Fix worldspace export baking ancestor transforms twice - #4699
Merged
antonkhelou merged 1 commit intoAug 19, 2026
Merged
Conversation
The worldspace flag baked the Maya ancestor chain into every selected object. When those ancestors are also exported as prims - via exportRoots or as parents of a deep selection - their transforms ended up in the file twice: once on the ancestor prims and once baked into the selection. Only bake the ancestor chain into prims that become top-level prims of the exported file, i.e. prims with no exported parent above them. This matches the behavior the existing exportRoots worldspace tests assert, where the bake lands on the export root itself. Added two tests covering worldspace with a selection: one where the export root is an ancestor of the selection (previously double transformed) and one where the selected node is itself the export root (bake must stay). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Exporting with
-worldspaceproduces wrong transforms when the selectedobjects have ancestors that are also exported. This happens in two common
setups:
-exportSelectedwith-exportRootspointing at an ancestor of theselection.
-exportSelectedwith a node deep in a hierarchy (its parents arealways exported with their transforms).
In both cases the ancestor transforms end up in the file twice. They are
written on the ancestor prims, and they are also baked into the xform ops
of every selected prim. When the file is composed, the objects move twice
as far, scale twice, and so on.
Repro
The cube lands at world position (10, 2, 0) instead of (5, 2, 0).
Cause
needsWorldspaceTransformintransformWriter.cppenables the ancestorbake for every transform found in the export selection (
dagPaths). Thatis only correct when the selected node becomes a root prim of the file.
The existing worldspace tests only cover exports without a selection,
where
dagPathshappens to hold the export roots, so the problem nevershowed up there.
Fix
Bake the ancestor chain only into prims that become top-level prims of
the exported file. A prim is top-level when its Maya parent maps to no
prim in the export, either because the node sits under the Maya world
root or because the export roots exclude its parent.
This matches what the existing
selNoneworldspace tests intestUsdExportRoots.pyalready assert: the bake lands on the exportroot itself, and prims below it keep their local transforms.
As a side effect, transforms above a non-top-level export root are now
captured on the export root prim instead of being double-applied below
it.
Tests
Two new cases in
testUsdExportRoots.py:testExportRoot_rootMid_selCube_worldspace— export root above theselection. Fails without the fix (double transform), passes with it.
testExportRoot_rootCube_selCube_worldspace— the selected node isitself the export root. Guards that the bake stays where it is needed.
All existing
testUsdExportRootsandtestUsdExportRootsAndRootPrimcases pass unchanged.
🤖 Generated with Claude Code