Copy Joint Orientation
24 June 2024
Not fully working as intended. I needed to unparent joints for it to work.
Need to take into account hierarchy/parent space.
import pymel.core as pm
def copy_joint_orientation():
# Get the selected joints
selected_joints = pm.ls(selection=True, type='joint')
# Ensure there is at least one joint selected
if not selected_joints:
pm.warning("No joints selected. Please select at least one joint.")
return
# Get the orientation of the first joint in the list
first_joint = selected_joints[0]
first_joint_orient = first_joint.getOrientation()
# Copy the orientation to the rest of the joints
for joint in selected_joints[1:]:
joint.setOrientation(first_joint_orient)
print(f"Copied orientation from {first_joint} to {len(selected_joints) - 1} other joints.")
# Run the function
copy_joint_orientation()