Joint Mover

Code author: Jeremy Ernst

class JointMover(path, metanode)[source]

Class for creating and working with a joint mover rig, which is a simplified rig used to aid in the creation of a skeleton, keeping it clean and consistent.

_connect_movers_to_metanode(nodes)[source]

Connect the joint mover controls to the owning component’s metanode.

Parameters:nodes – a list of joint mover controls (PyNodes)
_find_nodes_to_rename(nodes, old_prefix, old_suffix)[source]

Given a list of nodes, find only the transforms and rename them.

Parameters:
  • nodes – A list of PyNodes
  • old_prefix – The old prefix.
  • old_suffix – The old suffix.
Returns:

Return a list of nodes(PyNodes) to rename, with their new name (str): [[node1, newName], [node2, newName]]

static _rename_dependent_attrs(renamed_nodes)[source]

Renames the parentComponentBone attribute on any components that had a bone that was renamed.

Parameters:renamed_nodes – List of PyNodes and their new names. Used to check if the parentComponentBone attribute value is in that list, and if so, will then rename the attribute value for parentComponentBone.
add_joint_mover()[source]

Adds the joint mover maya ascii file to the maya scene.

create_joint_mover_controls(root_joint)[source]

Creates the joint mover controls on the joints that come in from the ascii file.

Parameters:root_joint – Root joint of the hierarchy from the joint mover ascii file.
get_containers()[source]

Get and return the containers that our joint mover controls and utility nodes are contained in.

Returns:PyNodes of containers that our joint mover controls and utility nodes reside in.
get_created_joints()[source]

Finds and returns the joints created by this JointMover.

Returns:string array of joint names
get_driven_joints()[source]

Return the joint mover joints currently driven by the movers (these are not the same as the created joints).

Returns:List of PyNodes representing the joint mover joints.
get_mover_values()[source]

Get the translation, rotation, and scale values of the joint mover controls.

Returns:Returns a dictionary of the joint mover transformation values. The dictionary is returned as: key = mover name, value = dictionary of attributes as keys, and their values as the values. For example: {calf_mover: {translateX: 5.00, translateY: 0.00, translateZ: 10.00}}
get_movers()[source]

Finds and returns the joint mover control objects created by the JointMover.

Returns:Dictionary of joint movers with the keys: global and offset.
_lock_joint_movers(lock=True, lock_children=False)[source]

Method for locking down the joint mover nodes so they cannot be deleted (or unlocking them).

Parameters:
  • lock (bool) – Whether to lock or unlock the nodes.
  • lock_children (bool) – Whether to lock all children of the nodes, whether they are movers or not.
remove_movers()[source]

Remove the generated joint mover controls from the driven joints (as well as any associated containers, nodes).

rename_movers(old_prefix, old_suffix)[source]

Renames joint movers with the new component prefix and/or suffix.

Parameters:
  • old_prefix (str) – The old prefix to search/replace
  • old_suffix (str) – The old suffix to search/replace
return_top_mover_grp()[source]

Finds the top-most global mover group and returns it.

Returns:string name of the top-most global mover group.
set_mover_parent(parent)[source]

Parents the top-most group in the joint mover file under the given parent joint’s global mover.

Parameters:parent (str) – Name of parent joint.
static set_mover_values(value_data)[source]

Sets values on the joint mover controls.

Parameters:value_data – The values to set on the controls. It should be formatted like the dictionary generated by the get_mover_values method.
toggle_build_joint(joint, group, build=True)[source]

Sets the metadata on the joint mover controls to either build or not build the given joint.

Parameters:
  • joint (str) – The joint whose build state is being toggled.
  • group (str) – The name of the joint mover control group that includes that joint.
  • build (bool) – Boolean value of whether to toggle the attribute on or off.
metanode

This property holds the metanode that is passed in from our component using the joint mover.

Returns:Returns the metanode from our component as a pynode.