-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
BufferAttributes and Materials are cloned by reference for Object3D instances, no matter what #30351
Conversation
bugfix: clone/copy Copy VALUES, not just references to the source Attribute array This fixes e.g. 'cumulative rotations' etc., for clones which would apply transformations to their predecessors, otherwise
bugfix: clone/copy Copy VALUES, not just references to the source Attribute array This fixes e.g. 'cumulative rotations' etc., for clones which would apply transformations to their predecessors, otherwise
Simplified change to use existing methods for deep/recursive clone/copy of Object3D instances Recommend making recursive default to false, if recursive cloning of BufferAttributes and Materials is undesirable for the default.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
removed unnecessary include
added conditional testing to check for the existence of instance properties
appeasing linter...
changed clone method due to CI error
more lint worship
lint worship
moar lint worship
I think your interpretation of a recursive clone is too strict. It's not mandatory that a recursive clone must be a "deep" one that clones every aspect of the 3D object. This really depends on the use case. In most use cases, developers want to share the materials and geometries for performance reasons.
That is actually not true and it seems you misunderstand a basic aspect of 3D transformations. 3D objects with the same geometry can have different transformations without affecting each other. It's probably best if you use the forum to clarify this aspect. Sorry, but this change can't be merged. |
Related issue: #30350
BufferAttribute arrays (for Object3D instances) are cloned / copied by reference.
this causes all predecessors of a clone to receive transformations such as rotations, which are meant to be applied only to clones.
The 'recursive' parameter for Object3D instances does not conform to new user expectations, making the method counterintuitive and user-unfriendly.
Users should expect any "recursive" clone to be a complete, new set. This update should be merged, or "recursive cloning" of Object3D instances should be removed.