Joint Mover Utilities

Code author: Jeremy Ernst

This module contains helper functions for dealing with joint movers and creating joint movers. The class JointMoverUtils, is a UI with methods to aid in joint mover creation, such as marking up joints with parameters that get used when auto-generating the mover controls.

Functions

class JointMoverUtils(parent=None)[source]

This class provides a user interface with methods to aid in joint mover file creation.

_images/JointMoverUtils.png

Functions:

Markup Joints()

Marks joints up with attributes that will be used when the JointMover class builds the controls on top of the joints. These attributes tell the JointMover class which control shape to use, how big the control is, what the offset is, if the joint should aim at the child, and if the joint is a twist joint.

Create Preview Movers()

Creates joint mover controls for the selected joints using the markup data on the joints (such as control size, control shape, and control offset).

Delete Preview Movers()

Deletes the preview movers.

Note

Don’t leave preview movers in your scene!

create_mover(control_path, jnt, key='mover')[source]

Creates the joint mover control for the given joint, using the given file path for which shape to use.

Parameters:
  • control_path (str) – The file path to the control shape to use.
  • jnt (PyNode) – The joint to create the mover for.
  • key (str) – Whether to create a global mover (key=”mover”) or an offset mover (key=”mover_offset”)
Returns:

Returns the created mover group and mover control nodes.

Return type:

[], PyNode

create_mover_containers(name)[source]

Creates containers for the various nodes that get created when building the joint mover. This includes an overall container for the entire asset, an overall container for this component, and then containers for the mover controls themselves and the utility nodes that get created when hooking up the joints to the offset movers.

Parameters:name (str) – The unique name of the component.
Returns:Returns the created PyNode containers.
create_movers_from_joints(name, joint_hierarchy_root)[source]

Given a joint hierarchy that has had the joints marked up, create joint mover controls for each joint based on those mark-up parameters.

Parameters:
  • name (str) – Unique name of the component.
  • joint_hierarchy_root – The top of the skeletal hierarchy that we want to create joint movers from.
Returns:

Returns a dictionary of PyNodes where the keys are the joint PyNodes, and the values of each are the mover nodes created for that joint.

drive_joints_with_movers(mover_data, name)[source]

Hook up the joints so that they are driven by the offset mover that was created from said joint.

Parameters:
  • mover_data – The dictionary of PyNodes that has the joint as the key, and the created movers as the value.
  • name – The unique name of the component.
drive_joints_with_offsets(mover, jnt, main_asset)[source]

Takes the given joint mover control and the given joint, and hooks them up so the mover drives the joint’s translation and rotation.

Parameters:
  • mover (PyNode) – Joint mover offset control transform.
  • jnt (PyNode) – The joint to drive translation and rotations on.
  • main_asset (PyNode) – The container to add the created utility nodes to.
mark_joint_movers(mover_data, name)[source]

Marks the joint mover controls with metadata attributes. For example, is the given node a mover control, or just a buffer group? What is the mover type? Which component does this mover belong to?

Parameters:
  • mover_data – The joint mover nodes (PyNodes) that have been created.
  • name (str) – The component’s unique name.
markup_joints()[source]

Finds joints in the file, and marks them up with attributes that will be used when building the joint mover controls. These attributes are things like: the control shape to build, the size of the control, the offset to apply to the control, whether the joint is a twist joint, etc.

setup_cv_scaling(node)[source]

Creates a setup where the current CV positions of the given node are multiplied by a value, which results in changing its total size.

Parameters:node (PyNode) – The transform node of the control
Returns:A list of PyNodes that are the created multiplyDivide nodes.
Return type:[], PyNodes
setup_mover(jnt, control_path, scale_factor, container)[source]

Creates a normal joint mover control setup for the given joint. Normal means that the joint receives a global mover and an offset mover with buffer groups above each.

Parameters:
  • jnt (PyNode) – The PyNode of the joint to create the setup.
  • control_path (str) – The path to the control shape file.
  • scale_factor (float) – The amount to scale the control by.
  • container (PyNode) – The container (PyNode) to add the created nodes to.
Returns:

Returns a list of PyNodes where the first element is the joint PyNode, and the second element is a list of the created mover nodes.

Return type:

[], PyNode

setup_twist_mover(jnt, control_path, scale_factor, container)[source]

Creates a twist joint mover control setup for the given joint. A twist joint setup is no global mover, and instead, a group that is driven by constraints to keep the twist joint along the X axis of the parent. Every channel on the offset control except for TranslateX is locked as well, to keep the twist joint aligned properly.

Parameters:
  • jnt (PyNode) – The PyNode of the joint to create the setup.
  • control_path (str) – The path to the control shape file.
  • scale_factor (float) – The amount to scale the control by.
  • container (PyNode) – The container (PyNode) to add the created nodes to.
Returns:

Returns a list of PyNodes where the first element is the joint PyNode, and the second element is a list of the created mover nodes.

Return type:

[], PyNode

show_window()[source]

Show the JointMoverUtils tool.