PDA

View Full Version : invalid attribute index

 Dyrn09-20-2005, 02:13 PMI'm fairly new to MEL scripting, but my grasp of programming principles is solid. I'm working on a script that should find the y-coordinate of each vertex of a plane, and save everything into a matrix for later use. Now, I've already been burnt because I couldn't use a variable where I wanted to (initial matrix dimensions), and I really, REALLY hope that's not the case here. See Below. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // step 1 //build a matrix to hold the Y values //no variable-dimension matrices my ass // take this, MEL //************************************** //************************************** int \$subz = getAttr ("polyPlane1.subdivisionsHeight") + 1 ; int \$subx = getAttr ("polyPlane1.subdivisionsWidth") + 1 ; matrix \$yval[200][200] ; //************************************** //************************************** // step 2 // get the y values of each point of // the plane and keep it in the matrix //************************************** //************************************** int \$x ; int \$z ; int \$numvert = 0 ; vector \$pont ; for (\$x = 0; \$x <= \$subx; \$x++) { for (\$z = 0; \$z <= \$subz; \$z++) { \$pont = pointPosition ("pPlane1.vtx [\$numvert]"); \$yval [\$z][\$x] = \$pont ; \$numvert++ ; } } print \$yval ; // Error: Invalid attribute index: pPlane1.vtx [\$numvert] // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Is this a case of I have to use a number, not a variable, to specify the vertex for the pointPosition command? If not, could someone tell me what the crap I'm doing wrong? If so, does anyone have any suggestions as per workarounds? Thanks all
harmless
09-20-2005, 03:28 PM
this:
\$pont = pointPosition ("pPlane1.vtx [\$numvert]");

should be this:
\$pont = pointPosition ("pPlane1.vtx [" + \$numvert + "]");

harmless
09-20-2005, 03:34 PM
int \$x = 3 ;
int \$y = 5 ;

string \$trickMaya = ("matrix \$m[" + \$x + "][" + \$y + "];") ;
eval \$trickMaya ;