Preserve physical properties in USD IO#1534
Open
yutingye wants to merge 2 commits into
Open
Conversation
Summary: Round-trips per-joint physical mass properties (mass, center-of-mass offset, inertia tensor, and inertia rotation) through FBX. On save, each entry is serialized to JSON and written as a `physicalProperties` string custom property on the owning FBX skeleton node. On load it is read back from those joint nodes. Root metadata remains only character metadata; the physical body data is owned by the skeleton nodes it describes. Joint resolution on save reuses `resolvePhysicalPropertiesJointIndex` (the same helper the glTF path uses), so a stale cached `jointIndex` falls back to the joint name. The loader is resilient: a joint whose `physicalProperties` property is malformed, or whose embedded JSON fails to parse or validate, is logged and skipped rather than aborting the whole character load. Adds shared test helpers that are reused across the IO round-trip tests: `withTestPhysicalProperties` (builds a deterministic two-joint fixture) and `comparePhysicalProperties` (asserts equality, matching entries by joint name so the comparison is independent of save/load ordering). `compareChars` now delegates to `comparePhysicalProperties`. Reviewed By: cstollmeta Differential Revision: D104556525
Summary: Round-trips per-joint physical mass properties through USD, mirroring the FBX support. On save, each entry is serialized to JSON and stored as a per-joint child prim under `/SkelRoot/PhysicalProperties`, carrying a `momentum:joint` name attribute and a `momentum:physicalProperties` string attribute, instead of a character-level attribute on `/SkelRoot`. On load, the stage is traversed and each stored body is mapped back to its joint by name. Joint resolution on save reuses `resolvePhysicalPropertiesJointIndex`, and an entry referencing an unknown joint is rejected on save. Adds round-trip coverage built on the shared `withTestPhysicalProperties` and `comparePhysicalProperties` helpers, plus structural assertions that the SkelRoot does not carry `momentum:physicalProperties` and that each stored physical body maps back to its joint. Reviewed By: cstollmeta Differential Revision: D104556530
Contributor
|
@yutingye has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104556530. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Round-trips per-joint physical mass properties through USD, mirroring the FBX support.
On save, each entry is serialized to JSON and stored as a per-joint child prim under
/SkelRoot/PhysicalProperties, carrying amomentum:jointname attribute and amomentum:physicalPropertiesstring attribute, instead of a character-level attribute on/SkelRoot. On load, the stage is traversed and each stored body is mapped back to its joint by name. Joint resolution on save reusesresolvePhysicalPropertiesJointIndex, and an entry referencing an unknown joint is rejected on save.Adds round-trip coverage built on the shared
withTestPhysicalPropertiesandcomparePhysicalPropertieshelpers, plus structural assertions that the SkelRoot does not carrymomentum:physicalPropertiesand that each stored physical body maps back to its joint.Reviewed By: cstollmeta
Differential Revision: D104556530