That description of how to use a struct really helped me out a lot. I've been using it in other scripts and I love it.
I'm running into one issue regarding using a struct of key arrays and "deepcopy". I'm saving the selected keys in the track view into a struct that defines arrays of the keys (the struct also holds the other info Swordslayer suggested).
I'm trying to make that key array a unique array that no longer points to the actual keys in the track editor from which they came. The reason I want to do this is, so I can paste those keys back onto the same track (but perhaps with a value offset). It seems like they need to be a separate entity as altering the tracks keys would alter the keys in my array and cause unexpected results.
Here's an example (from Swordslayer):
struct keyInfo (ctrl, index, keys, parentCtrl, name = getSubAnimName parentCtrl index)
local currentTV = trackViews.current
local selCount = currentTV.numSelTracks()
global copyTracks = for i = 1 to selCount
where (local ctrl = currentTV.getSelected i).keyable = true) collect
keyInfo ctrl:ctrl keys:ctrl.keys \
index:(currentTV.getSelectedSubNum i) \
parentCtrl:(currentTV.getParentOfSelected i)
------------------------
After getting the values for this struct's arrays, I want to be able to do stuff to the tracks and their keys without changing the values in the struct arrays.
Maxscript Help describes using "deepcopy" to do this, but it doesn't work for me. I tried
copyTracks = deepcopy copyTracks
myKeys = deepcopy copyTracks[1].keys
Both times, if I did something like this:
myKeys[1].value = 25, it would ALSO assign 25 to copyTracks[1].keys[1].value.
How do I do this?
Thanks