Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMSUSD-1113 suport legacy metarial scope mode #3810

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

pierrebai-adsk
Copy link
Collaborator

  • Add a legacyMaterialScope flag to the export command.
  • The flag default to false (off).
  • When turned on, we use the previous method of determining where a material is generated, which is under the common root prim of all meshes using the material.
  • The merge-to-USD workflow use that flag to ensure it receives the material under the mesh.
  • The export-to-USD UI forces that flag to be false (off), to ensure we always use the new material scope behavior.
  • Added some unit tests for the legacy mode.

@pierrebai-adsk pierrebai-adsk added the import-export Related to Import and/or Export label Jun 7, 2024
- Add a legacyMaterialScope flag to the export command.
- The flag default to false (off).
- When turned on, we use the previous method of determining where a material is generated, which is under the common root prim of all meshes using the material.
- The merge-to-USD workflow use that flag to ensure it receives the material under the mesh.
- The export-to-USD UI forces that flag to be false (off), to ensure we always use the new material scope behavior.
- Added some unit tests for the legacy mode.
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-1113/legacy-material-scope branch from 8e625f4 to 9c306c7 Compare June 7, 2024 13:22
@pierrebai-adsk pierrebai-adsk self-assigned this Jun 7, 2024
@pierrebai-adsk
Copy link
Collaborator Author

@dj-mcg here is the change to support legacy material scope.

const std::string& defaultPrim,
const TfToken& materialsScopeName)
{
SdfPath shaderExportLocation = SdfPath::AbsoluteRootPath();

Copy link
Collaborator

Choose a reason for hiding this comment

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

The new approach no longer considers CommonAncestors as all - is that intentional? Ultimately this new approach makes more sense to me, since I was confused about the intended behavior if both defaultPrim and exportMaterialUnderPrim were specified.

I still find it a little unusual that defaultPrim needs to be explicitly specified in export arguments here, given that the export process provides a fallback approach that we rely on to actually author this value in the root metadata. In fact, if we allowed for that same fallback behavior here, I think we would fully prefer the newer structure you've introduced here. Any thoughts about that?

Copy link
Collaborator Author

@pierrebai-adsk pierrebai-adsk Jun 7, 2024

Choose a reason for hiding this comment

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

For the first question, yes it is intentional. The code that I'm replacing now alredy did that, but was hidden in the caller, which passed an empty set of assignments in the new mode.

For the second question, we've had the same discussion internally this morning. For now, we keep it that way. The main issues were:

  • Which the root prim to use as the default prim was selected "at random" from the pool of root prims.
  • This decision is done at the very end of the export, so after material are already exported.
  • We would need to choose the root prim earlier instead, probably as soon as we export a root prim,
  • This required more code changes and it could change the behavior since which prim is first when we ask the stage for the set of root prims might not be in the order they are exported but in some other order, for example alphabetical.

In addition, we consider that not specifying a default prim but relying in this implicit selection was a legacy behaviour. In our export UI, the user selects the default prim, so the default prim is always known. The thought was that if you use the new material scope logic, you should specify a default prim.

That being said, if it causes headaches, we can revisit the decision.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, @pierrebai-adsk thanks for prompt and thorough attention to this issue!

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jun 7, 2024
@seando-adsk seando-adsk merged commit 56fb9fc into dev Jun 10, 2024
11 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-1113/legacy-material-scope branch June 10, 2024 15:21
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