本文主要是介绍maya删除父节点,一键全选,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
mel指令 删除父节点
mel指令 设置t-pose
python指令 测试ok
一键选择所有的子节点
mel指令 删除父节点
string $parentNodeName = "f_avg_root";
string $children[] = `listRelatives -children $parentNodeName`;for ($child in $children) {parent -w $child;
}delete $parentNodeName;
mel指令 设置t-pose
select -r f_avg_Pelvis f_avg_L_Hip f_avg_L_Knee f_avg_L_Ankle f_avg_L_Foot f_avg_R_Hip f_avg_R_Knee f_avg_R_Ankle f_avg_R_Foot f_avg_Spine1 f_avg_Spine2 f_avg_Spine3 f_avg_Neck f_avg_Head f_avg_L_Collar f_avg_L_Shoulder f_avg_L_Elbow f_avg_L_Wrist f_avg_L_Hand f_avg_R_Collar f_avg_R_Shoulder f_avg_R_Elbow f_avg_R_Wrist f_avg_R_Hand ;string $selToTpose[] =`ls -sl`;for ($each in $selToTpose){setAttr ($each +".r") 0 0 0 ;setKeyframe $each;}currentTime 0 ;
python指令 测试ok
import maya.cmds as cmdsnode_name="f_avg_root"
# 假定父节点的名称是 "parent_node"
children = cmds.listRelatives(node_name, children=True) or []# 解除父级关系,使子节点成为顶级节点
for child in children:cmds.parent(child, world=True)# 删除父节点
cmds.delete(node_name)
一键选择所有的子节点
把这个mel指令拖拽到工具架里面,取个名字,
调用方法:选择根节点,然后点击按钮,就全选所有子节点了。
// 获取当前选中的节点列表,选择第一个节点作为父节点
string $selection[] = `ls -sl`;
if (size($selection) > 0) {string $parentNode = $selection[0];// 选中父节点和其所有子节点select -r -hi $parentNode;
} else {print("No objects selected. Please select a parent node first.\n");
}
这篇关于maya删除父节点,一键全选的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!