PDA

View Full Version : mel multi-dimensional string array


justinms66
07-15-2012, 07:41 PM
I would like to create a multidimensional array with strings:

meshes={
{ "PolyMesh01", "PolyMesh02" },
{ "PolyMesh03" },
{ "PolyMesh04", "PolyMesh05", "PolyMesh06" }
};
Can this be achieved with mel scripting?

NaughtyNathan
07-15-2012, 07:58 PM
no, MEL doesn't have arrays of more than 1D. However, there are certainly ingenious ways around this.

The easiest way is to use some existing MEL support procs, stringArrayToString and stringToStringArray. you can use these to convert a string array into a single string which you can then put into an array (and vice versa). This basically gives you 2D string arrays.

A more complicated way is to use nodes in Maya to store your strings in multi arrays, but this is a bit more involved.

The most complicated way (but also the most rewarding) is to learn python and use that. python arrays (lists) are things of unbelievable beauty and power.

justinms66
07-16-2012, 03:49 PM
Interesting, thank you, that's extremely helpful!

depakeen
07-17-2012, 10:15 AM
no, MEL doesn't have arrays of more than 1D.
Actually, Maya has 2D arrays: matrices. But a matrix only supports float values...

NaughtyNathan
07-17-2012, 01:20 PM
Actually, Maya has 2D arrays: matrices. But a matrix only supports float values...yeah, matrices are useful to mention when we're talking exclusively about strings... :rolleyes: :D ;)

CGTalk Moderation
07-17-2012, 01:20 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.