View Full Version : mel list question

02 February 2011, 04: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?


02 February 2011, 11: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...

02 February 2011, 12:49 PM
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!)

02 February 2011, 12:58 PM
thanks guys! this was really helpful!

CGTalk Moderation
02 February 2011, 12:58 PM
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.