蟒蛇玛雅 - 选择儿童' nurbs'然后隐藏钥匙

时间:2014-04-04 00:17:44

标签: python maya

下面的脚本选择所选对象的所有子nurbCurves。我遇到的问题是,在运行脚本后,子节点中没有任何键出现在时间轴中。这是为什么?我怎么能纠正这个?

测试脚本。创建一些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 个答案:

答案 0 :(得分:1)

您正在选择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)
相关问题