PDA

View Full Version : Removing and inserting elements in attribute arrays


sackboy
02-28-2011, 10:31 AM
Hi all,
I am developing a new maya dependency node that has a somewhat complicated input attributes. I have a compound attribute, set as an array, and I have found very difficult to work with it.

One of the problems is the difference between logical indices and physical indices. It's all good when the logical index have some real meaning (relation to a vertex index), but when it's just a simple array it complicates things. For example if I remove an element of the array, I want the indices to remain consecutive, but I haven't found a way of changing the logical index of an element to update the order as it's going to be seen from MEL to match the physical index.

The same problem arises when trying to insert an element in the middle of the array, I haven't found any way to do it, neither from the API or MEL.

I'm thinking about adding MFnTypedAttribute of type MIntArray to perform double indirection to the compound attribute array, so I can insert and delete elements more easily, but I don't feel it's the best solution.

Anyone has any solution to these problems, any help would be appreciated.
Thank you very much

CGTalk Moderation
02-28-2011, 10:31 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.