hou.Parm class

The parm() function returns a parameter by its path. The Parm class represents a parameter on a node.

All Methods Replaces

Subclasses: hou.NodeReferenceParm

Methods

alias(self)str

Returns the parameter’s channel alias name. Returns an empty string if no such name exists.

appendToScope(self)

Not implemented yet

asCode(self, brief=False, function_name=None)str

Prints the Python code necessary to restore the contents of a parameter.

brief

Do not set values if they are the parameter’s default.

function_name

If specified, the output will be wrapped in this function.

componentIndex(self)int

Returns the component index of this parameter.

For example, the translation parameter along the x-axis, “tx”, would return a component index of 0, while the translation parameter along the y-axis, “ty” would return a component index of 1.

containingFolders(self) → 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”).

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.Node.parmsInFolder.

See also the containingFolderSetParmTulpes() method, and hou.Node.parmTuplesInFolder.

containingFolderSetParmTuples(self) → tuple of hou.ParmTuple

Return a list 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.Node.parmsInFolder and hou.Node.parmTuplesInFolder.

curKeyframe(self) → BaseKeyframe

Not implemented yet

deleteAllKeyframes(self)

Removes all keyframes from this parameter.

This has no effect if there are no keyframes to delete. The value of the parameter after all keyframes are removed will be the one it evaluated to at the current 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.

See also hou.ParmTuple.deleteAllKeyframes.

description(self)str

Returns this parameter’s label.

effectiveKeyframeAtFrame(self, frame)

Not implemented yet

eval(self)int, float, or str

Evaluates this parameter at the current frame and returns the result. See also the evalAtFrame() method.

evalAsFloat(self)float

Evaluates this parameter at the current frame and returns the result as a float.

Raises hou.TypeError if the value cannot be converted to a float.

evalAsFloatAtFrame(self, frame)float

Evaluates this parameter at a certain frame and returns the result as a float.

Raises hou.TypeError if the value cannot be converted to a float.

evalAsInt(self)int

Evalutes this parameter at the current frame and returns the result as an integer.

Raises hou.TypeError if the value cannot be converted to an integer.

evalAsIntAtFrame(self, frame)int

Evaluates this parameter at a certain frame and returns the result as an integer.

Raises hou.TypeError if the value cannot be converted to an integer.

evalAsString(self)str

Evalutes this parameter at the current frame and returns the result as a string.

Raises hou.TypeError if the value cannot be converted to a string.

evalAsStringAtFrame(self, frame)str

Evaluates this parameter at a certain frame and returns the result as a string.

Raises hou.TypeError if the value cannot be converted to a string.

evalAtFrame(self, frame)int, float, or str

Evalutes this parameter at a certain frame and returns the result as an integer, float or string.

executeCallbacks(self)

Not implemented yet

expression(self)str

Returns this parameter’s expression.

For example, a parameter might contain the Python expression “frame() * 2”. In this case eval() at frame 2 would return the value 4, while calling expression() would return the string “frame() * 2”.

If the parameter does not contain an expression, this method will raise hou.OperationFailed. Also, if the parameter contains more than one keyframe then it could contain multiple different expressions, so it also raises hou.OperationFailed in that case.

This method is roughly equivalent to…

parm.keyframes()[0].expression()

See also the setExpression(), expressionLanguage(), keyframes(), and eval() methods.

expressionLanguage(self)hou.exprLanguage enum value

Returns the parameter’s expression’s language.

If the parameter does not contain an expression, this method will raise hou.OperationFailed. Also, if the parameter contains more than one keyframe then it could contain multiple different expressions, so it also raises hou.OperationFailed in that case.

To change the expression language, use hou.Parm.setExpression and explicitly specify the language: parm.setExpression(parm.expression(), language).

This method is roughly equivalent to…

parm.keyframes()[0].expressionLanguage()

See also the expression(), setExpression(), keyframes(), and setExpressionLanguage() methods.

getReferencedParm(self)hou.Parm

Returns the referenced parameter. If no paramter is referenced, returns this parameter.

isAutoscoped(self)bool

Returns whether this parameter’s autoscope property is on.

isLocked(self)bool

Returns whether this parameter is locked (uneditable).

isParmReference(self)

Not implemented yet

isPending(self)

Not implemented yet

isSpare(self)bool

Returns whether this parameter is a “spare” (user-defined) parameter.

isTimeDependent(self)bool

Returns whether this parameter is time dependent, that is, its 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.

keyCurValueAtFrame(self, frame)

Not implemented yet

keyframeForCurTime(self) → Keyframe

Not implemented yet

keyframes(self) → tuple of hou.BaseKeyframe

Returns the keyframes on this parameter.

keyframesInRange(self, start_frame, end_frame) → tuple of hou.BaseKeyframe

Not implemented yet

language(self)

Not implemented yet

lock(self, on)

Locks (lock(True)) or unlocks (lock(False)) this parameter (this is, makes the value uneditable).

Raises hou.Permission if this parameter is part of a locked digital asset.

Returns a list of all possible menu items (for a menu parameter). Raises hou.OperationFailed if this parameter is not a menu.

moveToIntegerKeyframes(self, mode)

Not implemented yet

name(self)str

Returns this parameter’s name.

node(self)hou.Node

Returns the node on which this parameter exists.

parmTemplate(self)hou.ParmTemplate

Returns the template for this parameter.

path(self)str

Returns the full path to this parameter.

pendingValue(self)

Not implemented yet

pressButton(self)

Emulates clicking a button parameter to trigger its callback script. Raises hou.OperationFailed if the callback script could not be run.

refit(self, tolerance = 0.01)

Not implemented yet

removeFromScope(self)

Not implemented yet

reverse(self)

Not implemented yet

reverseForRange(self, start_frame, end_frame)

Not implemented yet

revertToAndRestorePermanentDefaults(self)

Changes the value back to the default that ships with Houdini, and restores that default.

See also the revertToDefaults() method, and hou.ParmTuple.revertToAndRestorePermanentDefaults

revertToDefaults(self)

Change the value back to the default(s). See also the revertToAndRestoreFactoryDefaults() method.

set(self, value, language=None)

Sets the parameter value at the current frame.

Raises hou.TypeError if the type of value does not match the type of this parameter. Raises hou.PermissionError if this parameter is not writable.

setAlias(self, alias_name)

Gives the parameter another name by which it can be referenced in channels. You can pass in an empty string to remove an existing alias name.

setAsScope(self)

Not implemented yet

setAutoscope(self, on)

Changes the autoscope property of the parameter. If this property is on, this parameter is automatically scoped when the object is selected.

setExpression(self, expression, language=None)

Sets this parameter’s expression.

The language parameter must either be a hou.exprLanguage enumeration value or None.

If language is None and the parameter does not already contain an expression, the language will be the node’s expression language. (See hou.Node.expressionLanguage.) Otherwise, if language is None and the parameter already has an expression, the expression language will not change.

Unlike hou.Parm.set, this method does not follow channel references. That is, if this parameter is referencing another parameter and you call setExpression(), it change the channel reference expression into the specified expression.

This method is roughly equivalent to setting a keyframe at the current time, where the keyframe’s expression and language are the ones specified. This method does not delete any previous keyframes.

For non-string parameters, this method is rougly equivalent to…

k = hou.Keyframe()
k.setExpression(expression, language)
parm.setKeyframe(k)

For string parameters, this method is rougly equivalent to…

k = hou.StringKeyframe()
k.setExpression(expression, language)
parm.setKeyframe(k)

See also the expression(), expressionLanguage(), and setKeyframe() methods, and hou.Node.expressionLanguage.

setKeyframe(self, keyframe)

Sets a keyframe on this parameter.

Raises hou.TypeError if keyframe is not of type hou.BaseKeyframe. Raises hou.PermissionError if this parameter is not writable.

setLanguage(self, language)

Not implemented yet

setPending(self, value)

Sets the parameter value at the current frame and marks it as pending if the parameter is keyed.

Raises hou.TypeError if the type of value does not match this parameter’s type. Raises hou.PermissionError if this parameter is not writable.

stretch(self, num_frames_to_add)

Not implemented yet

stretchSubrange(self, source_start_frame, source_end_frame, num_frames_to_add)

Not implemented yet

tuple(self)hou.ParmTuple

Returns the hou.ParmTuple associated with this parameter.

For example, calling this method on the Parm object for the translation parameter “tx”, would return a ParmTuple that contains Parm objects for the three translation parameters “tx”, “ty” and “tz”. If no tuple is associated with the parameter, then the parameter itself is returned in a tuple of size 1.

type(self) → parmTemplateType

Not implemented yet

unexpandedString(self)str

Returns the contents of the parameter before dollar sign and backtick expansion.

Examples of unexpanded strings would be “image$F.pic”, “$HIP/split.otl”, or “chs('../font1/text')”. If you were to call eval() on them, Houdini would perform variable expansion and backtick expression evaluation, so you would get back something like “image1.pic” instead of “image$F.pic”.

Because only string parameters will attempt to do dollar sign and string expansion, this method will raise hou.OperationFailed if called from a non-string parameter.

Suppose a string parameter contains keyframes. In this situation, Houdini will not attempt to do string expansion on the parameter’s value, so calling this method will raise hou.OperationFailed. Instead of calling this method, you can call expression() to access the first Keyframe’s expression. If there are multiple keyframes, you can call keyframes() to get a list of hou.StringKeyframe objects and call expression() on those objects to retrieve the expression.

Replaces

chadd command , chalias command , chautoscope command , chkey command , chkeyget command , chkeyls command , chlock command , chrefit command , chreverse command , chrm command , chround command , chscope command , chstretch command , opparm command , opscript command , ch expression function , chf expression function , chs expression function , chsraw expression function , cht expression function