Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Gobal scripted attributes doesn't update to new def when loaded

Gobal scripted attributes doesn't update to new def when loaded

Anonymous
Not applicable
236 Views
1 Reply
Message 1 of 2

Gobal scripted attributes doesn't update to new def when loaded

Anonymous
Not applicable
hi,

I'm trying to use a global scripted attributes (with attribID) to store variables in the rootnode, instead of using persistents globals.

I'm having problem with updating the definition.
When i update it using the same name and attribID, and then load a scene with the old one, i'm expecting it to update to the new one. But instead, the old def overide the new one !


Here step by step what i'm doing:

create attribute def:
global myAttrib = attributes myAttrib attribID:#(0x6b59619, 0x1f35b5f2) version:1
(
parameters params
(
param1 type:#string default:"name1"
)
)


add attribute to the scene root:
custattributes.add rootnode myAttrib


save the scene. close it.

update attribute definition:
attributes myAttrib attribID:#(0x6b59619, 0x1f35b5f2) version:2
(
parameters params
(
param1 type:#string default:"name1"
param2 type:#string default:"name2"
)
)


reload old scene: Old definition is not updated, instead it is loaded and replace the new one.
myAttrib.source
"attributes myAttrib attribID:#(0x6b59619, 0x1f35b5f2) version:1
(
parameters params
(
param1 type:#string default:"name1"
)
)
"



Here what is said in the maxscript reference:
Whenever you evaluate an attributes definition with a particular attribID: you will update all objects that have custom attributes based on that definition, and loading objects with attributes of that attribID will update themselves to the current definition.
0 Likes
237 Views
1 Reply
Reply (1)
Message 2 of 2

paulneale
Advisor
Advisor
What is happening is every time that you merge in an old file it is like evaluating the ols attribute def, his is why the new one is being over ridden. Maybe run a pre and post file merge call back, check the def, if new then grab it, do the merge then check it again and update if necessary.
Paul Neale

http://paulneale.com


Paul Neale




EESignature

0 Likes