In C, C++ and Java you have the concept of a structure, i.e. a way of collecting together related data in a single package. For example, in C++ you would be able to write :
// declare a new data type to hold a vector struct Vector { float x; float y; float z; }; // create a variable called V, of // type Vector Vector v; // set it's attributes... v.x = 0; v.y = 10; v.z = 0; |
Structures allow our code to take on a much more organised approach to data storage. By grouping together attributes your eventual programs become simpler, ie storing an array of objects rather than seperate arrays for all the components.
One of the biggest drawbacks of mel scripting is the inability to use any structures within mel. This does actually make our lives somewhat difficult :(
In effect we need to find some way of creating some form of structured storage. The answer it turns out, is fairly obvious. Maya has a rather nice scenegraph capable of storing structured objects on which we can dynamically add our our custom attributes via script.
The other plus points as far as we are concerned are that we also get persistant data storage, ie - the data we store in a node will be saved into and loaded from maya binary files. We also get a handy gui of the data for free since all extra attributes can be viewed in the attribute editor and channel box.