feat: refactor spring bones from GLB extras to item metadata#3395
feat: refactor spring bones from GLB extras to item metadata#3395decentraland-bot wants to merge 11 commits intofeat/spring-bonesfrom
Conversation
Refactor spring bone parameter storage from GLB file extensions (Option 1) to wearable item metadata JSON (Option 2). - Remove GLB binary patching (patchGltfSpringBones) - Save spring bone params to item.data.springBones metadata on save - Load spring bone params from metadata in ItemProvider - Simplify parseSpringBones to only detect bone names/hierarchy - Add SpringBonesData type to WearableData - Update tests to reflect new metadata-based approach Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coverage Report for CI Build 25020093935Coverage decreased (-0.3%) to 50.599%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
| if (isConnected && id && item) { | ||
| void this.loadAnimationData(item) | ||
| void this.loadSpringBonesData(item) | ||
| this.props.onLoadSpringBones(item) |
There was a problem hiding this comment.
| this.props.onLoadSpringBones(item) | |
| void this.props.onLoadSpringBones(item) |
| if (isConnected && id && item && item.id !== prevProps.item?.id && item.type === 'emote') { | ||
| if (isConnected && id && item && item.id !== prevProps.item?.id) { | ||
| void this.loadAnimationData(item) | ||
| void this.props.onLoadSpringBones(item) |
There was a problem hiding this comment.
do we want to load the springBones for emotes as well?
There was a problem hiding this comment.
Yes, maybe the name is not 100% self-explanatory, it should be: onClearThenReLoadSpringBones. It clears the spring bones from the previously selected item (wearable/emote) and then loads new spring bones only for wearables. I followed the same pattern as loadAnimationData had originally (that is supposed to run only for wearables, but the condition item.type === 'emote' is inside the loadAnimationData function)
There was a problem hiding this comment.
onClearThenReLoadSpringBones sounds a bit long, but I can update if you consider it best
| yield call(pushSpringBoneParamsToPreview) | ||
| } | ||
|
|
||
| function* parseSpringBonesForShape(item: Item, bodyShape: BodyShape) { |
There was a problem hiding this comment.
| function* parseSpringBonesForShape(item: Item, bodyShape: BodyShape) { | |
| function* parseSpringBonesForBodyShape(item: Item, bodyShape: BodyShape) { |
|
|
||
| item.data = { | ||
| ...item.data, | ||
| springBones: Object.keys(models).length > 0 ? { version: 1, models } : undefined |
There was a problem hiding this comment.
could we move the 1 to a const, something like SPRING_BONES_VERSION?
Summary
patchGltfSpringBones.tsdeleted)item.data.springBonesmetadata instead of patching GLB binaryitem.data.springBones.models[contentHash]instead of GLB extensionparseSpringBones.tsto return bone names/hierarchy only (no param extraction from GLB)springBonestoWearableDatatype inmodules/item/types.tsMetadata shape:
{ "springBones": { "version": 1, "models": { "contentHash": { "SpringBone_hair_l": { "stiffness": 2.0, ... } } } } }Test plan
item.data.springBones(not GLB)Pending tasks
Requested by Rocío Corral Mena via Slack
🤖 Generated with Claude Code