fix: use deepClone for Skin._skinMatrices to prevent undefined after clone#2941
fix: use deepClone for Skin._skinMatrices to prevent undefined after clone#2941cptbtptpbcptdtptp wants to merge 1 commit intogalacean:dev/2.0from
Conversation
When cloning a Skin object, _skinMatrices should be deep cloned instead of ignored. Using @ignoreClone causes the cloned Skin to share the same Float32Array reference with the original, leading to incorrect skinning behavior when the clone is modified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev/2.0 #2941 +/- ##
===========================================
+ Coverage 77.07% 77.12% +0.04%
===========================================
Files 899 899
Lines 98229 98229
Branches 9683 9693 +10
===========================================
+ Hits 75706 75755 +49
+ Misses 22355 22306 -49
Partials 168 168
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 Augment PR SummarySummary: Fixes Skin cloning to avoid shared skinning matrix buffers between the original and its clone. 🤖 Was this summary useful? React with 👍 or 👎 |
|
|
||
| /** @internal */ | ||
| @ignoreClone | ||
| @deepClone |
There was a problem hiding this comment.
Consider adding a small regression test that Skin.clone() produces an independent _skinMatrices (i.e., not the same Float32Array reference), since this change is specifically fixing shared-state cloning bugs.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Summary
@ignoreCloneto@deepCloneforSkin._skinMatricespropertyFloat32Arrayfor skin matrices instead ofundefinedProblem
When cloning a Skin object,
_skinMatriceswas decorated with@ignoreClone. According to the clone logic inCloneManager.cloneProperty(), whenCloneMode.Ignoreis set, the property is skipped entirely during cloning. This results in the cloned Skin object having_skinMatricesasundefined, which causes rendering issues when the cloned SkinnedMeshRenderer tries to update skin matrices.Solution
Use
@deepCloneinstead to create a deep copy of theFloat32Array, ensuring each cloned Skin instance has its own properly initialized skin matrices array.Test plan
_skinMatrices🤖 Generated with Claude Code