View Full Version : CustAttributs on rootnode throw system exception

04 April 2009, 01:10 PM
Hey there,
in one of my scripts I am adding a bunch of Custom Attributes to the rootnode. Usually it works fine but once in a while it gives a nasty "-- Unknown system exception". Closing max and re-opening the file always fixes the problem. Does anyone know what might cause the system exception?

I am adding three different CA definition sets to the rootnode based on this code:

testdataCaDef = attributes testdataCA
attribID:#(0x6c0dbc3a, 0x23c71ad2)
version:1 (
parameters main (
sTest type:#string
sTestPath type:#string

fn checkOnCAs = (

testCA = rootNode.custAttributes["testdataCA"]
if ( testCA == undefined ) then (
format "adding custom attributes\n"
try (
custattributes.add rootnode testdataCA
) catch (
errMsg = "Critical error : Failed to add custom attributes to scene root node"
MessageBox errMsg title:"Internal system error"
else (
format "custom attributes exists in scene\n"



Then, sometimes, it throws the system exception if I try to access some of the CAs (e.g. rootnode.testdataCA.sTestPath) while others still work fine.

Any ideas?

04 April 2009, 01:47 PM
hi lena,

are you on max 2009? if so, it's a bug, the service pack should fix it.

04 April 2009, 01:56 PM
nope, Max2008 64bit

04 April 2009, 02:05 PM
I'd guess the same bug exists in 2008. Perhaps it's safe to set something up on a trackviewnode instead? It has the added advantage that any animatable parameters are automatically exposed in trackview.. if they're something you'd want people to be able to interact with that way, at least.

custAttributes.add trackviewnodes <MSCustAttribDef>

04 April 2009, 02:18 PM
hmmm, that's bad news.

And no, there is no need for the parameter to bee seen by the user in the trackview and the parameter won't ever be animated.

Could you give me some more specific information about this bug? What is causing it? Where could I find more information about it?


04 April 2009, 02:51 PM
if you check the service packs/hotfixes for max 2009 it is mentioned in the readme for one of them - i think its SP1

04 April 2009, 04:35 PM
Ok, I will check that. Thanks.

04 April 2009, 08:40 AM
Lena, do you have this issue if you apply the CAdef to an attribute holder modifier?

04 April 2009, 11:49 AM
No, I didn't use any attribute holder modifier. No modifier at all.
I checked the service packs/hotfixes readme for max 2009 but couldn't find any information about my problem either.

04 April 2009, 12:49 PM
ok, i didnt know if it was a problem when you were assigning to the root node, that's all. Maybe you could try this to see if it a blanket CA bug.

in the readme here ( for max 2009 SP1 there is a short part that reads -

custom attributes -
Newly created custom attributes work without restarting 3dsMax/3dsMax Design 2009

not really heplful, i know. However, I had this exact problem with 2009 until I installed this patch so perhaps it was there with 2008 like richard said.

04 April 2009, 01:07 PM
If I had a sure-fire way of triggering the issue, I could test in a few max versions.. but odds are that it is indeed in 2008 and that your only solutions are to store the CA elsewhere or upgrade to 2009 (2010).

04 April 2009, 01:07 PM
Hey Pete,
thanks for the information. I read a different document...

I also believe now, that my problem is that bug you mentioned. I will try to keep track whether it only crashes when the CAs got newly created. But I think that's the case.

Thank y'all for your help.

04 April 2009, 01:20 PM
Richard, I am not that storing the CAs elsewhere would fix the problem?! The readme doesn't say that the bug only appears with CAs on the rootnode, but I read it as it happens for newly created Cas in general, no?

04 April 2009, 01:33 PM
I know you don't want it to appear in the trackview, but I mostly use this code to add CA's to the scene.

theScene = (refs.dependents rootNode)[1]
custAttributes.add theScene YourCA

Never had problems, but haven't tried it in 2008, hardly used it in production.

Just a thought.

04 April 2009, 01:54 PM
hi johan,

so is this if you want to add CA functions that can be used on a scene level, that stay with the scene, like a persistent global? I have not used this method, always preferring to add to an object.

04 April 2009, 02:09 PM
I don't see why not a CA is a CA, wherever applied. I use the scene level to assign certain data, haven't used functions yet in that particular case, but don't see why you can't use it.

For example I'm building a metadata like CA in the sceneroot, just like Legie appears to be wanting, that store what the previous file was who changed the last file etc. Like a poor man's CVS. I use that data also to have a reversed incremental save, which I call incremental push. This allows you to work with incremental numbers in your work file, but when you push the file back, it overwrites the main file (whoms file name and last version was stored in the CA). There's numoures things I would like to store in the scene root. RPManager does the same thing.

My "philosofy":
Scene specific data to the scene root
Object specific data to the object, preferably in a emptymodifier.
(With the exception of settings that need to be merged into other scene's)


04 April 2009, 02:27 PM
I see, thanks for that. As most of my stuff is character based - I didn't know you could store them in the scene root. thanks Johan.

Lena - sorry i had missed this fact in your first post, i took it the mean 'baseobject' but it does seem to be a generic CA bug, regardless of where it is placed. :hmm:

04 April 2009, 02:42 PM
in the code, the line

custattributes.add rootnode testdataCa is throwing an error, i had to change to
custattributes.add rootnode testdataCaDef

in order to see what was going on. I'm guessing this is a typo and not the error you were having an issue with!

04 April 2009, 04:35 PM
LoneRobot: yes, just a typo, sorry about that!

Ok, I have a new version of the problem: On one machine we got the "System Exception" when the script was accessing a custom attribute on the rootnode; then I opened the exact same scene on another machine with exact the same environment (3dsMax Version etc.) and it works! What the hack...
And restarting Max did not solve the problem as it usually does. Only after a million restarts, merging the scene back and forth into new, reset-ed scenes, it finally worked at some point.

CGTalk Moderation
04 April 2009, 04:35 PM
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.