[editor] ID system
Closed this issue · 3 comments
Right now the editor uses names to identify items, which is not great as names must be unique or there are conflict, which is not enforced by gltf. If a model doesn't have names, we must generate names for them, which is currently done by the client only, assuming other clients import the model with the same deterministic algo for generating names.
A better approach is to use IDs. When the editor is opened, it will generate a unique ID for each item (node, mesh, etc), then network these IDs to other players, using the gltf indices to identify items.
These IDs could be saved into gltf extras on save, but I don't think we need to save them.
Might be a good idea actually to save IDs into gltf extras - when we save the scene and the gltf is exported, the indexes for each node, mesh, etc may change. New players joining will download the new model and will not be able to set ids using the same indexes, but if the downloaded has the IDs already things should hopefully work fine.
(didnt add gltf extra saving, might in the future will see if things break without it)