HDK
|
The dialog script is a simple text-based language that describes a parameter interface. It is used to define parameter interfaces for HDA operators as well as custom parameter layouts with spare parameters for individual node instances.
Its basic syntax looks like:
Folders can be nested arbitrarily and there are many more folder types, parameter types and properties than illustrated in the above example.
Operator properties generally precede any parameters defined in the dialog script, though that is not required by the language. Many are only used in specific situations where the dialog script itself registers an operator.
Operator Property | Example | Notes |
---|---|---|
name | name "foo"
| The internal name of the operator. Used only when a dialog script registers an operator. |
label | label "Foo"
| The full name of the operator as it appears in the UI. Used only when a dialog script registers an operator. |
help | The help card for the operator. Used only when a dialog script registers an operator. | |
inputlabel | inputlabel 1 "Input 1"
| Input label to use for a particular input number. |
bindhandle | bindhandle tx sphere "Transformer" tx ""
| There is one bindhandle property for each parameter component bound to a handle. The usage is bindhandle <node parameter component> <handle type> <handle label> <handle parameter> <default_settings_string> . Only the default settings string from the first bindhandle property for a given handle is used. |
In the dialog script language, folders are defined by nesting parameters inside group objects.
The token used to declare the group determines the folder type.
Group Token | Folder Type |
---|---|
group | Tab. Adjacent groups append folders to the same switcher by default. |
groupradio | Radio. Adjacent groups append folders to the same switcher by default. |
groupcollapsible | Collapsible. Adjacent groups are unrelated. |
groupsimple | Simple outline. Adjacent groups are unrelated. |
Group Property | Example | Notes |
---|---|---|
name | name "folder1"
| The internal name of the switcher parameter. Where a switcher consists of multiple groups, only the name on the first group matters. |
label | label "Attributes"
| The folder label. |
tabbreak | tabbreak
| Used to end merging of adjacent tab or radio groups into the same switcher. |
disablewhen | disablewhen "{ enable_switcher == 0 }"
| Used to control disabling of all folders in a switcher. |
disablewhentab | disablewhentab "{ enable_folder == 0 }"
| Used to control disabling of a single folder. |
hidewhen | hidewhen "{ hide_switcher == 0 }"
| Used to control visibility of all folders in a switcher. |
hidewhentab | hidewhentab "{ hide_folder == 0 }"
| Used to control visibility of a single folder. |
parmtag | parmtag { "group_default" "1" }
| General purpose switcher level tag. Syntax is |
grouptag | grouptag { "sidefx::look" "blank" }
| General purpose folder level tag. Syntax is |
The type of a parameter is set by the type
property in the parm
block. See Houdini docs for parm types for more details.
Type | Type Label on Edit Type Properties Dialog |
---|---|
angle | Angle |
button | Button |
buttonstrip | Button Strip |
color | Color |
color4 | Color and Alpha |
data | Data |
direction | Direction Vector |
directory | File - Directory |
file | File |
float | Float |
float_minmax | Min/max Float |
geometry | File - Geometry |
geometrydata | Geometry Data |
huecircle | Hue Circle |
iconstrip | Icon Strip |
image | File - Image |
int | Integer |
integer | Integer |
intlog | Logarithmic Integer |
int_minmax | Min/max Integer |
intvector | Integer Vector 3 |
intvector2 | Integer Vector 2 |
intvector3 | Integer Vector 3 |
intvector4 | Integer Vector 4 |
keyvaluedict | Key-Value Dictionary |
label | Label |
log | Logarithmic Float |
oplist | Operator List |
oppath | Operator Path |
ordinal | Ordered Menu |
ramp_flt | Ramp (Float) |
ramp_rgb | Ramp (Color) |
rgb | Color |
rgba | Color and Alpha |
rgbamask | RGBA Mask |
separator | Separator |
string | String |
toggle | Toggle |
uv | UV |
uvw | UVW |
vector | Float Vector 3 |
vector2 | Float Vector 2 |
vector3 | Float Vector 3 |
vector4 | Float Vector 4 |
Several of the parameter types that appear in the Type Properties dialog are variations of a base type that are achieved by setting additional properties.
Variation | Key Properties |
---|---|
Label - Heading | type label
parmtag { "sidefx::look", "heading" }
|
Label - Message | type label
parmtag { "sidefx::look", "block" }
|
Spacer | type separator
parmtag { "sidefx::look", "blank" }
parmtag { "sidefx::layout_height", "small" }
|
Parm Property | Examples | Notes |
---|---|---|
name | name "attribmask"
| The internal name of the parameter from which channel names are derived. |
label | label "Attribute Mask"
| The label displayed in the parameter dialog. |
type | type float
| The type of the parameter. See the previous section for allowed types. |
baseparm | baseparm
| Used in custom parameter layouts to differentiate base parameters from spare parameters. Base parameters are part of the operator definition and the changes that can be applied to them by a custom layout are limited. |
callback | callback "hou.phm().callback(kwargs)"
| Sets the callback script. Equivalent to using parmtag to set "script_callback", which should be preferred to using this property. |
cppname | cppname "AttribMask"
| This name is used in place of an automatically capitalized version of name during proto generation from embedded dialog scripts. |
default | default { "0" "0" "1" }
default { [ "3*ch(\"otherparm\")" hscript-expr ] }
| The default value(s) for the parameter. The second form, which uses |
defaults | defaults { "0" "0" "1" }
| See default. |
disablewhen | disablewhen "{ enable_switcher == 0 }"
| Used to control disabling of the parameter. |
export | export none
| Used to control export to additional dialogs. A value of 0 or none means the parameter is only available in the main parameter dialog. A value of 1 or dialog means the parameter is available in the main parameter dialog and the viewer state dialog. A value of 2 or all means that the parameter is availble in the main parameter dialog, viewer state dialog, and the viewer toolbox. |
hidewhen | hidewhen "{ hide_switcher == 0 }"
| Used to control visibility of the parameter. |
invisible | invisible
| Used to flag a parameter as invisible. Invisible parameters do not appear in the dialog, but can still be queried or set by scripts. |
joinnext | joinnext
| Put the next parameter on the same line as this parameter. Most commonly used with toggles. |
menu | menu {
[ "items = [\"tokenA\" \"Label A\" \"tokenB\" \"Label B\"]" ]
[ "return items" ]
language python
}
| Turns the parameter into a menu. Menu items are specified, either as a hard-coded list or a script that returns them. Script lines are enclosed in []. Most commonly used with 'ordinal' or 'string' type parameters. |
menujoin | Turns the parameter into a menu and joins it horizontally with the next parameter. Houdini uses this style for menus that modify the operation of the following parameter. A script can be used, as with menu. | |
menumini | Displays the parameter as "mini" pop-up menu. This only shows a small button to open the menu, instead of showing the current value. Usually joined to the previous parameter (see joinnext) and combined with a callback script to execute actions on item selection. A script can be used, as with menu. | |
menureplace | Displays the parameter as a regular field, with a mini pop-up menu at the end from which they can choose items. Choosing an item replaces the contents of the field. A script can be used, as with menu. | |
menutoggle | Displays the parameter as a regular field, treated ass a space-separated lisst of keywords, with a mini pop-up menu at the end from which they can choose items. Choosing an item adds its token to the list or removes it if it is already there. A script can be used, as with menu. | |
nolabel | nolabel
| Hides the parameter label in the dialog. Most commonly used when joining parameters on the same line. |
parmtag | xi
parmtag { "script_callback" "hou.phm().callback(kwargs)" }
parmtag { "script_callback_language" "python" }
| General purpose tag. Syntax is |
proto_includeraw | proto_includeraw
| Tells the proto generation to create a raw string field instead of a normal string field during proto generation. This will create raw_ prefixed accessors that can be used to get the raw string from OP_Utils::evalOpParmRaw(). |
range | range { 0 1 }
range { 1! 10 }
| Specifies the range for numeric parameters. If the minimum or maximum value ends with an ! character, then the parameter interface will prevent the user from manually entering values lower and/or higher than that bound. |
size | size 3
| Tuple size. |
In the dialog script language, multiparms are defined by nesting "instance" parameters inside multiparm objects. Instance parameter names should contain a # character for each level of nesting inside a multiparm, which will be replaced by the index inside the multiparm as these are instanced.
The token used to declare the multiparm determines the multiparm type.
Multiparm Token | Multiparm Type |
---|---|
multiparm | List style multiparm that adds the instanced parameters as part of the normal parameter layout. |
multiscroll | Scrolling style multiparm that adds the instanced parameters inside a scrolling region so that the dialog itself doesn't grow in height. |
multiswitcher | Tab style multiparm that puts set of instance parameters into a separate tab. |
Multiparm Property | Example | Notes |
---|---|---|
name | name "numattribs"
| The internal name of the multiparm. |
label | label "Number of Attributes"
| The label for the multiparm. |
baseparm | baseparm
| Used in custom parameter layouts to differentiate base parameters from spare parameters. Base parameters are part of the operator definition and the changes that can be applied to them by a custom layout are limited. |
default | default 5
default { 5 }
| Default value for the multiparm. Unlike regular parameters, multiparms are never tuples, and so the enclosing {} are optional. |
disablewhen | disablewhen "{ enable_multiparm == 0 }"
| Used to control disabling of the multiparm. |
hidewhen | hidewhen "{ hide_multiparm == 0 }"
| Used to control visibility of the multiparm. |
parmtag | parmtag { "multistartoffset" "1" }
| General purpose tag. Syntax is |
This section provides dialog script examples for common parameter interfaces.
Value is an integer, but is saved to hip files as the entry token, allowing menu order to be safely changed.
Menu script returns a flat list of strings, where the even items are tokens and the odd items are labels.
A basic toggle parameter.
A toggle parameter joined to a string field that also controls whether the string field is enabled.
A basic float parameter with a single field.
A float parameter with a single field whose value can be optionally scaled by an attribute.
A basic float parameter with two fields.
A basic float vector parameter with three fields. Chief difference from a float tuple is the channel name suffixes are x,y,z instead of 1,2,3.
The "autoscope" tag value is a bit field specifying which components automatically get scoped in the channel editor when a node is selected.
In old versions of Houdini this had a different UI than a plani vector parameter, but that is no longer the case.
Script arguments are passed via the kwargs dictionary. The arguments are the same as for hscript with additional HOM objects for the node and parm.
Script arguments are available as local variables.
Buttons in a toggle button strip are defined by a menutoggle property. For a regular button strip, only the menu item labels are used.
Buttons in a radio button strip are defined by a menu property. For a regular button strip, only the menu item labels are used.
Buttons in a toggle icon strip are defined by a menutoggle property. The menu item tokens specify the icons while the labels will be used as tooltips.
Buttons in a radio icon strip are defined by a menu property. The menu item tokens specify the icons while the labels will be used as tooltips.
Collapsible folders are closed by default. A parmtag can be used to control this default state.
These are very common parameters on SOP operators.
A string parameter with a mini toggle menu populated with input attributes.
A string parameter with a mini menu for setting the value to an input attribute.
A color ramp parameter configured with a default ramp.
A float ramp parameter configured with a default ramp.
Unlike for normal parms, the default value does not have to be enclosed in {}, though it can be if so desired.