hello I want to convert this Mel script into a python script so I can build on top of it.
global proc motionTrailToCurve()
{
$selected=`ls -dag -et snapshotShape`;
for ($obj in $selected) {
$pts=(getAttr($obj+".pts"));
$size=size($pts);
$curve=`curve -d 1 -p $pts[0] $pts[1] $pts[2] -p $pts[4] $pts[5] $pts[6] -k 0 -k 1`;
for($i=8;$i<$size;$i+=4)
curve -os -a -p $pts[$i] $pts[$i+1] $pts[$i+2] $curve ;
}
}
motionTrailToCurve;
when I run py to mel I get this
import pymel.core as pm
def motionTrailToCurve():
selected=pm.ls(et='snapshotShape', dag=1)
for obj in selected:
pts=(pm.getAttr(str(obj) + ".pts"))
size=len(pts)
curve=pm.curve(p=[(pts[0], pts[1], pts[2]), (pts[4], pts[5], pts[6])], k=[0, 1], d=1)
for i in range(8,size,4):
pm.curve(curve, a=1, p=(pts[i], pts[i + 1], pts[i + 2]), os=1)
motionTrailToCurve()
when I run it I get this error:
Invalid arguments for flag 'p'. Expected ( distance, distance, distance ), got ( ( Point, Point, Point ), ( Point, Point, Point ) ) #
can someone point me towards the right direction on how to get this script to work in python, I'm new to all this and is just playing around trying to automate some of my workflow