我在曲线上找到了所有的CV,我想在每个曲线上创建一个簇。但我收到的错误不是很有帮助。这是代码:
# Find all the CVs on the curve, loop through and create a cluster on each
curveCVs = cmds.ls(targetCurve + ".cv[0:]",fl=True)
for i, cv in enumerate(curveCVs):
print i, cv
cmds.cluster(wn=(cv, cv))
错误在cmds.cluster中的wn标志的参数上。
# Error: RuntimeError: file <maya console> line 211: Invalid transforms specified.
文档说参数应该是一个字符串。例如。 wn =(“thing1”,“thing2”)
但即使我尝试手动输入CV字符串,它也不起作用。
cmds.cluster(wn=("targetPath.cv[14]", "targetPath.cv[14]"))
还有其他方法吗?
答案 0 :(得分:1)
你几乎得到了它。以下是您使用cmds.cluster
:
import maya.cmds as cmds
targetCurve = 'curve1' # Curve to put clusters on
curveCVs = cmds.ls('{0}.cv[:]'.format(targetCurve), fl = True) # Get all cvs from curve
if curveCVs: # Check if we found any cvs
for cv in curveCVs:
print 'Creating {0}'.format(cv)
cmds.cluster(cv) # Create cluster on a cv
else:
cmds.warning('Found no cvs!')