What I want is to transfer information(string in this case) between max files when one file is merged to another. This is the code that I use - CA is added to rootNode and when the files are opened separately everything work. But when I merge(using maxscript or manually) one file to the other the CA from the merged file is lost.
I have tried to add CA to Layer 0 but the same happens: the CA from the merged file is not “transfered” to the current scene.
Is there any way to be achieved what I want? It have to work even when one empty scene is merged to another empty scene.
(
resetmaxFile #noPrompt
t = teapot()
-- "save to rootNode"
myData_CA_Def = attributes myDataCA1 version:1 attribID:#(0x51bd3311, 0x1d487e11)
(
parameters main
(
myString type:#string default:"Teapot CA"
)
)
CustAttributes.add rootnode myData_CA_Def
saveMaxFile @"D:\Teapot_01.max"
resetmaxFile #noPrompt
s = sphere()
-- "save to rootNode"
myData_CA_Def = attributes myDataCA2 version:1 attribID:#(0x51bd3312, 0x1d487e12)
(
parameters main
(
myString type:#string default:"Sphere CA"
)
)
CustAttributes.add rootnode myData_CA_Def
saveMaxFile @"D:\Sphere_01.max"
-- "load Teapot_01.max"
resetmaxFile #noPrompt
loadMaxFile @"D:\Teapot_01.max"
-- "print CAs"
MSCustAttribArray = rootnode.custAttributes
for ca in MSCustAttribArray do
(
format "Teapot_01 CA: % \n" ca.myString
)
-- "load Sphere_01.max"
resetmaxFile #noPrompt
loadMaxFile @"D:\Sphere_01.max"
-- "print CAs"
MSCustAttribArray = rootnode.custAttributes
for ca in MSCustAttribArray do
(
format "Sphere_01 CA: % \n" ca.myString
)
-- "merge Teapot_01.max"
mergeMAXFile @"D:\Teapot_01.max"
-- "print CAs"
MSCustAttribArray = rootnode.custAttributes
for ca in MSCustAttribArray do
(
format "Merged CA: % \n" ca.myString
)
)
