# invalid attribute index

 09 September 2005 Dyrn Veteran invalid attribute index I'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 __________________ self-plug! - winged dude - post apocaplytic - share quote
 09 September 2005 harmless Frequenter James Gaczkowski USA this: \$pont = pointPosition ("pPlane1.vtx [\$numvert]"); should be this: \$pont = pointPosition ("pPlane1.vtx [" + \$numvert + "]"); share quote
 09 September 2005 harmless Frequenter James Gaczkowski USA int \$x = 3 ; int \$y = 5 ; string \$trickMaya = ("matrix \$m[" + \$x + "][" + \$y + "];") ; eval \$trickMaya ; //\$m is your variable-sized matrix Cheers share quote
 09 September 2005 Dyrn Veteran Thanks, eh. I've realized, however, why there was no obvious way to make a variable-sized matrix. SO, here's my next question. Is there any way to wipe past matrices? As it stands, the variable-sized matrix works like a charm the first time, and then seizes up because it won't overwrite the past iteration of itself. Thoughts? __________________ self-plug! - winged dude - post apocaplytic - share quote
 09 September 2005 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.