Notifications
Clear all

[Closed] Equiv't of Xref RootNode CAs

Greetings

Just a quickie, as I suspect the answer is ‘No’.

Is it possible to read rootnode custom attributes from a .max file without opening it?

Cheers

Mikie

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

are you waiting for the answer? … and my answer is… the answer is… … YES!

… and NO at the same time.
you have to open max file but you don’t have to reload your current scene. you only need temporary xref the scene with the attribute, read it from scene root, and remove the scene.

there is no other solution and can’t be. you can check the existence on a custom attribute by searching the name in binary stream… but there is no way to read a data of ca.
so xref scene the only solution that i see.

OOOH! I’ve only ever played with xref objects, as opposed to xref scenes… Will have a read of the docs, have a play, and see how it goes!

… learn something new everyday, that certainly comes in handy.

For the bonus round…
I would guess, by the 1 way nature of xrefs I cannot externally modify the xref values

i.e.

bob = xrefs.addNewXRefFile <filename>
 localCopy = for a in bob.tree.cusattributes collect c -- still very useful for me
 bob.tree.cusattributes[1].blahParameter = 2 -- would be sooper dooper useful if this worked
 delete bob

You can set it but it doesn’t store with the max file so when you reopen the file it will be the original value again. You can sort this by using postload script or callback however. But that requires you log all the changes and write to a script.