Custom Controllers or Custom Attributes stacked?

So i’m trying to figure out a pipeline problem, and I want to know if I’m over-thinking it or going down the wrong path entirely.

We have a bunch of animation max files that have multiple anims in each file. stuff like loops and multiple layered animations. This creates a problem when i do a batch export in that my exporter is a pretty ‘dumb’ process. it just opens the file and exports nodes based on a modifier.

What i want to do is attach info for each animation set into the file. for example, if i had a looping animation with an intro (0f-7f) a loop (8f-24f) and outro (25f-30f) I would want to attach 3 data sets. When my batch exporter opens this file, it would search for this data, and export an animation for each set found.

I’ve found a way to store the data inside a Custom Attribute. I’ve actually found out that you can add a custom attribute to another CA, nesting them inside one another, which is great, as now i can have access to it all like so:



$Rig.AnimPropsCA.AnimSet01.fileName
$Rig.AnimPropsCA.AnimSet01.filePath
$Rig.AnimPropsCA.AnimSet02.fileName
$Rig.AnimPropsCA.AnimSet03.FileName
etc...

the only problem I can see with this is that in order to loop through them I would have to build the above code as a string then execute it to get access to the nested CAs, instead of being able to loop like so:


local setCount = $rig.AnimProps.NumOfDataSets
for i = 1 to setCount do
(
     local fileName = $rig.animProps[i].fName
     local filePath =  $rig.animProps[i].fPath
     local animRange =  $rig.animProps[i].AnimRange1
     animationRange = interval animrange
     export (filePath + FileName) #noPrompt
)


does anyone know if there a way to do that? and if so, how?

thanks!

-ian

Did you check out the subanims? I’ve never done exactly this but there’s rarely if ever been controller data I couldn’t figure out how to access. It was always one of those things that took experience to know what to try to see where it was hiding, and I don’t remember enough of my experiences.

It seems to me that the standard, custAttributes.count and custAttributes.get methods would allow you to loop through them.

Example :


local setCount = custAttributes.count $rig.AnimProps
for i = 1 to setCount do
(
     ChildCA = custAttributes.get $rig.AnimProps i
     local fileName = ChildCA.fName
     local filePath =  ChildCA.fPath
     local animRange =  ChildCA.AnimRange1
     animationRange = interval animrange
     export (filePath + FileName) #noPrompt
)

that works!

I knew I was over-complicating it somewhere. As ever the solution is just looking at me right in the face.

Thanks Chad!

-ian