Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(composer): Fixes the duplication of sub models #356

Merged
merged 2 commits into from
Nov 11, 2022

Conversation

jwills-jdubs
Copy link
Contributor

Overview

Sub Models previously relied on appendSceneNodeInternal preventing.a duplicate based purely on the reference Id and the Object3D.id of the original sub model. The problem is both ThreeJS and our Ids are not persisted by design.

The solution was to add a property specifically to sub models that reference the "ID" of the sub model object. The only persisted case here is the name and changing that within the model in something like Blender is still a way to mess this up however I do believe unless you specifically name objects the most 3D applications will provide a new name. We then check all nodes in the scene for the property matching the name. If we find it we do not add the sub model to the scene as was occurring when within the same session.

Legal

This project is available under the Apache 2.0 License.

@jwills-jdubs jwills-jdubs marked this pull request as ready for review November 11, 2022 20:02
@jwills-jdubs jwills-jdubs changed the title fix(composer): Fixes the Duplication of sub models fix(composer): Fixes the duplication of sub models Nov 11, 2022
… adding persistant identifier to the sub model
} as ISceneNodeInternal;

appendSceneNodeInternal(node);
setSceneNodeObject3DMapping(nodeRef, object3D); // Cache Reference
}, [object3D]);
}, [object3D, document.nodeMap]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically I'd flag this, but approving as this is made available via useSceneDocument.

@jwills-jdubs jwills-jdubs merged commit 446a4ca into main Nov 11, 2022
@jwills-jdubs jwills-jdubs deleted the fix/duplicate-submodel branch November 11, 2022 20:56
@github-actions github-actions bot mentioned this pull request Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants