hkb_editor.workflows.apply_template
¶
apply_template
¶
apply_template(
behavior: HavokBehavior,
template: TemplateContext,
args: dict[str, Any],
logger: Logger = None,
) -> list[HkbRecord]
Run a template and return the objects it created.
Argument values are resolved to the types the template expects first. On failure any changes already recorded are undone and the original exception is re-raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
behavior
|
HavokBehavior
|
Behavior to modify. |
required |
template
|
TemplateContext
|
The loaded template. |
required |
args
|
dict
|
Maps argument name to its |
required |
logger
|
Logger
|
Where to report progress; defaults to the module logger. |
None
|
Returns:
| Type | Description |
|---|---|
list of HkbRecord
|
Objects added to the behavior, in creation order. |
coerce_template_arg
¶
coerce_template_arg(arg_type: type, value: Any) -> Any
Turn a widget value back into what the template argument expects.
Combos hand back strings, so Literal and Enum arguments have to be looked up again. Simple types and HkbRecord pass through unchanged.