H3ro
06-21-2006, 02:40 PM
I am trying to modefy a mesh that I have, but I cant change the X and Z position of the vertexes, so I can only change them I y.
To do so I am trying to make a "cleanup" script, that first make a copy of the mesh (befor i modefy it) and then when I want to it sets the X and Z position of all the vertexes right.
My script dont work, any inputs would have been great.
//set object and make a reference
global proc setObj ()
{
string $objMain[] = `ls -sl`;
duplicate;
string $objRef[] = `ls -sl`;
move -r 0 8 0;
rename $objMain[0] "targetObjectForCube";
rename $objRef[0] "BaseObjectForCube";
setAttr "BaseObjectForCube.visibility" 0;
}
//global proc copy ()
{
//save vertex information
select "BaseObjectForCube";
ConvertSelectionToVertices;
string $vertRef[] = `ls -sl -flatten`;
select "targetObjectForCube";
ConvertSelectionToVertices;
string $vertTarget[] = `ls -sl -flatten`;
float $noOfvert = size($vertTarget);
//find the position of the vertex
for( $i = 0; $i < $noOfvert; $i++ )
{
vector $position = `xform -ws -q -t $vertRef[$i]`;
//apply it to the other object
setAttr "targetObjectForCube.pnts["+$i+"].pntx" $position.x;
setAttr "targetObjectForCube.pnts["+$i+"].pntz" $position.z;
}
}
Thanks:)
To do so I am trying to make a "cleanup" script, that first make a copy of the mesh (befor i modefy it) and then when I want to it sets the X and Z position of all the vertexes right.
My script dont work, any inputs would have been great.
//set object and make a reference
global proc setObj ()
{
string $objMain[] = `ls -sl`;
duplicate;
string $objRef[] = `ls -sl`;
move -r 0 8 0;
rename $objMain[0] "targetObjectForCube";
rename $objRef[0] "BaseObjectForCube";
setAttr "BaseObjectForCube.visibility" 0;
}
//global proc copy ()
{
//save vertex information
select "BaseObjectForCube";
ConvertSelectionToVertices;
string $vertRef[] = `ls -sl -flatten`;
select "targetObjectForCube";
ConvertSelectionToVertices;
string $vertTarget[] = `ls -sl -flatten`;
float $noOfvert = size($vertTarget);
//find the position of the vertex
for( $i = 0; $i < $noOfvert; $i++ )
{
vector $position = `xform -ws -q -t $vertRef[$i]`;
//apply it to the other object
setAttr "targetObjectForCube.pnts["+$i+"].pntx" $position.x;
setAttr "targetObjectForCube.pnts["+$i+"].pntz" $position.z;
}
}
Thanks:)
