kishikaisei
03-27-2010, 06:09 PM
Hello there;
i'm trying to convert the curveToBones.mel, a bonus tool from autodesk to python
so this what i've done:
import maya.cmds as mc
def curveToJoint(numBones):
curves = mc.ls (selection = True)
for curve in curves:
mc.select (clear = True)
curveInfo = mc.pointOnCurve (curve, constructionHistory = 1)
mc.setAttr ( curveInfo + ".turnOnPercentage", 1)
joints = []
for i in range (1, numBones):
parameter = i * (1.0/numBones)
mc.setAttr ( curveInfo + ".parameter", parameter)
position = mc.getAttr (curveInfo + ".position")
joints[i] = mc.joint (position = (position[0][0],
position[0][1],
position[0][2]) )
mc.delete (curveInfo)
mc.joint (joints, edit = True, orientJoint = "xyz")
but maya creates 1 joint and give me this error:
# Error: IndexError: list assignment index out of range #
and idea about that ?
thanks for Help !
i'm trying to convert the curveToBones.mel, a bonus tool from autodesk to python
so this what i've done:
import maya.cmds as mc
def curveToJoint(numBones):
curves = mc.ls (selection = True)
for curve in curves:
mc.select (clear = True)
curveInfo = mc.pointOnCurve (curve, constructionHistory = 1)
mc.setAttr ( curveInfo + ".turnOnPercentage", 1)
joints = []
for i in range (1, numBones):
parameter = i * (1.0/numBones)
mc.setAttr ( curveInfo + ".parameter", parameter)
position = mc.getAttr (curveInfo + ".position")
joints[i] = mc.joint (position = (position[0][0],
position[0][1],
position[0][2]) )
mc.delete (curveInfo)
mc.joint (joints, edit = True, orientJoint = "xyz")
but maya creates 1 joint and give me this error:
# Error: IndexError: list assignment index out of range #
and idea about that ?
thanks for Help !
