From 616cff7a0ae3727a5886900028839beb22588f72 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Fri, 20 Jan 2023 09:12:56 -0500 Subject: [PATCH 1/3] MAYA-124459 restore point anim on import behaviour The internal implementation of the deformer command changed in Maya 2022 and later. We now need to add the object to the deformer on creation and no longer need to modify the tweak (the tweak does not get created now.) --- lib/mayaUsd/fileio/translators/translatorMesh.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/mayaUsd/fileio/translators/translatorMesh.cpp b/lib/mayaUsd/fileio/translators/translatorMesh.cpp index e12a721b80..993591d753 100644 --- a/lib/mayaUsd/fileio/translators/translatorMesh.cpp +++ b/lib/mayaUsd/fileio/translators/translatorMesh.cpp @@ -394,6 +394,14 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode( status = MGlobal::clearSelectionList(); CHECK_MSTATUS(status); + const MFnDagNode dagNodeFn(mayaObj, &status); + CHECK_MSTATUS(status); + +#if MAYA_API_VERSION >= 20220000 + status = MGlobal::selectByName(dagNodeFn.fullPathName().asChar()); + CHECK_MSTATUS(status); +#endif + // Create the point based deformer node for this prim. const std::string pointBasedDeformerNodeName = TfStringPrintf( "usdPointBasedDeformerNode%s", @@ -443,6 +451,10 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode( status = dgMod.doIt(); CHECK_MSTATUS(status); + // The deformer command changed in Maya 2022 to no longer add a tweak, + // so only modify the tweak when in Maya 2020 or earlier. +#if MAYA_API_VERSION < 20220000 + // Add the Maya object to the point based deformer node's set. const MFnGeometryFilter geomFilterFn(m_pointBasedDeformerNode, &status); CHECK_MSTATUS(status); @@ -464,8 +476,6 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode( // *after* the point based deformer. To do this, we need to dig for the // name of the tweak deformer node that Maya created to be able to pass it // to the reorderDeformers command. - const MFnDagNode dagNodeFn(mayaObj, &status); - CHECK_MSTATUS(status); // XXX: This seems to be the "most sane" way of finding the tweak deformer // node's name... @@ -486,6 +496,7 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode( dagNodeFn.fullPathName().asChar()); status = MGlobal::executePythonCommand(reorderDeformersCmd.c_str()); CHECK_MSTATUS(status); +#endif return status; } From bfa60ed73f3d700253467ad77210784b05c70634 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Fri, 20 Jan 2023 11:23:42 -0500 Subject: [PATCH 2/3] MAYA-124459 add a unit test for point cache import --- test/lib/usd/translators/CMakeLists.txt | 1 + .../UsdImportPointCacheTest/pointCache.usda | 244 ++++++++++++++++++ .../translators/testUsdImportPointCache.py | 81 ++++++ 3 files changed, 326 insertions(+) create mode 100644 test/lib/usd/translators/UsdImportPointCacheTest/pointCache.usda create mode 100644 test/lib/usd/translators/testUsdImportPointCache.py diff --git a/test/lib/usd/translators/CMakeLists.txt b/test/lib/usd/translators/CMakeLists.txt index 002cd5b2f0..1a941317dd 100644 --- a/test/lib/usd/translators/CMakeLists.txt +++ b/test/lib/usd/translators/CMakeLists.txt @@ -65,6 +65,7 @@ set(TEST_SCRIPT_FILES testUsdImportLight.py testUsdImportMayaReference.py testUsdImportMesh.py + testUsdImportPointCache.py testUsdImportPreviewSurface.py # XXX: This test is disabled by default since it requires the RenderMan for Maya plugin. # testUsdImportRfMLight.py diff --git a/test/lib/usd/translators/UsdImportPointCacheTest/pointCache.usda b/test/lib/usd/translators/UsdImportPointCacheTest/pointCache.usda new file mode 100644 index 0000000000..8c6e24cfd4 --- /dev/null +++ b/test/lib/usd/translators/UsdImportPointCacheTest/pointCache.usda @@ -0,0 +1,244 @@ +#usda 1.0 +( + defaultPrim = "group1" + endTimeCode = 1069 + framesPerSecond = 24 + metersPerUnit = 0.01 + startTimeCode = 1000 + timeCodesPerSecond = 24 + upAxis = "Y" +) + +def Xform "group1" ( + kind = "component" +) +{ + def Mesh "pCube1" ( + prepend apiSchemas = ["MaterialBindingAPI"] + ) + { + uniform bool doubleSided = 1 + float3[] extent.timeSamples = { + 1000: [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)], + 1001: [(-0.489661, -0.5, -0.5), (0.51033896, 0.5, 0.5)], + 1002: [(-0.45904753, -0.5, -0.5), (0.54095244, 0.5, 0.5)], + 1003: [(-0.40876478, -0.5, -0.5), (0.5912352, 0.5, 0.5)], + 1004: [(-0.33941793, -0.5, -0.5), (0.66058207, 0.5, 0.5)], + 1005: [(-0.25161222, -0.5, -0.5), (0.7483878, 0.5, 0.5)], + 1006: [(-0.14595284, -0.5, -0.5), (0.8540472, 0.5, 0.5)], + 1007: [(-0.023045003, -0.5, -0.5), (0.976955, 0.5, 0.5)], + 1008: [(0.11650607, -0.5, -0.5), (1.1165061, 0.5, 0.5)], + 1009: [(0.27209517, -0.5, -0.5), (1.2720952, 0.5, 0.5)], + 1010: [(0.4431171, -0.5, -0.5), (1.4431171, 0.5, 0.5)], + 1011: [(0.6289666, -0.5, -0.5), (1.6289667, 0.5, 0.5)], + 1012: [(0.8290386, -0.5, -0.5), (1.8290386, 0.5, 0.5)], + 1013: [(1.0427277, -0.5, -0.5), (2.0427277, 0.5, 0.5)], + 1014: [(1.2694288, -0.5, -0.5), (2.269429, 0.5, 0.5)], + 1015: [(1.5085368, -0.5, -0.5), (2.5085368, 0.5, 0.5)], + 1016: [(1.7594463, -0.5, -0.5), (2.7594464, 0.5, 0.5)], + 1017: [(2.021552, -0.5, -0.5), (3.021552, 0.5, 0.5)], + 1018: [(2.2942493, -0.5, -0.5), (3.2942493, 0.5, 0.5)], + 1019: [(2.5769322, -0.5, -0.5), (3.5769322, 0.5, 0.5)], + 1020: [(2.868996, -0.5, -0.5), (3.868996, 0.5, 0.5)], + 1021: [(3.169835, -0.5, -0.5), (4.169835, 0.5, 0.5)], + 1022: [(3.4788446, -0.5, -0.5), (4.4788446, 0.5, 0.5)], + 1023: [(3.7954192, -0.5, -0.5), (4.795419, 0.5, 0.5)], + 1024: [(4.1189537, -0.5, -0.5), (5.1189537, 0.5, 0.5)], + 1025: [(4.448843, -0.5, -0.5), (5.448843, 0.5, 0.5)], + 1026: [(4.784482, -0.5, -0.5), (5.784482, 0.5, 0.5)], + 1027: [(5.1252646, -0.5, -0.5), (6.1252646, 0.5, 0.5)], + 1028: [(5.470587, -0.5, -0.5), (6.470587, 0.5, 0.5)], + 1029: [(5.819843, -0.5, -0.5), (6.819843, 0.5, 0.5)], + 1030: [(6.172427, -0.5, -0.5), (7.172427, 0.5, 0.5)], + 1031: [(6.527735, -0.5, -0.5), (7.527735, 0.5, 0.5)], + 1032: [(6.885162, -0.5, -0.5), (7.885162, 0.5, 0.5)], + 1033: [(7.244101, -0.5, -0.5), (8.244101, 0.5, 0.5)], + 1034: [(7.603948, -0.5, -0.5), (8.603948, 0.5, 0.5)], + 1035: [(7.964098, -0.5, -0.5), (8.964098, 0.5, 0.5)], + 1036: [(8.323945, -0.5, -0.5), (9.323945, 0.5, 0.5)], + 1037: [(8.682884, -0.5, -0.5), (9.682884, 0.5, 0.5)], + 1038: [(9.04031, -0.5, -0.5), (10.04031, 0.5, 0.5)], + 1039: [(9.395618, -0.5, -0.5), (10.395618, 0.5, 0.5)], + 1040: [(9.748203, -0.5, -0.5), (10.748203, 0.5, 0.5)], + 1041: [(10.097459, -0.5, -0.5), (11.097459, 0.5, 0.5)], + 1042: [(10.4427805, -0.5, -0.5), (11.4427805, 0.5, 0.5)], + 1043: [(10.783564, -0.5, -0.5), (11.783564, 0.5, 0.5)], + 1044: [(11.119203, -0.5, -0.5), (12.119203, 0.5, 0.5)], + 1045: [(11.449092, -0.5, -0.5), (12.449092, 0.5, 0.5)], + 1046: [(11.772627, -0.5, -0.5), (12.772627, 0.5, 0.5)], + 1047: [(12.089201, -0.5, -0.5), (13.089201, 0.5, 0.5)], + 1048: [(12.398211, -0.5, -0.5), (13.398211, 0.5, 0.5)], + 1049: [(12.69905, -0.5, -0.5), (13.69905, 0.5, 0.5)], + 1050: [(12.991114, -0.5, -0.5), (13.991114, 0.5, 0.5)], + 1051: [(13.273797, -0.5, -0.5), (14.273797, 0.5, 0.5)], + 1052: [(13.546494, -0.5, -0.5), (14.546494, 0.5, 0.5)], + 1053: [(13.808599, -0.5, -0.5), (14.808599, 0.5, 0.5)], + 1054: [(14.059509, -0.5, -0.5), (15.059509, 0.5, 0.5)], + 1055: [(14.298617, -0.5, -0.5), (15.298617, 0.5, 0.5)], + 1056: [(14.525318, -0.5, -0.5), (15.525318, 0.5, 0.5)], + 1057: [(14.739007, -0.5, -0.5), (15.739007, 0.5, 0.5)], + 1058: [(14.939079, -0.5, -0.5), (15.939079, 0.5, 0.5)], + 1059: [(15.124928, -0.5, -0.5), (16.12493, 0.5, 0.5)], + 1060: [(15.295951, -0.5, -0.5), (16.29595, 0.5, 0.5)], + 1061: [(15.45154, -0.5, -0.5), (16.45154, 0.5, 0.5)], + 1062: [(15.591091, -0.5, -0.5), (16.591091, 0.5, 0.5)], + 1063: [(15.713999, -0.5, -0.5), (16.713999, 0.5, 0.5)], + 1064: [(15.819658, -0.5, -0.5), (16.819658, 0.5, 0.5)], + 1065: [(15.907464, -0.5, -0.5), (16.907463, 0.5, 0.5)], + 1066: [(15.97681, -0.5, -0.5), (16.97681, 0.5, 0.5)], + 1067: [(16.027094, -0.5, -0.5), (17.027094, 0.5, 0.5)], + 1068: [(16.057707, -0.5, -0.5), (17.057707, 0.5, 0.5)], + 1069: [(16.068047, -0.5, -0.5), (17.068047, 0.5, 0.5)], + } + int[] faceVertexCounts.timeSamples = { + 1000: [4, 4, 4, 4, 4, 4], + } + int[] faceVertexIndices.timeSamples = { + 1000: [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4], + } + rel material:binding = + normal3f[] normals ( + interpolation = "faceVarying" + ) + normal3f[] normals.timeSamples = { + 1000: [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0)], + } + point3f[] points.timeSamples = { + 1000: [(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (-0.5, -0.5, -0.5), (0.5, -0.5, -0.5)], + 1001: [(-0.489661, -0.5, 0.5), (0.51033896, -0.5, 0.5), (-0.489661, 0.5, 0.5), (0.51033896, 0.5, 0.5), (-0.489661, 0.5, -0.5), (0.51033896, 0.5, -0.5), (-0.489661, -0.5, -0.5), (0.51033896, -0.5, -0.5)], + 1002: [(-0.45904753, -0.5, 0.5), (0.54095244, -0.5, 0.5), (-0.45904753, 0.5, 0.5), (0.54095244, 0.5, 0.5), (-0.45904753, 0.5, -0.5), (0.54095244, 0.5, -0.5), (-0.45904753, -0.5, -0.5), (0.54095244, -0.5, -0.5)], + 1003: [(-0.40876478, -0.5, 0.5), (0.5912352, -0.5, 0.5), (-0.40876478, 0.5, 0.5), (0.5912352, 0.5, 0.5), (-0.40876478, 0.5, -0.5), (0.5912352, 0.5, -0.5), (-0.40876478, -0.5, -0.5), (0.5912352, -0.5, -0.5)], + 1004: [(-0.33941793, -0.5, 0.5), (0.66058207, -0.5, 0.5), (-0.33941793, 0.5, 0.5), (0.66058207, 0.5, 0.5), (-0.33941793, 0.5, -0.5), (0.66058207, 0.5, -0.5), (-0.33941793, -0.5, -0.5), (0.66058207, -0.5, -0.5)], + 1005: [(-0.25161222, -0.5, 0.5), (0.7483878, -0.5, 0.5), (-0.25161222, 0.5, 0.5), (0.7483878, 0.5, 0.5), (-0.25161222, 0.5, -0.5), (0.7483878, 0.5, -0.5), (-0.25161222, -0.5, -0.5), (0.7483878, -0.5, -0.5)], + 1006: [(-0.14595284, -0.5, 0.5), (0.8540472, -0.5, 0.5), (-0.14595284, 0.5, 0.5), (0.8540472, 0.5, 0.5), (-0.14595284, 0.5, -0.5), (0.8540472, 0.5, -0.5), (-0.14595284, -0.5, -0.5), (0.8540472, -0.5, -0.5)], + 1007: [(-0.023045003, -0.5, 0.5), (0.976955, -0.5, 0.5), (-0.023045003, 0.5, 0.5), (0.976955, 0.5, 0.5), (-0.023045003, 0.5, -0.5), (0.976955, 0.5, -0.5), (-0.023045003, -0.5, -0.5), (0.976955, -0.5, -0.5)], + 1008: [(0.11650607, -0.5, 0.5), (1.1165061, -0.5, 0.5), (0.11650607, 0.5, 0.5), (1.1165061, 0.5, 0.5), (0.11650607, 0.5, -0.5), (1.1165061, 0.5, -0.5), (0.11650607, -0.5, -0.5), (1.1165061, -0.5, -0.5)], + 1009: [(0.27209517, -0.5, 0.5), (1.2720952, -0.5, 0.5), (0.27209517, 0.5, 0.5), (1.2720952, 0.5, 0.5), (0.27209517, 0.5, -0.5), (1.2720952, 0.5, -0.5), (0.27209517, -0.5, -0.5), (1.2720952, -0.5, -0.5)], + 1010: [(0.4431171, -0.5, 0.5), (1.4431171, -0.5, 0.5), (0.4431171, 0.5, 0.5), (1.4431171, 0.5, 0.5), (0.4431171, 0.5, -0.5), (1.4431171, 0.5, -0.5), (0.4431171, -0.5, -0.5), (1.4431171, -0.5, -0.5)], + 1011: [(0.6289666, -0.5, 0.5), (1.6289667, -0.5, 0.5), (0.6289666, 0.5, 0.5), (1.6289667, 0.5, 0.5), (0.6289666, 0.5, -0.5), (1.6289667, 0.5, -0.5), (0.6289666, -0.5, -0.5), (1.6289667, -0.5, -0.5)], + 1012: [(0.8290386, -0.5, 0.5), (1.8290386, -0.5, 0.5), (0.8290386, 0.5, 0.5), (1.8290386, 0.5, 0.5), (0.8290386, 0.5, -0.5), (1.8290386, 0.5, -0.5), (0.8290386, -0.5, -0.5), (1.8290386, -0.5, -0.5)], + 1013: [(1.0427277, -0.5, 0.5), (2.0427277, -0.5, 0.5), (1.0427277, 0.5, 0.5), (2.0427277, 0.5, 0.5), (1.0427277, 0.5, -0.5), (2.0427277, 0.5, -0.5), (1.0427277, -0.5, -0.5), (2.0427277, -0.5, -0.5)], + 1014: [(1.2694288, -0.5, 0.5), (2.269429, -0.5, 0.5), (1.2694288, 0.5, 0.5), (2.269429, 0.5, 0.5), (1.2694288, 0.5, -0.5), (2.269429, 0.5, -0.5), (1.2694288, -0.5, -0.5), (2.269429, -0.5, -0.5)], + 1015: [(1.5085368, -0.5, 0.5), (2.5085368, -0.5, 0.5), (1.5085368, 0.5, 0.5), (2.5085368, 0.5, 0.5), (1.5085368, 0.5, -0.5), (2.5085368, 0.5, -0.5), (1.5085368, -0.5, -0.5), (2.5085368, -0.5, -0.5)], + 1016: [(1.7594463, -0.5, 0.5), (2.7594464, -0.5, 0.5), (1.7594463, 0.5, 0.5), (2.7594464, 0.5, 0.5), (1.7594463, 0.5, -0.5), (2.7594464, 0.5, -0.5), (1.7594463, -0.5, -0.5), (2.7594464, -0.5, -0.5)], + 1017: [(2.021552, -0.5, 0.5), (3.021552, -0.5, 0.5), (2.021552, 0.5, 0.5), (3.021552, 0.5, 0.5), (2.021552, 0.5, -0.5), (3.021552, 0.5, -0.5), (2.021552, -0.5, -0.5), (3.021552, -0.5, -0.5)], + 1018: [(2.2942493, -0.5, 0.5), (3.2942493, -0.5, 0.5), (2.2942493, 0.5, 0.5), (3.2942493, 0.5, 0.5), (2.2942493, 0.5, -0.5), (3.2942493, 0.5, -0.5), (2.2942493, -0.5, -0.5), (3.2942493, -0.5, -0.5)], + 1019: [(2.5769322, -0.5, 0.5), (3.5769322, -0.5, 0.5), (2.5769322, 0.5, 0.5), (3.5769322, 0.5, 0.5), (2.5769322, 0.5, -0.5), (3.5769322, 0.5, -0.5), (2.5769322, -0.5, -0.5), (3.5769322, -0.5, -0.5)], + 1020: [(2.868996, -0.5, 0.5), (3.868996, -0.5, 0.5), (2.868996, 0.5, 0.5), (3.868996, 0.5, 0.5), (2.868996, 0.5, -0.5), (3.868996, 0.5, -0.5), (2.868996, -0.5, -0.5), (3.868996, -0.5, -0.5)], + 1021: [(3.169835, -0.5, 0.5), (4.169835, -0.5, 0.5), (3.169835, 0.5, 0.5), (4.169835, 0.5, 0.5), (3.169835, 0.5, -0.5), (4.169835, 0.5, -0.5), (3.169835, -0.5, -0.5), (4.169835, -0.5, -0.5)], + 1022: [(3.4788446, -0.5, 0.5), (4.4788446, -0.5, 0.5), (3.4788446, 0.5, 0.5), (4.4788446, 0.5, 0.5), (3.4788446, 0.5, -0.5), (4.4788446, 0.5, -0.5), (3.4788446, -0.5, -0.5), (4.4788446, -0.5, -0.5)], + 1023: [(3.7954192, -0.5, 0.5), (4.795419, -0.5, 0.5), (3.7954192, 0.5, 0.5), (4.795419, 0.5, 0.5), (3.7954192, 0.5, -0.5), (4.795419, 0.5, -0.5), (3.7954192, -0.5, -0.5), (4.795419, -0.5, -0.5)], + 1024: [(4.1189537, -0.5, 0.5), (5.1189537, -0.5, 0.5), (4.1189537, 0.5, 0.5), (5.1189537, 0.5, 0.5), (4.1189537, 0.5, -0.5), (5.1189537, 0.5, -0.5), (4.1189537, -0.5, -0.5), (5.1189537, -0.5, -0.5)], + 1025: [(4.448843, -0.5, 0.5), (5.448843, -0.5, 0.5), (4.448843, 0.5, 0.5), (5.448843, 0.5, 0.5), (4.448843, 0.5, -0.5), (5.448843, 0.5, -0.5), (4.448843, -0.5, -0.5), (5.448843, -0.5, -0.5)], + 1026: [(4.784482, -0.5, 0.5), (5.784482, -0.5, 0.5), (4.784482, 0.5, 0.5), (5.784482, 0.5, 0.5), (4.784482, 0.5, -0.5), (5.784482, 0.5, -0.5), (4.784482, -0.5, -0.5), (5.784482, -0.5, -0.5)], + 1027: [(5.1252646, -0.5, 0.5), (6.1252646, -0.5, 0.5), (5.1252646, 0.5, 0.5), (6.1252646, 0.5, 0.5), (5.1252646, 0.5, -0.5), (6.1252646, 0.5, -0.5), (5.1252646, -0.5, -0.5), (6.1252646, -0.5, -0.5)], + 1028: [(5.470587, -0.5, 0.5), (6.470587, -0.5, 0.5), (5.470587, 0.5, 0.5), (6.470587, 0.5, 0.5), (5.470587, 0.5, -0.5), (6.470587, 0.5, -0.5), (5.470587, -0.5, -0.5), (6.470587, -0.5, -0.5)], + 1029: [(5.819843, -0.5, 0.5), (6.819843, -0.5, 0.5), (5.819843, 0.5, 0.5), (6.819843, 0.5, 0.5), (5.819843, 0.5, -0.5), (6.819843, 0.5, -0.5), (5.819843, -0.5, -0.5), (6.819843, -0.5, -0.5)], + 1030: [(6.172427, -0.5, 0.5), (7.172427, -0.5, 0.5), (6.172427, 0.5, 0.5), (7.172427, 0.5, 0.5), (6.172427, 0.5, -0.5), (7.172427, 0.5, -0.5), (6.172427, -0.5, -0.5), (7.172427, -0.5, -0.5)], + 1031: [(6.527735, -0.5, 0.5), (7.527735, -0.5, 0.5), (6.527735, 0.5, 0.5), (7.527735, 0.5, 0.5), (6.527735, 0.5, -0.5), (7.527735, 0.5, -0.5), (6.527735, -0.5, -0.5), (7.527735, -0.5, -0.5)], + 1032: [(6.885162, -0.5, 0.5), (7.885162, -0.5, 0.5), (6.885162, 0.5, 0.5), (7.885162, 0.5, 0.5), (6.885162, 0.5, -0.5), (7.885162, 0.5, -0.5), (6.885162, -0.5, -0.5), (7.885162, -0.5, -0.5)], + 1033: [(7.244101, -0.5, 0.5), (8.244101, -0.5, 0.5), (7.244101, 0.5, 0.5), (8.244101, 0.5, 0.5), (7.244101, 0.5, -0.5), (8.244101, 0.5, -0.5), (7.244101, -0.5, -0.5), (8.244101, -0.5, -0.5)], + 1034: [(7.603948, -0.5, 0.5), (8.603948, -0.5, 0.5), (7.603948, 0.5, 0.5), (8.603948, 0.5, 0.5), (7.603948, 0.5, -0.5), (8.603948, 0.5, -0.5), (7.603948, -0.5, -0.5), (8.603948, -0.5, -0.5)], + 1035: [(7.964098, -0.5, 0.5), (8.964098, -0.5, 0.5), (7.964098, 0.5, 0.5), (8.964098, 0.5, 0.5), (7.964098, 0.5, -0.5), (8.964098, 0.5, -0.5), (7.964098, -0.5, -0.5), (8.964098, -0.5, -0.5)], + 1036: [(8.323945, -0.5, 0.5), (9.323945, -0.5, 0.5), (8.323945, 0.5, 0.5), (9.323945, 0.5, 0.5), (8.323945, 0.5, -0.5), (9.323945, 0.5, -0.5), (8.323945, -0.5, -0.5), (9.323945, -0.5, -0.5)], + 1037: [(8.682884, -0.5, 0.5), (9.682884, -0.5, 0.5), (8.682884, 0.5, 0.5), (9.682884, 0.5, 0.5), (8.682884, 0.5, -0.5), (9.682884, 0.5, -0.5), (8.682884, -0.5, -0.5), (9.682884, -0.5, -0.5)], + 1038: [(9.04031, -0.5, 0.5), (10.04031, -0.5, 0.5), (9.04031, 0.5, 0.5), (10.04031, 0.5, 0.5), (9.04031, 0.5, -0.5), (10.04031, 0.5, -0.5), (9.04031, -0.5, -0.5), (10.04031, -0.5, -0.5)], + 1039: [(9.395618, -0.5, 0.5), (10.395618, -0.5, 0.5), (9.395618, 0.5, 0.5), (10.395618, 0.5, 0.5), (9.395618, 0.5, -0.5), (10.395618, 0.5, -0.5), (9.395618, -0.5, -0.5), (10.395618, -0.5, -0.5)], + 1040: [(9.748203, -0.5, 0.5), (10.748203, -0.5, 0.5), (9.748203, 0.5, 0.5), (10.748203, 0.5, 0.5), (9.748203, 0.5, -0.5), (10.748203, 0.5, -0.5), (9.748203, -0.5, -0.5), (10.748203, -0.5, -0.5)], + 1041: [(10.097459, -0.5, 0.5), (11.097459, -0.5, 0.5), (10.097459, 0.5, 0.5), (11.097459, 0.5, 0.5), (10.097459, 0.5, -0.5), (11.097459, 0.5, -0.5), (10.097459, -0.5, -0.5), (11.097459, -0.5, -0.5)], + 1042: [(10.4427805, -0.5, 0.5), (11.4427805, -0.5, 0.5), (10.4427805, 0.5, 0.5), (11.4427805, 0.5, 0.5), (10.4427805, 0.5, -0.5), (11.4427805, 0.5, -0.5), (10.4427805, -0.5, -0.5), (11.4427805, -0.5, -0.5)], + 1043: [(10.783564, -0.5, 0.5), (11.783564, -0.5, 0.5), (10.783564, 0.5, 0.5), (11.783564, 0.5, 0.5), (10.783564, 0.5, -0.5), (11.783564, 0.5, -0.5), (10.783564, -0.5, -0.5), (11.783564, -0.5, -0.5)], + 1044: [(11.119203, -0.5, 0.5), (12.119203, -0.5, 0.5), (11.119203, 0.5, 0.5), (12.119203, 0.5, 0.5), (11.119203, 0.5, -0.5), (12.119203, 0.5, -0.5), (11.119203, -0.5, -0.5), (12.119203, -0.5, -0.5)], + 1045: [(11.449092, -0.5, 0.5), (12.449092, -0.5, 0.5), (11.449092, 0.5, 0.5), (12.449092, 0.5, 0.5), (11.449092, 0.5, -0.5), (12.449092, 0.5, -0.5), (11.449092, -0.5, -0.5), (12.449092, -0.5, -0.5)], + 1046: [(11.772627, -0.5, 0.5), (12.772627, -0.5, 0.5), (11.772627, 0.5, 0.5), (12.772627, 0.5, 0.5), (11.772627, 0.5, -0.5), (12.772627, 0.5, -0.5), (11.772627, -0.5, -0.5), (12.772627, -0.5, -0.5)], + 1047: [(12.089201, -0.5, 0.5), (13.089201, -0.5, 0.5), (12.089201, 0.5, 0.5), (13.089201, 0.5, 0.5), (12.089201, 0.5, -0.5), (13.089201, 0.5, -0.5), (12.089201, -0.5, -0.5), (13.089201, -0.5, -0.5)], + 1048: [(12.398211, -0.5, 0.5), (13.398211, -0.5, 0.5), (12.398211, 0.5, 0.5), (13.398211, 0.5, 0.5), (12.398211, 0.5, -0.5), (13.398211, 0.5, -0.5), (12.398211, -0.5, -0.5), (13.398211, -0.5, -0.5)], + 1049: [(12.69905, -0.5, 0.5), (13.69905, -0.5, 0.5), (12.69905, 0.5, 0.5), (13.69905, 0.5, 0.5), (12.69905, 0.5, -0.5), (13.69905, 0.5, -0.5), (12.69905, -0.5, -0.5), (13.69905, -0.5, -0.5)], + 1050: [(12.991114, -0.5, 0.5), (13.991114, -0.5, 0.5), (12.991114, 0.5, 0.5), (13.991114, 0.5, 0.5), (12.991114, 0.5, -0.5), (13.991114, 0.5, -0.5), (12.991114, -0.5, -0.5), (13.991114, -0.5, -0.5)], + 1051: [(13.273797, -0.5, 0.5), (14.273797, -0.5, 0.5), (13.273797, 0.5, 0.5), (14.273797, 0.5, 0.5), (13.273797, 0.5, -0.5), (14.273797, 0.5, -0.5), (13.273797, -0.5, -0.5), (14.273797, -0.5, -0.5)], + 1052: [(13.546494, -0.5, 0.5), (14.546494, -0.5, 0.5), (13.546494, 0.5, 0.5), (14.546494, 0.5, 0.5), (13.546494, 0.5, -0.5), (14.546494, 0.5, -0.5), (13.546494, -0.5, -0.5), (14.546494, -0.5, -0.5)], + 1053: [(13.808599, -0.5, 0.5), (14.808599, -0.5, 0.5), (13.808599, 0.5, 0.5), (14.808599, 0.5, 0.5), (13.808599, 0.5, -0.5), (14.808599, 0.5, -0.5), (13.808599, -0.5, -0.5), (14.808599, -0.5, -0.5)], + 1054: [(14.059509, -0.5, 0.5), (15.059509, -0.5, 0.5), (14.059509, 0.5, 0.5), (15.059509, 0.5, 0.5), (14.059509, 0.5, -0.5), (15.059509, 0.5, -0.5), (14.059509, -0.5, -0.5), (15.059509, -0.5, -0.5)], + 1055: [(14.298617, -0.5, 0.5), (15.298617, -0.5, 0.5), (14.298617, 0.5, 0.5), (15.298617, 0.5, 0.5), (14.298617, 0.5, -0.5), (15.298617, 0.5, -0.5), (14.298617, -0.5, -0.5), (15.298617, -0.5, -0.5)], + 1056: [(14.525318, -0.5, 0.5), (15.525318, -0.5, 0.5), (14.525318, 0.5, 0.5), (15.525318, 0.5, 0.5), (14.525318, 0.5, -0.5), (15.525318, 0.5, -0.5), (14.525318, -0.5, -0.5), (15.525318, -0.5, -0.5)], + 1057: [(14.739007, -0.5, 0.5), (15.739007, -0.5, 0.5), (14.739007, 0.5, 0.5), (15.739007, 0.5, 0.5), (14.739007, 0.5, -0.5), (15.739007, 0.5, -0.5), (14.739007, -0.5, -0.5), (15.739007, -0.5, -0.5)], + 1058: [(14.939079, -0.5, 0.5), (15.939079, -0.5, 0.5), (14.939079, 0.5, 0.5), (15.939079, 0.5, 0.5), (14.939079, 0.5, -0.5), (15.939079, 0.5, -0.5), (14.939079, -0.5, -0.5), (15.939079, -0.5, -0.5)], + 1059: [(15.124928, -0.5, 0.5), (16.12493, -0.5, 0.5), (15.124928, 0.5, 0.5), (16.12493, 0.5, 0.5), (15.124928, 0.5, -0.5), (16.12493, 0.5, -0.5), (15.124928, -0.5, -0.5), (16.12493, -0.5, -0.5)], + 1060: [(15.295951, -0.5, 0.5), (16.29595, -0.5, 0.5), (15.295951, 0.5, 0.5), (16.29595, 0.5, 0.5), (15.295951, 0.5, -0.5), (16.29595, 0.5, -0.5), (15.295951, -0.5, -0.5), (16.29595, -0.5, -0.5)], + 1061: [(15.45154, -0.5, 0.5), (16.45154, -0.5, 0.5), (15.45154, 0.5, 0.5), (16.45154, 0.5, 0.5), (15.45154, 0.5, -0.5), (16.45154, 0.5, -0.5), (15.45154, -0.5, -0.5), (16.45154, -0.5, -0.5)], + 1062: [(15.591091, -0.5, 0.5), (16.591091, -0.5, 0.5), (15.591091, 0.5, 0.5), (16.591091, 0.5, 0.5), (15.591091, 0.5, -0.5), (16.591091, 0.5, -0.5), (15.591091, -0.5, -0.5), (16.591091, -0.5, -0.5)], + 1063: [(15.713999, -0.5, 0.5), (16.713999, -0.5, 0.5), (15.713999, 0.5, 0.5), (16.713999, 0.5, 0.5), (15.713999, 0.5, -0.5), (16.713999, 0.5, -0.5), (15.713999, -0.5, -0.5), (16.713999, -0.5, -0.5)], + 1064: [(15.819658, -0.5, 0.5), (16.819658, -0.5, 0.5), (15.819658, 0.5, 0.5), (16.819658, 0.5, 0.5), (15.819658, 0.5, -0.5), (16.819658, 0.5, -0.5), (15.819658, -0.5, -0.5), (16.819658, -0.5, -0.5)], + 1065: [(15.907464, -0.5, 0.5), (16.907463, -0.5, 0.5), (15.907464, 0.5, 0.5), (16.907463, 0.5, 0.5), (15.907464, 0.5, -0.5), (16.907463, 0.5, -0.5), (15.907464, -0.5, -0.5), (16.907463, -0.5, -0.5)], + 1066: [(15.97681, -0.5, 0.5), (16.97681, -0.5, 0.5), (15.97681, 0.5, 0.5), (16.97681, 0.5, 0.5), (15.97681, 0.5, -0.5), (16.97681, 0.5, -0.5), (15.97681, -0.5, -0.5), (16.97681, -0.5, -0.5)], + 1067: [(16.027094, -0.5, 0.5), (17.027094, -0.5, 0.5), (16.027094, 0.5, 0.5), (17.027094, 0.5, 0.5), (16.027094, 0.5, -0.5), (17.027094, 0.5, -0.5), (16.027094, -0.5, -0.5), (17.027094, -0.5, -0.5)], + 1068: [(16.057707, -0.5, 0.5), (17.057707, -0.5, 0.5), (16.057707, 0.5, 0.5), (17.057707, 0.5, 0.5), (16.057707, 0.5, -0.5), (17.057707, 0.5, -0.5), (16.057707, -0.5, -0.5), (17.057707, -0.5, -0.5)], + 1069: [(16.068047, -0.5, 0.5), (17.068047, -0.5, 0.5), (16.068047, 0.5, 0.5), (17.068047, 0.5, 0.5), (16.068047, 0.5, -0.5), (17.068047, 0.5, -0.5), (16.068047, -0.5, -0.5), (17.068047, -0.5, -0.5)], + } + texCoord2f[] primvars:st ( + customData = { + dictionary Maya = { + token name = "map1" + } + } + interpolation = "faceVarying" + ) + texCoord2f[] primvars:st.timeSamples = { + 1000: [(0.375, 0), (0.625, 0), (0.375, 0.25), (0.625, 0.25), (0.375, 0.5), (0.625, 0.5), (0.375, 0.75), (0.625, 0.75), (0.375, 1), (0.625, 1), (0.875, 0), (0.875, 0.25), (0.125, 0), (0.125, 0.25)], + } + int[] primvars:st:indices.timeSamples = { + 1000: [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 9, 8, 1, 10, 11, 3, 12, 0, 2, 13], + } + uniform token subdivisionScheme = "none" + + def GeomSubset "back" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [2] + } + + def GeomSubset "bottom" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [3] + } + + def GeomSubset "front" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [0] + } + + def GeomSubset "left" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [5] + } + + def GeomSubset "right" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [4] + } + + def GeomSubset "top" + { + uniform token elementType = "face" + uniform token familyName = "componentTag" + int[] indices = [1] + } + } + + def Scope "Looks" + { + def Material "initialShadingGroup" + { + } + } +} + diff --git a/test/lib/usd/translators/testUsdImportPointCache.py b/test/lib/usd/translators/testUsdImportPointCache.py new file mode 100644 index 0000000000..916eabd365 --- /dev/null +++ b/test/lib/usd/translators/testUsdImportPointCache.py @@ -0,0 +1,81 @@ +#!/pxrpythonsubst + +# +# Copyright 2020 Apple +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from __future__ import division + +import fixturesUtils +import logging +import os +import unittest +from maya import cmds, standalone +from maya.api import OpenMaya as om +from pxr import Usd + + +class testUsdImportPointCache(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.input_dir = fixturesUtils.setUpClass(__file__) + cls.temp_dir = os.path.abspath('.') + cls.usd_file = os.path.join(cls.input_dir, "UsdImportPointCacheTest/pointCache.usda") + + @classmethod + def tearDownClass(cls): + standalone.uninitialize() + + @classmethod + def getKeyframes(cls, path): + """Get all keyframe values on a prims attributes""" + frames = set() + prim = cls.stage.GetPrimAtPath(path) + attrs = prim.GetAuthoredAttributes() + + for attr in attrs: + samples = attr.GetTimeSamples() + frames.update(samples) + + return sorted(frames) + + def testImportPointCache(self): + """Test that the point cache is imported correctly.""" + + cmds.file(f=True, new=True) + + namespace = 'pointCache' + cmds.file(self.usd_file, namespace=namespace, mergeNamespacesOnClash=False, + reference=True, type='USD Import', ignoreVersion=True, sharedReferenceFile=False, + groupLocator=False, deferReference=False, lockReference=False, + options="assemblyRep=Import;readAnimData=1;useAsAnimationCache=1;") + + nodeName = 'pointCache:usdPointBasedDeformerNode_group1_pCube1' + primPath = cmds.getAttr(nodeName + '.primPath') + self.assertEqual(primPath, '/group1/pCube1') + + nodeName = 'pointCache:pCube1' + + cmds.currentTime(0) + vtx = cmds.pointPosition(nodeName + '.vtx[1]') + self.assertAlmostEqual(vtx[0], 0.5) + + cmds.currentTime(1050) + vtx = cmds.pointPosition(nodeName + '.vtx[1]') + self.assertAlmostEqual(vtx[0], 13.99111366) + +if __name__ == '__main__': + unittest.main(verbosity=2) From 82998e4a3cec4835f69a5ced0522e36896af4df4 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Mon, 23 Jan 2023 14:56:09 -0500 Subject: [PATCH 3/3] MAYA-124459 fixing copything and import --- test/lib/usd/translators/testUsdImportPointCache.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/lib/usd/translators/testUsdImportPointCache.py b/test/lib/usd/translators/testUsdImportPointCache.py index 916eabd365..e029b9b2dc 100644 --- a/test/lib/usd/translators/testUsdImportPointCache.py +++ b/test/lib/usd/translators/testUsdImportPointCache.py @@ -1,7 +1,6 @@ -#!/pxrpythonsubst - +#!/usr/bin/env mayapy # -# Copyright 2020 Apple +# Copyright 2023 Autodesk # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,15 +15,10 @@ # limitations under the License. # -from __future__ import division - import fixturesUtils -import logging import os import unittest from maya import cmds, standalone -from maya.api import OpenMaya as om -from pxr import Usd class testUsdImportPointCache(unittest.TestCase):