Skip to content

Store meta for instanced scenes

Rafał Mikrut requested to merge github/fork/KoBeWi/metainstancing into master

Created by: KoBeWi

I investigated #12990 and noticed that metadata is a hardcoded exception for instances. I was going to put a comment in the issue, but then decided to try my luck with making a PR right away :v (maybe it will be closed, but will raise more awareness for the issue)

Removing the exception makes the metadata correctly saved, but it also permanently overwrites the metadata from original scene. If you e.g. set root node as locked and instance it in another scene, then the lock will also be saved in the other scene. And when you remove it from the original scene, the lock in the new scene will stay.

Now, should this be expected behavior? The dictionaries are compared by reference and since metadata is now always unique, the metadata in the instanced scene will never be equal to the original one, thus every instance will serialize duplicate metadata of original scene. We could somehow force metadata to be compared by value, but still, any modification will make the dictionary unique and store all keys.

So uh, in case this is acceptable, the PR can be merged. If not, meta serialization needs some rework to fix the issue.

Resolves #12990 Fixes #12838 Helps #33790

Merge request reports