trigger.library.attribute

Attribute related library functions.

Attributes

LOG

Functions

attribute_pass(sourceNode, targetNode[, attributes, ...])

Copies the attributes from source node to the target node.

create_attribute(node[, property_dict, keyable, display])

Create attribute with the properties defined by the property_dict.

create_global_joint_attrs(joint[, moduleName, upAxis, ...])

Creates Trigger specific global attrubutes.

disconnect_attr([node, attr, suppress_warnings])

Disconnects all INCOMING connections to the attribute

drive_attrs(driver_attr, driven_attrs[, driver_range, ...])

Creates a ranged connection between driver and driven attr(s)

get_next_index(attr[, startFrom])

Returns the next free index from a multi index attribute

is_locked(node, attr)

Returns the locked state of the given attribute on defined node

is_visible(node, attr)

Returns the channelbox state of the given attribute on defined node

lock_and_hide(node[, channelArray, hide])

Locks and hides the channels specified in the channelArray.

query_limits(node, attribute[, only_hard_limits])

Query the limits of scalar attributes both transform and custom ones.

separator(node, name[, border])

Create an attribute providing a visual separator in the channel box.

unlock(node[, attr_list])

Unlocks the list of provided attributes on defined node

validate_attr(attr[, attr_range, nice_name, ...])

Validate attribute.

Module Contents

attribute_pass(sourceNode, targetNode, attributes=None, inConnections=True, outConnections=True, keepSourceAttributes=False, values=True, daisyChain=False, overrideEx=False)

Copies the attributes from source node to the target node. Args:

sourceNode: (Unicode) Source Object which the attributes will be copied from targetNode: (Unicode) Target Object which the attributes will be copied onto. attributes: (List of Strings) Optional. If left blank, all user defined custom attributes will be copied. Accepts String list. inConnections: (Bool) whether the incoming connections will be copied or not. Default is True. daisyChain overrides this argument. outConnections: (Bool) whether the incoming connections will be copied or not. Default is True. If True, the present out connections of source object will be lost. keepSourceAttributes: (Bool) If False the copied attributes will be deleted from the source node. Default is False values: (Bool) If True the values of the attributes will be copied as well daisyChain: (Bool) If true, instead of copyAttr command, it connects the source attributes to the target attributes. Non-destructive. Overrides inConnections and outConnections. overrideExisting: (Bool) When this flas set to True, if an Attribute on the target node with the same name exists, it gets deleted and created again to ensure it has the same properties.

Returns: None

create_attribute(node, property_dict=None, keyable=True, display=True, **kwargs)

Create attribute with the properties defined by the property_dict. Args:

node (str): Node to create attribute on property_dict (dict, optional): This holds the necessary information for the attribute:

{<nice_name>: (Optional) nice name for the attribute,

<attr_name>: name of the attribute, <attr_type>: Valid types are “long”, “short”, “bool”, “enum”, “float”, “double”, “string” <enum_list>: Must be a single string (in spite of the name) e.g. “option1:option2:option3”

Required if the attr_type is “enum”.

<default_value>: (Optional) Can be float, integer, string or bool depending on the attr_type.

If not provided it is 0, “”, or False depending on the attr_type

<min_value>: (Optional) Float or Integer. Default is -99999 <max_value>: (Optional) Float or Integer. Default is 99999

For easier use, each these elements can be entered as kwargs.

keyable (bool, optional): Makes the attribute keyable and visible in the channelbox display (bool, optional): Makes the attr displayable in the cb

Returns:

create_global_joint_attrs(joint, moduleName=None, upAxis=None, mirrorAxis=None, lookAxis=None)

Creates Trigger specific global attrubutes.

Args:

joint: (String) Targer Joint moduleName: (String) Optional. Name of the module name. If none given, joint name will be used instead upAxis: (Tuple) Overrides default upAxis Values for Trigger mirrorAxis: (Tuple) Overrides default mirrorAxis Values for Trigger lookAxis: (Tuple) Overrides default lookAxis Values for Trigger

Returns:

disconnect_attr(node=None, attr=None, suppress_warnings=False)

Disconnects all INCOMING connections to the attribute

drive_attrs(driver_attr, driven_attrs, driver_range=None, driven_range=None, force=True, optimize=True, proxy_driver_attr=None)

Creates a ranged connection between driver and driven attr(s) Args:

driver_attr: (String) Driver Attribute. Eg. pPlane.tx driven_attrs: (List or String) Driven attribute or list of driven attributes. “pSphere.sx” or [“pSphere.sx”, “pSphere.sy”] driver_range: (Tuple or List) Optional. Minumum and maximum range of driver. If not provided, there will be a direct connection between driver and driven driven_range: (Tuple or List) Optional. Minumum and maximum range of driven. If not provided, there will be a direct connection between driver and driven force: (Bool) If true, any existing connections on driven will be overriden. optimize: (Bool) When enabled, it uses direct connections where applicable. Default True proxy_driver_attr (str, optional): If defined this attribute will be created as a proxy for the driver_attr.

Returns:

get_next_index(attr, startFrom=0)

Returns the next free index from a multi index attribute

is_locked(node, attr)

Returns the locked state of the given attribute on defined node

is_visible(node, attr)

Returns the channelbox state of the given attribute on defined node

lock_and_hide(node, channelArray=None, hide=True)

Locks and hides the channels specified in the channelArray. Args:

node : (String) target object channelArray: (List) the channels as string values. eg: [“sx”, “sy”, “sz”] or [“translateX”, “rotateX”, “sz”] hide: (Bool) if false, the attributes will be only locked but not hidden. Defaulf True

Returns: None

query_limits(node, attribute, only_hard_limits=True)

Query the limits of scalar attributes both transform and custom ones.

Args:

node(str): Name of node to query limits. attribute(str): Name of the attribute to query limits. only_hard_limits(bool): If True, soft limits for custom attribute are not

going to be considered as a limit. Default True.

separator(node, name, border='-')

Create an attribute providing a visual separator in the channel box.

Args:

node (str): The node to add the attribute to. name (str): The name of the attribute. border (str): The type of character to surround the name.

Default is = but other good options are _ or -.

Returns:

str: The name of the attribute created.

unlock(node, attr_list=None)

Unlocks the list of provided attributes on defined node

validate_attr(attr, attr_range=None, nice_name=None, attr_type='float', default_value=None, keyable=True, display=True)

Validate attribute.

Check if attr exists, and create if it doesn’t

LOG