Hello
I have a workin MEL code that I need to convert to python.
I'm not really sure how would I set values on doubleArray attributes - it's weird already with MEL.

So, what would be the translation of following into python :

global proc attachPref(string $sh, int $worldSpace)
{
    string $a= $sh + "." + "delightVertexPointPref";
    if(!`objExists ($a)`)
        addAttr -dt "doubleArray" -ln "delightVertexPointPref" $sh;

    //get points positons and write into one big string $data
    int $ptsCnt= `getAttr -s ($sh+".controlPoints")`;
    string $data;
    float $pos[3];
    for($i= 0; $i<$ptsCnt; ++$i) {
if($worldSpace) $pos= `xform -q -ws -t ($sh + ".vtx[" + $i + "]")`;
        else            $pos= `xform -q     -t ($sh + ".vtx[" + $i + "]")`;
        $data += $pos[0] + " " + $pos[1] + " " + $pos[2] + " ";
    }

    eval setAttr $a -type "doubleArray" (3*$ptsCnt) $data;
}

The last line is the important part :)

Thanks !
ps. this is urgent :)

--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to