PDA

View Full Version : mel list question


Arrhenius
02-17-2011, 03:01 PM
ok im quite new to scripting in mel,and this may aswell be a very basic question or so.

if I have a list containting objects in it already, how do i add several things later on into that same list, and still keep the previous stuff in it?

thanks!

Azrail
02-21-2011, 10:22 AM
You can use stringArrayCatenate/appendStringArray for string array and copyArray for float arrays. There is no straightforward way of doing so with integers, so you'll have to make some iterator to convert them to floats and add them with copyArray for example (at least I can't think of other way for now).
Array management in mel is kinda real pain in the rear...

NaughtyNathan
02-21-2011, 11:49 AM
adding individual items onto any array type can be done like so:

int $vtxIds[] = { 33,34,43,44,61,79,80 };
string $objects[] = { "|pCube1","|pCube2","|polySurface17" };

$vtxIds[size($vtxIds)] = 112;
$objects[size($objects)] = "|pCube6";
but as Azrail says, for adding an array onto an array you need a loop or one of the built-in MEL scripts (which are basically just a loop that does the above!)
:nathaN

Arrhenius
02-21-2011, 11:58 AM
thanks guys! this was really helpful!

CGTalk Moderation
02-21-2011, 11:58 AM
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.