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

MAYA-115079: USD: MayaUsd test failures with USD built with AssetResolver 2 #2092

Merged
merged 1 commit into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/mayaUsd/fileio/translators/translatorMayaReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include <maya/MDGModifier.h>
#include <maya/MFileIO.h>
#include <maya/MFileObject.h>
#include <maya/MFnCamera.h>
#include <maya/MFnDagNode.h>
#include <maya/MFnStringData.h>
Expand Down Expand Up @@ -324,6 +325,10 @@ MStatus UsdMayaTranslatorMayaReference::update(const UsdPrim& prim, MObject pare
if (!mayaReferencePath.length()) {
return MS::kFailure;
}
MFileObject fileObj;
fileObj.setRawFullName(mayaReferencePath);
mayaReferencePath = fileObj.resolvedFullName();
seando-adsk marked this conversation as resolved.
Show resolved Hide resolved

TF_DEBUG(PXRUSDMAYA_TRANSLATORS)
.Msg(
"MayaReferenceLogic::update Looking for attribute on \"%s\".\"%s\"\n",
Expand Down
3 changes: 3 additions & 0 deletions test/lib/mayaUsd/fileio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set(TEST_SCRIPT_FILES
testExportChaser.py
testImportChaser.py
testJobContextRegistry.py

# Once of the tests in this file requires UsdMaya (from the Pixar plugin). That test
# will be skipped if not found (probably because BUILD_PXR_PLUGIN is off).
testSchemaApiAdaptor.py
)
if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022)
Expand Down
4 changes: 2 additions & 2 deletions test/lib/mayaUsd/fileio/testAddMayaReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import mayaUsdAddMayaReference
import mayaUsdMayaReferenceUtils as mayaRefUtils

import unittest
import os, unittest

class AddMayaReferenceTestCase(unittest.TestCase):
'''Test Add Maya Reference.
Expand Down Expand Up @@ -135,7 +135,7 @@ def testDefineInVariant(self):
# and that it has the expected metadata.
attr = mayaRefPrim.GetAttribute('mayaReference')
self.assertTrue(attr.IsValid())
self.assertEqual(attr.Get().resolvedPath, self.mayaSceneStr)
self.assertTrue(os.path.samefile(attr.Get().resolvedPath, self.mayaSceneStr))
seando-adsk marked this conversation as resolved.
Show resolved Hide resolved
attr = mayaRefPrim.GetAttribute('mayaNamespace')
self.assertTrue(attr.IsValid())
self.assertEqual(attr.Get(), self.kDefaultNamespace)
Expand Down
11 changes: 9 additions & 2 deletions test/lib/mayaUsd/fileio/testSchemaApiAdaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@

import mayaUsd.lib as mayaUsdLib

from pxr import Tf, Gf, UsdMaya, Usd
from pxr import Tf, Gf, Usd

from maya import cmds
import maya.api.OpenMaya as om
import maya.api.OpenMayaAnim as oma
from maya import standalone

HAS_USDMAYA = False
try:
from pxr import UsdMaya
seando-adsk marked this conversation as resolved.
Show resolved Hide resolved
HAS_USDMAYA = True
except ImportError as ie:
pass

HAS_BULLET = False
try:
from pxr import UsdPhysics
Expand Down Expand Up @@ -294,7 +301,7 @@ def testMinimalAdaptation(self):
colorAttr.Set((1,0,1))
self.assertEqual(cmds.getAttr(lightShape1 + ".shadowColor"), [(1.0, 0.0, 1.0)])

@unittest.skipUnless(HAS_BULLET, 'Requires the bullet plugin.')
@unittest.skipUnless(HAS_BULLET and HAS_USDMAYA, 'Requires the Pixar and bullet plugins.')
def testComplexAdaptation(self):
"""Test that we can adapt a bullet simulation"""

Expand Down
10 changes: 9 additions & 1 deletion test/lib/usd/translators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ set(TEST_SCRIPT_FILES
testUsdExportNurbsCurve.py
testUsdExportOpenLayer.py
testUsdExportOverImport.py
testUsdExportUsdzPackage.py
testUsdExportUsdPreviewSurface.py
testUsdExportParentScope.py
# To investigate: following test asserts in MFnParticleSystem, but passes.
Expand Down Expand Up @@ -91,6 +90,13 @@ if(BUILD_PXR_PLUGIN)
list(APPEND TEST_SCRIPT_FILES
testUsdExportUVTransforms.py
)

# This test uses the file "asset.ma" which
# requires the plugin "pxrUsdPreviewSurface" that is built by the
# Pixar plugin.
list(APPEND TEST_SCRIPT_FILES
testUsdExportUsdzPackage.py
)
seando-adsk marked this conversation as resolved.
Show resolved Hide resolved
endif()

if (BUILD_RFM_TRANSLATORS)
Expand Down Expand Up @@ -242,6 +248,8 @@ set_property(TEST testUsdMayaListShadingModesCommand APPEND PROPERTY LABELS tran

# Requires Physics API to test some exporters:
if (PXR_VERSION VERSION_GREATER 2105)
# Once of the tests in this file requires UsdMaya (from the Pixar plugin). That test
# will be skipped if not found (probably because BUILD_PXR_PLUGIN is off).
mayaUsd_add_test(testUsdExportSchemaApi
PYTHON_MODULE testUsdExportSchemaApi
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
11 changes: 9 additions & 2 deletions test/lib/usd/translators/testUsdExportSchemaApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
import maya.api.OpenMaya as om
import maya.api.OpenMayaAnim as oma

from pxr import Tf, Gf, UsdMaya, Usd
from pxr import Tf, Gf, Usd

import fixturesUtils

HAS_USDMAYA = False
try:
from pxr import UsdMaya
HAS_USDMAYA = True
except ImportError as ie:
pass

HAS_BULLET = False
try:
import maya.app.mayabullet.BulletUtils as BulletUtils
Expand Down Expand Up @@ -130,7 +137,7 @@ def testExportJobContextConflicts(self):

cmds.file(f=True, new=True)

@unittest.skipUnless(HAS_BULLET, 'Requires the bullet plugin.')
@unittest.skipUnless(HAS_BULLET and HAS_USDMAYA, 'Requires the Pixar and bullet plugins.')
def testPluginSchemaAdaptors(self):
"""Testing a plugin Schema adaptor in a generic context:"""

Expand Down