MayaVariable¶
vtool.maya_lib.attr.MayaVariable (name) |
Convenience class for dealing with Maya attributes. |
-
class
MayaVariable
(name)¶ Convenience class for dealing with Maya attributes.
-
TYPE_BOOL
= ‘bool’¶
-
TYPE_LONG
= ‘long’¶
-
TYPE_SHORT
= ‘short’¶
-
TYPE_ENUM
= ‘enum’¶
-
TYPE_FLOAT
= ‘float’¶
-
TYPE_DOUBLE
= ‘double’¶
-
TYPE_STRING
= ‘string’¶
-
TYPE_MESSAGE
= ‘message’¶
-
numeric_attributes
= [‘bool’, ‘long’, ‘short’, ‘float’, ‘double’]¶
-
exists
()¶ Returns: bool
-
is_numeric
()¶
-
set_name
(name)¶ Set the name of the variable.
Parameters: name (str) –
-
set_value
(value)¶ Set the value of the variable.
Parameters: value –
-
set_locked
(bool_value)¶ Set the lock state of the variable.
Parameters: bool_value (bool) –
-
set_keyable
(bool_value)¶ Set the keyable state of the variable.
Parameters: bool_value (bool) –
-
set_variable_type
(name)¶ Set the variable type, check Maya documentation.
-
set_node
(name)¶ Set the node where the variable should live.
Parameters: name (str) –
-
get_value
()¶ Get the variables value.
Returns: value
-
get_name
(name_only=False)¶ Get the name of the variable.
Parameters: name_only (bool) – If True just the variable name is returned. If False the node and variable are returned: “node.variable”.
-
get_dict
()¶ Get a dictionary that represents the state of the variable.
Returns: dict
-
set_dict
(var_dict)¶ Set a dictionary that describes the variable. See get_dict.
Parameters: var_dict (dict) – A dictionary created from get_dict.
-
create
(node=None)¶ Create the variable on the node.
Parameters: node (str) – The node for the variable. If not set, set_node should be set.
-
delete
(node=None)¶ Delete the variable on the node.
Parameters: node (str) – The node for the variable. If not set, set_node should be set.
-
load
()¶ Refresh the internal values.
-
connect_in
(attribute)¶ Connect the attribute into this variable.
Parameters: attribute (str) – ‘node.attribute’
-
connect_out
(attribute)¶ Connect from the variable into the attribute.
Parameters: attribute (str) – ‘node.attribute’
-