-
-
Notifications
You must be signed in to change notification settings - Fork 112
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(primitive): implement as proxy to avoid breaking references #764
Conversation
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andretchen0 I think I'm gonna pin this PR somewhere just as an example of how a PR should be done, thanks for the incredible amount of work, this is how primitives should have been working fro the beginning but now thanks to you they work.
This is the last in a series of PRs to implement primitives in a way that doesn't break references in
<script setup>
(see #701). With this PR,<primitive>
is now implemented as a JSProxy
.Problem
#701 Under the hood,
<primitive />
copies its:object
. This breaks references to the object in<script setup>
.Solution
Implement
<primitive />
as a JSProxy
.Playground
http://localhost:5173/issues/701
Problem
#751 Rigged models are squished and do not animate. Bones and animations lose their reference to the model.
Solution
Implement
<primitive />
as a JSProxy
.Playground
http://localhost:5173/models/rigged
Problem
#721 Tres typically removes/disposes in descendants-first order – children are removed before parents.
nodeOps.remove
sometimes calls a THREE object'sdispose
method. THREE'sdispose
implementation does not check for the existence of attributes before trying to delete them – which can result in a user-facing error.Solution
Try/catch on
dispose
innodeOps.remove
.Problem
Cientos' components using primitives under the hood – Sparkles and Contact Shadows – do not work under Tres
v4
.Solution
Implement
<primitive />
as a JSProxy
.Playground
http://localhost:5173/issues/701-cientos-v4
closes #751
closes #721
closes #701