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

MaterialX import export #1478

Merged
merged 13 commits into from
Jun 24, 2021
Merged

MaterialX import export #1478

merged 13 commits into from
Jun 24, 2021

Conversation

JGamache-autodesk
Copy link
Collaborator

This PR is built on top of PR #1450 and PR #1456.

So we get the previously submitted MaterialX export and the token refactoring.

In addition, we now get:

  • Import of the MaterialX exported from Maya back to Maya
  • Support for preview surface (in MaterialX)
  • Support for normal mapping in standard surface

Exports standard surface and file nodes to a MaterialX UsdShade network.
Combines two previously submitted PRs.
@@ -597,7 +597,11 @@ class _UVMappingManager
TfStringPrintf("%s:%s", itNode->GetText(), _tokens->varname.GetText()));
UsdShadeInput materialInput = material.GetInput(inputName);
TF_VERIFY(itName != largestSet.cend());
materialInput.Set(*itName);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

MaterialX uses std::string while UsdPreviewSurface uses TfToken.

if (iter != _shaderReaderMap.end()) {
shaderReader = iter->second;
if (!_context->GetCreatedObject(shaderSchema.GetPrim(), &sourceObj)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ask the shader reader in case it is a converter.

@kxl-adsk kxl-adsk removed the request for review from pmolodo June 16, 2021 13:04
over "MaterialX"
(
references = [@./standard_surface_jade.usda@</MaterialX>,
@./standard_surface_gold.mtlx@</MaterialX>]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will exercise the SdfFileReference auto-conversion to USD, but requires the UsdMtlx plugin which is not in the USD we currently use for tests.



class testUsdImportMaterialX(unittest.TestCase):
"""Test importing an asset with MaterialX shading:

Choose a reason for hiding this comment

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

Excellent test, @JGamache-autodesk! The only thing that would be good to add (but it's not blocking for this merge) is a test that performs export and import. I know part of the import file is actually having content exported from Maya, but I would want to avoid situations where USD test file gets updated but not the actual export code.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Jun 24, 2021
@kxl-adsk kxl-adsk merged commit e10aff0 into dev Jun 24, 2021
@kxl-adsk kxl-adsk deleted the t_gamaj/MAYA-111902/MaterialX_import branch June 24, 2021 14: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 materials 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.

None yet

3 participants