python maya - 选择子项'nurbs'并隐藏关键帧
下面的脚本会选择选定对象的所有子nurb曲线。我的问题是,运行这个脚本后,子节点的关键帧在时间轴上都不显示。这是为什么呢?我该怎么修正这个问题?
要测试这个脚本,你可以先创建几个nurb曲线控制器,并给它们设置位置动画。然后把它们放在一起,让它们的父级都是同一个主控制器。接着选择这个主控制器,运行脚本。
import maya.cmds as cmds
# Get selected objects
curSel = maya.cmds.ls(sl=True)
# Or, you can also specify a type in the listRelatives command
nurbsNodes = maya.cmds.listRelatives(curSel, allDescendents=True, noIntermediate=True, fullPath=True, type="nurbsCurve", path=True)
cmds.select(nurbsNodes)
1 个回答
2
你正在选择 nurbsCurve
的 形状,但是你的动画是在 变换 上进行的。
# list the shape nodes
nurbsShapes = maya.cmds.listRelatives(curSel, allDescendents=True, noIntermediate=True, fullPath=True, type="nurbsCurve", path=True)
# list the transform nodes to each shape node
nurbsTransforms = maya.cmds.listRelatives(nurbsShapes, type='transform', parent=True)
# select the transform nodes
cmds.select(nurbsTransforms)