vtool.maya_lib.rigs_util

Class Summary

Control(name) Convenience for creating controls
StoreControlData([node])
StretchyChain() rigs
RiggedLine(top_transform, btm_transform, name) rigs
RigSwitch(switch_joint) Create a switch between different rigs on a buffer joint.
MirrorControlKeyframes(node)

Function Summary

rename_control(old_name, new_name)
rename_message_groups(search_name, replace_name)
create_joint_buffer(joint[, connect_inverse])
create_distance_scale(xform1, xform2[, …]) Create a stretch effect on a transform by changing the scale when the distance changes between xform1 and xform2.
create_sparse_joints_on_curve(curve, …) Create joints on a curve that are evenly spaced and not in hierarchy.
create_joints_on_curve(*args, **kwargs) Create joints on curve that do not aim at child.
create_spline_ik_stretch(curve, joints[, …]) Makes the joints stretch on the curve.
create_simple_spline_ik_stretch(curve, joints) Stretch joints on curve.
create_bulge_chain(joints, control[, max_value]) Adds scaling to a joint chain that mimics a cartoony water bulge moving along a tube.
create_distance_falloff(source_transform[, …]) Under development.
create_attribute_lag(source, attribute, targets) Add lag to the targets based on a source attribute.
create_attribute_spread(control, transforms) Given a list of transforms, create a spread attribute which will cause them to rotate apart.
create_attribute_spread_translate(control, …) Given a list of transforms, create a spread attribute which will cause them to translate apart.
create_offset_sequence(attribute, …) Create an offset where target_transforms lag behind the attribute.
get_controls([namespace]) Get the controls in a scene.
select_controls([namespace])
key_controls([namespace])
mirror_control(*args, **kwargs) Find the right side control of a left side control, and mirror the control cvs.
mirror_controls(*args, **kwargs) Mirror cv positions of all controls in the scene.
mirror_curve([prefix]) Mirror curves in a scene if the end in _L and _R
process_joint_weight_to_parent(mesh) Sometimes joints have a sub joint added to help hold weighting and help with heat weighting.
joint_axis_visibility(*args, **kwargs) Show/hide the axis orientation of each joint.
hook_ik_fk(control, joint, groups[, attribute]) Convenience for hooking up ik fk.
fix_fade(target_curve, follow_fade_multiplies) This fixes multiplyDivides so that they will multiply by a value that has them match the curve when they move.
scale_controls(*args, **kwargs)
fix_sub_controls(*args, **kwargs)
set_control_space(x, y, z, control[, …])

Functions

rename_control(old_name, new_name)
rename_message_groups(search_name, replace_name)
create_joint_buffer(joint, connect_inverse=True)
create_distance_scale(xform1, xform2, axis=’X’, offset=1)

Create a stretch effect on a transform by changing the scale when the distance changes between xform1 and xform2.

Parameters:
  • xform1 (str) – The name of a transform.
  • xform2 (str) – The name of a transform.
  • axis (str) – “X”, “Y”, “Z” The axis to attach the stretch effect to.
  • offset (float) – Add an offset to the value.
Returns:

(locator1, locator2) The names of the two locators used to calculate distance.

Return type:

tuple

create_sparse_joints_on_curve(curve, joint_count, description)

Create joints on a curve that are evenly spaced and not in hierarchy.

create_joints_on_curve(*args, **kwargs)

Create joints on curve that do not aim at child.

Parameters:
  • curve (str) – The name of a curve.
  • joint_count (int) – The number of joints to create.
  • description (str) – The description to give the joints.
  • attach (bool) – Wether to attach the joints to the curve.
  • create_controls (bool) – Wether to create controls on the joints.
Returns:

[ joints, group, control_group ] joints is a list of joinst, group is the main group for the joints, control_group is the main group above the controls. If create_controls = False then control_group = None

Return type:

list

create_spline_ik_stretch(curve, joints, node_for_attribute=None, create_stretch_on_off=False, create_bulge=True, scale_axis=’X’)

Makes the joints stretch on the curve. Joints must be on a spline ik that is attached to the curve.

Parameters:
  • curve (str) – The name of the curve that joints are attached to via spline ik.
  • joints (list) – List of joints attached to spline ik.
  • node_for_attribute (str) – The name of the node to create the attributes on.
  • create_stretch_on_off (bool) – Wether to create extra attributes to slide the stretch value on/off.
  • create_bulge (bool) – Wether to add bulging to the other axis that are not the scale axis.
  • scale_axis (str) – ‘X’, ‘Y’, or ‘Z’, the axis that the joints stretch on.
create_simple_spline_ik_stretch(curve, joints, stretch_axis=’Y’)

Stretch joints on curve. Joints must be attached to a spline ik. This is a much simpler setup than create_spline_ik_stretch.

Parameters:
  • curve (str) – The name of the curve that joints are attached to via spline ik.
  • joints (list) – List of joints attached to spline ik.
create_bulge_chain(joints, control, max_value=15)

Adds scaling to a joint chain that mimics a cartoony water bulge moving along a tube.

Parameters:
  • joints (list) – List of joints that the bulge effect should move along.
  • control (str) – Name of the control to put the bulge slider on.
  • max_value (float) – The maximum value of the slider.
create_distance_falloff(source_transform, source_local_vector=[1, 0, 0], target_world_vector=[1, 0, 0], description=’falloff’)

Under development.

create_attribute_lag(source, attribute, targets)

Add lag to the targets based on a source attribute. A lag attribute will also be added to source to turn the effect on and off. If you are animating the rotation of a control inputs are as follows:

create_attribute_lag( ‘CNT_FIN_1_L’, ‘rotateY’, [‘driver_CNT_FIN_2_L, ‘driver_CNT_FIN_3_L’, ‘driver_CNT_FIN_4_L’] )

Parameters:
  • source (str) – The node where the attribute lives. Also a lag attribute will be created here.
  • attribute (str) – The attribute to lag. Sometimes can be rotateX, rotateY or rotateZ.
  • targets (list) – A list of targets to connect the lag into. The attribute arg will be used as the attribute to connect into on each target.
create_attribute_spread(control, transforms, name=’spread’, axis=’Y’, invert=False, create_driver=False)

Given a list of transforms, create a spread attribute which will cause them to rotate apart.

Parameters:
  • control (str) – The name of a control where the spread attribute should be created.
  • transforms (list) – A list of transforms that should spread apart by rotation.
  • name (str) – The name of the attribute to create.
  • axis (str) – Can be ‘X’,’Y’,’Z’
  • invert (bool) – Wether to invert the spread behavior so it can mirror.
  • create_driver (bool) – Wether to create a driver group above the transform.
create_attribute_spread_translate(control, transforms, name=’spread’, axis=’Z’, invert=False)

Given a list of transforms, create a spread attribute which will cause them to translate apart. This is good for fingers that are rigged with ik handles.

Parameters:
  • control (str) – The name of a control where the spread attribute should be created.
  • transforms (list) – A list of transforms that should spread apart by translation.
  • name (str) – The name of the attribute to create.
  • axis (str) – Can be ‘X’,’Y’,’Z’
  • invert (bool) – Wether to invert the spread behavior so it can mirror.
create_offset_sequence(attribute, target_transforms, target_attributes)

Create an offset where target_transforms lag behind the attribute.

get_controls(namespace=”)

Get the controls in a scene.

It follows these rules

First check if a transform starts with “CNT_” Second check if a transform has a an attribute named control. Third check if a transform has an attribute named tag and is a nurbsCurve, and that tag has a value. Fourth check if a transform has an attribute called curveType.

If it matches any of these conditions it is considered a control.

Returns:List of control names.
Return type:list
select_controls(namespace=”)
key_controls(namespace=”)
mirror_control(*args, **kwargs)

Find the right side control of a left side control, and mirror the control cvs.

It follows these rules: It will only match if the corresponding right side name exists.

Replace _L with _R at the end of a control name. Replace L_ with R_ at the start of a control name. Replace lf with rt inside the control name

mirror_controls(*args, **kwargs)

Mirror cv positions of all controls in the scene. See get_controls() and mirror_control() for rules.

mirror_curve(prefix=None)

Mirror curves in a scene if the end in _L and _R

process_joint_weight_to_parent(mesh)

Sometimes joints have a sub joint added to help hold weighting and help with heat weighting. This will do it for all joints with name matching process_ at the beginning on the mesh arg that is skinned.

Parameters:mesh (str) – A mesh skinned to process joints.
joint_axis_visibility(*args, **kwargs)

Show/hide the axis orientation of each joint.

hook_ik_fk(control, joint, groups, attribute=’ikFk’)

Convenience for hooking up ik fk.

Parameters:
  • control (str) – The name of the control where the attribute arg should be created.
  • joint (str) – The joint with the switch attribute. When adding multiple rigs to one joint chain, the first joint will have a switch attribute added.
  • groups (list) – The ik control group name and the fk control group name.
  • attribute (str) – The name to give the attribute on the control. Usually ‘ikFk’
fix_fade(target_curve, follow_fade_multiplies)

This fixes multiplyDivides so that they will multiply by a value that has them match the curve when they move.

For example if eye_lid_locator is multiplyDivided in translate to move with CNT_EYELID. Pass its multiplyDivide node to this function with a curve that matches the btm eye lid. The function will find the amount the multiplyDivide.input2X needs to move, so that when CNT_EYELID moves on Y it will match the curvature of target_curve.

Parameters:
  • target_curve (str) – The name of the curve to match to.
  • follow_fade_multiplies (str) – A list of a multiplyDivides.
scale_controls(*args, **kwargs)
fix_sub_controls(*args, **kwargs)
set_control_space(x, y, z, control, compensate_cvs=True)