Joints
- center_joint(jnt, child=None)
Center a joint between its parent and child.
- Parameters:
jnt (PyNode) – A joint node to be centered
child – An optional child joint, necessary if the joint has more than one child
- fixup_joint_orient(joint, aim_axis='x', keep_axis='y', preserve_children=False)
Orient the joint to point down the bone, preserving one existing axis of the current orientation.
- Parameters:
joint (Joint) – The joint to modify
aim_axis (str) – The axis to aim down the bone, default is ‘x’
keep_axis (str) – The axis to preserve, default is ‘y’
- freeze_joints(joint, rotate=True, scale=True)
Freeze rotates and scales on a joint hierarchy without creating intermediate transform nodes
- Parameters:
rotate (bool) – If true, freeze rotations
scale (bool) – If true, freeze scales
joint (pm.PyNode) – A Transform node
- get_child_joints(jnt)
Recurse through children to find and return any children joints, even if they are not immediate children. Will include the first joint found for each branch.
- Parameters:
jnt (PyNode) – A joint node
- get_end_joints(jnt)
Recurse through children and return all joints that have no joint children.
- Parameters:
jnt (PyNode) – A joint node
- get_ik_pole_vector_and_mid_point(root: pymel.core.dt.Vector, mid: pymel.core.dt.Vector, end: pymel.core.dt.Vector)
Return the pole vector and corresponding mid-point between the root and end positions of an ik joint chain.
- Parameters:
root – The location of the root joint
mid – The location of the mid joint
end – The location of the end joint
- Returns:
Tuple of (pole_vector, pole_mid_point)
- get_ik_pole_vector_and_mid_point_for_joint(end_joint)
Return the pole vector and corresponding mid-point between the root of an ik joint setup and the given end joint
- Returns:
Tuple of (pole_vector, pole_mid_point)
- get_joint_matrices(jnt)
Return the WorldMatrix, Rotation, RotationAxis, and JointOrientation matrices for a joint.
- get_parent_joint(jnt)
Returns the first parent of a given joint that is also a joint.
- Parameters:
jnt – A Joint node
- get_root_joint(jnt)
Get the top most joint for the given joint in a joint chain
- Parameters:
jnt – A Joint node
- insert_joints(child_jnt, count=1)
Insert one or more joints as parents of a joint.
- Parameters:
child_jnt – A Joint node, the inserted joint will be a parent to this joint.
count – The number of joints to insert.
- orient_ik_joints(end_joint, aim_axis='x', pole_axis='y', preserve_children=False)
Orient the two parent joints of the given end joint to line up with the IK plane created by the triangle between all three joints.
- Parameters:
end_joint (Joint) – The end joint, the two parent joints will be modified
aim_axis (str) – The axis to aim down the bone, default is ‘x’
pole_axis (str) – The axis to aim along the ik pole vector
preserve_children – If true, prevent child joints from moving.
- orient_joint(joint: pymel.core.nt.Joint, axis_order='xyz', up_axis_str='y', **kwargs)
Orient the joint to point down the bone
- Parameters:
joint – The joint to orient.
axis_order (str) – The axis order for orienting, e.g. ‘xyz’, ‘zyx’, …
up_axis_str (str) – The axis of the node that should be pointing up, represented as a string, e.g. ‘x’, ‘y’, ‘z’
kwargs – Any valid kwargs for the joint orient command
- orient_joint_custom(joint, aim_vector, up_vector, aim_axis='x', up_axis='y', preserve_children=False)
Orient a joint to point the aim_axis down aim_vector, keeping up_axis as closely aligned to up_vector as possible. The third axis will be computed.
- orient_joint_to_parent(joint, preserve_children=False)
Orient a joint to match it’s parent joint orientation.
- orient_joint_to_rotation(joint, preserve_children=False)
Orient a joint to match its current rotation. This is synonymous with freezing a joint’s rotation.
- Parameters:
joint
preserve_children
- orient_joint_to_world(joint)
Orient the joint to match the world aligned axes
- rotate_joint_orient(joint, rotation)
Rotate the orientation of a joint
- Parameters:
joint (Joint) – The joint to modify
rotation (Vector) – The rotation to apply to the orient
- set_joint_matrices(jnt, matrix, r, ra, jo, translate=True, rotate=True)
Set the matrices on the given joint. TODO: make this also affect scale
- set_joint_parent(child, parent)
Parent the given child joint to parent. Handles parenting the joint directly rather than inserting a buffer transform.
- Parameters:
child – A joint to be parented.
parent – A joint to be the new parent of child.
- set_joint_rotation_matrix(jnt, matrix)
Set the rotation matrix of a joint. This is done by setting the joint orient and rotation axes, rather than setting the rotation (?).
This affects the translate and scale axes, which means children’s positions must be updated. Normal joint orientation only affects the rotation.