On this page |
The asset parameters that are exposed on a Houdini asset are represented as Maya node attributes on the houdiniAsset
node. The parameters can be manipulated through Maya’s Attribute Editor. Also, since asset parameters are regular node attributes, built-in Maya tools can be used with the asset parameters. For example, they can be driven by Maya’s animation curve, or accessed via MEL’s getAttr
and setAttr
.
Note
Parameters that are marked as invisible are not represented on the houdiniAsset
node. So they are not accessible from inside Maya.
Houdini assets support a wide range of parameter types and configurations. However, not all of those parameter types and configurations are supported by the plug-in.
Dynamic options such as Disable When
and Hide When
are not supported.
Basic ¶
Float, integer, and string type parameters are supported. Tuples are also supported. For float and integer type parameters, range and locked range are also supported.
Note that for logarithmic float and integer parameters, they are treated as regular float and integer parameters. So the UI sliders for the parameters are linear, and not logarithmic.
Color parameters are supported, and the standard Maya color widget is shown in the Attribute Editor. However, Color and Alpha parameters does not have a color widget, and are displayed as a 4-tuple float.
Toggle parameters are supported.
For string parameters, clicking the Edit
button will pop up a separate dialog for editing the string. This can be used to multi-line strings.
Adding the sidefx::maya_component_selection_type
tag to the parameter will instruct Maya that it should accept component selections of the given type. Supported types are vertex, edge, face and uv. In this case, the Edit button will be replaced with a Use Selected button.
Ramp ¶
Float and color ramp parameters are supported.
Operator Path ¶
Operator Path parameters are supported if the Op Filter
is set to Any Object or Any SOP. Maya geometries can be connected to these parameters. Similar to Inputs
, the connected Maya geometries are sent through Houdini Engine, and available as an input node on the Houdini side. The path of the input node is then set to the parameter. See Inputs for more details.
Button ¶
Folder and Multiparm ¶
Folder parameters are supported. They are represented as compound attributes, and any child parameters inside the folder parameter are represented as child attributes of the compound attribute.
In the Attribute Editor, folder parameters are displayed as collapsible frames. Collapsible
, Simple
, and Tabs
type folders are all displayed in the same way. Radio Buttons
type folders are not supported.
Collapsible frames are expanded by default. Although the frames can be collapsed inside the Attribute Editor, the collapsed states are not remembered, so refreshing the Attribute Editor would cause all the frames to be expanded again.
Multiparm ¶
Multiparm
type folders are supported. They are represented as compound multi attributes. In the Attribute Editor, they are displayed with a custom UI that allow adding and removing multiparm instances.
Multiparm nested inside another multiparm is not supported at the moment.
There is one important thing to note when using multiparm. If the multiparm is defaulted to 0 size, when the asset node is first loaded, the child parameters are not known in the Maya side yet. This means when the first multiparm instance is added, the child parameters are not immediately visible until the node’s attributes are sync'd. Similarly, if the multiparm size reaches zero, and the node’s attributes are sync'd, then the child parameters of the multiparm are no longer known in the Maya side.
Menu ¶
Callback Script ¶
Running Callbacks in Houdini when a Parm is Modified ¶
Callback Scripts can be configured on parameters.
However, it is important to note that the callback script is not triggered until Maya evaluates the asset node. So if the button is clicked via script, it’s generally a good idea to force the asset node to evaluate. This can be done via dgeval
. For example, the following MEL commands will click a button parameter, and ensure the callback script is triggered:
setAttr foo1.houdiniAssetParm_parm__button 1; dgeval foo1.output;
If a parameter’s callback modifies any other parameters, it is recommended that it be tagged with the built-in sidefx::maya_parm_affects_others
tag. This notifies Maya that it should sync every attribute when this parameter has been modified. If an entire asset sync is required, tag the parm with the built-in sidefx::maya_parm_syncs_asset
tag.
Running Callbacks in Maya when a Parm is Modified ¶
To trigger a Maya script when a parm is modified, the built-in sidefx::maya_parm_callback_func
tag must be defined on the parm. This instructs Maya which function should be called when the parm is modified. Both MEL and Python functions are supported, however MEL is the default. If you wish for a Python function to be called, you must additionally include the sidefx::maya_parm_callback_func_language
built-in tag on the parm and set its value to python
.
In both languages, the callback function must receive a single argument. This argument will hold the source of callback. Eg. if the parm
parm on the Houdini asset foo1
is modified, it will pass “foo1.houdiniAssetParm_parm__button” to the callback function specified by sidefx::maya_parm_callback_func
. Therefore callback functions should be defined in the following way:
// MEL global proc myCallback(string $plug) { print("Caught message from " + $plug + "!\n"); } # Python def myCallback(plug): print('Caught message from ' + plug + '!')
In this case, sidefx::maya_parm_callback_func
would be defined as myCallback
, and sidefx::maya_parm_callback_func_language
would be defined as either Python
or (optionally) MEL
.
Animation and Expression ¶
Houdini asset’s parameters can be controlled by Maya’s animation curves and expressions. In most cases, the asset will cook correctly according to the animations and expressions. However, in more advanced usages, there may be situations where the result may be incorrect due to the following reasoning.
Houdini Engine uses a push mechanism when cooking assets. Before the asset is cooked, parameter values for the current time are pushed to the asset. In another words, when the asset cooks, only the parameter values for the current time are available to the asset. In fact, from the asset’s point of view, the parameters are not animated at all. The asset simply gets a snapshot of all the parameter values and then cooked. So if the asset requires parameter values from multiple time samples to correctly cook for a single time sample, then the asset will not cook properly through Houdini Engine at the moment.
Houdini Expression ¶
For string parameters, the string values are actually evaluated as Houdini Expressions. This makes it possible to enter Houdini Expressions directly inside Maya’s Attribute Editor. For numeric parameters, since Maya’s Attribute Editor will display a numeric widget, it is not possible to directly enter Houdini Expressions. If a numeric Houdini Expression is needed, one method is to create a string parameter on the asset level, then reference the string parameter in a numeric context inside the asset. This will cause the result of the expression be converted into a numeric value. However, the caveat is that the string parameter will not get a numeric widget inside Maya’s Attribute Editor.