On 23/11/20 11:01 am, Brecht Van Lommel wrote:
The solutions I'm suggesting are to either use a PointerProperty (which will not become invalid), or store data on the object itself rather than referencing the object.
Yes, these are perfect solutions in cases when they are sufficient. But sometimes they cannot replace real unique identifier. I guess this is why many end up just using object names since they are guaranteed to be unique within single .blend file. And after putting a lot of effort to write and optimize my own UID support I see why - it is just hard and error prone to implement from scratch in an addon. It is also not efficient, especially in large scenes, where looping through thousands or tens of thousands of objects in Python is not fast at all (even if the loop does not do much).

The question is if for example the Godot use case would be helped by having it globally unique, so that e.g. renaming .blend files or splitting .blend files into smaller ones also works.
I see. I guess this depends on the use case. I think the best solution is to allow to reset UUID - then if somebody needs to make sure copies of their objects are globally unique, they can do so by regenerating their UUIDs. But if somebody wants them to stay stable, they do not need to worry that renaming or copying .blend will break existing UUIDs.

Exporters usually export the evaluated objects rather than the original ones, so it's an important case. One that at least would have to be taken into account when someone contributes a patch for this.

We already have a mechanism for stable IDs for instances. I imagine that can be combined with a stable UUID of the original datablock to get a stable UUID for evaluated datablocks.
This sounds like a good idea. It will not hurt use cases where stable UUID does not matter, and will definitively help when stable UUID is important. For these evaluated objects UUID will be not resetable - once it generated, it will stay the same even if generated again. But I cannot think of a scenario where this would be an issue (especially if it would be possible to reset UUID of original datablock - could be useful if working with a copy of .blend file to make sure all UUIDs are globally unique).

_______________________________________________
Bf-committers mailing list
Bf-committers@blender.org
https://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to