Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I started this question to write a useful command for this. Question by Questioner
About how to select and delete only child joints.
I answered.
use the removeJoint command.
import maya.cmds as cmds
cmds.removeJoint()
If you write a complex command, you could select all the joints and run it to select and remove only the child joints, but I can't think of a command like that. I am sorry.
and I searched.
Code source: https://tech-art.online/maya-python-recursive/
from maya import cmds
# 階層構造の末端ジョイントを取得する再帰関数
def getEndJoints(root):
end_joints = []
children = cmds.listRelatives(root, c=True, type="joint")
if children is None:
return [root]
for child in children:
end_joints.extend(getEndJoints(child))
return end_joints
end_joints = getEndJoints("root")
cmds.select(end_joints)
The command wanted is,
- Duplicate and erase joints of children with the same name
- Ability to find and remove terminal child joints from long joints
The code of the command source must have the root name as root.
or else I can select children's joints.
Thank you for help.
Solved! Go to Solution.