vtool.maya_lib.attr

Class Summary

Connections(node)

Convenience for dealing with connections.

TransferConnections()

LockState(attribute)

This saves the lock state, so that an attribute lock state can be reset after editing.

LockNodeState(node)

This saves the lock state of the node, so that all attributes lock state can be reset after editing.

LockTransformState(node)

RemapAttributesToAttribute(node, attribute)

Create a slider switch between multiple attributes.

OrientJointAttributes([joint])

Creates attributes on a node that can then be used with OrientAttributes

MayaVariable(name)

Convenience class for dealing with Maya attributes.

MayaNumberVariable(name)

Convenience class for dealing with Maya numeric attributes.

MayaEnumVariable(name)

Convenience class for dealing with Maya enum attributes.

MayaStringVariable(name)

Convenience class for dealing with Maya string attributes.

StoreData([node, attribute_name])

Attributes(node)

Still testing.

TransferVariables()

MayaNode([name])

Not fully implemented.

MultiplyDivideNode([name])

Convenience class for dealing with multiply divide nodes.

Function Summary

get_variable_instance(attribute)

Get a variable instance for the attribute.

get_variable_instance_of_type(name, var_type)

is_attribute(node_dot_attribute)

Check if what is passed is an attribute.

is_attribute_numeric(node_dot_attribute)

Check if the attribute exists and is numeric.

is_translate_rotate_connected(transform[, ...])

Check if translate and rotate attributes are connected.

is_connected(node_and_attribute)

is_locked(node_and_attribute)

is_keyed(node_and_attribute)

get_node_and_attribute(attribute)

Split a name between its node and its attribute.

get_inputs(node[, node_only])

Get all the inputs into the specified node.

get_outputs(node[, node_only])

Get all the outputs from the specified node.

get_attribute_name(node_and_attribute)

For a string node.attribute, return the attribute portion

get_attribute_input(node_and_attribute[, ...])

Get the input into the specified attribute.

get_attribute_outputs(node_and_attribute[, ...])

Get the outputs from the specified attribute.

transfer_attribute_values(source_node, ...)

get_attribute_values(node[, keyable_only])

set_attribute_values(node, values)

transfer_variables()

Not done

transfer_output_connections(source_node, ...)

Transfer output connections from source_node to target_node.

set_nonkeyable(node, attributes)

param node

The name of a node

hide_attributes(node, attributes)

Lock and hide the attributes specified in attributes.

hide_keyable_attributes(node)

Lock and hide keyable attributes on node.

hide_translate(node)

hide_rotate(node)

hide_scale(node)

hide_visibility(node)

lock_attributes(node[, bool_value, ...])

lock attributes on a node.

unlock_attributes(node[, attributes, ...])

unlock attributes on a node.

lock_translate_attributes(node)

lock_rotate_attributes(node)

lock_scale_attributes(node)

lock_constraint(constraint)

This will check if the thing being passed in is a constraint.

lock_attributes_for_asset(node)

lock_hierarchy(top_transform[, ...])

remove_user_defined(node)

Removes user defined attributes from a node.

set_color(nodes, color)

Set the override color for the nodes in nodes.

set_color_rgb(nodes[, r, g, b])

Maya 2015 and above.

get_color_rgb(node[, as_float])

get_color(node[, as_float])

get_color_of_side([side, sub_color])

Get the override color for the given side.

color_to_rgb(color_index[, as_float])

hsv_to_rgb(hsv)

get_random_color([seed])

set_color_hue(color_rgb, hue)

set the hue component of hsv

set_color_saturation(color_rgb, saturation)

set the saturation component of hsv

set_color_value(color_rgb, value)

set the value component of hsv

connect_vector_attribute(source_transform, ...)

Connect an X,Y,Z attribute, eg translate, rotate, scale.

connect_transforms(source_transform, ...)

Connect translate, rotate, scale from souce to target.

connect_translate(source_transform, ...)

Connect translate attributes

connect_rotate(source_transform, ...)

Connect rotate attributes.

connect_scale(source_transform, target_transform)

Connect scale attributes.

connect_translate_into_pivots(...)

connect_translate_plus(source_transform, ...)

Connect translate attributes.

connect_translate_multiply(source_transform, ...)

Connect translate attributes with a multiplyDivide to multiply the effect.

connect_rotate_multiply(source_transform, ...)

Connect rotate attributes with a multiplyDivide to multiply the effect.

connect_scale_multiply(source_transform, ...)

Never use.

connect_visibility(attribute_name, target_node)

Connect the visibility into an attribute

connect_plus_and_value(source_attribute, ...)

connect_plus(source_attribute, target_attribute)

Connect source_attribute into target_attribute with a plusMinusAverage inbetween.

connect_plus_new(source_attribute, ...[, ...])

Not in use.

connect_multiply(source_attribute, ...[, ...])

Connect source_attribute into target_attribute with a multiplyDivide inbetween.

output_multiply(source_attribute[, value])

Insert a multiply from the output of a source attribute into all of the inputs of the source attribute

insert_multiply(target_attribute[, value])

Insert a multiply divide into the input attribute of target_attribute.

insert_blend(target_attribute[, value])

Insert a multiply divide into the input attribute of target_attribute.

connect_blend(source_attribute1, ...[, value])

Connect source 1 and source 2 into the target_attribute with and blendColors node.

connect_reverse(source_attribute, ...)

Connect source_attribute into target_attribute with a reverse node inbetween.

connect_equal_condition(source_attribute, ...)

Connect source_attribute into target_attribute with a condition node inbetween.

connect_greater_than_condition(...)

Connect source_attribute into target_attribute with a condition node inbetween.

connect_less_than_condition(...)

Connect source_attribute into target_attribute with a condition node inbetween.

create_blend_attribute(source, target[, ...])

Create an attribute to hook into a blendshape.

disconnect_attribute(attribute)

Disconnect an attribute.

disconnect_scale(transform_node)

get_indices(attribute[, multi])

Get the index values of a multi attribute.

get_available_slot(attribute)

Find the next available slot in a multi attribute.

get_slots(attribute)

Given a multi attribute, get all the slots currently made.

get_slot_count(attribute)

Get the number of created slots in a multi attribute.

clear_multi(node, attribute_name)

create_title(node, name[, name_list])

Create a enum title attribute on node

create_vetala_type(node, value)

Convenience to tag nodes that are vital to the auto rig.

get_vetala_type(node)

Get the vetala type of a node.

get_vetala_nodes([vetala_type])

Get vetala nodes in the scene.

has_default_xform_channels(transform[, ...])

Zero out the translate and rotate.

zero_xform_channels(transform)

Zero out the translate and rotate.

add_orient_attributes(transform[, ...])

Add orient attributes, used to automatically orient.

remove_orient_attributes(transform)

show_rotate_order(transform[, value])

hide_rotate_order(transform)

add_shape_for_attributes(transforms, shape_name)

store_world_matrix_to_attribute(transform[, ...])

search_for_open_input(node_and_attribute)

get_message_attributes(node[, user_defined])

get_message_input(node, message)

connect_message(input_node, ...)

Connect the message attribute of input_node into a custom message attribute on destination_node

connect_group_with_message(input_node, ...)

create_multi_message(node, attribute_name)

fill_multi_message(node, attribute_name, nodes)

append_multi_message(node, attribute_name, ...)

class Connections(node)

Convenience for dealing with connections. Connection mapping gets stored in the class.

Parameters

node (str) – The name of the node with connections.

disconnect()

Disconnect all connections.

disconnect_inputs()

Disconnect input connections.

connect()

This is meant to be run after disconnect(). This will reconnect all the stored connections.

refresh()

Refresh the stored connections

get()

Get the stored connections. Input and Output connections in a list. List is orderd as [[output, intput], …], the output is whatever connects in, whether it be the node output into something or something inputing into the node.

get_input_at_inc(inc)

Get connection that inputs into the node at index.

Parameters

inc (int) – The index of the connection.

get_output_at_inc(inc)

Get connection that the node outputs into at index.

Parameters

inc (int) – The index of the connection.

get_connection_inputs(connected_node)

Get connections that input into the node. List is [[external_output, node_input], …]

Parameters

connected_node (str) – The name of a connected node to filter with. Only inputs into the node will be returned.

get_connection_outputs(connected_node)

Get connections that the node outputs into. List is [[node_output, external_input], …]

Parameters

connected_node (str) – The name of a connected node to filter with. Only inputs from that node will be returned.

Retrun

list: [[node_output, external_input], …]

get_inputs_of_type(node_type)

Get nodes of node_type that connect into the node.

Parameters

node_type (str) – Maya node type.

Returns

The names of connected nodes matching node_type.

Return type

list

get_outputs_of_type(node_type)

Get all nodes of node_type that output from the node.

Parameters

node_type (str) – Maya node type.

Returns

The names of connected nodes matching node_type.

Return type

list

get_outputs()

Get all the connections that output from the node

Returns

[[node_output, external_input], … ]

Return type

list

get_inputs()

get all connections that input into the node.

Returns

[[external_output, node_input], … ]

Return type

list

class TransferConnections
transfer_keyable(source_node, target_node, prefix=None, disconnect_source=False)

Create the keyable attributes on the target node found on source_node.

Parameters

prefix (str) – The prefix to give. This is good when transfering more than once. This will help get rid of clashing attributes.

class LockState(attribute)

This saves the lock state, so that an attribute lock state can be reset after editing.

Parameters

attribute (str) – “node.attribute”

unlock()

Unlock the attribute.

lock()

Lock the attribute.

restore_initial()

Restore the initial lock state.

class LockNodeState(node)

This saves the lock state of the node, so that all attributes lock state can be reset after editing.

Parameters

attribute (str) – “node.attribute”

unlock()

Unlock the attribute.

lock()

Lock the attribute.

restore_initial()

Restore the initial lock state.

class LockTransformState(node)
lock()

Lock the attribute.

restore_initial()

Restore the initial lock state.

unlock()

Unlock the attribute.

class RemapAttributesToAttribute(node, attribute)

Create a slider switch between multiple attributes. This is useful for setting up switches like ikFk. This will create the switch attribute if it doesn’t already exist.

Parameters
  • node (str) – The name of a node.

  • attribute (str) – The attribute which should do the switching.

set_keyable(bool_value)

Whether the switch attribute should be keyable. This only works if the attribute doesn’t exist prior to create()

create_attributes(node, attributes)

Add attributes to be mapped. Saved in a list for create()

Parameters
  • node (str) – The name of the node where the attributes live.

  • attributes (list) – The names of attributes on the node to map to the switch.

create_attribute(node, attribute)

Add an attribute to be mapped. Saved in a list for create()

Parameters
  • node (str) – The name of the node where the attributes live.

  • attributes (list) – The name of an attribute on the node to map to the switch.

create()

Create the switch.

class OrientJointAttributes(joint=None)

Creates attributes on a node that can then be used with OrientAttributes

set_joint(joint)

Set a joint to create attributes on.

Parameters

joint (str) – The name of the joint.

get_values()

Get the orient settings in a dictionary.

Returns

dict

set_values(value_dict)
set_default_values(context_sensitive=False)

Reset the attributes to default.

delete()

Delete the attributes off of the joint set with set_joint.

get_variable_instance(attribute)

Get a variable instance for the attribute.

Parameters

attribute (str) – node.attribute name

Returns

The instance of a corresponding variable.

Return type

object

get_variable_instance_of_type(name, var_type)
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(force=False)
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_channel_box(bool_value)
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’

class MayaNumberVariable(name)

Convenience class for dealing with Maya numeric attributes.

get_max_value()
set_min_value(value)
Parameters

value (float) – Minimum value constraint

set_max_value(value)
Parameters

value (float) – Maximum value constraint

load()

Refresh the internal values.

TYPE_BOOL = 'bool'
TYPE_DOUBLE = 'double'
TYPE_ENUM = 'enum'
TYPE_FLOAT = 'float'
TYPE_LONG = 'long'
TYPE_MESSAGE = 'message'
TYPE_SHORT = 'short'
TYPE_STRING = 'string'
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’

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.

exists(force=False)
Returns

bool

get_dict()

Get a dictionary that represents the state of the variable.

Returns

dict

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_value()

Get the variables value.

Returns

value

is_numeric()
numeric_attributes = ['bool', 'long', 'short', 'float', 'double']
set_channel_box(bool_value)
set_dict(var_dict)

Set a dictionary that describes the variable. See get_dict.

Parameters

var_dict (dict) – A dictionary created from get_dict.

set_keyable(bool_value)

Set the keyable state of the variable.

Parameters

bool_value (bool) –

set_locked(bool_value)

Set the lock state of the variable.

Parameters

bool_value (bool) –

set_name(name)

Set the name of the variable.

Parameters

name (str) –

set_node(name)

Set the node where the variable should live.

Parameters

name (str) –

set_value(value)

Set the value of the variable.

Parameters

value

set_variable_type(name)

Set the variable type, check Maya documentation.

class MayaEnumVariable(name)

Convenience class for dealing with Maya enum attributes.

set_enum_names(name_list)
Parameters

name_list (list) – List of strings to define the enum.

TYPE_BOOL = 'bool'
TYPE_DOUBLE = 'double'
TYPE_ENUM = 'enum'
TYPE_FLOAT = 'float'
TYPE_LONG = 'long'
TYPE_MESSAGE = 'message'
TYPE_SHORT = 'short'
TYPE_STRING = 'string'
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’

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.

exists(force=False)
Returns

bool

get_dict()

Get a dictionary that represents the state of the variable.

Returns

dict

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_value()

Get the variables value.

Returns

value

is_numeric()
load()

Refresh the internal values.

numeric_attributes = ['bool', 'long', 'short', 'float', 'double']
set_channel_box(bool_value)
set_dict(var_dict)

Set a dictionary that describes the variable. See get_dict.

Parameters

var_dict (dict) – A dictionary created from get_dict.

set_keyable(bool_value)

Set the keyable state of the variable.

Parameters

bool_value (bool) –

set_locked(bool_value)

Set the lock state of the variable.

Parameters

bool_value (bool) –

set_name(name)

Set the name of the variable.

Parameters

name (str) –

set_node(name)

Set the node where the variable should live.

Parameters

name (str) –

set_value(value)

Set the value of the variable.

Parameters

value

set_variable_type(name)

Set the variable type, check Maya documentation.

class MayaStringVariable(name)

Convenience class for dealing with Maya string attributes.

TYPE_BOOL = 'bool'
TYPE_DOUBLE = 'double'
TYPE_ENUM = 'enum'
TYPE_FLOAT = 'float'
TYPE_LONG = 'long'
TYPE_MESSAGE = 'message'
TYPE_SHORT = 'short'
TYPE_STRING = 'string'
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’

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.

exists(force=False)
Returns

bool

get_dict()

Get a dictionary that represents the state of the variable.

Returns

dict

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_value()

Get the variables value.

Returns

value

is_numeric()
load()

Refresh the internal values.

numeric_attributes = ['bool', 'long', 'short', 'float', 'double']
set_channel_box(bool_value)
set_dict(var_dict)

Set a dictionary that describes the variable. See get_dict.

Parameters

var_dict (dict) – A dictionary created from get_dict.

set_keyable(bool_value)

Set the keyable state of the variable.

Parameters

bool_value (bool) –

set_locked(bool_value)

Set the lock state of the variable.

Parameters

bool_value (bool) –

set_name(name)

Set the name of the variable.

Parameters

name (str) –

set_node(name)

Set the node where the variable should live.

Parameters

name (str) –

set_value(value)

Set the value of the variable.

Parameters

value

set_variable_type(name)

Set the variable type, check Maya documentation.

class StoreData(node=None, attribute_name='DATA')
set_node(node)
set_data(data)
get_data()
eval_data()
class Attributes(node)

Still testing. Convenience class for dealing with groups of attributes. Currently only works on bool, long, short, float, double

Parameters

node (str) – The name of the node where the attributes live.

numeric_attributes = ['bool', 'long', 'short', 'float', 'double']
delete_all(retrieve=False)

Delete all loaded variables on a node.

create_all()

Meant to be used after delete_all to restore the attributes.

delete(name)

delete the attribute by name

Parameters

name (str) – The name of an attribute on the node.

create(name, var_type, index=None)

Create an attribute on the node. This refreshes all the attributes.

Parameters
  • name (str) – The name of the attribute.

  • var_type (str) – The type of variable.

  • index (int) – The index where the attribute should be created. 0 would make it the first attribute.

get_variables()

Get the variables initialized to the var class

Returns

A list of var classes initalized to work on variables on the node.

Return type

list

get_variable(attribute_name)

Get a variable by name initialized to the var class.

Parameters

attribute_name (str) – The name of a variable on the node.

Returns

An instance of the var class.

Return type

object

rename_variable(old_name, new_name)

Rename a variable. This will work in such a way that the variables are all reset.

Parameters
  • old_name (str) – The old name of the variable.

  • new_name (str) – The new name of the variable.

class TransferVariables
transfer_control(source, target)
class MayaNode(name=None)

Not fully implemented. Meant to be a convenience class for dealing with maya nodes.

class MultiplyDivideNode(name=None)

Convenience class for dealing with multiply divide nodes.

Parameters

name (str) – The description to give the node. Name = ‘multiplyDivide_(name)’.

set_operation(value)

Set the operation. 0 = no operation 1 = multiply 2 = divide 3 = power

default = 1

Parameters

value (int) – The operation index.

set_input1(valueX=None, valueY=None, valueZ=None)

Set the intput1 values

Parameters
  • valueX (float) –

  • valueY (float) –

  • valueZ (float) –

set_input2(valueX=None, valueY=None, valueZ=None)

Set the intput2 values

Parameters
  • valueX (float) –

  • valueY (float) –

  • valueZ (float) –

input1X_in(attribute)

Connect into input1X.

Parameters

attribute (str) – The node.attribute to connect in.

input1Y_in(attribute)

Connect into input1Y.

Parameters

attribute (str) – The node.attribute to connect in.

input1Z_in(attribute)

Connect into input1Z.

Parameters

attribute (str) – The node.attribute to connect in.

input2X_in(attribute)

Connect into input2X.

Parameters

attribute (str) – The node.attribute to connect in.

input2Y_in(attribute)

Connect into input2Y.

Parameters

attribute (str) – The node.attribute to connect in.

input2Z_in(attribute)

Connect into input2Z.

Parameters

attribute (str) – The node.attribute to connect in.

outputX_out(attribute)

Connect out from outputX.

Parameters

attribute (str) – The node.attribute to connect out into.

outputY_out(attribute)

Connect out from outputY.

Parameters

attribute (str) – The node.attribute to connect out into.

outputZ_out(attribute)

Connect out from outputZ.

Parameters

attribute (str) – The node.attribute to connect out into.

is_attribute(node_dot_attribute)

Check if what is passed is an attribute.

Returns

bool

is_attribute_numeric(node_dot_attribute)

Check if the attribute exists and is numeric.

Returns

bool

is_translate_rotate_connected(transform, ignore_keyframe=False)

Check if translate and rotate attributes are connected.

Parameters

transform (str) – The name of a transform.

Returns

bool

is_connected(node_and_attribute)
is_locked(node_and_attribute)
is_keyed(node_and_attribute)
get_node_and_attribute(attribute)

Split a name between its node and its attribute.

Parameters

attribute (str) – attribute name, node.attribute.

Returns

[node_name, attribute]

Return type

list

get_inputs(node, node_only=True)

Get all the inputs into the specified node.

Parameters
  • node (str) – The name of a node.

  • node_only (str) – Whether to return the node name or the node name + the attribute eg. ‘node_name.attribute’

Returns

The inputs.

Return type

list

get_outputs(node, node_only=True)

Get all the outputs from the specified node.

Parameters
  • node (str) – The name of a node.

  • node_only (str) – Whether to return the node name or the node name + the attribute eg. ‘node_name.attribute’

Returns

The outputs.

Return type

list

get_attribute_name(node_and_attribute)

For a string node.attribute, return the attribute portion

get_attribute_input(node_and_attribute, node_only=False)

Get the input into the specified attribute.

Parameters
  • node_and_attribute (str) – The node_name.attribute name to find an input into.

  • node_only (str) – Whether to return the node name or the node name + the attribute eg. ‘node_name.attribute’

Returns

The attribute that inputs into node_and_attribute

Return type

str

get_attribute_outputs(node_and_attribute, node_only=False)

Get the outputs from the specified attribute.

Parameters
  • node_and_attribute (str) – The node_name.attribute name to find outputs.

  • node_only (str) – Whether to return the node name or the node name + the attribute eg. ‘node_name.attribute’

Returns

The nodes that node_and_attribute connect into.

Return type

str

transfer_attribute_values(source_node, target_node, keyable_only=True)
get_attribute_values(node, keyable_only=True)
set_attribute_values(node, values)
transfer_variables()

Not done

transfer_output_connections(source_node, target_node)

Transfer output connections from source_node to target_node.

Parameters
  • source_node (str) – The node to take output connections from.

  • target_node (str) – The node to transfer output connections to.

set_nonkeyable(node, attributes)
Parameters
  • node (str) – The name of a node

  • attributes (list) or (str) – The name of attributes or an attribute to set nonkeyable

hide_attributes(node, attributes)

Lock and hide the attributes specified in attributes. This has been tested on individual attributes like translateX, not attributes like translate.

Parameters
  • node (str) – The name of a node.

  • attributes (list) – A list of attributes on node to lock and hide. Just the name of the attribute.

hide_keyable_attributes(node)

Lock and hide keyable attributes on node.

Parameters

node (str) –

hide_translate(node)
hide_rotate(node)
hide_scale(node)
hide_visibility(node)
lock_attributes(node, bool_value=True, attributes=None, hide=False)

lock attributes on a node.

Parameters
  • node (str) – The name of the node.

  • bool_value (bool) – Whether to lock the attributes.

  • attributes (list) – A list of attributes to lock on node.

  • hide (bool) – Whether to lock and hide the attributes.

unlock_attributes(node, attributes=[], only_keyable=False)

unlock attributes on a node.

Parameters
  • node (str) – The name of the node.

  • attributes (list) – A list of attributes to lock on node. If none given, unlock any that are locked.

  • only_keyable (bool) – Whether to unlock only the keyable attributes.

lock_translate_attributes(node)
lock_rotate_attributes(node)
lock_scale_attributes(node)
lock_constraint(constraint)

This will check if the thing being passed in is a constraint.

And then lock the target offsets which can sometimes get messed up in reference.

lock_attributes_for_asset(node)
lock_hierarchy(top_transform, exclude_transforms=[], skip_of_type=['ikHandle', 'joint'])
remove_user_defined(node)

Removes user defined attributes from a node.

set_color(nodes, color)

Set the override color for the nodes in nodes.

Parameters
  • nodes (list) – A list of nodes to change the override color.

  • color (int) – The color index to set override color to.

set_color_rgb(nodes, r=0, g=0, b=0)

Maya 2015 and above. Set to zero by default. Max value is 1.0.

get_color_rgb(node, as_float=False)
get_color(node, as_float=False)
get_color_of_side(side='C', sub_color=False)

Get the override color for the given side.

Parameters
  • side (str) – ‘L’,’R’, ‘C’

  • sub_color (bool) – Whether to return a sub color.

Returns

A color index for override color.

Return type

int

color_to_rgb(color_index, as_float=True)
hsv_to_rgb(hsv)
get_random_color(seed=0)
set_color_hue(color_rgb, hue)

set the hue component of hsv

set_color_saturation(color_rgb, saturation)

set the saturation component of hsv

set_color_value(color_rgb, value)

set the value component of hsv

connect_vector_attribute(source_transform, target_transform, attribute, connect_type='plus')

Connect an X,Y,Z attribute, eg translate, rotate, scale.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

  • attribute (str) – eg, translate, rotate, scale.

  • connect_type (str) – ‘plus’ or ‘multiply’

Returns

The nodes created.

Return type

list

connect_transforms(source_transform, target_transform)

Connect translate, rotate, scale from souce to target.

connect_translate(source_transform, target_transform)

Connect translate attributes

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

connect_rotate(source_transform, target_transform)

Connect rotate attributes. This will automatically connect rotateOrder from source to target, if not already connected.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

connect_scale(source_transform, target_transform)

Connect scale attributes.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

connect_translate_into_pivots(source_transform, target_transform)
connect_translate_plus(source_transform, target_transform)

Connect translate attributes. If target_transform already has input connections, reconnect with plusMinusAverage to accomodate both.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

Returns

the name of the plusMinusAverage node.

Return type

str

connect_translate_multiply(source_transform, target_transform, value=1, respect_value=False)

Connect translate attributes with a multiplyDivide to multiply the effect.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

  • value (float) – The multiply value. Set to 0.5 to translate target half of what source translates.

  • repsect_value (bool) – If respect value is True, then add a plus minus average to buffer the multiply divide.

Returns

the name of the multiplyDivide node. If respect value return [multiply, plus]

Return type

str

connect_rotate_multiply(source_transform, target_transform, value=1, respect_value=False)

Connect rotate attributes with a multiplyDivide to multiply the effect. This is dangerous because rotate is not calculated in the same linear way as translate. Probably shouldn’t be used because of Quaternion math. Would be better to use a double orient constraint.

Parameters
  • source_transform (str) – The name of a transform.

  • target_transform (str) – The name of a transform.

  • value (float) – The multiply value. Set to 0.5 to rotate target half of what source translates.

  • repsect_value (bool) – If respect value is True, then add a plus minus average to buffer the multiply divide.

Returns

the name of the multiplyDivide node. If respect value return [multiply, plus]

Return type

str

connect_scale_multiply(source_transform, target_transform, value=1, respect_value=False)

Never use.

connect_visibility(attribute_name, target_node, value=1)

Connect the visibility into an attribute

Parameters
  • attribute_name (str) – The node.attribute name of an attribute. Does not have to exists. Will be created if doesn’t exist.

  • target_node (str) – The target node to connect attribute_name into.

  • value (bool) – 0 or 1 whether you want the visibility on or off by default.

connect_plus_and_value(source_attribute, target_attribute, value)
connect_plus(source_attribute, target_attribute, respect_value=False)

Connect source_attribute into target_attribute with a plusMinusAverage inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • respect_value (bool) – Whether to edit the input1D list to accomodate for values in the target attribute.

Returns

The name of the plusMinusAverage node

Return type

str

connect_plus_new(source_attribute, target_attribute, respect_value=False)

Not in use. Connect source_attribute into target_attribute with a plusMinusAverage inbetween. Tried to make it better, but isn’t.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • respect_value (bool) – Whether to edit the input1D list to accomodate for values in the target attribute.

Returns

The name of the plusMinusAverage node

Return type

str

connect_multiply(source_attribute, target_attribute, value=0.1, skip_attach=False, plus=True)

Connect source_attribute into target_attribute with a multiplyDivide inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • skip_attach (bool) – Whether to attach the input into target_attribute (if there is one) into input2X of multiplyDivide.

  • plus (bool) – Whether to fix input connections in target_attribute to plug into a plusMinusAverage. Therefore not losing their influence on the attribute while still multiplying by the source_attribute.

Returns

The name of the plusMinusAverage node

Return type

str

output_multiply(source_attribute, value=1)

Insert a multiply from the output of a source attribute into all of the inputs of the source attribute

insert_multiply(target_attribute, value=0.1)

Insert a multiply divide into the input attribute of target_attribute.

Parameters
  • target_attribute (str) – The node.attribute name of an attribute.

  • value (float) – The float value to multiply the target_attribute by.

Returns

The new multiply divide.

Return type

str

insert_blend(target_attribute, value=1)

Insert a multiply divide into the input attribute of target_attribute.

Parameters
  • target_attribute (str) – The node.attribute name of an attribute.

  • value (float) – The float value to blend the target_attribute by.

Returns

The new blend node

Return type

str

connect_blend(source_attribute1, source_attribute2, target_attribute, value=0.5)

Connect source 1 and source 2 into the target_attribute with and blendColors node.

Parameters
  • source_attribute1 (str) – The node.attribute name of an attribute.

  • source_attribute2 (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • value (float) – The amount to blend the 2 attributes.

Returns

The name of the blendColors node

Return type

str

connect_reverse(source_attribute, target_attribute)

Connect source_attribute into target_attribute with a reverse node inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

Returns

The name of the reverse node

Return type

str

connect_equal_condition(source_attribute, target_attribute, equal_value)

Connect source_attribute into target_attribute with a condition node inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • equal_value (float) – The value the condition should be equal to, in order to pass 1. 0 otherwise.

  • visibility. (Good when hooking up enums to) –

Returns

The name of the condition node

Return type

str

connect_greater_than_condition(source_attribute, target_attribute, greater_than_value)

Connect source_attribute into target_attribute with a condition node inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • equal_value (float) – The value the condition should be equal to, in order to pass 1. 0 otherwise.

  • visibility. (Good when hooking up enums to) –

Returns

The name of the condition node

Return type

str

connect_less_than_condition(source_attribute, target_attribute, less_than_value)

Connect source_attribute into target_attribute with a condition node inbetween.

Parameters
  • source_attribute (str) – The node.attribute name of an attribute.

  • target_attribute (str) – The node.attribute name of an attribute.

  • equal_value (float) – The value the condition should be equal to, in order to pass 1. 0 otherwise.

  • visibility. (Good when hooking up enums to) –

Returns

The name of the condition node

Return type

str

create_blend_attribute(source, target, min_value=0, max_value=10, value=0)

Create an attribute to hook into a blendshape.

Parameters
  • source (str) – The node.attr name of an attribute to connect into a blendshape.

  • target (str) – the blendshape.weight name to connect into.

Returns

multiplyDivide node.

Return type

str

disconnect_attribute(attribute)

Disconnect an attribute. Find its input automatically and disconnect it.

Parameters

attribute (str) – The name of an attribute that has a connection.

disconnect_scale(transform_node)
get_indices(attribute, multi=True)

Get the index values of a multi attribute.

Parameters

attribute (str) – The node.attribute name of a multi attribute. Eg. blendShape1.inputTarget

Returns

A list of integers that correspond to multi attribute indices.

Return type

list

get_available_slot(attribute)

Find the next available slot in a multi attribute.

Parameters

attribute (str) – The node.attribute name of a multi attribute. Eg. blendShape1.inputTarget

Returns

The next empty slot.

Return type

int

get_slots(attribute)

Given a multi attribute, get all the slots currently made.

Parameters

attribute (str) – The node.attribute name of a multi attribute. Eg. blendShape1.inputTarget

Returns

The index of slots that are open. Indices are returned as str(int)

Return type

list

get_slot_count(attribute)

Get the number of created slots in a multi attribute.

Parameters

attribute (str) – The node.attribute name of a multi attribute. Eg. blendShape1.inputTarget

Returns

The number of open slots in the multi attribute

Return type

int

clear_multi(node, attribute_name)
create_title(node, name, name_list=[])

Create a enum title attribute on node

Parameters
  • node (str) – The name of a node

  • name (str) – The title name.

create_vetala_type(node, value)

Convenience to tag nodes that are vital to the auto rig.

get_vetala_type(node)

Get the vetala type of a node.

get_vetala_nodes(vetala_type=None)

Get vetala nodes in the scene.

has_default_xform_channels(transform, skip_locked=False)

Zero out the translate and rotate. Set scale to 1.

Parameters

transform (str) – The name of a transform node.

zero_xform_channels(transform)

Zero out the translate and rotate. Set scale to 1.

Parameters

transform (str) – The name of a transform node.

add_orient_attributes(transform, context_sensitive=False)

Add orient attributes, used to automatically orient.

Parameters

transform (str) – The name of the transform.

remove_orient_attributes(transform)
show_rotate_order(transform, value=None)
hide_rotate_order(transform)
add_shape_for_attributes(transforms, shape_name)
store_world_matrix_to_attribute(transform, attribute_name='origMatrix', skip_if_exists=False)
search_for_open_input(node_and_attribute)
get_message_attributes(node, user_defined=True)
get_message_input(node, message)
connect_message(input_node, destination_node, attribute)

Connect the message attribute of input_node into a custom message attribute on destination_node

Parameters
  • input_node (str) – The name of a node. If input_node is None then only the attribute is created.

  • destination_node (str) – The name of a node.

  • attribute (str) – The name of the message attribute to create and connect into. If already exists than just connect.

connect_group_with_message(input_node, destination_node, attribute)
create_multi_message(node, attribute_name)
fill_multi_message(node, attribute_name, nodes)
append_multi_message(node, attribute_name, input_node)