Notifications
Clear all

[Closed] Merging linked layer references in custom attributes conundrum

I’ve submitted an “official” defect report to Autodesk about this btw.

Hi Guys,

Interesting problem you’ve got here. I was wondering why max was crashing on me after adding custom attributes to some layers so this thread has saved a huge amount of time on working out what the problem was! Thanks for that.

I’ve been mulling this over and come up with a different way of fixing the problem. Granted it’s not perfect however.

On a filePreMerge callback do:
–Loop through all layers
–Append all data to a temporary array including layer ref
–Delete CA

On a filePostMerge callback do:
–Loop through all layers
–Create CA
–Set values from temporary array using layer ref

I’ve tested this and it stops max from crashing, but it’s not a perfect solution. If a user does not have this callback running and does a merge/Xref operation, max will crash. I guess this is just as good/bad as the layer rename option, just a different way of approaching it.

Is there any way of accessing rootNode/globaltracks CA’s on merge? Perhaps data stored there is a more reliable solution, but I’m not aware of a way of accessing it via merge.

Are you sure your solution works for all cases? I recall that the scene you merge into does not have to contain any CA to make the crash occur. So if the layer in the ‘external’ scene that you merge from has CA, and a similarly named layer without CA exists, it will crash. I don’t think the premerge callback will be able to avoid that.
In the opening post I posted a pre/post merge ‘solution’ too, where the original layers are renamed pre-merge, then named back and combined where necessary on post-merge.

Hmm I’ve done a bit more testing and this is interesting:

When I was testing the above callback method I was merging a max file with a sphere in a layer called “Layer01”. This merged into a scene every time with a layer already in the scene called “Layer01” – this layer both with and without custom attributes.

After your post I went back and tested it with 2 layers, both containing a sphere. Max crashed immediately.

So basically, no, the above script does not work at all. Apologies for that. But max will successfully import a layer with custom attributes if there is only one layer to merge. Odd.

EDIT:
Done some more testing. It seems to be both layer count and object count related. A file merge operation will only complete successfully if:
–The max file being merged contains only one extra layer (so two in total including layer 0)
–The max file being merged contains only one object.

If the above is not true, max seems to crash every time.

Looking at the “test” script here, that scene only contains one new layer, one object…

Yep, every time that script is run max throws a system exception. After using that script I went back to my old file that I successfully merged before and this time it crashed. I’ve yet to get it to merge successfully again, and I’ve tried about 20 times… I’m trying to think if I was doing anything differently before but I’m absolutely positive I’m not. I also tried redoing every step I did previously, saving out a new max file to merge, and this crashed max too. I’m starting to doubt myself before, but I’m sure it was working properly! :banghead:

Thanks for submitting a defect report to Autodesk regarding this problem. Although as you say if they do fix it, it will be for future versions only. I guess for now the only safe method is using the rootNode with no merge capabilities

Page 4 / 4