Skip to content

Conversation

@pierrebai-adsk
Copy link
Collaborator

The mesh reader (MayaUsdPrimReaderMesh) which handles the import of USD meshes, was not creating a Maya transform node for the USD geom prim when in a Maya prototype. Since Maya shape nodes do not have transforms, this prevented the reader from importing any transform that was authored directly on the USD geom prim.

This behavior of not creating the transform node was designed so that round-trip between USD import and export of instances would not create new Maya transform nodes on each round-trip. Unfortunately, this is incorrect when the USD geometry node has transforms. We cannot work around this, USD allows transform on geometry nodes, Maya does not.

The fix is to detect that the USD geom prim has transforms on it and create the Maya transform node in that case. Correctness trumps "nice" round-tripping.

  • Add a HasXformOps helper function to detect if a USD prim has XformOps authored.
  • Use the helper to decide of prototype nodes should have a transform node or not.
  • Use the helper to decide how to name the Maya geometry shape node.
  • Add a unit test to cover this situation.

@pierrebai-adsk pierrebai-adsk self-assigned this Sep 18, 2024
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-986/edit-instance-bad-position branch from 51ff393 to e368401 Compare September 18, 2024 16:04
@pierrebai-adsk pierrebai-adsk added the import-export Related to Import and/or Export label Sep 18, 2024
The mesh reader (MayaUsdPrimReaderMesh) which handles the import of USD
meshes, was *not* creating a Maya transform node for the USD geom prim
when in a Maya prototype. Since Maya shape nodes do not have transforms,
this prevented the reader from importing any transform that was authored
directly on the USD geom prim.

This behavior of not creating the transform node was designed so that
round-trip between USD import and export of instances would not create
new Maya transform nodes on each round-trip. Unfortunately, this is
incorrect when the USD geometry node has transforms. We cannot work
around this, USD allows transform on geometry nodes, Maya does not.

The fix is to detect that the USD geom prim has transforms on it and
create the Maya transform node in that case. Correctness trumps "nice"
round-tripping.

- Add a HasXformOps helper function to detect if a USD prim has XformOps authored.
- Use the helper to decide of prototype nodes should have a transform node or not.
- Use the helper to decide how to name the Maya geometry shape node.
- Add a unit test to cover this situation.
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-986/edit-instance-bad-position branch from e368401 to f0cae67 Compare September 18, 2024 17:30
if (inPrototype && !UsdMayaTranslatorUtil::HasXformOps(prim)) {
transformObj = parentNode;
} else {
bool retStatus = UsdMayaTranslatorUtil::CreateTransformNode(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key fix: when the prototype has transform on the prim, a Maya transform node must be created to hold that transform.

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Sep 20, 2024
@seando-adsk seando-adsk merged commit 6ef3a6b into dev Sep 20, 2024
12 of 13 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-986/edit-instance-bad-position branch September 20, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

import-export Related to Import and/or Export ready-for-merge Development process is finished, PR is ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants