[Closed] Custim Attributes on the world node??
So I noticed one of my character rigs had some strange tracks in the curve editor , when nothing is selected:
I had always assumed that a Custom Attribute had to be assigned to some max object. It looks like you can assign Custom Attributes to the world and/or the max scene itself, rather than on an object in the world?
I’d like to diagnose where these CAs come from, and what their defs are , but I only know how to access CAs via $object.modifiers [#whatever]. I’m not sure how to access a CA that appears attached to the world like this.
There’s a rootScene global variable (in earlier max version youd use (refs.dependents rootNode)[1] instead). So for example for i = 1 to custAttributes.count rootScene collect custAttributes.getDef rootScene i
They are caused by statesets and can appear without you even using them. Not sure why, but since I don’t use them either, all I care about is getting rid of them. Which you can by running the following code…
thescene = undefined
thescene = (refs.dependents rootnode)[1]
if(thescene.custAttributes.count != 0) do
for i = thescene.custAttributes.count to 1 by -1 do
custattributes.delete thescene (custattributes.getdef thescene.custAttributes[i])
thanks for your replies.
My fix was manual – create a new file and import assets from the old one.
this cleaned up those extra CAs.
If these keep showing up I’ll script something.
so, adding my own CA to a scene looks like
--define some custom attributes
my_ca = attributes custom_scene_attribs (
<some attribs>
)
--add the to the scene
custAttributes.add rootScene my_ca
a belated thank you to everyone who replied.
those pesky CAs kept showing up so I finally incorporated a routine to scrub them regularly.