Notifications
Clear all

[Closed] Custom Attribute Versions

I have a big problem concerning global scripted custom attributes (the ones with attrib ID): Let’s say you create a simple custom attribute and assign it to on object save it and xref it into another scene. It works well as long as there are no objects with a newer version of this attributes in the scene. If this is the case the new version will be replaced by the old one!

Does anyone know a way to prevent max from replacing newer custom attribute version so that the latest version is always kept?

Many thanks
Andreas

5 Replies
1 Reply
 PEN
(@pen)
Joined: 11 months ago

Posts: 0

You need to make the ca def unique so that it doesn’t get updated.

Thanks, that’s not exactly what I want, but it could work. But how do I convert the unique attribute back into an non unique one of the latest version so it gets updated by new versions? I could remove the custom attribute from all objects and add a new one but that would kill all the values.

 PEN

Ah so you want the object that is being merged in to take on the definition that is already in the scene?

I think that you would have to set up a callBack and on post file merge get all the defs in the scene and update the ones that you want. Problem here is if there are params in the current scene def that are not in the incomming def they will be lost and then replaced and so will any animation on them. So I think that they only is to update the defs before the merge.

So there is no way to prevent an attribute from being updated? I already included an “on update” event in the attribute definition which tells me whenever a version is “downgraded”, but until now I didn’t find a way to stop the updating at this point.

Sadly, no you can’t stop the updating. For custom attributes, load time is evaluation time. The custom attributes will be updated no matter what the version number. Also, making the custom attribute unique can also be problematic, depending on how many custom attribute instances you are talking about.

Every custom attribute has a definition. When you make a CA unique, it instantiates the definition. These definitions do not automatically garbage collect when you delete the attribute, so you can end up with alot of cruft if you don’t manually delete the definitions.

Ultimately, the versioning system that custom attributes inherit from scripted plugins is broken in custom attributes.