The ParmTuple class behaves like a Python sequence, so you can index into it
using square brackets, iterate over it, call len
on it, etc. The elements
inside the parameter tuple are hou.Parm objects.
A parameter tuple’s name may only contain letters, numbers, and underscores.
For example, objects contain a parameter tuple named "t"
that contains three
integer parameters. The names of the parameters inside the tuple are
determined from the parameter tuple’s name and its naming scheme. For example,
the "t"
parameter uses the XYZW naming scheme, so the three parameters inside
it are named "tx"
, "ty"
, and "tz"
. Note that if the parameter tuple
only contains one parameter, the tuple and the parameter inside it may have the
same name.
In addition to a name, a parameter tuple also has a label that is displayed to
the user in the parameter dialog. For example, the "t"
parameter’s label is
"Translate"
. The label may contain spaces and punctuation characters.
Each parameter in a tuple stores a value. Different instances of parm tuples in different nodes will store their own set of parameter values. The value in a parameter may be animated, in which case the parameter evaluates to a different result depending on the current time on the playbar. See hou.Keyframe for more information about animated parameters.
Each hou.NodeType has a set of parameter tuple descriptions associated with it, and each instance of a hou.OpNode has a corresponding set of parameter tuple instances. The parameter tuples store specific values that are saved with the node. The descriptions of the parameter tuples, however, are represented by a hou.ParmTemplate. A parameter template describes the type, default values, ranges, etc. of a parameter tuple.
See also hou.parmTuple() and hou.OpNode.parmTuple.
Methods ¶
Operators ¶
__getitem__(index)
→ hou.Parm
Return the Parm object for the specified component of this parameter tuple. Negative indices will index from the end.
This method makes instances of this class appear like a tuple, and lets you iterate over the parms in a ParmTuple.
Raises IndexError if the index is not valid.
>>> parm_tuple = hou.node("/obj").createNode("geo").parmTuple("t") >>> for parm in parm_tuple: ... print parm.name(), tx ty tz >>> tuple(parm_tuple) (<hou.Parm tx in /obj/geo1>, <hou.Parm ty in /obj/geo1>, <hou.Parm tz in /obj/geo1>)
__len__()
→ int
Return the number of hou.Parms in this parameter tuple.
Metadata ¶
name()
→ str
Return the name of this parameter tuple. Note that the parameter tuple’s name and its naming scheme determine the names of the parameters inside it.
>>> node = hou.node("/obj").createNode("geo") >>> node.parmTuple("t").parmTemplate().namingScheme() parmNamingScheme.XYZW >>> [parm.name() for parm in node.parmTuple("t")] ['tx', 'ty', 'tz'] >>> parm_tuple = node.parent().createNode("cam").parmTuple("dcolor") >>> parm_tuple.parmTemplate().namingScheme() parmNamingScheme.RGBA >>> [parm.name() for parm in parm_tuple] ['dcolorr', 'dcolorg', 'dcolorb']
description()
→ str
Return this parameter tuple’s label that is displayed in the parameter dialog.
node()
→ hou.OpNode
Return the node containing this parameter tuple.
parmTemplate()
→ hou.ParmTemplate
Return this parameter tuple’s template.
Note that a folder parameter will have a hou.FolderSetParmTemplate template and a multiparm parameter will have a hou.FolderParmTemplate template.
isSpare()
→ bool
Returns whether the parameter is a “spare” (user-defined) parameter.
isTimeDependent()
→ bool
Returns whether any of the parameters in the tuple are time dependent,
that is, a parameter’s value changes depending on the point on the timeline
at which it’s evaluated. For example the parameter has an expression
containing the $F
(current frame number) variable.
lock(bool_values)
Lock or unlock all the parameters in this tuple. Houdini displays locked parameters as disabled and does not let you change their values.
bool_values
Either a single True
or False
value to be applied to all
components of this parameter or a sequence of them where each value
corresponds to a single component. Where an element of bool_values
is True
, that component will be locked (uneditable), and where
an element is False
, the corresponding component will be unlocked
(editable).
For example, the parameter tuple for “translation” contains Parm objects for translation along each of the axes, “tx”, “ty” and “tz”. If lock is called with the following tuple of boolean values, (True, True, False), then the parameter “tx” and “ty” will be locked and made non-editable, while “tz” will be unlocked and made editable.
Raises hou.InvalidSize if bool_values
has a different length than
this parameter tuple. Raises hou.PermissionError if any of the
parameters in this parameter tuple are not writable.
disable(on)
Sets the UI disable state of this parameter tuple in its node. This is not the same as locking a parameter, as the underlying value can still be modified. It’s closer to what a disable-when conditional does, when a parameter is disabled automatically by it.
isDisabled()
→ bool
Returns the disable state of the parameter tuple, ignoring the lock state. This can be used to read the result of a disable-when conditional.
It is recommended that hou.OpNode.updateParmStates is called before executing this method either in non-graphical Houdini or when the owner node has not yet been loaded into the Parameter Pane.
hide(on)
Sets the UI hidden state of this parameter tuple in its node.
Calling this method is equivalent to changing the Invisible
checkbox
on the Edit Parameter Interface
dialog, or hiding the parameter with
a hide-when conditional.
To hide a folder, use hou.OpNode.setParmTemplateGroup. This method cannot be used to hide a folder because a parm tuple corresponds to a set of folders, not an individual folder.
To change the visibility of all new instances of the node type defined by a digital asset, use hou.HDADefinition.setParmTemplateGroup as in the following example:
def showParmTupleInDefinition(parm_tuple, visible): '''parm_tuple is a hou.ParmTuple on an instance of the digital asset.''' definition = parm_tuple.node().type().definition() parm_template_group = definition.parmTemplateGroup() parm_template = parm_template_group.find(parm_tuple.name()) parm_template.hide(not visible) parm_template_group.replace(parm_tuple.name(), parm_template) definition.setParmTemplateGroup(parm_template_group)
isHidden()
→ bool
Returns the hidden state of the parameter tuple. This can be used to read the result of a hide-when conditional.
It is recommended that hou.OpNode.updateParmStates is called before executing this method either in non-graphical Houdini or when the owner node has not yet been loaded into the Parameter Pane.
isConstrained()
→ bool
Returns True if the Parm’s parent node is an OBJ that is cooked and has constraints.
Evaluation ¶
eval()
→ tuple of int
, float
, str
, or hou.Ramp
Evalute this parameter tuple at the current frame and returns the result as a tuple of integers, floats or strings, or a hou.Ramp object, depending on the type of the parameter.
See also the evalAtFrame and evalAtTime methods.
evalAtTime(time)
→ tuple of int
, float
, str
, or hou.Ramp
Evalute the parameter tuple at a given time and return the result as a tuple of integers, floats, strings, or a Ramp object, depending on the type of the parameter.
See also evalAtFrame.
evalAtFrame(frame)
→ tuple of int
, float
, str
, or hou.Ramp
Evalute the parameter tuple at a given frame and return the result as a tuple of integers, floats, strings, or a Ramp object, depending on the type of the parameter.
See also evalAtTime.
evalAsFloats()
→ tuple of float
Evaluates this parameter tuple at the current frame and returns the result as a tuple of floats.
Raises TypeError
if a value cannot be converted to a float.
evalAsFloatsAtFrame(frame)
→ tuple of float
Evaluates this parameter tuple at a certain frame and returns the result as a tuple of floats.
Raises TypeError
if a value cannot be converted to a float.
evalAsInts()
→ tuple of int
Evaluates this parameter tuple at the current frame and returns the result as a tuple of integers.
Raises TypeError
if a value cannot be converted to an integer.
evalAsIntsAtFrame(frame)
→ tuple of int
Evaluates this parameter tuple at a certain frame and returns the result as a tuple of integers.
Raises TypeError
if a value cannot be converted to an integer.
evalAsRamps()
→ hou.Ramp
Evaluates this parameter tuple at the current frame and returns the result as a tuple containing a hou.Ramp object.
Raises TypeError
if this is not a ramp parameter.
evalAsRampsAtFrame(frame)
→ hou.Ramp
Evaluates this parameter tuple at a certain frame and returns the result as a tuple containing a hou.Ramp object.
Raises TypeError
if this is not a ramp parameter.
evalAsStrings()
→ tuple of str
Evaluates this parameter tuple at the current frame and returns the result as a tuple of strings.
Raises TypeError
if a value cannot be converted to a string.
evalAsStringsAtFrame(frame)
→ tuple of str
Evaluates the parameter tuple at a frame and returns the result as a tuple of strings.
Raises TypeError
if a value cannot be converted to a string.
evalAsGeometries()
→ tuple of hou.Geometry
Evaluates this parameter tuple at the current frame and returns the result as a tuple containing a hou.Geometry object.
Raises TypeError
if a value cannot be converted to a
hou.Geometry.
evalAsGeometriesAtFrame(frame)
→ tuple of hou.Geometry
Evaluates this parameter tuple at a certain frame and returns the result as a tuple containing a hou.Geometry object.
Raises TypeError
if a value cannot be converted to a
hou.Geometry.
evalAsJSONMaps()
→ tuple of dict of str
to str
Evaluates this parameter tuple at the current frame and returns the result as a tuple containing JSON map structures (i.e. Python dictionary).
Raises TypeError
or hou.OperationFailed if the parameter
tuple is not a JSON map data parameter tuple.
evalAsJSONMapsAtFrame(frame)
→ tuple of dict of str
to str
Evaluates this parameter tuple at a certain frame and returns the result as a a tuple containing JSON map structures (i.e. Python dictionary).
Raises TypeError
or hou.OperationFailed if the parameter
tuple is not a JSON map data parameter tuple.
Setting ¶
set(values, language=None, follow_parm_references=True)
Sets the values of the parameters in the tuple at the current frame.
values
A sequence of floats, integers or strings, corresponding to the components of this parameter tuple.
For example, the parameter tuple for “translation” contains hou.Parm objects for translation along each of the axes, “tx”, “ty” and “tz”. If set is called with the following tuple of floats, (2.5, 4.0, 5.5), then the parameter “tx” with be set to 2.5, “ty” will be set to 4.0 and “tz” will be set to 5.5.
You can also pass in a hou.ParmTuple object for this argument to create channel references from the parameters in this tuple to the parameters in the passed-in tuple. If this tuple has more parameters than the passed-in tuple then no work is performed on the extra parameters. If the passed-in tuple has more parameters than this tuple then the extra parameters are ignored.
language
This option only applies when setting to a hou.ParmTuple value.
Specifies the expression language to use when creating channel
references from this parameter tuple to the given parameter tuple. Set
this option to an hou.exprLanguage object or None
to choose the
default language.
follow_parm_references
This option only applies when setting to a hou.Parm value and it defines which hou.Parm gets modified.
When this option is set to True
then this method will first follow
current channel references on this hou.Parm to determine the
hou.Parm that will be modified. It acts to keep the chain of
references and will set a new channel reference on the hou.Parm
that doesn’t have one yet.
When False
, the current hou.Parm is modified directly and the
chain of references is broken if there was an existing channel reference.
If this parameter tuple currently contains channel references to another parameter tuple, then this method will follow channel references and change the value of the referenced parameter tuple. If this is not the desired behavior, then first delete the channel reference with hou.Parm.deleteAllKeyframes or hou.Parm.revertToDefaults for string parameters that don’t have the channel reference embedded in their string value.
Raises hou.InvalidSize if values
has a different length than this
parameter tuple. Raises hou.PermissionError if any of the parameters
in this parameter tuple are not writable.
Animation ¶
saveClip(file_name, start=None, end=None, sample_rate=0)
Saves the animation associated with the parameters of this tuple to the clip file specified by ‹file_name›. The extension of ‹file_name› determines the format of the saved file.
You can use one of the following extensions:
-
.clip
: save animation as plain text (ASCII) clip file. -
.bclip
: save animation as a bclip (binary clip) file. -
.bclip.sc
: save animation as a bclip file using Blosc compression.
Set ‹sample_rate› to a non-zero, non-negative value to specify the sample_rate to be used for the clip file. For example, if the current frame rate is 24 (hou.fps()), and ‹sample_rate› is set to 12, the animation will be sampled every second frame since ‹sample_rate› is half of the current frame rate.
If ‹start› is not None
, start saving the animation from the specified
frame (inclusive).
Otherwise, the animation will be saved from the global start frame (inclusive).
Similarly, if ‹end› is not None
, stop saving the animation at the
specified frame (inclusive).
Otherwise, the animation will be saved until the global end frame (inclusive).
The global start and end frame are specified in the Global Animation Options window.
Raises a hou.OperationFailed exception if none of the parameters of this tuple have animation.
Raises a hou.OperationFailed exception if there is an error saving the animation to file.
Raises a hou.InvalidInput exception if start >= end
. If specifying only
‹start›, ensure that the specified value is less than the global
end frame. Likewise, if specifying only ‹end›, ensure it is larger than
the global start frame.
loadClip(file_name, sample_rate=0, start=None)
Load animation for the parameters in this tuple from the clip file specified by ‹file_name›. See hou.ParmTuple.saveClip for the list of supported clip file formats.
Any tracks in the clip file that do not match the name of the parameters of this tuple will be ignored.
If ‹sample_rate› is set to a non-zero, non-negative value, the specified value will be used when loading the animation. For example, if the current frame rate is 24 (hou.fps()) and ‹sample_rate› is set to 12, the animation will be loaded with a keyframe at every second frame since ‹sample_rate› is half of the current frame rate.
‹start› specifies the frame the loaded animation should start from. By default the animation starts at the frame specified in the clip file.
Warning
Any existing keyframes for the parameters of this tuple that are within the range of the loaded animation will be overwritten with the loaded data.
This function will raise a hou.OperationFailed exception if there is an error reading animation data from the file.
clipData(start=None, end=None, binary=True, use_blosc_compression=True, sample_rate=0)
→ str
for Python 2, bytes
for Python 3
Returns the clip data for the parameters of this tuple. This method is similar to hou.ParmTuple.saveClip, except that it returns the clip data (file contents) instead of saving the animation to a clip file.
‹start›, ‹end›, and ‹sample_rate› behave the same as in hou.ParmTuple.saveClip.
If ‹binary› is True
, return binary clip data otherwise, return plain
text (ASCII) clip data.
If ‹use_blosc_compression› is True
, blosc compress the binary clip data.
This cannot be used for plain text (ASCII) clip data.
The returned clip data is a bytes
object in Python 3 and a str
object in Python 2. See HOM binary data for
more information.
Raises a hou.OperationFailed exception if none of the parameters of this tuple have animation.
Raises a hou.InvalidInput exception if start >= end
. If specifying only
‹start›, ensure that the specified value is less than the global
end frame. Likewise, if specifying only ‹end›, ensure it is larger than
the global start frame.
Raises a hou.InvalidInput exception if binary = False
and
use_blosc_compression = True
.
setClipData(data, binary=True, blosc_compressed=True, sample_rate=0, start=None)
Load animation for the parameters of this tuple from the given clip ‹data›. This method is similar to hou.ParmTuple.loadClip, except that it loads animation from the given clip data instead of a clip file.
‹sample_rate› and ‹start› behave the same as in hou.ParmTuple.loadClip.
‹binary› and ‹blosc_compressed› specify the type of input data.
If ‹binary› is True
, the given data is binary clip data otherwise, it
is plain text (ASCII) clip data.
If ‹blosc_compressed› is True
, the given data is blosc compressed
binary data. This cannot be used for plain text (ASCII) clip data.
The data must be a bytes
object in Python 3 and a str
object in Python 2. See HOM binary data for more
information.
Raises a hou.OperationFailed exception if the given data is invalid.
Raises a hou.InvalidInput exception if binary = False
and
blosc_compressed = True
.
setPending(values)
Sets the value of a parameter in the tuple at the current frame and marks it as pending if the parameter is keyed.
values
A sequence of floats or strings, corresponding to the components of this parameter tuple.
For example, the parameter tuple for “translation” contains Parm objects for translation along each of the axes, “tx”, “ty” and “tz”. If set is called with following tuple of floats, (2.5, 4.0, 5.5), then the parameter “tx” with be set to 2.5, “ty” will be set to 4.0 and “tz” will be set to 5.5.
Raises hou.InvalidSize if values
has a different length than this
parameter tuple. Raises hou.PermissionError if any of the parameters
in this parameter tuple are not writable.
deleteAllKeyframes()
Remove all the keyframes from this parameter tuple.
This method be approximately implemented as follows:
def deleteAllKeyframes(self): for parm in self: parm.deleteAllKeyframes()
See also hou.Parm.deleteAllKeyframes.
deleteKeyframeAtFrame(frame)
Removes a keyframe from this parameter tuple at the given frame.
This function will raise a hou.ObjectWasDeleted exception if it is invoked on a parameter that does not exist in Houdini.
This function will raise a hou.PermissionError exception if writing to the specified parameter is impossible.
This function will raise a hou.OperationFailed exception the parameter doesn’t have a keyframe at the given frame.
See also hou.ParmTuple.deleteAllKeyframes.
setAutoscope(bool_values)
Changes the autoscope property of components of this parameter tuple.
bool_values
A sequence of True
or False
values, where each value corresponds
to a component of this parameter. Where an element of bool_values
is True
, that component will be autoscope.
For example, the parameter tuple for “translation” contains Parm objects for translation along each of the axes, “tx”, “ty” and “tz”. If setAutoscope is called with the following tuple of boolean values, (True, True, False), then the parameter “tx” and “ty” will be automatically scoped, while “tz” will not.
Raises hou.InvalidSize if values
has a different length than this
parameter tuple. Raises hou.PermissionError if any of the parameters
in this parameter tuple are not writable.
setKeyframe(keyframe_vector)
Sets a keyframe on this parameter.
keyframe_vector
A sequence of keyframes for each component of the parameter tuple.
Raises TypeError
if keyframe
is not of type
hou.BaseKeyframe. Raises hou.PermissionError if this parameter
is not writable. Raises hou.InvalidSize if keyframe_vector
has a
different length than this parameter tuple.
Expressions ¶
isShowingExpression()
→ bool
Return whether this parameter is shown as an expression or as the
See also the showExpression()
method.
showExpression(on)
Sets the UI for the parm to show the expression instead of the value.
See also the isShowingExpression()
method.
Defaults ¶
overwriteDefaults()
Overwrite the default values with the current parameter tuple values.
revertToAndRestorePermanentDefaults()
Changes the value back to the defaults that ship with Houdini, and restore those defaults.
See also the revertToDefaults()
method.
revertToDefaults()
Changes the value back to the default(s).
See also the revertToAndRestoreFactoryDefaults()
method.
isAtDefault(compare_temporary_defaults=True, compare_expressions=False)
→ bool
Returns whether the parameter tuple is currently at its defaults.
compare_temporary_defaults
:
When ‹compare_temporary_defaults› is True, isDefault
also checks
compare_expressions
:
When ‹compare_Expressions› is True, isDefault
compares the actual
See also the revertToDefaults()
and
revertToAndRestorePermanentDefaults()
methods.
isAtRampDefault()
→ bool
Returns whether the ramp parameter is currently at its default.
This tests all of the multiparm parameters associated with the ramp by comparing to the special ramp default spare paramater data. Ramps with no default spare data will never be at default.
Multiparms ¶
isMultiParmInstance()
→ bool
Return whether this parameter is an instance of a multi parm. For example,
the pt0
, pt1
, pt2
, etc. parameter tuples in an add
SOP are
instances of a multiparm.
isMultiParmParent()
→ bool
Return whether this parameter is a parent multi parm, the number of instances parameter or returns None otherwise
parentMultiParm()
→ hou.Parm
Return the parent multi-parameter if this parameter is a multi-parameter instance and None otherwise.
multiParmInstanceIndices()
→ tuple of int
If this parameter is a multi-parameter instance, then return a tuple of indices of where the parameter appears in the multi-parameter block and any nested blocks. Indices for outer multi-parameter blocks are listed first.
For example if this parameter appears as the fourth instance in the multi-parameter block then (3,) is returned.
As another example if this parameter appears as the third instance in the multi-parameter block and the block itself appears as the first instance of an outer multi-parameter block then (0, 2) is returned.
multiParmInstances()
→ tuple
of hou.ParmTuple
If this parameter corresponds to the number of instances for a multiparm, return all the parameter tuples corresponding to all instances of this multiparm.
Returns an empty tuple if this parameter is not for a multiparm.
multiParmInstancesPerItem()
→ int
If this parameter corresponds to the number of instances for a multiparm, return number of parameters per instance.
Returns 0 if this parameter is not for a multiparm.
multiParmInstancesCount()
→ int
If this parameter corresponds to the number of instances for a multiparm, return number of parameters per instance.
Returns 0 if this parameter is not for a multiparm.
multiParmStartOffset()
→ int
If this parameter corresponds to the number of instances for a multiparm, return the starting index used when building multi parameter names. The default value is 1.
Returns 0 if this parameter is not for a multiparm.
CHOPs ¶
createClip(parent_node, name, create_new, apply_immediately, current_value_only, create_locked, set_value_to_default)
→ hou.ChopNode
Creates a Channel CHOP representing this parameter. The Channel CHOP is created with the given name as a child of the given parent node. The parent_node is typically created via hou.OpNode.findOrCreateMotionEffectsNetwork.
create_new: Always create a new Channel CHOP. If set to False, then if a Channel CHOP already exists with the same name, it will be re-used. If the parameter already exists on the Channel CHOP, the older parameter will be removed first.
apply_immediately: If set to True, then the export flag on the Channel CHOP will be set.
current_value_only: If set to True, then only the current value of the parameter will be stored.
create_locked: If set to True, then the parameters are locked on creation.
set_value_to_default: If set to True, then the parameters are reverted to their default values on creation
appendClip(chop_node, apply_immediately, current_value_only, create_locked, set_value_to_default)
Appends this parameter to the specified Channel CHOP.
apply_immediately: If set to True, then the export flag on the Channel CHOP will be set.
current_value_only: If set to True, then only the current value of the parameter will be stored.
create_locked: If set to True, then the parameters are locked on creation.
set_value_to_default: If set to True, then the parameters are reverted to their default values on creation
Hierarchy ¶
containingFolders()
→ tuple of str
Returns a tuple of strings corresponding to the names of the folders containing this parameter.
For example, if this parameter is in the Shading folder and the Shading folder is inside the Render folder, this method will return (“Render”, “Shading”). Note that by folder name, we mean the label used in the parameter dialog, not the internal parameter name.
Returns an empty tuple if this parameter is not inside a folder.
Note that calling this method on many parameters may be slow. For a faster alternative, see hou.OpNode.parmsInFolder.
See also the containingFolderSetParmTuples
method, and
hou.OpNode.parmTuplesInFolder.
containingFolderSetParmTuples()
→ tuple of hou.ParmTuple
Return a tuple of ParmTuples corresponding to the folders containing this parameter.
For example, if this parameter is in the Shading folder and the Shading folder is inside the Render folder, this method will return a tuple containing the Render parm tuple and the Shading parm tuple. Any parm tuples returned will be folder sets.
If this parameter is not inside a folder, an empty tuple is returned.
See also the containingFolders()
method, and
hou.OpNode.parmsInFolder and hou.OpNode.parmTuplesInFolder.
containingFolderIndices()
→ tuple of int
Return a tuple of indices corresponding to the folders containing this parameter. Each index refers to a folder in the corresponding folder set parameter.
This method can be implemented as follows:
def containingFolderIndices(self): return tuple( list(folder_set_parm_tuple.parmTemplate().folderNames()).index( folder_name) for folder_set_parm_tuple, folder_name in zip( parm.containingFolderSetParmTuples(), parm.containingFolders()))
This example makes a parameter visible in the parameter pane by opening all the folders containing it.
def makeParmVisible(parm): for folder_set_parm_tuple, folder_index in zip( parm.containingFolderSetParmTuples(), parm.containingFolderIndices()): folder_set_parm_tuple[0].set(folder_index)
Clipboard ¶
copyToParmClipboard()
Copies this to the parameter clipboard. See also hou.parmClipboardContents().
Misc ¶
asCode(brief=False, save_values=True, save_keyframes=True, save_keys_in_frames=False, save_flag_values=True, save_aliases=True, function_name=None)
→ str
Returns a script of Python statements that can be executed to
set the parameter tuple’s values, flags and other properties.
To run the script, use either Python’s exec
or execfile
functions.
brief
When ‹brief› is True, the output script omits commands for
setting values and flags that are set to the factory defaults.
The script also omits keyframe commands that set unused
values, slopes and accelerations. The value of ‹brief› must
be either True or False.
save_values
:
When ‹save_values› is True, asCode
outputs commands
for setting the parameter tuple’s values. The value of
‹save_values› must be either True or False.
save_keyframes
When ‹save_keyframes› is True, asCode
outputs commands
for creating the parameter tuple’s keyframes (if any). The value
of ‹save_keyframes› must be either True or False.
save_keys_in_frames
When ‹save_keys_in_frames› is True, asCode
outputs commands
for setting channel and key times in samples (frames) instead
of seconds. This parameter has no effect if ‹save_keyframes›
is set to False. The value of ‹save_keys_in_frames› must be either
True or False.
save_flag_values
When ‹save_flag_values› is True, asCode
outputs commands
for setting the parameter tuple’s flag values. The value of
‹save_flag_values› must be either True or False.
save_aliases
When ‹save_aliases› is True, asCode
outputs commands for
setting the parameter tuple’s channel aliases. The value of
‹save_aliases› must be either True or False.
function_name
If ‹function_name› is specified, then the output script is wrapped in a Python function definition with the given name. ‹function_name› must be a non-zero length string consisting of only alphanumeric and underscore characters. Any invalid characters are internally converted to underscores.
The wrapper function takes in a single argument which must be a reference to an existing node parameter tuple. For symmetry, the function also returns the parameter tuple reference.
Here is an example of saving the output to a file and then loading it back into Houdini:
# Get a reference to the target parameter tuple. pt = hou.parmTuple("/obj/geo1/t") # Execute asCode and write the output script to file. script = pt.asCode() f = open("set_parm_tuple_properties.py", "w") f.write(script) f.close() # Execute the script. This will set the values, flag values # and other properties on /obj/geo1's t parameter tuple. It will # also store a reference to the t parameter tuple into a variable # named 'hou_parm_tuple'. execfile("set_parm_tuple_properties.py")
Here is an example of saving the output into a function and then calling it in Houdini:
# Get a reference to the target parameter tuple. node = hou.parmTuple("/obj/geo1/t") # Execute asCode and write the function definition to file. func = p.asCode(function_name="setParmTupleProperties") f = open("parmtuplelib.py", "w") f.write(func) f.close() # Call the function definition to set the properties on another # parameter tuple. import parmtuplelib hou_parm_tuple = parmtuplelib.setParmTupleProperties(node.parm("t"))
Scripts ¶
pressScriptActionButton(arguments={})
Emulates clicking a script action button on a parameter to trigger its script. Raises hou.OperationFailed if the action script could not be run. An optional dictionary of arguments can be passed to the action script. Returns the result of the execution of the script.
Note
This can be called on any type parameter to trigger its script action, it is not limited to only button parameters.
arguments
An optional dictionary of arguments for the callback script. It lets you control the keyboard modifiers with boolean values for 'alt', 'shift', 'ctrl' and 'command'.
As data ¶
See recipes for more information.
asData(**kwargs) -> dict[str, Any]
Returns a JSON-like structure representing this parameter.
setFromData(data: dict[str, Any]) -> None
Updates the settings and value of this parameter from the given data (as returned by ParmTuple.asData()
).
valueAsData(**kwargs) -> Union[int, str, float, dict, list]
Returns a JSON-like value representing the value of this parameter.
setValueFromData(data: Union[int, str, float, dict, list]) -> None
Updates the value of this parameter from the given data (as returned by ParmTuple.valueAsData()
).
multiParmInstancesAsData(**kwargs) -> Sequence[dict[str, Any]]
Returns a JSON-like structure representating any child instances of this multiparm.
setMultiParmInstancesFromData(data: Sequence[dict[str, Any]]) -> None
Sets the child instances of this multiparm from the given data (as returned by ParmTuple.multiParmInstancesAsData()
).
rampPointsAsData(**kwargs) -> Sequence[dict[str, Any]]
Returns a JSON-like structure representing the points of this ramp parameter.
setRampPointsFromData(data: Sequence[dict[str, Any]]) -> None
Sets the points of this ramp parameter from the given data (as returned by ParmTuple.rampPointsAsData()
).
templateAsData(children=True, **kwargs) -> dict[str, Any]
Returns a JSON-like structure representing this tuple’s template.
templateChildrenAsData(**kwargs) -> dict[str, Any]
Returns a JSON-like structure representing the children of this tuple’s template.
insertTemplatesFromData(data: dict[str, Any], operation="insert_after", rename_conflicts=True) -> None
Inserts spare parameters relative to this parameter, from the given data.