See recipes for more information.
Functions ¶
Recipes ¶
saveNodePresetRecipe(name: str, label: str, location: str, node: hou.OpNode, nodetype_patterns: str="", comment: str="", nodes_only=False, children=False, editables=False, inputs=False, outputs=False, position=False, flags=True, parms: Union[bool, Sequence[hou.ParmTuple], Sequence[str]] = True, spareparms=True, parms_as_brief=True, default_parmvalues=False, evaluate_parmvalues=False, parmtemplates="spare_only", metadata=False, verbose=False) -> None
Saves parameters from a node as a preset recipe. To apply parameters saved in a recipe, use hou.data.applyNodePresetRecipe.
name
The internal name for the Data asset to store the recipe in.
label
The label for the recipe, used in menus where the user can select the recipe.
location
A string representing the path to the asset library (.hda
file) to save the recipe asset into. Alternatively, if you use an opdef:
path, such as opdef:/Sop/my_asset
to reference an existing asset, Houdini will save the new recipe asset into the same library file as the referenced asset.
If you use the special string Embedded
, the asset will be saved as part of the current scene file. This is sometimes useful for sharing a self-contained, working scene file.
node
A hou.OpNode instance to save data from.
nodetype_patterns
Houdini will show this as an available preset for node types whose internal name (with category, as in the string returned by hou.NodeType.nameWithCategory) matches this pattern. See Target node patterns for more information. If this is empty, the recipe uses a pattern that only matches the node type of the node
argument.
children
If this is False
, the recipe only captures the top level nodes, ignoring nodes inside subnets and unlocked assets.
editables
If this is False
, the recipe ignores nodes inside editable dive target networks inside assets.
inputs
If this is True
, the recipe captures input connections.
outputs
If this is True
, the recipe captures output connections.
position
If this is True
, the recipe captures the node position.
parms
If this is True
, the recipe captures any non-default parameter values, and spare parameters (depending on the default_parmvalues
and spareparms
arguments). If this is False
, the recipe does not capture any parameters. Alternatively, you can specify a list of hou.ParmTuple or hou.Parm instances, or strings representing names of parameters to capture.
See common save options below.
applyNodePresetRecipe(name: str, node: hou.OpNode, parmsTrue, parmtemplates=True, children=True, editables=True, skip_notes=True)
→ dict[str, Any]
Applies the recipe specified by name
to the given hou.OpNode instance.
name
The internal name of the recipe to apply to node
.
node
A hou.OpNode instance to apply the recipe to.
See common apply options below.
Returns a dictionary containing information about how the recreated contents of the recipe.
saveDecorationRecipe(name: str, label: str, location: str, central_node: [hou.OpNode], decorator_items: Collection[hou.NetworkItem], nodetype_patterns="", comment="", generic_tags: Sequence[hou.NetworkItem]=None, selected_node: hou.NetworkMovableItem=None, nodes_only=False, central_children=False, children=True, central_editables=False, editables=True, flags=False, central_parms: Union[bool, Sequence[hou.ParmTuple], Sequence[str]]=True, parms=True, spareparms=True, parms_as_brief=True, default_parmvalues=False, evaluate_parmvalues=False, parmtemplates="spare_only", metadata=False, verbose=False) -> None
Saves a set of network items as a decoration recipe. To apply a saved decoration recipe, use hou.data.applyDecorationRecipe.
name
The internal name for the Data asset to store the recipe in.
label
The label for the recipe, used in menus where the user can select the recipe.
location
A string representing the path to the asset library (.hda
file) to save the recipe asset into. Alternatively, if you use an opdef:
path, such as opdef:/Sop/my_asset
to reference an existing asset, Houdini will save the new recipe asset into the same library file as the referenced asset.
If you use the special string Embedded
, the asset will be saved as part of the current scene file. This is sometimes useful for sharing a self-contained, working scene file.
central_node
A [Hom:hou.OpNode]
instance to use as the “central” node of the decoration. See decoration recipes for more information.
decorator_items
A collection of hou.NetworkMovableItem instances to capture as the contents of the recipe.
nodetype_patterns
Houdini will show this as an available preset for node types whose internal name (with category, as in the string returned by hou.NodeType.nameWithCategory) matches this pattern. See Target node patterns for more information. If this is empty, the recipe uses a pattern that only matches the node type of the node
argument.
children
Whether to recursively save the contents of subnetworks and unlocked assets other than the central node.
central_children
Whether to recursively save the contents of the central node (if it is a subnetwork or unlocked asset).
editables
Whether to save the contents of editable dive targets inside assets other than the central node.
central_editables
Whether to save the contents of editable dive targets inside the central node, if any.
parms
Whether to save parameter values on nodes other than the central node.
central_parms
If this is True
, the recipe captures any non-default parameter values, and spare parameters (depending on the default_parmvalues
and spareparms
arguments). If this is False
, the recipe does not capture any parameters. Alternatively, you can specify a list of hou.ParmTuple or hou.Parm instances, or strings representing names of parameters to capture.
See common save options below.
applyDecorationRecipe(name: str, central_node: hou.OpNode, insert_mode=False, parms=True, parmtemplates=True, children=True, editables=True, skip_notes=True) -> dict[str, Any]
Applies the decoration recipe specified by name
to the given hou.OpNode instance.
name
The internal name of the recipe to apply to node
.
central_node
The “target” hou.OpNode instance to apply the decoration to. Parameters saved from the central node in the recipe are applied to this node, and decoration items from the recipe are recreated around it.
insert_mode
Rewire existing connections into and out of the given node.
See common apply options below.
saveTabToolRecipe(name: str, label: str, location: str, anchor_node: hou.Node, items: Sequence[hou.NetworkMovableItem]=None, tab_submenu="Recipes", icon="BUTTONS_recipe", comment="", generic_tags: Sequence[hou.NetworkMovableItem] = None, selected_node: hou.NetworkMovableItem = None, nodes_only=False, central_children=False, children=True, central_editables=False, editables=True, flags: bool=False, central_parms: Union[bool, Sequence[hou.ParmTuple], Sequence[str]] = True, parms=True, spareparms=True, parms_as_brief=True, default_parmvalues=False, evaluate_parmvalues=False, parmtemplates="spare_only", metadata=False, verbose=False) -> None
name
The internal name for the Data asset to store the recipe in.
label
The label for the recipe, used in menus where the user can select the recipe.
location
A string representing the path to the asset library (.hda
file) to save the recipe asset into. Alternatively, if you use an opdef:
path, such as opdef:/Sop/my_asset
to reference an existing asset, Houdini will save the new recipe asset into the same library file as the referenced asset.
If you use the special string Embedded
, the asset will be saved as part of the current scene file. This is sometimes useful for sharing a self-contained, working scene file.
anchor_node
A hou.OpNode instance to include as part of the recipe. When you drop the tool in a network later, the position you choose is applied to this node, and the other items in the recipe are positioned relative to it.
items
A collection of hou.NetworkMovableItem instances to include in the tool recipe.
children
Whether to recursively save the contents of subnetworks and unlocked assets other than the central node.
central_children
Whether to recursively save the contents of the central node (if it is a subnetwork or unlocked asset).
editables
Whether to save the contents of editable dive targets inside assets other than the central node.
central_editables
Whether to save the contents of editable dive targets inside the central node, if any.
parms
Whether to save parameter values on nodes other than the central node.
central_parms
If this is True
, the recipe captures any non-default parameter values, and spare parameters (depending on the default_parmvalues
and spareparms
arguments). If this is False
, the recipe does not capture any parameters. Alternatively, you can specify a list of hou.ParmTuple or hou.Parm instances, or strings representing names of parameters to capture.
See common save options below.
applyTabToolRecipe(name: str, kwargs: dict[str, Any], parms=True, parmtemplates=True, children=True, editables=True, skip_notes=True) -> dict[str, Any]
Recreates the contents of a tool recipe, as if the user had chosen the recipe from the tab menu in a network editor.
name
The internal name of the recipe to apply to node
.
kwargs
A dictionary containing arguments to pass to the tool script when it runs. Normally this is created by Houdini when the user chooses a tool from the tab menu, but to run the recipe programmatically you must create this dictionary yourself. The dictionary should contain the following keys:
pane
A hou.NetworkEditor instance in which to run the tool.
inputs
An optional sequence of node names. If non-empty, this simulates the user starting an output wire and then choosing the tool from the tab menu, or dropping the tool on an existing wire.
outputs
An optional sequence of node names. If non-empty, this simulates starting an input wire and then choosing the tool from the tab menu, or dropping the tool on an existing wire.
nodepositionx
, nodepositiony
The network editor position at which to create the tool contents. This simulates the user clicking the position after choosing the tool.
See common apply options below.
Common recipe save options ¶
comment
Optional comment string to associate with the recipe.
flags
If this is True
, the recipe captures flag states.
nodes_only
If this is True
, the recipe only saves nodes, ignoring sticky notes, network boxes, and dots.
selected_node
(For tool and decoration recipes.) An optional hou.NetworkMovableItem instance. Specifies which item should be selected after applying the recipe.
spareparms
If this is True
, the recipe captures any spare parameters on the node.
parms_as_brief
Normally, the recipe stores parameters in a compact form where possible. If this is False
, it stores all parameters with full structure. This option mainly exists for debugging.
default_parmvalues
Normally, when parms
is True
, the recipe only captures parameters with non-default values. If this is True
, the recipe also captures parameters set to the default value. If the parms
argument is a list of parameters to capture, this is ignored.
evaluate_parmvalues
If this is True
, the recipe captures the evaluated value of the parameters at the current time (including expanding variables in strings), instead of capturing expressions and keyframe animation.
parmtemplates
If this is "spare_only"
, the recipe only captures parameter template data for spare parameters so it can recreate them. If this is "all"
, the recipe captures template data for all parameters. This option mainly exists for debugging.
metadata
If this is True
, the recipe captures additional information about the node.
verbose
Normally, the recipe does not capture options that can be inferred, such as options at their default value. If this is True
, the recipe captures every setting. This option mainly exists for debugging.
Common recipe apply options ¶
parms
If this is False
, do not apply any parameter data stored in the recipe to the node.
parmtemplates
If this is False
, do not apply any template settings or recreate any spare parameters stored in the recipe.
children
If this is False
, do not recursively recreate any child network data stored in the recipe.
editables
If this is False
, do not recreate the contents of any editable dive targets stored in the recipe.
skip_notes
If this is True
, do not recreate any sticky notes stored in the recipe.
As data functions ¶
dataFromParms(parms: Sequence[hou.ParmTuple], values=True, parms:Union[bool, Sequence[hou.ParmTuple], Sequence[str]] = True, default_values=False, evaluate_values=False, locked=True, brief=True, multiparm_instances=True, metadata=False, callback: Callable = None) -> dict[str, Any]
Returns a JSON-like data structure representing the given list of hou.ParmTuple objects.
selectedItemsAsData(nodes_only=False, children=True, editables=True, inputs=True, outputs=False, position=True, flags=True, parms=True, spareparms=True, parms_as_brief=True, default_parmvalues=False, evaluate_parmvalues=False, parmtemplates="spare_only", metadata=False, callback: Callable = None, anchor_position: hou.Vector2 = None) -> dict[str, Any]
Returns a JSON-like data structure representing the currently selected network items.
itemsAsData(items: Sequence[hou.NetworkMovableItems], nodes_only=False, children=True, editables=True, inputs=True, position=True, flags=True, parms=True, anchor_position: hou.Vector2 = None) -> dict[str, Any]
Returns a JSON-like data structure representing the given network items.
createItemsFromData(parent: hou.OpNode, data: dict[str, Any], external_connections=True, start_position: hou.Vector2 = None) -> dict[str, hou.NetworkMovableItem]
Given a network node and JSON-like data structure as returned by hou.data.itemsAsData()
, recreate the data items inside the network. Returns a dictionary mapping the names of the original captured items to the corresponding recreated items.
clusterItemsAsData(items: Sequence[hou.NetworkMovableItems], start_tags: Union[bool, Sequence[hou.NetworkMovableItems]] = True, end_tags: Union[bool, Sequence[hou.NetworkMovableItems]] = True, Union[bool, Sequence[hou.NetworkMovableItems]] = False, target_childen=False, target_editables=False, target_parms=True, action_behavior="default") -> dict[str, Any]
Returns a JSON-like data structure representing the given network items. The returned dictionary includes what would be returned by hou.data.itemsAsData()
in a key, along with various other properties related to the given items.
createClusterItemsFromData(parent: hou.OpNode, data: dict[str, Any], target_node: hou.Node = None, clear_content=False, external_connections=False, create_exteriors=False) -> dict[str, Any]
Given a network node and JSON-like data structure as returned by hou.data.clusterItemsAsData()
, recreate the data items inside the network. Returns a dictionary containing information about how the items were recreated.
See also |