ConstraintEditor

vtool.maya_lib.space.ConstraintEditor() Convenience class for editing constraints.
class ConstraintEditor

Convenience class for editing constraints.

constraint_parent = ‘parentConstraint’
constraint_point = ‘pointConstraint’
constraint_orient = ‘orientConstraint’
constraint_scale = ‘scaleConstraint’
constraint_aim = ‘aimConstraint’
editable_constraints = [‘parentConstraint’, ‘pointConstraint’, ‘orientConstraint’, ‘scaleConstraint’, ‘aimConstraint’]
has_constraint(transform)
get_weight_names(constraint)
get_weight_count(constraint)

Get the number of inputs weights (transforms) feeding int the constraint.

Parameters:constraint (str) – The name of a constraint.
get_constraint(transform, constraint_type)

Find a constraint on the transform.

Parameters:
  • transform (str) – The name of a transform that is constrained.
  • constraint_type (str) – The type of constraint to search for. Eg. parentConstraint, orientConstraint, pointConstraint, etc.
Retrun
str: The name of the constraint.
get_transform(constraint)

Get the transform that the constraint is constraining.

Parameters:constraint (str) – The name of the constraint.
Returns:The name of the transform that is being constrained.
Return type:str
get_targets(constraint)

Get the transforms influencing the constraint.

Parameters:constraint (str) – The name of the constraint.
Returns:The names of the transforms affecting the constraint.
Return type:list
remove_target(target, constraint)

Remove a target from a constraint. This only works if the constraint has all its original connections intact.

Parameters:
  • target (str) – The name of the transform target to remove.
  • constraint (str) – The name of a constraint that has target affecting it.
set_interpolation(int_value, constraint)

Set the interpolation type of the constraint.

Parameters:
  • int_value (int) – index of the interpolation type.
  • constraint (str) – The name of a constraint. Probably “parentConstraint” or “orientConstraint”.
create_title(node, constraint, title_name=’FOLLOW’)

This will create a title enum attribute based on the targets feeding into a constraint. The enum will have the name of the transforms affecting the constraint.

Parameters:
  • node (str) – The name of the node to add the title to.
  • constraint (str) – The name of a constraint. Should be affected by multipe transforms.
  • title_name (str) – The name to give the title attribute.
create_switch(node, attribute, constraint)

Create a switch over all the target weights.

Parameters:
  • node (str) – The name of the node to add the switch attribute to.
  • attribute (str) – The name to give the switch attribute.
  • constraint (str) – The name of the constraint with multiple weight target transforms affecting it.