From 9a5a9eb755182bc1c9d1ace19366f05305f506dd Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Tue, 3 Dec 2019 11:27:55 -0800 Subject: [PATCH 1/8] Applied changes from refactoring_sandbox up to 5a5392c to dev. --- lib/CMakeLists.txt | 310 ++++++++++++++++++ lib/base/debugCodes.h | 1 + lib/fileio/chaser/chaser.cpp | 42 +++ .../usdMaya => lib/fileio/chaser}/chaser.h | 8 +- .../fileio/chaser}/chaserRegistry.cpp | 6 +- .../fileio/chaser}/chaserRegistry.h | 24 +- .../fileio}/fallbackPrimReader.cpp | 4 +- .../fileio}/fallbackPrimReader.h | 4 +- .../fileio}/functorPrimReader.cpp | 2 +- .../fileio}/functorPrimReader.h | 10 +- .../fileio}/functorPrimWriter.cpp | 16 +- .../fileio}/functorPrimWriter.h | 8 +- .../fileio}/instancedNodeWriter.cpp | 8 +- .../fileio}/instancedNodeWriter.h | 6 +- .../usdMaya => lib/fileio/jobs}/jobArgs.cpp | 6 +- .../lib/usdMaya => lib/fileio/jobs}/jobArgs.h | 28 +- .../fileio/jobs}/modelKindProcessor.cpp | 2 +- .../fileio/jobs}/modelKindProcessor.h | 4 +- .../usdMaya => lib/fileio/jobs}/readJob.cpp | 126 +++---- .../lib/usdMaya => lib/fileio/jobs}/readJob.h | 73 +++-- .../usdMaya => lib/fileio/jobs}/writeJob.cpp | 26 +- .../usdMaya => lib/fileio/jobs}/writeJob.h | 11 +- .../lib/usdMaya => lib/fileio}/primReader.cpp | 2 +- .../lib/usdMaya => lib/fileio}/primReader.h | 16 +- .../usdMaya => lib/fileio}/primReaderArgs.cpp | 2 +- .../usdMaya => lib/fileio}/primReaderArgs.h | 20 +- .../fileio}/primReaderContext.cpp | 2 +- .../fileio}/primReaderContext.h | 12 +- .../fileio}/primReaderRegistry.cpp | 10 +- .../fileio}/primReaderRegistry.h | 16 +- lib/fileio/primUpdater.cpp | 109 ++++++ lib/fileio/primUpdater.h | 129 ++++++++ lib/fileio/primUpdaterContext.cpp | 46 +++ lib/fileio/primUpdaterContext.h | 62 ++++ lib/fileio/primUpdaterRegistry.cpp | 110 +++++++ lib/fileio/primUpdaterRegistry.h | 168 ++++++++++ .../lib/usdMaya => lib/fileio}/primWriter.cpp | 16 +- .../lib/usdMaya => lib/fileio}/primWriter.h | 42 +-- .../usdMaya => lib/fileio}/primWriterArgs.cpp | 4 +- .../usdMaya => lib/fileio}/primWriterArgs.h | 18 +- .../fileio}/primWriterContext.cpp | 2 +- .../fileio}/primWriterContext.h | 24 +- .../fileio}/primWriterRegistry.cpp | 8 +- .../fileio}/primWriterRegistry.h | 14 +- .../usdMaya => lib/fileio}/registryHelper.cpp | 4 +- .../usdMaya => lib/fileio}/registryHelper.h | 0 .../usdMaya => lib/fileio}/shaderWriter.cpp | 4 +- .../lib/usdMaya => lib/fileio}/shaderWriter.h | 12 +- .../shading}/shadingModeDisplayColor.cpp | 10 +- .../fileio/shading}/shadingModeExporter.cpp | 10 +- .../fileio/shading}/shadingModeExporter.h | 20 +- .../shading}/shadingModeExporterContext.cpp | 8 +- .../shading}/shadingModeExporterContext.h | 34 +- lib/fileio/shading/shadingModeImporter.cpp | 185 +++++++++++ .../fileio/shading}/shadingModeImporter.h | 30 +- .../fileio/shading}/shadingModePxrRis.cpp | 18 +- .../shading}/shadingModePxrRis_rfm_map.h | 0 .../fileio/shading}/shadingModeRegistry.cpp | 10 +- .../fileio/shading}/shadingModeRegistry.h | 20 +- .../shading}/shadingModeUseRegistry.cpp | 14 +- .../fileio}/transformWriter.cpp | 12 +- .../usdMaya => lib/fileio}/transformWriter.h | 10 +- .../translators}/skelBindingsProcessor.cpp | 4 +- .../translators}/skelBindingsProcessor.h | 4 +- .../fileio/translators}/translatorCamera.cpp | 12 +- .../fileio/translators}/translatorCamera.h | 10 +- .../fileio/translators}/translatorCurves.cpp | 4 +- .../fileio/translators}/translatorCurves.h | 8 +- .../fileio/translators}/translatorGprim.cpp | 4 +- .../fileio/translators}/translatorGprim.h | 10 +- .../translators}/translatorMaterial.cpp | 16 +- .../fileio/translators}/translatorMaterial.h | 14 +- .../fileio/translators}/translatorMesh.cpp | 26 +- .../fileio/translators}/translatorMesh.h | 8 +- .../translators}/translatorMesh_PrimVars.cpp | 10 +- .../translators}/translatorMesh_SubDiv.cpp | 4 +- .../translators}/translatorNurbsPatch.cpp | 12 +- .../translators}/translatorNurbsPatch.h | 8 +- .../fileio/translators}/translatorPrim.cpp | 8 +- .../fileio/translators}/translatorPrim.h | 8 +- .../translators}/translatorRfMLight.cpp | 22 +- .../fileio/translators}/translatorRfMLight.h | 14 +- .../fileio/translators}/translatorSkel.cpp | 8 +- .../fileio/translators}/translatorSkel.h | 22 +- .../fileio/translators}/translatorUtil.cpp | 16 +- .../fileio/translators}/translatorUtil.h | 18 +- .../translators}/translatorXformable.cpp | 8 +- .../fileio/translators}/translatorXformable.h | 10 +- .../translatorXformable_decompose.cpp | 2 +- .../usdMaya => lib/fileio/utils}/adaptor.cpp | 12 +- .../usdMaya => lib/fileio/utils}/adaptor.h | 104 +++--- .../usdMaya => lib/fileio/utils}/meshUtil.cpp | 4 +- .../usdMaya => lib/fileio/utils}/meshUtil.h | 16 +- .../usdMaya => lib/fileio/utils}/readUtil.cpp | 8 +- .../usdMaya => lib/fileio/utils}/readUtil.h | 24 +- .../fileio/utils}/roundTripUtil.cpp | 2 +- .../fileio/utils}/roundTripUtil.h | 16 +- .../fileio/utils}/shadingUtil.cpp | 2 +- .../fileio/utils}/shadingUtil.h | 6 +- .../fileio/utils}/userTaggedAttribute.cpp | 4 +- .../fileio/utils}/userTaggedAttribute.h | 20 +- .../fileio/utils}/writeUtil.cpp | 10 +- .../usdMaya => lib/fileio/utils}/writeUtil.h | 42 +-- .../fileio/utils}/xformStack.cpp | 2 +- .../usdMaya => lib/fileio/utils}/xformStack.h | 46 +-- .../fileio}/writeJobContext.cpp | 20 +- .../usdMaya => lib/fileio}/writeJobContext.h | 28 +- .../usdMaya => lib/nodes}/hdImagingShape.cpp | 8 +- .../usdMaya => lib/nodes}/hdImagingShape.h | 32 +- .../nodes}/pointBasedDeformerNode.cpp | 4 +- .../nodes}/pointBasedDeformerNode.h | 20 +- lib/nodes/proxyShapePlugin.cpp | 62 +++- .../lib/usdMaya => lib/nodes}/stageNode.cpp | 6 +- .../lib/usdMaya => lib/nodes}/stageNode.h | 18 +- lib/python/module.cpp | 34 ++ .../usdMaya => lib/python}/wrapAdaptor.cpp | 4 +- .../wrapBlockSceneModificationContext.cpp | 2 +- .../usdMaya => lib/python}/wrapColorSpace.cpp | 0 .../python}/wrapDiagnosticDelegate.cpp | 2 +- .../usdMaya => lib/python}/wrapMeshUtil.cpp | 2 +- .../lib/usdMaya => lib/python}/wrapQuery.cpp | 0 .../usdMaya => lib/python}/wrapReadUtil.cpp | 2 +- .../python}/wrapRoundTripUtil.cpp | 2 +- .../usdMaya => lib/python}/wrapStageCache.cpp | 0 .../python}/wrapUserTaggedAttribute.cpp | 2 +- .../usdMaya => lib/python}/wrapWriteUtil.cpp | 2 +- .../usdMaya => lib/python}/wrapXformStack.cpp | 2 +- .../render}/px_vp20/glslProgram.cpp | 2 +- .../lib => lib/render}/px_vp20/glslProgram.h | 12 +- .../maya/lib => lib/render}/px_vp20/utils.cpp | 4 +- .../maya/lib => lib/render}/px_vp20/utils.h | 20 +- .../render}/px_vp20/utils_legacy.cpp | 2 +- .../lib => lib/render}/px_vp20/utils_legacy.h | 4 +- .../render}/pxrUsdMayaGL/batchRenderer.cpp | 16 +- .../render}/pxrUsdMayaGL/batchRenderer.h | 66 ++-- .../render}/pxrUsdMayaGL/debugCodes.cpp | 2 +- .../render}/pxrUsdMayaGL/debugCodes.h | 0 .../hdImagingShapeDrawOverride.cpp | 12 +- .../pxrUsdMayaGL/hdImagingShapeDrawOverride.h | 22 +- .../render}/pxrUsdMayaGL/hdImagingShapeUI.cpp | 12 +- .../render}/pxrUsdMayaGL/hdImagingShapeUI.h | 8 +- .../render}/pxrUsdMayaGL/hdRenderer.cpp | 6 +- .../render}/pxrUsdMayaGL/hdRenderer.h | 14 +- .../render}/pxrUsdMayaGL/instancerImager.cpp | 58 +++- .../render}/pxrUsdMayaGL/instancerImager.h | 41 ++- .../pxrUsdMayaGL/instancerShapeAdapter.cpp | 112 ++----- .../pxrUsdMayaGL/instancerShapeAdapter.h | 22 +- .../pxrUsdMayaGL/proxyDrawOverride.cpp | 16 +- .../render}/pxrUsdMayaGL/proxyDrawOverride.h | 28 +- .../pxrUsdMayaGL/proxyShapeDelegate.cpp | 21 +- .../render}/pxrUsdMayaGL/proxyShapeUI.cpp | 18 +- .../render}/pxrUsdMayaGL/proxyShapeUI.h | 12 +- .../render}/pxrUsdMayaGL/renderParams.h | 2 +- .../render}/pxrUsdMayaGL/sceneDelegate.cpp | 9 +- .../render}/pxrUsdMayaGL/sceneDelegate.h | 26 +- .../render}/pxrUsdMayaGL/shapeAdapter.cpp | 14 +- .../render}/pxrUsdMayaGL/shapeAdapter.h | 44 +-- .../render}/pxrUsdMayaGL/softSelectHelper.cpp | 2 +- .../render}/pxrUsdMayaGL/softSelectHelper.h | 12 +- .../pxrUsdMayaGL/usdProxyShapeAdapter.cpp | 24 +- .../pxrUsdMayaGL/usdProxyShapeAdapter.h | 20 +- .../render}/pxrUsdMayaGL/userData.cpp | 4 +- .../render}/pxrUsdMayaGL/userData.h | 6 +- .../vp2ShaderFragments/FallbackCPVShader.xml | 17 + .../vp2ShaderFragments/FallbackShader.xml | 17 + .../vp2ShaderFragments/Float4ToFloat4.xml | 17 + .../vp2ShaderFragments/Float4ToFloatW.xml | 17 + .../vp2ShaderFragments/UsdPreviewSurface.xml | 16 + .../UsdPrimvarReader_float.xml | 17 + .../UsdPrimvarReader_float2.xml | 17 + .../UsdPrimvarReader_float3.xml | 17 + .../UsdPrimvarReader_float4.xml | 17 + .../vp2ShaderFragments/UsdUVTexture.xml | 17 + .../lightingContributions.xml | 16 + .../opacityToTransparency.xml | 17 + .../scaledDiffusePassThrough.xml | 17 + .../scaledSpecularPassThrough.xml | 17 + .../usdPreviewSurfaceCombiner.xml | 16 + .../usdPreviewSurfaceLighting.xml | 16 + lib/usd/CMakeLists.txt | 35 ++ lib/usd/translators/CMakeLists.txt | 138 ++++++++ .../usd/translators}/api.h | 0 .../usd/translators}/cameraReader.cpp | 5 +- .../usd/translators}/cameraWriter.cpp | 12 +- .../usd/translators}/cameraWriter.h | 4 +- .../usd/translators}/fileTextureWriter.cpp | 10 +- .../usd/translators}/fileTextureWriter.h | 5 +- .../usd/translators}/instancerWriter.cpp | 12 +- .../usd/translators}/instancerWriter.h | 7 +- .../usd/translators}/jointWriter.cpp | 18 +- .../usd/translators}/jointWriter.h | 4 +- .../usd/translators}/lightReader.cpp | 6 +- .../usd/translators}/lightWriter.cpp | 5 +- .../usd/translators}/locatorWriter.cpp | 8 +- .../usd/translators}/locatorWriter.h | 4 +- .../usd/translators}/materialReader.cpp | 5 +- .../usd/translators}/meshReader.cpp | 5 +- .../usd/translators}/meshWriter.cpp | 18 +- .../usd/translators}/meshWriter.h | 4 +- .../usd/translators}/meshWriter_Primvars.cpp | 10 +- .../usd/translators}/meshWriter_Skin.cpp | 10 +- .../usd/translators}/meshWriter_Subdiv.cpp | 3 +- .../usd/translators}/nurbsCurveWriter.cpp | 10 +- .../usd/translators}/nurbsCurveWriter.h | 4 +- .../usd/translators}/nurbsCurvesReader.cpp | 5 +- .../usd/translators}/nurbsPatchReader.cpp | 5 +- .../usd/translators}/nurbsSurfaceWriter.cpp | 12 +- .../usd/translators}/nurbsSurfaceWriter.h | 4 +- .../usd/translators}/overview.dox | 0 .../usd/translators}/particleWriter.cpp | 10 +- .../usd/translators}/particleWriter.h | 4 +- lib/usd/translators/plugInfo.json | 59 ++++ .../usd/translators}/plugin.cpp | 3 +- .../usd/translators}/scopeReader.cpp | 5 +- .../usd/translators}/skelReader.cpp | 7 +- .../usd/translators}/strokeWriter.cpp | 6 +- .../usd/translators}/strokeWriter.h | 4 +- .../usd/translators}/xformReader.cpp | 5 +- .../utils}/blockSceneModificationContext.cpp | 2 +- .../utils}/blockSceneModificationContext.h | 6 +- .../utils}/diagnosticDelegate.cpp | 4 +- .../utils}/diagnosticDelegate.h | 22 +- .../utils}/undoHelperCommand.cpp | 67 +++- .../usdMaya => lib/utils}/undoHelperCommand.h | 32 +- plugin/adsk/plugin/CMakeLists.txt | 1 + plugin/adsk/plugin/ProxyShape.cpp | 8 + plugin/adsk/plugin/importTranslator.cpp | 178 ++++++++++ plugin/adsk/plugin/importTranslator.h | 81 +++++ plugin/adsk/plugin/plugin.cpp | 58 +++- plugin/adsk/scripts/CMakeLists.txt | 2 + .../adsk/scripts/mayaUsdTranslatorExport.mel | 60 ++++ .../adsk/scripts/mayaUsdTranslatorImport.mel | 60 ++++ .../lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp | 1 + .../AL_USDMaya/AL/usdmaya/PluginRegister.h | 31 +- plugin/al/lib/AL_USDMaya/CMakeLists.txt | 1 - plugin/al/mayautils/AL/maya/CMakeLists.txt | 3 +- .../AL/maya/event/MayaEventManager.cpp | 3 +- .../al/plugin/AL_USDMayaPlugin/CMakeLists.txt | 1 - .../AL_USDMayaTestPlugin/CMakeLists.txt | 1 - .../ProxyShapeTranslator.cpp | 6 +- .../pxrUsdTranslators/ProxyShapeTranslator.h | 4 +- plugin/pxr/maya/lib/CMakeLists.txt | 2 - plugin/pxr/maya/lib/px_vp20/CMakeLists.txt | 36 -- plugin/pxr/maya/lib/px_vp20/api.h | 32 -- .../pxr/maya/lib/pxrUsdMayaGL/CMakeLists.txt | 62 ---- plugin/pxr/maya/lib/pxrUsdMayaGL/api.h | 32 -- .../testProxyShapeDrawUsdChangeProcessing.py | 4 +- plugin/pxr/maya/lib/usdMaya/CMakeLists.txt | 80 +---- plugin/pxr/maya/lib/usdMaya/exportCommand.cpp | 6 +- .../pxr/maya/lib/usdMaya/exportTranslator.cpp | 8 +- .../pxr/maya/lib/usdMaya/exportTranslator.h | 2 +- plugin/pxr/maya/lib/usdMaya/importCommand.cpp | 8 +- plugin/pxr/maya/lib/usdMaya/importCommand.h | 4 +- .../pxr/maya/lib/usdMaya/importTranslator.cpp | 16 +- .../pxr/maya/lib/usdMaya/importTranslator.h | 2 +- ...instancerShapeAdapterWithSceneAssembly.cpp | 135 ++++++++ .../instancerShapeAdapterWithSceneAssembly.h | 52 +++ .../lib/usdMaya/listShadingModesCommand.cpp | 4 +- plugin/pxr/maya/lib/usdMaya/module.cpp | 12 - plugin/pxr/maya/lib/usdMaya/proxyShape.cpp | 19 +- .../lib/usdMaya/readJobWithSceneAssembly.cpp | 126 +++++++ .../lib/usdMaya/readJobWithSceneAssembly.h | 73 +++++ .../lib/usdMaya/readJob_ImportWithProxies.cpp | 18 +- .../maya/lib/usdMaya/referenceAssembly.cpp | 33 +- .../testUsdExportShadingModeDisplayColor.py | 8 +- .../usdMaya/testenv/testUsdExportUVSets.py | 8 +- .../lib/usdMaya/testenv/testUsdImportMesh.py | 10 +- .../usdMaya/testenv/testUsdImportUVSets.py | 8 +- .../lib/usdMaya/testenv/testUsdMayaAdaptor.py | 50 +-- .../testenv/testUsdMayaAdaptorMetadata.py | 6 +- ...estUsdMayaBlockSceneModificationContext.py | 6 +- .../testenv/testUsdMayaDiagnosticDelegate.py | 18 +- .../testUsdMayaGetVariantSetSelections.py | 4 +- .../testenv/testUsdMayaReadWriteUtils.py | 50 +-- .../usdMaya/testenv/testUsdMayaXformStack.py | 84 ++--- ...dReferenceAssemblyChangeRepresentations.py | 10 +- .../lib/usdMaya/translatorModelAssembly.cpp | 20 +- .../lib/usdMaya/translatorModelAssembly.h | 8 +- .../lib/usdMaya/userExportedAttributesUI.py | 6 +- plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt | 1 - .../pxr/maya/plugin/pxrUsd/alembicChaser.cpp | 4 +- plugin/pxr/maya/plugin/pxrUsd/plugin.cpp | 128 +++----- .../pxr/maya/plugin/pxrUsd/usdTranslator.cpp | 2 +- .../usdPreviewSurfaceWriter.cpp | 8 +- .../usdPreviewSurfaceWriter.h | 4 +- .../plugin/pxrUsdTranslators/CMakeLists.txt | 64 ---- .../plugin/pxrUsdTranslators/plugInfo.json | 60 ---- .../testenv/testPxrUsdTranslators.py | 8 +- test/lib/ufe/testGroupCmd.py | 2 +- 289 files changed, 4271 insertions(+), 1954 deletions(-) create mode 100644 lib/fileio/chaser/chaser.cpp rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/chaser}/chaser.h (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/chaser}/chaserRegistry.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/chaser}/chaserRegistry.h (93%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/fallbackPrimReader.cpp (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/fallbackPrimReader.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/functorPrimReader.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/functorPrimReader.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/functorPrimWriter.cpp (91%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/functorPrimWriter.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/instancedNodeWriter.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/instancedNodeWriter.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/jobArgs.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/jobArgs.h (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/modelKindProcessor.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/modelKindProcessor.h (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/readJob.cpp (76%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/readJob.h (58%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/writeJob.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/jobs}/writeJob.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReader.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReader.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderArgs.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderArgs.h (88%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderContext.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderContext.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderRegistry.cpp (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primReaderRegistry.h (95%) create mode 100644 lib/fileio/primUpdater.cpp create mode 100644 lib/fileio/primUpdater.h create mode 100644 lib/fileio/primUpdaterContext.cpp create mode 100644 lib/fileio/primUpdaterContext.h create mode 100644 lib/fileio/primUpdaterRegistry.cpp create mode 100644 lib/fileio/primUpdaterRegistry.h rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriter.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriter.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterArgs.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterArgs.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterContext.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterContext.h (93%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterRegistry.cpp (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/primWriterRegistry.h (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/registryHelper.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/registryHelper.h (100%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/shaderWriter.cpp (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/shaderWriter.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeDisplayColor.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeExporter.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeExporter.h (89%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeExporterContext.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeExporterContext.h (92%) create mode 100644 lib/fileio/shading/shadingModeImporter.cpp rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeImporter.h (92%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModePxrRis.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModePxrRis_rfm_map.h (100%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeRegistry.cpp (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeRegistry.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/shading}/shadingModeUseRegistry.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/transformWriter.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/transformWriter.h (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/skelBindingsProcessor.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/skelBindingsProcessor.h (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorCamera.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorCamera.h (91%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorCurves.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorCurves.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorGprim.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorGprim.h (89%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMaterial.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMaterial.h (91%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMesh.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMesh.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMesh_PrimVars.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorMesh_SubDiv.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorNurbsPatch.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorNurbsPatch.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorPrim.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorPrim.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorRfMLight.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorRfMLight.h (87%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorSkel.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorSkel.h (92%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorUtil.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorUtil.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorXformable.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorXformable.h (91%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/translators}/translatorXformable_decompose.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/adaptor.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/adaptor.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/meshUtil.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/meshUtil.h (93%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/readUtil.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/readUtil.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/roundTripUtil.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/roundTripUtil.h (92%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/shadingUtil.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/shadingUtil.h (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/userTaggedAttribute.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/userTaggedAttribute.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/writeUtil.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/writeUtil.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/xformStack.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio/utils}/xformStack.h (95%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/writeJobContext.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/fileio}/writeJobContext.h (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/hdImagingShape.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/hdImagingShape.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/pointBasedDeformerNode.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/pointBasedDeformerNode.h (90%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/stageNode.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/nodes}/stageNode.h (90%) create mode 100644 lib/python/module.cpp rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapAdaptor.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapBlockSceneModificationContext.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapColorSpace.cpp (100%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapDiagnosticDelegate.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapMeshUtil.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapQuery.cpp (100%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapReadUtil.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapRoundTripUtil.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapStageCache.cpp (100%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapUserTaggedAttribute.cpp (98%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapWriteUtil.cpp (97%) rename {plugin/pxr/maya/lib/usdMaya => lib/python}/wrapXformStack.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/glslProgram.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/glslProgram.h (90%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/utils.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/utils.h (93%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/utils_legacy.cpp (98%) rename {plugin/pxr/maya/lib => lib/render}/px_vp20/utils_legacy.h (96%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/batchRenderer.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/batchRenderer.h (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/debugCodes.cpp (97%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/debugCodes.h (100%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp (96%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdImagingShapeDrawOverride.h (91%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdImagingShapeUI.cpp (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdImagingShapeUI.h (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdRenderer.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/hdRenderer.h (96%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/instancerImager.cpp (90%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/instancerImager.h (79%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/instancerShapeAdapter.cpp (79%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/instancerShapeAdapter.h (87%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/proxyDrawOverride.cpp (96%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/proxyDrawOverride.h (87%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/proxyShapeDelegate.cpp (86%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/proxyShapeUI.cpp (92%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/proxyShapeUI.h (94%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/renderParams.h (98%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/sceneDelegate.cpp (99%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/sceneDelegate.h (93%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/shapeAdapter.cpp (98%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/shapeAdapter.h (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/softSelectHelper.cpp (98%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/softSelectHelper.h (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/usdProxyShapeAdapter.cpp (95%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/usdProxyShapeAdapter.h (94%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/userData.cpp (94%) rename {plugin/pxr/maya/lib => lib/render}/pxrUsdMayaGL/userData.h (94%) create mode 100644 lib/usd/CMakeLists.txt create mode 100644 lib/usd/translators/CMakeLists.txt rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/api.h (100%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/cameraReader.cpp (91%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/cameraWriter.cpp (96%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/cameraWriter.h (94%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/fileTextureWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/fileTextureWriter.h (94%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/instancerWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/instancerWriter.h (96%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/jointWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/jointWriter.h (97%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/lightReader.cpp (95%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/lightWriter.cpp (94%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/locatorWriter.cpp (91%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/locatorWriter.h (95%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/materialReader.cpp (92%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshReader.cpp (91%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshWriter.h (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshWriter_Primvars.cpp (99%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshWriter_Skin.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/meshWriter_Subdiv.cpp (99%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsCurveWriter.cpp (97%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsCurveWriter.h (95%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsCurvesReader.cpp (91%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsPatchReader.cpp (91%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsSurfaceWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/nurbsSurfaceWriter.h (95%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/overview.dox (100%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/particleWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/particleWriter.h (95%) create mode 100644 lib/usd/translators/plugInfo.json rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/plugin.cpp (96%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/scopeReader.cpp (92%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/skelReader.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/strokeWriter.cpp (98%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/strokeWriter.h (94%) rename {plugin/pxr/maya/plugin/pxrUsdTranslators => lib/usd/translators}/xformReader.cpp (93%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/blockSceneModificationContext.cpp (96%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/blockSceneModificationContext.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/diagnosticDelegate.cpp (99%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/diagnosticDelegate.h (94%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/undoHelperCommand.cpp (56%) rename {plugin/pxr/maya/lib/usdMaya => lib/utils}/undoHelperCommand.h (83%) create mode 100644 plugin/adsk/plugin/importTranslator.cpp create mode 100644 plugin/adsk/plugin/importTranslator.h create mode 100644 plugin/adsk/scripts/mayaUsdTranslatorExport.mel create mode 100644 plugin/adsk/scripts/mayaUsdTranslatorImport.mel delete mode 100644 plugin/pxr/maya/lib/px_vp20/CMakeLists.txt delete mode 100644 plugin/pxr/maya/lib/px_vp20/api.h delete mode 100644 plugin/pxr/maya/lib/pxrUsdMayaGL/CMakeLists.txt delete mode 100644 plugin/pxr/maya/lib/pxrUsdMayaGL/api.h create mode 100644 plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.cpp create mode 100644 plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.h create mode 100644 plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.cpp create mode 100644 plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.h delete mode 100644 plugin/pxr/maya/plugin/pxrUsdTranslators/plugInfo.json diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 53f0c2607f..eab78a2fde 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -44,16 +44,84 @@ list(APPEND mayaUsd_src # base/debugCodes.cpp # + fileio/registryHelper.cpp + fileio/primReaderContext.cpp + fileio/primReaderArgs.cpp + fileio/primReader.cpp + fileio/primReaderRegistry.cpp + fileio/functorPrimReader.cpp + fileio/fallbackPrimReader.cpp + fileio/primWriterContext.cpp + fileio/primWriterArgs.cpp + fileio/primWriter.cpp + fileio/primWriterRegistry.cpp + fileio/functorPrimWriter.cpp + fileio/writeJobContext.cpp + fileio/instancedNodeWriter.cpp + fileio/transformWriter.cpp + fileio/shaderWriter.cpp + fileio/primUpdater.cpp + fileio/primUpdaterContext.cpp + fileio/primUpdaterRegistry.cpp + # + fileio/chaser/chaser.cpp + fileio/chaser/chaserRegistry.cpp + # + fileio/jobs/jobArgs.cpp + fileio/jobs/readJob.cpp + fileio/jobs/writeJob.cpp + fileio/jobs/modelKindProcessor.cpp + # + fileio/translators/translatorUtil.cpp + fileio/translators/translatorXformable.cpp + fileio/translators/translatorXformable_decompose.cpp + fileio/translators/translatorPrim.cpp + fileio/translators/translatorGprim.cpp + fileio/translators/skelBindingsProcessor.cpp + fileio/translators/translatorMaterial.cpp + fileio/translators/translatorCamera.cpp + fileio/translators/translatorCurves.cpp + fileio/translators/translatorMesh.cpp + fileio/translators/translatorMesh_SubDiv.cpp + fileio/translators/translatorMesh_PrimVars.cpp + fileio/translators/translatorNurbsPatch.cpp + fileio/translators/translatorRfMLight.cpp + fileio/translators/translatorSkel.cpp + # + fileio/shading/shadingModeDisplayColor.cpp + fileio/shading/shadingModeExporterContext.cpp + fileio/shading/shadingModeExporter.cpp + fileio/shading/shadingModeImporter.cpp + fileio/shading/shadingModePxrRis.cpp + fileio/shading/shadingModeRegistry.cpp + fileio/shading/shadingModeUseRegistry.cpp + # + fileio/utils/adaptor.cpp + fileio/utils/readUtil.cpp + fileio/utils/userTaggedAttribute.cpp + fileio/utils/writeUtil.cpp + fileio/utils/shadingUtil.cpp + fileio/utils/meshUtil.cpp + fileio/utils/roundTripUtil.cpp + fileio/utils/xformStack.cpp + # utils/colorSpace.cpp + utils/diagnosticDelegate.cpp utils/query.cpp utils/util.cpp utils/utilFileSystem.cpp + utils/blockSceneModificationContext.cpp utils/stageCache.cpp + utils/query.cpp + utils/undoHelperCommand # + nodes/pointBasedDeformerNode.cpp + nodes/hdImagingShape.cpp nodes/usdPrimProvider.cpp nodes/proxyShapeBase.cpp nodes/proxyShapePlugin.cpp nodes/stageData.cpp + nodes/stageNode.cpp # listeners/stageNoticeListener.cpp listeners/notice.cpp @@ -73,6 +141,25 @@ list(APPEND mayaUsd_src # render/vp2ShaderFragments/shaderFragments.cpp # + render/pxrUsdMayaGL/batchRenderer.cpp + render/pxrUsdMayaGL/debugCodes.cpp + render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp + render/pxrUsdMayaGL/hdImagingShapeUI.cpp + render/pxrUsdMayaGL/hdRenderer.cpp + render/pxrUsdMayaGL/proxyDrawOverride.cpp + render/pxrUsdMayaGL/proxyShapeUI.cpp + render/pxrUsdMayaGL/sceneDelegate.cpp + render/pxrUsdMayaGL/shapeAdapter.cpp + render/pxrUsdMayaGL/softSelectHelper.cpp + render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp + render/pxrUsdMayaGL/userData.cpp + render/pxrUsdMayaGL/instancerImager.cpp + render/pxrUsdMayaGL/instancerShapeAdapter.cpp + render/pxrUsdMayaGL/proxyShapeDelegate.cpp + # + render/px_vp20/glslProgram.cpp + render/px_vp20/utils.cpp + render/px_vp20/utils_legacy.cpp ) list(APPEND mayaUsdShaderFragments_xmls @@ -145,20 +232,93 @@ list(APPEND mayaUsdBase_headers base/debugCodes.h ) +list(APPEND mayaUsdFileio_headers + fileio/registryHelper.h + fileio/primReaderContext.h + fileio/primReaderArgs.h + fileio/primReader.h + fileio/primReaderRegistry.h + fileio/functorPrimReader.h + fileio/fallbackPrimReader.h + fileio/primWriterContext.h + fileio/primWriterArgs.h + fileio/primWriter.h + fileio/primWriterRegistry.h + fileio/functorPrimWriter.h + fileio/writeJobContext.h + fileio/instancedNodeWriter.h + fileio/transformWriter.h + fileio/shaderWriter.h + fileio/primUpdater.h + fileio/primUpdaterContext.h + fileio/primUpdaterRegistry.h +) + +list(APPEND mayaUsdChaser_headers + fileio/chaser/chaser.h + fileio/chaser/chaserRegistry.h +) + +list(APPEND mayaUsdJobs_headers + fileio/jobs/jobArgs.h + fileio/jobs/readJob.h + fileio/jobs/writeJob.h + fileio/jobs/modelKindProcessor.h +) + +list(APPEND mayaUsdShading_headers + fileio/shading/shadingModeExporterContext.h + fileio/shading/shadingModeExporter.h + fileio/shading/shadingModeImporter.h + fileio/shading/shadingModeRegistry.h +) + +list(APPEND mayaUsdUtilsIO_headers + fileio/utils/adaptor.h + fileio/utils/readUtil.h + fileio/utils/userTaggedAttribute.h + fileio/utils/writeUtil.h + fileio/utils/shadingUtil.h + fileio/utils/meshUtil.h + fileio/utils/roundTripUtil.h + fileio/utils/xformStack.h +) + +list(APPEND mayaUsdTranslators_headers + fileio/translators/translatorUtil.h + fileio/translators/translatorXformable.h + fileio/translators/translatorPrim.h + fileio/translators/translatorGprim.h + fileio/translators/skelBindingsProcessor.h + fileio/translators/translatorMaterial.h + fileio/translators/translatorCamera.h + fileio/translators/translatorCurves.h + fileio/translators/translatorMesh.h + fileio/translators/translatorNurbsPatch.h + fileio/translators/translatorRfMLight.h + fileio/translators/translatorSkel.h +) + list(APPEND mayaUsdUtils_headers utils/colorSpace.h + utils/diagnosticDelegate.h utils/query.h utils/util.h utils/utilFileSystem.h + utils/blockSceneModificationContext.h utils/stageCache.h utils/query.h + utils/undoHelperCommand.h ) list(APPEND mayaUsdNodes_headers + nodes/pointBasedDeformerNode.h + nodes/hdImagingShape.h nodes/usdPrimProvider.h nodes/proxyShapeBase.h nodes/proxyShapePlugin.h nodes/stageData.h + nodes/stageNode.h ) list(APPEND mayaUsdListeners_headers @@ -207,6 +367,28 @@ if(UFE_FOUND) endif() endif() +list(APPEND mayaUsdPxrUsdMayaGL_headers + render/pxrUsdMayaGL/batchRenderer.h + render/pxrUsdMayaGL/debugCodes.h + render/pxrUsdMayaGL/hdImagingShapeUI.h + render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h + render/pxrUsdMayaGL/instancerImager.h + render/pxrUsdMayaGL/instancerShapeAdapter.h + render/pxrUsdMayaGL/proxyShapeUI.h + render/pxrUsdMayaGL/proxyDrawOverride.h + render/pxrUsdMayaGL/renderParams.h + render/pxrUsdMayaGL/sceneDelegate.h + render/pxrUsdMayaGL/shapeAdapter.h + render/pxrUsdMayaGL/softSelectHelper.h + render/pxrUsdMayaGL/usdProxyShapeAdapter.h + render/pxrUsdMayaGL/userData.h +) + +list(APPEND mayaUsdPxVP20_headers + render/px_vp20/utils.h + render/px_vp20/utils_legacy.h +) + add_library(${LIBRARY_NAME} SHARED ${mayaUsd_src} ) @@ -317,6 +499,12 @@ set_property(GLOBAL PROPERTY GLOBAL_LIBRARY_LOCATION ${CMAKE_INSTALL_PREFIX}/lib # promote headers mayaUsd_promoteMayaUsdHeader() mayaUsd_promoteHeaderList(${mayaUsdBase_headers}) +mayaUsd_promoteHeaderList(${mayaUsdFileio_headers}) +mayaUsd_promoteHeaderList(${mayaUsdChaser_headers}) +mayaUsd_promoteHeaderList(${mayaUsdJobs_headers}) +mayaUsd_promoteHeaderList(${mayaUsdUtilsIO_headers}) +mayaUsd_promoteHeaderList(${mayaUsdShading_headers}) +mayaUsd_promoteHeaderList(${mayaUsdTranslators_headers}) mayaUsd_promoteHeaderList(${mayaUsdUtils_headers}) mayaUsd_promoteHeaderList(${mayaUsdNodes_headers}) mayaUsd_promoteHeaderList(${mayaUsdListeners_headers}) @@ -324,6 +512,7 @@ mayaUsd_promoteHeaderList(${mayaUsdVP2RenderDelegate_headers}) if(UFE_FOUND) mayaUsd_promoteHeaderList(${mayaUsdUfe_headers}) endif() +mayaUsd_promoteHeaderList(${mayaUsdPxrUsdMayaGL_headers}) # install public headers install(FILES ${CMAKE_BINARY_DIR}/include/mayaUsd/mayaUsd.h @@ -334,6 +523,30 @@ install(FILES ${mayaUsdBase_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/base/ ) +install(FILES ${mayaUsdFileio_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/ +) + +install(FILES ${mayaUsdChaser_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/chaser/ +) + +install(FILES ${mayaUsdJobs_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/jobs/ +) + +install(FILES ${mayaUsdUtilsIO_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/utils/ +) + +install(FILES ${mayaUsdShading_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/shading/ +) + +install(FILES ${mayaUsdTranslators_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/fileio/translators/ +) + install(FILES ${mayaUsdUtils_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/utils/ ) @@ -356,6 +569,10 @@ if(UFE_FOUND) ) endif() +install(FILES ${mayaUsdPxrUsdMayaGL_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/render/pxrUsdMayaGL +) + install(FILES ${mayaUsdShaderFragments_xmls} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/usd/mayaUsd_ShaderFragments/resources ) @@ -437,6 +654,99 @@ if(UFE_FOUND) endif() +# Python extension library for mayaUsd library bindings. Capitalize leading +# character of library name. Pixar's TF_WRAP_MODULE macro expects the library +# name to be prefixed with _, but adds an underscore to the package name when +# creating the Python extension module initialization function (see Pixar's +# pyModule.h). Create a package name without the leading underscore, and +# prefix our library name with a leading underscore, to match this convention. +string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_CAPS) +string(SUBSTRING "${LIBRARY_NAME}" 1 -1 LIBRARY_NAME_END) +string(SUBSTRING "${LIBRARY_NAME_CAPS}" 0 1 LIBRARY_NAME_BEGIN) +string(CONCAT PACKAGE_NAME "Py" "${LIBRARY_NAME_BEGIN}" "${LIBRARY_NAME_END}") +string(CONCAT PYTHON_LIBRARY_NAME "_" "${PACKAGE_NAME}") + +add_library(${PYTHON_LIBRARY_NAME} + SHARED + python/module.cpp + python/wrapAdaptor.cpp + python/wrapBlockSceneModificationContext.cpp + python/wrapColorSpace.cpp + python/wrapDiagnosticDelegate.cpp + python/wrapMeshUtil.cpp + python/wrapQuery.cpp + python/wrapReadUtil.cpp + python/wrapRoundTripUtil.cpp + python/wrapStageCache.cpp + python/wrapUserTaggedAttribute.cpp + python/wrapWriteUtil.cpp + python/wrapXformStack.cpp +) + if(IS_MACOSX) set(_macDef OSMac_) endif() + +target_compile_definitions(${PYTHON_LIBRARY_NAME} + PRIVATE + ${_macDef} + MFB_PACKAGE_NAME=${PACKAGE_NAME} + MFB_ALT_PACKAGE_NAME=${PACKAGE_NAME} + MFB_PACKAGE_MODULE=${PROJECT_NAME} +) +set_target_properties(${PYTHON_LIBRARY_NAME} + PROPERTIES + PREFIX "" +) +if(IS_WINDOWS) +set_target_properties(${PYTHON_LIBRARY_NAME} + PROPERTIES + SUFFIX ".pyd" +) +elseif(IS_MACOSX) + set_target_properties(${PYTHON_LIBRARY_NAME} + PROPERTIES + SUFFIX ".so" + ) +endif() + +target_link_libraries(${PYTHON_LIBRARY_NAME} + ${LIBRARY_NAME} +) + +# We will use the following Python package structure: +# +# mayaUsd: top-level package +# mayaUsd.lib: Python wrappers for mayaUsd library functionality. +# +# We re-map the Python library namespace to mayaUsd.lib through a simple +# __init__.py. + +set(PYLIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/python/${PROJECT_NAME}/lib) + +if(IS_MACOSX OR IS_LINUX) + mayaUsd_init_rpath(rpath "lib") + mayaUsd_add_rpath(rpath "../../..") + mayaUsd_install_rpath(rpath ${PYTHON_LIBRARY_NAME}) +endif() + +install(TARGETS ${PYTHON_LIBRARY_NAME} + LIBRARY + DESTINATION ${PYLIB_INSTALL_PREFIX} + ARCHIVE + DESTINATION ${PYLIB_INSTALL_PREFIX} + RUNTIME + DESTINATION ${PYLIB_INSTALL_PREFIX} +) +if(IS_WINDOWS) + install(FILES $ DESTINATION ${PYLIB_INSTALL_PREFIX} OPTIONAL) +endif() + +install(CODE + "file(TOUCH \"${PYLIB_INSTALL_PREFIX}/../__init__.py\")") + +install(CODE + "file(WRITE \"${PYLIB_INSTALL_PREFIX}/__init__.py\" + \"from ${PYTHON_LIBRARY_NAME} import *\")") + +add_subdirectory(usd) diff --git a/lib/base/debugCodes.h b/lib/base/debugCodes.h index e004f53983..12f737713e 100644 --- a/lib/base/debugCodes.h +++ b/lib/base/debugCodes.h @@ -25,6 +25,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DEBUG_CODES( PXRUSDMAYA_REGISTRY, PXRUSDMAYA_DIAGNOSTICS, + PXRUSDMAYA_TRANSLATORS, USDMAYA_PROXYSHAPEBASE ); diff --git a/lib/fileio/chaser/chaser.cpp b/lib/fileio/chaser/chaser.cpp new file mode 100644 index 0000000000..5b92794d70 --- /dev/null +++ b/lib/fileio/chaser/chaser.cpp @@ -0,0 +1,42 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include "chaser.h" + +PXR_NAMESPACE_OPEN_SCOPE + +bool +UsdMayaChaser::ExportDefault() +{ + // Do nothing by default. + return true; +} + +bool +UsdMayaChaser::ExportFrame(const UsdTimeCode& time) +{ + // Do nothing by default. + return true; +} + +bool +UsdMayaChaser::PostExport() +{ + // Do nothing by default. + return true; +} + +PXR_NAMESPACE_CLOSE_SCOPE + diff --git a/plugin/pxr/maya/lib/usdMaya/chaser.h b/lib/fileio/chaser/chaser.h similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/chaser.h rename to lib/fileio/chaser/chaser.h index af164866ea..66d125a059 100644 --- a/plugin/pxr/maya/lib/usdMaya/chaser.h +++ b/lib/fileio/chaser/chaser.h @@ -18,7 +18,7 @@ /// \file usdMaya/chaser.h -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/pxr.h" @@ -57,14 +57,14 @@ class UsdMayaChaser : public TfRefBase /// The stage will be incomplete; any animated data will not have /// been exported yet. /// Returning false will terminate the whole export. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool ExportDefault(); /// Do custom processing after UsdMaya has exported data at \p time. /// The stage will be incomplete; any future animated frames will not /// have been exported yet. /// Returning false will terminate the whole export. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool ExportFrame(const UsdTimeCode& time); /// Do custom post-processing that needs to run after the main UsdMaya @@ -72,7 +72,7 @@ class UsdMayaChaser : public TfRefBase /// At this point, all data has been authored to the stage (except for /// any custom data that you'll author in this step). /// Returning false will terminate the whole export. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool PostExport(); }; diff --git a/plugin/pxr/maya/lib/usdMaya/chaserRegistry.cpp b/lib/fileio/chaser/chaserRegistry.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/chaserRegistry.cpp rename to lib/fileio/chaser/chaserRegistry.cpp index b9714cce00..21fc882d0d 100644 --- a/plugin/pxr/maya/lib/usdMaya/chaserRegistry.cpp +++ b/lib/fileio/chaser/chaserRegistry.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/chaserRegistry.h" +#include "chaserRegistry.h" -#include -#include "usdMaya/registryHelper.h" +#include "../../base/debugCodes.h" +#include "../registryHelper.h" #include "pxr/base/tf/instantiateSingleton.h" diff --git a/plugin/pxr/maya/lib/usdMaya/chaserRegistry.h b/lib/fileio/chaser/chaserRegistry.h similarity index 93% rename from plugin/pxr/maya/lib/usdMaya/chaserRegistry.h rename to lib/fileio/chaser/chaserRegistry.h index 1819cfaeff..cb69fc0027 100644 --- a/plugin/pxr/maya/lib/usdMaya/chaserRegistry.h +++ b/lib/fileio/chaser/chaserRegistry.h @@ -18,10 +18,10 @@ /// \file usdMaya/chaserRegistry.h -#include "usdMaya/api.h" -#include "usdMaya/chaser.h" -#include "usdMaya/jobArgs.h" -#include +#include "../../base/api.h" +#include "chaser.h" +#include "../jobs/jobArgs.h" +#include "../../utils/util.h" #include "pxr/pxr.h" @@ -61,7 +61,7 @@ class UsdMayaChaserRegistry : public TfWeakBase public: typedef UsdMayaUtil::MDagPathMap DagToUsdMap; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC FactoryContext( const UsdStagePtr& stage, const DagToUsdMap& dagToUsdMap, @@ -71,21 +71,21 @@ class UsdMayaChaserRegistry : public TfWeakBase /// /// It is safe for the \p UsdMayaChaser to save this return value and /// use it during it's execution. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdStagePtr GetStage() const; /// \brief Returns a map that maps full MDagPath's to Usd prim paths. /// /// It is safe for the \p UsdMayaChaser to save this return value by /// reference and use it during it's execution. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const DagToUsdMap& GetDagToUsdMap() const; /// \brief Returns the current job args. /// /// It is safe for the \p UsdMayaChaser to save this return value by /// reference and use it during it's execution. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdMayaJobExportArgs& GetJobArgs() const; private: @@ -100,22 +100,22 @@ class UsdMayaChaserRegistry : public TfWeakBase /// /// Please use the \p PXRUSDMAYA_DEFINE_CHASER_FACTORY instead of calling /// this directly. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool RegisterFactory( const std::string& name, FactoryFn fn); /// \brief Creates a chaser using the factoring registered to \p name. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaChaserRefPtr Create( const std::string& name, const FactoryContext& context) const; /// \brief Returns the names of all registered chasers. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::vector GetAllRegisteredChasers() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdMayaChaserRegistry& GetInstance(); private: diff --git a/plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.cpp b/lib/fileio/fallbackPrimReader.cpp similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.cpp rename to lib/fileio/fallbackPrimReader.cpp index 31976219ef..cfcb96ca6a 100644 --- a/plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.cpp +++ b/lib/fileio/fallbackPrimReader.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/fallbackPrimReader.h" +#include "fallbackPrimReader.h" -#include "usdMaya/translatorUtil.h" +#include "translators/translatorUtil.h" #include "pxr/usd/usdGeom/imageable.h" diff --git a/plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.h b/lib/fileio/fallbackPrimReader.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.h rename to lib/fileio/fallbackPrimReader.h index e2cd2e5d71..7034c42a56 100644 --- a/plugin/pxr/maya/lib/usdMaya/fallbackPrimReader.h +++ b/lib/fileio/fallbackPrimReader.h @@ -18,8 +18,8 @@ /// \file usdMaya/fallbackPrimReader.h -#include "usdMaya/primReader.h" -#include "usdMaya/primReaderRegistry.h" +#include "primReader.h" +#include "primReaderRegistry.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/functorPrimReader.cpp b/lib/fileio/functorPrimReader.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/functorPrimReader.cpp rename to lib/fileio/functorPrimReader.cpp index 4b317e5fac..305aa13a62 100644 --- a/plugin/pxr/maya/lib/usdMaya/functorPrimReader.cpp +++ b/lib/fileio/functorPrimReader.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/functorPrimReader.h" +#include "functorPrimReader.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/functorPrimReader.h b/lib/fileio/functorPrimReader.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/functorPrimReader.h rename to lib/fileio/functorPrimReader.h index 121b59f7dd..79f5d5c2c5 100644 --- a/plugin/pxr/maya/lib/usdMaya/functorPrimReader.h +++ b/lib/fileio/functorPrimReader.h @@ -18,11 +18,11 @@ /// \file usdMaya/functorPrimReader.h -#include "usdMaya/api.h" -#include "usdMaya/primReader.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primReaderRegistry.h" +#include "../base/api.h" +#include "primReader.h" +#include "primReaderArgs.h" +#include "primReaderContext.h" +#include "primReaderRegistry.h" #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/functorPrimWriter.cpp b/lib/fileio/functorPrimWriter.cpp similarity index 91% rename from plugin/pxr/maya/lib/usdMaya/functorPrimWriter.cpp rename to lib/fileio/functorPrimWriter.cpp index 75c909e895..9499f8a575 100644 --- a/plugin/pxr/maya/lib/usdMaya/functorPrimWriter.cpp +++ b/lib/fileio/functorPrimWriter.cpp @@ -14,14 +14,14 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/functorPrimWriter.h" - -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/transformWriter.h" -#include "usdMaya/writeJobContext.h" +#include "functorPrimWriter.h" + +#include "primWriter.h" +#include "primWriterArgs.h" +#include "primWriterContext.h" +#include "primWriterRegistry.h" +#include "transformWriter.h" +#include "writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/stage.h" diff --git a/plugin/pxr/maya/lib/usdMaya/functorPrimWriter.h b/lib/fileio/functorPrimWriter.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/functorPrimWriter.h rename to lib/fileio/functorPrimWriter.h index 7aeb57525a..ce9c9745f5 100644 --- a/plugin/pxr/maya/lib/usdMaya/functorPrimWriter.h +++ b/lib/fileio/functorPrimWriter.h @@ -19,11 +19,11 @@ /// \file usdMaya/functorPrimWriter.h #include "pxr/pxr.h" -#include "usdMaya/transformWriter.h" +#include "transformWriter.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/writeJobContext.h" +#include "primWriter.h" +#include "primWriterRegistry.h" +#include "writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.cpp b/lib/fileio/instancedNodeWriter.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.cpp rename to lib/fileio/instancedNodeWriter.cpp index 32830a7077..27f72a4986 100644 --- a/plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.cpp +++ b/lib/fileio/instancedNodeWriter.cpp @@ -14,11 +14,11 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/instancedNodeWriter.h" +#include "instancedNodeWriter.h" -#include "usdMaya/primWriter.h" -#include -#include "usdMaya/writeJobContext.h" +#include "primWriter.h" +#include "../utils/util.h" +#include "writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/references.h" diff --git a/plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.h b/lib/fileio/instancedNodeWriter.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.h rename to lib/fileio/instancedNodeWriter.h index e42b43f339..58643277d9 100644 --- a/plugin/pxr/maya/lib/usdMaya/instancedNodeWriter.h +++ b/lib/fileio/instancedNodeWriter.h @@ -19,10 +19,10 @@ /// \file usdMaya/instancedNodeWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" +#include "primWriter.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../utils/util.h" +#include "writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/lib/usdMaya/jobArgs.cpp b/lib/fileio/jobs/jobArgs.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/jobArgs.cpp rename to lib/fileio/jobs/jobArgs.cpp index e84523a392..9465c3c207 100644 --- a/plugin/pxr/maya/lib/usdMaya/jobArgs.cpp +++ b/lib/fileio/jobs/jobArgs.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/jobArgs.h" +#include "jobArgs.h" -#include "usdMaya/registryHelper.h" -#include "usdMaya/shadingModeRegistry.h" +#include "../registryHelper.h" +#include "../shading/shadingModeRegistry.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/envSetting.h" diff --git a/plugin/pxr/maya/lib/usdMaya/jobArgs.h b/lib/fileio/jobs/jobArgs.h similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/jobArgs.h rename to lib/fileio/jobs/jobArgs.h index f50bbc3e33..f462418e55 100644 --- a/plugin/pxr/maya/lib/usdMaya/jobArgs.h +++ b/lib/fileio/jobs/jobArgs.h @@ -18,8 +18,8 @@ /// \file usdMaya/jobArgs.h -#include "usdMaya/api.h" -#include +#include "../../base/api.h" +#include "../../utils/util.h" #include "pxr/pxr.h" @@ -50,7 +50,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_PUBLIC_TOKENS( UsdMayaTranslatorTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_TRANSLATOR_TOKENS); #define PXRUSDMAYA_JOB_EXPORT_ARGS_TOKENS \ @@ -101,7 +101,7 @@ TF_DECLARE_PUBLIC_TOKENS( TF_DECLARE_PUBLIC_TOKENS( UsdMayaJobExportArgsTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_JOB_EXPORT_ARGS_TOKENS); #define PXRUSDMAYA_JOB_IMPORT_ARGS_TOKENS \ @@ -120,7 +120,7 @@ TF_DECLARE_PUBLIC_TOKENS( TF_DECLARE_PUBLIC_TOKENS( UsdMayaJobImportArgsTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_JOB_IMPORT_ARGS_TOKENS); @@ -200,20 +200,20 @@ struct UsdMayaJobExportArgs /// default dictionary. /// Issues runtime errors if \p dict contains values of the wrong type; /// types should match those declared in GetDefaultDictionary(). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdMayaJobExportArgs CreateFromDictionary( const VtDictionary& userArgs, const UsdMayaUtil::MDagPathSet& dagPaths, const std::vector& timeSamples = std::vector()); /// Gets the default arguments dictionary for UsdMayaJobExportArgs. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const VtDictionary& GetDefaultDictionary(); /// Adds type name to filter out during export. This will also add all /// inherited types (so if you exclude "constraint", it will also exclude /// "parentConstraint") - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void AddFilteredTypeName(const MString& typeName); const std::set& GetFilteredTypeIds() const { @@ -225,7 +225,7 @@ struct UsdMayaJobExportArgs } private: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaJobExportArgs( const VtDictionary& userArgs, const UsdMayaUtil::MDagPathSet& dagPaths, @@ -239,7 +239,7 @@ struct UsdMayaJobExportArgs std::set _filteredTypeIds; }; -PXRUSDMAYA_API +MAYAUSD_CORE_PUBLIC std::ostream& operator <<( std::ostream& out, const UsdMayaJobExportArgs& exportArgs); @@ -270,25 +270,25 @@ struct UsdMayaJobImportArgs /// default dictionary. /// Issues runtime errors if \p dict contains values of the wrong type; /// types should match those declared in GetDefaultDictionary(). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdMayaJobImportArgs CreateFromDictionary( const VtDictionary& userArgs, const bool importWithProxyShapes = false, const GfInterval& timeInterval = GfInterval::GetFullInterval()); /// Gets the default arguments dictionary for UsdMayaJobImportArgs. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const VtDictionary& GetDefaultDictionary(); private: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaJobImportArgs( const VtDictionary& userArgs, const bool importWithProxyShapes, const GfInterval& timeInterval); }; -PXRUSDMAYA_API +MAYAUSD_CORE_PUBLIC std::ostream& operator <<( std::ostream& out, const UsdMayaJobImportArgs& importArgs); diff --git a/plugin/pxr/maya/lib/usdMaya/modelKindProcessor.cpp b/lib/fileio/jobs/modelKindProcessor.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/modelKindProcessor.cpp rename to lib/fileio/jobs/modelKindProcessor.cpp index 803bf886fd..c4568ebfb0 100644 --- a/plugin/pxr/maya/lib/usdMaya/modelKindProcessor.cpp +++ b/lib/fileio/jobs/modelKindProcessor.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/modelKindProcessor.h" +#include "modelKindProcessor.h" #include "pxr/usd/kind/registry.h" #include "pxr/usd/usd/modelAPI.h" diff --git a/plugin/pxr/maya/lib/usdMaya/modelKindProcessor.h b/lib/fileio/jobs/modelKindProcessor.h similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/modelKindProcessor.h rename to lib/fileio/jobs/modelKindProcessor.h index e7e0b5cfac..654d0c1d24 100644 --- a/plugin/pxr/maya/lib/usdMaya/modelKindProcessor.h +++ b/lib/fileio/jobs/modelKindProcessor.h @@ -18,8 +18,8 @@ /// \file usdMaya/modelKindProcessor.h -#include "usdMaya/jobArgs.h" -#include "usdMaya/primWriter.h" +#include "jobArgs.h" +#include "../primWriter.h" #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/readJob.cpp b/lib/fileio/jobs/readJob.cpp similarity index 76% rename from plugin/pxr/maya/lib/usdMaya/readJob.cpp rename to lib/fileio/jobs/readJob.cpp index 3504267a70..3f26a245fe 100644 --- a/plugin/pxr/maya/lib/usdMaya/readJob.cpp +++ b/lib/fileio/jobs/readJob.cpp @@ -13,16 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/readJob.h" +#include "readJob.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/shadingModeRegistry.h" -#include -#include "usdMaya/stageNode.h" -#include "usdMaya/translatorMaterial.h" -#include "usdMaya/translatorModelAssembly.h" -#include "usdMaya/translatorXformable.h" -#include +#include "../primReaderRegistry.h" +#include "../../utils/stageCache.h" +#include "../../nodes/stageNode.h" +#include "../translators/translatorMaterial.h" +#include "../translators/translatorXformable.h" +#include "../../utils/util.h" #include "pxr/base/tf/token.h" @@ -60,14 +58,6 @@ PXR_NAMESPACE_OPEN_SCOPE - -// for now, we hard code this to use displayColor. But maybe the more -// appropriate thing to do is just to leave shadingMode a lone and pass -// "displayColor" in from the UsdMayaRepresentationFull -// (usdMaya/referenceAssembly.cpp) -const static TfToken ASSEMBLY_SHADING_MODE = UsdMayaShadingModeTokens->displayColor; - - UsdMaya_ReadJob::UsdMaya_ReadJob( const std::string &iFileName, const std::string &iPrimPath, @@ -75,8 +65,8 @@ UsdMaya_ReadJob::UsdMaya_ReadJob( const UsdMayaJobImportArgs &iArgs) : mArgs(iArgs), mFileName(iFileName), - mPrimPath(iPrimPath), mVariants(iVariants), + mPrimPath(iPrimPath), mDagModifierUndo(), mDagModifierSeeded(false), mMayaRootDagPath() @@ -176,7 +166,7 @@ UsdMaya_ReadJob::Read(std::vector* addedDagPaths) usdRootPrim = stage->GetPseudoRoot(); } - bool isImportingPsuedoRoot = (usdRootPrim == stage->GetPseudoRoot()); + bool isImportingPseudoRoot = (usdRootPrim == stage->GetPseudoRoot()); if (!usdRootPrim) { TF_RUNTIME_ERROR( @@ -194,19 +184,7 @@ UsdMaya_ReadJob::Read(std::vector* addedDagPaths) Usd_PrimFlagsPredicate predicate = UsdPrimDefaultPredicate; - const bool isSceneAssembly = mMayaRootDagPath.node().hasFn(MFn::kAssembly); - if (isSceneAssembly) { - mArgs.shadingMode = ASSEMBLY_SHADING_MODE; - - // When importing on behalf of a scene assembly, we want to make sure - // that we traverse down into instances. The expectation is that the - // user switched an assembly to its Expanded or Full representation - // because they want to see the hierarchy underneath it, possibly with - // the intention of making modifications down there. As a result, we - // don't really want to try to preserve instancing, but we do need to - // be able to access the scene description below the root prim. - predicate.TraverseInstanceProxies(true); - } + PreImport(predicate); UsdPrimRange range(usdRootPrim, predicate); if (range.empty()) { @@ -223,9 +201,7 @@ UsdMaya_ReadJob::Read(std::vector* addedDagPaths) // usdRootPrim's path. SdfPath rootPathToRegister = usdRootPrim.GetPath(); - if (isImportingPsuedoRoot || isSceneAssembly) { - // Skip the root prim if it is the pseudoroot, or if we are importing - // on behalf of a scene assembly. + if (SkipRootPrim(isImportingPseudoRoot)) { range.increment_begin(); } else { // Otherwise, associate the usdRootPrim's *parent* with the root Maya @@ -265,14 +241,10 @@ UsdMaya_ReadJob::Read(std::vector* addedDagPaths) CHECK_MSTATUS_AND_RETURN(status, false); } - if (mArgs.importWithProxyShapes) { - _DoImportWithProxies(range); - } else { - _DoImport(range, usdRootPrim); - } + DoImport(range, usdRootPrim); SdfPathSet topImportedPaths; - if (isImportingPsuedoRoot) { + if (isImportingPseudoRoot) { // get all the dag paths for the root prims TF_FOR_ALL(childIter, stage->GetPseudoRoot().GetChildren()) { topImportedPaths.insert(childIter->GetPath()); @@ -294,6 +266,22 @@ UsdMaya_ReadJob::Read(std::vector* addedDagPaths) return (status == MS::kSuccess); } +bool +UsdMaya_ReadJob::DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootPrim) +{ + return _DoImport(rootRange, usdRootPrim); +} + +bool UsdMaya_ReadJob::OverridePrimReader( + const UsdPrim& usdRootPrim, + const UsdPrim& prim, + const UsdMayaPrimReaderArgs& args, + UsdMayaPrimReaderContext& readCtx, + UsdPrimRange::iterator& primIt +) +{ + return false; +} bool UsdMaya_ReadJob::_DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootPrim) @@ -319,47 +307,8 @@ UsdMaya_ReadJob::_DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootPrim) UsdMayaPrimReaderArgs args(prim, mArgs); UsdMayaPrimReaderContext readCtx(&mNewNodeRegistry); - // If we are NOT importing on behalf of an assembly, then we'll - // create reference assembly nodes that target the asset file - // and the root prims of those assets directly. This ensures - // that a re-export will work correctly, since USD references - // can only target root prims. - std::string assetIdentifier; - SdfPath assetPrimPath; - if (UsdMayaTranslatorModelAssembly::ShouldImportAsAssembly( - usdRootPrim, - prim, - &assetIdentifier, - &assetPrimPath)) { - const bool isSceneAssembly = - mMayaRootDagPath.node().hasFn(MFn::kAssembly); - if (isSceneAssembly) { - // If we ARE importing on behalf of an assembly, we use - // the file path of the top-level assembly and the path - // to the prim within that file when creating the - // reference assembly. - assetIdentifier = mFileName; - assetPrimPath = prim.GetPath(); - } - - // Note that if assemblyRep == "Import", the assembly reader - // will NOT run and we will fall through to the prim reader - // below. - MObject parentNode = readCtx.GetMayaNode( - prim.GetPath().GetParentPath(), false); - if (UsdMayaTranslatorModelAssembly::Read( - prim, - assetIdentifier, - assetPrimPath, - parentNode, - args, - &readCtx, - mArgs.assemblyRep)) { - if (readCtx.GetPruneChildren()) { - primIt.PruneChildren(); - } - continue; - } + if (OverridePrimReader(usdRootPrim, prim, args, readCtx, primIt)) { + continue; } TfToken typeName = prim.GetTypeName(); @@ -392,6 +341,14 @@ UsdMaya_ReadJob::_DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootPrim) return true; } +void UsdMaya_ReadJob::PreImport(Usd_PrimFlagsPredicate& returnPredicate) +{} + +bool UsdMaya_ReadJob::SkipRootPrim(bool isImportingPseudoRoot) +{ + return isImportingPseudoRoot; +} + bool UsdMaya_ReadJob::Redo() { @@ -439,5 +396,10 @@ UsdMaya_ReadJob::SetMayaRootDagPath(const MDagPath &mayaRootDagPath) mMayaRootDagPath = mayaRootDagPath; } +const MDagPath& +UsdMaya_ReadJob::GetMayaRootDagPath() const +{ + return mMayaRootDagPath; +} PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/readJob.h b/lib/fileio/jobs/readJob.h similarity index 58% rename from plugin/pxr/maya/lib/usdMaya/readJob.h rename to lib/fileio/jobs/readJob.h index 2dec9903c0..cf24a6223b 100644 --- a/plugin/pxr/maya/lib/usdMaya/readJob.h +++ b/lib/fileio/jobs/readJob.h @@ -18,8 +18,8 @@ /// \file usdMaya/readJob.h -#include "usdMaya/jobArgs.h" -#include "usdMaya/primReaderContext.h" +#include "jobArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -35,61 +35,86 @@ PXR_NAMESPACE_OPEN_SCOPE - +class UsdMayaPrimReaderArgs; class UsdMaya_ReadJob { public: + MAYAUSD_CORE_PUBLIC UsdMaya_ReadJob( const std::string& iFileName, const std::string& iPrimPath, const std::map& iVariants, const UsdMayaJobImportArgs & iArgs); - ~UsdMaya_ReadJob(); + MAYAUSD_CORE_PUBLIC + virtual ~UsdMaya_ReadJob(); /// Reads the USD stage specified by the job file name and prim path. /// Newly-created DAG paths are inserted into the vector \p addedDagPaths. + MAYAUSD_CORE_PUBLIC bool Read(std::vector* addedDagPaths); /// Redoes a previous Read() operation after Undo() has been called. /// If Undo() hasn't been called, does nothing. + MAYAUSD_CORE_PUBLIC bool Redo(); /// Undoes a previous Read() operation, removing all added nodes. + MAYAUSD_CORE_PUBLIC bool Undo(); // Getters/Setters + MAYAUSD_CORE_PUBLIC void SetMayaRootDagPath(const MDagPath &mayaRootDagPath); - -private: - // XXX: Activating the 'Expanded' representation of a USD reference - // assembly node is very much like performing a regular UsdMaya_ReadJob but with - // a few key differences (e.g. creating proxy shapes at collapse points). - // These private helper methods cover the functionality of a regular - // usdImport, and an 'Expanded' representation-style import, respectively. - // It would be great if we could combine these into a single traversal at - // some point. + MAYAUSD_CORE_PUBLIC + const MDagPath& GetMayaRootDagPath() const; + +protected: + + MAYAUSD_CORE_PUBLIC + virtual bool DoImport(UsdPrimRange& range, const UsdPrim& usdRootPrim); + + // Hook for derived classes to override the prim reader. Returns true if + // override was done, false otherwise. Implementation in this class + // returns false. + MAYAUSD_CORE_PUBLIC + virtual bool OverridePrimReader( + const UsdPrim& usdRootPrim, + const UsdPrim& prim, + const UsdMayaPrimReaderArgs& args, + UsdMayaPrimReaderContext& readCtx, + UsdPrimRange::iterator& primIt + ); + + // Engine method for DoImport(). Covers the functionality of a regular + // usdImport. + MAYAUSD_CORE_PUBLIC bool _DoImport(UsdPrimRange& range, const UsdPrim& usdRootPrim); - bool _DoImportWithProxies(UsdPrimRange& range); - // These are helper methods for the proxy import method. - bool _ProcessProxyPrims( - const std::vector& proxyPrims, - const UsdPrim& pxrGeomRoot, - const std::vector& collapsePointPathStrings); - bool _ProcessSubAssemblyPrims(const std::vector& subAssemblyPrims); - bool _ProcessCameraPrims(const std::vector& cameraPrims); + // Hook for derived classes to perform processing before import. + // Method in this class is a no-op. + MAYAUSD_CORE_PUBLIC + virtual void PreImport(Usd_PrimFlagsPredicate& returnPredicate); + + // Hook for derived classes to determine whether to skip the root prim + // on prim traversal. This class returns the argument unchanged. + MAYAUSD_CORE_PUBLIC + virtual bool SkipRootPrim(bool isImportingPseudoRoot); // Data UsdMayaJobImportArgs mArgs; std::string mFileName; - std::string mPrimPath; std::map mVariants; - MDagModifier mDagModifierUndo; - bool mDagModifierSeeded; UsdMayaPrimReaderContext::ObjectRegistry mNewNodeRegistry; MDagPath mMayaRootDagPath; + +private: + + // Data + std::string mPrimPath; + MDagModifier mDagModifierUndo; + bool mDagModifierSeeded; }; diff --git a/plugin/pxr/maya/lib/usdMaya/writeJob.cpp b/lib/fileio/jobs/writeJob.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/writeJob.cpp rename to lib/fileio/jobs/writeJob.cpp index 1181bf9dbb..82cdb407e2 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeJob.cpp +++ b/lib/fileio/jobs/writeJob.cpp @@ -14,19 +14,19 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/writeJob.h" - -#include "usdMaya/jobArgs.h" -#include "usdMaya/modelKindProcessor.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/transformWriter.h" -#include "usdMaya/translatorMaterial.h" -#include - -#include "usdMaya/chaser.h" -#include "usdMaya/chaserRegistry.h" +#include "writeJob.h" + +#include "jobArgs.h" +#include "modelKindProcessor.h" +#include "../primWriter.h" +#include "../primWriterRegistry.h" +#include "../shading/shadingModeExporterContext.h" +#include "../transformWriter.h" +#include "../translators/translatorMaterial.h" +#include "../../utils/util.h" + +#include "../chaser/chaser.h" +#include "../chaser/chaserRegistry.h" #include "pxr/base/tf/fileUtils.h" #include "pxr/base/tf/hash.h" diff --git a/plugin/pxr/maya/lib/usdMaya/writeJob.h b/lib/fileio/jobs/writeJob.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/writeJob.h rename to lib/fileio/jobs/writeJob.h index b8399267de..0d3583a0de 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeJob.h +++ b/lib/fileio/jobs/writeJob.h @@ -18,9 +18,11 @@ /// \file usdMaya/writeJob.h -#include "usdMaya/chaser.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../base/api.h" + +#include "../chaser/chaser.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/pxr.h" @@ -37,8 +39,10 @@ class UsdMaya_ModelKindProcessor; class UsdMaya_WriteJob { public: + MAYAUSD_CORE_PUBLIC UsdMaya_WriteJob(const UsdMayaJobExportArgs & iArgs); + MAYAUSD_CORE_PUBLIC ~UsdMaya_WriteJob(); /// Writes the Maya stage to the given USD file name, If \p append is @@ -46,6 +50,7 @@ class UsdMaya_WriteJob /// file. /// This will write the entire frame range specified by the export args. /// Returns \c true if successful, or \c false if an error was encountered. + MAYAUSD_CORE_PUBLIC bool Write(const std::string& fileName, bool append); private: diff --git a/plugin/pxr/maya/lib/usdMaya/primReader.cpp b/lib/fileio/primReader.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/primReader.cpp rename to lib/fileio/primReader.cpp index 20358da92a..107ae54c62 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReader.cpp +++ b/lib/fileio/primReader.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primReader.h" +#include "primReader.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/primReader.h b/lib/fileio/primReader.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/primReader.h rename to lib/fileio/primReader.h index 57f92e9c81..0b9f2a6ec8 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReader.h +++ b/lib/fileio/primReader.h @@ -18,9 +18,9 @@ /// \file usdMaya/primReader.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../base/api.h" +#include "primReaderArgs.h" +#include "primReaderContext.h" #include "pxr/pxr.h" @@ -29,7 +29,7 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaPrimReader { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimReader(const UsdMayaPrimReaderArgs&); virtual ~UsdMayaPrimReader() {}; @@ -37,11 +37,11 @@ class UsdMayaPrimReader /// modifying the prim reader context as a result. /// Callers must ensure \p context is non-null. /// Returns true if successful. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool Read(UsdMayaPrimReaderContext* context) = 0; /// Whether this prim reader specifies a PostReadSubtree step. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool HasPostReadSubtree() const; /// An additional import step that runs after all descendants of this prim @@ -51,12 +51,12 @@ class UsdMayaPrimReader /// are run in the order: /// (1) Read A (2) Read B (3) PostReadSubtree B (4) PostReadSubtree A, /// (5) Read C (6) PostReadSubtree C - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void PostReadSubtree(UsdMayaPrimReaderContext* context); protected: /// Input arguments. Read data about the input USD prim from here. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdMayaPrimReaderArgs& _GetArgs(); private: diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderArgs.cpp b/lib/fileio/primReaderArgs.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/primReaderArgs.cpp rename to lib/fileio/primReaderArgs.cpp index ef0cd1e2b1..9206c6fb43 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderArgs.cpp +++ b/lib/fileio/primReaderArgs.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primReaderArgs.h" +#include "primReaderArgs.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderArgs.h b/lib/fileio/primReaderArgs.h similarity index 88% rename from plugin/pxr/maya/lib/usdMaya/primReaderArgs.h rename to lib/fileio/primReaderArgs.h index 1d0b2d51ee..415be098cc 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderArgs.h +++ b/lib/fileio/primReaderArgs.h @@ -18,8 +18,8 @@ /// \file usdMaya/primReaderArgs.h -#include "usdMaya/api.h" -#include "usdMaya/jobArgs.h" +#include "../base/api.h" +#include "jobs/jobArgs.h" #include "pxr/pxr.h" @@ -38,33 +38,33 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaPrimReaderArgs { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimReaderArgs( const UsdPrim& prim, const UsdMayaJobImportArgs& jobArgs); /// \brief return the usd prim that should be read. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdPrim& GetUsdPrim() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const TfToken& GetShadingMode() const; /// Returns the time interval over which to import animated data. /// An empty interval (GfInterval::IsEmpty()) means that no /// animated (time-sampled) data should be imported. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC GfInterval GetTimeInterval() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const TfToken::Set& GetIncludeMetadataKeys() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const TfToken::Set& GetIncludeAPINames() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const TfToken::Set& GetExcludePrimvarNames() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetUseAsAnimationCache() const; bool ShouldImportUnboundShaders() const { diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderContext.cpp b/lib/fileio/primReaderContext.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/primReaderContext.cpp rename to lib/fileio/primReaderContext.cpp index b2ee08e1f8..679661501f 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderContext.cpp +++ b/lib/fileio/primReaderContext.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primReaderContext.h" +#include "primReaderContext.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderContext.h b/lib/fileio/primReaderContext.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/primReaderContext.h rename to lib/fileio/primReaderContext.h index 690a392354..76364c16fa 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderContext.h +++ b/lib/fileio/primReaderContext.h @@ -18,7 +18,7 @@ /// \file usdMaya/primReaderContext.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" @@ -45,7 +45,7 @@ class UsdMayaPrimReaderContext public: typedef std::map ObjectRegistry; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimReaderContext(ObjectRegistry* pathNodeMap); /// \brief Returns the prim was registered at \p path. If \p findAncestors @@ -53,7 +53,7 @@ class UsdMayaPrimReaderContext /// that corresponding to its nearest ancestor. /// /// Returns an invalid MObject if no such object exists. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject GetMayaNode( const SdfPath& path, bool findAncestors) const; @@ -66,17 +66,17 @@ class UsdMayaPrimReaderContext /// - undo/redo purposes /// /// Plugins should call this as needed. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void RegisterNewMayaNode(const std::string &path, const MObject &mayaNode) const; /// \brief returns true if prim traversal of the children of the current /// node can be pruned. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetPruneChildren() const; /// \brief If this plugin takes care of reading all of its children, it /// should SetPruneChildren(true). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetPruneChildren(bool prune); ~UsdMayaPrimReaderContext() { } diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderRegistry.cpp b/lib/fileio/primReaderRegistry.cpp similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/primReaderRegistry.cpp rename to lib/fileio/primReaderRegistry.cpp index 343591e2f1..d259426ca9 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderRegistry.cpp +++ b/lib/fileio/primReaderRegistry.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primReaderRegistry.h" +#include "primReaderRegistry.h" -#include -#include "usdMaya/fallbackPrimReader.h" -#include "usdMaya/functorPrimReader.h" -#include "usdMaya/registryHelper.h" +#include "../base/debugCodes.h" +#include "fallbackPrimReader.h" +#include "functorPrimReader.h" +#include "registryHelper.h" #include "pxr/base/plug/registry.h" #include "pxr/base/tf/registryManager.h" diff --git a/plugin/pxr/maya/lib/usdMaya/primReaderRegistry.h b/lib/fileio/primReaderRegistry.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/primReaderRegistry.h rename to lib/fileio/primReaderRegistry.h index c1509b92f7..fd7b556c2e 100644 --- a/plugin/pxr/maya/lib/usdMaya/primReaderRegistry.h +++ b/lib/fileio/primReaderRegistry.h @@ -18,10 +18,10 @@ /// \file usdMaya/primReaderRegistry.h -#include "usdMaya/api.h" -#include "usdMaya/primReader.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../base/api.h" +#include "primReader.h" +#include "primReaderArgs.h" +#include "primReaderContext.h" #include "pxr/pxr.h" @@ -66,7 +66,7 @@ struct UsdMayaPrimReaderRegistry UsdMayaPrimReaderContext*) > ReaderFn; /// \brief Register \p fn as a reader provider for \p type. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Register(const TfType& type, ReaderFactoryFn fn); /// \brief Register \p fn as a reader provider for \p T. @@ -98,7 +98,7 @@ struct UsdMayaPrimReaderRegistry /// function as a reader provider for \p T. /// This is a helper method for the macro PXRUSDMAYA_DEFINE_READER; /// you probably want to use PXRUSDMAYA_DEFINE_READER directly instead. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void RegisterRaw(const TfType& type, ReaderFn fn); /// \brief Wraps \p fn in a ReaderFactoryFn and registers that factory @@ -124,14 +124,14 @@ struct UsdMayaPrimReaderRegistry /// \code /// prim.GetTypeName() /// \endcode - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static ReaderFactoryFn Find( const TfToken& usdTypeName); /// Similar to Find(), but returns a "fallback" prim reader factory if none /// can be found for \p usdTypeName. Thus, this always returns a valid /// reader factory. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static ReaderFactoryFn FindOrFallback(const TfToken& usdTypeName); }; diff --git a/lib/fileio/primUpdater.cpp b/lib/fileio/primUpdater.cpp new file mode 100644 index 0000000000..4208bfcce5 --- /dev/null +++ b/lib/fileio/primUpdater.cpp @@ -0,0 +1,109 @@ +// +// Copyright 2018 Pixar +// +// 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. +// +#include "primUpdater.h" + +#include +#include +#include + +PXR_NAMESPACE_OPEN_SCOPE + +static +MDagPath +_GetDagPath(const MFnDependencyNode& depNodeFn, const bool reportError = true) +{ + try { + const MFnDagNode& dagNodeFn = + dynamic_cast(depNodeFn); + + MStatus status; + const MDagPath dagPath = dagNodeFn.dagPath(&status); + if (status == MS::kSuccess) { + const bool dagPathIsValid = dagPath.isValid(&status); + if (status == MS::kSuccess && dagPathIsValid) { + return dagPath; + } + } + + if (reportError) { + TF_CODING_ERROR( + "Invalid MDagPath for MFnDagNode '%s'. Verify that it was " + "constructed using an MDagPath.", + dagNodeFn.fullPathName().asChar()); + } + } + catch (const std::bad_cast& /* e */) { + // This is not a DAG node, so it can't have a DAG path. + } + + return MDagPath(); +} + +static +UsdMayaUtil::MDagPathMap +_GetDagPathMap(const MFnDependencyNode& depNodeFn, const SdfPath& usdPath) +{ + const MDagPath dagPath = _GetDagPath(depNodeFn, /* reportError = */ false); + if (dagPath.isValid()) { + return UsdMayaUtil::MDagPathMap({ {dagPath, usdPath} }); + } + + return UsdMayaUtil::MDagPathMap({}); +} + +UsdMayaPrimUpdater::UsdMayaPrimUpdater( + const MFnDependencyNode& depNodeFn, + const SdfPath& usdPath) : + _dagPath(_GetDagPath(depNodeFn)), + _mayaObject(depNodeFn.object()), + _usdPath(usdPath), + _baseDagToUsdPaths(_GetDagPathMap(depNodeFn, usdPath)) +{ +} + +bool UsdMayaPrimUpdater::Push(UsdMayaPrimUpdaterContext* context) +{ + return false; +} + +bool UsdMayaPrimUpdater::Pull(UsdMayaPrimUpdaterContext* context) +{ + return false; +} + +void UsdMayaPrimUpdater::Clear(UsdMayaPrimUpdaterContext* context) +{ +} + +const MDagPath& +UsdMayaPrimUpdater::GetDagPath() const +{ + return _dagPath; +} + +const MObject& +UsdMayaPrimUpdater::GetMayaObject() const +{ + return _mayaObject; +} + +const SdfPath& +UsdMayaPrimUpdater::GetUsdPath() const +{ + return _usdPath; +} + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/fileio/primUpdater.h b/lib/fileio/primUpdater.h new file mode 100644 index 0000000000..f3688aeb10 --- /dev/null +++ b/lib/fileio/primUpdater.h @@ -0,0 +1,129 @@ +// +// Copyright 2018 Pixar +// +// 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. +// +#ifndef PXRUSDMAYA_MAYAPRIMUPDATER_H +#define PXRUSDMAYA_MAYAPRIMUPDATER_H + +/// \file usdMaya/primUpdater.h + +#include "../base/api.h" +#include "primUpdaterContext.h" +#include "../utils/util.h" + +#include "pxr/pxr.h" +#include "pxr/usd/sdf/path.h" + +#include +#include +#include + +PXR_NAMESPACE_OPEN_SCOPE + +class UsdMayaPrimUpdater +{ +public: + MAYAUSD_CORE_PUBLIC + UsdMayaPrimUpdater(const MFnDependencyNode& depNodeFn, + const SdfPath& usdPath); + + UsdMayaPrimUpdater() = default; + virtual ~UsdMayaPrimUpdater() = default; + + MAYAUSD_CORE_PUBLIC + enum class Supports { Invalid = 0, Push = 1 << 0, Pull = 1 << 1, Clear = 1 << 2, All = Push | Pull | Clear}; + + MAYAUSD_CORE_PUBLIC + virtual bool Push(UsdMayaPrimUpdaterContext* context); + + MAYAUSD_CORE_PUBLIC + virtual bool Pull(UsdMayaPrimUpdaterContext* context); + + MAYAUSD_CORE_PUBLIC + virtual void Clear(UsdMayaPrimUpdaterContext* context); + + /// The source Maya DAG path that we are consuming. + /// + /// If this prim writer is for a Maya DG node and not a DAG node, this will + /// return an invalid MDagPath. + MAYAUSD_CORE_PUBLIC + const MDagPath& GetDagPath() const; + + /// The MObject for the Maya node being written by this writer. + MAYAUSD_CORE_PUBLIC + const MObject& GetMayaObject() const; + + /// The path of the destination USD prim to which we are writing. + MAYAUSD_CORE_PUBLIC + const SdfPath& GetUsdPath() const; + + /// The destination USD prim to which we are writing. + template + UsdPrim GetUsdPrim(UsdMayaPrimUpdaterContext& context) const + { + UsdPrim usdPrim; + + if (!TF_VERIFY(GetDagPath().isValid())) { + return usdPrim; + } + + T primSchema = + T::Define(context.GetUsdStage(), GetUsdPath()); + if (!TF_VERIFY( + primSchema, + "Could not define given updater type at path '%s'\n", + GetUsdPath().GetText())) { + return usdPrim; + } + usdPrim = primSchema.GetPrim(); + if (!TF_VERIFY( + usdPrim, + "Could not get UsdPrim for given updater type at path '%s'\n", + primSchema.GetPath().GetText())) { + return usdPrim; + } + + return usdPrim; + } + +private: + /// The MDagPath for the Maya node being written, valid only for DAG node + /// prim writers. + const MDagPath _dagPath; + + /// The MObject for the Maya node being written, valid for both DAG and DG + /// node prim writers. + const MObject _mayaObject; + + const SdfPath _usdPath; + const UsdMayaUtil::MDagPathMap _baseDagToUsdPaths; + +}; + +using UsdMayaPrimUpdaterSharedPtr = std::shared_ptr; + +inline UsdMayaPrimUpdater::Supports operator|(UsdMayaPrimUpdater::Supports a, UsdMayaPrimUpdater::Supports b) +{ + return static_cast(static_cast(a) | static_cast(b)); +} + +inline UsdMayaPrimUpdater::Supports operator&(UsdMayaPrimUpdater::Supports a, UsdMayaPrimUpdater::Supports b) +{ + return static_cast(static_cast(a) & static_cast(b)); +} + + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/lib/fileio/primUpdaterContext.cpp b/lib/fileio/primUpdaterContext.cpp new file mode 100644 index 0000000000..682f77c574 --- /dev/null +++ b/lib/fileio/primUpdaterContext.cpp @@ -0,0 +1,46 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include "primUpdaterContext.h" + +PXR_NAMESPACE_OPEN_SCOPE + +UsdMayaPrimUpdaterContext::UsdMayaPrimUpdaterContext( + const UsdTimeCode& timeCode, + const UsdStageRefPtr& stage) : + _timeCode(timeCode), + _stage(stage) +{ +} + +const UsdTimeCode& +UsdMayaPrimUpdaterContext::GetTimeCode() const +{ + return _timeCode; +} + +UsdStageRefPtr +UsdMayaPrimUpdaterContext::GetUsdStage() const +{ + return _stage; +} + +void +UsdMayaPrimUpdaterContext::Clear(const SdfPath&) +{ +} + +PXR_NAMESPACE_CLOSE_SCOPE + diff --git a/lib/fileio/primUpdaterContext.h b/lib/fileio/primUpdaterContext.h new file mode 100644 index 0000000000..804076f9a5 --- /dev/null +++ b/lib/fileio/primUpdaterContext.h @@ -0,0 +1,62 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#ifndef PXRUSDMAYA_PRIMUPDATERCONTEXT_H +#define PXRUSDMAYA_PRIMUPDATERCONTEXT_H + +/// \file usdMaya/primUpdaterContext.h + +#include "../base/api.h" + +#include "pxr/pxr.h" + +#include "pxr/usd/usd/stage.h" +#include "pxr/usd/usd/timeCode.h" + +PXR_NAMESPACE_OPEN_SCOPE + + +/// \class UsdMayaPrimUpdaterContext +/// \brief This class provides an interface for updater plugins to communicate +/// state back to the core usd maya logic. +class UsdMayaPrimUpdaterContext +{ +public: + MAYAUSD_CORE_PUBLIC + UsdMayaPrimUpdaterContext( + const UsdTimeCode& timeCode, + const UsdStageRefPtr& stage); + + /// \brief returns the time frame where data should be edited. + MAYAUSD_CORE_PUBLIC + const UsdTimeCode& GetTimeCode() const; + + /// \brief returns the usd stage that is being written to. + MAYAUSD_CORE_PUBLIC + UsdStageRefPtr GetUsdStage() const; + + MAYAUSD_CORE_PUBLIC + virtual void Clear(const SdfPath&); + +private: + const UsdTimeCode& _timeCode; + UsdStageRefPtr _stage; +}; + + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif + diff --git a/lib/fileio/primUpdaterRegistry.cpp b/lib/fileio/primUpdaterRegistry.cpp new file mode 100644 index 0000000000..866bc59df2 --- /dev/null +++ b/lib/fileio/primUpdaterRegistry.cpp @@ -0,0 +1,110 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include "pxr/pxr.h" +#include "primUpdaterRegistry.h" + +#include "../base/debugCodes.h" +#include "registryHelper.h" + +#include "pxr/base/plug/registry.h" +#include "pxr/base/tf/debug.h" +#include "pxr/base/tf/diagnostic.h" +#include "pxr/base/tf/registryManager.h" +#include "pxr/base/tf/staticTokens.h" +#include "pxr/base/tf/stl.h" +#include "pxr/base/tf/token.h" + +#include "pxr/usd/usd/schemaBase.h" + +#include +#include +#include + + +PXR_NAMESPACE_OPEN_SCOPE + + +TF_DEFINE_PRIVATE_TOKENS(_tokens, + (UsdMaya) + (PrimUpdater) +); + +typedef std::map _Registry; +static _Registry _reg; + + +/* static */ +void +UsdMayaPrimUpdaterRegistry::Register( + const TfType& t, + UsdMayaPrimUpdater::Supports sup, + UsdMayaPrimUpdaterRegistry::UpdaterFactoryFn fn) +{ + TfToken tfTypeName(t.GetTypeName()); + + TF_DEBUG(PXRUSDMAYA_REGISTRY).Msg( + "Registering UsdMayaPrimWriter for TfType type %s.\n", + tfTypeName.GetText()); + + std::pair< _Registry::iterator, bool> insertStatus = + _reg.insert(std::make_pair(tfTypeName, std::make_tuple(sup,fn))); + if (insertStatus.second) { + UsdMaya_RegistryHelper::AddUnloader([tfTypeName]() { + _reg.erase(tfTypeName); + }); + } + else { + TF_CODING_ERROR("Multiple updaters for TfType %s", tfTypeName.GetText()); + } +} + +/* static */ +UsdMayaPrimUpdaterRegistry::RegisterItem +UsdMayaPrimUpdaterRegistry::Find(const TfToken& usdTypeName) +{ + TfRegistryManager::GetInstance().SubscribeTo(); + + // unfortunately, usdTypeName is diff from the tfTypeName which we use to + // register. do the conversion here. + TfType tfType = PlugRegistry::FindDerivedTypeByName(usdTypeName); + std::string typeNameStr = tfType.GetTypeName(); + TfToken typeName(typeNameStr); + + RegisterItem ret; + if (TfMapLookup(_reg, typeName, &ret)) { + return ret; + } + + static const TfTokenVector SCOPE = { + _tokens->UsdMaya, + _tokens->PrimUpdater + }; + UsdMaya_RegistryHelper::FindAndLoadMayaPlug(SCOPE, typeNameStr); + + // ideally something just registered itself. if not, we at least put it in + // the registry in case we encounter it again. + if (!TfMapLookup(_reg, typeName, &ret)) { + TF_DEBUG(PXRUSDMAYA_REGISTRY).Msg( + "No usdMaya updater plugin for TfType %s. No maya plugin found.\n", + typeName.GetText()); + _reg[typeName] = {}; + } + + return ret; +} + + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/fileio/primUpdaterRegistry.h b/lib/fileio/primUpdaterRegistry.h new file mode 100644 index 0000000000..8b9074f0fa --- /dev/null +++ b/lib/fileio/primUpdaterRegistry.h @@ -0,0 +1,168 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#ifndef PXRUSDMAYA_PRIM_UPDATER_REGISTRY_H +#define PXRUSDMAYA_PRIM_UPDATER_REGISTRY_H + +/// \file usdMaya/primUpdaterRegistry.h + +#include "pxr/pxr.h" +#include "../base/api.h" + +#include "primUpdater.h" +#include "primUpdaterContext.h" + +#include "pxr/usd/sdf/path.h" + +#include + +#include +#include + + +PXR_NAMESPACE_OPEN_SCOPE + + +/// \class UsdMayaPrimUpdaterRegistry +/// \brief Provides functionality to register and lookup USD updater plugins +/// for Maya nodes. +/// +/// Use PXRUSDMAYA_REGISTER_UPDATER(mayaTypeName, updaterClass) to register a updater +/// class with the registry. +/// +/// The plugin is expected to update a prim at ctx->GetAuthorPath(). +/// +/// In order for the core system to discover the plugin, you need a +/// \c plugInfo.json that contains the Maya type name and the Maya plugin to +/// load: +/// \code +/// { +/// "UsdMaya": { +/// "PrimUpdater": { +/// "mayaPlugin": "myMayaPlugin", +/// "providesTranslator": [ +/// "MyUsdType" +/// ] +/// } +/// } +/// } +/// \endcode +/// +/// The registry contains information for both Maya built-in node types +/// and for any user-defined plugin types. If UsdMaya does not ship with a +/// updater plugin for some Maya built-in type, you can register your own +/// plugin for that Maya built-in type. +struct UsdMayaPrimUpdaterRegistry +{ + /// Updater factory function, i.e. a function that creates a prim updater + /// for the given Maya node/USD paths and context. + using UpdaterFactoryFn = std::function< UsdMayaPrimUpdaterSharedPtr ( + const MFnDependencyNode&, + const SdfPath&) >; + + using RegisterItem = std::tuple; + + /// \brief Register \p fn as a factory function providing a + /// UsdMayaPrimUpdater subclass that can be used to update \p mayaType. + /// If you can't provide a valid UsdMayaPrimUpdater for the given arguments, + /// return a null pointer from the factory function \p fn. + /// + /// Example for registering a updater factory in your custom plugin: + /// \code{.cpp} + /// class MyUpdater : public UsdMayaPrimUpdater { + /// static UsdMayaPrimUpdaterSharedPtr Create( + /// const MFnDependencyNode& depNodeFn, + /// const SdfPath& usdPath); + /// }; + /// TF_REGISTRY_FUNCTION_WITH_TAG(UsdMayaPrimUpdaterRegistry, MyUpdater) { + /// UsdMayaPrimUpdaterRegistry::Register(UsdMayaPrimUpdater::Supports, + /// MyUpdater::Create); + /// } + /// \endcode + MAYAUSD_CORE_PUBLIC + static void Register(const TfType& type, UsdMayaPrimUpdater::Supports sup, UpdaterFactoryFn fn); + + /// \brief Register \p fn as a reader provider for \p T. +/// +/// Example for registering a reader factory in your custom plugin, assuming +/// that MyType is registered with the TfType system: +/// \code{.cpp} +/// class MyReader : public UsdMayaPrimUpdater { +/// static UsdMayaPrimReaderSharedPtr Create( +/// const UsdMayaPrimReaderArgs&); +/// }; +/// TF_REGISTRY_FUNCTION_WITH_TAG(UsdMayaPrimUpdaterRegistry, MyType) { +/// UsdMayaPrimUpdaterRegistry::Register(MyReader::Create); +/// } +/// \endcode + template + static void Register(UsdMayaPrimUpdater::Supports sup, UpdaterFactoryFn fn) + { + if (TfType t = TfType::Find()) { + Register(t, sup, fn); + } + else { + TF_CODING_ERROR("Cannot register unknown TfType: %s.", + ArchGetDemangled().c_str()); + } + } + + // takes a usdType (i.e. prim.GetTypeName()) + /// \brief Finds a updater factory if one exists for \p usdTypeName. + /// + /// \p usdTypeName should be a usd typeName, for example, + /// \code + /// prim.GetTypeName() + /// \endcode + MAYAUSD_CORE_PUBLIC + static RegisterItem Find(const TfToken& usdTypeName); +}; + +/// \brief Registers a pre-existing updater class for the given Maya type; +/// the updater class should be a subclass of UsdMayaPrimUpdater with a three-place +/// constructor that takes (const MFnDependencyNode& depNodeFn, +/// const SdfPath& usdPath, UsdMayaWriteJobContext& jobCtx) as arguments. +/// +/// Example: +/// \code{.cpp} +/// class MyUpdater : public UsdMayaPrimUpdater { +/// MyUpdater( +/// const MFnDependencyNode& depNodeFn, +/// const SdfPath& usdPath, +/// UsdMayaPrimUpdater::Supports sup) { +/// // ... +/// } +/// }; +/// PXRUSDMAYA_REGISTER_UPDATER(myUsdTypeName, MyUpdater); +/// \endcode +#define PXRUSDMAYA_REGISTER_UPDATER(usdTypeName, updaterClass, supports) \ +TF_REGISTRY_FUNCTION_WITH_TAG( \ + UsdMayaPrimUpdaterRegistry, \ + usdTypeName##_##updaterClass) \ +{ \ + UsdMayaPrimUpdaterRegistry::Register( \ + supports, \ + []( \ + const MFnDependencyNode& depNodeFn, \ + const SdfPath& usdPath) { \ + return std::make_shared(depNodeFn, usdPath); \ + }); \ +} + + +PXR_NAMESPACE_CLOSE_SCOPE + + +#endif diff --git a/plugin/pxr/maya/lib/usdMaya/primWriter.cpp b/lib/fileio/primWriter.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/primWriter.cpp rename to lib/fileio/primWriter.cpp index 818855db96..4d03253d37 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriter.cpp +++ b/lib/fileio/primWriter.cpp @@ -14,14 +14,14 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" - -#include "usdMaya/adaptor.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/translatorGprim.h" -#include -#include "usdMaya/writeJobContext.h" -#include "usdMaya/writeUtil.h" +#include "primWriter.h" + +#include "utils/adaptor.h" +#include "jobs/jobArgs.h" +#include "translators/translatorGprim.h" +#include "../utils//util.h" +#include "writeJobContext.h" +#include "utils/writeUtil.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/primWriter.h b/lib/fileio/primWriter.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/primWriter.h rename to lib/fileio/primWriter.h index 8fdc9ba893..85949468b9 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriter.h +++ b/lib/fileio/primWriter.h @@ -19,10 +19,10 @@ /// \file usdMaya/primWriter.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../base/api.h" -#include "usdMaya/jobArgs.h" -#include +#include "jobs/jobArgs.h" +#include "../utils/util.h" #include "pxr/base/vt/value.h" #include "pxr/usd/sdf/path.h" @@ -63,13 +63,13 @@ class UsdMayaPrimWriter /// an MDagPath to ensure that instancing is handled correctly. An error /// will be issued if the constructor receives an MFnDagNode *not* /// constructed with an MDagPath. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimWriter( const MFnDependencyNode& depNodeFn, const SdfPath& usdPath, UsdMayaWriteJobContext& jobCtx); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual ~UsdMayaPrimWriter(); /// Main export function that runs when the traversal hits the node. @@ -77,13 +77,13 @@ class UsdMayaPrimWriter /// and UsdGeomGprim schemas if the prim conforms to one or both; in most /// cases, subclasses will want to invoke the base class Write() method /// when overriding. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void Write(const UsdTimeCode& usdTime); /// Post export function that runs before saving the stage. /// /// Base implementation does nothing. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void PostExport(); /// Whether this prim writer directly create one or more gprims on the @@ -93,7 +93,7 @@ class UsdMayaPrimWriter /// /// Base implementation returns \c false; prim writers exporting /// gprim (shape) classes should override. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool ExportsGprims() const; /// Whether the traversal routine using this prim writer should skip all of @@ -104,18 +104,18 @@ class UsdMayaPrimWriter /// /// Base implementation returns \c false; prim writers that handle export /// for their entire subtree should override. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool ShouldPruneChildren() const; /// Whether visibility can be exported for this prim. /// By default, this is based off of the export visibility setting in the /// export args. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetExportVisibility() const; /// Sets whether visibility can be exported for this prim. /// This will override the export args. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetExportVisibility(const bool exportVis); /// Gets all of the exported prim paths that are potentially models, i.e. @@ -126,7 +126,7 @@ class UsdMayaPrimWriter /// contiguous model hierarchy for any potential model prims. /// /// The base implementation returns an empty vector. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual const SdfPathVector& GetModelPaths() const; /// Gets a mapping from MDagPaths to exported prim paths. @@ -140,7 +140,7 @@ class UsdMayaPrimWriter /// /// The base implementation for DAG prim writers simply maps GetDagPath() /// to GetUsdPath(). For DG prim writers, an empty map is returned. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual const UsdMayaUtil::MDagPathMap& GetDagToUsdPathMapping() const; @@ -148,33 +148,33 @@ class UsdMayaPrimWriter /// /// If this prim writer is for a Maya DG node and not a DAG node, this will /// return an invalid MDagPath. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const MDagPath& GetDagPath() const; /// The MObject for the Maya node being written by this writer. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const MObject& GetMayaObject() const; /// The path of the destination USD prim to which we are writing. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const SdfPath& GetUsdPath() const; /// The destination USD prim to which we are writing. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdPrim& GetUsdPrim() const; /// Gets the USD stage that we're writing to. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdStageRefPtr& GetUsdStage() const; protected: /// Helper function for determining whether the current node has input /// animation curves. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual bool _HasAnimCurves() const; /// Gets the current global export args in effect. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdMayaJobExportArgs& _GetExportArgs() const; /// Sets the value of \p attr to \p value at \p time with value @@ -206,7 +206,7 @@ class UsdMayaPrimWriter /// Get the attribute value-writer object to be used when writing /// attributes. Access to this is provided so that attribute authoring /// happening inside non-member functions can make use of it. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdUtilsSparseValueWriter* _GetSparseValueWriter(); UsdPrim _usdPrim; diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterArgs.cpp b/lib/fileio/primWriterArgs.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/primWriterArgs.cpp rename to lib/fileio/primWriterArgs.cpp index ef4cca6fe1..77ca96696b 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterArgs.cpp +++ b/lib/fileio/primWriterArgs.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primWriterArgs.h" +#include "primWriterArgs.h" -#include "usdMaya/writeUtil.h" +#include "utils/writeUtil.h" #include diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterArgs.h b/lib/fileio/primWriterArgs.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/primWriterArgs.h rename to lib/fileio/primWriterArgs.h index f8c4185dc1..7e50806793 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterArgs.h +++ b/lib/fileio/primWriterArgs.h @@ -18,7 +18,7 @@ /// \file usdMaya/primWriterArgs.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" #include "pxr/base/vt/array.h" @@ -40,31 +40,31 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaPrimWriterArgs { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimWriterArgs( const MDagPath& dagPath, const bool exportRefsAsInstanceable); /// \brief returns the MObject that should be exported. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject GetMObject() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const MDagPath& GetMDagPath() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetExportRefsAsInstanceable() const; /// helper functions to get data from attribute named \p from the current /// MObject. /// \{ - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool ReadAttribute(const std::string& name, std::string* val) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool ReadAttribute(const std::string& name, VtIntArray* val) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool ReadAttribute(const std::string& name, VtFloatArray* val) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool ReadAttribute(const std::string& name, VtVec3fArray* val) const; /// \} diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterContext.cpp b/lib/fileio/primWriterContext.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/primWriterContext.cpp rename to lib/fileio/primWriterContext.cpp index c9c65a0263..b1d06a21bc 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterContext.cpp +++ b/lib/fileio/primWriterContext.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/primWriterContext.h" +#include "primWriterContext.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterContext.h b/lib/fileio/primWriterContext.h similarity index 93% rename from plugin/pxr/maya/lib/usdMaya/primWriterContext.h rename to lib/fileio/primWriterContext.h index 72adfc6642..15a97f4cd3 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterContext.h +++ b/lib/fileio/primWriterContext.h @@ -18,7 +18,7 @@ /// \file usdMaya/primWriterContext.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" @@ -35,23 +35,23 @@ class UsdMayaPrimWriterContext { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimWriterContext( const UsdTimeCode& timeCode, const SdfPath& authorPath, const UsdStageRefPtr& stage); /// \brief returns the time frame where data should be authored. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const UsdTimeCode& GetTimeCode() const; /// \brief returns the path where the writer plugin should create /// a prim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const SdfPath& GetAuthorPath() const; /// \brief returns the usd stage that is being written to. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdStageRefPtr GetUsdStage() const; /// \brief Returns the value provided by SetExportsGprims(), or \c false @@ -59,7 +59,7 @@ class UsdMayaPrimWriterContext /// /// May be used by export processes to reason about what kind of asset we /// are creating. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetExportsGprims() const; /// Set the value that will be returned by GetExportsGprims(). @@ -69,7 +69,7 @@ class UsdMayaPrimWriterContext /// function is invoked. /// /// \sa GetExportsGprims() - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetExportsGprims(bool exportsGprims); /// Set the value that will be returned by GetPruneChildren(). @@ -81,7 +81,7 @@ class UsdMayaPrimWriterContext /// This should be called during the initial (unvarying) export for it /// to be considered by the export process. If it is called during the /// animated (varying) export, it will be ignored. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetPruneChildren(bool pruneChildren); /// \brief Returns the value provided by SetPruneChildren(), or \c false @@ -89,13 +89,13 @@ class UsdMayaPrimWriterContext /// /// Export processes should prune all descendants of the current node /// during traversal if this is set to \c true. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetPruneChildren() const; /// Gets the value provided by SetModelPaths(). /// The default value is an empty vector if SetModelPaths() was /// never called. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const SdfPathVector& GetModelPaths() const; /// Sets the vector of prim paths that the prim writer declares as @@ -105,11 +105,11 @@ class UsdMayaPrimWriterContext /// /// The USD export process will attempt to "fix-up" kind metadata to ensure /// contiguous model hierarchy. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetModelPaths(const SdfPathVector& modelPaths); /// Overload of SetModelPaths() that moves the input vector. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetModelPaths(SdfPathVector&& modelPaths); private: diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterRegistry.cpp b/lib/fileio/primWriterRegistry.cpp similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/primWriterRegistry.cpp rename to lib/fileio/primWriterRegistry.cpp index e2fd8c52ef..ec7df249e2 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterRegistry.cpp +++ b/lib/fileio/primWriterRegistry.cpp @@ -14,11 +14,11 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primWriterRegistry.h" +#include "primWriterRegistry.h" -#include -#include "usdMaya/functorPrimWriter.h" -#include "usdMaya/registryHelper.h" +#include "../base/debugCodes.h" +#include "functorPrimWriter.h" +#include "registryHelper.h" #include "pxr/base/tf/debug.h" #include "pxr/base/tf/diagnostic.h" diff --git a/plugin/pxr/maya/lib/usdMaya/primWriterRegistry.h b/lib/fileio/primWriterRegistry.h similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/primWriterRegistry.h rename to lib/fileio/primWriterRegistry.h index ca31c5fa29..0f08c6c4f5 100644 --- a/plugin/pxr/maya/lib/usdMaya/primWriterRegistry.h +++ b/lib/fileio/primWriterRegistry.h @@ -19,11 +19,11 @@ /// \file usdMaya/primWriterRegistry.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../base/api.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" +#include "primWriter.h" +#include "primWriterArgs.h" +#include "primWriterContext.h" #include "pxr/usd/sdf/path.h" @@ -101,20 +101,20 @@ struct UsdMayaPrimWriterRegistry /// MyWriter::Create); /// } /// \endcode - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Register(const std::string& mayaType, WriterFactoryFn fn); /// \brief Wraps \p fn in a WriterFactoryFn and registers the wrapped /// function as a prim writer provider. /// This is a helper method for the macro PXRUSDMAYA_DEFINE_WRITER; /// you probably want to use PXRUSDMAYA_DEFINE_WRITER directly instead. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void RegisterRaw(const std::string& mayaType, WriterFn fn); /// \brief Finds a writer if one exists for \p mayaTypeName. /// /// If there is no writer plugin for \p mayaTypeName, returns nullptr. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static WriterFactoryFn Find(const std::string& mayaTypeName); }; diff --git a/plugin/pxr/maya/lib/usdMaya/registryHelper.cpp b/lib/fileio/registryHelper.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/registryHelper.cpp rename to lib/fileio/registryHelper.cpp index f5d8cf94c1..087ec39e34 100644 --- a/plugin/pxr/maya/lib/usdMaya/registryHelper.cpp +++ b/lib/fileio/registryHelper.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/registryHelper.h" +#include "fileio/registryHelper.h" -#include +#include "base/debugCodes.h" #include "pxr/base/js/converter.h" #include "pxr/base/plug/plugin.h" diff --git a/plugin/pxr/maya/lib/usdMaya/registryHelper.h b/lib/fileio/registryHelper.h similarity index 100% rename from plugin/pxr/maya/lib/usdMaya/registryHelper.h rename to lib/fileio/registryHelper.h diff --git a/plugin/pxr/maya/lib/usdMaya/shaderWriter.cpp b/lib/fileio/shaderWriter.cpp similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/shaderWriter.cpp rename to lib/fileio/shaderWriter.cpp index 09a6d17535..260ef3c923 100644 --- a/plugin/pxr/maya/lib/usdMaya/shaderWriter.cpp +++ b/lib/fileio/shaderWriter.cpp @@ -14,9 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/shaderWriter.h" +#include "shaderWriter.h" -#include "usdMaya/writeJobContext.h" +#include "writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shaderWriter.h b/lib/fileio/shaderWriter.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/shaderWriter.h rename to lib/fileio/shaderWriter.h index c6d4812a1b..e332d36805 100644 --- a/plugin/pxr/maya/lib/usdMaya/shaderWriter.h +++ b/lib/fileio/shaderWriter.h @@ -19,11 +19,11 @@ /// \file usdMaya/shaderWriter.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../base/api.h" -#include "usdMaya/primWriter.h" +#include "primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" @@ -42,7 +42,7 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaShaderWriter : public UsdMayaPrimWriter { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaShaderWriter( const MFnDependencyNode& depNodeFn, const SdfPath& usdPath, @@ -60,7 +60,7 @@ class UsdMayaShaderWriter : public UsdMayaPrimWriter /// the exported prims in USD. Derived classes should override this and /// return the corresponding property names for the Maya attributes /// that should be considered for connections. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual TfToken GetShadingPropertyNameForMayaAttrName( const TfToken& mayaAttrName); @@ -74,7 +74,7 @@ class UsdMayaShaderWriter : public UsdMayaPrimWriter /// method will only return valid USD properties that the shader writer /// has already authored on its privately held UsdPrim, so this method /// should only be called after Write() has been called at least once. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual UsdProperty GetShadingPropertyForMayaAttrName( const TfToken& mayaAttrName); }; diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeDisplayColor.cpp b/lib/fileio/shading/shadingModeDisplayColor.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/shadingModeDisplayColor.cpp rename to lib/fileio/shading/shadingModeDisplayColor.cpp index 9c79682f9a..1731a002ba 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeDisplayColor.cpp +++ b/lib/fileio/shading/shadingModeDisplayColor.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/shadingModeRegistry.h" -#include "usdMaya/translatorMaterial.h" +#include "../../utils/colorSpace.h" +#include "./shadingModeExporter.h" +#include "./shadingModeExporterContext.h" +#include "./shadingModeRegistry.h" +#include "../translators/translatorMaterial.h" #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeExporter.cpp b/lib/fileio/shading/shadingModeExporter.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/shadingModeExporter.cpp rename to lib/fileio/shading/shadingModeExporter.cpp index 0cb637b07f..ee79a34abd 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeExporter.cpp +++ b/lib/fileio/shading/shadingModeExporter.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/shadingModeExporter.h" +#include "shadingModeExporter.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/shadingModeExporterContext.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../jobs/jobArgs.h" +#include "shadingModeExporterContext.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeExporter.h b/lib/fileio/shading/shadingModeExporter.h similarity index 89% rename from plugin/pxr/maya/lib/usdMaya/shadingModeExporter.h rename to lib/fileio/shading/shadingModeExporter.h index 3c902d8a29..a858f67f4a 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeExporter.h +++ b/lib/fileio/shading/shadingModeExporter.h @@ -19,10 +19,10 @@ /// \file usdMaya/shadingModeExporter.h #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/shadingModeExporterContext.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../base/api.h" +#include "shadingModeExporterContext.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usdShade/material.h" @@ -37,12 +37,12 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaShadingModeExporter { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaShadingModeExporter(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual ~UsdMayaShadingModeExporter(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void DoExport( UsdMayaWriteJobContext& writeJobContext, const UsdMayaUtil::MDagPathMap& dagPathToUsdMap); @@ -52,11 +52,11 @@ class UsdMayaShadingModeExporter /// Because it is called before the per-shading-engine loop, the /// shadingEngine in the passed UsdMayaShadingModeExportContext will be a /// null MObject. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void PreExport(UsdMayaShadingModeExportContext* /* context */) {}; /// Called inside of a loop, per-shading-engine - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void Export( const UsdMayaShadingModeExportContext& context, UsdShadeMaterial* const mat, @@ -67,7 +67,7 @@ class UsdMayaShadingModeExporter /// Because it is called after the per-shading-engine loop, the /// shadingEngine in the passed UsdMayaShadingModeExportContext will be a /// null MObject. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual void PostExport(const UsdMayaShadingModeExportContext& /* context */) {}; }; diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.cpp b/lib/fileio/shading/shadingModeExporterContext.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.cpp rename to lib/fileio/shading/shadingModeExporterContext.cpp index c2d5a4a662..9fc3e49150 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.cpp +++ b/lib/fileio/shading/shadingModeExporterContext.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/shadingModeExporterContext.h" +#include "shadingModeExporterContext.h" -#include "usdMaya/jobArgs.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../jobs/jobArgs.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/envSetting.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.h b/lib/fileio/shading/shadingModeExporterContext.h similarity index 92% rename from plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.h rename to lib/fileio/shading/shadingModeExporterContext.h index f2e47cdaa9..a6b49c1213 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeExporterContext.h +++ b/lib/fileio/shading/shadingModeExporterContext.h @@ -19,10 +19,10 @@ /// \file usdMaya/shadingModeExporterContext.h #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/jobArgs.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../base/api.h" +#include "../jobs/jobArgs.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/base/vt/types.h" @@ -69,28 +69,28 @@ class UsdMayaShadingModeExportContext return _bindableRoots; } - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetSurfaceShaderPlugName(const TfToken& surfaceShaderPlugName); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetVolumeShaderPlugName(const TfToken& volumeShaderPlugName); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetDisplacementShaderPlugName(const TfToken& displacementShaderPlugName); const UsdMayaUtil::MDagPathMap& GetDagPathToUsdMap() const { return _dagPathToUsdMap; } - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MPlug GetSurfaceShaderPlug() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject GetSurfaceShader() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MPlug GetVolumeShaderPlug() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject GetVolumeShader() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MPlug GetDisplacementShaderPlug() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject GetDisplacementShader() const; /// An assignment contains a bound prim path and a list of faceIndices. @@ -105,7 +105,7 @@ class UsdMayaShadingModeExportContext /// Returns a vector of binding assignments associated with the shading /// engine. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AssignmentVector GetAssignments() const; /// Use this function to create a UsdShadeMaterial prim at the "standard" @@ -115,7 +115,7 @@ class UsdMayaShadingModeExportContext /// If \p boundPrimPaths is not NULL, it is populated with the set of /// prim paths that were bound to the created material prim, based on the /// given \p assignmentsToBind. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdPrim MakeStandardMaterialPrim( const AssignmentVector& assignmentsToBind, const std::string& name=std::string(), @@ -130,12 +130,12 @@ class UsdMayaShadingModeExportContext /// /// If it's false, this will return if it's the 0-th logical /// element and an empty token otherwise. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::string GetStandardAttrName( const MPlug& attrPlug, const bool allowMultiElementArrays) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaShadingModeExportContext( const MObject& shadingEngine, UsdMayaWriteJobContext& writeJobContext, diff --git a/lib/fileio/shading/shadingModeImporter.cpp b/lib/fileio/shading/shadingModeImporter.cpp new file mode 100644 index 0000000000..8a1fb9fdd4 --- /dev/null +++ b/lib/fileio/shading/shadingModeImporter.cpp @@ -0,0 +1,185 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include "shadingModeImporter.h" + +#include "pxr/base/tf/diagnostic.h" +#include "pxr/base/tf/staticTokens.h" +#include "pxr/base/tf/stringUtils.h" +#include "pxr/base/tf/token.h" + +#include "pxr/usd/sdf/path.h" +#include "pxr/usd/usd/prim.h" + +#include +#include +#include +#include + + +PXR_NAMESPACE_OPEN_SCOPE + + +TF_DEFINE_PUBLIC_TOKENS(UsdMayaShadingModeImporterTokens, + PXRUSDMAYA_SHADING_MODE_IMPORTER_TOKENS); + + +bool +UsdMayaShadingModeImportContext::GetCreatedObject( + const UsdPrim& prim, + MObject* obj) const +{ + if (!prim) { + return false; + } + + MObject node = _context->GetMayaNode(prim.GetPath(), false); + if (!node.isNull()) { + *obj = node; + return true; + } + + return false; +} + +MObject +UsdMayaShadingModeImportContext::AddCreatedObject( + const UsdPrim& prim, + const MObject& obj) +{ + if (prim) { + return AddCreatedObject(prim.GetPath(), obj); + } + + return obj; +} + +MObject +UsdMayaShadingModeImportContext::AddCreatedObject( + const SdfPath& path, + const MObject& obj) +{ + if (!path.IsEmpty()) { + _context->RegisterNewMayaNode(path.GetString(), obj); + } + + return obj; +} + +MObject +UsdMayaShadingModeImportContext::CreateShadingEngine() const +{ + const TfToken shadingEngineName = GetShadingEngineName(); + if (shadingEngineName.IsEmpty()) { + return MObject(); + } + + MStatus status; + MFnSet fnSet; + MSelectionList tmpSelList; + MObject shadingEngine = + fnSet.create(tmpSelList, MFnSet::kRenderableOnly, &status); + if (status != MS::kSuccess) { + TF_RUNTIME_ERROR("Failed to create shadingEngine: %s", + shadingEngineName.GetText()); + return MObject(); + } + + fnSet.setName(shadingEngineName.GetText(), + /* createNamespace = */ true, + &status); + CHECK_MSTATUS_AND_RETURN(status, MObject()); + + return shadingEngine; +} + +TfToken +UsdMayaShadingModeImportContext::GetShadingEngineName() const +{ + if (!_shadeMaterial && !_boundPrim) { + return TfToken(); + } + + if (!_shadingEngineName.IsEmpty()) { + return _shadingEngineName; + } + + TfToken primName; + if (_shadeMaterial) { + primName = _shadeMaterial.GetPrim().GetName(); + } else if (_boundPrim) { + primName = _boundPrim.GetPrim().GetName(); + } + + // To make sure that the shadingEngine object names do not collide with + // Maya transform or shape node names, we put the shadingEngine objects + // into their own namespace. + const TfToken shadingEngineName( + TfStringPrintf( + "%s:%s", + UsdMayaShadingModeImporterTokens->MayaMaterialNamespace.GetText(), + primName.GetText())); + + return shadingEngineName; +} + +TfToken +UsdMayaShadingModeImportContext::GetSurfaceShaderPlugName() const +{ + return _surfaceShaderPlugName; +} + +TfToken +UsdMayaShadingModeImportContext::GetVolumeShaderPlugName() const +{ + return _volumeShaderPlugName; +} + +TfToken +UsdMayaShadingModeImportContext::GetDisplacementShaderPlugName() const +{ + return _displacementShaderPlugName; +} + +void +UsdMayaShadingModeImportContext::SetShadingEngineName( + const TfToken& shadingEngineName) +{ + _shadingEngineName = shadingEngineName; +} + +void +UsdMayaShadingModeImportContext::SetSurfaceShaderPlugName( + const TfToken& surfaceShaderPlugName) +{ + _surfaceShaderPlugName = surfaceShaderPlugName; +} + +void +UsdMayaShadingModeImportContext::SetVolumeShaderPlugName( + const TfToken& volumeShaderPlugName) +{ + _volumeShaderPlugName = volumeShaderPlugName; +} + +void +UsdMayaShadingModeImportContext::SetDisplacementShaderPlugName( + const TfToken& displacementShaderPlugName) +{ + _displacementShaderPlugName = displacementShaderPlugName; +} + + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeImporter.h b/lib/fileio/shading/shadingModeImporter.h similarity index 92% rename from plugin/pxr/maya/lib/usdMaya/shadingModeImporter.h rename to lib/fileio/shading/shadingModeImporter.h index 27105093a4..0f619993e2 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeImporter.h +++ b/lib/fileio/shading/shadingModeImporter.h @@ -18,8 +18,8 @@ /// \file usdMaya/shadingModeImporter.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -43,7 +43,7 @@ PXR_NAMESPACE_OPEN_SCOPE ((MayaMaterialNamespace, "USD_Materials")) TF_DECLARE_PUBLIC_TOKENS(UsdMayaShadingModeImporterTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_SHADING_MODE_IMPORTER_TOKENS); @@ -79,21 +79,21 @@ class UsdMayaShadingModeImportContext /// This will return true and \p obj will be set to the /// previously created MObject. Otherwise, this returns false; /// If \p prim is an invalid UsdPrim, this will return false. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetCreatedObject(const UsdPrim& prim, MObject* obj) const; /// If you want to register a prim so that other parts of the import /// uses them, this function registers \obj as being created. /// If \p prim is an invalid UsdPrim, nothing will get stored and \p obj /// will be returned. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject AddCreatedObject(const UsdPrim& prim, const MObject& obj); /// If you want to register a path so that other parts of the import /// uses them, this function registers \obj as being created. /// If \p path is an empty SdfPath, nothing will get stored and \p obj /// will be returned. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject AddCreatedObject(const SdfPath& path, const MObject& obj); /// @} @@ -102,7 +102,7 @@ class UsdMayaShadingModeImportContext /// /// The shading engine's name is set using the value returned by /// GetShadingEngineName(). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MObject CreateShadingEngine() const; /// Gets the name of the shading engine that will be created for this @@ -111,14 +111,14 @@ class UsdMayaShadingModeImportContext /// If a shading engine name has been explicitly set on the context, that /// will be returned. Otherwise, the shading engine name is computed based /// on the context's material and/or bound prim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetShadingEngineName() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetSurfaceShaderPlugName() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetVolumeShaderPlugName() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetDisplacementShaderPlugName() const; /// Sets the name of the shading engine to be created for this context. @@ -126,14 +126,14 @@ class UsdMayaShadingModeImportContext /// Call this with an empty TfToken to reset the context to the default /// behavior of computing the shading engine name based on its material /// and/or bound prim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetShadingEngineName(const TfToken& shadingEngineName); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetSurfaceShaderPlugName(const TfToken& surfaceShaderPlugName); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetVolumeShaderPlugName(const TfToken& volumeShaderPlugName); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetDisplacementShaderPlugName(const TfToken& displacementShaderPlugName); private: diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModePxrRis.cpp b/lib/fileio/shading/shadingModePxrRis.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/shadingModePxrRis.cpp rename to lib/fileio/shading/shadingModePxrRis.cpp index a9fd84583c..1e379f7fb6 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModePxrRis.cpp +++ b/lib/fileio/shading/shadingModePxrRis.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/roundTripUtil.h" -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/shadingModeImporter.h" +#include "../utils/roundTripUtil.h" +#include "shadingModeExporter.h" +#include "shadingModeExporterContext.h" +#include "shadingModeImporter.h" // Defines the RenderMan for Maya mapping between Pxr objects and Maya internal nodes -#include "usdMaya/shadingModePxrRis_rfm_map.h" -#include "usdMaya/shadingModeRegistry.h" -#include "usdMaya/translatorUtil.h" -#include -#include "usdMaya/writeUtil.h" +#include "shadingModePxrRis_rfm_map.h" +#include "shadingModeRegistry.h" +#include "../translators/translatorUtil.h" +#include "../../utils/util.h" +#include "../utils/writeUtil.h" #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModePxrRis_rfm_map.h b/lib/fileio/shading/shadingModePxrRis_rfm_map.h similarity index 100% rename from plugin/pxr/maya/lib/usdMaya/shadingModePxrRis_rfm_map.h rename to lib/fileio/shading/shadingModePxrRis_rfm_map.h diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.cpp b/lib/fileio/shading/shadingModeRegistry.cpp similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.cpp rename to lib/fileio/shading/shadingModeRegistry.cpp index f35a8f3c13..cdfffbdf4f 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.cpp +++ b/lib/fileio/shading/shadingModeRegistry.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/shadingModeRegistry.h" +#include "shadingModeRegistry.h" -#include "usdMaya/registryHelper.h" -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/shadingModeImporter.h" +#include "../registryHelper.h" +#include "shadingModeExporter.h" +#include "shadingModeExporterContext.h" +#include "shadingModeImporter.h" #include "pxr/base/tf/instantiateSingleton.h" #include "pxr/base/tf/registryManager.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.h b/lib/fileio/shading/shadingModeRegistry.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.h rename to lib/fileio/shading/shadingModeRegistry.h index 84b11c9b83..96e84a95a6 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeRegistry.h +++ b/lib/fileio/shading/shadingModeRegistry.h @@ -18,10 +18,10 @@ /// \file usdMaya/shadingModeRegistry.h -#include "usdMaya/api.h" -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/shadingModeImporter.h" +#include "../../base/api.h" +#include "shadingModeExporter.h" +#include "shadingModeExporterContext.h" +#include "shadingModeImporter.h" #include "pxr/pxr.h" @@ -44,7 +44,7 @@ PXR_NAMESPACE_OPEN_SCOPE (displayColor) TF_DECLARE_PUBLIC_TOKENS(UsdMayaShadingModeTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_SHADINGMODE_TOKENS); @@ -60,28 +60,32 @@ class UsdMayaShadingModeRegistry : public TfWeakBase { public: + MAYAUSD_CORE_PUBLIC static UsdMayaShadingModeExporterCreator GetExporter(const TfToken& name) { return GetInstance()._GetExporter(name); } + MAYAUSD_CORE_PUBLIC static UsdMayaShadingModeImporter GetImporter(const TfToken& name) { return GetInstance()._GetImporter(name); } + MAYAUSD_CORE_PUBLIC static TfTokenVector ListExporters() { return GetInstance()._ListExporters(); } + MAYAUSD_CORE_PUBLIC static TfTokenVector ListImporters() { return GetInstance()._ListImporters(); } - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdMayaShadingModeRegistry& GetInstance(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool RegisterExporter( const std::string& name, UsdMayaShadingModeExporterCreator fn); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool RegisterImporter( const std::string& name, UsdMayaShadingModeImporter fn); diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeUseRegistry.cpp b/lib/fileio/shading/shadingModeUseRegistry.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/shadingModeUseRegistry.cpp rename to lib/fileio/shading/shadingModeUseRegistry.cpp index 7dce3c4a0a..a64d52a732 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeUseRegistry.cpp +++ b/lib/fileio/shading/shadingModeUseRegistry.cpp @@ -14,13 +14,13 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/shaderWriter.h" -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeExporterContext.h" -#include "usdMaya/shadingModeRegistry.h" -#include "usdMaya/shadingUtil.h" -#include +#include "../primWriter.h" +#include "../shaderWriter.h" +#include "shadingModeExporter.h" +#include "shadingModeExporterContext.h" +#include "shadingModeRegistry.h" +#include "../utils/shadingUtil.h" +#include "../../utils/util.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/lib/usdMaya/transformWriter.cpp b/lib/fileio/transformWriter.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/transformWriter.cpp rename to lib/fileio/transformWriter.cpp index a772d962e8..771de453ba 100644 --- a/plugin/pxr/maya/lib/usdMaya/transformWriter.cpp +++ b/lib/fileio/transformWriter.cpp @@ -14,13 +14,13 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/transformWriter.h" +#include "transformWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriterRegistry.h" -#include -#include "usdMaya/writeJobContext.h" -#include "usdMaya/xformStack.h" +#include "utils/adaptor.h" +#include "primWriterRegistry.h" +#include "../utils/util.h" +#include "writeJobContext.h" +#include "utils/xformStack.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec3d.h" diff --git a/plugin/pxr/maya/lib/usdMaya/transformWriter.h b/lib/fileio/transformWriter.h similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/transformWriter.h rename to lib/fileio/transformWriter.h index c62546e36a..2062f3541b 100644 --- a/plugin/pxr/maya/lib/usdMaya/transformWriter.h +++ b/lib/fileio/transformWriter.h @@ -19,10 +19,10 @@ /// \file usdMaya/transformWriter.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../base/api.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "primWriter.h" +#include "writeJobContext.h" #include "pxr/base/gf/vec3d.h" #include "pxr/base/tf/token.h" @@ -50,7 +50,7 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaTransformWriter : public UsdMayaPrimWriter { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaTransformWriter( const MFnDependencyNode& depNodeFn, const SdfPath& usdPath, @@ -59,7 +59,7 @@ class UsdMayaTransformWriter : public UsdMayaPrimWriter /// Main export function that runs when the traversal hits the node. /// This extends UsdMayaPrimWriter::Write() by exporting xform ops for /// UsdGeomXformable if the Maya node has transform data. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void Write(const UsdTimeCode& usdTime) override; private: diff --git a/plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.cpp b/lib/fileio/translators/skelBindingsProcessor.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.cpp rename to lib/fileio/translators/skelBindingsProcessor.cpp index 6649ecfd5c..d456fee5cb 100644 --- a/plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.cpp +++ b/lib/fileio/translators/skelBindingsProcessor.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/skelBindingsProcessor.h" +#include "skelBindingsProcessor.h" #include "pxr/usd/usdGeom/xform.h" #include "pxr/usd/usdSkel/bindingAPI.h" #include "pxr/usd/usdSkel/root.h" #include "pxr/usd/usdUtils/authoring.h" -#include "usdMaya/translatorUtil.h" +#include "translatorUtil.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.h b/lib/fileio/translators/skelBindingsProcessor.h similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.h rename to lib/fileio/translators/skelBindingsProcessor.h index 58897426e4..92ef4f22b0 100644 --- a/plugin/pxr/maya/lib/usdMaya/skelBindingsProcessor.h +++ b/lib/fileio/translators/skelBindingsProcessor.h @@ -18,8 +18,8 @@ /// \file usdMaya/skelBindingsProcessor.h -#include "usdMaya/api.h" -#include +#include "../../base/api.h" +#include "../../utils/util.h" #include "pxr/pxr.h" #include "pxr/usd/sdf/path.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorCamera.cpp b/lib/fileio/translators/translatorCamera.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/translatorCamera.cpp rename to lib/fileio/translators/translatorCamera.cpp index 8cb633bd09..254bb3ca4a 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorCamera.cpp +++ b/lib/fileio/translators/translatorCamera.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorCamera.h" +#include "translatorCamera.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/translatorUtil.h" -#include +#include "../jobs/jobArgs.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "translatorUtil.h" +#include "../../utils/util.h" #include "pxr/base/gf/vec2f.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorCamera.h b/lib/fileio/translators/translatorCamera.h similarity index 91% rename from plugin/pxr/maya/lib/usdMaya/translatorCamera.h rename to lib/fileio/translators/translatorCamera.h index f18f6cc0ac..af0633e56f 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorCamera.h +++ b/lib/fileio/translators/translatorCamera.h @@ -18,9 +18,9 @@ /// \file usdMaya/translatorCamera.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -37,7 +37,7 @@ struct UsdMayaTranslatorCamera { /// Reads a UsdGeomCamera \p usdCamera from USD and creates a Maya /// MFnCamera under \p parentNode. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Read( const UsdGeomCamera& usdCamera, MObject parentNode, @@ -46,7 +46,7 @@ struct UsdMayaTranslatorCamera /// Helper function to access just the logic that writes from a non-animated /// camera into an existing maya camera. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadToCamera( const UsdGeomCamera& usdCamera, MFnCamera& cameraObject); diff --git a/plugin/pxr/maya/lib/usdMaya/translatorCurves.cpp b/lib/fileio/translators/translatorCurves.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/translatorCurves.cpp rename to lib/fileio/translators/translatorCurves.cpp index c7d0208670..75650af97a 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorCurves.cpp +++ b/lib/fileio/translators/translatorCurves.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorCurves.h" +#include "translatorCurves.h" -#include "usdMaya/translatorUtil.h" +#include "translatorUtil.h" #include "pxr/usd/usdGeom/basisCurves.h" #include "pxr/usd/usdGeom/nurbsCurves.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorCurves.h b/lib/fileio/translators/translatorCurves.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/translatorCurves.h rename to lib/fileio/translators/translatorCurves.h index 154454a74b..eb80f48661 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorCurves.h +++ b/lib/fileio/translators/translatorCurves.h @@ -18,9 +18,9 @@ /// \file usdMaya/translatorCurves.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -35,7 +35,7 @@ PXR_NAMESPACE_OPEN_SCOPE struct UsdMayaTranslatorCurves { /// \brief Creates a NurbsCurve under \p parentNode. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Create( const UsdGeomCurves& curves, MObject parentNode, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorGprim.cpp b/lib/fileio/translators/translatorGprim.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/translatorGprim.cpp rename to lib/fileio/translators/translatorGprim.cpp index f2b0a67741..e437f0a7f8 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorGprim.cpp +++ b/lib/fileio/translators/translatorGprim.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorGprim.h" +#include "translatorGprim.h" -#include +#include "../../utils/util.h" #include diff --git a/plugin/pxr/maya/lib/usdMaya/translatorGprim.h b/lib/fileio/translators/translatorGprim.h similarity index 89% rename from plugin/pxr/maya/lib/usdMaya/translatorGprim.h rename to lib/fileio/translators/translatorGprim.h index e752da8a12..8d2765a292 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorGprim.h +++ b/lib/fileio/translators/translatorGprim.h @@ -18,9 +18,9 @@ /// \file translatorGprim.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primWriterContext.h" +#include "../../base/api.h" +#include "../primReaderContext.h" +#include "../primWriterContext.h" #include "pxr/pxr.h" @@ -34,13 +34,13 @@ PXR_NAMESPACE_OPEN_SCOPE /// \brief Provides helper functions for reading UsdGeomGprim. struct UsdMayaTranslatorGprim { - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Read( const UsdGeomGprim& gprim, MObject mayaNode, UsdMayaPrimReaderContext* context); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Write( const MObject& mayaNode, const UsdGeomGprim& gprim, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMaterial.cpp b/lib/fileio/translators/translatorMaterial.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/translatorMaterial.cpp rename to lib/fileio/translators/translatorMaterial.cpp index 7a887c5036..c7da9e427d 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMaterial.cpp +++ b/lib/fileio/translators/translatorMaterial.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorMaterial.h" - -#include "usdMaya/primReaderContext.h" -#include "usdMaya/shadingModeExporter.h" -#include "usdMaya/shadingModeImporter.h" -#include "usdMaya/shadingModeRegistry.h" -#include -#include "usdMaya/writeJobContext.h" +#include "translatorMaterial.h" + +#include "../primReaderContext.h" +#include "../shading/shadingModeExporter.h" +#include "../shading/shadingModeImporter.h" +#include "../shading/shadingModeRegistry.h" +#include "../../utils/util.h" +#include "../writeJobContext.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/envSetting.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMaterial.h b/lib/fileio/translators/translatorMaterial.h similarity index 91% rename from plugin/pxr/maya/lib/usdMaya/translatorMaterial.h rename to lib/fileio/translators/translatorMaterial.h index b5f6c4bfb1..5acd22f618 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMaterial.h +++ b/lib/fileio/translators/translatorMaterial.h @@ -19,10 +19,10 @@ /// \file usdMaya/translatorMaterial.h #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/primReaderContext.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../base/api.h" +#include "../primReaderContext.h" +#include "../../utils/util.h" +#include "..//writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" @@ -41,7 +41,7 @@ struct UsdMayaTranslatorMaterial /// Reads \p material according to \p shadingMode . Some shading modes may /// want to know the \p boundPrim. This returns an MObject that is the Maya /// shadingEngine that corresponds to \p material. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject Read( const TfToken& shadingMode, const UsdShadeMaterial& material, @@ -52,7 +52,7 @@ struct UsdMayaTranslatorMaterial /// This will see which UsdShadeMaterial is bound to \p prim. If the /// material has not been read already, it will read it. /// The created/retrieved shadingEngine will be assigned to \p shapeObj. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool AssignMaterial( const TfToken& shadingMode, const UsdGeomGprim& prim, @@ -61,7 +61,7 @@ struct UsdMayaTranslatorMaterial /// Finds shadingEngines in the Maya scene and exports them to the USD /// stage contained in \p writeJobContext. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void ExportShadingEngines( UsdMayaWriteJobContext& writeJobContext, const UsdMayaUtil::MDagPathMap& dagPathToUsdMap); diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMesh.cpp b/lib/fileio/translators/translatorMesh.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/translatorMesh.cpp rename to lib/fileio/translators/translatorMesh.cpp index ff48b3c3d0..58d1d33079 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMesh.cpp +++ b/lib/fileio/translators/translatorMesh.cpp @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorMesh.h" - -#include "usdMaya/meshUtil.h" -#include "usdMaya/pointBasedDeformerNode.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/readUtil.h" -#include "usdMaya/roundTripUtil.h" -#include "usdMaya/stageNode.h" -#include "usdMaya/translatorGprim.h" -#include "usdMaya/translatorMaterial.h" -#include "usdMaya/translatorUtil.h" -#include +#include "translatorMesh.h" + +#include "../utils/meshUtil.h" +#include "../../nodes/pointBasedDeformerNode.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "../utils/readUtil.h" +#include "../utils/roundTripUtil.h" +#include "../../nodes/stageNode.h" +#include "translatorGprim.h" +#include "translatorMaterial.h" +#include "translatorUtil.h" +#include "../../utils/util.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMesh.h b/lib/fileio/translators/translatorMesh.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/translatorMesh.h rename to lib/fileio/translators/translatorMesh.h index cc8fecbfc0..f98c057e57 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMesh.h +++ b/lib/fileio/translators/translatorMesh.h @@ -19,10 +19,10 @@ #ifndef PXRUSDMAYA_TRANSLATOR_MESH_H #define PXRUSDMAYA_TRANSLATOR_MESH_H -#include "usdMaya/api.h" +#include "../../base/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -42,7 +42,7 @@ class UsdMayaTranslatorMesh { public: /// Creates an MFnMesh under \p parentNode from \p mesh. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Create( const UsdGeomMesh& mesh, MObject parentNode, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMesh_PrimVars.cpp b/lib/fileio/translators/translatorMesh_PrimVars.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/translatorMesh_PrimVars.cpp rename to lib/fileio/translators/translatorMesh_PrimVars.cpp index 9c5e7b0911..50d7513784 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMesh_PrimVars.cpp +++ b/lib/fileio/translators/translatorMesh_PrimVars.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorMesh.h" +#include "translatorMesh.h" -#include -#include "usdMaya/meshUtil.h" -#include "usdMaya/readUtil.h" -#include "usdMaya/roundTripUtil.h" +#include "../../utils/colorSpace.h" +#include "../utils/meshUtil.h" +#include "../utils/readUtil.h" +#include "../utils/roundTripUtil.h" #include "pxr/base/gf/vec2f.h" #include "pxr/base/gf/vec4f.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorMesh_SubDiv.cpp b/lib/fileio/translators/translatorMesh_SubDiv.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/translatorMesh_SubDiv.cpp rename to lib/fileio/translators/translatorMesh_SubDiv.cpp index 149a048b9a..2a1646cb0d 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorMesh_SubDiv.cpp +++ b/lib/fileio/translators/translatorMesh_SubDiv.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorMesh.h" +#include "translatorMesh.h" -#include +#include "../../utils/util.h" #include "pxr/usd/usdGeom/mesh.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.cpp b/lib/fileio/translators/translatorNurbsPatch.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.cpp rename to lib/fileio/translators/translatorNurbsPatch.cpp index c569195776..28f1d6c3d6 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.cpp +++ b/lib/fileio/translators/translatorNurbsPatch.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorNurbsPatch.h" +#include "translatorNurbsPatch.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/translatorGprim.h" -#include "usdMaya/translatorMaterial.h" -#include "usdMaya/translatorUtil.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "translatorGprim.h" +#include "translatorMaterial.h" +#include "translatorUtil.h" #include "pxr/usd/usdGeom/nurbsPatch.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.h b/lib/fileio/translators/translatorNurbsPatch.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.h rename to lib/fileio/translators/translatorNurbsPatch.h index 084aa91754..eda3cf1662 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorNurbsPatch.h +++ b/lib/fileio/translators/translatorNurbsPatch.h @@ -18,9 +18,9 @@ /// \file usdMaya/translatorNurbsPatch.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -34,7 +34,7 @@ PXR_NAMESPACE_OPEN_SCOPE struct UsdMayaTranslatorNurbsPatch { - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Read( const UsdGeomNurbsPatch& usdNurbsPatch, MObject parentNode, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorPrim.cpp b/lib/fileio/translators/translatorPrim.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/translatorPrim.cpp rename to lib/fileio/translators/translatorPrim.cpp index df1a97b792..c4d3ca6ae3 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorPrim.cpp +++ b/lib/fileio/translators/translatorPrim.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorPrim.h" +#include "translatorPrim.h" -#include "usdMaya/readUtil.h" -#include "usdMaya/translatorUtil.h" -#include +#include "../utils/readUtil.h" +#include "translatorUtil.h" +#include "../../utils/util.h" #include "pxr/usd/usdGeom/imageable.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorPrim.h b/lib/fileio/translators/translatorPrim.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/translatorPrim.h rename to lib/fileio/translators/translatorPrim.h index d6f24e167b..e118c62d72 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorPrim.h +++ b/lib/fileio/translators/translatorPrim.h @@ -18,9 +18,9 @@ /// \file usdMaya/translatorPrim.h -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/pxr.h" @@ -35,7 +35,7 @@ PXR_NAMESPACE_OPEN_SCOPE /// accurately take a UsdGeomImageable. struct UsdMayaTranslatorPrim { - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Read( const UsdPrim& prim, MObject mayaNode, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorRfMLight.cpp b/lib/fileio/translators/translatorRfMLight.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/translatorRfMLight.cpp rename to lib/fileio/translators/translatorRfMLight.cpp index 7dee04e982..d74371f4f6 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorRfMLight.cpp +++ b/lib/fileio/translators/translatorRfMLight.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorRfMLight.h" - -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/translatorUtil.h" -#include "usdMaya/translatorXformable.h" -#include +#include "translatorRfMLight.h" + +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "../primReaderRegistry.h" +#include "../primWriterArgs.h" +#include "../primWriterContext.h" +#include "../primWriterRegistry.h" +#include "translatorUtil.h" +#include "translatorXformable.h" +#include "../../utils/util.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorRfMLight.h b/lib/fileio/translators/translatorRfMLight.h similarity index 87% rename from plugin/pxr/maya/lib/usdMaya/translatorRfMLight.h rename to lib/fileio/translators/translatorRfMLight.h index 704ed1be54..6583f36f6d 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorRfMLight.h +++ b/lib/fileio/translators/translatorRfMLight.h @@ -20,11 +20,11 @@ #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "../primWriterArgs.h" +#include "../primWriterContext.h" PXR_NAMESPACE_OPEN_SCOPE @@ -36,7 +36,7 @@ struct UsdMayaTranslatorRfMLight /// identify a RenderMan for Maya light. /// /// Returns true if this succeeds in creating a UsdLux schema prim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Write( const UsdMayaPrimWriterArgs& args, UsdMayaPrimWriterContext* context); @@ -44,7 +44,7 @@ struct UsdMayaTranslatorRfMLight /// Imports a UsdLux schema prim as a RenderMan for Maya light. /// /// Returns true if this succeeds in creating a RenderMan for Maya light. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool Read( const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext* context); diff --git a/plugin/pxr/maya/lib/usdMaya/translatorSkel.cpp b/lib/fileio/translators/translatorSkel.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/translatorSkel.cpp rename to lib/fileio/translators/translatorSkel.cpp index 270fa40cca..5e1beb4447 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorSkel.cpp +++ b/lib/fileio/translators/translatorSkel.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorSkel.h" +#include "translatorSkel.h" -#include "usdMaya/translatorUtil.h" -#include "usdMaya/translatorXformable.h" -#include +#include "translatorUtil.h" +#include "translatorXformable.h" +#include "../../utils/util.h" #include "pxr/base/tf/staticData.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorSkel.h b/lib/fileio/translators/translatorSkel.h similarity index 92% rename from plugin/pxr/maya/lib/usdMaya/translatorSkel.h rename to lib/fileio/translators/translatorSkel.h index 62903368f0..45fe034d9a 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorSkel.h +++ b/lib/fileio/translators/translatorSkel.h @@ -20,9 +20,9 @@ #define PXRUSDMAYA_TRANSLATOR_SKEL_H #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/base/vt/array.h" @@ -39,7 +39,7 @@ struct UsdMayaTranslatorSkel { /// Returns true if \p joint is being used to identify the root of /// a UsdSkelSkeleton. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool IsUsdSkeleton(const MDagPath& joint); /// Returns true if \p Skeleton was originally generated from Maya. @@ -47,16 +47,16 @@ struct UsdMayaTranslatorSkel /// determine whether or not a joint should be created to represent a /// Skeleton when importing a Skeleton from USD that was originally /// created in Maya. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool IsSkelMayaGenerated(const UsdSkelSkeleton& skel); /// Mark a Skeleton as being originally exported from Maya. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void MarkSkelAsMayaGenerated(const UsdSkelSkeleton& skel); /// Create joint nodes for each joint in \p skelQuery. /// Animation is applied to the joints if \p args enable it. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateJointHierarchy(const UsdSkelSkeletonQuery& skelQuery, MObject& parentNode, const UsdMayaPrimReaderArgs& args, @@ -64,20 +64,20 @@ struct UsdMayaTranslatorSkel VtArray* joints); /// Find the set of MObjects joint objects for a skeleton. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool GetJoints(const UsdSkelSkeletonQuery& skelQuery, UsdMayaPrimReaderContext* context, VtArray* joints); /// Create a dagPose node holding a bind pose for skel \p skelQuery. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateBindPose(const UsdSkelSkeletonQuery& skelQuery, const VtArray& joints, UsdMayaPrimReaderContext* context, MObject* bindPoseNode); /// Find the bind pose for a Skeleton. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject GetBindPose(const UsdSkelSkeletonQuery& skelQuery, UsdMayaPrimReaderContext* context); @@ -85,7 +85,7 @@ struct UsdMayaTranslatorSkel /// The skinning cluster is wired up to be driven by the joints /// created by CreateJoints(). /// This currently only supports mesh objects. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateSkinCluster(const UsdSkelSkeletonQuery& skelQuery, const UsdSkelSkinningQuery& skinningQuery, const VtArray& joints, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorUtil.cpp b/lib/fileio/translators/translatorUtil.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/translatorUtil.cpp rename to lib/fileio/translators/translatorUtil.cpp index 3c6fbe2cbd..4aa3d9780b 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorUtil.cpp +++ b/lib/fileio/translators/translatorUtil.cpp @@ -14,14 +14,14 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/translatorUtil.h" - -#include "usdMaya/adaptor.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/translatorXformable.h" -#include -#include "usdMaya/xformStack.h" +#include "translatorUtil.h" + +#include "../utils/adaptor.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" +#include "translatorXformable.h" +#include "../../utils/util.h" +#include "../utils/xformStack.h" #include "pxr/usd/sdf/schema.h" #include "pxr/usd/usd/prim.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorUtil.h b/lib/fileio/translators/translatorUtil.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/translatorUtil.h rename to lib/fileio/translators/translatorUtil.h index a6b616d2b8..33474315ca 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorUtil.h +++ b/lib/fileio/translators/translatorUtil.h @@ -17,9 +17,9 @@ #define PXRUSDMAYA_TRANSLATOR_UTIL_H #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" +#include "../../base/api.h" +#include "../primReaderArgs.h" +#include "../primReaderContext.h" #include "pxr/usd/usd/prim.h" @@ -47,7 +47,7 @@ struct UsdMayaTranslatorUtil /// the prim is transferred onto the Maya transform node. If \p context is /// non-NULL, the new Maya node will be registered to the path of /// \p usdPrim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateTransformNode( const UsdPrim& usdPrim, @@ -64,7 +64,7 @@ struct UsdMayaTranslatorUtil /// contain the \c typeName metadata of \p usdPrim, so the \c typeName will /// be applied on export. Otherwise, this attribute will be set to the /// empty string, so a typeless def will be generated on export. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateDummyTransformNode( const UsdPrim& usdPrim, @@ -78,7 +78,7 @@ struct UsdMayaTranslatorUtil /// \brief Helper to create a node for \p usdPrim of type \p /// nodeTypeName under \p parentNode. If \p context is non-NULL, /// the new Maya node will be registered to the path of \p usdPrim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateNode( const UsdPrim& usdPrim, @@ -91,7 +91,7 @@ struct UsdMayaTranslatorUtil /// \brief Helper to create a node for \p usdPath of type \p /// nodeTypeName under \p parentNode. If \p context is non-NULL, /// the new Maya node will be registered to the path of \p usdPrim. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateNode( const SdfPath& usdPath, @@ -105,7 +105,7 @@ struct UsdMayaTranslatorUtil /// nodeTypeName under \p parentNode. Note that this version does /// NOT take a context and cannot register the newly created Maya node /// since it does not know the SdfPath to an originating object. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateNode( const MString& nodeName, @@ -126,7 +126,7 @@ struct UsdMayaTranslatorUtil /// TODO: add a ShadingNodeType::Unspecified, which will make this function /// determine the type of node automatically using it's classification /// string - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool CreateShaderNode( const MString& nodeName, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorXformable.cpp b/lib/fileio/translators/translatorXformable.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/translatorXformable.cpp rename to lib/fileio/translators/translatorXformable.cpp index 07c86b5cb0..d07e287705 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorXformable.cpp +++ b/lib/fileio/translators/translatorXformable.cpp @@ -14,11 +14,11 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/translatorXformable.h" +#include "translatorXformable.h" -#include "usdMaya/translatorPrim.h" -#include "usdMaya/translatorUtil.h" -#include "usdMaya/xformStack.h" +#include "translatorPrim.h" +#include "translatorUtil.h" +#include "../utils/xformStack.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/matrix4d.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorXformable.h b/lib/fileio/translators/translatorXformable.h similarity index 91% rename from plugin/pxr/maya/lib/usdMaya/translatorXformable.h rename to lib/fileio/translators/translatorXformable.h index 882d8bb26c..52582dfe33 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorXformable.h +++ b/lib/fileio/translators/translatorXformable.h @@ -17,13 +17,13 @@ #define PXRUSDMAYA_TRANSLATOR_XFORMABLE_H #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec3d.h" #include "pxr/usd/usdGeom/xformable.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primReaderArgs.h" +#include "../primReaderContext.h" +#include "../primReaderArgs.h" #include @@ -35,7 +35,7 @@ struct UsdMayaTranslatorXformable { /// \brief reads xform attributes from \p xformable and converts them into /// maya transform values. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void Read( const UsdGeomXformable& xformable, MObject mayaNode, @@ -43,7 +43,7 @@ struct UsdMayaTranslatorXformable UsdMayaPrimReaderContext* context); /// \brief Convenince function for decomposing \p usdMatrix. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ConvertUsdMatrixToComponents( const GfMatrix4d &usdMatrix, GfVec3d *trans, diff --git a/plugin/pxr/maya/lib/usdMaya/translatorXformable_decompose.cpp b/lib/fileio/translators/translatorXformable_decompose.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/translatorXformable_decompose.cpp rename to lib/fileio/translators/translatorXformable_decompose.cpp index bf3162c3d3..98145a66f9 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorXformable_decompose.cpp +++ b/lib/fileio/translators/translatorXformable_decompose.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/translatorXformable.h" +#include "translatorXformable.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/matrix3d.h" diff --git a/plugin/pxr/maya/lib/usdMaya/adaptor.cpp b/lib/fileio/utils/adaptor.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/adaptor.cpp rename to lib/fileio/utils/adaptor.cpp index f7e42c8d1b..82ad604793 100644 --- a/plugin/pxr/maya/lib/usdMaya/adaptor.cpp +++ b/lib/fileio/utils/adaptor.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/adaptor.h" +#include "adaptor.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/readUtil.h" -#include "usdMaya/registryHelper.h" -#include -#include "usdMaya/writeUtil.h" +#include "../primWriterRegistry.h" +#include "readUtil.h" +#include "../registryHelper.h" +#include "../../utils/util.h" +#include "writeUtil.h" #include "pxr/usd/sdf/schema.h" #include "pxr/usd/usd/apiSchemaBase.h" diff --git a/plugin/pxr/maya/lib/usdMaya/adaptor.h b/lib/fileio/utils/adaptor.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/adaptor.h rename to lib/fileio/utils/adaptor.h index 1e2d476945..e3b9decd6e 100644 --- a/plugin/pxr/maya/lib/usdMaya/adaptor.h +++ b/lib/fileio/utils/adaptor.h @@ -18,7 +18,7 @@ /// \file usdMaya/adaptor.h -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/pxr.h" @@ -148,22 +148,22 @@ class UsdMayaAdaptor { SdfAttributeSpecHandle _attrDef; public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AttributeAdaptor(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AttributeAdaptor(const MPlug& plug, SdfAttributeSpecHandle attrDef); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC explicit operator bool() const; /// Gets the adaptor for the node that owns this attribute. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaAdaptor GetNodeAdaptor() const; /// Gets the name of the attribute in the bound USD schema. /// Returns the empty token if this attribute adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetName() const; /// Gets the value of the underlying Maya plug and adapts it back into @@ -189,14 +189,14 @@ class UsdMayaAdaptor { /// converted to a VtValue, or if this attribute adaptor is invalid. /// \warning Unlike UsdAttribute::Get(), this function never performs /// fallback value resolution, since Maya attributes always have values. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool Get(VtValue* value) const; /// Adapts the value to a Maya-compatible representation and sets it on /// the underlying Maya plug. Raises a coding error if the value cannot /// be adapted or is incompatible with this attribute's definition in /// the schema. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool Set(const VtValue& newValue); /// Adapts the value to a Maya-compatible representation and sets it on @@ -205,12 +205,12 @@ class UsdMayaAdaptor { /// the schema. /// \note This overload will call doIt() on the MDGModifier; thus /// any actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool Set(const VtValue& newValue, MDGModifier& modifier); /// Gets the defining spec for this attribute from the schema registry. /// Returns a null handle if this attribute adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const SdfAttributeSpecHandle GetAttributeDefinition() const; }; @@ -224,22 +224,22 @@ class UsdMayaAdaptor { SdfPrimSpecHandle _schemaDef; public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor(const MObjectHandle& object, SdfPrimSpecHandle schemaDef); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC explicit operator bool() const; /// Gets the root adaptor for the underlying Maya node. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaAdaptor GetNodeAdaptor() const; /// Gets the name of the bound schema. /// Returns the empty token if this schema adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetName() const; /// Gets the Maya attribute adaptor for the given schema attribute if it @@ -253,7 +253,7 @@ class UsdMayaAdaptor { /// already defined by the prim type), but in Maya, you must first /// use CreateAttribute() to define the attribute on the Maya node /// (since the attribute is *not* already defined anywhere in Maya). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AttributeAdaptor GetAttribute(const TfToken& attrName) const; /// Creates a Maya attribute corresponding to the given schema attribute @@ -263,7 +263,7 @@ class UsdMayaAdaptor { /// different from the USD schema attribute name for technical reasons. /// You cannot depend on the Maya attribute having a specific name; this /// is all managed internally by the attribute adaptor. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AttributeAdaptor CreateAttribute(const TfToken& attrName); /// Creates a Maya attribute corresponding to the given schema attribute @@ -275,7 +275,7 @@ class UsdMayaAdaptor { /// is all managed internally by the attribute adaptor. /// \note This overload will call doIt() on the MDGModifier; thus /// any actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC AttributeAdaptor CreateAttribute( const TfToken& attrName, MDGModifier& modifier); @@ -283,7 +283,7 @@ class UsdMayaAdaptor { /// Removes the named attribute adaptor from this Maya object. Raises a /// coding error if \p attrName does not exist on the schema, or if /// this schema adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void RemoveAttribute(const TfToken& attrName); /// Removes the named attribute adaptor from this Maya object. Raises a @@ -291,24 +291,24 @@ class UsdMayaAdaptor { /// this schema adaptor is invalid. /// \note This overload will call doIt() on the MDGModifier; thus /// any actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void RemoveAttribute(const TfToken& attrName, MDGModifier& modifier); /// Returns the names of only those schema attributes that are present /// on the Maya object, i.e., have been created via CreateAttribute(). /// Returns an empty vector if this schema adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfTokenVector GetAuthoredAttributeNames() const; /// Returns the name of all schema attributes, including those that are /// unauthored on the Maya object. /// Returns an empty vector if this schema adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfTokenVector GetAttributeNames() const; /// Gets the prim spec for this schema from the schema registry. /// Returns a null handle if this schema adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const SdfPrimSpecHandle GetSchemaDefinition() const; private: @@ -319,33 +319,33 @@ class UsdMayaAdaptor { const SdfAttributeSpecHandle& attrSpec) const; }; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaAdaptor(const MObject& obj); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC explicit operator bool() const; /// Gets the full name of the underlying Maya node. /// An empty string is returned if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::string GetMayaNodeName() const; /// Gets the corresponding USD type name for this Maya node. /// An empty token is returned if the type could not be determined. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetUsdTypeName() const; /// Gets the corresponding USD (Tf) type for this Maya node based on its /// Maya type and registered mappings from Maya to Tf type. /// An empty type is returned if the type could not be determined. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfType GetUsdType() const; /// Returns a vector containing the names of USD API schemas applied via /// adaptors on this Maya object, using the ApplySchema() or /// ApplySchemaByName() methods. /// An empty vector is returned if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfTokenVector GetAppliedSchemas() const; /// Returns a schema adaptor for this Maya object, bound to the given USD @@ -360,7 +360,7 @@ class UsdMayaAdaptor { /// Xform type inherits from Xformable. (We expect to be able to remove this /// limitation in the future.) /// \sa GetSchemaOrInheritedSchema() - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor GetSchema(const TfType& ty) const; /// Returns a schema adaptor for this Maya object, bound to the named USD @@ -375,7 +375,7 @@ class UsdMayaAdaptor { /// Xform type inherits from Xformable. (We expect to be able to remove this /// limitation in the future.) /// \sa GetSchemaOrInheritedSchema() - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor GetSchemaByName(const TfToken& schemaName) const; template @@ -401,7 +401,7 @@ class UsdMayaAdaptor { /// /// Once we are able to implement the expected polymorphic behavior for /// GetSchema() and GetSchemaByName(), this function will be deprecated. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor GetSchemaOrInheritedSchema(const TfType& ty) const; /// Applies the given API schema type on this Maya object via the adaptor @@ -411,7 +411,7 @@ class UsdMayaAdaptor { /// Raises a coding error if the type does not correspond to any known /// USD schema, or if it is not an API schema, or if it is a non-applied API /// schema, or if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor ApplySchema(const TfType& ty); /// Applies the given API schema type on this Maya object via the adaptor @@ -423,7 +423,7 @@ class UsdMayaAdaptor { /// schema, or if the adaptor is invalid. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor ApplySchema(const TfType& ty, MDGModifier& modifier); /// Applies the named API schema on this Maya object via the adaptor @@ -433,7 +433,7 @@ class UsdMayaAdaptor { /// Raises a coding error if there is no known USD schema with this name, or /// if it is not an API schema, or if it is a non-applied API schema, or if /// the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor ApplySchemaByName(const TfToken& schemaName); /// Applies the named API schema on this Maya object via the adaptor @@ -444,40 +444,40 @@ class UsdMayaAdaptor { /// if it is not an API schema, or if the adaptor is invalid. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SchemaAdaptor ApplySchemaByName( const TfToken& schemaName, MDGModifier& modifier); /// Removes the given API schema from the adaptor's apiSchemas metadata. /// Raises a coding error if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void UnapplySchema(const TfType& ty); /// Removes the given API schema from the adaptor's apiSchemas metadata. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. /// Raises a coding error if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void UnapplySchema(const TfType& ty, MDGModifier& modifier); /// Removes the named API schema from the adaptor's apiSchemas metadata. /// Raises a coding error if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void UnapplySchemaByName(const TfToken& schemaName); /// Removes the named API schema from the adaptor's apiSchemas metadata. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. /// Raises a coding error if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void UnapplySchemaByName(const TfToken& schemaName, MDGModifier& modifier); /// Returns all metadata authored via the adaptor on this Maya object. /// Only registered metadata (i.e. the metadata fields included in /// GetPrimMetadataFields()) will be returned. /// Returns an empty map if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMetadataValueMap GetAllAuthoredMetadata() const; /// Retrieves the requested metadatum if it has been authored on this Maya @@ -487,14 +487,14 @@ class UsdMayaAdaptor { /// \warning This function does not behave exactly like /// UsdObject::GetMetadata; it won't return the registered fallback value if /// the metadatum is unauthored. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetMetadata(const TfToken& key, VtValue* value) const; /// Sets the metadatum \p key's value to \p value on this Maya object, /// returning true on success. Raises a coding error if the metadata key /// is not registered, or if the value is the wrong type for the metadatum, /// or if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool SetMetadata(const TfToken& key, const VtValue& value); /// Sets the metadatum \p key's value to \p value on this Maya object, @@ -503,7 +503,7 @@ class UsdMayaAdaptor { /// or if the adaptor is invalid. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool SetMetadata( const TfToken& key, const VtValue& value, @@ -511,33 +511,33 @@ class UsdMayaAdaptor { /// Clears the authored \p key's value on this Maya object. /// Raises a coding error if the adaptor is invalid. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void ClearMetadata(const TfToken& key); /// Clears the authored \p key's value on this Maya object. /// Raises a coding error if the adaptor is invalid. /// \note This overload will call doIt() on the MDGModifier; thus any /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void ClearMetadata(const TfToken& key, MDGModifier& modifier); /// Gets the names of all prim metadata fields registered in Sdf. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static TfTokenVector GetPrimMetadataFields(); /// Gets the names of all known API schemas. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static TfToken::Set GetRegisteredAPISchemas(); /// Gets the names of all known typed schemas. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static TfToken::Set GetRegisteredTypedSchemas(); /// Registers the given Maya plugin type with a USD typed schema. /// Each Maya type is associated with only one TfType; re-registering /// the same Maya type again will overwrite the previous registration. /// However, multiple Maya types may map to the same TfType. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void RegisterTypedSchemaConversion( const std::string& nodeTypeName, const TfType& usdType); @@ -555,7 +555,7 @@ class UsdMayaAdaptor { /// cannot find any attributes with the default name or the alias names), /// it always uses the generated name. /// \sa UsdMayaAdaptor::SchemaAdaptor::CreateAttribute() - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void RegisterAttributeAlias( const TfToken& attributeName, const std::string& alias); @@ -563,7 +563,7 @@ class UsdMayaAdaptor { /// schema \p attributeName, in the order in which the aliases were /// registered. The default generated name is always the zeroth item in the /// returned vector. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static std::vector GetAttributeAliases( const TfToken& attributeName); diff --git a/plugin/pxr/maya/lib/usdMaya/meshUtil.cpp b/lib/fileio/utils/meshUtil.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/meshUtil.cpp rename to lib/fileio/utils/meshUtil.cpp index ccc51a1cf8..2becf96424 100644 --- a/plugin/pxr/maya/lib/usdMaya/meshUtil.cpp +++ b/lib/fileio/utils/meshUtil.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/meshUtil.h" +#include "meshUtil.h" -#include "usdMaya/adaptor.h" +#include "adaptor.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/meshUtil.h b/lib/fileio/utils/meshUtil.h similarity index 93% rename from plugin/pxr/maya/lib/usdMaya/meshUtil.h rename to lib/fileio/utils/meshUtil.h index 3a9293d3c7..6f5c246694 100644 --- a/plugin/pxr/maya/lib/usdMaya/meshUtil.h +++ b/lib/fileio/utils/meshUtil.h @@ -19,7 +19,7 @@ #ifndef PXRUSDMAYA_MESH_UTIL_H #define PXRUSDMAYA_MESH_UTIL_H -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/pxr.h" #include "pxr/base/gf/vec3f.h" @@ -39,7 +39,7 @@ class UsdGeomMesh; ((DisplayOpacityColorSetName, "displayOpacity")) TF_DECLARE_PUBLIC_TOKENS(UsdMayaMeshColorSetTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_MESH_COLOR_SET_TOKENS); /// Utilities for dealing with USD and RenderMan for Maya mesh/subdiv tags. @@ -47,17 +47,17 @@ namespace UsdMayaMeshUtil { /// Gets the internal emit-normals tag on the Maya \p mesh, placing it in /// \p value. Returns true if the tag exists on the mesh, and false if not. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetEmitNormalsTag(const MFnMesh &mesh, bool* value); /// Sets the internal emit-normals tag on the Maya \p mesh. /// This value indicates to the exporter whether it should write out the /// normals for the mesh to USD. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void SetEmitNormalsTag(MFnMesh &meshFn, const bool emitNormals); /// Helper method for getting Maya mesh normals as a VtVec3fArray. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetMeshNormals( const MObject& mesh, VtArray* normalsArray, @@ -66,20 +66,20 @@ namespace UsdMayaMeshUtil /// Gets the subdivision scheme tagged for the Maya mesh by consulting the /// adaptor for \c UsdGeomMesh.subdivisionSurface, and then falling back to /// the RenderMan for Maya attribute. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetSubdivScheme(const MFnMesh &mesh); /// Gets the subdivision interpolate boundary tagged for the Maya mesh by /// consulting the adaptor for \c UsdGeomMesh.interpolateBoundary, and then /// falling back to the RenderMan for Maya attribute. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetSubdivInterpBoundary(const MFnMesh &mesh); /// Gets the subdivision face-varying linear interpolation tagged for the /// Maya mesh by consulting the adaptor for /// \c UsdGeomMesh.faceVaryingLinearInterpolation, and then falling back to /// the OpenSubdiv2-style tagging. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetSubdivFVLinearInterpolation(const MFnMesh& mesh); } // namespace UsdMayaMeshUtil diff --git a/plugin/pxr/maya/lib/usdMaya/readUtil.cpp b/lib/fileio/utils/readUtil.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/readUtil.cpp rename to lib/fileio/utils/readUtil.cpp index fcb879e85f..3e7513764c 100644 --- a/plugin/pxr/maya/lib/usdMaya/readUtil.cpp +++ b/lib/fileio/utils/readUtil.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/readUtil.h" +#include "readUtil.h" -#include "usdMaya/adaptor.h" -#include -#include +#include "adaptor.h" +#include "../../utils/colorSpace.h" +#include "../../utils/util.h" #include "pxr/base/gf/gamma.h" #include "pxr/base/gf/matrix4d.h" diff --git a/plugin/pxr/maya/lib/usdMaya/readUtil.h b/lib/fileio/utils/readUtil.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/readUtil.h rename to lib/fileio/utils/readUtil.h index c170659ccf..1ad271e9a0 100644 --- a/plugin/pxr/maya/lib/usdMaya/readUtil.h +++ b/lib/fileio/utils/readUtil.h @@ -19,7 +19,7 @@ #ifndef PXRUSDMAYA_READUTIL_H #define PXRUSDMAYA_READUTIL_H -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/pxr.h" #include "pxr/usd/sdf/attributeSpec.h" @@ -43,7 +43,7 @@ struct UsdMayaReadUtil /// Returns whether the environment setting for reading Float2 types as UV /// sets is set to true - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadFloat2AsUV(); /// Given the \p typeName and \p variability, try to create a Maya attribute @@ -55,7 +55,7 @@ struct UsdMayaReadUtil /// information is conflicting, then returns null and posts a runtime error. /// If the attribute doesn't exist yet, then creates it and returns the /// attribute object. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject FindOrCreateMayaAttr( const SdfValueTypeName& typeName, const SdfVariability variability, @@ -66,7 +66,7 @@ struct UsdMayaReadUtil /// An overload of FindOrCreateMayaAttr that takes an MDGModifier. /// \note This function will call doIt() on the MDGModifier; thus the /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject FindOrCreateMayaAttr( const SdfValueTypeName& typeName, const SdfVariability variability, @@ -75,7 +75,7 @@ struct UsdMayaReadUtil const std::string& attrNiceName, MDGModifier& modifier); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject FindOrCreateMayaAttr( const TfType& type, const TfToken& role, @@ -89,7 +89,7 @@ struct UsdMayaReadUtil /// If the variability of the USD attribute doesn't match the keyable state /// of the Maya plug, then the plug's keyable state will also be updated. /// Returns true if the plug was set. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool SetMayaAttr( MPlug& attrPlug, const UsdAttribute& usdAttr); @@ -97,7 +97,7 @@ struct UsdMayaReadUtil /// Sets a Maya plug using the given VtValue. The plug keyable state won't /// be affected. /// Returns true if the plug was set. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool SetMayaAttr( MPlug& attrPlug, const VtValue& newValue); @@ -105,7 +105,7 @@ struct UsdMayaReadUtil /// An overload of SetMayaAttr that takes an MDGModifier. /// \note This function will call doIt() on the MDGModifier; thus the /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool SetMayaAttr( MPlug& attrPlug, const VtValue& newValue, @@ -113,7 +113,7 @@ struct UsdMayaReadUtil /// Sets the plug's keyable state based on whether the variability is /// varying or uniform. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void SetMayaAttrKeyableState( MPlug& attrPlug, const SdfVariability variability); @@ -121,7 +121,7 @@ struct UsdMayaReadUtil /// An overload of SetMayaAttrKeyableState that takes an MDGModifier. /// \note This function will call doIt() on the MDGModifier; thus the /// actions will have been committed when the function returns. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void SetMayaAttrKeyableState( MPlug& attrPlug, const SdfVariability variability, @@ -135,7 +135,7 @@ struct UsdMayaReadUtil /// Reads the metadata specified in \p includeMetadataKeys from \p prim, and /// uses adaptors to write them onto attributes of \p mayaObject. /// Returns true if successful (even if there was nothing to import). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMetadataFromPrim( const TfToken::Set& includeMetadataKeys, const UsdPrim& prim, @@ -146,7 +146,7 @@ struct UsdMayaReadUtil /// Returns true if successful (even if there was nothing to import). /// \note If the schema wasn't applied using the schema class's Apply() /// function, then this function won't recognize it. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadAPISchemaAttributesFromPrim( const TfToken::Set& includeAPINames, const UsdPrim& prim, diff --git a/plugin/pxr/maya/lib/usdMaya/roundTripUtil.cpp b/lib/fileio/utils/roundTripUtil.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/roundTripUtil.cpp rename to lib/fileio/utils/roundTripUtil.cpp index 8043aeffcc..8e753a4adf 100644 --- a/plugin/pxr/maya/lib/usdMaya/roundTripUtil.cpp +++ b/lib/fileio/utils/roundTripUtil.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/roundTripUtil.h" +#include "roundTripUtil.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/roundTripUtil.h b/lib/fileio/utils/roundTripUtil.h similarity index 92% rename from plugin/pxr/maya/lib/usdMaya/roundTripUtil.h rename to lib/fileio/utils/roundTripUtil.h index 8f54128796..405d9bed22 100644 --- a/plugin/pxr/maya/lib/usdMaya/roundTripUtil.h +++ b/lib/fileio/utils/roundTripUtil.h @@ -18,7 +18,7 @@ /// \file usdMaya/roundTripUtil.h -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/pxr.h" @@ -39,34 +39,34 @@ struct UsdMayaRoundTripUtil /// when importing a USD file. This just checks that there is an actual /// authored opinion and that it was not Maya generated. /// \sa IsAttributeMayaGenerated - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool IsAttributeUserAuthored(const UsdAttribute& attr); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool IsAttributeMayaGenerated(const UsdAttribute& attr); /// Annotate that an attribute was generated by Maya. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void MarkAttributeAsMayaGenerated(const UsdAttribute& attr); /// Primvars in USD are not clamped but they may have originally have been /// clamped. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool IsPrimvarClamped(const UsdGeomPrimvar& primvar); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void MarkPrimvarAsClamped(const UsdGeomPrimvar& primvar); /// If Maya attribute arrays are used, we may need to store this encoding. /// This is especially true for shading where connections are made between /// attributes inside the array. Returns true if this was marked as an /// array attribute and will set \p index. Returns false otherwise. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool GetAttributeArray( const UsdAttribute& attr, unsigned int* index); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void MarkAttributeAsArray( const UsdAttribute& attr, const unsigned int index); diff --git a/plugin/pxr/maya/lib/usdMaya/shadingUtil.cpp b/lib/fileio/utils/shadingUtil.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/shadingUtil.cpp rename to lib/fileio/utils/shadingUtil.cpp index 5b8c26b0de..1e26517644 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingUtil.cpp +++ b/lib/fileio/utils/shadingUtil.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/shadingUtil.h" +#include "shadingUtil.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/valueTypeName.h" diff --git a/plugin/pxr/maya/lib/usdMaya/shadingUtil.h b/lib/fileio/utils/shadingUtil.h similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/shadingUtil.h rename to lib/fileio/utils/shadingUtil.h index 4945137580..ba3da5310a 100644 --- a/plugin/pxr/maya/lib/usdMaya/shadingUtil.h +++ b/lib/fileio/utils/shadingUtil.h @@ -19,7 +19,7 @@ /// \file usdMaya/shadingUtil.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/valueTypeName.h" @@ -47,7 +47,7 @@ namespace UsdMayaShadingUtil /// /// Returns the material input on success, or an invalid UsdShadeInput /// otherwise. -PXRUSDMAYA_API +MAYAUSD_CORE_PUBLIC UsdShadeInput CreateMaterialInputAndConnectShader( UsdShadeMaterial& material, const TfToken& materialInputName, @@ -66,7 +66,7 @@ UsdShadeInput CreateMaterialInputAndConnectShader( /// /// Returns the shader output on success, or an invalid UsdShadeOutput /// otherwise. -PXRUSDMAYA_API +MAYAUSD_CORE_PUBLIC UsdShadeOutput CreateShaderOutputAndConnectMaterial( UsdShadeShader& shader, const TfToken& shaderOutputName, diff --git a/plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.cpp b/lib/fileio/utils/userTaggedAttribute.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.cpp rename to lib/fileio/utils/userTaggedAttribute.cpp index 49f1bc70fa..f0a5c6a39a 100644 --- a/plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.cpp +++ b/lib/fileio/utils/userTaggedAttribute.cpp @@ -14,9 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/userTaggedAttribute.h" +#include "userTaggedAttribute.h" -#include +#include "../../utils/util.h" #include "pxr/base/js/json.h" #include "pxr/base/js/value.h" diff --git a/plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.h b/lib/fileio/utils/userTaggedAttribute.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.h rename to lib/fileio/utils/userTaggedAttribute.h index be0d925ea9..dfc9eaf484 100644 --- a/plugin/pxr/maya/lib/usdMaya/userTaggedAttribute.h +++ b/lib/fileio/utils/userTaggedAttribute.h @@ -20,7 +20,7 @@ #define PXRUSDMAYA_USER_TAGGED_ATTRIBUTE_H #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/base/tf/iterator.h" #include "pxr/base/tf/token.h" @@ -43,7 +43,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_PUBLIC_TOKENS( UsdMayaUserTaggedAttributeTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_ATTR_TOKENS); @@ -69,7 +69,7 @@ class UsdMayaUserTaggedAttribute return false; }; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaUserTaggedAttribute( const MPlug& plug, const std::string& name, @@ -79,31 +79,31 @@ class UsdMayaUserTaggedAttribute GetFallbackTranslateMayaDoubleToUsdSinglePrecision()); /// \brief Gets all of the exported attributes for the given node. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static std::vector GetUserTaggedAttributesForNode(const MObject& mayaNode); /// \brief Gets the plug for the Maya attribute to be exported. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MPlug GetMayaPlug() const; /// \brief Gets the name of the Maya attribute that will be exported; /// the name will not contain the name of the node. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::string GetMayaName() const; /// \brief Gets the name of the USD attribute to which the Maya attribute /// will be exported. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::string GetUsdName() const; /// \brief Gets the type of the USD attribute to export: whether it is a /// regular attribute, primvar, etc. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetUsdType() const; /// \brief Gets the interpolation for primvars. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken GetUsdInterpolation() const; /// \brief Gets whether the attribute type should be mapped from a double @@ -120,7 +120,7 @@ class UsdMayaUserTaggedAttribute /// 'translateMayaDoubleToUsdSinglePrecision' to true so that the data is /// cast to single-precision on export. It will be up-cast back to double /// on re-import. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetTranslateMayaDoubleToUsdSinglePrecision() const; }; diff --git a/plugin/pxr/maya/lib/usdMaya/writeUtil.cpp b/lib/fileio/utils/writeUtil.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/writeUtil.cpp rename to lib/fileio/utils/writeUtil.cpp index c6a974c512..e98f9cde8a 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeUtil.cpp +++ b/lib/fileio/utils/writeUtil.cpp @@ -14,12 +14,12 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/writeUtil.h" +#include "writeUtil.h" -#include "usdMaya/adaptor.h" -#include -#include "usdMaya/translatorUtil.h" -#include "usdMaya/userTaggedAttribute.h" +#include "adaptor.h" +#include "../../utils/colorSpace.h" +#include "../translators/translatorUtil.h" +#include "userTaggedAttribute.h" #include "pxr/base/gf/gamma.h" #include "pxr/base/gf/rotation.h" diff --git a/plugin/pxr/maya/lib/usdMaya/writeUtil.h b/lib/fileio/utils/writeUtil.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/writeUtil.h rename to lib/fileio/utils/writeUtil.h index b522b039ea..cd32bdad18 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeUtil.h +++ b/lib/fileio/utils/writeUtil.h @@ -20,8 +20,8 @@ #define PXRUSDMAYA_WRITEUTIL_H #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include "usdMaya/userTaggedAttribute.h" +#include "../../base/api.h" +#include "userTaggedAttribute.h" #include "pxr/base/tf/token.h" #include "pxr/base/vt/types.h" @@ -53,14 +53,14 @@ struct UsdMayaWriteUtil /// Returns whether the environment setting for writing the TexCoord /// types is set to true - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteUVAsFloat2(); /// Get the SdfValueTypeName that corresponds to the given plug \p attrPlug. /// If \p translateMayaDoubleToUsdSinglePrecision is true, Maya plugs that /// contain double data will return the appropriate float-based type. /// Otherwise, the type returned will be the appropriate double-based type. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static SdfValueTypeName GetUsdTypeName( const MPlug& attrPlug, const bool translateMayaDoubleToUsdSinglePrecision = @@ -75,7 +75,7 @@ struct UsdMayaWriteUtil /// If \p translateMayaDoubleToUsdSinglePrecision is true, Maya plugs that /// contain double data will result in USD attributes of the appropriate /// float-based type. Otherwise, their type will be double-based. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdAttribute GetOrCreateUsdAttr( const MPlug& attrPlug, const UsdPrim& usdPrim, @@ -90,7 +90,7 @@ struct UsdMayaWriteUtil /// If \p translateMayaDoubleToUsdSinglePrecision is true, Maya plugs that /// contain double data will result in primvars of the appropriate /// float-based type. Otherwise, their type will be double-based. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdGeomPrimvar GetOrCreatePrimvar( const MPlug& attrPlug, UsdGeomImageable& imageable, @@ -106,7 +106,7 @@ struct UsdMayaWriteUtil /// If \p translateMayaDoubleToUsdSinglePrecision is true, Maya plugs that /// contain double data will result in UsdRi attributes of the appropriate /// float-based type. Otherwise, their type will be double-based. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static UsdAttribute GetOrCreateUsdRiAttribute( const MPlug& attrPlug, const UsdPrim& usdPrim, @@ -122,7 +122,7 @@ struct UsdMayaWriteUtil /// /// For type names with color roles, the value read from Maya will be /// converted to a linear color value if \p linearizeColors is true. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static VtValue GetVtValue( const MPlug& attrPlug, const SdfValueTypeName& typeName, @@ -135,7 +135,7 @@ struct UsdMayaWriteUtil /// /// For types with color roles, the value read from Maya will be converted /// to a linear color value if \p linearizeColors is true. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static VtValue GetVtValue( const MPlug& attrPlug, const TfType& type, @@ -148,7 +148,7 @@ struct UsdMayaWriteUtil /// Whether to export Maya attributes as single-precision or /// double-precision floating point is determined by consulting the type /// name of the USD attribute. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool SetUsdAttr( const MPlug& attrPlug, const UsdAttribute& usdAttr, @@ -158,7 +158,7 @@ struct UsdMayaWriteUtil /// Given a Maya node \p mayaNode, inspect it for attributes tagged by /// the user for export to USD and write them onto \p usdPrim at time /// \p usdTime. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteUserExportedAttributes( const MObject& mayaNode, const UsdPrim& usdPrim, @@ -167,7 +167,7 @@ struct UsdMayaWriteUtil /// Writes all of the adaptor metadata from \p mayaObject onto the \p prim. /// Returns true if successful (even if there was nothing to export). - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteMetadataToPrim( const MObject& mayaObject, const UsdPrim& prim); @@ -177,7 +177,7 @@ struct UsdMayaWriteUtil /// \p prim. /// Returns true if successful (even if there was nothing to export). /// \sa UsdMayaAdaptor::GetAppliedSchemas - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteAPISchemaAttributesToPrim( const MObject& mayaObject, const UsdPrim& prim, @@ -217,7 +217,7 @@ struct UsdMayaWriteUtil /// Authors class inherits on \p usdPrim. \p inheritClassNames are /// specified as names (not paths). For example, they should be /// ["_class_Special", ...]. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteClassInherits( const UsdPrim& usdPrim, const std::vector& inheritClassNames); @@ -226,7 +226,7 @@ struct UsdMayaWriteUtil /// arrays as point-instancer attributes on the given \p instancer /// schema object. /// Returns true if successful. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool WriteArrayAttrsToInstancer( MFnArrayAttrsData& inputPointsData, const UsdGeomPointInstancer& instancer, @@ -240,34 +240,34 @@ struct UsdMayaWriteUtil /// \{ /// \brief Reads attribute \p name on \p depNode into \p val. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMayaAttribute( const MFnDependencyNode& depNode, const MString& name, std::string* val); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMayaAttribute( const MFnDependencyNode& depNode, const MString& name, std::vector* val); /// \brief Reads attribute \p name on \p depNode into \p val. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMayaAttribute( const MFnDependencyNode& depNode, const MString& name, VtIntArray* val); /// \brief Reads attribute \p name on \p depNode into \p val. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMayaAttribute( const MFnDependencyNode& depNode, const MString& name, VtFloatArray* val); /// \brief Reads attribute \p name on \p depNode into \p val. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static bool ReadMayaAttribute( const MFnDependencyNode& depNode, const MString& name, @@ -296,7 +296,7 @@ struct UsdMayaWriteUtil /// This gives the time samples [1, 1.9, 3, 3.9, 5, 5.9]. /// Note that the \p subframeOffsets allows the last frame to go /// _outside_ the specified \p frameRange. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static std::vector GetTimeSamples( const GfInterval& frameRange, const std::set& subframeOffsets, diff --git a/plugin/pxr/maya/lib/usdMaya/xformStack.cpp b/lib/fileio/utils/xformStack.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/xformStack.cpp rename to lib/fileio/utils/xformStack.cpp index 73683b7dd0..72c5663fd8 100644 --- a/plugin/pxr/maya/lib/usdMaya/xformStack.cpp +++ b/lib/fileio/utils/xformStack.cpp @@ -13,7 +13,7 @@ // limitations under the License. // -#include "usdMaya/xformStack.h" +#include "xformStack.h" #include "pxr/base/tf/declarePtrs.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/lib/usdMaya/xformStack.h b/lib/fileio/utils/xformStack.h similarity index 95% rename from plugin/pxr/maya/lib/usdMaya/xformStack.h rename to lib/fileio/utils/xformStack.h index 2a1492dae1..ed44d190b4 100644 --- a/plugin/pxr/maya/lib/usdMaya/xformStack.h +++ b/lib/fileio/utils/xformStack.h @@ -17,7 +17,7 @@ #define PXRUSDMAYA_XFORM_STACK_H #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../../base/api.h" #include "pxr/base/tf/refPtr.h" #include "pxr/base/tf/token.h" #include "pxr/usd/usdGeom/xformOp.h" @@ -51,7 +51,7 @@ PXR_NAMESPACE_OPEN_SCOPE (transform) TF_DECLARE_PUBLIC_TOKENS(UsdMayaXformStackTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_XFORM_STACK_TOKENS); /// \class UsdMayaXformOpClassification @@ -71,28 +71,28 @@ class UsdMayaXformOpClassification static UsdMayaXformOpClassification const & NullInstance(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC TfToken const &GetName() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdGeomXformOp::Type GetOpType() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool IsInvertedTwin() const;; /// Return True if the given op type is compatible with this /// OpClassification (ie, is the same, or is, say rotateX, when /// this op type is rotateXYZ) - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool IsCompatibleType(UsdGeomXformOp::Type otherType) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool operator ==(const UsdMayaXformOpClassification& other) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool IsNull() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC std::vector CompatibleAttrNames() const; private: @@ -169,19 +169,19 @@ class UsdMayaXformStack explicit UsdMayaXformStack(const UsdMayaXformStack& other) = default; explicit UsdMayaXformStack(UsdMayaXformStack&& other) = default; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC OpClassList const & GetOps() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const std::vector& GetInversionTwins() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool GetNameMatters() const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaXformOpClassification const & operator[] (const size_t index) const; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC size_t GetSize() const; @@ -192,7 +192,7 @@ class UsdMayaXformStack /// the name, but has the wrong invertedTwin status, NO_INDEX is returned /// return Index to the op classification object with the given name (and /// inverted twin state); will be NO_INDEX if no match could be found. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC size_t FindOpIndex(const TfToken& opName, bool isInvertedTwin=false) const; /// \brief Finds the Op Classification with the given name in this stack @@ -204,7 +204,7 @@ class UsdMayaXformStack /// return Reference to the op classification object with the given name (and /// inverted twin state); will be a reference to OpClass::NullInstance /// if no match could be found. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const OpClass& FindOp(const TfToken& opName, bool isInvertedTwin=false) const; /// \brief Finds the indices of Op Classification(s) with the given name in this stack @@ -215,7 +215,7 @@ class UsdMayaXformStack /// not as part of an inverted twin pair, the first result will point /// to the found classification, and the second will be NO_INDEX. If /// no matches are found, both will be NO_INDEX. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const IndexPair& FindOpIndexPair(const TfToken& opName) const; /// \brief Finds the Op Classification(s) with the given name in this stack @@ -226,7 +226,7 @@ class UsdMayaXformStack /// inverted twin pair, the first result will point to the found /// classification, and the second will be OpClass::NullInstance. If /// no matches are found, both results will be OpClass::NullInstance. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC const OpClassPair FindOpPair(const TfToken& opName) const; /// \brief Returns a list of matching XformOpDefinitions for this stack @@ -240,7 +240,7 @@ class UsdMayaXformStack /// This returns a vector of the matching XformOpDefinitions in this stack. The /// size of this vector will be 0 if no complete match is found, or xformops.size() /// if a complete match is found. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC OpClassList MatchingSubstack( const std::vector& xformops) const; @@ -259,7 +259,7 @@ class UsdMayaXformStack /// shear /// scale /// scalePivot^-1 (inverted twin) - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const UsdMayaXformStack& MayaStack(); @@ -271,7 +271,7 @@ class UsdMayaXformStack /// rotate /// scale /// pivot^-1 (inverted twin) - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const UsdMayaXformStack& CommonStack(); /// \brief xform "stack" consisting of only a single matrix xform @@ -280,14 +280,14 @@ class UsdMayaXformStack /// matrix "transform" op, regardless of name. /// Consists of these xform operators: /// transform - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const UsdMayaXformStack& MatrixStack(); /// \brief Runs MatchingSubstack against the given list of stacks /// /// Returns the first non-empty result it finds; if all stacks /// return an empty vector, an empty vector is returned. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static OpClassList FirstMatchingSubstack( const std::vector& stacks, diff --git a/plugin/pxr/maya/lib/usdMaya/writeJobContext.cpp b/lib/fileio/writeJobContext.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/writeJobContext.cpp rename to lib/fileio/writeJobContext.cpp index 77364392cd..5ad4ed3ba5 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeJobContext.cpp +++ b/lib/fileio/writeJobContext.cpp @@ -14,16 +14,16 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/writeJobContext.h" - -#include "usdMaya/instancedNodeWriter.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/skelBindingsProcessor.h" -#include -#include "usdMaya/transformWriter.h" -#include +#include "writeJobContext.h" + +#include "instancedNodeWriter.h" +#include "jobs/jobArgs.h" +#include "primWriter.h" +#include "primWriterRegistry.h" +#include "translators/skelBindingsProcessor.h" +#include "../utils/stageCache.h" +#include "transformWriter.h" +#include "../utils/util.h" #include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/lib/usdMaya/writeJobContext.h b/lib/fileio/writeJobContext.h similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/writeJobContext.h rename to lib/fileio/writeJobContext.h index c0f473fbb7..132260265d 100644 --- a/plugin/pxr/maya/lib/usdMaya/writeJobContext.h +++ b/lib/fileio/writeJobContext.h @@ -18,10 +18,10 @@ /// \file usdMaya/writeJobContext.h -#include "usdMaya/api.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" +#include "../base/api.h" +#include "jobs/jobArgs.h" +#include "primWriter.h" +#include "primWriterRegistry.h" #include "pxr/pxr.h" @@ -51,10 +51,10 @@ class UsdMayaWriteJobContext protected: friend class UsdMaya_WriteJob; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaWriteJobContext(const UsdMayaJobExportArgs& args); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC ~UsdMayaWriteJobContext(); public: @@ -65,7 +65,7 @@ class UsdMayaWriteJobContext /// exportable child shape, given its hierarchy and the current path /// translation rules. (This always returns false if the export args /// don't specify merge transform/shape.) - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool IsMergedTransform(const MDagPath& path) const; /// Convert DAG paths to USD paths, taking into account the current path @@ -73,7 +73,7 @@ class UsdMayaWriteJobContext /// visibility, etc). /// Note that this does *not* take into account instancing; the returned /// path is translated as if \p dagPath were un-instanced. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC SdfPath ConvertDagToUsdPath(const MDagPath& dagPath) const; /// Creates a prim writer that writes the Maya node \p depNodeFn, excluding @@ -91,7 +91,7 @@ class UsdMayaWriteJobContext /// /// Note that you must call UsdMayaPrimWriter::Write() on the returned prim /// writer in order to author its USD attributes. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaPrimWriterSharedPtr CreatePrimWriter( const MFnDependencyNode& depNodeFn, const SdfPath& usdPath = SdfPath(), @@ -112,7 +112,7 @@ class UsdMayaWriteJobContext /// for this prototype's hierarchy will be appended to the vector. /// Note that you must call UsdMayaPrimWriter::Write() on all the returned prim /// writers in order to author their USD attributes. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void CreatePrimWriterHierarchy( const MDagPath& rootDag, const SdfPath& rootUsdPath, @@ -128,7 +128,7 @@ class UsdMayaWriteJobContext /// - UsdMayaJobExportArgsTokens->auto_: create a SkelRoot if needed /// UsdMayaJobExportArgsTokens->none is not valid for \p config; it will /// mark an invalid binding. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void MarkSkelBindings( const SdfPath& path, const SdfPath& skelPath, @@ -137,16 +137,16 @@ class UsdMayaWriteJobContext protected: /// Opens the stage with the given \p filename for writing. /// If \p append is \c true, the file must already exist. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool _OpenFile(const std::string& filename, bool append); /// Whether the current export options should traverse \p curDag and its /// descendants. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool _NeedToTraverse(const MDagPath& curDag) const; /// Perform any necessary cleanup; call this before you save the stage. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool _PostProcess(); UsdMayaJobExportArgs mArgs; diff --git a/plugin/pxr/maya/lib/usdMaya/hdImagingShape.cpp b/lib/nodes/hdImagingShape.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/hdImagingShape.cpp rename to lib/nodes/hdImagingShape.cpp index c4100f1dd6..83663938e5 100644 --- a/plugin/pxr/maya/lib/usdMaya/hdImagingShape.cpp +++ b/lib/nodes/hdImagingShape.cpp @@ -14,11 +14,11 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/hdImagingShape.h" +#include "hdImagingShape.h" -#include "usdMaya/blockSceneModificationContext.h" -#include "usdMaya/translatorUtil.h" -#include +#include "../utils/blockSceneModificationContext.h" +#include "../fileio/translators/translatorUtil.h" +#include "../utils/util.h" #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/envSetting.h" diff --git a/plugin/pxr/maya/lib/usdMaya/hdImagingShape.h b/lib/nodes/hdImagingShape.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/hdImagingShape.h rename to lib/nodes/hdImagingShape.h index bf1da84820..21170eb251 100644 --- a/plugin/pxr/maya/lib/usdMaya/hdImagingShape.h +++ b/lib/nodes/hdImagingShape.h @@ -20,8 +20,8 @@ #include "pxr/pxr.h" -#include "usdMaya/api.h" -#include +#include "../base/api.h" +#include "../utils/util.h" #include "pxr/base/tf/staticTokens.h" @@ -45,7 +45,7 @@ PXR_NAMESPACE_OPEN_SCOPE ((MayaTypeName, "pxrHdImagingShape")) TF_DECLARE_PUBLIC_TOKENS(PxrMayaHdImagingShapeTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_HD_IMAGING_SHAPE_TOKENS); @@ -60,24 +60,24 @@ class PxrMayaHdImagingShape : public MPxSurfaceShape { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MTypeId typeId; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MString typeName; // Attributes - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject selectionResolutionAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject enableDepthSelectionAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void* creator(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MStatus initialize(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static PxrMayaHdImagingShape* GetShapeAtDagPath( const MDagPath& dagPath); @@ -93,30 +93,30 @@ class PxrMayaHdImagingShape : public MPxSurfaceShape /// well and set it up such that it will *not* save into the Maya scene /// file. The nodes are also locked to prevent accidental deletion, /// re-naming, or re-parenting. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject GetOrCreateInstance(); // MPxSurfaceShape Overrides - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool isBounded() const override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MBoundingBox boundingBox() const override; // MPxNode Overrides - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void postConstructor() override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool getInternalValue( const MPlug& plug, MDataHandle& dataHandle) override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool setInternalValue( const MPlug& plug, const MDataHandle& dataHandle) override; diff --git a/plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.cpp b/lib/nodes/pointBasedDeformerNode.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.cpp rename to lib/nodes/pointBasedDeformerNode.cpp index f1c5e40b57..b9a07eccde 100644 --- a/plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.cpp +++ b/lib/nodes/pointBasedDeformerNode.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/pointBasedDeformerNode.h" +#include "pointBasedDeformerNode.h" -#include +#include "stageData.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/vec3f.h" diff --git a/plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.h b/lib/nodes/pointBasedDeformerNode.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.h rename to lib/nodes/pointBasedDeformerNode.h index f8916da441..211279508a 100644 --- a/plugin/pxr/maya/lib/usdMaya/pointBasedDeformerNode.h +++ b/lib/nodes/pointBasedDeformerNode.h @@ -18,7 +18,7 @@ /// \file usdMaya/pointBasedDeformerNode.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" @@ -41,7 +41,7 @@ PXR_NAMESPACE_OPEN_SCOPE ((MayaTypeName, "pxrUsdPointBasedDeformerNode")) TF_DECLARE_PUBLIC_TOKENS(UsdMayaPointBasedDeformerNodeTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_POINT_BASED_DEFORMER_NODE_TOKENS); @@ -58,27 +58,27 @@ TF_DECLARE_PUBLIC_TOKENS(UsdMayaPointBasedDeformerNodeTokens, class UsdMayaPointBasedDeformerNode : public MPxDeformerNode { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MTypeId typeId; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MString typeName; // Attributes - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject inUsdStageAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject primPathAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject timeAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void* creator(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MStatus initialize(); // MPxGeometryFilter overrides - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MStatus deform( MDataBlock& block, MItGeometry& iter, diff --git a/lib/nodes/proxyShapePlugin.cpp b/lib/nodes/proxyShapePlugin.cpp index c3ef612f1b..da4323a2c4 100644 --- a/lib/nodes/proxyShapePlugin.cpp +++ b/lib/nodes/proxyShapePlugin.cpp @@ -15,10 +15,15 @@ // #include "proxyShapePlugin.h" +#include "../render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h" +#include "../render/pxrUsdMayaGL/hdImagingShapeUI.h" +#include "../render/pxrUsdMayaGL/proxyDrawOverride.h" +#include "../render/pxrUsdMayaGL/proxyShapeUI.h" #include "../render/vp2RenderDelegate/proxyRenderDelegate.h" #include "../render/vp2ShaderFragments/shaderFragments.h" #include "stageData.h" +#include "hdImagingShape.h" #include "proxyShapeBase.h" #include "pxr/base/tf/envSetting.h" @@ -76,11 +81,45 @@ MayaUsdProxyShapePlugin::initialize(MFnPlugin& plugin) getProxyShapeClassification()); CHECK_MSTATUS(status); + // Hybrid Hydra / VP2 rendering uses a draw override to draw the proxy + // shape. The Pixar and MayaUsd plugins use the UsdMayaProxyDrawOverride, + // so register it here. Native USD VP2 rendering uses a sub-scene override. + if (_useVP2RenderDelegate) { status = MHWRender::MDrawRegistry::registerSubSceneOverrideCreator( ProxyRenderDelegate::drawDbClassification, _RegistrantId, ProxyRenderDelegate::Creator); CHECK_MSTATUS(status); + } else { + status = MHWRender::MDrawRegistry::registerDrawOverrideCreator( + UsdMayaProxyDrawOverride::drawDbClassification, + _RegistrantId, + UsdMayaProxyDrawOverride::Creator); + CHECK_MSTATUS(status); + + status = plugin.registerDisplayFilter( + MayaUsdProxyShapeBase::displayFilterName, + MayaUsdProxyShapeBase::displayFilterLabel, + UsdMayaProxyDrawOverride::drawDbClassification); + CHECK_MSTATUS(status); + + // Hybrid Hydra / VP2 rendering uses the PxrMayaHdImagingShape for draw + // aggregation of all proxy shapes. + status = plugin.registerShape( + PxrMayaHdImagingShape::typeName, + PxrMayaHdImagingShape::typeId, + PxrMayaHdImagingShape::creator, + PxrMayaHdImagingShape::initialize, + PxrMayaHdImagingShapeUI::creator, + &PxrMayaHdImagingShapeDrawOverride::drawDbClassification); + CHECK_MSTATUS(status); + + status = MHWRender::MDrawRegistry::registerDrawOverrideCreator( + PxrMayaHdImagingShapeDrawOverride::drawDbClassification, + _RegistrantId, + PxrMayaHdImagingShapeDrawOverride::creator); + CHECK_MSTATUS(status); + } status = HdVP2ShaderFragments::registerFragments(); CHECK_MSTATUS(status); @@ -110,10 +149,31 @@ MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin) MStatus status = HdVP2ShaderFragments::deregisterFragments(); CHECK_MSTATUS(status); + if (_useVP2RenderDelegate) { status = MHWRender::MDrawRegistry::deregisterSubSceneOverrideCreator( ProxyRenderDelegate::drawDbClassification, _RegistrantId); CHECK_MSTATUS(status); + } + else + { + status = plugin.deregisterDisplayFilter( + MayaUsdProxyShapeBase::displayFilterName); + CHECK_MSTATUS(status); + + status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator( + UsdMayaProxyDrawOverride::drawDbClassification, + _RegistrantId); + CHECK_MSTATUS(status); + + status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator( + PxrMayaHdImagingShapeDrawOverride::drawDbClassification, + _RegistrantId); + CHECK_MSTATUS(status); + + status = plugin.deregisterNode(PxrMayaHdImagingShape::typeId); + CHECK_MSTATUS(status); + } status = plugin.deregisterNode(MayaUsdProxyShapeBase::typeId); CHECK_MSTATUS(status); @@ -127,7 +187,7 @@ MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin) const MString* MayaUsdProxyShapePlugin::getProxyShapeClassification() { return _useVP2RenderDelegate ? &ProxyRenderDelegate::drawDbClassification : - nullptr; + &UsdMayaProxyDrawOverride::drawDbClassification; } bool MayaUsdProxyShapePlugin::useVP2_NativeUSD_Rendering() diff --git a/plugin/pxr/maya/lib/usdMaya/stageNode.cpp b/lib/nodes/stageNode.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/stageNode.cpp rename to lib/nodes/stageNode.cpp index 9c544eb492..53df5bd390 100644 --- a/plugin/pxr/maya/lib/usdMaya/stageNode.cpp +++ b/lib/nodes/stageNode.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/stageNode.h" +#include "stageNode.h" -#include -#include +#include "../utils/stageCache.h" +#include "stageData.h" #include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/lib/usdMaya/stageNode.h b/lib/nodes/stageNode.h similarity index 90% rename from plugin/pxr/maya/lib/usdMaya/stageNode.h rename to lib/nodes/stageNode.h index f170b54d25..aeb929d9a4 100644 --- a/plugin/pxr/maya/lib/usdMaya/stageNode.h +++ b/lib/nodes/stageNode.h @@ -18,7 +18,7 @@ /// \file usdMaya/stageNode.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" @@ -40,7 +40,7 @@ PXR_NAMESPACE_OPEN_SCOPE ((MayaTypeName, "pxrUsdStageNode")) TF_DECLARE_PUBLIC_TOKENS(UsdMayaStageNodeTokens, - PXRUSDMAYA_API, + MAYAUSD_CORE_PUBLIC, PXRUSDMAYA_STAGE_NODE_TOKENS); @@ -57,25 +57,25 @@ TF_DECLARE_PUBLIC_TOKENS(UsdMayaStageNodeTokens, class UsdMayaStageNode : public MPxNode { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MTypeId typeId; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static const MString typeName; // Attributes - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject filePathAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MObject outUsdStageAttr; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void* creator(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MStatus initialize(); // MPxNode overrides - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MStatus compute(const MPlug& plug, MDataBlock& dataBlock) override; private: diff --git a/lib/python/module.cpp b/lib/python/module.cpp new file mode 100644 index 0000000000..8c1c56423c --- /dev/null +++ b/lib/python/module.cpp @@ -0,0 +1,34 @@ +// +// Copyright 2019 Autodesk +// +// 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. +// +#include "pxr/pxr.h" +#include "pxr/base/tf/pyModule.h" + +PXR_NAMESPACE_USING_DIRECTIVE + +TF_WRAP_MODULE { + TF_WRAP(Adaptor); + TF_WRAP(BlockSceneModificationContext); + TF_WRAP(ColorSpace); + TF_WRAP(DiagnosticDelegate); + TF_WRAP(MeshUtil); + TF_WRAP(Query); + TF_WRAP(ReadUtil); + TF_WRAP(RoundTripUtil); + TF_WRAP(StageCache); + TF_WRAP(UserTaggedAttribute); + TF_WRAP(WriteUtil); + TF_WRAP(XformStack); +} diff --git a/plugin/pxr/maya/lib/usdMaya/wrapAdaptor.cpp b/lib/python/wrapAdaptor.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/wrapAdaptor.cpp rename to lib/python/wrapAdaptor.cpp index a7aa6f51ec..3e8f992d45 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapAdaptor.cpp +++ b/lib/python/wrapAdaptor.cpp @@ -15,8 +15,8 @@ // #include "pxr/pxr.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/undoHelperCommand.h" +#include +#include #include #include "pxr/base/tf/pyResultConversions.h" diff --git a/plugin/pxr/maya/lib/usdMaya/wrapBlockSceneModificationContext.cpp b/lib/python/wrapBlockSceneModificationContext.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/wrapBlockSceneModificationContext.cpp rename to lib/python/wrapBlockSceneModificationContext.cpp index 2fb0bb6e1d..fe3fd6dadb 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapBlockSceneModificationContext.cpp +++ b/lib/python/wrapBlockSceneModificationContext.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/blockSceneModificationContext.h" +#include #include diff --git a/plugin/pxr/maya/lib/usdMaya/wrapColorSpace.cpp b/lib/python/wrapColorSpace.cpp similarity index 100% rename from plugin/pxr/maya/lib/usdMaya/wrapColorSpace.cpp rename to lib/python/wrapColorSpace.cpp diff --git a/plugin/pxr/maya/lib/usdMaya/wrapDiagnosticDelegate.cpp b/lib/python/wrapDiagnosticDelegate.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/wrapDiagnosticDelegate.cpp rename to lib/python/wrapDiagnosticDelegate.cpp index 15ef1837e1..f15663ced9 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapDiagnosticDelegate.cpp +++ b/lib/python/wrapDiagnosticDelegate.cpp @@ -15,7 +15,7 @@ // #include "pxr/pxr.h" -#include "usdMaya/diagnosticDelegate.h" +#include #include #include diff --git a/plugin/pxr/maya/lib/usdMaya/wrapMeshUtil.cpp b/lib/python/wrapMeshUtil.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/wrapMeshUtil.cpp rename to lib/python/wrapMeshUtil.cpp index af6a8f7049..e5b77b718c 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapMeshUtil.cpp +++ b/lib/python/wrapMeshUtil.cpp @@ -15,7 +15,7 @@ // #include "pxr/pxr.h" -#include "usdMaya/meshUtil.h" +#include #include #include "pxr/base/gf/vec3f.h" diff --git a/plugin/pxr/maya/lib/usdMaya/wrapQuery.cpp b/lib/python/wrapQuery.cpp similarity index 100% rename from plugin/pxr/maya/lib/usdMaya/wrapQuery.cpp rename to lib/python/wrapQuery.cpp diff --git a/plugin/pxr/maya/lib/usdMaya/wrapReadUtil.cpp b/lib/python/wrapReadUtil.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/wrapReadUtil.cpp rename to lib/python/wrapReadUtil.cpp index 00575a19aa..6db3bb06df 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapReadUtil.cpp +++ b/lib/python/wrapReadUtil.cpp @@ -16,7 +16,7 @@ #include "pxr/pxr.h" #include -#include "usdMaya/readUtil.h" +#include #include "pxr/base/tf/pyResultConversions.h" #include "pxr/usd/usd/attribute.h" diff --git a/plugin/pxr/maya/lib/usdMaya/wrapRoundTripUtil.cpp b/lib/python/wrapRoundTripUtil.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/wrapRoundTripUtil.cpp rename to lib/python/wrapRoundTripUtil.cpp index 76b5a681c2..3a4994d8a2 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapRoundTripUtil.cpp +++ b/lib/python/wrapRoundTripUtil.cpp @@ -15,7 +15,7 @@ // #include "pxr/pxr.h" -#include "usdMaya/roundTripUtil.h" +#include #include "pxr/usd/usdGeom/primvar.h" #include "pxr/usd/usd/attribute.h" diff --git a/plugin/pxr/maya/lib/usdMaya/wrapStageCache.cpp b/lib/python/wrapStageCache.cpp similarity index 100% rename from plugin/pxr/maya/lib/usdMaya/wrapStageCache.cpp rename to lib/python/wrapStageCache.cpp diff --git a/plugin/pxr/maya/lib/usdMaya/wrapUserTaggedAttribute.cpp b/lib/python/wrapUserTaggedAttribute.cpp similarity index 98% rename from plugin/pxr/maya/lib/usdMaya/wrapUserTaggedAttribute.cpp rename to lib/python/wrapUserTaggedAttribute.cpp index f46f32fef2..5f9c78fe50 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapUserTaggedAttribute.cpp +++ b/lib/python/wrapUserTaggedAttribute.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/userTaggedAttribute.h" +#include #include diff --git a/plugin/pxr/maya/lib/usdMaya/wrapWriteUtil.cpp b/lib/python/wrapWriteUtil.cpp similarity index 97% rename from plugin/pxr/maya/lib/usdMaya/wrapWriteUtil.cpp rename to lib/python/wrapWriteUtil.cpp index b188719206..9c2003499e 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapWriteUtil.cpp +++ b/lib/python/wrapWriteUtil.cpp @@ -16,7 +16,7 @@ #include "pxr/pxr.h" #include -#include "usdMaya/writeUtil.h" +#include #include "pxr/base/tf/pyResultConversions.h" #include "pxr/usd/usd/attribute.h" diff --git a/plugin/pxr/maya/lib/usdMaya/wrapXformStack.cpp b/lib/python/wrapXformStack.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/wrapXformStack.cpp rename to lib/python/wrapXformStack.cpp index b7e4ac62b2..f0388d4d73 100644 --- a/plugin/pxr/maya/lib/usdMaya/wrapXformStack.cpp +++ b/lib/python/wrapXformStack.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/xformStack.h" +#include "../fileio/utils/xformStack.h" #include "pxr/base/tf/pyContainerConversions.h" #include "pxr/base/tf/pyEnum.h" diff --git a/plugin/pxr/maya/lib/px_vp20/glslProgram.cpp b/lib/render/px_vp20/glslProgram.cpp similarity index 99% rename from plugin/pxr/maya/lib/px_vp20/glslProgram.cpp rename to lib/render/px_vp20/glslProgram.cpp index a46de8fa43..790bcd27ad 100644 --- a/plugin/pxr/maya/lib/px_vp20/glslProgram.cpp +++ b/lib/render/px_vp20/glslProgram.cpp @@ -17,7 +17,7 @@ // glew must be included before any other GL header. #include "pxr/imaging/glf/glew.h" -#include "px_vp20/glslProgram.h" +#include "./glslProgram.h" #include "pxr/pxr.h" #include "pxr/base/tf/diagnostic.h" diff --git a/plugin/pxr/maya/lib/px_vp20/glslProgram.h b/lib/render/px_vp20/glslProgram.h similarity index 90% rename from plugin/pxr/maya/lib/px_vp20/glslProgram.h rename to lib/render/px_vp20/glslProgram.h index f621270e61..78c4780690 100644 --- a/plugin/pxr/maya/lib/px_vp20/glslProgram.h +++ b/lib/render/px_vp20/glslProgram.h @@ -21,7 +21,7 @@ #define __PX_VP20_GLSL_PROGRAM_H__ #include "pxr/pxr.h" -#include "px_vp20/api.h" +#include "../../base/api.h" #include "pxr/imaging/garch/gl.h" #include @@ -38,21 +38,21 @@ PXR_NAMESPACE_OPEN_SCOPE class PxrMayaGLSLProgram { public: - PX_VP20_API + MAYAUSD_CORE_PUBLIC PxrMayaGLSLProgram(); - PX_VP20_API + MAYAUSD_CORE_PUBLIC virtual ~PxrMayaGLSLProgram(); /// Compile a shader of type \p type with the given \p source. - PX_VP20_API + MAYAUSD_CORE_PUBLIC bool CompileShader(const GLenum type, const std::string& source); /// Link the compiled shaders together. - PX_VP20_API + MAYAUSD_CORE_PUBLIC bool Link(); /// Validate whether this program is valid in the current context. - PX_VP20_API + MAYAUSD_CORE_PUBLIC bool Validate() const; /// Get the ID of the OpenGL program object. diff --git a/plugin/pxr/maya/lib/px_vp20/utils.cpp b/lib/render/px_vp20/utils.cpp similarity index 99% rename from plugin/pxr/maya/lib/px_vp20/utils.cpp rename to lib/render/px_vp20/utils.cpp index fbf9749b61..9dcef5240e 100644 --- a/plugin/pxr/maya/lib/px_vp20/utils.cpp +++ b/lib/render/px_vp20/utils.cpp @@ -16,9 +16,9 @@ // glew must be included before any other GL header. #include "pxr/imaging/glf/glew.h" -#include "px_vp20/utils.h" +#include "./utils.h" -#include "px_vp20/glslProgram.h" +#include "./glslProgram.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/matrix4d.h" diff --git a/plugin/pxr/maya/lib/px_vp20/utils.h b/lib/render/px_vp20/utils.h similarity index 93% rename from plugin/pxr/maya/lib/px_vp20/utils.h rename to lib/render/px_vp20/utils.h index 51dcf6b792..f783f20846 100644 --- a/plugin/pxr/maya/lib/px_vp20/utils.h +++ b/lib/render/px_vp20/utils.h @@ -19,7 +19,7 @@ /// \file px_vp20/utils.h #include "pxr/pxr.h" -#include "px_vp20/api.h" +#include "../../base/api.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/matrix4f.h" @@ -43,13 +43,13 @@ class px_vp20Utils { public: /// Take VP2.0 lighting information and import it into opengl lights - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool setupLightingGL(const MHWRender::MDrawContext& context); - PX_VP20_API + MAYAUSD_CORE_PUBLIC static void unsetLightingGL(const MHWRender::MDrawContext& context); /// Translate a Maya MDrawContext into a GlfSimpleLightingContext. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static GlfSimpleLightingContextRefPtr GetLightingContextFromDrawContext( const MHWRender::MDrawContext& context); @@ -59,13 +59,13 @@ class px_vp20Utils /// returned in the \p view parameter. /// Returns false if there's not a 3D viewport (e.g. we're drawing into /// a render view). - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool GetViewFromDrawContext( const MHWRender::MDrawContext& context, M3dView& view); /// Renders the given bounding box in the given \p color via OpenGL. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool RenderBoundingBox( const MBoundingBox& bounds, const GfVec4f& color, @@ -76,7 +76,7 @@ class px_vp20Utils /// list of transforms to apply to the unit cube centered around the /// origin. Those transforms will all be concatenated with the /// \p worldViewMat and \p projectionMat. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool RenderWireCubes( const std::vector& cubeXforms, const GfVec4f& color, @@ -85,7 +85,7 @@ class px_vp20Utils /// Gets the view and projection matrices based on a particular /// selection in the given draw context. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool GetSelectionMatrices( const MHWRender::MSelectionInfo& selectionInfo, const MHWRender::MDrawContext& context, @@ -97,14 +97,14 @@ class px_vp20Utils /// /// \p displayStyle should be a bitwise combination of /// MHWRender::MFrameContext::DisplayStyle values. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static void OutputDisplayStyleToStream( const unsigned int displayStyle, std::ostream& stream); /// Outputs a human-readable form of the given \p displayStatus to /// \p stream for debugging. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static void OutputDisplayStatusToStream( const MHWRender::DisplayStatus displayStatus, std::ostream& stream); diff --git a/plugin/pxr/maya/lib/px_vp20/utils_legacy.cpp b/lib/render/px_vp20/utils_legacy.cpp similarity index 98% rename from plugin/pxr/maya/lib/px_vp20/utils_legacy.cpp rename to lib/render/px_vp20/utils_legacy.cpp index 74d07000fe..86dc958a8b 100644 --- a/plugin/pxr/maya/lib/px_vp20/utils_legacy.cpp +++ b/lib/render/px_vp20/utils_legacy.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "px_vp20/utils_legacy.h" +#include "./utils_legacy.h" #include "pxr/base/gf/matrix4d.h" diff --git a/plugin/pxr/maya/lib/px_vp20/utils_legacy.h b/lib/render/px_vp20/utils_legacy.h similarity index 96% rename from plugin/pxr/maya/lib/px_vp20/utils_legacy.h rename to lib/render/px_vp20/utils_legacy.h index 1363404503..a9e448ffb5 100644 --- a/plugin/pxr/maya/lib/px_vp20/utils_legacy.h +++ b/lib/render/px_vp20/utils_legacy.h @@ -19,7 +19,7 @@ /// \file px_vp20/utils_legacy.h #include "pxr/pxr.h" -#include "px_vp20/api.h" +#include "../../base/api.h" #include "pxr/base/gf/matrix4d.h" @@ -36,7 +36,7 @@ class px_LegacyViewportUtils public: /// Get the view and projection matrices used for selection from the /// given selection context in MSelectInfo \p selectInfo. - PX_VP20_API + MAYAUSD_CORE_PUBLIC static bool GetSelectionMatrices( MSelectInfo& selectInfo, GfMatrix4d& viewMatrix, diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.cpp b/lib/render/pxrUsdMayaGL/batchRenderer.cpp similarity index 99% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.cpp rename to lib/render/pxrUsdMayaGL/batchRenderer.cpp index 9b369e83f1..407f811844 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.cpp +++ b/lib/render/pxrUsdMayaGL/batchRenderer.cpp @@ -18,16 +18,12 @@ #include "pxr/imaging/glf/glew.h" #include "pxr/pxr.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/sceneDelegate.h" -#include "pxrUsdMayaGL/shapeAdapter.h" -#include "pxrUsdMayaGL/softSelectHelper.h" -#include "pxrUsdMayaGL/userData.h" - -#include "px_vp20/utils.h" -#include "px_vp20/utils_legacy.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./userData.h" + +#include "../px_vp20/utils.h" +#include "../px_vp20/utils_legacy.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec2i.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.h b/lib/render/pxrUsdMayaGL/batchRenderer.h similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.h rename to lib/render/pxrUsdMayaGL/batchRenderer.h index 2dd285241b..c93b906d9b 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/batchRenderer.h +++ b/lib/render/pxrUsdMayaGL/batchRenderer.h @@ -19,14 +19,14 @@ /// \file pxrUsdMayaGL/batchRenderer.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/sceneDelegate.h" -#include "pxrUsdMayaGL/shapeAdapter.h" -#include "pxrUsdMayaGL/softSelectHelper.h" -#include "usdMaya/diagnosticDelegate.h" -#include -#include +#include "../../base/api.h" +#include "./renderParams.h" +#include "./sceneDelegate.h" +#include "./shapeAdapter.h" +#include "./softSelectHelper.h" +#include "../../utils/diagnosticDelegate.h" +#include "../../listeners/notice.h" +#include "../../utils/util.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec2i.h" @@ -93,18 +93,18 @@ class UsdMayaGLBatchRenderer /// /// This should be called at least once and it is OK to call it multiple /// times. This handles things like initializing OpenGL/Glew. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void Init(); /// Get the singleton instance of the batch renderer. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static UsdMayaGLBatchRenderer& GetInstance(); /// Get the render index owned by the batch renderer. /// /// Clients of the batch renderer should use this render index to construct /// their delegates. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC HdRenderIndex* GetRenderIndex() const; /// Get the delegate ID prefix for the specified viewport. @@ -114,21 +114,21 @@ class UsdMayaGLBatchRenderer /// the legacy viewport or for Viewport 2.0. Shape adapters should use this /// method to request the appropriate prefix from the batch renderer when /// building the ID for their delegate. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC SdfPath GetDelegatePrefix(const bool isViewport2) const; /// Add the given shape adapter for batched rendering and selection. /// /// Returns true if the shape adapter had not been previously added, or /// false otherwise. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool AddShapeAdapter(PxrMayaHdShapeAdapter* shapeAdapter); /// Remove the given shape adapter from batched rendering and selection. /// /// Returns true if the shape adapter was removed from internal caches, or /// false otherwise. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool RemoveShapeAdapter(PxrMayaHdShapeAdapter* shapeAdapter); /// Reset the internal state of the global UsdMayaGLBatchRenderer. @@ -137,7 +137,7 @@ class UsdMayaGLBatchRenderer /// Maya scene so that any UsdImagingDelegates held by shape adapters that /// have been populated with USD stages can have those stages released, /// since the delegates hold a strong pointer to their stages. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void Reset(); /// Replaces the contents of the given \p primFilter with \p dagPath, if @@ -153,17 +153,17 @@ class UsdMayaGLBatchRenderer /// Note that the VP2 shape adapters are searched first, followed by the /// Legacy shape adapters. You cannot rely on the shape adapters being /// associated with a specific viewport. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool PopulateCustomPrimFilter( const MDagPath& dagPath, PxrMayaHdPrimFilter& primFilter); /// Render batch or bounding box in the legacy viewport based on \p request - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void Draw(const MDrawRequest& request, M3dView& view); /// Render batch or bounding box in Viewport 2.0 based on \p userData - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void Draw( const MHWRender::MDrawContext& context, const MUserData* userData); @@ -171,7 +171,7 @@ class UsdMayaGLBatchRenderer /// Gets the resolution of the draw target used for computing selections. /// /// The resolution is specified as (width, height). - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC GfVec2i GetSelectionResolution() const; /// Sets the resolution of the draw target used for computing selections. @@ -181,15 +181,15 @@ class UsdMayaGLBatchRenderer /// Smaller values yield better performance but may miss selecting very /// small objects. Larger values will be slower but more accurate. The /// default resolution is (256, 256) for performance. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetSelectionResolution(const GfVec2i& widthHeight); /// Gets whether depth selection has been enabled. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool IsDepthSelectionEnabled() const; /// Sets whether to enable depth selection. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetDepthSelectionEnabled(const bool enabled); /// Tests the object from the given shape adapter for intersection with @@ -201,7 +201,7 @@ class UsdMayaGLBatchRenderer /// The returned HitSet is owned by the batch renderer, and it will be /// erased at the next selection, so clients should make copies if they /// need the data to persist. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC const HdxPickHitVector* TestIntersection( const PxrMayaHdShapeAdapter* shapeAdapter, MSelectInfo& selectInfo); @@ -215,7 +215,7 @@ class UsdMayaGLBatchRenderer /// The returned HitSet is owned by the batch renderer, and it will be /// erased at the next selection, so clients should make copies if they /// need the data to persist. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC const HdxPickHitVector* TestIntersection( const PxrMayaHdShapeAdapter* shapeAdapter, const MHWRender::MSelectionInfo& selectionInfo, @@ -230,7 +230,7 @@ class UsdMayaGLBatchRenderer /// /// If hit(s) are found, returns \c true and populates \p *outResult with /// the intersection result. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool TestIntersectionCustomPrimFilter( const PxrMayaHdPrimFilter& primFilter, const GfMatrix4d& viewMatrix, @@ -242,41 +242,41 @@ class UsdMayaGLBatchRenderer /// /// If \p hitSet is nullptr or is empty, nullptr is returned. Otherwise a /// pointer to the nearest hit in \p hitSet is returned. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static const HdxPickHit* GetNearestHit( const HdxPickHitVector* hitSet); /// Returns the index within the point instancer for \c hit. /// /// Returns -1 if unable to get the instanceIndex. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC int GetInstancerIndexForHit(const HdxPickHit& hit) const; /// Returns whether soft selection for proxy shapes is currently enabled. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC inline bool GetObjectSoftSelectEnabled() { return _objectSoftSelectEnabled; } /// Starts batching all diagnostics until the end of the current frame draw. /// The batch renderer will automatically release the diagnostics when Maya /// is done rendering the frame. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void StartBatchingFrameDiagnostics(); private: friend class TfSingleton; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC UsdMayaGLBatchRenderer(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual ~UsdMayaGLBatchRenderer(); /// Gets the UsdMayaGLSoftSelectHelper that this batchRenderer maintains. /// /// This should only be used by PxrMayaHdShapeAdapter. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC const UsdMayaGLSoftSelectHelper& GetSoftSelectHelper(); /// Allow shape adapters access to the soft selection helper. @@ -482,7 +482,7 @@ class UsdMayaGLBatchRenderer std::unique_ptr _sharedDiagBatchCtx; }; -PXRUSDMAYAGL_API_TEMPLATE_CLASS(TfSingleton); +MAYAUSD_TEMPLATE_CLASS(TfSingleton); PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/debugCodes.cpp b/lib/render/pxrUsdMayaGL/debugCodes.cpp similarity index 97% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/debugCodes.cpp rename to lib/render/pxrUsdMayaGL/debugCodes.cpp index 4a7b671593..24c53c119c 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/debugCodes.cpp +++ b/lib/render/pxrUsdMayaGL/debugCodes.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/debugCodes.h" +#include "./debugCodes.h" #include "pxr/pxr.h" #include "pxr/base/tf/debug.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/debugCodes.h b/lib/render/pxrUsdMayaGL/debugCodes.h similarity index 100% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/debugCodes.h rename to lib/render/pxrUsdMayaGL/debugCodes.h diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp b/lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp similarity index 96% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp rename to lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp index a1762bbc98..f48dda1e16 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp +++ b/lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp @@ -14,14 +14,14 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdMayaGL/hdImagingShapeDrawOverride.h" +#include "./hdImagingShapeDrawOverride.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/instancerImager.h" -#include "pxrUsdMayaGL/userData.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./instancerImager.h" +#include "./userData.h" -#include "usdMaya/hdImagingShape.h" +#include "../../nodes/hdImagingShape.h" #include "pxr/base/gf/vec2i.h" #include "pxr/base/tf/debug.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.h b/lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h similarity index 91% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.h rename to lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h index b38a59fbe4..7f69ffbf39 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeDrawOverride.h +++ b/lib/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h @@ -19,7 +19,7 @@ /// \file pxrUsdMayaGL/hdImagingShapeDrawOverride.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include #include @@ -52,44 +52,44 @@ class PxrMayaHdImagingShapeDrawOverride : public MHWRender::MPxDrawOverride { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static const MString drawDbClassification; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static MHWRender::MPxDrawOverride* creator(const MObject& obj); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC ~PxrMayaHdImagingShapeDrawOverride() override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MHWRender::DrawAPI supportedDrawAPIs() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MMatrix transform( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MBoundingBox boundingBox( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool isBounded( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool disableInternalBoundingBoxDraw() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MUserData* prepareForDraw( const MDagPath& objPath, const MDagPath& cameraPath, const MHWRender::MFrameContext& frameContext, MUserData* oldData) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void draw( const MHWRender::MDrawContext& context, const MUserData* data); diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.cpp b/lib/render/pxrUsdMayaGL/hdImagingShapeUI.cpp similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.cpp rename to lib/render/pxrUsdMayaGL/hdImagingShapeUI.cpp index a84e7e8d4d..af80bbc90a 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.cpp +++ b/lib/render/pxrUsdMayaGL/hdImagingShapeUI.cpp @@ -14,14 +14,14 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdMayaGL/hdImagingShapeUI.h" +#include "./hdImagingShapeUI.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/instancerImager.h" -#include "pxrUsdMayaGL/userData.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./instancerImager.h" +#include "./userData.h" -#include "usdMaya/hdImagingShape.h" +#include "../../nodes/hdImagingShape.h" #include "pxr/base/gf/vec2i.h" #include "pxr/base/tf/debug.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.h b/lib/render/pxrUsdMayaGL/hdImagingShapeUI.h similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.h rename to lib/render/pxrUsdMayaGL/hdImagingShapeUI.h index 736c051ee4..53c67cea90 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdImagingShapeUI.h +++ b/lib/render/pxrUsdMayaGL/hdImagingShapeUI.h @@ -19,7 +19,7 @@ /// \file pxrUsdMayaGL/hdImagingShapeUI.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" // XXX: On Linux, some Maya headers (notably M3dView.h) end up indirectly // including X11/Xlib.h, which #define's "Bool" as int. This can cause @@ -49,16 +49,16 @@ class PxrMayaHdImagingShapeUI : public MPxSurfaceShapeUI { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void* creator(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void getDrawRequests( const MDrawInfo& drawInfo, bool objectAndActiveOnly, MDrawRequestQueue& requests) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void draw(const MDrawRequest& request, M3dView& view) const override; private: diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.cpp b/lib/render/pxrUsdMayaGL/hdRenderer.cpp similarity index 99% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.cpp rename to lib/render/pxrUsdMayaGL/hdRenderer.cpp index 153870af75..5a163a195b 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.cpp +++ b/lib/render/pxrUsdMayaGL/hdRenderer.cpp @@ -22,9 +22,9 @@ // gl.h #include "pxr/imaging/glf/glew.h" -#include "pxrUsdMayaGL/hdRenderer.h" -#include "px_vp20/utils.h" -#include "px_vp20/utils_legacy.h" +#include "./hdRenderer.h" +#include "../px_vp20/utils.h" +#include "../px_vp20/utils_legacy.h" #include #include diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.h b/lib/render/pxrUsdMayaGL/hdRenderer.h similarity index 96% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.h rename to lib/render/pxrUsdMayaGL/hdRenderer.h index a555bf642e..82ec386b14 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/hdRenderer.h +++ b/lib/render/pxrUsdMayaGL/hdRenderer.h @@ -19,7 +19,7 @@ /// \file pxrUsdMayaGL/hdRenderer.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include "pxr/base/gf/vec3d.h" #include "pxr/base/gf/vec4f.h" @@ -114,14 +114,14 @@ class UsdMayaGLHdRenderer /// \brief Should be called when the prim to \p usdPrim to draw or \p /// excludePaths change - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void CheckRendererSetup( const UsdPrim& usdPrim, const SdfPathVector& excludePaths); /// \brief Generate an array of draw requests based on the selection status /// of \c objPath - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void GenerateDefaultVp2DrawRequests( const MDagPath& objPath, const MHWRender::MFrameContext& frameContext, @@ -131,7 +131,7 @@ class UsdMayaGLHdRenderer /// /// This function overrides some of the members of \p params, in particular, /// the \c drawMode. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void Render( const MDrawRequest& aRequest, M3dView& aView, @@ -142,14 +142,14 @@ class UsdMayaGLHdRenderer /// This function assumes that you have already set your desired values for /// \c complexity \c shotGuides and \c showRenderGuides members of /// \p params - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void RenderVp2( const RequestDataArray &requests, const MHWRender::MDrawContext& context, UsdImagingGLRenderParams params) const; /// \brief Test for intersection, for use in \c select(). - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool TestIntersection( MSelectInfo& selectInfo, UsdImagingGLRenderParams params, @@ -157,7 +157,7 @@ class UsdMayaGLHdRenderer /// \brief Helper function to convert from \p subdLevel (int) into Hydra's /// \p complexity parameter (\p float) - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static float SubdLevelToComplexity(int subdLevel); private: diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.cpp b/lib/render/pxrUsdMayaGL/instancerImager.cpp similarity index 90% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.cpp rename to lib/render/pxrUsdMayaGL/instancerImager.cpp index a2d48b6874..0078e7aee9 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.cpp +++ b/lib/render/pxrUsdMayaGL/instancerImager.cpp @@ -13,13 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/instancerImager.h" +#include "./instancerImager.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" -#include "usdMaya/hdImagingShape.h" -#include "usdMaya/referenceAssembly.h" +#include "../../nodes/hdImagingShape.h" #include "pxr/base/tf/instantiateSingleton.h" @@ -34,6 +33,12 @@ PXR_NAMESPACE_OPEN_SCOPE TF_INSTANTIATE_SINGLETON(UsdMayaGL_InstancerImager); +UsdMayaGL_InstancerImager::ContinueTrackingOnDisconnectDelegate +UsdMayaGL_InstancerImager::_continueTrackingOnDisconnectDelegate = nullptr; + +UsdMayaGL_InstancerImager::InstancerShapeAdapterFactory +UsdMayaGL_InstancerImager::_instancerShapeAdapterFactory = nullptr; + /* static */ UsdMayaGL_InstancerImager& UsdMayaGL_InstancerImager::GetInstance() @@ -95,7 +100,7 @@ UsdMayaGL_InstancerImager::_SyncShapeAdapters( std::unique_ptr& adapter = entry.adapterVp2; if (!adapter) { - adapter.reset(new UsdMayaGL_InstancerShapeAdapter()); + adapter.reset(CreateInstancerShapeAdapter()); } if (adapter->Sync( @@ -110,7 +115,7 @@ UsdMayaGL_InstancerImager::_SyncShapeAdapters( std::unique_ptr& adapter = entry.adapterLegacy; if (!adapter) { - adapter.reset(new UsdMayaGL_InstancerShapeAdapter()); + adapter.reset(CreateInstancerShapeAdapter()); } if (adapter->Sync( @@ -382,9 +387,8 @@ UsdMayaGL_InstancerImager::_OnDisconnection( continue; } - if (sourceNode.typeId() == UsdMayaReferenceAssembly::typeId) { - // There's at least one USD reference assembly still connected to - // this point instancer, so continue tracking the instancer node. + if (ContinueTrackingOnDisconnect(sourceNode)) { + // Continue tracking the instancer node. return; } } @@ -414,14 +418,40 @@ UsdMayaGL_InstancerImager::~UsdMayaGL_InstancerImager() _instancers.size()); } -UsdMayaGL_InstancerImager::_InstancerEntry::~_InstancerEntry() +void UsdMayaGL_InstancerImager::SetContinueTrackingOnDisconnectDelegate( + ContinueTrackingOnDisconnectDelegate delegate) { - MMessage::removeCallbacks(callbacks); + _continueTrackingOnDisconnectDelegate = delegate; } -TF_REGISTRY_FUNCTION(UsdMayaReferenceAssembly) +bool UsdMayaGL_InstancerImager::ContinueTrackingOnDisconnect( + const MFnDependencyNode& fn +) { - TfSingleton::GetInstance(); + if (!_continueTrackingOnDisconnectDelegate) { + return false; + } + return _continueTrackingOnDisconnectDelegate(fn); +} + +void UsdMayaGL_InstancerImager::SetInstancerShapeAdapterFactory( + InstancerShapeAdapterFactory factory) +{ + _instancerShapeAdapterFactory = factory; +} + +UsdMayaGL_InstancerShapeAdapter* +UsdMayaGL_InstancerImager::CreateInstancerShapeAdapter() +{ + if (!_instancerShapeAdapterFactory) { + return new UsdMayaGL_InstancerShapeAdapter(); + } + return _instancerShapeAdapterFactory(); +} + +UsdMayaGL_InstancerImager::_InstancerEntry::~_InstancerEntry() +{ + MMessage::removeCallbacks(callbacks); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.h b/lib/render/pxrUsdMayaGL/instancerImager.h similarity index 79% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.h rename to lib/render/pxrUsdMayaGL/instancerImager.h index d244179240..67e6653e69 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerImager.h +++ b/lib/render/pxrUsdMayaGL/instancerImager.h @@ -18,17 +18,20 @@ /// \file pxrUsdMayaGL/instancerImager.h -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/instancerShapeAdapter.h" +#include "../../base/api.h" +#include "./instancerShapeAdapter.h" #include "pxr/base/tf/singleton.h" #include "pxr/base/tf/weakBase.h" -#include -#include +#include "../../listeners/notice.h" +#include "../../utils/util.h" #include #include +#include + +#include PXR_NAMESPACE_OPEN_SCOPE @@ -42,6 +45,7 @@ PXR_NAMESPACE_OPEN_SCOPE /// gets drawn by the draw override. class UsdMayaGL_InstancerImager : public TfWeakBase { public: + MAYAUSD_CORE_PUBLIC static UsdMayaGL_InstancerImager& GetInstance(); /// Sync all dirty instancer shape adapters for Viewport 2.0. @@ -60,6 +64,22 @@ class UsdMayaGL_InstancerImager : public TfWeakBase { /// Legacy Viewport adapters. void RemoveShapeAdapters(bool vp2); + /// Delegate function for returning whether we should continue tracking the + /// instancer node on disconnect. + typedef std::function ContinueTrackingOnDisconnectDelegate; + + MAYAUSD_CORE_PUBLIC + static void SetContinueTrackingOnDisconnectDelegate( + ContinueTrackingOnDisconnectDelegate delegate); + + /// Factory function for creating instancer shape adapters. + typedef std::function InstancerShapeAdapterFactory; + + /// Set the factory function for creating instancer shape adapters. + MAYAUSD_CORE_PUBLIC + static void SetInstancerShapeAdapterFactory( + InstancerShapeAdapterFactory factory); + private: /// Helper struct that owns all the data needed to track and draw a /// particular instancer node. @@ -151,10 +171,23 @@ class UsdMayaGL_InstancerImager : public TfWeakBase { /// @} + // Invoke the delegate, if present, else return false. + static bool ContinueTrackingOnDisconnect(const MFnDependencyNode&); + + /// Invoke the factory function for creating instancer shape adapters. If + /// no factory has been set, returns a UsdMayaGL_InstancerShapeAdapter base + /// class object. The caller must manage the lifescope of the returned + /// object. + static UsdMayaGL_InstancerShapeAdapter* CreateInstancerShapeAdapter(); + UsdMayaGL_InstancerImager(); ~UsdMayaGL_InstancerImager(); friend class TfSingleton; + + static ContinueTrackingOnDisconnectDelegate _continueTrackingOnDisconnectDelegate; + + static InstancerShapeAdapterFactory _instancerShapeAdapterFactory; }; PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.cpp b/lib/render/pxrUsdMayaGL/instancerShapeAdapter.cpp similarity index 79% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.cpp rename to lib/render/pxrUsdMayaGL/instancerShapeAdapter.cpp index c9592508df..38ea86254e 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.cpp +++ b/lib/render/pxrUsdMayaGL/instancerShapeAdapter.cpp @@ -13,16 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/instancerShapeAdapter.h" +#include "./instancerShapeAdapter.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/shapeAdapter.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./renderParams.h" +#include "./shapeAdapter.h" -#include "usdMaya/referenceAssembly.h" -#include -#include "usdMaya/writeUtil.h" +#include "../../utils/util.h" +#include "../../fileio/utils/writeUtil.h" #include "pxr/base/gf/vec4f.h" #include "pxr/base/gf/matrix4d.h" @@ -168,90 +167,8 @@ UsdMayaGL_InstancerShapeAdapter::_SyncInstancerPrototypes( UsdModelAPI(prototypePrim).SetKind(KindTokens->component); usdInstancer.GetPrototypesRel().AddTarget(prototypeUsdPath); - UsdReferences prototypeRefs = prototypePrim.GetReferences(); - prototypeRefs.ClearReferences(); - - // Collect data about what prototype this is. - MPlug hierarchyPlug = inputHierarchy[i]; - MPlug source = UsdMayaUtil::GetConnected(hierarchyPlug); - if (source.isNull()) { - continue; - } - - MStatus status; - MFnDependencyNode sourceNode(source.node(), &status); - if (!status) { - continue; - } - - // If this is a non-full-representation USD reference assembly, add a - // reference. Otherwise, leave the prim empty. - if (sourceNode.typeId() != UsdMayaReferenceAssembly::typeId) { - continue; - } - - UsdMayaReferenceAssembly* usdRefAssem = - dynamic_cast( - sourceNode.userNode()); - if (!usdRefAssem) { - continue; - } - - if (usdRefAssem->getActive() == - UsdMayaRepresentationFull::_assemblyType) { - continue; - } - - UsdPrim prim = usdRefAssem->usdPrim(); - if (!prim) { - continue; - } - - // Add main reference data. - const std::string& layerId = - prim.GetStage()->GetRootLayer()->GetIdentifier(); - const SdfPath primPath = prim.GetPath(); - prototypeRefs.AddReference(SdfReference(layerId, primPath)); - - // Reference session data. - // We also mute any sublayers of the session layer, because those - // correspond to assembly edits generated by UsdMayaReferenceAssembly, - // and UsdMayaReferenceAssembly won't give us the assembly edits - // consistently between different representations. - // (Most session layers won't have sublayers; they only show up when - // there's assembly edits in Collapsed/Expanded representations.) - // XXX Handle assembly edits on instancer prototypes? - if (SdfLayerHandle sessionLayer = prim.GetStage()->GetSessionLayer()) { - if (sessionLayer->GetPrimAtPath(primPath)) { - prototypeRefs.AddReference( - SdfReference(sessionLayer->GetIdentifier(), primPath), - UsdListPositionFrontOfPrependList); - const SdfSubLayerProxy subLayers = - sessionLayer->GetSubLayerPaths(); - layerIdsToMute.insert( - layerIdsToMute.end(), - subLayers.begin(), - subLayers.end()); - } - } - - // Also handles instancerTranslate. - // These are all in "physical", not "logical" indices. - auto holder = UsdMayaUtil::GetPlugDataHandle(hierarchyPlug); - MMatrix mMat = MFnMatrixData(holder->GetDataHandle().data()).matrix(); - GfMatrix4d gfMat(mMat.matrix); - - MPlug translatePlug = sourceNode.findPlug("translate", &status); - if (status) { - // OK if we didn't find plug, assume instancerTranslate is zero. - GfVec3d tr(translatePlug.child(0).asDouble(), - translatePlug.child(1).asDouble(), - translatePlug.child(2).asDouble()); - gfMat = gfMat * GfMatrix4d().SetTranslate(-tr); - } - - UsdGeomXformable xformable(prototypePrim); - xformable.MakeMatrixXform().Set(gfMat); + SyncInstancerPerPrototypePostHook( + inputHierarchy[i], prototypePrim, layerIdsToMute); } // Actually do all the muting in a batch. @@ -484,6 +401,17 @@ UsdMayaGL_InstancerShapeAdapter::_Init(HdRenderIndex* renderIndex) return true; } +/* virtual */ +void UsdMayaGL_InstancerShapeAdapter::SyncInstancerPerPrototypePostHook( + const MPlug& , + UsdPrim& prototypePrim, + std::vector& +) +{ + UsdReferences prototypeRefs = prototypePrim.GetReferences(); + prototypeRefs.ClearReferences(); +} + UsdMayaGL_InstancerShapeAdapter::UsdMayaGL_InstancerShapeAdapter() { TF_DEBUG(PXRUSDMAYAGL_SHAPE_ADAPTER_LIFECYCLE).Msg( diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.h b/lib/render/pxrUsdMayaGL/instancerShapeAdapter.h similarity index 87% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.h rename to lib/render/pxrUsdMayaGL/instancerShapeAdapter.h index 1d8f45ef30..3c09b9ae2b 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/instancerShapeAdapter.h +++ b/lib/render/pxrUsdMayaGL/instancerShapeAdapter.h @@ -18,8 +18,8 @@ /// \file pxrUsdMayaGL/instancerShapeAdapter.h -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/shapeAdapter.h" +#include "../../base/api.h" +#include "./shapeAdapter.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/imaging/hd/renderIndex.h" @@ -59,19 +59,24 @@ class UsdMayaGL_InstancerShapeAdapter : public PxrMayaHdShapeAdapter /// /// Returns true if the visibility state was changed, or false /// otherwise. + MAYAUSD_CORE_PUBLIC bool UpdateVisibility(const M3dView* view = nullptr) override; /// Gets whether the shape adapter's shape is visible. /// /// This should be called after a call to UpdateVisibility() to ensure /// that the returned value is correct. + MAYAUSD_CORE_PUBLIC bool IsVisible() const override; + MAYAUSD_CORE_PUBLIC void SetRootXform(const GfMatrix4d& transform) override; + MAYAUSD_CORE_PUBLIC const SdfPath& GetDelegateID() const override; - ~UsdMayaGL_InstancerShapeAdapter() override; + MAYAUSD_CORE_PUBLIC + ~UsdMayaGL_InstancerShapeAdapter() override; protected: @@ -83,6 +88,7 @@ class UsdMayaGL_InstancerShapeAdapter : public PxrMayaHdShapeAdapter /// legacy viewport and Viewport 2.0. The legacy viewport Sync() method /// "promotes" the display state parameters to their Viewport 2.0 /// equivalents before calling this method. + MAYAUSD_CORE_PUBLIC bool _Sync( const MDagPath& shapeDagPath, const unsigned int displayStyle, @@ -92,8 +98,18 @@ class UsdMayaGL_InstancerShapeAdapter : public PxrMayaHdShapeAdapter /// /// Note that only friends of this class are able to construct /// instances of this class. + MAYAUSD_CORE_PUBLIC UsdMayaGL_InstancerShapeAdapter(); + // Derived class hook to allow derived classes to augment + // _SyncInstancerPrototypes(), for each prototype. The implementation + // in this class clears references on the argument prototypePrim. + virtual void SyncInstancerPerPrototypePostHook( + const MPlug& hierarchyPlug, + UsdPrim& prototypePrim, + std::vector& layerIdsToMute + ); + private: /// Initialize the shape adapter using the given \p renderIndex. diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.cpp b/lib/render/pxrUsdMayaGL/proxyDrawOverride.cpp similarity index 96% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.cpp rename to lib/render/pxrUsdMayaGL/proxyDrawOverride.cpp index 4238986b21..bc64f9e159 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.cpp +++ b/lib/render/pxrUsdMayaGL/proxyDrawOverride.cpp @@ -14,15 +14,15 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdMayaGL/proxyDrawOverride.h" +#include "./proxyDrawOverride.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/usdProxyShapeAdapter.h" +#include "./batchRenderer.h" +#include "./renderParams.h" +#include "./usdProxyShapeAdapter.h" -#include "px_vp20/utils.h" +#include "../px_vp20/utils.h" -#include "usdMaya/proxyShape.h" +#include "../../nodes/proxyShapeBase.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec3f.h" @@ -50,7 +50,7 @@ PXR_NAMESPACE_OPEN_SCOPE const MString UsdMayaProxyDrawOverride::drawDbClassification( TfStringPrintf("drawdb/geometry/pxrUsdMayaGL/%s", - UsdMayaProxyShapeTokens->MayaTypeName.GetText()).c_str()); + MayaUsdProxyShapeBaseTokens->MayaTypeName.GetText()).c_str()); /* static */ MHWRender::MPxDrawOverride* @@ -249,7 +249,7 @@ UsdMayaProxyDrawOverride::userSelect( M3dView view; const bool hasView = px_vp20Utils::GetViewFromDrawContext(context, view); if (hasView && - !view.pluginObjectDisplay(UsdMayaProxyShape::displayFilterName)) { + !view.pluginObjectDisplay(MayaUsdProxyShapeBase::displayFilterName)) { return false; } diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.h b/lib/render/pxrUsdMayaGL/proxyDrawOverride.h similarity index 87% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.h rename to lib/render/pxrUsdMayaGL/proxyDrawOverride.h index d6ca96fe55..67c71ab827 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyDrawOverride.h +++ b/lib/render/pxrUsdMayaGL/proxyDrawOverride.h @@ -19,8 +19,8 @@ /// \file pxrUsdMayaGL/proxyDrawOverride.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/usdProxyShapeAdapter.h" +#include "../../base/api.h" +#include "./usdProxyShapeAdapter.h" #include #include @@ -42,37 +42,37 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static const MString drawDbClassification; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static MHWRender::MPxDrawOverride* Creator(const MObject& obj); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC ~UsdMayaProxyDrawOverride() override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MHWRender::DrawAPI supportedDrawAPIs() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MMatrix transform( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MBoundingBox boundingBox( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool isBounded( const MDagPath& objPath, const MDagPath& cameraPath) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool disableInternalBoundingBoxDraw() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC MUserData* prepareForDraw( const MDagPath& objPath, const MDagPath& cameraPath, @@ -80,10 +80,10 @@ class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride MUserData* oldData) override; #if MAYA_API_VERSION >= 20180000 - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool wantUserSelection() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool userSelect( MHWRender::MSelectionInfo& selectionInfo, const MHWRender::MDrawContext& context, @@ -91,7 +91,7 @@ class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride const MUserData* data) override; #endif - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void draw( const MHWRender::MDrawContext& context, const MUserData* data); diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeDelegate.cpp b/lib/render/pxrUsdMayaGL/proxyShapeDelegate.cpp similarity index 86% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeDelegate.cpp rename to lib/render/pxrUsdMayaGL/proxyShapeDelegate.cpp index e7ed73052a..97ecc01817 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeDelegate.cpp +++ b/lib/render/pxrUsdMayaGL/proxyShapeDelegate.cpp @@ -16,9 +16,9 @@ #include "pxr/imaging/glf/glew.h" // This header must absolutely come first. -#include "pxrUsdMayaGL/batchRenderer.h" +#include "./batchRenderer.h" -#include "usdMaya/proxyShape.h" +#include "../../nodes/proxyShapeBase.h" #include "pxr/base/gf/rotation.h" #include "pxr/base/gf/frustum.h" @@ -44,7 +44,7 @@ static PxrMayaHdPrimFilter _sharedPrimFilter = { TfTokenVector() // Render Tags }; -/// Delegate for computing a ray intersection against a UsdMayaProxyShape by +/// Delegate for computing a ray intersection against a MayaUsdProxyShapeBase by /// rendering using Hydra via the UsdMayaGLBatchRenderer. bool UsdMayaGL_ClosestPointOnProxyShape( @@ -124,23 +124,10 @@ UsdMayaGL_ClosestPointOnProxyShape( return true; } -/// Delegate for returning whether object soft-select mode is currently on -/// Technically, we could make ProxyShape track this itself, but then that would -/// be making two callbacks to track the same thing... so we use BatchRenderer -/// implementation -bool -UsdMayaGL_ObjectSoftSelectEnabled() -{ - return UsdMayaGLBatchRenderer::GetInstance().GetObjectSoftSelectEnabled(); -} - - -TF_REGISTRY_FUNCTION(UsdMayaProxyShape) +TF_REGISTRY_FUNCTION(MayaUsdProxyShapeBase) { MayaUsdProxyShapeBase::SetClosestPointDelegate( UsdMayaGL_ClosestPointOnProxyShape); - UsdMayaProxyShape::SetObjectSoftSelectEnabledDelegate( - UsdMayaGL_ObjectSoftSelectEnabled); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.cpp b/lib/render/pxrUsdMayaGL/proxyShapeUI.cpp similarity index 92% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.cpp rename to lib/render/pxrUsdMayaGL/proxyShapeUI.cpp index 840f0442a0..61dc3aedc8 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.cpp +++ b/lib/render/pxrUsdMayaGL/proxyShapeUI.cpp @@ -14,12 +14,12 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdMayaGL/proxyShapeUI.h" +#include "./proxyShapeUI.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/usdProxyShapeAdapter.h" -#include "usdMaya/proxyShape.h" +#include "./batchRenderer.h" +#include "./renderParams.h" +#include "./usdProxyShapeAdapter.h" +#include "../../nodes/proxyShapeBase.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/gf/vec4f.h" @@ -107,7 +107,7 @@ UsdMayaProxyShapeUI::getDrawRequests( void UsdMayaProxyShapeUI::draw(const MDrawRequest& request, M3dView& view) const { - if (!view.pluginObjectDisplay(UsdMayaProxyShape::displayFilterName)) { + if (!view.pluginObjectDisplay(MayaUsdProxyShapeBase::displayFilterName)) { return; } @@ -131,7 +131,7 @@ UsdMayaProxyShapeUI::select( { M3dView view = selectInfo.view(); - if (!view.pluginObjectDisplay(UsdMayaProxyShape::displayFilterName)) { + if (!view.pluginObjectDisplay(MayaUsdProxyShapeBase::displayFilterName)) { return false; } @@ -145,7 +145,7 @@ UsdMayaProxyShapeUI::select( // Note that we cannot use MayaUsdProxyShapeBase::GetShapeAtDagPath() here. // selectInfo.selectPath() returns the dag path to the assembly node, not // the shape node, so we don't have the shape node's path readily available. - UsdMayaProxyShape* shape = static_cast(surfaceShape()); + MayaUsdProxyShapeBase* shape = static_cast(surfaceShape()); if (!shape) { return false; } @@ -200,7 +200,7 @@ UsdMayaProxyShapeUI::UsdMayaProxyShapeUI() : MPxSurfaceShapeUI() MStatus status; _onNodeRemovedCallbackId = MDGMessage::addNodeRemovedCallback( _OnNodeRemoved, - UsdMayaProxyShapeTokens->MayaTypeName.GetText(), + MayaUsdProxyShapeBaseTokens->MayaTypeName.GetText(), this, &status); CHECK_MSTATUS(status); diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.h b/lib/render/pxrUsdMayaGL/proxyShapeUI.h similarity index 94% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.h rename to lib/render/pxrUsdMayaGL/proxyShapeUI.h index 7b964d89f4..36f3ee9d16 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/proxyShapeUI.h +++ b/lib/render/pxrUsdMayaGL/proxyShapeUI.h @@ -19,8 +19,8 @@ /// \file pxrUsdMayaGL/proxyShapeUI.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/usdProxyShapeAdapter.h" +#include "../../base/api.h" +#include "./usdProxyShapeAdapter.h" #include #include @@ -41,21 +41,21 @@ class UsdMayaProxyShapeUI : public MPxSurfaceShapeUI { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC static void* creator(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void getDrawRequests( const MDrawInfo& drawInfo, bool objectAndActiveOnly, MDrawRequestQueue& requests) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void draw( const MDrawRequest& request, M3dView& view) const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool select( MSelectInfo& selectInfo, MSelectionList& selectionList, diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/renderParams.h b/lib/render/pxrUsdMayaGL/renderParams.h similarity index 98% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/renderParams.h rename to lib/render/pxrUsdMayaGL/renderParams.h index 483c6dd7d8..a13537e7e0 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/renderParams.h +++ b/lib/render/pxrUsdMayaGL/renderParams.h @@ -20,7 +20,7 @@ #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include "pxr/base/gf/vec4f.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.cpp b/lib/render/pxrUsdMayaGL/sceneDelegate.cpp similarity index 99% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.cpp rename to lib/render/pxrUsdMayaGL/sceneDelegate.cpp index c4ff50cf82..fad136dd32 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.cpp +++ b/lib/render/pxrUsdMayaGL/sceneDelegate.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/sceneDelegate.h" +#include "./sceneDelegate.h" #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/renderParams.h" +#include "../../base/api.h" +#include "./renderParams.h" -#include "px_vp20/utils.h" +#include "../px_vp20/utils.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec2f.h" @@ -193,7 +193,6 @@ PxrMayaHdSceneDelegate::GetCameraParamValue( return Get(cameraId, paramName); } -PXRUSDMAYAGL_API TfTokenVector PxrMayaHdSceneDelegate::GetTaskRenderTags(SdfPath const& taskId) { diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.h b/lib/render/pxrUsdMayaGL/sceneDelegate.h similarity index 93% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.h rename to lib/render/pxrUsdMayaGL/sceneDelegate.h index 47f887d2dc..2a6a7427f9 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/sceneDelegate.h +++ b/lib/render/pxrUsdMayaGL/sceneDelegate.h @@ -20,8 +20,8 @@ #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/renderParams.h" +#include "../../base/api.h" +#include "./renderParams.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec4d.h" @@ -54,55 +54,55 @@ using PxrMayaHdPrimFilterVector = std::vector; class PxrMayaHdSceneDelegate : public HdSceneDelegate { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC PxrMayaHdSceneDelegate( HdRenderIndex* renderIndex, const SdfPath& delegateID); // HdSceneDelegate interface - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC VtValue Get(const SdfPath& id, const TfToken& key) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC VtValue GetCameraParamValue( SdfPath const& cameraId, TfToken const& paramName) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC TfTokenVector GetTaskRenderTags(SdfPath const& taskId) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetCameraState( const GfMatrix4d& worldToViewMatrix, const GfMatrix4d& projectionMatrix, const GfVec4d& viewport); // VP 1.0 only. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetLightingStateFromVP1( const GfMatrix4d& worldToViewMatrix, const GfMatrix4d& projectionMatrix); // VP 2.0 only. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetLightingStateFromMayaDrawContext( const MHWRender::MDrawContext& context); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC HdTaskSharedPtrVector GetSetupTasks(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC HdTaskSharedPtrVector GetRenderTasks( const size_t hash, const PxrMayaHdRenderParams& renderParams, const PxrMayaHdPrimFilterVector& primFilters); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC HdTaskSharedPtrVector GetPickingTasks( const TfTokenVector& renderTags); protected: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void _SetLightingStateFromLightingContext(); template diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.cpp b/lib/render/pxrUsdMayaGL/shapeAdapter.cpp similarity index 98% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.cpp rename to lib/render/pxrUsdMayaGL/shapeAdapter.cpp index 4051d5faa7..8bee32e0a1 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.cpp +++ b/lib/render/pxrUsdMayaGL/shapeAdapter.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/shapeAdapter.h" +#include "./shapeAdapter.h" #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/softSelectHelper.h" -#include "pxrUsdMayaGL/userData.h" +#include "../../base/api.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./renderParams.h" +#include "./softSelectHelper.h" +#include "./userData.h" #include "pxr/base/gf/gamma.h" #include "pxr/base/gf/matrix4d.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.h b/lib/render/pxrUsdMayaGL/shapeAdapter.h similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.h rename to lib/render/pxrUsdMayaGL/shapeAdapter.h index a5d973f547..da53ef5ef5 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/shapeAdapter.h +++ b/lib/render/pxrUsdMayaGL/shapeAdapter.h @@ -20,9 +20,9 @@ #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/userData.h" +#include "../../base/api.h" +#include "./renderParams.h" +#include "./userData.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/tf/token.h" @@ -60,7 +60,7 @@ class PxrMayaHdShapeAdapter /// Update the shape adapter's state from the shape with the given /// \p shapeDagPath and the legacy viewport display state. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool Sync( const MDagPath& shapeDagPath, const M3dView::DisplayStyle legacyDisplayStyle, @@ -68,7 +68,7 @@ class PxrMayaHdShapeAdapter /// Update the shape adapter's state from the shape with the given /// \p shapeDagPath and the Viewport 2.0 display state. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool Sync( const MDagPath& shapeDagPath, const unsigned int displayStyle, @@ -89,14 +89,14 @@ class PxrMayaHdShapeAdapter /// /// Returns true if the visibility state was changed, or false /// otherwise. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool UpdateVisibility(const M3dView* view = nullptr); /// Gets whether the shape adapter's shape is visible. /// /// This should be called after a call to UpdateVisibility() to ensure /// that the returned value is correct. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool IsVisible() const; /// Get the Maya user data object for drawing in the legacy viewport. @@ -108,7 +108,7 @@ class PxrMayaHdShapeAdapter /// \p boundingBox may be set to nullptr if no box is desired to be /// drawn. /// - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual void GetMayaUserData( MPxSurfaceShapeUI* shapeUI, MDrawRequest& drawRequest, @@ -132,7 +132,7 @@ class PxrMayaHdShapeAdapter /// the given parameters if oldData is nullptr (or not an instance of /// PxrMayaHdUserData), otherwise returns oldData after having /// re-populated it. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual PxrMayaHdUserData* GetMayaUserData( MUserData* oldData, const MBoundingBox* boundingBox = nullptr); @@ -155,7 +155,7 @@ class PxrMayaHdShapeAdapter /// /// If there is no corresponding HdReprSelector for the given display /// state, an empty HdReprSelector is returned. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual HdReprSelector GetReprSelectorForDisplayState( const unsigned int displayStyle, const MHWRender::DisplayStatus displayStatus) const; @@ -164,12 +164,12 @@ class PxrMayaHdShapeAdapter /// /// Sets \p drawShape and \p drawBoundingBox depending on whether shape /// and/or bounding box rendering is indicated from the state. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual PxrMayaHdRenderParams GetRenderParams( bool* drawShape, bool* drawBoundingBox) const; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual const HdRprimCollection& GetRprimCollection() const; /// Retrieves the render tags for this shape. I.e. which @@ -178,20 +178,20 @@ class PxrMayaHdShapeAdapter /// This function just returns the _renderTags attribute and it /// is expected each subclass update the attribute in _Sync() or /// overrides this function if it needs special processing. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual const TfTokenVector& GetRenderTags() const; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual const GfMatrix4d& GetRootXform() const; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual void SetRootXform(const GfMatrix4d& transform); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual const SdfPath& GetDelegateID() const; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual const MDagPath& GetDagPath() const; /// Get whether this shape adapter is for use with Viewport 2.0. @@ -202,7 +202,7 @@ class PxrMayaHdShapeAdapter /// Returns true if the shape adapter should be used for batched /// drawing/selection in Viewport 2.0, or false if it should be used /// in the legacy viewport. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool IsViewport2() const; protected: @@ -215,7 +215,7 @@ class PxrMayaHdShapeAdapter /// legacy viewport and Viewport 2.0. The legacy viewport Sync() method /// "promotes" the display state parameters to their Viewport 2.0 /// equivalents before calling this method. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual bool _Sync( const MDagPath& shapeDagPath, const unsigned int displayStyle, @@ -232,7 +232,7 @@ class PxrMayaHdShapeAdapter /// Returns a TfToken collection name that is unique to the shape and /// is a valid SdfPath identifier, or an empty TfToken is there is an /// error. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual TfToken _GetRprimCollectionName() const; /// Helper for getting the wireframe color of the shape. @@ -271,10 +271,10 @@ class PxrMayaHdShapeAdapter bool* visibility); /// Construct a new uninitialized PxrMayaHdShapeAdapter. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC PxrMayaHdShapeAdapter(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC virtual ~PxrMayaHdShapeAdapter(); MDagPath _shapeDagPath; diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.cpp b/lib/render/pxrUsdMayaGL/softSelectHelper.cpp similarity index 98% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.cpp rename to lib/render/pxrUsdMayaGL/softSelectHelper.cpp index bd45ccbf24..e476b61605 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.cpp +++ b/lib/render/pxrUsdMayaGL/softSelectHelper.cpp @@ -15,7 +15,7 @@ // #include "pxr/pxr.h" -#include "pxrUsdMayaGL/softSelectHelper.h" +#include "./softSelectHelper.h" #include "pxr/base/tf/stl.h" diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.h b/lib/render/pxrUsdMayaGL/softSelectHelper.h similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.h rename to lib/render/pxrUsdMayaGL/softSelectHelper.h index 9928cb7149..b8c72241b8 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/softSelectHelper.h +++ b/lib/render/pxrUsdMayaGL/softSelectHelper.h @@ -19,7 +19,7 @@ /// \file pxrUsdMayaGL/softSelectHelper.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include "pxr/base/tf/hash.h" @@ -49,15 +49,15 @@ PXR_NAMESPACE_OPEN_SCOPE class UsdMayaGLSoftSelectHelper { public: - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC UsdMayaGLSoftSelectHelper(); /// \brief Clears the saved soft selection state. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void Reset(); /// \brief Repopulates soft selection state - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void Populate(); /// \brief Returns true if \p dagPath is in the softSelection. Also returns @@ -65,14 +65,14 @@ class UsdMayaGLSoftSelectHelper /// /// NOTE: until MAYA-73448 (and MAYA-73513) is fixed, the \p weight value is /// arbitrary. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool GetWeight(const MDagPath& dagPath, float* weight) const; /// \brief Returns true if \p dagPath is in the softSelection. Also returns /// the appropriate color based on the distance/weight and the current soft /// select color curve. It will currently always return (0, 0, 1) at the /// moment. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool GetFalloffColor(const MDagPath& dagPath, MColor* falloffColor) const; private: diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.cpp b/lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp similarity index 95% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.cpp rename to lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp index 318122cb0e..4ebb080b22 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.cpp +++ b/lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/usdProxyShapeAdapter.h" +#include "./usdProxyShapeAdapter.h" #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/batchRenderer.h" -#include "pxrUsdMayaGL/debugCodes.h" -#include "pxrUsdMayaGL/renderParams.h" -#include "pxrUsdMayaGL/shapeAdapter.h" -#include "usdMaya/proxyShape.h" +#include "../../base/api.h" +#include "./batchRenderer.h" +#include "./debugCodes.h" +#include "./renderParams.h" +#include "./shapeAdapter.h" +#include "../../nodes/proxyShapeBase.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/vec4f.h" @@ -71,7 +71,7 @@ PxrMayaHdUsdProxyShapeAdapter::UpdateVisibility(const M3dView* view) M3dView* nonConstView = const_cast(view); if (nonConstView && - !nonConstView->pluginObjectDisplay(UsdMayaProxyShape::displayFilterName)) { + !nonConstView->pluginObjectDisplay(MayaUsdProxyShapeBase::displayFilterName)) { // USD proxy shapes are being filtered from this view, so don't bother // checking any other visibility state. isVisible = false; @@ -123,11 +123,11 @@ PxrMayaHdUsdProxyShapeAdapter::_Sync( const unsigned int displayStyle, const MHWRender::DisplayStatus displayStatus) { - MayaUsdProxyShapeBase* usdProxyShape = + MayaUsdProxyShapeBase* usdProxyShape = MayaUsdProxyShapeBase::GetShapeAtDagPath(shapeDagPath); if (!usdProxyShape) { TF_DEBUG(PXRUSDMAYAGL_SHAPE_ADAPTER_LIFECYCLE).Msg( - "Failed to get UsdMayaProxyShape for '%s'\n", + "Failed to get MayaUsdProxyShapeBase for '%s'\n", shapeDagPath.fullPathName().asChar()); return false; } @@ -147,7 +147,7 @@ PxrMayaHdUsdProxyShapeAdapter::_Sync( &drawProxyPurpose, &drawGuidePurpose)) { TF_DEBUG(PXRUSDMAYAGL_SHAPE_ADAPTER_LIFECYCLE).Msg( - "Failed to get render attributes for UsdMayaProxyShape '%s'\n", + "Failed to get render attributes for MayaUsdProxyShapeBase '%s'\n", shapeDagPath.fullPathName().asChar()); return false; } @@ -299,7 +299,7 @@ PxrMayaHdUsdProxyShapeAdapter::_Init(HdRenderIndex* renderIndex) // shapes with different Maya types. const TfToken delegateName( TfStringPrintf("%s_%zx", - UsdMayaProxyShapeTokens->MayaTypeName.GetText(), + MayaUsdProxyShapeBaseTokens->MayaTypeName.GetText(), shapeHash)); const SdfPath delegateId = delegatePrefix.AppendChild(delegateName); diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.h b/lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.h similarity index 94% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.h rename to lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.h index 128bc439c9..c152d30c4b 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.h +++ b/lib/render/pxrUsdMayaGL/usdProxyShapeAdapter.h @@ -20,8 +20,8 @@ #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" -#include "pxrUsdMayaGL/shapeAdapter.h" +#include "../../base/api.h" +#include "./shapeAdapter.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/imaging/hd/renderIndex.h" @@ -64,20 +64,20 @@ class PxrMayaHdUsdProxyShapeAdapter : public PxrMayaHdShapeAdapter /// /// Returns true if the visibility state was changed, or false /// otherwise. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool UpdateVisibility(const M3dView* view = nullptr) override; /// Gets whether the shape adapter's shape is visible. /// /// This should be called after a call to UpdateVisibility() to ensure /// that the returned value is correct. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool IsVisible() const override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC void SetRootXform(const GfMatrix4d& transform) override; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC const SdfPath& GetDelegateID() const override; protected: @@ -90,7 +90,7 @@ class PxrMayaHdUsdProxyShapeAdapter : public PxrMayaHdShapeAdapter /// legacy viewport and Viewport 2.0. The legacy viewport Sync() method /// "promotes" the display state parameters to their Viewport 2.0 /// equivalents before calling this method. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool _Sync( const MDagPath& shapeDagPath, const unsigned int displayStyle, @@ -100,10 +100,10 @@ class PxrMayaHdUsdProxyShapeAdapter : public PxrMayaHdShapeAdapter /// /// Note that only friends of this class are able to construct /// instances of this class. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC PxrMayaHdUsdProxyShapeAdapter(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC ~PxrMayaHdUsdProxyShapeAdapter() override; private: @@ -117,7 +117,7 @@ class PxrMayaHdUsdProxyShapeAdapter : public PxrMayaHdShapeAdapter /// The shape adapter will then query the batch renderer for its render /// index and use that to re-create its delegate and re-add its rprim /// collection, if necessary. - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC bool _Init(HdRenderIndex* renderIndex); UsdPrim _rootPrim; diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/userData.cpp b/lib/render/pxrUsdMayaGL/userData.cpp similarity index 94% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/userData.cpp rename to lib/render/pxrUsdMayaGL/userData.cpp index 2df0268a43..49f8c7c0ad 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/userData.cpp +++ b/lib/render/pxrUsdMayaGL/userData.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdMayaGL/userData.h" +#include "./userData.h" #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/userData.h b/lib/render/pxrUsdMayaGL/userData.h similarity index 94% rename from plugin/pxr/maya/lib/pxrUsdMayaGL/userData.h rename to lib/render/pxrUsdMayaGL/userData.h index 6654f7dfbc..2f4603addd 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/userData.h +++ b/lib/render/pxrUsdMayaGL/userData.h @@ -19,7 +19,7 @@ /// \file pxrUsdMayaGL/userData.h #include "pxr/pxr.h" -#include "pxrUsdMayaGL/api.h" +#include "../../base/api.h" #include "pxr/base/gf/vec4f.h" @@ -47,10 +47,10 @@ class PxrMayaHdUserData : public MUserData std::unique_ptr boundingBox; std::unique_ptr wireframeColor; - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC PxrMayaHdUserData(); - PXRUSDMAYAGL_API + MAYAUSD_CORE_PUBLIC ~PxrMayaHdUserData() override; }; diff --git a/lib/render/vp2ShaderFragments/FallbackCPVShader.xml b/lib/render/vp2ShaderFragments/FallbackCPVShader.xml index 6c3e59b467..cf1be1a449 100644 --- a/lib/render/vp2ShaderFragments/FallbackCPVShader.xml +++ b/lib/render/vp2ShaderFragments/FallbackCPVShader.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/FallbackShader.xml b/lib/render/vp2ShaderFragments/FallbackShader.xml index c3173cd742..183cb4edac 100644 --- a/lib/render/vp2ShaderFragments/FallbackShader.xml +++ b/lib/render/vp2ShaderFragments/FallbackShader.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/Float4ToFloat4.xml b/lib/render/vp2ShaderFragments/Float4ToFloat4.xml index 7279f9caa9..7e542174c4 100644 --- a/lib/render/vp2ShaderFragments/Float4ToFloat4.xml +++ b/lib/render/vp2ShaderFragments/Float4ToFloat4.xml @@ -1,3 +1,20 @@ + Passthrough of a 4D float vector. diff --git a/lib/render/vp2ShaderFragments/Float4ToFloatW.xml b/lib/render/vp2ShaderFragments/Float4ToFloatW.xml index 22a2a2307e..36d24a0cf3 100644 --- a/lib/render/vp2ShaderFragments/Float4ToFloatW.xml +++ b/lib/render/vp2ShaderFragments/Float4ToFloatW.xml @@ -1,3 +1,20 @@ + Extracts the W component of a 4D float vector. diff --git a/lib/render/vp2ShaderFragments/UsdPreviewSurface.xml b/lib/render/vp2ShaderFragments/UsdPreviewSurface.xml index 68c6b2f228..c03dfcde6a 100644 --- a/lib/render/vp2ShaderFragments/UsdPreviewSurface.xml +++ b/lib/render/vp2ShaderFragments/UsdPreviewSurface.xml @@ -1,3 +1,19 @@ + diff --git a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float.xml b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float.xml index 59ce5474ef..8fd62bd6b2 100644 --- a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float.xml +++ b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float2.xml b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float2.xml index 55a404c58b..4610eb6193 100644 --- a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float2.xml +++ b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float2.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float3.xml b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float3.xml index 5d19d53735..c39c0d9c22 100644 --- a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float3.xml +++ b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float3.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float4.xml b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float4.xml index 55ba06bc35..a82d3f4d9c 100644 --- a/lib/render/vp2ShaderFragments/UsdPrimvarReader_float4.xml +++ b/lib/render/vp2ShaderFragments/UsdPrimvarReader_float4.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/UsdUVTexture.xml b/lib/render/vp2ShaderFragments/UsdUVTexture.xml index 9c1f43e472..e2a40ce375 100644 --- a/lib/render/vp2ShaderFragments/UsdUVTexture.xml +++ b/lib/render/vp2ShaderFragments/UsdUVTexture.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/lightingContributions.xml b/lib/render/vp2ShaderFragments/lightingContributions.xml index 6ce6eb6247..f2336fad3f 100644 --- a/lib/render/vp2ShaderFragments/lightingContributions.xml +++ b/lib/render/vp2ShaderFragments/lightingContributions.xml @@ -1,3 +1,19 @@ + diff --git a/lib/render/vp2ShaderFragments/opacityToTransparency.xml b/lib/render/vp2ShaderFragments/opacityToTransparency.xml index dd01a39c85..5ff48b0863 100644 --- a/lib/render/vp2ShaderFragments/opacityToTransparency.xml +++ b/lib/render/vp2ShaderFragments/opacityToTransparency.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/scaledDiffusePassThrough.xml b/lib/render/vp2ShaderFragments/scaledDiffusePassThrough.xml index 4c53656225..90da495a78 100644 --- a/lib/render/vp2ShaderFragments/scaledDiffusePassThrough.xml +++ b/lib/render/vp2ShaderFragments/scaledDiffusePassThrough.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/scaledSpecularPassThrough.xml b/lib/render/vp2ShaderFragments/scaledSpecularPassThrough.xml index 6fb0f086cb..745874c720 100644 --- a/lib/render/vp2ShaderFragments/scaledSpecularPassThrough.xml +++ b/lib/render/vp2ShaderFragments/scaledSpecularPassThrough.xml @@ -1,3 +1,20 @@ + diff --git a/lib/render/vp2ShaderFragments/usdPreviewSurfaceCombiner.xml b/lib/render/vp2ShaderFragments/usdPreviewSurfaceCombiner.xml index 35bf943e81..496f108542 100644 --- a/lib/render/vp2ShaderFragments/usdPreviewSurfaceCombiner.xml +++ b/lib/render/vp2ShaderFragments/usdPreviewSurfaceCombiner.xml @@ -1,3 +1,19 @@ + diff --git a/lib/render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml b/lib/render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml index 6c0e09ab3a..f679694ae0 100644 --- a/lib/render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml +++ b/lib/render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml @@ -1,3 +1,19 @@ + diff --git a/lib/usd/CMakeLists.txt b/lib/usd/CMakeLists.txt new file mode 100644 index 0000000000..264e325401 --- /dev/null +++ b/lib/usd/CMakeLists.txt @@ -0,0 +1,35 @@ +#============================================================================== +# Configuration hdMaya +#============================================================================== +set(MTOH_CXX_STD "11" + CACHE + STRING + "Which C++ standard / version to use, as an integer - ie, 14 means use c++14." +) + +option(LUMA_USD_BUILD "Build the plugin for Luma's version of USD." OFF) +option(INSTALL_MAYA_MOD "Installs a maya module file for the plugin." OFF) +option(HDMAYA_BUILD_TESTS "Build the maya-to-hydra tests" OFF) +option(BUILD_DOCS "Whether or not to build the documentation." OFF) + +if(CMAKE_WANT_UFE_BUILD) + find_package(UFE QUIET) + if(UFE_FOUND) + message(STATUS "Building with UFE ${UFE_VERSION} features enabled.") + include_directories(${UFE_INCLUDE_DIR}) + add_definitions(-DWANT_UFE_BUILD) + else() + message(STATUS "UFE not found. UFE features will be disabled.") + endif() +endif() + +# promote headers +list(APPEND schemas_headers + schemas/MayaReference.h + schemas/api.h + schemas/tokens.h +) + +mayaUsd_promoteHeaderList(${schemas_headers}) + +add_subdirectory(translators) diff --git a/lib/usd/translators/CMakeLists.txt b/lib/usd/translators/CMakeLists.txt new file mode 100644 index 0000000000..dd65803b42 --- /dev/null +++ b/lib/usd/translators/CMakeLists.txt @@ -0,0 +1,138 @@ +set(TRANSLATORS_PLUGIN mayaUsd_Translators) + +set(INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/usd) + +set( + resources_install_path + ${CMAKE_INSTALL_PREFIX}/lib/usd/${TRANSLATORS_PLUGIN}/resources +) + +set( + library_install_path + ${CMAKE_INSTALL_PREFIX}/lib/ +) + +list(APPEND DEPENDANT_LIBRARIES + arch + gf + kind + sdf + tf + usd + usdGeom + usdLux + usdRi + usdShade + usdSkel + usdUtils + vt + ${Boost_PYTHON_LIBRARY} + ${MAYA_LIBRARIES} + ${LIBRARY_NAME} +) + +list(APPEND source + cameraReader.cpp + cameraWriter.cpp + fileTextureWriter.cpp + instancerWriter.cpp + jointWriter.cpp + lightReader.cpp + lightWriter.cpp + locatorWriter.cpp + materialReader.cpp + meshReader.cpp + meshWriter.cpp + meshWriter_Primvars.cpp + meshWriter_Skin.cpp + meshWriter_Subdiv.cpp + nurbsCurveWriter.cpp + nurbsCurvesReader.cpp + nurbsPatchReader.cpp + nurbsSurfaceWriter.cpp + particleWriter.cpp + scopeReader.cpp + strokeWriter.cpp + skelReader.cpp + xformReader.cpp +) + +add_library(${TRANSLATORS_PLUGIN} SHARED ${source}) + +#====================================================================== +# TARGET PROPERTIES +#====================================================================== +if(IS_MACOSX OR IS_LINUX) + # rpath setup + mayaUsd_init_rpath(rpath "plugin") + mayaUsd_add_rpath(rpath "${CMAKE_INSTALL_PREFIX}/lib") + if(WANT_USD_RELATIVE_PATH) + mayaUsd_add_rpath(rpath "../../USD/lib") + elseif(DEFINED PXR_USD_LOCATION) + mayaUsd_add_rpath(rpath "${PXR_USD_LOCATION}/lib") + endif() + mayaUsd_install_rpath(rpath ${TRANSLATORS_PLUGIN}) +endif() + +if(IS_LINUX) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags" PARENT_SCOPE) + if(WANT_USD_RELATIVE_PATH) + mayaUsd_add_rpath(rpath "../../USD/lib64") + endif() +endif() + +if(IS_MACOSX) + target_compile_definitions(${TRANSLATORS_PLUGIN} PRIVATE + OSMac_ + ) +endif() + +#====================================================================== +# INCLUDE, LINK +#====================================================================== +target_include_directories(${TRANSLATORS_PLUGIN} + PUBLIC + ${MAYA_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} +) + +target_include_directories(${TRANSLATORS_PLUGIN} + PRIVATE + api.h +) + +target_link_libraries(${TRANSLATORS_PLUGIN} PRIVATE ${DEPENDANT_LIBRARIES}) + +#====================================================================== +# PLUGINFO +#====================================================================== +configure_file ( + "${CMAKE_CURRENT_SOURCE_DIR}/plugInfo.json" + "${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json" +) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json + DESTINATION ${resources_install_path} +) + +#install top level plugInfo.json that includes the configured plugInfo.json +install(CODE + "file(WRITE \"${INSTALL_DESTINATION}/plugInfo.json\" \"{\n \\\"Includes\\\": [ \\\"*/resources/\\\" ]\n}\")" +) + +#====================================================================== +# INSTALL +#====================================================================== + +install( + TARGETS ${TRANSLATORS_PLUGIN} + LIBRARY + DESTINATION ${library_install_path} + ARCHIVE + DESTINATION ${library_install_path} + RUNTIME + DESTINATION ${library_install_path} +) +if(IS_WINDOWS) + install(FILES $ DESTINATION ${library_install_path} OPTIONAL) +endif() diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/api.h b/lib/usd/translators/api.h similarity index 100% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/api.h rename to lib/usd/translators/api.h diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraReader.cpp b/lib/usd/translators/cameraReader.cpp similarity index 91% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/cameraReader.cpp rename to lib/usd/translators/cameraReader.cpp index 39ab380866..978425a794 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraReader.cpp +++ b/lib/usd/translators/cameraReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorCamera.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorCamera.h" #include "pxr/usd/usd/prim.h" #include "pxr/usd/usdGeom/camera.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.cpp b/lib/usd/translators/cameraWriter.cpp similarity index 96% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.cpp rename to lib/usd/translators/cameraWriter.cpp index f2946ab779..a792783500 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.cpp +++ b/lib/usd/translators/cameraWriter.cpp @@ -14,13 +14,13 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/cameraWriter.h" +#include "cameraWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../utils/util.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec2f.h" #include "pxr/base/tf/diagnostic.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.h b/lib/usd/translators/cameraWriter.h similarity index 94% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.h rename to lib/usd/translators/cameraWriter.h index 57a11e6745..ff44cb6330 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/cameraWriter.h +++ b/lib/usd/translators/cameraWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/cameraWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.cpp b/lib/usd/translators/fileTextureWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.cpp rename to lib/usd/translators/fileTextureWriter.cpp index 9e96929455..7faee28a6e 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.cpp +++ b/lib/usd/translators/fileTextureWriter.cpp @@ -14,12 +14,12 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/fileTextureWriter.h" +#include "fileTextureWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/shaderWriter.h" -#include -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/shaderWriter.h" +#include "../../utils/util.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/gf/vec4f.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.h b/lib/usd/translators/fileTextureWriter.h similarity index 94% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.h rename to lib/usd/translators/fileTextureWriter.h index 104f00139d..da15784c35 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/fileTextureWriter.h +++ b/lib/usd/translators/fileTextureWriter.h @@ -19,9 +19,8 @@ /// \file pxrUsdTranslators/fileTextureWriter.h #include "pxr/pxr.h" -#include "usdMaya/shaderWriter.h" - -#include "usdMaya/writeJobContext.h" +#include "../../fileio/shaderWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.cpp b/lib/usd/translators/instancerWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.cpp rename to lib/usd/translators/instancerWriter.cpp index 5aa643e878..dab0177291 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.cpp +++ b/lib/usd/translators/instancerWriter.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdTranslators/instancerWriter.h" +#include "instancerWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriterRegistry.h" -#include -#include "usdMaya/writeJobContext.h" -#include "usdMaya/writeUtil.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../utils/util.h" +#include "../../fileio/writeJobContext.h" +#include "../../fileio/utils/writeUtil.h" #include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.h b/lib/usd/translators/instancerWriter.h similarity index 96% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.h rename to lib/usd/translators/instancerWriter.h index f0b1448482..cd615ad3a4 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/instancerWriter.h +++ b/lib/usd/translators/instancerWriter.h @@ -19,10 +19,11 @@ /// \file pxrUsdTranslators/instancerWriter.h #include "pxr/pxr.h" -#include "usdMaya/transformWriter.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/transformWriter.h" + +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.cpp b/lib/usd/translators/jointWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.cpp rename to lib/usd/translators/jointWriter.cpp index 2b255041b2..f32450f5e3 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.cpp +++ b/lib/usd/translators/jointWriter.cpp @@ -14,15 +14,15 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/jointWriter.h" - -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/translatorSkel.h" -#include "usdMaya/translatorUtil.h" -#include -#include "usdMaya/writeJobContext.h" +#include "jointWriter.h" + +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/translators/translatorSkel.h" +#include "../../fileio/translators/translatorUtil.h" +#include "../../utils/util.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.h b/lib/usd/translators/jointWriter.h similarity index 97% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.h rename to lib/usd/translators/jointWriter.h index ba9ecf78a2..3320bb568a 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/jointWriter.h +++ b/lib/usd/translators/jointWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/jointWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/lightReader.cpp b/lib/usd/translators/lightReader.cpp similarity index 95% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/lightReader.cpp rename to lib/usd/translators/lightReader.cpp index 57ceee5f3a..c3ec154145 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/lightReader.cpp +++ b/lib/usd/translators/lightReader.cpp @@ -13,8 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorRfMLight.h" -#include "usdMaya/primReaderRegistry.h" + +#include "../../fileio/translators/translatorRfMLight.h" +#include "../../fileio/primReaderRegistry.h" #include "pxr/usd/usdLux/cylinderLight.h" #include "pxr/usd/usdLux/diskLight.h" @@ -26,7 +27,6 @@ #include "pxr/usd/usdRi/pxrAovLight.h" #include "pxr/usd/usdRi/pxrEnvDayLight.h" - PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/lightWriter.cpp b/lib/usd/translators/lightWriter.cpp similarity index 94% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/lightWriter.cpp rename to lib/usd/translators/lightWriter.cpp index 9392160352..6931c2fa39 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/lightWriter.cpp +++ b/lib/usd/translators/lightWriter.cpp @@ -13,8 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/translatorRfMLight.h" -#include "usdMaya/primWriterRegistry.h" + +#include "../../fileio/translators/translatorRfMLight.h" +#include "../../fileio/primWriterRegistry.h" PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.cpp b/lib/usd/translators/locatorWriter.cpp similarity index 91% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.cpp rename to lib/usd/translators/locatorWriter.cpp index c27ca2f96c..4c1775603a 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.cpp +++ b/lib/usd/translators/locatorWriter.cpp @@ -14,11 +14,11 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/locatorWriter.h" +#include "locatorWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usdGeom/xform.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.h b/lib/usd/translators/locatorWriter.h similarity index 95% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.h rename to lib/usd/translators/locatorWriter.h index 2b7a9b6614..32376dc9d2 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/locatorWriter.h +++ b/lib/usd/translators/locatorWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/locatorWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/materialReader.cpp b/lib/usd/translators/materialReader.cpp similarity index 92% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/materialReader.cpp rename to lib/usd/translators/materialReader.cpp index 664ac3fcba..a2c6c0dc6b 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/materialReader.cpp +++ b/lib/usd/translators/materialReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorMaterial.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorMaterial.h" #include "pxr/usd/usdShade/material.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshReader.cpp b/lib/usd/translators/meshReader.cpp similarity index 91% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshReader.cpp rename to lib/usd/translators/meshReader.cpp index 091de21884..05a20bfc56 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshReader.cpp +++ b/lib/usd/translators/meshReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorMesh.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorMesh.h" #include "pxr/usd/usdGeom/mesh.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.cpp b/lib/usd/translators/meshWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.cpp rename to lib/usd/translators/meshWriter.cpp index fc770902c8..512dcf8b55 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.cpp +++ b/lib/usd/translators/meshWriter.cpp @@ -14,15 +14,15 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/meshWriter.h" - -#include "usdMaya/adaptor.h" -#include "usdMaya/meshUtil.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include -#include "usdMaya/writeUtil.h" -#include "usdMaya/writeJobContext.h" +#include "meshWriter.h" + +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/utils/meshUtil.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../utils/util.h" +#include "../../fileio/utils/writeUtil.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec2f.h" #include "pxr/base/gf/vec3f.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.h b/lib/usd/translators/meshWriter.h similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.h rename to lib/usd/translators/meshWriter.h index 9d883b0242..774ca4ab9f 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter.h +++ b/lib/usd/translators/meshWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/meshWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec2f.h" #include "pxr/base/gf/vec3f.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Primvars.cpp b/lib/usd/translators/meshWriter_Primvars.cpp similarity index 99% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Primvars.cpp rename to lib/usd/translators/meshWriter_Primvars.cpp index dbdee6f9d9..b633b678ac 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Primvars.cpp +++ b/lib/usd/translators/meshWriter_Primvars.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "pxrUsdTranslators/meshWriter.h" +#include "meshWriter.h" -#include -#include "usdMaya/roundTripUtil.h" -#include -#include "usdMaya/writeUtil.h" +#include "../../utils/colorSpace.h" +#include "../../fileio/utils/roundTripUtil.h" +#include "../../utils/util.h" +#include "../../fileio/utils/writeUtil.h" #include "pxr/base/gf/gamma.h" #include "pxr/base/gf/math.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Skin.cpp b/lib/usd/translators/meshWriter_Skin.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Skin.cpp rename to lib/usd/translators/meshWriter_Skin.cpp index de98ab20ad..5b0d553d69 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Skin.cpp +++ b/lib/usd/translators/meshWriter_Skin.cpp @@ -14,13 +14,13 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/meshWriter.h" -#include "pxrUsdTranslators/jointWriter.h" +#include "meshWriter.h" +#include "jointWriter.h" -#include "usdMaya/translatorSkel.h" -#include "usdMaya/translatorUtil.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/translators/translatorSkel.h" +#include "../../fileio/translators/translatorUtil.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/matrix4d.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Subdiv.cpp b/lib/usd/translators/meshWriter_Subdiv.cpp similarity index 99% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Subdiv.cpp rename to lib/usd/translators/meshWriter_Subdiv.cpp index 26e5742687..b2cd475673 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/meshWriter_Subdiv.cpp +++ b/lib/usd/translators/meshWriter_Subdiv.cpp @@ -14,7 +14,8 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/meshWriter.h" + +#include "meshWriter.h" #include "pxr/usd/usdGeom/mesh.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.cpp b/lib/usd/translators/nurbsCurveWriter.cpp similarity index 97% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.cpp rename to lib/usd/translators/nurbsCurveWriter.cpp index 7efa826c39..e2b1d133f6 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.cpp +++ b/lib/usd/translators/nurbsCurveWriter.cpp @@ -14,12 +14,12 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/nurbsCurveWriter.h" +#include "nurbsCurveWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec2d.h" #include "pxr/base/gf/vec3f.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.h b/lib/usd/translators/nurbsCurveWriter.h similarity index 95% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.h rename to lib/usd/translators/nurbsCurveWriter.h index 6cfbcc220c..fbaab2c230 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurveWriter.h +++ b/lib/usd/translators/nurbsCurveWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/nurbsCurveWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurvesReader.cpp b/lib/usd/translators/nurbsCurvesReader.cpp similarity index 91% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurvesReader.cpp rename to lib/usd/translators/nurbsCurvesReader.cpp index b7916b3609..eb1017ea5b 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsCurvesReader.cpp +++ b/lib/usd/translators/nurbsCurvesReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorCurves.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorCurves.h" #include "pxr/usd/usdGeom/nurbsCurves.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsPatchReader.cpp b/lib/usd/translators/nurbsPatchReader.cpp similarity index 91% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsPatchReader.cpp rename to lib/usd/translators/nurbsPatchReader.cpp index 1a36f6240b..c59c409f04 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsPatchReader.cpp +++ b/lib/usd/translators/nurbsPatchReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorNurbsPatch.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorNurbsPatch.h" #include "pxr/usd/usd/prim.h" #include "pxr/usd/usdGeom/nurbsPatch.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.cpp b/lib/usd/translators/nurbsSurfaceWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.cpp rename to lib/usd/translators/nurbsSurfaceWriter.cpp index 5f95280736..5fd2dd8676 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.cpp +++ b/lib/usd/translators/nurbsSurfaceWriter.cpp @@ -14,13 +14,13 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/nurbsSurfaceWriter.h" +#include "nurbsSurfaceWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/writeJobContext.h" -#include "usdMaya/writeUtil.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/writeJobContext.h" +#include "../../fileio/utils/writeUtil.h" #include "pxr/base/gf/vec2d.h" #include "pxr/base/gf/vec2f.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.h b/lib/usd/translators/nurbsSurfaceWriter.h similarity index 95% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.h rename to lib/usd/translators/nurbsSurfaceWriter.h index 908541b9a6..e5d3ebe613 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/nurbsSurfaceWriter.h +++ b/lib/usd/translators/nurbsSurfaceWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/nurbsSurfaceWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/overview.dox b/lib/usd/translators/overview.dox similarity index 100% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/overview.dox rename to lib/usd/translators/overview.dox diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.cpp b/lib/usd/translators/particleWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.cpp rename to lib/usd/translators/particleWriter.cpp index d09d0b1c7e..f4066be364 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.cpp +++ b/lib/usd/translators/particleWriter.cpp @@ -14,12 +14,12 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/particleWriter.h" +#include "particleWriter.h" -#include "usdMaya/adaptor.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/transformWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/utils/adaptor.h" +#include "../../fileio/primWriterRegistry.h" +#include "../../fileio/transformWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.h b/lib/usd/translators/particleWriter.h similarity index 95% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.h rename to lib/usd/translators/particleWriter.h index 78b58bdf3a..1a8131fc98 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/particleWriter.h +++ b/lib/usd/translators/particleWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/particleWriter.h #include "pxr/pxr.h" -#include "usdMaya/transformWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/transformWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" diff --git a/lib/usd/translators/plugInfo.json b/lib/usd/translators/plugInfo.json new file mode 100644 index 0000000000..7600166d41 --- /dev/null +++ b/lib/usd/translators/plugInfo.json @@ -0,0 +1,59 @@ +{ + "Plugins": [ + { + "Info": { + "UsdMaya": { + "PrimReader": { + "providesTranslator": [ + "UsdGeomCamera", + "UsdGeomMesh", + "UsdGeomNurbsCurves", + "UsdGeomNurbsPatch", + "UsdGeomScope", + "UsdGeomXform", + "UsdLuxCylinderLight", + "UsdLuxDiskLight", + "UsdLuxDistantLight", + "UsdLuxDomeLight", + "UsdLuxGeometryLight", + "UsdLuxRectLight", + "UsdLuxSphereLight", + "UsdRiPxrAovLight", + "UsdRiPxrEnvDayLight", + "UsdShadeMaterial", + "UsdSkelRoot", + "UsdSkelSkeleton" + ] + }, + "PrimWriter": { + "providesTranslator": [ + "camera", + "file", + "instancer", + "joint", + "locator", + "mesh", + "nParticle", + "nurbsCurve", + "nurbsSurface", + "particle", + "PxrAovLight", + "PxrCylinderLight", + "PxrDiskLight", + "PxrDistantLight", + "PxrDomeLight", + "PxrEnvDayLight", + "PxrMeshLight", + "PxrRectLight", + "PxrSphereLight", + "stroke" + ] + } + } + }, + "LibraryPath": "../../../@CMAKE_SHARED_LIBRARY_PREFIX@@TRANSLATORS_PLUGIN@@CMAKE_SHARED_LIBRARY_SUFFIX@", + "Name": "@TRANSLATORS_PLUGIN@", + "Type": "library" + } + ] +} diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/plugin.cpp b/lib/usd/translators/plugin.cpp similarity index 96% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/plugin.cpp rename to lib/usd/translators/plugin.cpp index fbe52ee9a2..b821e014bc 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/plugin.cpp +++ b/lib/usd/translators/plugin.cpp @@ -14,7 +14,8 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/api.h" + +#include "api.h" #include #include diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/scopeReader.cpp b/lib/usd/translators/scopeReader.cpp similarity index 92% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/scopeReader.cpp rename to lib/usd/translators/scopeReader.cpp index 5af9a61897..3a4d6c5b46 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/scopeReader.cpp +++ b/lib/usd/translators/scopeReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorUtil.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorUtil.h" #include "pxr/usd/usd/prim.h" #include "pxr/usd/usdGeom/scope.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/skelReader.cpp b/lib/usd/translators/skelReader.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/skelReader.cpp rename to lib/usd/translators/skelReader.cpp index 542244b9d3..e2c2551c0d 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/skelReader.cpp +++ b/lib/usd/translators/skelReader.cpp @@ -14,9 +14,10 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorSkel.h" -#include "usdMaya/translatorUtil.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorSkel.h" +#include "../../fileio/translators/translatorUtil.h" #include "pxr/usd/usd/prim.h" #include "pxr/usd/usd/primRange.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.cpp b/lib/usd/translators/strokeWriter.cpp similarity index 98% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.cpp rename to lib/usd/translators/strokeWriter.cpp index 5bfac35a52..0369bfa66e 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.cpp +++ b/lib/usd/translators/strokeWriter.cpp @@ -14,11 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "pxrUsdTranslators/strokeWriter.h" +#include "strokeWriter.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriterRegistry.h" #include "pxr/base/gf/vec3f.h" #include "pxr/base/tf/diagnostic.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.h b/lib/usd/translators/strokeWriter.h similarity index 94% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.h rename to lib/usd/translators/strokeWriter.h index fa196562bc..c4608f673d 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/strokeWriter.h +++ b/lib/usd/translators/strokeWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdTranslators/strokeWriter.h #include "pxr/pxr.h" -#include "usdMaya/primWriter.h" -#include "usdMaya/writeJobContext.h" +#include "../../fileio/primWriter.h" +#include "../../fileio/writeJobContext.h" #include "pxr/usd/sdf/path.h" #include "pxr/usd/usd/timeCode.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/xformReader.cpp b/lib/usd/translators/xformReader.cpp similarity index 93% rename from plugin/pxr/maya/plugin/pxrUsdTranslators/xformReader.cpp rename to lib/usd/translators/xformReader.cpp index 0cb8885b63..a27eee6b8b 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/xformReader.cpp +++ b/lib/usd/translators/xformReader.cpp @@ -14,8 +14,9 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/primReaderRegistry.h" -#include "usdMaya/translatorUtil.h" + +#include "../../fileio/primReaderRegistry.h" +#include "../../fileio/translators/translatorUtil.h" #include "pxr/usd/usd/prim.h" #include "pxr/usd/usdGeom/xform.h" diff --git a/plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.cpp b/lib/utils/blockSceneModificationContext.cpp similarity index 96% rename from plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.cpp rename to lib/utils/blockSceneModificationContext.cpp index 77ddf4cedf..7a070d3526 100644 --- a/plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.cpp +++ b/lib/utils/blockSceneModificationContext.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "pxr/pxr.h" -#include "usdMaya/blockSceneModificationContext.h" +#include "blockSceneModificationContext.h" #include "pxr/base/tf/stringUtils.h" diff --git a/plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.h b/lib/utils/blockSceneModificationContext.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.h rename to lib/utils/blockSceneModificationContext.h index f2fbe5abc3..fe3428ae33 100644 --- a/plugin/pxr/maya/lib/usdMaya/blockSceneModificationContext.h +++ b/lib/utils/blockSceneModificationContext.h @@ -19,7 +19,7 @@ /// \file usdMaya/blockSceneModificationContext.h #include "pxr/pxr.h" -#include "usdMaya/api.h" +#include "../base/api.h" PXR_NAMESPACE_OPEN_SCOPE @@ -31,10 +31,10 @@ class UsdMayaBlockSceneModificationContext { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaBlockSceneModificationContext(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC virtual ~UsdMayaBlockSceneModificationContext(); private: diff --git a/plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.cpp b/lib/utils/diagnosticDelegate.cpp similarity index 99% rename from plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.cpp rename to lib/utils/diagnosticDelegate.cpp index f659071454..19c9101347 100644 --- a/plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.cpp +++ b/lib/utils/diagnosticDelegate.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/diagnosticDelegate.h" +#include "./diagnosticDelegate.h" -#include +#include "../base/debugCodes.h" #include "pxr/base/arch/threads.h" #include "pxr/base/tf/envSetting.h" diff --git a/plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.h b/lib/utils/diagnosticDelegate.h similarity index 94% rename from plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.h rename to lib/utils/diagnosticDelegate.h index 5f14227f8c..9f00a3a6cb 100644 --- a/plugin/pxr/maya/lib/usdMaya/diagnosticDelegate.h +++ b/lib/utils/diagnosticDelegate.h @@ -18,7 +18,7 @@ /// \file usdMaya/diagnosticDelegate.h -#include "usdMaya/api.h" +#include "../base/api.h" #include "pxr/pxr.h" @@ -52,32 +52,32 @@ class UsdMayaDiagnosticBatchContext; /// must be done only on the main thread. class UsdMayaDiagnosticDelegate : TfDiagnosticMgr::Delegate { public: - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC ~UsdMayaDiagnosticDelegate() override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void IssueError(const TfError& err) override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void IssueStatus(const TfStatus& status) override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void IssueWarning(const TfWarning& warning) override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC void IssueFatalError( const TfCallContext& context, const std::string& msg) override; /// Installs a shared delegate globally. /// If this is invoked on a secondary thread, issues a fatal coding error. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void InstallDelegate(); /// Removes the global shared delegate, if it exists. /// If this is invoked on a secondary thread, issues a fatal coding error. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void RemoveDelegate(); /// Returns the number of active batch contexts associated with the global /// delegate. 0 means no batching; 1 or more means diagnostics are batched. /// If there is no delegate installed, issues a runtime error and returns 0. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static int GetBatchCount(); private: @@ -116,9 +116,9 @@ class UsdMayaDiagnosticBatchContext /// Constructs a batch context, causing all subsequent diagnostic messages /// to be batched on all threads. /// If this is invoked on a secondary thread, issues a fatal coding error. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC UsdMayaDiagnosticBatchContext(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC ~UsdMayaDiagnosticBatchContext(); UsdMayaDiagnosticBatchContext( diff --git a/plugin/pxr/maya/lib/usdMaya/undoHelperCommand.cpp b/lib/utils/undoHelperCommand.cpp similarity index 56% rename from plugin/pxr/maya/lib/usdMaya/undoHelperCommand.cpp rename to lib/utils/undoHelperCommand.cpp index 332a72e8c9..828869ec24 100644 --- a/plugin/pxr/maya/lib/usdMaya/undoHelperCommand.cpp +++ b/lib/utils/undoHelperCommand.cpp @@ -13,17 +13,76 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/undoHelperCommand.h" +#include "undoHelperCommand.h" #include "pxr/base/tf/errorMark.h" #include +// This is added to prevent multiple definitions of the MApiVersion string. +#define MNoVersionString +#include + +namespace { +#define CMD_NAME "usdUndoHelperCmd" + +int _registrationCount = 0; + +// Name of the plugin registering the command. +MString _registrantPluginName; +} + PXR_NAMESPACE_OPEN_SCOPE const UsdMayaUndoHelperCommand::UndoableFunction* UsdMayaUndoHelperCommand::_dgModifierFunc = nullptr; +/* static */ +MStatus +UsdMayaUndoHelperCommand::initialize(MFnPlugin& plugin) +{ + // If we're already registered, do nothing. + if (_registrationCount++ > 0) { + return MS::kSuccess; + } + + _registrantPluginName = plugin.name(); + + return plugin.registerCommand( + CMD_NAME, + UsdMayaUndoHelperCommand::creator, + UsdMayaUndoHelperCommand::createSyntax); +} + +/* static */ +MStatus +UsdMayaUndoHelperCommand::finalize(MFnPlugin& plugin) +{ + // If more than one plugin still has us registered, do nothing. + if (_registrationCount-- > 1) { + return MS::kSuccess; + } + + // Maya requires deregistration to be done by the same plugin that + // performed the registration. If this isn't possible, warn and don't + // deregister. + if (plugin.name() != _registrantPluginName) { + MGlobal::displayWarning( + CMD_NAME " cannot be deregistered, registering plugin " + + _registrantPluginName + " is unloaded."); + return MS::kSuccess; + } + + return plugin.deregisterCommand(CMD_NAME); +} + +/* static */ +const char* +UsdMayaUndoHelperCommand::name() +{ + return CMD_NAME; +} + UsdMayaUndoHelperCommand::UsdMayaUndoHelperCommand() : _undoable(false) { } @@ -85,9 +144,9 @@ void UsdMayaUndoHelperCommand::ExecuteWithUndo(const UndoableFunction& func) { int cmdExists = 0; - MGlobal::executeCommand("exists usdUndoHelperCmd", cmdExists); + MGlobal::executeCommand("exists " CMD_NAME, cmdExists); if (!cmdExists) { - TF_WARN("usdUndoHelperCmd is unavailable; " + TF_WARN(CMD_NAME " is unavailable; " "function will run without undo support"); MDGModifier modifier; func(modifier); @@ -96,7 +155,7 @@ UsdMayaUndoHelperCommand::ExecuteWithUndo(const UndoableFunction& func) // Run function through command if it is available to get undo support! _dgModifierFunc = &func; - MGlobal::executeCommand("usdUndoHelperCmd", false, true); + MGlobal::executeCommand(CMD_NAME, false, true); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/undoHelperCommand.h b/lib/utils/undoHelperCommand.h similarity index 83% rename from plugin/pxr/maya/lib/usdMaya/undoHelperCommand.h rename to lib/utils/undoHelperCommand.h index cd407cadc7..0aeaaa1ba2 100644 --- a/plugin/pxr/maya/lib/usdMaya/undoHelperCommand.h +++ b/lib/utils/undoHelperCommand.h @@ -22,12 +22,13 @@ #include "pxr/base/tf/token.h" #include "pxr/base/vt/value.h" -#include "usdMaya/api.h" -#include "usdMaya/adaptor.h" +#include "../base/api.h" +#include #include #include #include +#include // For MFnPlugin PXR_NAMESPACE_OPEN_SCOPE @@ -43,23 +44,32 @@ class UsdMayaUndoHelperCommand : public MPxCommand using UndoableResultFunction = std::function; using UndoableFunction = UndoableResultFunction; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC + static const char* name(); + + MAYAUSD_CORE_PUBLIC + static MStatus initialize(MFnPlugin&); + + MAYAUSD_CORE_PUBLIC + static MStatus finalize(MFnPlugin&); + + MAYAUSD_CORE_PUBLIC UsdMayaUndoHelperCommand(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC ~UsdMayaUndoHelperCommand() override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MStatus doIt(const MArgList& args) override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MStatus redoIt() override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC MStatus undoIt() override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC bool isUndoable() const override; - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static MSyntax createSyntax(); - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void* creator(); /// Calls \p func with an MDGModifier, saving the modifier for future undo @@ -67,7 +77,7 @@ class UsdMayaUndoHelperCommand : public MPxCommand /// \p func directly without undo support and issues a warning. If \p func /// raises any Tf errors when it is called, it will not be added to Maya's /// undo stack. - PXRUSDMAYA_API + MAYAUSD_CORE_PUBLIC static void ExecuteWithUndo(const UndoableFunction& func); /// This overload of ExecuteWithUndo() supports a \p func that returns a diff --git a/plugin/adsk/plugin/CMakeLists.txt b/plugin/adsk/plugin/CMakeLists.txt index e3a79fd92d..7eee36dd4b 100644 --- a/plugin/adsk/plugin/CMakeLists.txt +++ b/plugin/adsk/plugin/CMakeLists.txt @@ -13,6 +13,7 @@ endif() add_library(${PLUGIN_PACKAGE} MODULE plugin.cpp + importTranslator.cpp ProxyShape.cpp ) diff --git a/plugin/adsk/plugin/ProxyShape.cpp b/plugin/adsk/plugin/ProxyShape.cpp index bb1ec6489d..3d1b6cab32 100644 --- a/plugin/adsk/plugin/ProxyShape.cpp +++ b/plugin/adsk/plugin/ProxyShape.cpp @@ -16,6 +16,7 @@ #include "ProxyShape.h" #include +#include MAYAUSD_NS_DEF { @@ -59,6 +60,13 @@ ProxyShape::~ProxyShape() void ProxyShape::postConstructor() { ParentClass::postConstructor(); + + if (!MayaUsdProxyShapePlugin::useVP2_NativeUSD_Rendering()) + { + // This shape uses Hydra for imaging, so make sure that the + // pxrHdImagingShape is setup. + PXR_NS::PxrMayaHdImagingShape::GetOrCreateInstance(); + } } } // MayaUsd diff --git a/plugin/adsk/plugin/importTranslator.cpp b/plugin/adsk/plugin/importTranslator.cpp new file mode 100644 index 0000000000..17d8b2034f --- /dev/null +++ b/plugin/adsk/plugin/importTranslator.cpp @@ -0,0 +1,178 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include "importTranslator.h" + +#include +#include +#include +#include + +#include "pxr/base/gf/interval.h" +#include "pxr/base/vt/dictionary.h" + +#include +#include +#include +#include + +#include +#include + + +PXR_NAMESPACE_OPEN_SCOPE + + +/* static */ +void* +UsdMayaImportTranslator::creator() +{ + return new UsdMayaImportTranslator(); +} + +UsdMayaImportTranslator::UsdMayaImportTranslator() : MPxFileTranslator() +{ +} + +/* virtual */ +UsdMayaImportTranslator::~UsdMayaImportTranslator() +{ +} + +/* virtual */ +MStatus +UsdMayaImportTranslator::reader( + const MFileObject& file, + const MString& optionsString, + MPxFileTranslator::FileAccessMode /*mode*/) +{ + std::string fileName(file.fullName().asChar()); + std::string primPath("/"); + std::map variants; + + bool readAnimData = true; + bool useCustomFrameRange = false; + GfInterval timeInterval(1.0, 1.0); + + VtDictionary userArgs; + + if (optionsString.length() > 0) { + MStringArray optionList; + MStringArray theOption; + optionsString.split(';', optionList); + for(int i=0; i<(int)optionList.length(); ++i) { + theOption.clear(); + optionList[i].split('=', theOption); + if (theOption.length() != 2) { + continue; + } + + std::string argName(theOption[0].asChar()); + if (argName == "readAnimData") { + readAnimData = (theOption[1].asInt() != 0); + } else if (argName == "useCustomFrameRange") { + useCustomFrameRange = (theOption[1].asInt() != 0); + } else if (argName == "startTime") { + timeInterval.SetMin(theOption[1].asDouble()); + } else if (argName == "endTime") { + timeInterval.SetMax(theOption[1].asDouble()); + } else { + userArgs[argName] = + UsdMayaUtil::ParseArgumentValue( + argName, + theOption[1].asChar(), + UsdMayaJobImportArgs::GetDefaultDictionary()); + } + } + } + + if (readAnimData) { + if (!useCustomFrameRange) { + timeInterval = GfInterval::GetFullInterval(); + } + } + else { + timeInterval = GfInterval(); + } + + UsdMayaJobImportArgs jobArgs = + UsdMayaJobImportArgs::CreateFromDictionary( + userArgs, + /* importWithProxyShapes = */ false, + timeInterval); + UsdMaya_ReadJob mUsdReadJob(fileName, primPath, variants, jobArgs); + std::vector addedDagPaths; + bool success = mUsdReadJob.Read(&addedDagPaths); + return (success) ? MS::kSuccess : MS::kFailure; +} + +/* virtual */ +MPxFileTranslator::MFileKind +UsdMayaImportTranslator::identifyFile( + const MFileObject& file, + const char* /*buffer*/, + short /*size*/) const +{ + MFileKind retValue = kNotMyFileType; + const MString fileName = file.fullName(); + const int lastIndex = fileName.length() - 1; + + const int periodIndex = fileName.rindex('.'); + if (periodIndex < 0 || periodIndex >= lastIndex) { + return retValue; + } + + const MString fileExtension = fileName.substring(periodIndex + 1, lastIndex); + + if (fileExtension == UsdMayaTranslatorTokens->UsdFileExtensionDefault.GetText() || + fileExtension == UsdMayaTranslatorTokens->UsdFileExtensionASCII.GetText() || + fileExtension == UsdMayaTranslatorTokens->UsdFileExtensionCrate.GetText()) { + retValue = kIsMyFileType; + } + + return retValue; +} + +/* static */ +const std::string& +UsdMayaImportTranslator::GetDefaultOptions() +{ + static std::string defaultOptions; + static std::once_flag once; + std::call_once(once, []() { + std::vector entries; + for (const std::pair keyValue : + UsdMayaJobImportArgs::GetDefaultDictionary()) { + if (keyValue.second.IsHolding()) { + entries.push_back(TfStringPrintf("%s=%d", + keyValue.first.c_str(), + static_cast(keyValue.second.Get()))); + } + else if (keyValue.second.IsHolding()) { + entries.push_back(TfStringPrintf("%s=%s", + keyValue.first.c_str(), + keyValue.second.Get().c_str())); + } + } + entries.push_back("readAnimData=0"); + entries.push_back("useCustomFrameRange=0"); + defaultOptions = TfStringJoin(entries, ";"); + }); + + return defaultOptions; +} + + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/adsk/plugin/importTranslator.h b/plugin/adsk/plugin/importTranslator.h new file mode 100644 index 0000000000..3477097ea9 --- /dev/null +++ b/plugin/adsk/plugin/importTranslator.h @@ -0,0 +1,81 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#ifndef PXRUSDMAYA_IMPORT_TRANSLATOR_H +#define PXRUSDMAYA_IMPORT_TRANSLATOR_H + +/// \file usdMaya/importTranslator.h + +#include "base/api.h" +#include + +#include "pxr/pxr.h" + +#include +#include +#include +#include + +#include + +PXR_NAMESPACE_OPEN_SCOPE + + +/// File translator for USD files. Handles the USD option in the Import window. +class UsdMayaImportTranslator : public MPxFileTranslator +{ + public: + + MAYAUSD_PLUGIN_PUBLIC + static void* creator(); + + MAYAUSD_PLUGIN_PUBLIC + MStatus reader( + const MFileObject& file, + const MString& optionsString, + MPxFileTranslator::FileAccessMode mode) override; + + bool haveReadMethod() const override { return true; } + bool haveWriteMethod() const override { return false; } + + MAYAUSD_PLUGIN_PUBLIC + MFileKind identifyFile( + const MFileObject& file, + const char* buffer, + short size) const override; + + MString defaultExtension() const override { + return UsdMayaTranslatorTokens->UsdFileExtensionDefault.GetText(); + } + MString filter() const override { + return UsdMayaTranslatorTokens->UsdReadableFileFilter.GetText(); + } + + MAYAUSD_PLUGIN_PUBLIC + static const std::string& GetDefaultOptions(); + + private: + + UsdMayaImportTranslator(); + UsdMayaImportTranslator(const UsdMayaImportTranslator&); + ~UsdMayaImportTranslator() override; + UsdMayaImportTranslator& operator=(const UsdMayaImportTranslator&); +}; + + +PXR_NAMESPACE_CLOSE_SCOPE + + +#endif diff --git a/plugin/adsk/plugin/plugin.cpp b/plugin/adsk/plugin/plugin.cpp index 675bfb78fa..9e35fb3b6b 100644 --- a/plugin/adsk/plugin/plugin.cpp +++ b/plugin/adsk/plugin/plugin.cpp @@ -15,12 +15,16 @@ // #include "base/api.h" +#include "importTranslator.h" #include "ProxyShape.h" #include #include #include #include +#include + +#include #if defined(WANT_UFE_BUILD) #include @@ -44,6 +48,17 @@ MStatus initializePlugin(MObject obj) MStatus status; MFnPlugin plugin(obj, "Autodesk", "1.0", "Any"); + status = plugin.registerFileTranslator( + "mayaUsdImport", + "", + UsdMayaImportTranslator::creator, + "mayaUsdTranslatorImport", // options script name + const_cast(UsdMayaImportTranslator::GetDefaultOptions().c_str()), + false); + if (!status) { + status.perror("mayaUsdPlugin: unable to register import translator."); + } + status = MayaUsdProxyShapePlugin::initialize(plugin); CHECK_MSTATUS(status); @@ -59,10 +74,40 @@ MStatus initializePlugin(MObject obj) MayaUsd::ProxyShape::typeId, MayaUsd::ProxyShape::creator, MayaUsd::ProxyShape::initialize, - nullptr, + UsdMayaProxyShapeUI::creator, MayaUsdProxyShapePlugin::getProxyShapeClassification()); CHECK_MSTATUS(status); + status = UsdMayaUndoHelperCommand::initialize(plugin); + if (!status) { + status.perror(std::string("registerCommand ").append( + UsdMayaUndoHelperCommand::name()).c_str()); + } + + // As of 2-Aug-2019, these PlugPlugin translators are not loaded + // automatically. To be investigated. A duplicate of this code is in the + // Pixar plugin.cpp. + const std::vector translatorPluginNames{ + "mayaUsd_Translators"}; + const auto& plugRegistry = PlugRegistry::GetInstance(); + std::stringstream msg("mayaUsdPlugin: "); + for (const auto& pluginName : translatorPluginNames) { + auto plugin = plugRegistry.GetPluginWithName(pluginName); + if (!plugin) { + status = MStatus::kFailure; + msg << "translator " << pluginName << " not found."; + status.perror(msg.str().c_str()); + } + else { + // Load is a no-op if already loaded. + if (!plugin->Load()) { + status = MStatus::kFailure; + msg << pluginName << " translator load failed."; + status.perror(msg.str().c_str()); + } + } + } + return status; } @@ -72,6 +117,17 @@ MStatus uninitializePlugin(MObject obj) MFnPlugin plugin(obj); MStatus status; + status = UsdMayaUndoHelperCommand::finalize(plugin); + if (!status) { + status.perror(std::string("deregisterCommand ").append( + UsdMayaUndoHelperCommand::name()).c_str()); + } + + status = plugin.deregisterFileTranslator("mayaUsdImport"); + if (!status) { + status.perror("mayaUsdPlugin: unable to deregister import translator."); + } + status = plugin.deregisterNode(MayaUsd::ProxyShape::typeId); CHECK_MSTATUS(status); diff --git a/plugin/adsk/scripts/CMakeLists.txt b/plugin/adsk/scripts/CMakeLists.txt index dba9ba4df6..4487eefbb2 100644 --- a/plugin/adsk/scripts/CMakeLists.txt +++ b/plugin/adsk/scripts/CMakeLists.txt @@ -1,4 +1,6 @@ list(APPEND scripts_src + mayaUsdTranslatorImport.mel + mayaUsdTranslatorExport.mel AEmayaUsdProxyShapeTemplate.mel ) diff --git a/plugin/adsk/scripts/mayaUsdTranslatorExport.mel b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel new file mode 100644 index 0000000000..6fa6458ffa --- /dev/null +++ b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel @@ -0,0 +1,60 @@ +// Copyright 2019 Autodesk +// +// Copyright 2019 Pixar +// +// 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. +// + +global proc int mayaUsdTranslatorExport (string $parent, + string $action, + string $initialSettings, + string $resultCallback ) +// +// Description: +// This script posts the mayaUsd export file translator options. +// The optionsString is of the form: +// varName1=value1;varName2=value2;... +// +// Parameters: +// $parent - the elf parent layout for this options layout. It is +// always a scrollLayout. +// $action - the action that is to be performed with this invocation of this proc. +// Valid options are: +// "query" - construct the options string and pass it to the resultCallback. +// "post" - post all the elf controls. +// $initialSettings - the current options string in effect at the time this script is invoked. +// $resultCallback - This is the proc to be called with the result string. +// resultCallback ( string $optionsString ) +// +// Returns: +// 1 if successful. +// 0 otherwise. +// +{ + int $bResult = 1; + + if ($action == "post") { + setParent $parent; + + text -label "Maya USD export options to be determined."; + } else if ($action == "query") { + string $currentOptions = ""; + + eval($resultCallback+" \""+$currentOptions+"\""); + + } else { + $bResult = 0; + } + + return $bResult; +} diff --git a/plugin/adsk/scripts/mayaUsdTranslatorImport.mel b/plugin/adsk/scripts/mayaUsdTranslatorImport.mel new file mode 100644 index 0000000000..a79eebd94c --- /dev/null +++ b/plugin/adsk/scripts/mayaUsdTranslatorImport.mel @@ -0,0 +1,60 @@ +// Copyright 2019 Autodesk +// +// Copyright 2019 Pixar +// +// 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. +// + +global proc int mayaUsdTranslatorImport (string $parent, + string $action, + string $initialSettings, + string $resultCallback ) +// +// Description: +// This script posts the mayaUsd import file translator options. +// The optionsString is of the form: +// varName1=value1;varName2=value2;... +// +// Parameters: +// $parent - the elf parent layout for this options layout. It is +// always a scrollLayout. +// $action - the action that is to be performed with this invocation of this proc. +// Valid options are: +// "query" - construct the options string and pass it to the resultCallback. +// "post" - post all the elf controls. +// $initialSettings - the current options string in effect at the time this script is invoked. +// $resultCallback - This is the proc to be called with the result string. +// resultCallback ( string $optionsString ) +// +// Returns: +// 1 if successful. +// 0 otherwise. +// +{ + int $bResult = 1; + + if ($action == "post") { + setParent $parent; + + text -label "Maya USD import options to be determined."; + } else if ($action == "query") { + string $currentOptions = ""; + + eval($resultCallback+" \""+$currentOptions+"\""); + + } else { + $bResult = 0; + } + + return $bResult; +} diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp index ed02f3f322..d0c558cf8a 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp @@ -161,6 +161,7 @@ void Profiler::popTime() #ifdef _WIN32 while(clock_gettime(CLOCK_REALTIME_COARSE, &endtime) != 0) /* deliberately empty */; #endif + // compute time difference timespec diff = timeDiff(m_timeStack[m_stackPos].m_time, endtime); m_timeStack[m_stackPos].m_path->second = timeAdd(diff, m_timeStack[m_stackPos].m_path->second); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h index a028f6b15f..a5fd50101a 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h @@ -16,9 +16,6 @@ #pragma once #include "pxr/pxr.h" #include "pxr/imaging/glf/glew.h" -#include "pxr/imaging/glf/contextCaps.h" -#include "pxr/imaging/glf/glContext.h" - #include "AL/maya/utils/CommandGuiHelper.h" #include "AL/maya/utils/MenuBuilder.h" #include "AL/usdmaya/Global.h" @@ -341,14 +338,40 @@ MStatus registerPlugin(AFnPlugin& plugin) CHECK_MSTATUS(AL::maya::utils::MenuBuilder::generatePluginUI(plugin, "AL_usdmaya")); AL::usdmaya::Global::onPluginLoad(); + // As of 2-Aug-2019, these PlugPlugin translators are not loaded + // automatically. To be investigated. A duplicate of this code is in the + // Autodesk plugin.cpp. + const std::vector translatorPluginNames{ + "mayaUsd_Translators" }; + const auto& plugRegistry = PlugRegistry::GetInstance(); + std::stringstream msg("mayaUsdPlugin: "); + for (const auto& pluginName : translatorPluginNames) { + auto plugin = plugRegistry.GetPluginWithName(pluginName); + if (!plugin) { + status = MStatus::kFailure; + msg << "translator " << pluginName << " not found."; + status.perror(msg.str().c_str()); + } + else { + // Load is a no-op if already loaded. + if (!plugin->Load()) { + status = MStatus::kFailure; + msg << pluginName << " translator load failed."; + status.perror(msg.str().c_str()); + } + } + } + // Force all plugins to be loaded at startup time. Unless we load plugins upfront // options will not be registered until the start of import or export, and won't be available in the GUI + const TfType& translatorType = TfType::Find(); PlugPluginPtrVector plugins = PlugRegistry::GetInstance().GetAllPlugins(); for(auto& plugin : plugins) { - if(!plugin->IsLoaded()) + if(!plugin->IsLoaded() && plugin->DeclaresType(translatorType, true)) plugin->Load(); } + return status; } diff --git a/plugin/al/lib/AL_USDMaya/CMakeLists.txt b/plugin/al/lib/AL_USDMaya/CMakeLists.txt index 1bad35e87b..44f3b4579b 100644 --- a/plugin/al/lib/AL_USDMaya/CMakeLists.txt +++ b/plugin/al/lib/AL_USDMaya/CMakeLists.txt @@ -177,7 +177,6 @@ target_include_directories( set(Boost_LINK_LIBRARIES ${Boost_PYTHON_LIBRARY} ${Boost_THREAD_LIBRARY} - ${Boost_SYSTEM_LIBRARY} ) if(WIN32) list(APPEND Boost_LINK_LIBRARIES diff --git a/plugin/al/mayautils/AL/maya/CMakeLists.txt b/plugin/al/mayautils/AL/maya/CMakeLists.txt index ddb3326018..dd0c19e1b8 100755 --- a/plugin/al/mayautils/AL/maya/CMakeLists.txt +++ b/plugin/al/mayautils/AL/maya/CMakeLists.txt @@ -62,8 +62,7 @@ target_include_directories(${MAYAUTILS_LIBRARY_NAME} ${UTILS_INCLUDE_LOCATION} ${MAYAUTILS_INCLUDE_LOCATION} ${MAYA_INCLUDE_DIRS} - ${MAYAUSD_INCLUDE_DIR} -) + ) target_link_libraries(${MAYAUTILS_LIBRARY_NAME} AL_EventSystem diff --git a/plugin/al/mayautils/AL/maya/event/MayaEventManager.cpp b/plugin/al/mayautils/AL/maya/event/MayaEventManager.cpp index 1dc803c9b3..590f7ebedc 100644 --- a/plugin/al/mayautils/AL/maya/event/MayaEventManager.cpp +++ b/plugin/al/mayautils/AL/maya/event/MayaEventManager.cpp @@ -15,7 +15,6 @@ // #include "AL/maya/event/MayaEventManager.h" -#include #include #include #include @@ -23,6 +22,8 @@ #include #include +#include + namespace AL { namespace maya { namespace event { diff --git a/plugin/al/plugin/AL_USDMayaPlugin/CMakeLists.txt b/plugin/al/plugin/AL_USDMayaPlugin/CMakeLists.txt index b743d6ecaf..e74c896b86 100644 --- a/plugin/al/plugin/AL_USDMayaPlugin/CMakeLists.txt +++ b/plugin/al/plugin/AL_USDMayaPlugin/CMakeLists.txt @@ -26,7 +26,6 @@ target_link_libraries(${PXR_PACKAGE} target_include_directories(${PXR_PACKAGE} PRIVATE ${MAYA_INCLUDE_DIRS} - ${MAYAUSD_INCLUDE_DIR} "../../lib/AL_USDMaya" ) diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/CMakeLists.txt b/plugin/al/plugin/AL_USDMayaTestPlugin/CMakeLists.txt index 2bd7cd7843..c324ee2fee 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/CMakeLists.txt +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/CMakeLists.txt @@ -79,7 +79,6 @@ target_include_directories(${PXR_PACKAGE} PRIVATE ${GTEST_INCLUDE_DIRS} ${MAYA_INCLUDE_DIRS} - ${MAYAUSD_INCLUDE_DIR} "../../lib/AL_USDMaya" "../../schemas" ${MAYATEST_INCLUDE_LOCATION} diff --git a/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.cpp b/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.cpp index 16daf0bd8e..fe0432daed 100644 --- a/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.cpp +++ b/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.cpp @@ -23,10 +23,8 @@ #include "maya/MTime.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" -#include "usdMaya/primWriterRegistry.h" +#include +#include #include #include "pxr/base/tf/token.h" diff --git a/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.h b/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.h index abd1ffd009..c11fc4dbbd 100644 --- a/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.h +++ b/plugin/al/translators/pxrUsdTranslators/ProxyShapeTranslator.h @@ -19,8 +19,8 @@ #include "pxr/pxr.h" #include "usdMaya/api.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" +#include +#include PXR_NAMESPACE_OPEN_SCOPE diff --git a/plugin/pxr/maya/lib/CMakeLists.txt b/plugin/pxr/maya/lib/CMakeLists.txt index 377b223835..5d0bc21387 100644 --- a/plugin/pxr/maya/lib/CMakeLists.txt +++ b/plugin/pxr/maya/lib/CMakeLists.txt @@ -1,4 +1,2 @@ -add_subdirectory(px_vp20) -add_subdirectory(pxrUsdMayaGL) add_subdirectory(usdMaya) diff --git a/plugin/pxr/maya/lib/px_vp20/CMakeLists.txt b/plugin/pxr/maya/lib/px_vp20/CMakeLists.txt deleted file mode 100644 index f2f8e94ea1..0000000000 --- a/plugin/pxr/maya/lib/px_vp20/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -set(PXR_PACKAGE px_vp20) - -if (NOT ${PXR_ENABLE_GL_SUPPORT}) - message(STATUS - "Skipping ${PXR_PACKAGE} because PXR_ENABLE_GL_SUPPORT is OFF") - return() -endif() - -pxr_shared_library(${PXR_PACKAGE} - LIBRARIES - garch - gf - glf - tf - ${GLEW_LIBRARY} - ${MAYA_OpenMaya_LIBRARY} - ${MAYA_OpenMayaUI_LIBRARY} - ${MAYA_OpenMayaRender_LIBRARY} - ${OPENGL_gl_LIBRARY} - - INCLUDE_DIRS - ${GLEW_INCLUDE_DIR} - ${MAYA_INCLUDE_DIRS} - ${OPENGL_INCLUDE_DIRS} - - PUBLIC_HEADERS - api.h - - PUBLIC_CLASSES - glslProgram - utils - utils_legacy - - DISABLE_PRECOMPILED_HEADERS -) - diff --git a/plugin/pxr/maya/lib/px_vp20/api.h b/plugin/pxr/maya/lib/px_vp20/api.h deleted file mode 100644 index 48fa79ef65..0000000000 --- a/plugin/pxr/maya/lib/px_vp20/api.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright 2017 Pixar -// -// 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. -// -#ifndef PX_VP20_API_H -#define PX_VP20_API_H - -#include "pxr/base/arch/export.h" - -#if defined(PX_VP20_EXPORTS) -# define PX_VP20_API ARCH_EXPORT -# define PX_VP20_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) -# define PX_VP20_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) -#else -# define PX_VP20_API ARCH_IMPORT -# define PX_VP20_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) -# define PX_VP20_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) -#endif -#define PX_VP20_LOCAL ARCH_HIDDEN - -#endif diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/CMakeLists.txt b/plugin/pxr/maya/lib/pxrUsdMayaGL/CMakeLists.txt deleted file mode 100644 index 0fcc145efb..0000000000 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -set(PXR_PACKAGE pxrUsdMayaGL) - -if (NOT ${PXR_ENABLE_GL_SUPPORT}) - message(STATUS - "Skipping ${PXR_PACKAGE} because PXR_ENABLE_GL_SUPPORT is OFF") - return() -endif() - -pxr_shared_library(${PXR_PACKAGE} - LIBRARIES - arch - gf - glf - hd - hdSt - hdx - px_vp20 - sdf - tf - usd - usdGeom - usdImaging - usdImagingGL - usdMaya - vt - ${MAYA_Foundation_LIBRARY} - ${MAYA_OpenMaya_LIBRARY} - ${MAYA_OpenMayaRender_LIBRARY} - ${MAYA_OpenMayaUI_LIBRARY} - - INCLUDE_DIRS - ${Boost_INCLUDE_DIRS} - ${MAYA_INCLUDE_DIRS} - - PUBLIC_HEADERS - api.h - renderParams.h - - PUBLIC_CLASSES - batchRenderer - debugCodes - hdImagingShapeDrawOverride - hdImagingShapeUI - hdRenderer - proxyDrawOverride - proxyShapeUI - sceneDelegate - shapeAdapter - softSelectHelper - usdProxyShapeAdapter - userData - - PRIVATE_CLASSES - instancerImager - instancerShapeAdapter - - CPPFILES - proxyShapeDelegate - - DISABLE_PRECOMPILED_HEADERS -) - diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/api.h b/plugin/pxr/maya/lib/pxrUsdMayaGL/api.h deleted file mode 100644 index 40856405f8..0000000000 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/api.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright 2017 Pixar -// -// 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. -// -#ifndef PXRUSDMAYAGL_API_H -#define PXRUSDMAYAGL_API_H - -#include "pxr/base/arch/export.h" - -#if defined(PXRUSDMAYAGL_EXPORTS) -# define PXRUSDMAYAGL_API ARCH_EXPORT -# define PXRUSDMAYAGL_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) -# define PXRUSDMAYAGL_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) -#else -# define PXRUSDMAYAGL_API ARCH_IMPORT -# define PXRUSDMAYAGL_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) -# define PXRUSDMAYAGL_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) -#endif -#define PXRUSDMAYAGL_LOCAL ARCH_HIDDEN - -#endif diff --git a/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/testProxyShapeDrawUsdChangeProcessing.py b/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/testProxyShapeDrawUsdChangeProcessing.py index 61eee0a70a..6dddd42908 100644 --- a/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/testProxyShapeDrawUsdChangeProcessing.py +++ b/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/testProxyShapeDrawUsdChangeProcessing.py @@ -17,6 +17,8 @@ from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib + from maya import cmds import os @@ -66,7 +68,7 @@ def _WriteViewportImage(self, outputImageName, suffix): height=540) def _RunTest(self, dagPathName): - rootPrim = UsdMaya.GetPrim(dagPathName) + rootPrim = mayaUsdLib.GetPrim(dagPathName) self.assertTrue(rootPrim) prim = rootPrim.GetChild('Geom').GetChild('Primitive') diff --git a/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt b/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt index 66af72489b..e452bde2c6 100644 --- a/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt +++ b/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt @@ -22,6 +22,7 @@ pxr_shared_library(${PXR_PACKAGE} ${MAYA_OpenMaya_LIBRARY} ${MAYA_OpenMayaAnim_LIBRARY} ${MAYA_OpenMayaRender_LIBRARY} + ${MAYA_OpenMayaUI_LIBRARY} mayaUsd INCLUDE_DIRS @@ -32,47 +33,8 @@ pxr_shared_library(${PXR_PACKAGE} api.h PUBLIC_CLASSES - adaptor - blockSceneModificationContext - diagnosticDelegate editUtil - hdImagingShape - jobArgs - meshUtil - pointBasedDeformerNode - primReader - primReaderArgs - primReaderContext - primReaderRegistry - primWriter - primWriterArgs - primWriterContext - primWriterRegistry - readUtil - roundTripUtil - shaderWriter - shadingModeExporter - shadingModeExporterContext - shadingModeImporter - shadingModeRegistry - shadingUtil - stageNode - transformWriter - translatorCamera - translatorCurves - translatorGprim - translatorMaterial - translatorMesh - translatorModelAssembly - translatorNurbsPatch - translatorPrim - translatorRfMLight - translatorSkel - translatorUtil - translatorXformable - writeJobContext - writeUtil - xformStack + translatorModelAssembly exportCommand exportTranslator @@ -81,52 +43,18 @@ pxr_shared_library(${PXR_PACKAGE} listShadingModesCommand proxyShape referenceAssembly - undoHelperCommand - - chaser - chaserRegistry - - userTaggedAttribute PRIVATE_CLASSES - fallbackPrimReader - functorPrimReader - functorPrimWriter - instancedNodeWriter - modelKindProcessor - readJob - registryHelper - skelBindingsProcessor - writeJob - - PRIVATE_HEADERS - shadingModePxrRis_rfm_map.h + readJobWithSceneAssembly + instancerShapeAdapterWithSceneAssembly CPPFILES - shadingModeDisplayColor.cpp - shadingModePxrRis.cpp - shadingModeUseRegistry.cpp - translatorMesh_PrimVars.cpp - translatorMesh_SubDiv.cpp - translatorXformable_decompose.cpp readJob_ImportWithProxies.cpp PYMODULE_CPPFILES module.cpp wrapAssembly.cpp - wrapBlockSceneModificationContext.cpp - wrapColorSpace.cpp - wrapDiagnosticDelegate.cpp wrapEditUtil.cpp - wrapMeshUtil.cpp - wrapQuery.cpp - wrapReadUtil.cpp - wrapRoundTripUtil.cpp - wrapStageCache.cpp - wrapAdaptor.cpp - wrapUserTaggedAttribute.cpp - wrapWriteUtil.cpp - wrapXformStack.cpp PYMODULE_FILES __init__.py diff --git a/plugin/pxr/maya/lib/usdMaya/exportCommand.cpp b/plugin/pxr/maya/lib/usdMaya/exportCommand.cpp index 8f9d50f6fd..9eecaba0f3 100644 --- a/plugin/pxr/maya/lib/usdMaya/exportCommand.cpp +++ b/plugin/pxr/maya/lib/usdMaya/exportCommand.cpp @@ -15,10 +15,10 @@ // #include "usdMaya/exportCommand.h" -#include "usdMaya/shadingModeRegistry.h" +#include #include -#include "usdMaya/writeJob.h" -#include "usdMaya/writeUtil.h" +#include +#include #include "pxr/usd/usdGeom/tokens.h" diff --git a/plugin/pxr/maya/lib/usdMaya/exportTranslator.cpp b/plugin/pxr/maya/lib/usdMaya/exportTranslator.cpp index 321d5f1a14..b8f8c7ae22 100644 --- a/plugin/pxr/maya/lib/usdMaya/exportTranslator.cpp +++ b/plugin/pxr/maya/lib/usdMaya/exportTranslator.cpp @@ -15,10 +15,10 @@ // #include "usdMaya/exportTranslator.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/shadingModeRegistry.h" -#include "usdMaya/writeJob.h" -#include "usdMaya/writeUtil.h" +#include +#include +#include +#include #include #include diff --git a/plugin/pxr/maya/lib/usdMaya/exportTranslator.h b/plugin/pxr/maya/lib/usdMaya/exportTranslator.h index 4f40c71993..c77954edb8 100644 --- a/plugin/pxr/maya/lib/usdMaya/exportTranslator.h +++ b/plugin/pxr/maya/lib/usdMaya/exportTranslator.h @@ -19,7 +19,7 @@ /// \file usdMaya/exportTranslator.h #include "usdMaya/api.h" -#include "usdMaya/jobArgs.h" +#include #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/importCommand.cpp b/plugin/pxr/maya/lib/usdMaya/importCommand.cpp index 2fd6b53354..9c0b81ab96 100644 --- a/plugin/pxr/maya/lib/usdMaya/importCommand.cpp +++ b/plugin/pxr/maya/lib/usdMaya/importCommand.cpp @@ -15,9 +15,9 @@ // #include "usdMaya/importCommand.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/readJob.h" -#include "usdMaya/shadingModeRegistry.h" +#include +#include "usdMaya/readJobWithSceneAssembly.h" +#include #include "pxr/usd/ar/resolver.h" @@ -201,7 +201,7 @@ UsdMayaImportCommand::doIt(const MArgList & args) /* importWithProxyShapes = */ false, timeInterval); - mUsdReadJob = new UsdMaya_ReadJob(mFileName, mPrimPath, mVariants, jobArgs); + mUsdReadJob = new UsdMaya_ReadJobWithSceneAssembly(mFileName, mPrimPath, mVariants, jobArgs); // Add optional command params if (argData.isFlagSet("parent")) { diff --git a/plugin/pxr/maya/lib/usdMaya/importCommand.h b/plugin/pxr/maya/lib/usdMaya/importCommand.h index 6165219354..52d81727de 100644 --- a/plugin/pxr/maya/lib/usdMaya/importCommand.h +++ b/plugin/pxr/maya/lib/usdMaya/importCommand.h @@ -31,7 +31,7 @@ PXR_NAMESPACE_OPEN_SCOPE -class UsdMaya_ReadJob; +class UsdMaya_ReadJobWithSceneAssembly; class UsdMayaImportCommand : public MPxCommand { @@ -55,7 +55,7 @@ class UsdMayaImportCommand : public MPxCommand static void* creator(); private: - UsdMaya_ReadJob* mUsdReadJob; + UsdMaya_ReadJobWithSceneAssembly* mUsdReadJob; }; diff --git a/plugin/pxr/maya/lib/usdMaya/importTranslator.cpp b/plugin/pxr/maya/lib/usdMaya/importTranslator.cpp index 09e6df35f7..1705f2b72b 100644 --- a/plugin/pxr/maya/lib/usdMaya/importTranslator.cpp +++ b/plugin/pxr/maya/lib/usdMaya/importTranslator.cpp @@ -15,10 +15,9 @@ // #include "usdMaya/importTranslator.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/readJob.h" -#include "usdMaya/shadingModeRegistry.h" -#include "usdMaya/writeJob.h" +#include "usdMaya/readJobWithSceneAssembly.h" +#include +#include #include "pxr/base/gf/interval.h" #include "pxr/base/vt/dictionary.h" @@ -112,13 +111,10 @@ UsdMayaImportTranslator::reader( userArgs, /* importWithProxyShapes = */ false, timeInterval); - UsdMaya_ReadJob* mUsdReadJob = - new UsdMaya_ReadJob(fileName, - primPath, - variants, - jobArgs); + UsdMaya_ReadJobWithSceneAssembly mUsdReadJob( + fileName, primPath, variants, jobArgs); std::vector addedDagPaths; - bool success = mUsdReadJob->Read(&addedDagPaths); + bool success = mUsdReadJob.Read(&addedDagPaths); return (success) ? MS::kSuccess : MS::kFailure; } diff --git a/plugin/pxr/maya/lib/usdMaya/importTranslator.h b/plugin/pxr/maya/lib/usdMaya/importTranslator.h index fd2c7303f3..1ad0cac1e8 100644 --- a/plugin/pxr/maya/lib/usdMaya/importTranslator.h +++ b/plugin/pxr/maya/lib/usdMaya/importTranslator.h @@ -20,7 +20,7 @@ #include "usdMaya/api.h" -#include "usdMaya/jobArgs.h" +#include #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.cpp b/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.cpp new file mode 100644 index 0000000000..b00e0244bc --- /dev/null +++ b/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.cpp @@ -0,0 +1,135 @@ +// +// Copyright 2018 Pixar +// +// 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. +// +#include "usdMaya/instancerShapeAdapterWithSceneAssembly.h" + +#include +#include + +#include "usdMaya/referenceAssembly.h" + +#include +#include + +PXR_NAMESPACE_OPEN_SCOPE + +UsdMayaGL_InstancerShapeAdapterWithSceneAssembly::UsdMayaGL_InstancerShapeAdapterWithSceneAssembly() +{ + TF_DEBUG(PXRUSDMAYAGL_SHAPE_ADAPTER_LIFECYCLE).Msg( + "Constructing UsdMayaGL_InstancerShapeAdapterWithSceneAssembly: %p\n", + this); +} + +/* virtual */ +UsdMayaGL_InstancerShapeAdapterWithSceneAssembly::~UsdMayaGL_InstancerShapeAdapterWithSceneAssembly() +{ + TF_DEBUG(PXRUSDMAYAGL_SHAPE_ADAPTER_LIFECYCLE).Msg( + "Destructing UsdMayaGL_InstancerShapeAdapterWithSceneAssembly: %p\n", + this); +} + +/* virtual */ +void UsdMayaGL_InstancerShapeAdapterWithSceneAssembly::SyncInstancerPerPrototypePostHook( + const MPlug& hierarchyPlug, + UsdPrim& prototypePrim, + std::vector& layerIdsToMute +) +{ + UsdReferences prototypeRefs = prototypePrim.GetReferences(); + prototypeRefs.ClearReferences(); + + // Collect data about what prototype this is. + MPlug source = UsdMayaUtil::GetConnected(hierarchyPlug); + if (source.isNull()) { + return; + } + + MStatus status; + MFnDependencyNode sourceNode(source.node(), &status); + if (!status) { + return; + } + + // If this is a non-full-representation USD reference assembly, add a + // reference. Otherwise, leave the prim empty. + if (sourceNode.typeId() != UsdMayaReferenceAssembly::typeId) { + return; + } + + UsdMayaReferenceAssembly* usdRefAssem = + dynamic_cast( + sourceNode.userNode()); + if (!usdRefAssem) { + return; + } + + if (usdRefAssem->getActive() == + UsdMayaRepresentationFull::_assemblyType) { + return; + } + + UsdPrim prim = usdRefAssem->usdPrim(); + if (!prim) { + return; + } + + // Add main reference data. + const std::string& layerId = + prim.GetStage()->GetRootLayer()->GetIdentifier(); + const SdfPath primPath = prim.GetPath(); + prototypeRefs.AddReference(SdfReference(layerId, primPath)); + + // Reference session data. + // We also mute any sublayers of the session layer, because those + // correspond to assembly edits generated by UsdMayaReferenceAssembly, + // and UsdMayaReferenceAssembly won't give us the assembly edits + // consistently between different representations. + // (Most session layers won't have sublayers; they only show up when + // there's assembly edits in Collapsed/Expanded representations.) + // XXX Handle assembly edits on instancer prototypes? + if (SdfLayerHandle sessionLayer = prim.GetStage()->GetSessionLayer()) { + if (sessionLayer->GetPrimAtPath(primPath)) { + prototypeRefs.AddReference( + SdfReference(sessionLayer->GetIdentifier(), primPath), + UsdListPositionFrontOfPrependList); + const SdfSubLayerProxy subLayers = + sessionLayer->GetSubLayerPaths(); + layerIdsToMute.insert( + layerIdsToMute.end(), + subLayers.begin(), + subLayers.end()); + } + } + + // Also handles instancerTranslate. + // These are all in "physical", not "logical" indices. + auto holder = UsdMayaUtil::GetPlugDataHandle(hierarchyPlug); + MMatrix mMat = MFnMatrixData(holder->GetDataHandle().data()).matrix(); + GfMatrix4d gfMat(mMat.matrix); + + MPlug translatePlug = sourceNode.findPlug("translate", &status); + if (status) { + // OK if we didn't find plug, assume instancerTranslate is zero. + GfVec3d tr(translatePlug.child(0).asDouble(), + translatePlug.child(1).asDouble(), + translatePlug.child(2).asDouble()); + gfMat = gfMat * GfMatrix4d().SetTranslate(-tr); + } + + UsdGeomXformable xformable(prototypePrim); + xformable.MakeMatrixXform().Set(gfMat); +} + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.h b/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.h new file mode 100644 index 0000000000..dfb4427ed6 --- /dev/null +++ b/plugin/pxr/maya/lib/usdMaya/instancerShapeAdapterWithSceneAssembly.h @@ -0,0 +1,52 @@ +// +// Copyright 2018 Pixar +// +// 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. +// +#ifndef PXRUSDMAYAGL_INSTANCER_SHAPE_ADAPTER_WITH_SCENE_ASSEMBLY_H +#define PXRUSDMAYAGL_INSTANCER_SHAPE_ADAPTER_WITH_SCENE_ASSEMBLY_H + +/// \file pxrUsdMayaGL/instancerShapeAdapter.h + +#include + +PXR_NAMESPACE_OPEN_SCOPE + +/// Class to manage translation of native Maya instancers into +/// UsdGeomPointInstancers for imaging with Hydra. +/// This adapter will translate instancer prototypes that are USD reference +/// assemblies into UsdGeomPointInstancer prototypes, ignoring any prototypes +/// that are not reference assemblies. +class UsdMayaGL_InstancerShapeAdapterWithSceneAssembly : public UsdMayaGL_InstancerShapeAdapter +{ + public: + + ~UsdMayaGL_InstancerShapeAdapterWithSceneAssembly() override; + + /// Construct a new uninitialized UsdMayaGL_InstancerShapeAdapterWithSceneAssembly. + UsdMayaGL_InstancerShapeAdapterWithSceneAssembly(); + + private: + + // For each prototype in _SyncInstancerPrototypes(), perform scene + // assembly node processing. + void SyncInstancerPerPrototypePostHook( + const MPlug& hierarchyPlug, + UsdPrim& prototypePrim, + std::vector& layerIdsToMute + ) override; +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/plugin/pxr/maya/lib/usdMaya/listShadingModesCommand.cpp b/plugin/pxr/maya/lib/usdMaya/listShadingModesCommand.cpp index 62f3f57ecb..48c390a9a2 100644 --- a/plugin/pxr/maya/lib/usdMaya/listShadingModesCommand.cpp +++ b/plugin/pxr/maya/lib/usdMaya/listShadingModesCommand.cpp @@ -15,8 +15,8 @@ // #include "usdMaya/listShadingModesCommand.h" -#include "usdMaya/registryHelper.h" -#include "usdMaya/shadingModeRegistry.h" +#include +#include #include #include diff --git a/plugin/pxr/maya/lib/usdMaya/module.cpp b/plugin/pxr/maya/lib/usdMaya/module.cpp index 6d6ff07a45..6584ee328e 100644 --- a/plugin/pxr/maya/lib/usdMaya/module.cpp +++ b/plugin/pxr/maya/lib/usdMaya/module.cpp @@ -19,18 +19,6 @@ PXR_NAMESPACE_USING_DIRECTIVE TF_WRAP_MODULE { - TF_WRAP(Adaptor); TF_WRAP(Assembly); - TF_WRAP(BlockSceneModificationContext); - TF_WRAP(ColorSpace); - TF_WRAP(DiagnosticDelegate); TF_WRAP(EditUtil); - TF_WRAP(MeshUtil); - TF_WRAP(Query); - TF_WRAP(ReadUtil); - TF_WRAP(RoundTripUtil); - TF_WRAP(StageCache); - TF_WRAP(UserTaggedAttribute); - TF_WRAP(WriteUtil); - TF_WRAP(XformStack); } diff --git a/plugin/pxr/maya/lib/usdMaya/proxyShape.cpp b/plugin/pxr/maya/lib/usdMaya/proxyShape.cpp index b6f19e5b75..704fb96bf2 100644 --- a/plugin/pxr/maya/lib/usdMaya/proxyShape.cpp +++ b/plugin/pxr/maya/lib/usdMaya/proxyShape.cpp @@ -15,12 +15,13 @@ // #include "usdMaya/proxyShape.h" -#include "usdMaya/hdImagingShape.h" +#include #include #include #include #include #include +#include #include "pxr/base/gf/bbox3d.h" #include "pxr/base/gf/range3d.h" @@ -322,5 +323,21 @@ void UsdMayaProxyShape::postConstructor() } } +/// Delegate for returning whether object soft-select mode is currently on +/// Technically, we could make ProxyShape track this itself, but then that would +/// be making two callbacks to track the same thing... so we use BatchRenderer +/// implementation +bool +UsdMayaGL_ObjectSoftSelectEnabled() +{ + return UsdMayaGLBatchRenderer::GetInstance().GetObjectSoftSelectEnabled(); +} + + +TF_REGISTRY_FUNCTION(UsdMayaProxyShape) +{ + UsdMayaProxyShape::SetObjectSoftSelectEnabledDelegate( + UsdMayaGL_ObjectSoftSelectEnabled); +} PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.cpp b/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.cpp new file mode 100644 index 0000000000..d0c600ea69 --- /dev/null +++ b/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.cpp @@ -0,0 +1,126 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#include + +#include "usdMaya/readJobWithSceneAssembly.h" +#include "usdMaya/translatorModelAssembly.h" + +PXR_NAMESPACE_OPEN_SCOPE + +// For now, we hard code this to use displayColor. But maybe the more +// appropriate thing to do is just to leave shadingMode alone and pass +// "displayColor" in from the UsdMayaRepresentationFull +// (usdMaya/referenceAssembly.cpp) +const static TfToken ASSEMBLY_SHADING_MODE = UsdMayaShadingModeTokens->displayColor; + +UsdMaya_ReadJobWithSceneAssembly::UsdMaya_ReadJobWithSceneAssembly( + const std::string &iFileName, + const std::string &iPrimPath, + const std::map& iVariants, + const UsdMayaJobImportArgs &iArgs) : + UsdMaya_ReadJob(iFileName, iPrimPath, iVariants, iArgs) +{ +} + +UsdMaya_ReadJobWithSceneAssembly::~UsdMaya_ReadJobWithSceneAssembly() +{ +} + +bool +UsdMaya_ReadJobWithSceneAssembly::DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootPrim) +{ + return mArgs.importWithProxyShapes ? + _DoImportWithProxies(rootRange) : _DoImport(rootRange, usdRootPrim); +} + +bool UsdMaya_ReadJobWithSceneAssembly::OverridePrimReader( + const UsdPrim& usdRootPrim, + const UsdPrim& prim, + const UsdMayaPrimReaderArgs& args, + UsdMayaPrimReaderContext& readCtx, + UsdPrimRange::iterator& primIt +) +{ + // If we are NOT importing on behalf of an assembly, then we'll + // create reference assembly nodes that target the asset file + // and the root prims of those assets directly. This ensures + // that a re-export will work correctly, since USD references + // can only target root prims. + std::string assetIdentifier; + SdfPath assetPrimPath; + if (UsdMayaTranslatorModelAssembly::ShouldImportAsAssembly( + usdRootPrim, + prim, + &assetIdentifier, + &assetPrimPath)) { + const bool isSceneAssembly = + GetMayaRootDagPath().node().hasFn(MFn::kAssembly); + if (isSceneAssembly) { + // If we ARE importing on behalf of an assembly, we use + // the file path of the top-level assembly and the path + // to the prim within that file when creating the + // reference assembly. + assetIdentifier = mFileName; + assetPrimPath = prim.GetPath(); + } + + // Note that if assemblyRep == "Import", the assembly reader + // will NOT run and we will fall through to the prim reader. + MObject parentNode = readCtx.GetMayaNode( + prim.GetPath().GetParentPath(), false); + if (UsdMayaTranslatorModelAssembly::Read( + prim, + assetIdentifier, + assetPrimPath, + parentNode, + args, + &readCtx, + mArgs.assemblyRep)) { + if (readCtx.GetPruneChildren()) { + primIt.PruneChildren(); + } + return true; + } + } + return false; +} + +void UsdMaya_ReadJobWithSceneAssembly::PreImport(Usd_PrimFlagsPredicate& returnPredicate) +{ + const bool isSceneAssembly = mMayaRootDagPath.node().hasFn(MFn::kAssembly); + if (isSceneAssembly) { + mArgs.shadingMode = ASSEMBLY_SHADING_MODE; + + // When importing on behalf of a scene assembly, we want to make sure + // that we traverse down into instances. The expectation is that the + // user switched an assembly to its Expanded or Full representation + // because they want to see the hierarchy underneath it, possibly with + // the intention of making modifications down there. As a result, we + // don't really want to try to preserve instancing, but we do need to + // be able to access the scene description below the root prim. + returnPredicate.TraverseInstanceProxies(true); + } +} + +bool UsdMaya_ReadJobWithSceneAssembly::SkipRootPrim(bool isImportingPseudoRoot) +{ + // Skip the root prim if it is the pseudoroot, or if we are importing + // on behalf of a scene assembly. + return isImportingPseudoRoot || + mMayaRootDagPath.node().hasFn(MFn::kAssembly); +} + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.h b/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.h new file mode 100644 index 0000000000..8ce1f90441 --- /dev/null +++ b/plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.h @@ -0,0 +1,73 @@ +// +// Copyright 2016 Pixar +// +// 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. +// +#ifndef PXRUSDMAYA_READ_JOB_WITH_SCENE_ASSEMBLY_H +#define PXRUSDMAYA_READ_JOB_WITH_SCENE_ASSEMBLY_H + +/// \file usdMaya/readJobWithSceneAssembly.h + +#include + +PXR_NAMESPACE_OPEN_SCOPE + +class UsdMaya_ReadJobWithSceneAssembly : public UsdMaya_ReadJob +{ +public: + UsdMaya_ReadJobWithSceneAssembly( + const std::string& iFileName, + const std::string& iPrimPath, + const std::map& iVariants, + const UsdMayaJobImportArgs & iArgs); + + ~UsdMaya_ReadJobWithSceneAssembly(); + +private: + + bool DoImport(UsdPrimRange& range, const UsdPrim& usdRootPrim) override; + bool OverridePrimReader( + const UsdPrim& usdRootPrim, + const UsdPrim& prim, + const UsdMayaPrimReaderArgs& args, + UsdMayaPrimReaderContext& readCtx, + UsdPrimRange::iterator& primIt + ) override; + + // Hook to set the shading mode if dealing with scene assembly. + void PreImport(Usd_PrimFlagsPredicate& returnPredicate) override; + + bool SkipRootPrim(bool isImportingPseudoRoot) override; + + // XXX: Activating the 'Expanded' representation of a USD reference assembly + // node is very much like performing a regular UsdMaya_ReadJob but with + // a few key differences (e.g. creating proxy shapes at collapse points). + // This private helper method covers the functionality of an 'Expanded' + // representation-style import. It would be great if we could combine + // these into a single traversal at some point. + bool _DoImportWithProxies(UsdPrimRange& range); + + // These are helper methods for the proxy import method. + bool _ProcessProxyPrims( + const std::vector& proxyPrims, + const UsdPrim& pxrGeomRoot, + const std::vector& collapsePointPathStrings); + bool _ProcessSubAssemblyPrims(const std::vector& subAssemblyPrims); + bool _ProcessCameraPrims(const std::vector& cameraPrims); +}; + + +PXR_NAMESPACE_CLOSE_SCOPE + + +#endif diff --git a/plugin/pxr/maya/lib/usdMaya/readJob_ImportWithProxies.cpp b/plugin/pxr/maya/lib/usdMaya/readJob_ImportWithProxies.cpp index fbe3ab1185..64a7f67549 100644 --- a/plugin/pxr/maya/lib/usdMaya/readJob_ImportWithProxies.cpp +++ b/plugin/pxr/maya/lib/usdMaya/readJob_ImportWithProxies.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "usdMaya/readJob.h" +#include "usdMaya/readJobWithSceneAssembly.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primReaderRegistry.h" +#include +#include +#include #include #include "usdMaya/translatorModelAssembly.h" -#include "usdMaya/translatorUtil.h" +#include #include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/stringUtils.h" @@ -170,7 +170,7 @@ _CreateParentTransformNodes( } bool -UsdMaya_ReadJob::_ProcessProxyPrims( +UsdMaya_ReadJobWithSceneAssembly::_ProcessProxyPrims( const std::vector& proxyPrims, const UsdPrim& pxrGeomRoot, const std::vector& collapsePointPathStrings) @@ -225,7 +225,7 @@ UsdMaya_ReadJob::_ProcessProxyPrims( } bool -UsdMaya_ReadJob::_ProcessSubAssemblyPrims( +UsdMaya_ReadJobWithSceneAssembly::_ProcessSubAssemblyPrims( const std::vector& subAssemblyPrims) { TF_FOR_ALL(iter, subAssemblyPrims) { @@ -259,7 +259,7 @@ UsdMaya_ReadJob::_ProcessSubAssemblyPrims( } bool -UsdMaya_ReadJob::_ProcessCameraPrims(const std::vector& cameraPrims) +UsdMaya_ReadJobWithSceneAssembly::_ProcessCameraPrims(const std::vector& cameraPrims) { TF_FOR_ALL(iter, cameraPrims) { const UsdPrim cameraPrim = *iter; @@ -283,7 +283,7 @@ UsdMaya_ReadJob::_ProcessCameraPrims(const std::vector& cameraPrims) } bool -UsdMaya_ReadJob::_DoImportWithProxies(UsdPrimRange& range) +UsdMaya_ReadJobWithSceneAssembly::_DoImportWithProxies(UsdPrimRange& range) { MStatus status; diff --git a/plugin/pxr/maya/lib/usdMaya/referenceAssembly.cpp b/plugin/pxr/maya/lib/usdMaya/referenceAssembly.cpp index 950e686f50..13fb7dd075 100644 --- a/plugin/pxr/maya/lib/usdMaya/referenceAssembly.cpp +++ b/plugin/pxr/maya/lib/usdMaya/referenceAssembly.cpp @@ -16,13 +16,15 @@ #include "usdMaya/referenceAssembly.h" #include "usdMaya/editUtil.h" -#include "usdMaya/jobArgs.h" +#include #include #include "usdMaya/proxyShape.h" #include -#include "usdMaya/readJob.h" +#include "usdMaya/readJobWithSceneAssembly.h" #include #include +#include +#include "usdMaya/instancerShapeAdapterWithSceneAssembly.h" #include "pxr/base/tf/fileUtils.h" #include "pxr/base/tf/registryManager.h" @@ -1528,7 +1530,7 @@ bool UsdMayaRepresentationHierBase::activate() UsdMayaJobImportArgs::CreateFromDictionary( userArgs, shouldImportWithProxies, GfInterval::GetFullInterval()); - UsdMaya_ReadJob readJob(usdFilePath.asChar(), + UsdMaya_ReadJobWithSceneAssembly readJob(usdFilePath.asChar(), usdPrimPath.asChar(), variantSetSelections, importArgs); @@ -1561,5 +1563,28 @@ const MString UsdMayaRepresentationExpanded::_assemblyType("Expanded"); const MString UsdMayaRepresentationFull::_assemblyType("Full"); -PXR_NAMESPACE_CLOSE_SCOPE +bool UsdMayaGL_InstancerImager_ContinueTrackingOnDisconnect( + const MFnDependencyNode& fn +) +{ + // There's at least one USD reference assembly still connected to + // this point instancer, so continue tracking the instancer node. + return (fn.typeId() == UsdMayaReferenceAssembly::typeId); +} + +UsdMayaGL_InstancerShapeAdapter* +UsdMayaGL_InstancerImager_InstancerShapeAdapterFactory() +{ + return new UsdMayaGL_InstancerShapeAdapterWithSceneAssembly(); +} +TF_REGISTRY_FUNCTION(UsdMayaReferenceAssembly) +{ + UsdMayaGL_InstancerImager::GetInstance(); + UsdMayaGL_InstancerImager::SetContinueTrackingOnDisconnectDelegate( + UsdMayaGL_InstancerImager_ContinueTrackingOnDisconnect); + UsdMayaGL_InstancerImager::SetInstancerShapeAdapterFactory( + UsdMayaGL_InstancerImager_InstancerShapeAdapterFactory); +} + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportShadingModeDisplayColor.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportShadingModeDisplayColor.py index e7c8614ad7..5b89344ba3 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportShadingModeDisplayColor.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportShadingModeDisplayColor.py @@ -15,13 +15,13 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Gf from pxr import Usd from pxr import UsdGeom from pxr import UsdShade +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -73,7 +73,7 @@ def testExportDisplayColorShading(self): meshDisplayColors = cubeMesh.GetDisplayColorPrimvar().Get() self.assertEqual(len(meshDisplayColors), 1) self.assertTrue(Gf.IsClose(meshDisplayColors[0], - UsdMaya.ConvertMayaToLinear(self.RED_COLOR), + mayaUsdLib.ConvertMayaToLinear(self.RED_COLOR), 1e-6)) # Validate the Material prim bound to the Mesh prim. @@ -89,7 +89,7 @@ def testExportDisplayColorShading(self): materialInput = material.GetInput('displayColor') matDisplayColor = materialInput.Get() self.assertTrue(Gf.IsClose(matDisplayColor, - UsdMaya.ConvertMayaToLinear(self.RED_COLOR), + mayaUsdLib.ConvertMayaToLinear(self.RED_COLOR), 1e-6)) # Just verify that displayOpacity and transparency exist. diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportUVSets.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportUVSets.py index 00142fd43c..e96c6a4e08 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportUVSets.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdExportUVSets.py @@ -15,8 +15,6 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Gf from pxr import Sdf from pxr import Tf @@ -24,6 +22,8 @@ from pxr import UsdGeom from pxr import Vt +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -43,7 +43,7 @@ def _AssertUVPrimvar(self, primvar, if expectedUnauthoredValuesIndex is None: expectedUnauthoredValuesIndex = -1 - if not UsdMaya.WriteUtil.WriteUVAsFloat2(): + if not mayaUsdLib.WriteUtil.WriteUVAsFloat2(): self.assertEqual(primvar.GetTypeName(), Sdf.ValueTypeNames.TexCoord2fArray) else: self.assertEqual(primvar.GetTypeName(), Sdf.ValueTypeNames.Float2Array) @@ -65,7 +65,7 @@ def setUpClass(cls): standalone.initialize('usd') cmds.loadPlugin('pxrUsd') - if not UsdMaya.WriteUtil.WriteUVAsFloat2(): + if not mayaUsdLib.WriteUtil.WriteUVAsFloat2(): cmds.file(os.path.abspath('UsdExportUVSetsTest.ma'), open=True, force=True) else: diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportMesh.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportMesh.py index 302ad55a61..38a10f0209 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportMesh.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportMesh.py @@ -15,10 +15,10 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import UsdGeom +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -26,7 +26,7 @@ import unittest -class testUsdExportMesh(unittest.TestCase): +class testUsdImportMesh(unittest.TestCase): @classmethod def setUpClass(cls): @@ -44,7 +44,7 @@ def testImportPoly(self): mesh = 'PolyMeshShape' self.assertTrue(cmds.objExists(mesh)) - schema = UsdMaya.Adaptor(mesh).GetSchema(UsdGeom.Mesh) + schema = mayaUsdLib.Adaptor(mesh).GetSchema(UsdGeom.Mesh) subdivisionScheme = schema.GetAttribute( UsdGeom.Tokens.subdivisionScheme).Get() self.assertEqual(subdivisionScheme, UsdGeom.Tokens.none) @@ -64,7 +64,7 @@ def testImportSubdiv(self): mesh = 'SubdivMeshShape' self.assertTrue(cmds.objExists(mesh)) - schema = UsdMaya.Adaptor(mesh).GetSchema(UsdGeom.Mesh) + schema = mayaUsdLib.Adaptor(mesh).GetSchema(UsdGeom.Mesh) subdivisionScheme = \ schema.GetAttribute(UsdGeom.Tokens.subdivisionScheme).Get() self.assertIsNone(subdivisionScheme) diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportUVSets.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportUVSets.py index 964e427c59..545aac6727 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportUVSets.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdImportUVSets.py @@ -15,11 +15,11 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Gf from pxr import Tf +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone from maya.api import OpenMaya as OM @@ -72,7 +72,7 @@ def setUpClass(cls): cmds.loadPlugin('pxrUsd') usdFile = "" - if UsdMaya.ReadUtil.ReadFloat2AsUV(): + if mayaUsdLib.ReadUtil.ReadFloat2AsUV(): usdFile = os.path.abspath('UsdImportUVSetsTest_Float.usda') else: usdFile = os.path.abspath('UsdImportUVSetsTest.usda') @@ -301,7 +301,7 @@ def testImportUVSetForMeshWithCreases(self): # We need to load this mesh from a separate USD file because importing # it caused a crash (that this test verifies should no longer happen). usdFile = "" - if UsdMaya.ReadUtil.ReadFloat2AsUV(): + if mayaUsdLib.ReadUtil.ReadFloat2AsUV(): usdFile = os.path.abspath('UsdImportUVSetsTestWithCreases_Float.usda') else: usdFile = os.path.abspath('UsdImportUVSetsTestWithCreases.usda') diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptor.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptor.py index 255d7ec5de..9fee5df3aa 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptor.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptor.py @@ -17,6 +17,8 @@ from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib + from pxr import Sdf from pxr import Tf from pxr import UsdGeom @@ -43,7 +45,7 @@ def testApplySchema(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - proxy = UsdMaya.Adaptor('group1') + proxy = mayaUsdLib.Adaptor('group1') self.assertTrue(proxy) self.assertEqual(proxy.GetAppliedSchemas(), []) @@ -73,7 +75,7 @@ def testGetSchema(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - proxy = UsdMaya.Adaptor('group1') + proxy = mayaUsdLib.Adaptor('group1') self.assertTrue(proxy.GetSchema(UsdGeom.ModelAPI)) self.assertTrue(proxy.GetSchema(UsdGeom.Xform)) @@ -91,7 +93,7 @@ def testUnapplySchema(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - proxy = UsdMaya.Adaptor('group1') + proxy = mayaUsdLib.Adaptor('group1') self.assertEqual(proxy.GetAppliedSchemas(), []) proxy.ApplySchema(UsdGeom.ModelAPI) @@ -117,8 +119,8 @@ def testAttributes(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - modelAPI = UsdMaya.Adaptor('group1').ApplySchema(UsdGeom.ModelAPI) - xform = UsdMaya.Adaptor('group1').GetSchema(UsdGeom.Xform) + modelAPI = mayaUsdLib.Adaptor('group1').ApplySchema(UsdGeom.ModelAPI) + xform = mayaUsdLib.Adaptor('group1').GetSchema(UsdGeom.Xform) # Schema attributes list versus authored attributes list. self.assertIn(UsdGeom.Tokens.modelCardTextureXPos, @@ -173,7 +175,7 @@ def testMetadata(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - proxy = UsdMaya.Adaptor('group1') + proxy = mayaUsdLib.Adaptor('group1') self.assertEqual(proxy.GetAllAuthoredMetadata(), {}) self.assertIsNone(proxy.GetMetadata("instanceable")) @@ -203,8 +205,8 @@ def testMetadata(self): def testStaticHelpers(self): """Tests the static helpers for querying metadata and schema info.""" - self.assertIn("MotionAPI", UsdMaya.Adaptor.GetRegisteredAPISchemas()) - self.assertIn("hidden", UsdMaya.Adaptor.GetPrimMetadataFields()) + self.assertIn("MotionAPI", mayaUsdLib.Adaptor.GetRegisteredAPISchemas()) + self.assertIn("hidden", mayaUsdLib.Adaptor.GetPrimMetadataFields()) def testAttributeAliases(self): """Tests behavior with the purpose/USD_purpose alias.""" @@ -214,7 +216,7 @@ def testAttributeAliases(self): cmds.addAttr("group1", longName="USD_purpose", dataType="string") cmds.setAttr("group1.USD_purpose", "proxy", type="string") self.assertEqual( - UsdMaya.Adaptor("group1") + mayaUsdLib.Adaptor("group1") .GetSchema(UsdGeom.Xform) .GetAttribute(UsdGeom.Tokens.purpose) .Get(), @@ -224,7 +226,7 @@ def testAttributeAliases(self): dataType="string") cmds.setAttr("group1.USD_ATTR_purpose", "render", type="string") self.assertEqual( - UsdMaya.Adaptor("group1") + mayaUsdLib.Adaptor("group1") .GetSchema(UsdGeom.Xform) .GetAttribute(UsdGeom.Tokens.purpose) .Get(), @@ -232,7 +234,7 @@ def testAttributeAliases(self): cmds.deleteAttr("group1.USD_purpose") self.assertEqual( - UsdMaya.Adaptor("group1") + mayaUsdLib.Adaptor("group1") .GetSchema(UsdGeom.Xform) .GetAttribute(UsdGeom.Tokens.purpose) .Get(), @@ -240,12 +242,12 @@ def testAttributeAliases(self): cmds.deleteAttr("group1.USD_ATTR_purpose") self.assertIsNone( - UsdMaya.Adaptor("group1") + mayaUsdLib.Adaptor("group1") .GetSchema(UsdGeom.Xform) .GetAttribute(UsdGeom.Tokens.purpose) .Get()) - UsdMaya.Adaptor("group1")\ + mayaUsdLib.Adaptor("group1")\ .GetSchema(UsdGeom.Xform)\ .CreateAttribute(UsdGeom.Tokens.purpose) self.assertTrue(cmds.attributeQuery("USD_ATTR_purpose", node="group1", @@ -256,46 +258,46 @@ def testConcreteSchemaRegistrations(self): cmds.file(new=True, force=True) cmds.createNode("joint", name="TestJoint") self.assertTrue( - UsdMaya.Adaptor("TestJoint").GetSchema(UsdSkel.Skeleton)) + mayaUsdLib.Adaptor("TestJoint").GetSchema(UsdSkel.Skeleton)) self.assertFalse( - UsdMaya.Adaptor("TestJoint").GetSchema(UsdGeom.Mesh)) + mayaUsdLib.Adaptor("TestJoint").GetSchema(UsdGeom.Mesh)) cmds.createNode("camera", name="TestCamera") self.assertTrue( - UsdMaya.Adaptor("TestCamera").GetSchema(UsdGeom.Camera)) + mayaUsdLib.Adaptor("TestCamera").GetSchema(UsdGeom.Camera)) cmds.createNode("mesh", name="TestMesh") self.assertTrue( - UsdMaya.Adaptor("TestMesh").GetSchema(UsdGeom.Mesh)) + mayaUsdLib.Adaptor("TestMesh").GetSchema(UsdGeom.Mesh)) cmds.createNode("instancer", name="TestInstancer") self.assertTrue( - UsdMaya.Adaptor("TestInstancer").GetSchema( + mayaUsdLib.Adaptor("TestInstancer").GetSchema( UsdGeom.PointInstancer)) cmds.createNode("nurbsSurface", name="TestNurbsSurface") self.assertTrue( - UsdMaya.Adaptor("TestNurbsSurface").GetSchema( + mayaUsdLib.Adaptor("TestNurbsSurface").GetSchema( UsdGeom.NurbsPatch)) cmds.createNode("nurbsCurve", name="TestNurbsCurve") self.assertTrue( - UsdMaya.Adaptor("TestNurbsCurve").GetSchema( + mayaUsdLib.Adaptor("TestNurbsCurve").GetSchema( UsdGeom.NurbsCurves)) cmds.createNode("locator", name="TestLocator") self.assertTrue( - UsdMaya.Adaptor("TestLocator").GetSchema(UsdGeom.Xform)) + mayaUsdLib.Adaptor("TestLocator").GetSchema(UsdGeom.Xform)) cmds.createNode("nParticle", name="TestParticles") self.assertTrue( - UsdMaya.Adaptor("TestParticles").GetSchema(UsdGeom.Points)) + mayaUsdLib.Adaptor("TestParticles").GetSchema(UsdGeom.Points)) def testUndoRedo(self): """Tests that adaptors work with undo/redo.""" cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - adaptor = UsdMaya.Adaptor("group1") + adaptor = mayaUsdLib.Adaptor("group1") self.assertEqual(adaptor.GetAppliedSchemas(), []) # Do a single operation, then undo, then redo. @@ -330,7 +332,7 @@ def testUndoRedo(self): def testGetAttributeAliases(self): """Tests the GetAttributeAliases function.""" self.assertEqual( - UsdMaya.Adaptor.GetAttributeAliases("subdivisionScheme"), + mayaUsdLib.Adaptor.GetAttributeAliases("subdivisionScheme"), ["USD_ATTR_subdivisionScheme", "USD_subdivisionScheme"]) if __name__ == '__main__': diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptorMetadata.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptorMetadata.py index a7fb37c979..98955c3bcc 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptorMetadata.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaAdaptorMetadata.py @@ -15,11 +15,11 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Usd from pxr import UsdGeom +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -124,7 +124,7 @@ def testImport_GeomModelAPI(self): cmds.usdImport(file=usdFile, shadingMode='none', apiSchema=['GeomModelAPI']) - worldProxy = UsdMaya.Adaptor('World') + worldProxy = mayaUsdLib.Adaptor('World') modelAPI = worldProxy.GetSchema(UsdGeom.ModelAPI) # model:cardGeometry diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaBlockSceneModificationContext.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaBlockSceneModificationContext.py index b991d0bba6..e0134da3b5 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaBlockSceneModificationContext.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaBlockSceneModificationContext.py @@ -15,7 +15,7 @@ # limitations under the License. # -from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib from maya import cmds from maya import standalone @@ -53,7 +53,7 @@ def testPreserveSceneModified(self): cmds.polyCube() self._AssertSceneIsModified(True) - with UsdMaya.BlockSceneModificationContext(): + with mayaUsdLib.BlockSceneModificationContext(): # Create a cube inside the context manager. cmds.polyCube() @@ -68,7 +68,7 @@ def testPreserveSceneNotModified(self): exits. """ - with UsdMaya.BlockSceneModificationContext(): + with mayaUsdLib.BlockSceneModificationContext(): # Create a cube inside the context manager. cmds.polyCube() diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaDiagnosticDelegate.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaDiagnosticDelegate.py index 95b148c620..0bf9d0261f 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaDiagnosticDelegate.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaDiagnosticDelegate.py @@ -15,10 +15,10 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Tf +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone from maya import OpenMaya as OM @@ -26,7 +26,7 @@ import unittest -class testUsdMayaReadWriteUtils(unittest.TestCase): +class testUsdMayaDiagnosticDelegate(unittest.TestCase): @classmethod def setUpClass(cls): standalone.initialize('usd') @@ -108,7 +108,7 @@ def testError_Python(self): def testBatching(self): self._StartRecording() - with UsdMaya.DiagnosticBatchContext(): + with mayaUsdLib.DiagnosticBatchContext(): Tf.Warn("spooky warning") Tf.Status("informative status") @@ -138,7 +138,7 @@ def testBatching_DelegateRemoved(self): """Tests removing the diagnostic delegate when the batch context is still open.""" self._StartRecording() - with UsdMaya.DiagnosticBatchContext(): + with mayaUsdLib.DiagnosticBatchContext(): Tf.Warn("this warning won't be lost") Tf.Status("this status won't be lost") @@ -158,11 +158,11 @@ def testBatching_DelegateRemoved(self): def testBatching_BatchCount(self): """Tests the GetBatchCount() debugging function.""" count = -1 - with UsdMaya.DiagnosticBatchContext(): - with UsdMaya.DiagnosticBatchContext(): - count = UsdMaya.DiagnosticDelegate.GetBatchCount() + with mayaUsdLib.DiagnosticBatchContext(): + with mayaUsdLib.DiagnosticBatchContext(): + count = mayaUsdLib.DiagnosticDelegate.GetBatchCount() self.assertEqual(count, 2) - count = UsdMaya.DiagnosticDelegate.GetBatchCount() + count = mayaUsdLib.DiagnosticDelegate.GetBatchCount() self.assertEqual(count, 0) if __name__ == '__main__': diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaGetVariantSetSelections.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaGetVariantSetSelections.py index 81eafcf8d7..f587551bee 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaGetVariantSetSelections.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaGetVariantSetSelections.py @@ -17,6 +17,8 @@ from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -77,7 +79,7 @@ def testAllSelections(self): # Verify that selecting a non-registered variant set affects the # stage's composition. - prim = UsdMaya.GetPrim(self.assemblyNodeName) + prim = mayaUsdLib.GetPrim(self.assemblyNodeName) geomPrim = prim.GetChild('Geom') cubePrim = geomPrim.GetChild('Cube') diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaReadWriteUtils.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaReadWriteUtils.py index 9145ca9621..c960c22321 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaReadWriteUtils.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaReadWriteUtils.py @@ -17,6 +17,8 @@ from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib + from pxr import Gf from pxr import Sdf from pxr import Tf @@ -43,16 +45,16 @@ def testGetVtValue(self): cmds.group(name="group1", empty=True) - mat = UsdMaya.WriteUtil.GetVtValue("group1.matrix", + mat = mayaUsdLib.WriteUtil.GetVtValue("group1.matrix", Sdf.ValueTypeNames.Matrix4d) self.assertEqual(mat, Gf.Matrix4d(1.0)) - vec3f = UsdMaya.WriteUtil.GetVtValue("group1.scale", + vec3f = mayaUsdLib.WriteUtil.GetVtValue("group1.scale", Sdf.ValueTypeNames.Vector3f) self.assertEqual(vec3f, Gf.Vec3f(1.0)) self.assertIsInstance(vec3f, Gf.Vec3f) - vec3d = UsdMaya.WriteUtil.GetVtValue("group1.scale", + vec3d = mayaUsdLib.WriteUtil.GetVtValue("group1.scale", Sdf.ValueTypeNames.Vector3d) self.assertEqual(vec3d, Gf.Vec3d(1.0)) self.assertIsInstance(vec3d, Gf.Vec3d) @@ -60,11 +62,11 @@ def testGetVtValue(self): cmds.addAttr("group1", ln="myArray", dt="vectorArray") cmds.setAttr("group1.myArray", 3, (0, 1, 2), (1, 2, 3), (2, 3, 4), type="vectorArray") - float3Array = UsdMaya.WriteUtil.GetVtValue("group1.myArray", + float3Array = mayaUsdLib.WriteUtil.GetVtValue("group1.myArray", Sdf.ValueTypeNames.Float3Array) self.assertEqual(float3Array, Vt.Vec3fArray([(0, 1, 2), (1, 2, 3), (2, 3, 4)])) - point3Array = UsdMaya.WriteUtil.GetVtValue("group1.myArray", + point3Array = mayaUsdLib.WriteUtil.GetVtValue("group1.myArray", Sdf.ValueTypeNames.Point3dArray) self.assertEqual(point3Array, Vt.Vec3dArray([(0, 1, 2), (1, 2, 3), (2, 3, 4)])) @@ -72,13 +74,13 @@ def testGetVtValue(self): # Strings can be strings, tokens, or asset paths. cmds.addAttr("group1", ln="myString", dt="string") cmds.setAttr("group1.myString", "a_b_c", type="string") - string = UsdMaya.WriteUtil.GetVtValue("group1.myString", + string = mayaUsdLib.WriteUtil.GetVtValue("group1.myString", Sdf.ValueTypeNames.String) self.assertEqual(string, "a_b_c") - token = UsdMaya.WriteUtil.GetVtValue("group1.myString", + token = mayaUsdLib.WriteUtil.GetVtValue("group1.myString", Sdf.ValueTypeNames.Token) # alas, this becomes a str in Python self.assertEqual(token, "a_b_c") - token = UsdMaya.WriteUtil.GetVtValue("group1.myString", + token = mayaUsdLib.WriteUtil.GetVtValue("group1.myString", Sdf.ValueTypeNames.Asset) self.assertEqual(token, Sdf.AssetPath("a_b_c")) @@ -88,10 +90,10 @@ def testGetVtValue(self): cmds.addAttr("group1", ln="myColorY", p="myColor", at="double") cmds.addAttr("group1", ln="myColorZ", p="myColor", at="double") cmds.setAttr("group1.myColor", 0.5, 0.5, 0.5) - color3f = UsdMaya.WriteUtil.GetVtValue("group1.myColor", + color3f = mayaUsdLib.WriteUtil.GetVtValue("group1.myColor", Sdf.ValueTypeNames.Color3f) self.assertAlmostEqual(color3f[0], 0.2176376) - vec3f = UsdMaya.WriteUtil.GetVtValue("group1.myColor", + vec3f = mayaUsdLib.WriteUtil.GetVtValue("group1.myColor", Sdf.ValueTypeNames.Vector3f) self.assertAlmostEqual(vec3f[0], 0.5) @@ -99,7 +101,7 @@ def testFindOrCreateMayaAttr(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.Asset, Sdf.VariabilityUniform, "group1", @@ -114,7 +116,7 @@ def testFindOrCreateMayaAttr(self): cmds.setAttr(attrName, "cat.png", type="string") self.assertEqual(cmds.getAttr(attrName, type=True), "string") - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.Double3Array, Sdf.VariabilityVarying, "group1", @@ -129,7 +131,7 @@ def testFindOrCreateMayaAttr(self): # Try re-creating the attribute with a different nice name. We should # get the same attribute back (no changes in-scene). - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.Double3Array, Sdf.VariabilityVarying, "group1", @@ -143,7 +145,7 @@ def testFindOrCreateMayaAttr(self): # Try re-creating the attribute with an incompatible type. We should # get an exception (Tf runtime error). with self.assertRaises(Tf.ErrorException): - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.String, Sdf.VariabilityVarying, "group1", @@ -154,39 +156,39 @@ def testSetMayaAttr(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.Asset, Sdf.VariabilityUniform, "group1", "myAssetPath", "kittens") - self.assertTrue(UsdMaya.ReadUtil.SetMayaAttr(attrName, + self.assertTrue(mayaUsdLib.ReadUtil.SetMayaAttr(attrName, Sdf.AssetPath("kittens.png"))) self.assertEqual(cmds.getAttr("group1.myAssetPath"), "kittens.png") self.assertEqual( - UsdMaya.WriteUtil.GetVtValue(attrName, + mayaUsdLib.WriteUtil.GetVtValue(attrName, Sdf.ValueTypeNames.Asset), Sdf.AssetPath("kittens.png")) # Test color conversion from linear to display. - attrName = UsdMaya.ReadUtil.FindOrCreateMayaAttr( + attrName = mayaUsdLib.ReadUtil.FindOrCreateMayaAttr( Sdf.ValueTypeNames.Color3f, Sdf.VariabilityUniform, "group1", "furColor") - self.assertTrue(UsdMaya.ReadUtil.SetMayaAttr(attrName, + self.assertTrue(mayaUsdLib.ReadUtil.SetMayaAttr(attrName, Gf.Vec3f(0.2176376))) self.assertAlmostEqual( - UsdMaya.WriteUtil.GetVtValue(attrName, + mayaUsdLib.WriteUtil.GetVtValue(attrName, Sdf.ValueTypeNames.Color3f)[0], 0.2176376) self.assertAlmostEqual( - UsdMaya.WriteUtil.GetVtValue(attrName, + mayaUsdLib.WriteUtil.GetVtValue(attrName, Sdf.ValueTypeNames.Vector3f)[0], 0.5) # Should even work on Maya built-in attrs. - self.assertTrue(UsdMaya.ReadUtil.SetMayaAttr("group1.scale", + self.assertTrue(mayaUsdLib.ReadUtil.SetMayaAttr("group1.scale", Gf.Vec3d(1.0, 2.0, 3.0))) self.assertEqual(cmds.getAttr("group1.scale"), [(1.0, 2.0, 3.0)]) @@ -194,10 +196,10 @@ def testSetMayaAttrKeyableState(self): cmds.file(new=True, force=True) cmds.group(name="group1", empty=True) - UsdMaya.ReadUtil.SetMayaAttrKeyableState("group1.scaleX", + mayaUsdLib.ReadUtil.SetMayaAttrKeyableState("group1.scaleX", Sdf.VariabilityUniform) self.assertFalse(cmds.getAttr("group1.scaleX", k=True)) - UsdMaya.ReadUtil.SetMayaAttrKeyableState("group1.scaleX", + mayaUsdLib.ReadUtil.SetMayaAttrKeyableState("group1.scaleX", Sdf.VariabilityVarying) self.assertTrue(cmds.getAttr("group1.scaleX", k=True)) diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaXformStack.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaXformStack.py index c89875a83e..97db3ed619 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaXformStack.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdMayaXformStack.py @@ -15,11 +15,11 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import Gf from pxr import Usd +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone from maya.api import OpenMaya as OM @@ -46,7 +46,7 @@ def tearDownClass(cls): # tests: # UsdMayaXformOpClassification::GetOpType def test00GetOpType(self): - translateOp = UsdMaya.XformStack.CommonStack().GetOps()[0] + translateOp = mayaUsdLib.XformStack.CommonStack().GetOps()[0] # could import UsdGeom, and compare objects # directly, but had a bug where if you didn't # import UsdGeom, the wrappers for @@ -71,7 +71,7 @@ def test00GetOpType(self): # UsdMayaXformStack::GetOps def testMayaStack(self): from pxr import UsdGeom - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual( [(x.GetName(), x.IsInvertedTwin(), x.GetOpType()) for x in mayaStack.GetOps()], [ @@ -97,7 +97,7 @@ def testMayaStack(self): # UsdMayaXformStack::GetOps def testCommonStack(self): from pxr import UsdGeom - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual( [(x.GetName(), x.IsInvertedTwin(), x.GetOpType()) for x in commonStack.GetOps()], [ @@ -117,7 +117,7 @@ def testCommonStack(self): # UsdMayaXformStack::GetOps def testMatrixStack(self): from pxr import UsdGeom - matrixStack = UsdMaya.XformStack.MatrixStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() self.assertEqual( [(x.GetName(), x.IsInvertedTwin(), x.GetOpType()) for x in matrixStack.GetOps()], [('transform', False, UsdGeom.XformOp.TypeTransform)] @@ -129,7 +129,7 @@ def testMatrixStack(self): # UsdMayaXformStack::FindOp def testIsCompatibleType(self): from pxr import UsdGeom - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() translateOp = commonStack.FindOp('translate') for opType in UsdGeom.XformOp.Type.allValues: @@ -162,8 +162,8 @@ def testIsCompatibleType(self): # UsdMayaXformStack::CommonStack # UsdMayaXformStack::MayaStack def testOpClassEqual(self): - mayaTranslate = UsdMaya.XformStack.MayaStack().GetOps()[0] - commonTranslate = UsdMaya.XformStack.CommonStack().GetOps()[0] + mayaTranslate = mayaUsdLib.XformStack.MayaStack().GetOps()[0] + commonTranslate = mayaUsdLib.XformStack.CommonStack().GetOps()[0] self.assertIsNot(mayaTranslate, commonTranslate) self.assertEqual(mayaTranslate, commonTranslate) @@ -172,7 +172,7 @@ def testOpClassEqual(self): # UsdMayaXformStack::MayaStack # UsdMayaXformStack::FindOp def testCompatibleAttrNames(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() translateOp = mayaStack.FindOp('translate') self.assertItemsEqual( @@ -235,12 +235,12 @@ def testCompatibleAttrNames(self): def testNoInit(self): try: - UsdMaya.XformOpClassification() + mayaUsdLib.XformOpClassification() except Exception as e: self.assertTrue('cannot be instantiated from Python' in str(e)) try: - UsdMaya.XformStack() + mayaUsdLib.XformStack() except Exception as e: self.assertTrue('cannot be instantiated from Python' in str(e)) @@ -250,13 +250,13 @@ def testNoInit(self): # UsdMayaXformStack::CommonStack # UsdMayaXformStack::MatrixStack def testGetInversionTwins(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(mayaStack.GetInversionTwins(), [(2, 5), (7, 10)]) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual(commonStack.GetInversionTwins(), [(1, 4)]) - matrixStack = UsdMaya.XformStack.MatrixStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() self.assertEqual(matrixStack.GetInversionTwins(), []) @@ -266,11 +266,11 @@ def testGetInversionTwins(self): # UsdMayaXformStack::CommonStack # UsdMayaXformStack::MatrixStack def testGetNameMatters(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertTrue(mayaStack.GetNameMatters()) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertTrue(commonStack.GetNameMatters()) - matrixStack = UsdMaya.XformStack.MatrixStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() self.assertFalse(matrixStack.GetNameMatters()) # tests: @@ -280,13 +280,13 @@ def testGetNameMatters(self): # UsdMayaXformStack::CommonStack # UsdMayaXformStack::MatrixStack def testGetSize(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(len(mayaStack), 11) self.assertEqual(mayaStack.GetSize(), 11) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual(len(commonStack), 5) self.assertEqual(commonStack.GetSize(), 5) - matrixStack = UsdMaya.XformStack.MatrixStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() self.assertEqual(len(matrixStack), 1) self.assertEqual(matrixStack.GetSize(), 1) @@ -294,7 +294,7 @@ def testGetSize(self): # UsdMayaXformStack::MayaStack # UsdMayaXformOpClassification::GetName def testIndexing(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(mayaStack[0].GetName(), 'translate') self.assertEqual(mayaStack[1].GetName(), 'rotatePivotTranslate') self.assertEqual(mayaStack[2].GetName(), 'rotatePivot') @@ -333,7 +333,7 @@ def getStackItem(i): # UsdMayaXformStack::MayaStack # UsdMayaXformStack::CommonStack def testFindOpIndex(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(mayaStack.FindOpIndex('translate'), 0) self.assertEqual(mayaStack.FindOpIndex('rotatePivotTranslate'), 1) self.assertEqual(mayaStack.FindOpIndex('rotatePivot'), 2) @@ -400,7 +400,7 @@ def testFindOpIndex(self): self.assertIs(mayaStack.FindOpIndex('pivot', isInvertedTwin=False), None) self.assertIs(mayaStack.FindOpIndex('pivot', False), None) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual(commonStack.FindOpIndex('pivot'), 1) self.assertEqual(commonStack.FindOpIndex('pivot', isInvertedTwin=True), 4) self.assertEqual(commonStack.FindOpIndex('pivot', True), 4) @@ -426,7 +426,7 @@ def testFindOp(self): def getNameInverted(op): return (op.GetName(), op.IsInvertedTwin()) - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(getNameInverted(mayaStack.FindOp('translate')), ('translate', False)) self.assertEqual(getNameInverted(mayaStack.FindOp('rotatePivotTranslate')), @@ -530,7 +530,7 @@ def getNameInverted(op): self.assertIs(mayaStack.FindOp('pivot', isInvertedTwin=False), None) self.assertIs(mayaStack.FindOp('pivot', False), None) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual(getNameInverted(commonStack.FindOp('pivot')), ('pivot', False)) self.assertEqual(getNameInverted(commonStack.FindOp('pivot', isInvertedTwin=True)), @@ -560,7 +560,7 @@ def getNameInverted(op): # UsdMayaXformStack::MayaStack # UsdMayaXformStack::CommonStack def testFindOpIndexPair(self): - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() self.assertEqual(mayaStack.FindOpIndexPair('translate'), (0, None)) self.assertEqual(mayaStack.FindOpIndexPair('rotatePivotTranslate'), (1, None)) self.assertEqual(mayaStack.FindOpIndexPair('rotatePivot'), (2, 5)) @@ -573,7 +573,7 @@ def testFindOpIndexPair(self): self.assertEqual(mayaStack.FindOpIndexPair('pivot'), (None, None)) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() self.assertEqual(commonStack.FindOpIndexPair('pivot'), (1, 4)) self.assertEqual(commonStack.FindOpIndexPair('rotate'), (2, None)) self.assertEqual(commonStack.FindOpIndexPair('scalePivot'), (None, None)) @@ -597,7 +597,7 @@ def assertFindOpPair(stack, name, expected0, expected1): assertOp(result[0], expected0) assertOp(result[1], expected1) - mayaStack = UsdMaya.XformStack.MayaStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() assertFindOpPair(mayaStack, 'translate', ('translate', False), None) assertFindOpPair(mayaStack, 'rotatePivotTranslate', @@ -619,7 +619,7 @@ def assertFindOpPair(stack, name, expected0, expected1): assertFindOpPair(mayaStack, 'pivot', None, None) - commonStack = UsdMaya.XformStack.CommonStack() + commonStack = mayaUsdLib.XformStack.CommonStack() assertFindOpPair(commonStack, 'pivot', ('pivot', False), ('pivot', True)) assertFindOpPair(commonStack, 'rotate', @@ -629,7 +629,7 @@ def assertFindOpPair(stack, name, expected0, expected1): def makeMayaStackAttrs(self): from pxr import UsdGeom - self.stack = UsdMaya.XformStack.MayaStack() + self.stack = mayaUsdLib.XformStack.MayaStack() self.stage = Usd.Stage.CreateInMemory() self.prim = self.stage.DefinePrim('/myPrim', 'Xform') self.xform = UsdGeom.Xform(self.prim) @@ -653,7 +653,7 @@ def makeMayaStackAttrs(self): def makeCommonStackAttrs(self): from pxr import UsdGeom - self.stack = UsdMaya.XformStack.CommonStack() + self.stack = mayaUsdLib.XformStack.CommonStack() self.stage = Usd.Stage.CreateInMemory() self.prim = self.stage.DefinePrim('/myPrim', 'Xform') self.xform = UsdGeom.Xform(self.prim) @@ -671,7 +671,7 @@ def makeCommonStackAttrs(self): def makeMatrixStackAttrs(self): from pxr import UsdGeom - self.stack = UsdMaya.XformStack.MatrixStack() + self.stack = mayaUsdLib.XformStack.MatrixStack() self.stage = Usd.Stage.CreateInMemory() self.prim = self.stage.DefinePrim('/myPrim', 'Xform') self.xform = UsdGeom.Xform(self.prim) @@ -835,7 +835,7 @@ def testMatchingSubstack_nameDoesntMatter(self): # ...so, ie, just the "shear" transform from the maya stack! orderedOps = [self.ops['shear']] - matrixStack = UsdMaya.XformStack.MatrixStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() expectedOps = [matrixStack[0]] # check names doesn't match @@ -922,13 +922,13 @@ def testMatchingSubstack_rotOrder_rotAxis(self): def doFirstMatchingTest(self, stacks, opNames, matchingStack, expectEmpty=False): orderedOps, expected = self.makeXformOpsAndExpectedClassifications( matchingStack, opNames, expectEmpty=expectEmpty) - result = UsdMaya.XformStack.FirstMatchingSubstack(stacks, orderedOps) + result = mayaUsdLib.XformStack.FirstMatchingSubstack(stacks, orderedOps) self.assertEqual(result, expected) def testFirstMatchingSubstack(self): - mayaStack = UsdMaya.XformStack.MayaStack() - commonStack = UsdMaya.XformStack.CommonStack() - matrixStack = UsdMaya.XformStack.MatrixStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() + commonStack = mayaUsdLib.XformStack.CommonStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() # Should match maya only: self.makeMayaStackAttrs() @@ -1081,9 +1081,9 @@ def testFirstMatchingSubstack_rotOrder(self): self.longMessage = True - mayaStack = UsdMaya.XformStack.MayaStack() - commonStack = UsdMaya.XformStack.CommonStack() - matrixStack = UsdMaya.XformStack.MatrixStack() + mayaStack = mayaUsdLib.XformStack.MayaStack() + commonStack = mayaUsdLib.XformStack.CommonStack() + matrixStack = mayaUsdLib.XformStack.MatrixStack() self.makeMayaStackAttrs() self.ops['rotateX'] = self.xform.AddRotateXOp(opSuffix='rotate') @@ -1136,7 +1136,7 @@ def stackName(x): errMessage = '\nstackNames: ' + str(stackNames) expectNone = not (mayaStack in stackList or commonStack in stackList) - resultList = UsdMaya.XformStack.FirstMatchingSubstack( + resultList = mayaUsdLib.XformStack.FirstMatchingSubstack( stackList, orderedOps) if expectNone: self.assertEqual(resultList, [], str(stackNames)) diff --git a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdReferenceAssemblyChangeRepresentations.py b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdReferenceAssemblyChangeRepresentations.py index 47d736bef0..315b183407 100644 --- a/plugin/pxr/maya/lib/usdMaya/testenv/testUsdReferenceAssemblyChangeRepresentations.py +++ b/plugin/pxr/maya/lib/usdMaya/testenv/testUsdReferenceAssemblyChangeRepresentations.py @@ -15,10 +15,10 @@ # limitations under the License. # -from pxr import UsdMaya - from pxr import UsdGeom +import mayaUsd.lib as mayaUsdLib + from maya import cmds from maya import standalone @@ -122,7 +122,7 @@ def _ValidateCards(self, nodeName): drawModeAttr = cmds.getAttr('%s.drawMode' % nodeName) self.assertEqual(drawModeAttr, 'cards') - prim = UsdMaya.GetPrim(nodeName) + prim = mayaUsdLib.GetPrim(nodeName) primModelAPI = UsdGeom.ModelAPI(prim) self.assertEqual(primModelAPI.ComputeModelDrawMode(), 'cards') @@ -771,12 +771,12 @@ def testDisjointAssembliesVariantSetsChange(self): cmds.setAttr('%s.usdVariantSet_shadingVariant' % cube1, 'Blue', type='string') - prim1 = UsdMaya.GetPrim(cube1) + prim1 = mayaUsdLib.GetPrim(cube1) self.assertEqual( prim1.GetVariantSet('shadingVariant').GetVariantSelection(), 'Blue') - prim2 = UsdMaya.GetPrim(cube2) + prim2 = mayaUsdLib.GetPrim(cube2) self.assertEqual( prim2.GetVariantSet('shadingVariant').GetVariantSelection(), 'Default') diff --git a/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.cpp b/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.cpp index ae1d738a84..c90ba7ca48 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.cpp +++ b/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.cpp @@ -15,18 +15,20 @@ // #include "usdMaya/translatorModelAssembly.h" -#include "usdMaya/editUtil.h" -#include "usdMaya/jobArgs.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" -#include "usdMaya/referenceAssembly.h" +#include +#include +#include +#include +#include +#include #include -#include "usdMaya/translatorUtil.h" -#include "usdMaya/translatorXformable.h" +#include +#include #include +#include "usdMaya/editUtil.h" +#include "usdMaya/referenceAssembly.h" + #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/stringUtils.h" #include "pxr/base/tf/token.h" diff --git a/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.h b/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.h index 1e0c4076b6..5b332959a7 100644 --- a/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.h +++ b/plugin/pxr/maya/lib/usdMaya/translatorModelAssembly.h @@ -19,10 +19,10 @@ /// \file usdMaya/translatorModelAssembly.h #include "usdMaya/api.h" -#include "usdMaya/primReaderArgs.h" -#include "usdMaya/primReaderContext.h" -#include "usdMaya/primWriterArgs.h" -#include "usdMaya/primWriterContext.h" +#include +#include +#include +#include #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/lib/usdMaya/userExportedAttributesUI.py b/plugin/pxr/maya/lib/usdMaya/userExportedAttributesUI.py index 207fbaae58..f8c1dbe313 100644 --- a/plugin/pxr/maya/lib/usdMaya/userExportedAttributesUI.py +++ b/plugin/pxr/maya/lib/usdMaya/userExportedAttributesUI.py @@ -17,6 +17,8 @@ from pxr import UsdMaya +import mayaUsd.lib as mayaUsdLib + from pxr import UsdGeom from maya import OpenMaya as OM @@ -227,7 +229,7 @@ def __init__(self, mayaAttrName): self._usdAttrName = None self._primvarInterpolation = None self._translateMayaDoubleToUsdSinglePrecision = ( - UsdMaya.UserTaggedAttribute.GetFallbackTranslateMayaDoubleToUsdSinglePrecision()) + mayaUsdLib.UserTaggedAttribute.GetFallbackTranslateMayaDoubleToUsdSinglePrecision()) def __eq__(self, other): # Note that _primvarInterpolation and @@ -347,7 +349,7 @@ def GetExportedAttributesFromNode(nodeName): exportedAttr.translateMayaDoubleToUsdSinglePrecision = ( attrMetadata.get( 'translateMayaDoubleToUsdSinglePrecision', - UsdMaya.UserTaggedAttribute.GetFallbackTranslateMayaDoubleToUsdSinglePrecision())) + mayaUsdLib.UserTaggedAttribute.GetFallbackTranslateMayaDoubleToUsdSinglePrecision())) result.append(exportedAttr) return result diff --git a/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt b/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt index 04b88e0bab..da8ffa4238 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt +++ b/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt @@ -4,7 +4,6 @@ pxr_plugin(${PXR_PACKAGE} MAYA_PLUGIN LIBRARIES - pxrUsdMayaGL mayaUsd sdf tf diff --git a/plugin/pxr/maya/plugin/pxrUsd/alembicChaser.cpp b/plugin/pxr/maya/plugin/pxrUsd/alembicChaser.cpp index 4aca2278bc..72f9d74676 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/alembicChaser.cpp +++ b/plugin/pxr/maya/plugin/pxrUsd/alembicChaser.cpp @@ -14,8 +14,8 @@ // limitations under the License. // -#include "usdMaya/chaserRegistry.h" -#include "usdMaya/writeUtil.h" +#include +#include #include "pxr/pxr.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp b/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp index 14233ff218..52cf25a566 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp +++ b/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp @@ -16,29 +16,23 @@ #include "pxr/pxr.h" #include "pxrUsd/api.h" +#include #include -#include "pxrUsdMayaGL/hdImagingShapeDrawOverride.h" -#include "pxrUsdMayaGL/hdImagingShapeUI.h" -#include "pxrUsdMayaGL/proxyDrawOverride.h" -#include "pxrUsdMayaGL/proxyShapeUI.h" - -#include "usdMaya/diagnosticDelegate.h" +#include #include "usdMaya/exportCommand.h" #include "usdMaya/exportTranslator.h" -#include "usdMaya/hdImagingShape.h" #include "usdMaya/importCommand.h" #include "usdMaya/importTranslator.h" #include "usdMaya/listShadingModesCommand.h" + #include -#include "usdMaya/pointBasedDeformerNode.h" +#include #include "usdMaya/proxyShape.h" #include "usdMaya/referenceAssembly.h" -#include -#include "usdMaya/stageNode.h" -#include "usdMaya/undoHelperCommand.h" +#include +#include -#include #include #include #include @@ -49,6 +43,9 @@ #include #endif +#include "pxr/base/plug/plugin.h" +#include "pxr/base/plug/registry.h" + PXR_NAMESPACE_USING_DIRECTIVE @@ -87,51 +84,14 @@ initializePlugin(MObject obj) MPxNode::kDeformerNode); CHECK_MSTATUS(status); - if (MayaUsdProxyShapePlugin::useVP2_NativeUSD_Rendering()) { - status = plugin.registerShape( - UsdMayaProxyShape::typeName, - UsdMayaProxyShape::typeId, - UsdMayaProxyShape::creator, - UsdMayaProxyShape::initialize, - UsdMayaProxyShapeUI::creator, - MayaUsdProxyShapePlugin::getProxyShapeClassification()); - CHECK_MSTATUS(status); - } - else { - status = plugin.registerShape( - UsdMayaProxyShape::typeName, - UsdMayaProxyShape::typeId, - UsdMayaProxyShape::creator, - UsdMayaProxyShape::initialize, - UsdMayaProxyShapeUI::creator, - &UsdMayaProxyDrawOverride::drawDbClassification); - CHECK_MSTATUS(status); - status = plugin.registerShape( - PxrMayaHdImagingShape::typeName, - PxrMayaHdImagingShape::typeId, - PxrMayaHdImagingShape::creator, - PxrMayaHdImagingShape::initialize, - PxrMayaHdImagingShapeUI::creator, - &PxrMayaHdImagingShapeDrawOverride::drawDbClassification); - CHECK_MSTATUS(status); - status = MHWRender::MDrawRegistry::registerDrawOverrideCreator( - PxrMayaHdImagingShapeDrawOverride::drawDbClassification, - _RegistrantId, - PxrMayaHdImagingShapeDrawOverride::creator); - CHECK_MSTATUS(status); - - status = MHWRender::MDrawRegistry::registerDrawOverrideCreator( - UsdMayaProxyDrawOverride::drawDbClassification, - _RegistrantId, - UsdMayaProxyDrawOverride::Creator); - CHECK_MSTATUS(status); - - status = plugin.registerDisplayFilter( - UsdMayaProxyShape::displayFilterName, - UsdMayaProxyShape::displayFilterLabel, - UsdMayaProxyDrawOverride::drawDbClassification); - CHECK_MSTATUS(status); - } + status = plugin.registerShape( + UsdMayaProxyShape::typeName, + UsdMayaProxyShape::typeId, + UsdMayaProxyShape::creator, + UsdMayaProxyShape::initialize, + UsdMayaProxyShapeUI::creator, + MayaUsdProxyShapePlugin::getProxyShapeClassification()); + CHECK_MSTATUS(status); status = plugin.registerNode( UsdMayaReferenceAssembly::typeName, @@ -194,12 +154,10 @@ initializePlugin(MObject obj) status.perror("registerCommand usdListShadingModes"); } - status = plugin.registerCommand( - "usdUndoHelperCmd", - UsdMayaUndoHelperCommand::creator, - UsdMayaUndoHelperCommand::createSyntax); + status = UsdMayaUndoHelperCommand::initialize(plugin); if (!status) { - status.perror("registerCommand usdUndoHelperCmd"); + status.perror(std::string("registerCommand ").append( + UsdMayaUndoHelperCommand::name()).c_str()); } status = plugin.registerFileTranslator( @@ -227,6 +185,30 @@ initializePlugin(MObject obj) UsdMayaSceneResetNotice::InstallListener(); UsdMayaDiagnosticDelegate::InstallDelegate(); + // As of 2-Aug-2019, these PlugPlugin translators are not loaded + // automatically. To be investigated. A duplicate of this code is in the + // Autodesk plugin.cpp. + const std::vector translatorPluginNames{ + "mayaUsd_Translators"}; + const auto& plugRegistry = PlugRegistry::GetInstance(); + std::stringstream msg("mayaUsdPlugin: "); + for (const auto& pluginName : translatorPluginNames) { + auto plugin = plugRegistry.GetPluginWithName(pluginName); + if (!plugin) { + status = MStatus::kFailure; + msg << "translator " << pluginName << " not found."; + status.perror(msg.str().c_str()); + } + else { + // Load is a no-op if already loaded. + if (!plugin->Load()) { + status = MStatus::kFailure; + msg << pluginName << " translator load failed."; + status.perror(msg.str().c_str()); + } + } + } + return status; } @@ -257,9 +239,10 @@ uninitializePlugin(MObject obj) status.perror("deregisterCommand usdListShadingModes"); } - status = plugin.deregisterCommand("usdUndoHelperCmd"); + status = UsdMayaUndoHelperCommand::finalize(plugin); if (!status) { - status.perror("deregisterCommand usdUndoHelperCmd"); + status.perror(std::string("deregisterCommand ").append( + UsdMayaUndoHelperCommand::name()).c_str()); } status = plugin.deregisterFileTranslator("pxrUsdImport"); @@ -275,23 +258,6 @@ uninitializePlugin(MObject obj) status = MGlobal::executeCommand("assembly -e -deregister " + UsdMayaReferenceAssembly::typeName); CHECK_MSTATUS(status); - status = plugin.deregisterDisplayFilter( - UsdMayaProxyShape::displayFilterName); - CHECK_MSTATUS(status); - - status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator( - UsdMayaProxyDrawOverride::drawDbClassification, - _RegistrantId); - CHECK_MSTATUS(status); - - status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator( - PxrMayaHdImagingShapeDrawOverride::drawDbClassification, - _RegistrantId); - CHECK_MSTATUS(status); - - status = plugin.deregisterNode(PxrMayaHdImagingShape::typeId); - CHECK_MSTATUS(status); - status = plugin.deregisterNode(UsdMayaReferenceAssembly::typeId); CHECK_MSTATUS(status); diff --git a/plugin/pxr/maya/plugin/pxrUsd/usdTranslator.cpp b/plugin/pxr/maya/plugin/pxrUsd/usdTranslator.cpp index b31d31ee89..4639a90cdf 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/usdTranslator.cpp +++ b/plugin/pxr/maya/plugin/pxrUsd/usdTranslator.cpp @@ -14,7 +14,7 @@ // limitations under the License. // #include "usdMaya/translatorModelAssembly.h" -#include "usdMaya/primWriterRegistry.h" +#include #include "pxr/pxr.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.cpp b/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.cpp index d8f38358d5..7d54d03f0a 100644 --- a/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.cpp +++ b/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.cpp @@ -17,11 +17,11 @@ #include "pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h" #include "pxrUsdPreviewSurface/usdPreviewSurface.h" -#include "usdMaya/primWriterRegistry.h" -#include "usdMaya/shaderWriter.h" +#include +#include #include -#include "usdMaya/writeJobContext.h" -#include "usdMaya/writeUtil.h" +#include +#include #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/staticTokens.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h b/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h index 733887318c..96d0db3848 100644 --- a/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h +++ b/plugin/pxr/maya/plugin/pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h @@ -19,9 +19,9 @@ /// \file pxrUsdPreviewSurface/usdPreviewSurfaceWriter.h #include "pxr/pxr.h" -#include "usdMaya/shaderWriter.h" +#include -#include "usdMaya/writeJobContext.h" +#include #include "pxr/base/tf/token.h" #include "pxr/usd/sdf/path.h" diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/CMakeLists.txt b/plugin/pxr/maya/plugin/pxrUsdTranslators/CMakeLists.txt index ebb8e8af78..bd431a1089 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/CMakeLists.txt +++ b/plugin/pxr/maya/plugin/pxrUsdTranslators/CMakeLists.txt @@ -1,67 +1,3 @@ -set(PXR_PACKAGE pxrUsdTranslators) - -pxr_plugin(${PXR_PACKAGE} - MAYA_PLUGIN - - LIBRARIES - arch - gf - kind - sdf - tf - usd - usdGeom - usdLux - usdMaya - usdRi - usdShade - usdSkel - usdUtils - vt - ${MAYA_Foundation_LIBRARY} - ${MAYA_OpenMaya_LIBRARY} - ${MAYA_OpenMayaAnim_LIBRARY} - ${MAYA_OpenMayaFX_LIBRARY} - - INCLUDE_DIRS - ${MAYA_INCLUDE_DIRS} - - PRIVATE_CLASSES - cameraWriter - fileTextureWriter - instancerWriter - jointWriter - locatorWriter - meshWriter - nurbsCurveWriter - nurbsSurfaceWriter - particleWriter - strokeWriter - - CPPFILES - cameraReader.cpp - lightReader.cpp - lightWriter.cpp - materialReader.cpp - meshReader.cpp - meshWriter_Primvars.cpp - meshWriter_Skin.cpp - meshWriter_Subdiv.cpp - nurbsCurvesReader.cpp - nurbsPatchReader.cpp - plugin.cpp - scopeReader.cpp - skelReader.cpp - xformReader.cpp - - PRIVATE_HEADERS - api.h - - RESOURCE_FILES - plugInfo.json - - DISABLE_PRECOMPILED_HEADERS -) pxr_test_scripts( testenv/testPxrUsdTranslators.py diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/plugInfo.json b/plugin/pxr/maya/plugin/pxrUsdTranslators/plugInfo.json deleted file mode 100644 index c7496b3073..0000000000 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/plugInfo.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "Plugins": [ - { - "Info": { - "UsdMaya": { - "PrimReader": { - "mayaPlugin": "pxrUsdTranslators", - "providesTranslator": [ - "UsdGeomCamera", - "UsdGeomMesh", - "UsdGeomNurbsCurves", - "UsdGeomNurbsPatch", - "UsdGeomScope", - "UsdGeomXform", - "UsdLuxCylinderLight", - "UsdLuxDiskLight", - "UsdLuxDistantLight", - "UsdLuxDomeLight", - "UsdLuxGeometryLight", - "UsdLuxRectLight", - "UsdLuxSphereLight", - "UsdRiPxrAovLight", - "UsdRiPxrEnvDayLight", - "UsdShadeMaterial", - "UsdSkelRoot", - "UsdSkelSkeleton" - ] - }, - "PrimWriter": { - "mayaPlugin": "pxrUsdTranslators", - "providesTranslator": [ - "camera", - "file", - "instancer", - "joint", - "locator", - "mesh", - "nParticle", - "nurbsCurve", - "nurbsSurface", - "particle", - "PxrAovLight", - "PxrCylinderLight", - "PxrDiskLight", - "PxrDistantLight", - "PxrDomeLight", - "PxrEnvDayLight", - "PxrMeshLight", - "PxrRectLight", - "PxrSphereLight", - "stroke" - ] - } - } - }, - "Name": "@PLUG_INFO_PLUGIN_NAME@", - "Type": "resource" - } - ] -} diff --git a/plugin/pxr/maya/plugin/pxrUsdTranslators/testenv/testPxrUsdTranslators.py b/plugin/pxr/maya/plugin/pxrUsdTranslators/testenv/testPxrUsdTranslators.py index 04fef4eb90..9a14aebd44 100644 --- a/plugin/pxr/maya/plugin/pxrUsdTranslators/testenv/testPxrUsdTranslators.py +++ b/plugin/pxr/maya/plugin/pxrUsdTranslators/testenv/testPxrUsdTranslators.py @@ -33,8 +33,12 @@ def tearDownClass(cls): standalone.uninitialize() def testLoads(self): - self.assertEqual(cmds.loadPlugin('pxrUsdTranslators'), - ["pxrUsdTranslators"]) + # The pxrUsdTranslators plugin does absolutely nothing, registers no + # nodes, or commands. Pending explanation from Pixar as to what its + # purpose is, remove the load test of this plugin. PPT, 2-Oct-2019. + # self.assertEqual(cmds.loadPlugin('pxrUsdTranslators'), + # ["pxrUsdTranslators"]) + pass if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/test/lib/ufe/testGroupCmd.py b/test/lib/ufe/testGroupCmd.py index 75d14c554e..8286360b8a 100644 --- a/test/lib/ufe/testGroupCmd.py +++ b/test/lib/ufe/testGroupCmd.py @@ -65,7 +65,7 @@ def testUsdGroup(self): groupPath = propsPath + "newGroup" # Create new group. - group = propsHierarchy.createGroupCmd("newGroup") + group = propsHierarchy.createGroupCmd(ufe.PathComponent("newGroup")) self.assertIsNotNone(group.item) # MAYA-92350: must re-create hierarchy interface object. Fix ASAP. From fd049a517e0bb2bd1c63394ee0f7b7db4b336afe Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Wed, 4 Dec 2019 10:34:10 -0800 Subject: [PATCH 2/8] Addressed internal code review comments. --- .../AL_USDMaya/AL/usdmaya/PluginRegister.h | 24 --- .../maya/lib/usdMaya/shadingModeImporter.cpp | 185 ------------------ 2 files changed, 209 deletions(-) delete mode 100644 plugin/pxr/maya/lib/usdMaya/shadingModeImporter.cpp diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h index a5fd50101a..e32498c3a8 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h @@ -338,30 +338,6 @@ MStatus registerPlugin(AFnPlugin& plugin) CHECK_MSTATUS(AL::maya::utils::MenuBuilder::generatePluginUI(plugin, "AL_usdmaya")); AL::usdmaya::Global::onPluginLoad(); - // As of 2-Aug-2019, these PlugPlugin translators are not loaded - // automatically. To be investigated. A duplicate of this code is in the - // Autodesk plugin.cpp. - const std::vector translatorPluginNames{ - "mayaUsd_Translators" }; - const auto& plugRegistry = PlugRegistry::GetInstance(); - std::stringstream msg("mayaUsdPlugin: "); - for (const auto& pluginName : translatorPluginNames) { - auto plugin = plugRegistry.GetPluginWithName(pluginName); - if (!plugin) { - status = MStatus::kFailure; - msg << "translator " << pluginName << " not found."; - status.perror(msg.str().c_str()); - } - else { - // Load is a no-op if already loaded. - if (!plugin->Load()) { - status = MStatus::kFailure; - msg << pluginName << " translator load failed."; - status.perror(msg.str().c_str()); - } - } - } - // Force all plugins to be loaded at startup time. Unless we load plugins upfront // options will not be registered until the start of import or export, and won't be available in the GUI const TfType& translatorType = TfType::Find(); diff --git a/plugin/pxr/maya/lib/usdMaya/shadingModeImporter.cpp b/plugin/pxr/maya/lib/usdMaya/shadingModeImporter.cpp deleted file mode 100644 index 12e992c3ee..0000000000 --- a/plugin/pxr/maya/lib/usdMaya/shadingModeImporter.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// -// Copyright 2016 Pixar -// -// 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. -// -#include "usdMaya/shadingModeImporter.h" - -#include "pxr/base/tf/diagnostic.h" -#include "pxr/base/tf/staticTokens.h" -#include "pxr/base/tf/stringUtils.h" -#include "pxr/base/tf/token.h" - -#include "pxr/usd/sdf/path.h" -#include "pxr/usd/usd/prim.h" - -#include -#include -#include -#include - - -PXR_NAMESPACE_OPEN_SCOPE - - -TF_DEFINE_PUBLIC_TOKENS(UsdMayaShadingModeImporterTokens, - PXRUSDMAYA_SHADING_MODE_IMPORTER_TOKENS); - - -bool -UsdMayaShadingModeImportContext::GetCreatedObject( - const UsdPrim& prim, - MObject* obj) const -{ - if (!prim) { - return false; - } - - MObject node = _context->GetMayaNode(prim.GetPath(), false); - if (!node.isNull()) { - *obj = node; - return true; - } - - return false; -} - -MObject -UsdMayaShadingModeImportContext::AddCreatedObject( - const UsdPrim& prim, - const MObject& obj) -{ - if (prim) { - return AddCreatedObject(prim.GetPath(), obj); - } - - return obj; -} - -MObject -UsdMayaShadingModeImportContext::AddCreatedObject( - const SdfPath& path, - const MObject& obj) -{ - if (!path.IsEmpty()) { - _context->RegisterNewMayaNode(path.GetString(), obj); - } - - return obj; -} - -MObject -UsdMayaShadingModeImportContext::CreateShadingEngine() const -{ - const TfToken shadingEngineName = GetShadingEngineName(); - if (shadingEngineName.IsEmpty()) { - return MObject(); - } - - MStatus status; - MFnSet fnSet; - MSelectionList tmpSelList; - MObject shadingEngine = - fnSet.create(tmpSelList, MFnSet::kRenderableOnly, &status); - if (status != MS::kSuccess) { - TF_RUNTIME_ERROR("Failed to create shadingEngine: %s", - shadingEngineName.GetText()); - return MObject(); - } - - fnSet.setName(shadingEngineName.GetText(), - /* createNamespace = */ true, - &status); - CHECK_MSTATUS_AND_RETURN(status, MObject()); - - return shadingEngine; -} - -TfToken -UsdMayaShadingModeImportContext::GetShadingEngineName() const -{ - if (!_shadeMaterial && !_boundPrim) { - return TfToken(); - } - - if (!_shadingEngineName.IsEmpty()) { - return _shadingEngineName; - } - - TfToken primName; - if (_shadeMaterial) { - primName = _shadeMaterial.GetPrim().GetName(); - } else if (_boundPrim) { - primName = _boundPrim.GetPrim().GetName(); - } - - // To make sure that the shadingEngine object names do not collide with - // Maya transform or shape node names, we put the shadingEngine objects - // into their own namespace. - const TfToken shadingEngineName( - TfStringPrintf( - "%s:%s", - UsdMayaShadingModeImporterTokens->MayaMaterialNamespace.GetText(), - primName.GetText())); - - return shadingEngineName; -} - -TfToken -UsdMayaShadingModeImportContext::GetSurfaceShaderPlugName() const -{ - return _surfaceShaderPlugName; -} - -TfToken -UsdMayaShadingModeImportContext::GetVolumeShaderPlugName() const -{ - return _volumeShaderPlugName; -} - -TfToken -UsdMayaShadingModeImportContext::GetDisplacementShaderPlugName() const -{ - return _displacementShaderPlugName; -} - -void -UsdMayaShadingModeImportContext::SetShadingEngineName( - const TfToken& shadingEngineName) -{ - _shadingEngineName = shadingEngineName; -} - -void -UsdMayaShadingModeImportContext::SetSurfaceShaderPlugName( - const TfToken& surfaceShaderPlugName) -{ - _surfaceShaderPlugName = surfaceShaderPlugName; -} - -void -UsdMayaShadingModeImportContext::SetVolumeShaderPlugName( - const TfToken& volumeShaderPlugName) -{ - _volumeShaderPlugName = volumeShaderPlugName; -} - -void -UsdMayaShadingModeImportContext::SetDisplacementShaderPlugName( - const TfToken& displacementShaderPlugName) -{ - _displacementShaderPlugName = displacementShaderPlugName; -} - - -PXR_NAMESPACE_CLOSE_SCOPE From f243a41039808ec3b249e7f631ba975138e9e45c Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Wed, 8 Jan 2020 13:48:36 -0800 Subject: [PATCH 3/8] Core changes to compile with -Werror --- lib/fileio/jobs/readJob.cpp | 4 ++-- lib/fileio/primUpdater.h | 1 - lib/render/vp2RenderDelegate/mesh.cpp | 4 ++-- lib/usd/translators/CMakeLists.txt | 5 ----- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/fileio/jobs/readJob.cpp b/lib/fileio/jobs/readJob.cpp index 3f26a245fe..525ee56c24 100644 --- a/lib/fileio/jobs/readJob.cpp +++ b/lib/fileio/jobs/readJob.cpp @@ -66,10 +66,10 @@ UsdMaya_ReadJob::UsdMaya_ReadJob( mArgs(iArgs), mFileName(iFileName), mVariants(iVariants), + mMayaRootDagPath(), mPrimPath(iPrimPath), mDagModifierUndo(), - mDagModifierSeeded(false), - mMayaRootDagPath() + mDagModifierSeeded(false) { } diff --git a/lib/fileio/primUpdater.h b/lib/fileio/primUpdater.h index f3688aeb10..bf1bbd603d 100644 --- a/lib/fileio/primUpdater.h +++ b/lib/fileio/primUpdater.h @@ -41,7 +41,6 @@ class UsdMayaPrimUpdater UsdMayaPrimUpdater() = default; virtual ~UsdMayaPrimUpdater() = default; - MAYAUSD_CORE_PUBLIC enum class Supports { Invalid = 0, Push = 1 << 0, Pull = 1 << 1, Clear = 1 << 2, All = Push | Pull | Clear}; MAYAUSD_CORE_PUBLIC diff --git a/lib/render/vp2RenderDelegate/mesh.cpp b/lib/render/vp2RenderDelegate/mesh.cpp index a54de1f340..eb7097f54d 100644 --- a/lib/render/vp2RenderDelegate/mesh.cpp +++ b/lib/render/vp2RenderDelegate/mesh.cpp @@ -304,7 +304,7 @@ namespace { const VtIntArray &faceVertexCounts = topology.GetFaceVertexCounts(); unsigned int numIndex = 0; - for (int i = 0; i < faceVertexCounts.size(); i++) + for (std::size_t i = 0; i < faceVertexCounts.size(); i++) { numIndex += faceVertexCounts[i]; } @@ -317,7 +317,7 @@ namespace { { const VtIntArray &faceVertexCounts = topology.GetFaceVertexCounts(); const int* currentFaceStart = topology.GetFaceVertexIndices().cdata(); - for (int faceId = 0; faceId < faceVertexCounts.size(); faceId++) + for (std::size_t faceId = 0; faceId < faceVertexCounts.size(); faceId++) { int numVertexIndicesInFace = faceVertexCounts[faceId]; if (numVertexIndicesInFace >= 2) diff --git a/lib/usd/translators/CMakeLists.txt b/lib/usd/translators/CMakeLists.txt index dd65803b42..17d6b61816 100644 --- a/lib/usd/translators/CMakeLists.txt +++ b/lib/usd/translators/CMakeLists.txt @@ -96,11 +96,6 @@ target_include_directories(${TRANSLATORS_PLUGIN} ${CMAKE_BINARY_DIR} ) -target_include_directories(${TRANSLATORS_PLUGIN} - PRIVATE - api.h -) - target_link_libraries(${TRANSLATORS_PLUGIN} PRIVATE ${DEPENDANT_LIBRARIES}) #====================================================================== From b10bf8e4d7986ea4d0087beaf3f78e966f06420a Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Wed, 8 Jan 2020 13:50:47 -0800 Subject: [PATCH 4/8] AL plugin changes to compile with -Werror --- .../lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp | 2 + .../AL/usdmaya/fileio/AnimationTranslator.cpp | 7 + .../AL_USDMaya/AL/usdmaya/fileio/Import.cpp | 2 +- .../translators/TransformTranslator.cpp | 7 + .../fileio/translators/TranslatorContext.cpp | 4 +- .../AL/usdmaya/nodes/ProxyShapeUI.cpp | 3 + .../AL/maya/utils/PluginTranslatorOptions.cpp | 2 +- .../AL/maya/test_EventHandler.cpp | 62 ++--- .../AL/maya/test_MayaEventManager.cpp | 4 +- .../usdmaya/commands/test_ExportCommands.cpp | 2 +- .../commands/test_InternalProxySelection.cpp | 54 ++-- .../usdmaya/commands/test_LayerCommands.cpp | 6 +- .../commands/test_LayerManagerCommands.cpp | 24 +- .../commands/test_ProxyShapeImport.cpp | 2 +- .../commands/test_ProxyShapeSelect.cpp | 242 +++++++++--------- .../AL/usdmaya/fileio/export_blendshape.cpp | 6 +- .../AL/usdmaya/fileio/export_constraints.cpp | 2 +- .../AL/usdmaya/fileio/export_ik.cpp | 12 +- .../AL/usdmaya/fileio/export_lattice.cpp | 4 +- .../AL/usdmaya/fileio/export_nonlinear.cpp | 4 +- .../AL/usdmaya/fileio/import_instances.cpp | 8 +- .../usdmaya/nodes/proxy/test_PrimFilter.cpp | 2 +- .../AL/usdmaya/nodes/test_ActiveInactive.cpp | 64 ++--- .../AL/usdmaya/nodes/test_ExtraDataPlugin.cpp | 2 +- .../AL/usdmaya/nodes/test_LayerManager.cpp | 72 +++--- .../AL/usdmaya/nodes/test_ProxyShape.cpp | 26 +- .../AL/usdmaya/nodes/test_TransformMatrix.cpp | 8 +- .../usdmaya/nodes/test_TranslatorContext.cpp | 12 +- .../AL/usdmaya/test_DiffGeom.cpp | 20 +- .../AL/usdmaya/test_DiffPrimVar.cpp | 44 ++-- .../test_translators_AnimationTranslator.cpp | 4 - .../test_translators_CameraTranslator.cpp | 2 +- .../test_translators_MeshTranslator.cpp | 24 +- .../test_translators_NurbsCurveTranslator.cpp | 2 +- .../test_translators_PythonBindings.cpp | 2 +- .../AL/usdmaya/utils/DgNodeHelper.cpp | 4 + .../AL/usdmaya/utils/DiffPrimVar.cpp | 4 +- .../AL/usdmaya/utils/MeshUtils.cpp | 10 +- .../usd/transaction/tests/testTransaction.cpp | 48 ++-- 39 files changed, 412 insertions(+), 397 deletions(-) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp index d0c558cf8a..e2f10b022a 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp @@ -160,6 +160,8 @@ void Profiler::popTime() timespec endtime; #ifdef _WIN32 while(clock_gettime(CLOCK_REALTIME_COARSE, &endtime) != 0) /* deliberately empty */; + #else + timespec_get(&endtime, TIME_UTC); #endif // compute time difference diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp index 7e1dd89294..3d3a56554e 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp @@ -313,7 +313,14 @@ void AnimationTranslator::exportAnimation(const ExporterParams& params) for(auto it = startWSM; it != endWSM; ++it) { MMatrix mat = it->first.inclusiveMatrix(); +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif it->second.Set(*(const GfMatrix4d*)&mat, timeCode); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif } } } diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp index a05605c46f..2ca5640401 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp @@ -196,7 +196,7 @@ void Import::doImport() if(!status) status.perror("Failed to access instance parent"); // add each child from the instance transform, to the new transform - for(int i = 0; i < fnInstance.childCount(); ++i) + for(int i = 0; unsigned(i) < fnInstance.childCount(); ++i) { MObject child = fnInstance.child(i); status = fnParent.addChild(child, MFnDagNode::kNextPos, true); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp index 3a3cf30fbc..e90f3ad299 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp @@ -766,7 +766,14 @@ MStatus TransformTranslator::copyAttributes(const MObject& from, UsdPrim& to, co { MMatrix wsm = path.inclusiveMatrix(); auto op = xformSchema.AddTransformOp(UsdGeomXformOp::PrecisionDouble, TfToken("transform")); +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif op.Set(*(const GfMatrix4d*)&wsm, params.m_timeCode); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif if(animTranslator) animTranslator->addWorldSpace(path, op.GetAttr()); } diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp index 287bd233f5..a7f2691331 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp @@ -270,8 +270,6 @@ void TranslatorContext::removeItems(const SdfPath& path) MDagModifier modifier2; MObjectHandleArray tempXforms; MStatus status; - bool hasDagNodes = false; - bool hasDependNodes = false; // Store the DAG nodes to delete in a vector which we will sort via their path length std::vector> dagNodesToDelete; @@ -539,7 +537,7 @@ void TranslatorContext::removeEntries(const SdfPathVector& itemsToRemove) //---------------------------------------------------------------------------------------------------------------------- void TranslatorContext::preUnloadPrim(UsdPrim& prim, const MObject& primObj) { - TF_DEBUG(ALUSDMAYA_TRANSLATORS).Msg("TranslatorContext::preUnloadPrim %s"); + TF_DEBUG(ALUSDMAYA_TRANSLATORS).Msg("TranslatorContext::preUnloadPrim %s", prim.GetPath().GetText()); assert(m_proxyShape); auto stage = m_proxyShape->getUsdStage(); if(stage) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp index f3bc38b2a8..6f33ced864 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp @@ -107,7 +107,10 @@ void ProxyShapeUI::getDrawRequests(const MDrawInfo& drawInfo, bool isObjectAndAc MDrawRequest request = drawInfo.getPrototype(*this); + // If there are no side effects to calling surfaceShape(), the following two + // lines can be removed, as they are unused. PPT, 8-Jan-2020. ProxyShape* shape = static_cast(surfaceShape()); + (void) shape; // add the request to the queue requests.add(request); diff --git a/plugin/al/mayautils/AL/maya/utils/PluginTranslatorOptions.cpp b/plugin/al/mayautils/AL/maya/utils/PluginTranslatorOptions.cpp index 454abbe082..b4a2f5b168 100644 --- a/plugin/al/mayautils/AL/maya/utils/PluginTranslatorOptions.cpp +++ b/plugin/al/mayautils/AL/maya/utils/PluginTranslatorOptions.cpp @@ -100,7 +100,7 @@ bool PluginTranslatorOptionsContext::isRegistered(const char* const pluginTransl //---------------------------------------------------------------------------------------------------------------------- AL_MAYA_UTILS_PUBLIC PluginTranslatorOptions::PluginTranslatorOptions(PluginTranslatorOptionsContext& context, const char* const pluginTranslatorGrouping) -: m_options(), m_context(context), m_grouping(pluginTranslatorGrouping) +: m_grouping(pluginTranslatorGrouping), m_options(), m_context(context) { context.registerPluginTranslatorOptions(this); } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_EventHandler.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_EventHandler.cpp index 321b01a7d1..a9b4c9e9a2 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_EventHandler.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_EventHandler.cpp @@ -78,7 +78,7 @@ TEST(Callback, Callback) EXPECT_EQ(info1.tag(), "tag"); EXPECT_EQ(info1.callbackId(), makeCallbackId(1, 5, 3)); - EXPECT_EQ(info1.eventId(), 1); + EXPECT_EQ(info1.eventId(), 1u); EXPECT_TRUE(info1 < info2); EXPECT_FALSE(info2 < info1); EXPECT_TRUE(info1.userData() == &value); @@ -86,20 +86,20 @@ TEST(Callback, Callback) EXPECT_TRUE(info1.isCCallback()); EXPECT_FALSE(info1.isMELCallback()); EXPECT_FALSE(info1.isPythonCallback()); - EXPECT_EQ(info1.weight(), 1000); + EXPECT_EQ(info1.weight(), 1000u); // test python command Callback info3("tag", "i am a command" , 1000, true, makeCallbackId(1, 5, 3)); EXPECT_EQ(info3.tag(), "tag"); EXPECT_EQ(info3.callbackId(), makeCallbackId(1, 5, 3)); - EXPECT_EQ(info3.eventId(), 1); + EXPECT_EQ(info3.eventId(), 1u); EXPECT_TRUE(info3.userData() == nullptr); EXPECT_EQ(strcmp(info3.callbackText(), "i am a command"), 0); EXPECT_FALSE(info3.isCCallback()); EXPECT_FALSE(info3.isMELCallback()); EXPECT_TRUE(info3.isPythonCallback()); - EXPECT_EQ(info3.weight(), 1000); + EXPECT_EQ(info3.weight(), 1000u); // test MEL command Callback info4("tag", "i am a command" , 1000, false, makeCallbackId(1, 5, 3)); @@ -125,8 +125,8 @@ TEST(EventDispatcher, EventDispatcher) int associated; EventDispatcher info(&g_eventSystem, "eventName", 42, kUserSpecifiedEventType, &associated, 23); EXPECT_EQ(info.name(), "eventName"); - EXPECT_EQ(info.eventId(), 42); - EXPECT_EQ(info.parentCallbackId(), 23); + EXPECT_EQ(info.eventId(), 42u); + EXPECT_EQ(info.parentCallbackId(), 23u); EXPECT_EQ(info.associatedData(), &associated); @@ -138,7 +138,7 @@ TEST(EventDispatcher, EventDispatcher) EXPECT_EQ(eventPart, 42); uint64_t callbackPart = extractCallbackId(id1); - EXPECT_EQ(callbackPart, 1); + EXPECT_EQ(callbackPart, 1u); ASSERT_FALSE(info.callbacks().empty()); const Callback& callback = info.callbacks()[0]; @@ -150,7 +150,7 @@ TEST(EventDispatcher, EventDispatcher) EXPECT_TRUE(callback.isCCallback()); EXPECT_FALSE(callback.isMELCallback()); EXPECT_FALSE(callback.isPythonCallback()); - EXPECT_EQ(callback.weight(), 1001); + EXPECT_EQ(callback.weight(), 1001u); } CallbackId id2 = info.registerCallback("tag2", "i am a command", 1003, false); @@ -158,7 +158,7 @@ TEST(EventDispatcher, EventDispatcher) { uint64_t callbackPart = extractCallbackId(id2); - EXPECT_EQ(callbackPart, 2); + EXPECT_EQ(callbackPart, 2u); ASSERT_TRUE(info.callbacks().size() == 2); const Callback& callback = info.callbacks()[1]; @@ -170,7 +170,7 @@ TEST(EventDispatcher, EventDispatcher) EXPECT_FALSE(callback.isCCallback()); EXPECT_TRUE(callback.isMELCallback()); EXPECT_FALSE(callback.isPythonCallback()); - EXPECT_EQ(callback.weight(), 1003); + EXPECT_EQ(callback.weight(), 1003u); } CallbackId id3 = info.registerCallback("tag3", "i am a command", 1002, true); @@ -178,9 +178,9 @@ TEST(EventDispatcher, EventDispatcher) { uint64_t callbackPart = extractCallbackId(id3); - EXPECT_EQ(callbackPart, 3); + EXPECT_EQ(callbackPart, 3u); - ASSERT_TRUE(info.callbacks().size() == 3); + ASSERT_TRUE(info.callbacks().size() == 3u); const Callback& callback = info.callbacks()[1]; EXPECT_EQ(callback.callbackId(), id3); @@ -190,12 +190,12 @@ TEST(EventDispatcher, EventDispatcher) EXPECT_FALSE(callback.isCCallback()); EXPECT_FALSE(callback.isMELCallback()); EXPECT_TRUE(callback.isPythonCallback()); - EXPECT_EQ(callback.weight(), 1002); + EXPECT_EQ(callback.weight(), 1002u); } EventDispatcher info2(std::move(info)); EXPECT_TRUE(info2.name() == "eventName"); - EXPECT_TRUE(info2.callbacks().size() == 3); + EXPECT_TRUE(info2.callbacks().size() == 3u); EXPECT_EQ(info2.associatedData(), &associated); EXPECT_TRUE(info.name().empty()); EXPECT_TRUE(info.callbacks().empty()); @@ -203,7 +203,7 @@ TEST(EventDispatcher, EventDispatcher) info = std::move(info2); EXPECT_EQ(info.associatedData(), &associated); EXPECT_TRUE(info.name() == "eventName"); - EXPECT_TRUE(info.callbacks().size() == 3); + EXPECT_TRUE(info.callbacks().size() == 3u); EXPECT_TRUE(info2.name().empty()); EXPECT_TRUE(info2.callbacks().empty()); @@ -211,12 +211,12 @@ TEST(EventDispatcher, EventDispatcher) EXPECT_FALSE(info.unregisterCallback(488)); EXPECT_TRUE(info.unregisterCallback(id1)); - ASSERT_TRUE(info.callbacks().size() == 2); + ASSERT_TRUE(info.callbacks().size() == 2u); ASSERT_TRUE(info.callbacks()[0].callbackId() == id3); ASSERT_TRUE(info.callbacks()[1].callbackId() == id2); EXPECT_TRUE(info.unregisterCallback(id2)); - ASSERT_TRUE(info.callbacks().size() == 1); + ASSERT_TRUE(info.callbacks().size() == 1u); ASSERT_TRUE(info.callbacks()[0].callbackId() == id3); EXPECT_TRUE(info.unregisterCallback(id3)); @@ -293,13 +293,13 @@ TEST(EventScheduler, registerEvent) EXPECT_TRUE(id1 != 0); auto eventInfo = registrar.event(id1); EXPECT_TRUE(eventInfo != nullptr); - EXPECT_EQ(eventInfo->eventId(), 1); - EXPECT_EQ(eventInfo->parentCallbackId(), 0); + EXPECT_EQ(eventInfo->eventId(), 1u); + EXPECT_EQ(eventInfo->parentCallbackId(), 0u); EXPECT_EQ(eventInfo->associatedData(), &associated); // This should fail to register a new event (since the name is not unique) EventId id2 = registrar.registerEvent("eventName", kUserSpecifiedEventType, &associated, 0); - EXPECT_EQ(id2, 0); + EXPECT_EQ(id2, 0u); // We should be able to register a new event (since the associated data is different) int associated2; @@ -307,8 +307,8 @@ TEST(EventScheduler, registerEvent) EXPECT_TRUE(id3 != 0); eventInfo = registrar.event(id3); EXPECT_TRUE(eventInfo != nullptr); - EXPECT_EQ(eventInfo->eventId(), 2); - EXPECT_EQ(eventInfo->parentCallbackId(), 0); + EXPECT_EQ(eventInfo->eventId(), 2u); + EXPECT_EQ(eventInfo->parentCallbackId(), 0u); EXPECT_EQ(eventInfo->associatedData(), &associated2); EXPECT_TRUE(registrar.unregisterEvent(id1)); @@ -332,8 +332,8 @@ TEST(EventScheduler, registerChildEvent) EXPECT_TRUE(id1 != 0); auto parentEventInfo = registrar.event(id1); EXPECT_TRUE(parentEventInfo != nullptr); - EXPECT_EQ(parentEventInfo->eventId(), 1); - EXPECT_EQ(parentEventInfo->parentCallbackId(), 0); + EXPECT_EQ(parentEventInfo->eventId(), 1u); + EXPECT_EQ(parentEventInfo->parentCallbackId(), 0u); EXPECT_EQ(parentEventInfo->associatedData(), &associated); int value; @@ -343,7 +343,7 @@ TEST(EventScheduler, registerChildEvent) EXPECT_TRUE(id2 != 0); auto eventInfo = registrar.event(id2); EXPECT_TRUE(eventInfo != nullptr); - EXPECT_EQ(eventInfo->eventId(), 2); + EXPECT_EQ(eventInfo->eventId(), 2u); EXPECT_EQ(eventInfo->parentCallbackId(), callbackId); EXPECT_EQ(eventInfo->associatedData(), &associated); @@ -374,8 +374,8 @@ TEST(EventScheduler, registerCallback) EXPECT_TRUE(id1 != 0); auto parentEventInfo = registrar.event(id1); EXPECT_TRUE(parentEventInfo != nullptr); - EXPECT_EQ(parentEventInfo->eventId(), 1); - EXPECT_EQ(parentEventInfo->parentCallbackId(), 0); + EXPECT_EQ(parentEventInfo->eventId(), 1u); + EXPECT_EQ(parentEventInfo->parentCallbackId(), 0u); EXPECT_EQ(parentEventInfo->associatedData(), &associated); int value; @@ -385,7 +385,7 @@ TEST(EventScheduler, registerCallback) EXPECT_TRUE(id2 != 0); auto eventInfo = registrar.event(id2); EXPECT_TRUE(eventInfo != nullptr); - EXPECT_EQ(eventInfo->eventId(), 2); + EXPECT_EQ(eventInfo->eventId(), 2u); EXPECT_EQ(eventInfo->parentCallbackId(), callbackId); EXPECT_EQ(eventInfo->associatedData(), &associated); @@ -426,15 +426,15 @@ TEST(EventScheduler, registerCallbackAgainstEventThatDoesNotExist) EXPECT_TRUE(id1 != 0); auto eventInfo = registrar.event(id1); EXPECT_TRUE(eventInfo != nullptr); - EXPECT_EQ(eventInfo->eventId(), 1); - EXPECT_EQ(eventInfo->parentCallbackId(), 0); + EXPECT_EQ(eventInfo->eventId(), 1u); + EXPECT_EQ(eventInfo->parentCallbackId(), 0u); EXPECT_EQ(eventInfo->associatedData(), &associated); CallbackId callbackId = registrar.registerCallback(id1, "ChildCallback2", func_dispatch2, 1000, &value); EXPECT_TRUE(registrar.unregisterCallback(cb.callbackId())); eventInfo = registrar.event(id1); - EXPECT_EQ(1, eventInfo->callbacks().size()); + EXPECT_EQ(1u, eventInfo->callbacks().size()); EXPECT_TRUE(registrar.unregisterCallback(callbackId)); eventInfo = registrar.event(id1); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_MayaEventManager.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_MayaEventManager.cpp index 2b5643f536..2a050e40aa 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_MayaEventManager.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_MayaEventManager.cpp @@ -67,7 +67,7 @@ TEST(maya_Event, registerEvent) EXPECT_EQ(std::string(""), std::string(callbackInfo->callbackText())); EXPECT_EQ(std::string("I'm a tag"), std::string(callbackInfo->tag())); EXPECT_EQ(callback, callbackInfo->callbackId()); - EXPECT_EQ(1234, callbackInfo->weight()); + EXPECT_EQ(1234u, callbackInfo->weight()); EXPECT_FALSE(callbackInfo->isPythonCallback()); EXPECT_FALSE(callbackInfo->isMELCallback()); EXPECT_TRUE(callbackInfo->isCCallback()); @@ -96,7 +96,7 @@ TEST(maya_Event, invalidRegisteredEvent) 1234, 0); - EXPECT_EQ(id, 0); + EXPECT_EQ(id, 0u); } //---------------------------------------------------------------------------------------------------------------------- diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ExportCommands.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ExportCommands.cpp index 78cf5d9cda..8f9cfb04e1 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ExportCommands.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ExportCommands.cpp @@ -154,7 +154,7 @@ TEST(ExportCommands, extensiveAnimationCheck) for(auto op : ops) { auto attr = op.GetAttr(); - EXPECT_EQ(10, attr.GetNumTimeSamples()); + EXPECT_EQ(10u, attr.GetNumTimeSamples()); } } else diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_InternalProxySelection.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_InternalProxySelection.cpp index 4ba67c46e2..b28e0c4dee 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_InternalProxySelection.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_InternalProxySelection.cpp @@ -76,124 +76,124 @@ TEST(InternalProxyShapeSelect, selectNode) MSelectionList sl; // make sure the path is contained in the selected paths (for hydra selection) - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); // make sure undo clears the previous info MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); // make sure redo works happily without side effects MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); // So now we have a single item selected. Let's see if we can replace this selection list // with two other paths. The previous selection should be removed, the two additional paths // should be selected MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -r -pp \"/root/hip2/knee2/ankle2/ltoe2\" -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); // when undoing this command, the previous path should be selected MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); // now attempt to clear the selection list MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -cl \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); // undoing this command should return selected items back into MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); // So now we have a single item selected. Let's see if we can replace this selection list // with two other paths. The previous selection should be removed, the two additional paths // should be selected MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -a -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -a -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectionList().size()); + EXPECT_EQ(1u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -tgl -pp \"/root/hip2/knee2/ankle2/rtoe2\" -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("AL_usdmaya_InternalProxyShapeSelect -tgl -pp \"/root/hip2/knee2/ankle2/rtoe2\" -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectionList().size()); + EXPECT_EQ(2u, proxy->selectionList().size()); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); EXPECT_TRUE(proxy->selectionList().isSelected(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectionList().size()); + EXPECT_EQ(0u, proxy->selectionList().size()); } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerCommands.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerCommands.cpp index 51e6e342b7..b2017f5f5d 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerCommands.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerCommands.cpp @@ -109,18 +109,18 @@ TEST(LayerCommands, addSubLayer) AL::usdmaya::nodes::ProxyShape* proxyShape = CreateMayaProxyShape(constructTransformChain, temp_path); - EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 2); //Session layer and RootLayer + EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 2u); //Session layer and RootLayer // Add anonymous layer to the sublayers MGlobal::executeCommand("AL_usdmaya_LayerCreateLayer -s -o \"\" -p \"AL_usdmaya_ProxyShape1\""); - EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 3); // With added anonymous layer + EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 3u); // With added anonymous layer const MString testLayer = MString(AL_USDMAYA_TEST_DATA) + MString("/root.usda"); MString c; c.format(MString("AL_usdmaya_LayerCreateLayer -s -o \"^1s\" -p \"AL_usdmaya_ProxyShape1\""), testLayer); MGlobal::executeCommand(c); - EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 5); // With added named layer + EXPECT_EQ(proxyShape->getUsdStage()->GetLayerStack().size(), 5u); // With added named layer } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerManagerCommands.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerManagerCommands.cpp index c5f43ee449..956c595f74 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerManagerCommands.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_LayerManagerCommands.cpp @@ -81,15 +81,15 @@ TEST(LayerManagerCommands, noDirtyLayers) MStringArray dirtyLayerPairs; // There should be no dirty layers since we have no edited anything result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dal", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 0); + EXPECT_EQ(dirtyLayerPairs.length(), 0u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dso", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 0); + EXPECT_EQ(dirtyLayerPairs.length(), 0u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dlo", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 0); + EXPECT_EQ(dirtyLayerPairs.length(), 0u); dirtyLayerPairs.clear(); } } @@ -119,16 +119,16 @@ TEST(LayerManagerCommands, dirtySublayer) result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dal", dirtyLayerPairs, true); // 4 (layerIdentifier,layerContents), since both the rootlayer and sublayer have been modified. - EXPECT_EQ(dirtyLayerPairs.length(), 4); + EXPECT_EQ(dirtyLayerPairs.length(), 4u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dso", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 0); + EXPECT_EQ(dirtyLayerPairs.length(), 0u); dirtyLayerPairs.clear(); // 4 (layerIdentifier,layerContents), since both the rootlayer and sublayer have been modified. result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dlo", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 4); + EXPECT_EQ(dirtyLayerPairs.length(), 4u); dirtyLayerPairs.clear(); } } @@ -147,16 +147,16 @@ TEST(LayerManagerCommands, dirtySessionLayer) stage->DefinePrim(SdfPath("/DirtySessionLayer")); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dal", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 2); + EXPECT_EQ(dirtyLayerPairs.length(), 2u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dso", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 2); + EXPECT_EQ(dirtyLayerPairs.length(), 2u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dlo", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 0); + EXPECT_EQ(dirtyLayerPairs.length(), 0u); dirtyLayerPairs.clear(); } } @@ -189,15 +189,15 @@ TEST(LayerManagerCommands, dirtySublayerSessionLayer) stage->SetEditTarget(sublayer); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dal", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 4); + EXPECT_EQ(dirtyLayerPairs.length(), 4u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dso", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 2); + EXPECT_EQ(dirtyLayerPairs.length(), 2u); dirtyLayerPairs.clear(); result = MGlobal::executeCommand("AL_usdmaya_LayerManager -dlo", dirtyLayerPairs, true); - EXPECT_EQ(dirtyLayerPairs.length(), 2); + EXPECT_EQ(dirtyLayerPairs.length(), 2u); dirtyLayerPairs.clear(); } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeImport.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeImport.cpp index a663477b0f..2f2002647c 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeImport.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeImport.cpp @@ -442,7 +442,7 @@ TEST(ProxyShapeImport, layerManagerTracksAllDirtyLayersWhenLoadingFromStageCache MStringArray trackedLayerIds; layerManager->getLayerIdentifiers(trackedLayerIds); - ASSERT_EQ(trackedLayerIds.length(), 2); + ASSERT_EQ(trackedLayerIds.length(), 2u); auto trackedLayer = layerManager->findLayer(rootLayer->GetIdentifier()); ASSERT_TRUE(trackedLayer); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeSelect.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeSelect.cpp index a9cc632d6f..e77736dbe1 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeSelect.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/commands/test_ProxyShapeSelect.cpp @@ -108,13 +108,13 @@ TEST(ProxyShapeSelect, selectNode1) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", results, false, true); MSelectionList sl; - EXPECT_EQ(1, results.length()); + EXPECT_EQ(1u, results.length()); EXPECT_EQ(MString("|transform1|root|hip1|knee1|ankle1|ltoe1"), results[0]); results.clear(); // make sure the path is contained in the selected paths (for hydra selection) - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -125,21 +125,21 @@ TEST(ProxyShapeSelect, selectNode1) // make sure undo clears the previous info MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // make sure redo works happily without side effects MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -151,14 +151,14 @@ TEST(ProxyShapeSelect, selectNode1) // with two other paths. The previous selection should be removed, the two additional paths // should be selected MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip2/knee2/ankle2/ltoe2\" -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(2, results.length()); + EXPECT_EQ(2u, results.length()); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|ltoe2"), results[0]); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|rtoe2"), results[1]); results.clear(); - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -174,8 +174,8 @@ TEST(ProxyShapeSelect, selectNode1) // when undoing this command, the previous path should be selected MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -190,9 +190,9 @@ TEST(ProxyShapeSelect, selectNode1) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -207,9 +207,9 @@ TEST(ProxyShapeSelect, selectNode1) // now attempt to clear the selection list MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -cl \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -221,14 +221,14 @@ TEST(ProxyShapeSelect, selectNode1) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // undoing this command should return selected items back into MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/ltoe2"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2/knee2/ankle2/rtoe2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -243,7 +243,7 @@ TEST(ProxyShapeSelect, selectNode1) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -255,7 +255,7 @@ TEST(ProxyShapeSelect, selectNode1) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); } @@ -340,11 +340,11 @@ TEST(ProxyShapeSelect, selectNode2) // with two other paths. The previous selection should be removed, the two additional paths // should be selected MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -a -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(1, results.length()); + EXPECT_EQ(1u, results.length()); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|ltoe2"), results[0]); results.clear(); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -354,11 +354,11 @@ TEST(ProxyShapeSelect, selectNode2) compareNodes({SdfPath("/root/hip2/knee2/ankle2/ltoe2")}); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -a -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(1, results.length()); + EXPECT_EQ(1u, results.length()); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|rtoe2"), results[0]); results.clear(); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -373,7 +373,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -388,7 +388,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -400,11 +400,11 @@ TEST(ProxyShapeSelect, selectNode2) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -420,7 +420,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -434,10 +434,10 @@ TEST(ProxyShapeSelect, selectNode2) compareNodes({SdfPath("/root/hip2/knee2/ankle2/ltoe2"), SdfPath("/root/hip2/knee2/ankle2/rtoe2")}); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); results.clear(); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -451,10 +451,10 @@ TEST(ProxyShapeSelect, selectNode2) compareNodes({SdfPath("/root/hip2/knee2/ankle2/rtoe2")}); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); results.clear(); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -466,11 +466,11 @@ TEST(ProxyShapeSelect, selectNode2) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -485,7 +485,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -500,7 +500,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -515,7 +515,7 @@ TEST(ProxyShapeSelect, selectNode2) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -527,7 +527,7 @@ TEST(ProxyShapeSelect, selectNode2) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); } @@ -618,10 +618,10 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -a -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); results.clear(); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -635,10 +635,10 @@ TEST(ProxyShapeSelect, selectNode3) compareNodes({SdfPath("/root/hip2/knee2/ankle2/rtoe2")}); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -d -pp \"/root/hip2/knee2/ankle2/rtoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); results.clear(); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -650,11 +650,11 @@ TEST(ProxyShapeSelect, selectNode3) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -669,7 +669,7 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -684,7 +684,7 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -699,7 +699,7 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -711,15 +711,15 @@ TEST(ProxyShapeSelect, selectNode3) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -tgl -pp \"/root/hip2/knee2/ankle2/rtoe2\" -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(2, results.length()); + EXPECT_EQ(2u, results.length()); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|rtoe2"), results[0]); EXPECT_EQ(MString("|transform1|root|hip2|knee2|ankle2|ltoe2"), results[1]); results.clear(); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -733,10 +733,10 @@ TEST(ProxyShapeSelect, selectNode3) compareNodes({SdfPath("/root/hip2/knee2/ankle2/ltoe2"), SdfPath("/root/hip2/knee2/ankle2/rtoe2")}); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -tgl -pp \"/root/hip2/knee2/ankle2/rtoe2\" -pp \"/root/hip2/knee2/ankle2/ltoe2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); results.clear(); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -748,11 +748,11 @@ TEST(ProxyShapeSelect, selectNode3) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -767,7 +767,7 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("undo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -779,11 +779,11 @@ TEST(ProxyShapeSelect, selectNode3) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(2, proxy->selectedPaths().size()); + EXPECT_EQ(2u, proxy->selectedPaths().size()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -798,7 +798,7 @@ TEST(ProxyShapeSelect, selectNode3) MGlobal::executeCommand("redo", false, true); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip2/knee2"))); @@ -810,7 +810,7 @@ TEST(ProxyShapeSelect, selectNode3) EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1"))); EXPECT_FALSE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); } // make sure we can select a parent transform of a node that is already selected @@ -852,7 +852,7 @@ TEST(ProxyShapeSelect, selectParent) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", false, true); MSelectionList sl; MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -862,7 +862,7 @@ TEST(ProxyShapeSelect, selectParent) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1\" \"AL_usdmaya_ProxyShape1\"", false, true); sl.clear(); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -909,7 +909,7 @@ TEST(ProxyShapeSelect, selectParentViaMaya) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", false, true); MSelectionList sl; MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -919,7 +919,7 @@ TEST(ProxyShapeSelect, selectParentViaMaya) MGlobal::executeCommand("select -r \"ankle1\"", false, true); sl.clear(); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -966,7 +966,7 @@ TEST(ProxyShapeSelect, selectSamePathTwice) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", false, true); MSelectionList sl; MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -975,14 +975,14 @@ TEST(ProxyShapeSelect, selectSamePathTwice) uint32_t selected = 0, required = 0, refCount = 0; proxy->getCounts(SdfPath("/root/hip1/knee1/ankle1/ltoe1"), selected, required, refCount); - EXPECT_EQ(1, selected); - EXPECT_EQ(0, required); - EXPECT_EQ(0, refCount); + EXPECT_EQ(1u, selected); + EXPECT_EQ(0u, required); + EXPECT_EQ(0u, refCount); MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", false, true); sl.clear(); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -991,9 +991,9 @@ TEST(ProxyShapeSelect, selectSamePathTwice) selected = 0, required = 0, refCount = 0; proxy->getCounts(SdfPath("/root/hip1/knee1/ankle1/ltoe1"), selected, required, refCount); - EXPECT_EQ(1, selected); - EXPECT_EQ(0, required); - EXPECT_EQ(0, refCount); + EXPECT_EQ(1u, selected); + EXPECT_EQ(0u, required); + EXPECT_EQ(0u, refCount); } @@ -1036,7 +1036,7 @@ TEST(ProxyShapeSelect, selectSamePathTwiceViaMaya) MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/root/hip1/knee1/ankle1/ltoe1\" \"AL_usdmaya_ProxyShape1\"", false, true); MSelectionList sl; MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1045,14 +1045,14 @@ TEST(ProxyShapeSelect, selectSamePathTwiceViaMaya) uint32_t selected = 0, required = 0, refCount = 0; proxy->getCounts(SdfPath("/root/hip1/knee1/ankle1/ltoe1"), selected, required, refCount); - EXPECT_EQ(1, selected); - EXPECT_EQ(0, required); - EXPECT_EQ(0, refCount); + EXPECT_EQ(1u, selected); + EXPECT_EQ(0u, required); + EXPECT_EQ(0u, refCount); MGlobal::executeCommand("select -r \"|transform1|root|hip1|knee1|ankle1|ltoe1\"", false, true); sl.clear(); MGlobal::getActiveSelectionList(sl); - EXPECT_EQ(1, sl.length()); + EXPECT_EQ(1u, sl.length()); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1061,9 +1061,9 @@ TEST(ProxyShapeSelect, selectSamePathTwiceViaMaya) selected = 0, required = 0, refCount = 0; proxy->getCounts(SdfPath("/root/hip1/knee1/ankle1/ltoe1"), selected, required, refCount); - EXPECT_EQ(1, selected); - EXPECT_EQ(0, required); - EXPECT_EQ(0, refCount); + EXPECT_EQ(1u, selected); + EXPECT_EQ(0u, required); + EXPECT_EQ(0u, refCount); } TEST(ProxyShapeSelect, repeatedSelection) @@ -1085,26 +1085,26 @@ TEST(ProxyShapeSelect, repeatedSelection) MGlobal::getActiveSelectionList(sl); MStringArray selStrings; sl.getSelectionStrings(selStrings); - ASSERT_EQ(1, selStrings.length()); + ASSERT_EQ(1u, selStrings.length()); ASSERT_EQ(objName, selStrings[0]); // Make sure it's only selected ONCE! auto& selectedPaths = proxy->selectedPaths(); - ASSERT_EQ(1, selectedPaths.size()); + ASSERT_EQ(1u, selectedPaths.size()); size_t pathCount = 0; for (auto& it : proxy->selectedPaths()) { if (it == path) { pathCount += 1; } } - ASSERT_EQ(1, pathCount); + ASSERT_EQ(1u, pathCount); }; auto assertNothingSelected = [](AL::usdmaya::nodes::ProxyShape *proxy) { MSelectionList sl; MGlobal::getActiveSelectionList(sl); - ASSERT_EQ(0, sl.length()); - ASSERT_EQ(0, proxy->selectedPaths().size()); + ASSERT_EQ(0u, sl.length()); + ASSERT_EQ(0u, proxy->selectedPaths().size()); }; const std::string temp_path = buildTempPath("AL_USDMayaTests_repeatedSelection.usda"); @@ -1192,7 +1192,7 @@ TEST(ProxyShapeSelect, deselectNode) MGlobal::getActiveSelectionList(sl); MStringArray selStrings; sl.getSelectionStrings(selStrings); - ASSERT_EQ(1, selStrings.length()); + ASSERT_EQ(1u, selStrings.length()); ASSERT_EQ(objName, selStrings[0]); }; @@ -1200,7 +1200,7 @@ TEST(ProxyShapeSelect, deselectNode) { MSelectionList sl; MGlobal::getActiveSelectionList(sl); - ASSERT_EQ(0, sl.length()); + ASSERT_EQ(0u, sl.length()); }; const std::string temp_path = buildTempPath("AL_USDMayaTests_deselectNode.usda"); @@ -1360,13 +1360,13 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 0: nothing selected MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -r -pp \"/\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(1, results.length()); + EXPECT_EQ(1u, results.length()); EXPECT_EQ(MString("|transform1|AL_usdmaya_ProxyShape1"), results[0]); results.clear(); // State 1: proxy selected // make sure nothing is in the internally selected paths - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); // Make sure active selection is as expected { SCOPED_TRACE(""); compareNodes({SdfPath("/")}); }; @@ -1374,14 +1374,14 @@ TEST(ProxyShapeSelect, pseudoRootSelect) MGlobal::executeCommand("undo", false, true); // State 0: nothing selected - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); { SCOPED_TRACE(""); compareNodes({}); }; // make sure redo works happily without side effects MGlobal::executeCommand("redo", false, true); // State 1: proxy selected - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); { SCOPED_TRACE(""); compareNodes({SdfPath("/")}); }; // Make sure toggle works with a root path, and another path @@ -1391,8 +1391,8 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 2: ltoe1 selected // make sure ltoe1 is contained in the selected paths (for hydra selection) - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1403,16 +1403,16 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // Make sure append works MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -append -pp \"/\" -pp \"/root/hip2\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(2, results.length()); + EXPECT_EQ(2u, results.length()); EXPECT_EQ(MString("|transform1|AL_usdmaya_ProxyShape1"), results[0]); EXPECT_EQ(MString("|transform1|root|hip2"), results[1]); results.clear(); // State 3: ltoe1, proxy, hip2 selected // make sure ltoe1 and hip2 are contained in the selected paths (for hydra selection) - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1424,13 +1424,13 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // Make sure remove works MGlobal::executeCommand("AL_usdmaya_ProxyShapeSelect -d -pp \"/\" \"AL_usdmaya_ProxyShape1\"", results, false, true); - EXPECT_EQ(0, results.length()); + EXPECT_EQ(0u, results.length()); // State 4: ltoe1, hip2 selected // make sure ltoe1 and hip2 are contained in the selected paths (for hydra selection) - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1445,9 +1445,9 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 3: ltoe1, proxy, hip2 selected // make sure ltoe1 and hip2 are contained in the selected paths (for hydra selection) - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1462,8 +1462,8 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 2: ltoe1 selected // make sure ltoe1 is contained in the selected paths (for hydra selection) - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1476,21 +1476,21 @@ TEST(ProxyShapeSelect, pseudoRootSelect) MGlobal::executeCommand("undo", false, true); // State 1: proxy selected - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); { SCOPED_TRACE(""); compareNodes({SdfPath("/")}); }; // Undo the initial replace MGlobal::executeCommand("undo", false, true); // State 0: nothing selected - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); { SCOPED_TRACE(""); compareNodes({}); }; // Redo the initial replace MGlobal::executeCommand("redo", false, true); // State 1: proxy selected - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); { SCOPED_TRACE(""); compareNodes({SdfPath("/")}); }; // Redo the toggle @@ -1498,8 +1498,8 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 2: ltoe1 selected // make sure ltoe1 is contained in the selected paths (for hydra selection) - EXPECT_EQ(1, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1513,9 +1513,9 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 3: ltoe1, proxy, hip2 selected // make sure ltoe1 and hip2 are contained in the selected paths (for hydra selection) - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); @@ -1530,9 +1530,9 @@ TEST(ProxyShapeSelect, pseudoRootSelect) // State 4: ltoe1, hip2 selected // make sure ltoe1 and hip2 are contained in the selected paths (for hydra selection) - EXPECT_EQ(2, proxy->selectedPaths().size()); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); - EXPECT_EQ(1, proxy->selectedPaths().count(SdfPath("/root/hip2"))); + EXPECT_EQ(2u, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip1/knee1/ankle1/ltoe1"))); + EXPECT_EQ(1u, proxy->selectedPaths().count(SdfPath("/root/hip2"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1"))); EXPECT_TRUE(proxy->isRequiredPath(SdfPath("/root/hip1/knee1"))); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_blendshape.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_blendshape.cpp index 918dc520ad..0fe5a3c5e7 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_blendshape.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_blendshape.cpp @@ -89,7 +89,7 @@ TEST(export_blendshape, non_animated_mesh) UsdAttribute pointsAttr = mesh.GetPointsAttr(); ASSERT_TRUE(pointsAttr); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(0, size); + EXPECT_EQ(0u, size); } TEST(export_blendshape, animated_mesh) @@ -127,7 +127,7 @@ TEST(export_blendshape, animated_mesh) UsdAttribute pointsAttr = mesh.GetPointsAttr(); ASSERT_TRUE(pointsAttr); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(50, size); + EXPECT_EQ(50u, size); } TEST(export_blendshape, time_bound_animated_mesh) @@ -165,5 +165,5 @@ TEST(export_blendshape, time_bound_animated_mesh) UsdAttribute pointsAttr = mesh.GetPointsAttr(); ASSERT_TRUE(pointsAttr); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(50, size); + EXPECT_EQ(50u, size); } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_constraints.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_constraints.cpp index 0c398bdf95..b10be0e169 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_constraints.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_constraints.cpp @@ -144,7 +144,7 @@ TEST(export_constraint, constraints) for(auto op : ops) { auto attr = op.GetAttr(); - EXPECT_EQ(50, attr.GetNumTimeSamples()); + EXPECT_EQ(50u, attr.GetNumTimeSamples()); } ++iter; } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_ik.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_ik.cpp index 0cb01330dc..7ad8776bee 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_ik.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_ik.cpp @@ -80,11 +80,11 @@ TEST(export_ik, ikchain) auto attr = op.GetAttr(); if(AL::usdmaya::xformOpToEnum(op.GetBaseName()) == AL::usdmaya::kTranslate) { - EXPECT_EQ(0, attr.GetNumTimeSamples()); + EXPECT_EQ(0u, attr.GetNumTimeSamples()); } else { - EXPECT_EQ(50, attr.GetNumTimeSamples()); + EXPECT_EQ(50u, attr.GetNumTimeSamples()); } } } @@ -101,11 +101,11 @@ TEST(export_ik, ikchain) auto attr = op.GetAttr(); if(AL::usdmaya::xformOpToEnum(op.GetBaseName()) == AL::usdmaya::kTranslate) { - EXPECT_EQ(0, attr.GetNumTimeSamples()); + EXPECT_EQ(0u, attr.GetNumTimeSamples()); } else { - EXPECT_EQ(50, attr.GetNumTimeSamples()); + EXPECT_EQ(50u, attr.GetNumTimeSamples()); } } } @@ -116,11 +116,11 @@ TEST(export_ik, ikchain) bool resetsXformStack; std::vector ops = joint3.GetOrderedXformOps(&resetsXformStack); - EXPECT_EQ(ops.size(), 1); + EXPECT_EQ(ops.size(), 1u); for(auto op : ops) { auto attr = op.GetAttr(); - EXPECT_EQ(0, attr.GetNumTimeSamples()); + EXPECT_EQ(0u, attr.GetNumTimeSamples()); } } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_lattice.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_lattice.cpp index 3f7a49617f..41b4179b0b 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_lattice.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_lattice.cpp @@ -60,7 +60,7 @@ TEST(export_ffd, nonanimated) UsdAttribute pointsAttr = mesh.GetPointsAttr(); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(0, size); + EXPECT_EQ(0u, size); } } @@ -98,7 +98,7 @@ TEST(export_ffd, animated) UsdAttribute pointsAttr = mesh.GetPointsAttr(); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(50, size); + EXPECT_EQ(50u, size); } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_nonlinear.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_nonlinear.cpp index a15457f564..20845c9347 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_nonlinear.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_nonlinear.cpp @@ -60,7 +60,7 @@ TEST(export_nonlinear, nonanimated) UsdAttribute pointsAttr = mesh.GetPointsAttr(); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(0, size); + EXPECT_EQ(0u, size); } } @@ -97,7 +97,7 @@ TEST(export_nonlinear, animated) UsdAttribute pointsAttr = mesh.GetPointsAttr(); size_t size = pointsAttr.GetNumTimeSamples(); - EXPECT_EQ(50, size); + EXPECT_EQ(50u, size); } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/import_instances.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/import_instances.cpp index f1e5cd6941..4d61119c07 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/import_instances.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/import_instances.cpp @@ -67,11 +67,11 @@ TEST(import_instances, merged) ASSERT_TRUE(removed != 0); } - EXPECT_EQ(0, expectedTransforms.size()); + EXPECT_EQ(0u, expectedTransforms.size()); MStringArray meshResults; MGlobal::executeCommand("ls -type mesh", meshResults); - EXPECT_EQ(2, meshResults.length()); + EXPECT_EQ(2u, meshResults.length()); } TEST(import_instances, unmerged) @@ -129,11 +129,11 @@ TEST(import_instances, unmerged) ASSERT_TRUE(removed != 0); } - EXPECT_EQ(0, expectedTransforms.size()); + EXPECT_EQ(0u, expectedTransforms.size()); MStringArray meshResults; MGlobal::executeCommand("ls -type mesh", meshResults); - EXPECT_EQ(2, meshResults.length()); + EXPECT_EQ(2u, meshResults.length()); } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/proxy/test_PrimFilter.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/proxy/test_PrimFilter.cpp index 31c32f3077..34899e90d0 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/proxy/test_PrimFilter.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/proxy/test_PrimFilter.cpp @@ -234,7 +234,7 @@ TEST(PrimFilter, removedPaths) EXPECT_TRUE(filter.newPrimSet()[2].GetPath() == SdfPath("/root/hip2/knee2/ankle2/ltoe2")); EXPECT_TRUE(filter.newPrimSet()[3].GetPath() == SdfPath("/root/hip2/knee2/ankle2/rtoe2")); EXPECT_TRUE(filter.updatablePrimSet().size() == previous.size()); - ASSERT_EQ(4, filter.transformsToCreate().size()); + ASSERT_EQ(4u, filter.transformsToCreate().size()); EXPECT_TRUE(filter.transformsToCreate()[0].GetPath() == SdfPath("/root/hip1/knee1/ankle1/ltoe1")); EXPECT_TRUE(filter.transformsToCreate()[1].GetPath() == SdfPath("/root/hip1/knee1/ankle1/rtoe1")); EXPECT_TRUE(filter.transformsToCreate()[2].GetPath() == SdfPath("/root/hip2/knee2/ankle2/ltoe2")); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ActiveInactive.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ActiveInactive.cpp index 07e997be8a..60291f1407 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ActiveInactive.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ActiveInactive.cpp @@ -338,7 +338,7 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); MFileIO::saveAs(temp_ma_path.c_str(), 0, true); @@ -354,7 +354,7 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); MFileIO::saveAs(temp_ma_path2.c_str(), 0, true); @@ -365,7 +365,7 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); } @@ -387,7 +387,7 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // deactivate the prim @@ -395,14 +395,14 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); } @@ -424,14 +424,14 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // deactivate the prim @@ -439,7 +439,7 @@ TEST_F(ActiveInactive, customTransformType) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); } } @@ -488,7 +488,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); @@ -497,7 +497,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // activate the prim @@ -507,7 +507,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); @@ -516,7 +516,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); } @@ -544,7 +544,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // activate the prim @@ -553,7 +553,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); @@ -562,7 +562,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // activate the prim @@ -572,7 +572,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); } MFileIO::newFile(true); @@ -599,7 +599,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("dave:pSphere1"))); EXPECT_TRUE(bool(sl.add("dave:pSphereShape1"))); EXPECT_TRUE(bool(sl.add("dave:polySphere1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); UsdPrim prim = stage->GetPrimAtPath(SdfPath("/root")); @@ -618,7 +618,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("dave:pCube1"))); EXPECT_TRUE(bool(sl.add("dave:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("dave:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // should be able to set the variant back to a sphere @@ -631,7 +631,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("dave:pCube1"))); EXPECT_FALSE(bool(sl.add("dave:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("dave:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // should be able to set the variant back to a cube @@ -644,7 +644,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("dave:pCube1"))); EXPECT_TRUE(bool(sl.add("dave:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("dave:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // should be able to set the variant to cube with ns fred @@ -677,7 +677,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("fred:pCube1"))); EXPECT_FALSE(bool(sl.add("fred:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("fred:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // should be able to set the variant back to a cached sphere @@ -693,7 +693,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("fred:pCube1"))); EXPECT_FALSE(bool(sl.add("fred:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("fred:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // With any luck, the transform chain above the prim should have been removed leaving us with no // AL_usdmaya_transforms in the scene @@ -716,7 +716,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("fred:pCube1"))); EXPECT_FALSE(bool(sl.add("fred:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("fred:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // check to make sure the transform chain is back @@ -776,7 +776,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); // activate the prim @@ -786,7 +786,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); EXPECT_EQ(MStatus(MS::kSuccess), MFileIO::saveAs(temp_ma_path3.c_str(), 0, true)); @@ -810,7 +810,7 @@ TEST_F(ActiveInactive, disable) EXPECT_FALSE(bool(sl.add("cube:pCube1"))); EXPECT_FALSE(bool(sl.add("cube:pCubeShape1"))); EXPECT_FALSE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); // activate the prim, this should ensure the MGlobal::executeCommand("AL_usdmaya_ActivatePrim -a true -pp \"/root/rig\" \"AL_usdmaya_ProxyShape1\"", false, false); @@ -818,7 +818,7 @@ TEST_F(ActiveInactive, disable) EXPECT_TRUE(bool(sl.add("cube:pCube1"))); EXPECT_TRUE(bool(sl.add("cube:pCubeShape1"))); EXPECT_TRUE(bool(sl.add("cube:polyCube1"))); - EXPECT_EQ(3, sl.length()); + EXPECT_EQ(3u, sl.length()); sl.clear(); } } @@ -868,7 +868,7 @@ TEST_F(ActiveInactive, variantChange) EXPECT_TRUE(bool(sl.add("switchable"))); EXPECT_TRUE(bool(sl.add("switchable|top"))); EXPECT_TRUE(bool(sl.add("cam"))); - EXPECT_EQ(4, sl.length()); + EXPECT_EQ(4u, sl.length()); sl.clear(); UsdPrim prim = stage->GetPrimAtPath(SdfPath("/root/switchable")); @@ -885,7 +885,7 @@ TEST_F(ActiveInactive, variantChange) EXPECT_TRUE(bool(sl.add("cam_ns:camera_rigg_top"))); EXPECT_TRUE(bool(sl.add("cam_ns:camera1"))); EXPECT_TRUE(bool(sl.add("cam_ns:cameraShape1"))); - EXPECT_EQ(5, sl.length()); + EXPECT_EQ(5u, sl.length()); sl.clear(); // make sure we can switch back @@ -895,7 +895,7 @@ TEST_F(ActiveInactive, variantChange) EXPECT_TRUE(bool(sl.add("switchable"))); EXPECT_TRUE(bool(sl.add("switchable|top"))); EXPECT_TRUE(bool(sl.add("cam"))); - EXPECT_EQ(4, sl.length()); + EXPECT_EQ(4u, sl.length()); sl.clear(); EXPECT_TRUE(optionSet.SetVariantSelection("no_translator")); @@ -907,7 +907,7 @@ TEST_F(ActiveInactive, variantChange) EXPECT_FALSE(bool(sl.add("cam_ns:camera_rigg_top"))); EXPECT_FALSE(bool(sl.add("cam_ns:camera1"))); EXPECT_FALSE(bool(sl.add("cam_ns:cameraShape1"))); - EXPECT_EQ(0, sl.length()); + EXPECT_EQ(0u, sl.length()); sl.clear(); } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ExtraDataPlugin.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ExtraDataPlugin.cpp index d8f0787d18..f9cbaa9038 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ExtraDataPlugin.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ExtraDataPlugin.cpp @@ -81,7 +81,7 @@ TEST(ExtraDataPlugin, ExtraDataPlugin) auto dataPlugins = manufacture.getExtraDataPlugins(mayaObject); ASSERT_TRUE(!dataPlugins.empty()); - EXPECT_EQ(1, dataPlugins.size()); + EXPECT_EQ(1u, dataPlugins.size()); // ensure correct extra data plugin returned auto first = dataPlugins[0]; diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_LayerManager.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_LayerManager.cpp index 976e01d346..5f33a3d135 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_LayerManager.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_LayerManager.cpp @@ -81,32 +81,32 @@ TEST(LayerManager, conditionalCreator) // Before we start, should no LayerManagers getLayerManagers(managers); - EXPECT_EQ(managers.length(), 0); + EXPECT_EQ(managers.length(), 0u); // After we make one, should be one createLayerManager(); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); // Trying to make another should fail createLayerManager(); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); // Delete the layer manager deleteLayerManager(managers[0]); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 0); + EXPECT_EQ(managers.length(), 0u); // Should be able to make another one again createLayerManager(); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); // Trying to make another should fail createLayerManager(); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); } // static MObject findNode(); @@ -122,7 +122,7 @@ TEST(LayerManager, findNode) // Before we start, should no LayerManagers getLayerManagers(managers); - EXPECT_EQ(managers.length(), 0); + EXPECT_EQ(managers.length(), 0u); result = AL::usdmaya::nodes::LayerManager::findNode(); EXPECT_TRUE(result.isNull()); EXPECT_FALSE(AL::usdmaya::nodes::LayerManager::findManager()); @@ -131,7 +131,7 @@ TEST(LayerManager, findNode) MObject manager = AL::usdmaya::nodes::LayerManager::findOrCreateNode(); EXPECT_FALSE(manager.isNull()); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); EXPECT_EQ(managers[0], manager); result = AL::usdmaya::nodes::LayerManager::findNode(); EXPECT_FALSE(result.isNull()); @@ -140,7 +140,7 @@ TEST(LayerManager, findNode) EXPECT_FALSE(result.isNull()); EXPECT_EQ(result, manager); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); auto managerPtr = static_cast(MFnDependencyNode(manager).userNode()); @@ -151,13 +151,13 @@ TEST(LayerManager, findNode) // Trying to make another should fail createLayerManager(); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); EXPECT_EQ(managers[0], manager); // Delete the layer manager deleteLayerManager(managers[0]); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 0); + EXPECT_EQ(managers.length(), 0u); result = AL::usdmaya::nodes::LayerManager::findNode(); EXPECT_TRUE(result.isNull()); EXPECT_FALSE(AL::usdmaya::nodes::LayerManager::findManager()); @@ -166,7 +166,7 @@ TEST(LayerManager, findNode) manager = AL::usdmaya::nodes::LayerManager::findOrCreateNode(); EXPECT_FALSE(manager.isNull()); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); EXPECT_EQ(managers[0], manager); result = AL::usdmaya::nodes::LayerManager::findNode(); EXPECT_FALSE(result.isNull()); @@ -175,7 +175,7 @@ TEST(LayerManager, findNode) EXPECT_FALSE(result.isNull()); EXPECT_EQ(result, manager); getLayerManagers(managers); - EXPECT_EQ(managers.length(), 1); + EXPECT_EQ(managers.length(), 1u); managerPtr = static_cast(MFnDependencyNode(manager).userNode()); @@ -205,7 +205,7 @@ TEST(LayerManager, addRemoveLayer) ASSERT_FALSE(manager->findLayer(anonLayer->GetIdentifier())); ASSERT_FALSE(manager->findLayer(realLayer->GetIdentifier())); manager->getLayerIdentifiers(layerIds); - ASSERT_EQ(layerIds.length(), 0); + ASSERT_EQ(layerIds.length(), 0u); // try adding an anonymous layer { @@ -216,7 +216,7 @@ TEST(LayerManager, addRemoveLayer) ASSERT_EQ(manager->findLayer(anonLayer->GetIdentifier()), anonLayer); ASSERT_FALSE(manager->findLayer(realLayer->GetIdentifier())); manager->getLayerIdentifiers(layerIds); - ASSERT_EQ(layerIds.length(), 1); + ASSERT_EQ(layerIds.length(), 1u); ASSERT_EQ(MString(anonLayer->GetIdentifier().c_str()), layerIds[0]); } @@ -228,7 +228,7 @@ TEST(LayerManager, addRemoveLayer) ASSERT_EQ(manager->findLayer(anonLayer->GetIdentifier()), anonLayer); ASSERT_EQ(manager->findLayer(realLayer->GetIdentifier()), realLayer); manager->getLayerIdentifiers(layerIds); - ASSERT_EQ(layerIds.length(), 2); + ASSERT_EQ(layerIds.length(), 2u); // since there's ony two items, and they may be returned in arbitrary // order, just check both orderings if (MString(anonLayer->GetIdentifier().c_str()) == layerIds[0]) @@ -250,7 +250,7 @@ TEST(LayerManager, addRemoveLayer) ASSERT_FALSE(manager->findLayer(anonLayer->GetIdentifier())); ASSERT_EQ(manager->findLayer(realLayer->GetIdentifier()), realLayer); manager->getLayerIdentifiers(layerIds); - ASSERT_EQ(layerIds.length(), 1); + ASSERT_EQ(layerIds.length(), 1u); ASSERT_EQ(MString(realLayer->GetIdentifier().c_str()), layerIds[0]); } @@ -262,7 +262,7 @@ TEST(LayerManager, addRemoveLayer) ASSERT_FALSE(manager->findLayer(anonLayer->GetIdentifier())); ASSERT_FALSE(manager->findLayer(realLayer->GetIdentifier())); manager->getLayerIdentifiers(layerIds); - ASSERT_EQ(layerIds.length(), 0); + ASSERT_EQ(layerIds.length(), 0u); } } @@ -290,8 +290,8 @@ def Scope "blabla" auto *manager = AL::usdmaya::nodes::LayerManager::findOrCreateManager(); ASSERT_TRUE(manager); - ASSERT_EQ(0, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(0, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(0u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(0u, manager->layersPlug().evaluateNumElements()); auto realLayer = SdfLayer::New( SdfFileFormat::FindById(UsdUsdaFileFormatTokens->Id), @@ -343,11 +343,11 @@ def Scope "blabla" }; auto assertLayersPopulated = [&] () { - ASSERT_EQ(0, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(1, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(0u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(1u, manager->layersPlug().evaluateNumElements()); MPlug layersPlug0 = manager->layersPlug().elementByPhysicalIndex(0, &status); ASSERT_TRUE(status); - ASSERT_EQ(0, layersPlug0.logicalIndex(&status)); + ASSERT_EQ(0u, layersPlug0.logicalIndex(&status)); ASSERT_TRUE(status); // lame that MPlug.child(MObject&) won't accept const MObject&... so make a temp non-const one MObject tempNonConst; @@ -370,17 +370,17 @@ def Scope "blabla" }; // Now try making dummy connections to the layers attribute - ASSERT_EQ(0, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(0, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(0u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(0u, manager->layersPlug().evaluateNumElements()); { SCOPED_TRACE(""); makeConnections(); } - ASSERT_EQ(2, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(2, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(2u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(2u, manager->layersPlug().evaluateNumElements()); // Then make sure clearSerialisationAttributes wipes them out manager->clearSerialisationAttributes(); - ASSERT_EQ(0, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(0, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(0u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(0u, manager->layersPlug().evaluateNumElements()); // Now, populate, we should have one layer plug manager->populateSerialisationAttributes(); @@ -388,11 +388,11 @@ def Scope "blabla" // Try clearing, then making connections, then re-populating manager->clearSerialisationAttributes(); - ASSERT_EQ(0, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(0, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(0u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(0u, manager->layersPlug().evaluateNumElements()); { SCOPED_TRACE(""); makeConnections(); } - ASSERT_EQ(2, manager->layersPlug().numConnectedElements()); - ASSERT_EQ(2, manager->layersPlug().evaluateNumElements()); + ASSERT_EQ(2u, manager->layersPlug().numConnectedElements()); + ASSERT_EQ(2u, manager->layersPlug().evaluateNumElements()); manager->populateSerialisationAttributes(); { SCOPED_TRACE(""); assertLayersPopulated(); } } @@ -443,20 +443,20 @@ TEST(LayerManager, simpleSaveRestore) MStringArray result; MGlobal::executeCommand(MString("ls -type " ) + AL::usdmaya::nodes::LayerManager::kTypeName, result); - EXPECT_EQ(result.length(), 1); + EXPECT_EQ(result.length(), 1u); // ...however, it's layers attribute should be empty (only used during serialization / deserialization!) MFnDependencyNode mfnLayerMan(layerManagerNode); MPlug layerPlug = mfnLayerMan.findPlug("layers"); ASSERT_FALSE(layerPlug.isNull()); ASSERT_TRUE(layerPlug.isArray()); - EXPECT_EQ(layerPlug.evaluateNumElements(), 0); + EXPECT_EQ(layerPlug.evaluateNumElements(), 0u); // Make sure that we still have the edits we made... MSelectionList list; list.add(shapeName); MObject shapeObj; - ASSERT_EQ(list.length(), 1); + ASSERT_EQ(list.length(), 1u); list.getDependNode(0, shapeObj); ASSERT_FALSE(shapeObj.isNull()); MFnDagNode fn(shapeObj); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ProxyShape.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ProxyShape.cpp index d1593c7b7c..045863248f 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ProxyShape.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_ProxyShape.cpp @@ -332,7 +332,7 @@ TEST(ProxyShape, basicTransformChainOperations) // construct a chain of transform nodes MObject leafNode = proxy->makeUsdTransformChain(prim, modifier1, AL::usdmaya::nodes::ProxyShape::kSelection, &modifier2, &createCount); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); // make sure we get some sane looking values. EXPECT_FALSE(leafNode == MObject::kNullObj); @@ -389,7 +389,7 @@ TEST(ProxyShape, basicTransformChainOperations) MDGModifier modifier2b; createCount = 0; MObject leafNode2 = proxy->makeUsdTransformChain(prim, modifier1b, AL::usdmaya::nodes::ProxyShape::kSelection, &modifier2b, &createCount); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); // hopefully not much will happen this time! EXPECT_FALSE(leafNode2 == MObject::kNullObj); @@ -424,7 +424,7 @@ TEST(ProxyShape, basicTransformChainOperations) // now lets' go and remove all of those transforms for fun! proxy->removeUsdTransformChain(prim, modifier1, AL::usdmaya::nodes::ProxyShape::kSelection); EXPECT_EQ(MStatus(MS::kSuccess), modifier1.doIt()); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); // having removed those chains, we shouldn't have any more transform nodes left { @@ -677,9 +677,9 @@ TEST(ProxyShape, basicTransformChainOperations) uint32_t createCount = 0; // construct a chain of transform nodes - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); MObject leafNode = proxy->makeUsdTransformChain(prim, modifier1, AL::usdmaya::nodes::ProxyShape::kSelection, &modifier2, &createCount); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); // make sure we get some sane looking values. EXPECT_FALSE(leafNode == MObject::kNullObj); @@ -691,7 +691,7 @@ TEST(ProxyShape, basicTransformChainOperations) UsdPrim kneeprim = stage->GetPrimAtPath(SdfPath("/root/hip1/knee1")); createCount = 0; MObject kneeNode = proxy->makeUsdTransformChain(kneeprim, modifier1, AL::usdmaya::nodes::ProxyShape::kRequired, &modifier2, &createCount); - EXPECT_EQ(1, proxy->selectedPaths().size()); + EXPECT_EQ(1u, proxy->selectedPaths().size()); // make sure we get some sane looking values. EXPECT_FALSE(kneeNode == MObject::kNullObj); @@ -709,7 +709,7 @@ TEST(ProxyShape, basicTransformChainOperations) MDagModifier modifier1b; proxy->removeUsdTransformChain(prim, modifier1b, AL::usdmaya::nodes::ProxyShape::kSelection); EXPECT_EQ(MStatus(MS::kSuccess), modifier1b.doIt()); - EXPECT_EQ(0, proxy->selectedPaths().size()); + EXPECT_EQ(0u, proxy->selectedPaths().size()); // We should now only have 3 TM's left { @@ -720,7 +720,7 @@ TEST(ProxyShape, basicTransformChainOperations) it.next(); count++; } - EXPECT_EQ(3, count); + EXPECT_EQ(3u, count); } { @@ -730,7 +730,7 @@ TEST(ProxyShape, basicTransformChainOperations) EXPECT_EQ(MStatus(MS::kSuccess), status); // and we *should* find it has zero children - EXPECT_EQ(0, fnx.childCount()); + EXPECT_EQ(0u, fnx.childCount()); } // now remove the last transforms @@ -852,7 +852,7 @@ TEST(ProxyShape, basicTransformChainOperations2) EXPECT_EQ(MStatus(MS::kSuccess), status); // we should have one child here (the ankle1) - EXPECT_EQ(0, fnx.childCount()); + EXPECT_EQ(0u, fnx.childCount()); } // construct a chain of transform nodes @@ -887,13 +887,13 @@ TEST(ProxyShape, basicTransformChainOperations2) EXPECT_EQ(MStatus(MS::kSuccess), status); // we should have one child here (the ankle1) - EXPECT_EQ(1, fnx.childCount()); + EXPECT_EQ(1u, fnx.childCount()); MFnTransform fnAnkle(fnx.child(0), &status); EXPECT_EQ(MStatus(MS::kSuccess), status); // we should have two children here (ltoe1, rtoe1) - EXPECT_EQ(2, fnAnkle.childCount()); + EXPECT_EQ(2u, fnAnkle.childCount()); MFnTransform fnLToe(fnAnkle.child(0), &status); EXPECT_EQ(MStatus(MS::kSuccess), status); @@ -936,7 +936,7 @@ TEST(ProxyShape, basicTransformChainOperations2) EXPECT_EQ(MStatus(MS::kSuccess), status); // we should have one child here (the ankle1) - EXPECT_EQ(0, fnx.childCount()); + EXPECT_EQ(0u, fnx.childCount()); } // construct a chain of transform nodes diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TransformMatrix.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TransformMatrix.cpp index 4dad16162f..9d59982561 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TransformMatrix.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TransformMatrix.cpp @@ -528,7 +528,7 @@ TEST(Transform, primValuesPushedToUsdMatchMaya) bool reset; std::vector ops = usd_xform.GetOrderedXformOps(&reset); - EXPECT_EQ(11, ops.size()); + EXPECT_EQ(11u, ops.size()); UsdGeomXformOp& translate = ops[0]; UsdGeomXformOp& rotatePivotTranslate = ops[1]; @@ -835,7 +835,7 @@ TEST(Transform, animationValuesFromUsdAreCorrectlyRead) bool reset; std::vector ops = usd_xform.GetOrderedXformOps(&reset); - EXPECT_EQ(3, ops.size()); + EXPECT_EQ(3u, ops.size()); MPlug wsmPlug = fnx.findPlug("m"); @@ -1380,7 +1380,7 @@ TEST(Transform, emptyOpsNotMade) bool resetsXform; auto xformOps = xformGeom.GetOrderedXformOps(&resetsXform); EXPECT_FALSE(resetsXform); - EXPECT_EQ(xformOps.size(), 0); + EXPECT_EQ(xformOps.size(), 0u); }; { @@ -1396,7 +1396,7 @@ TEST(Transform, emptyOpsNotMade) MSelectionList sel; EXPECT_TRUE(MGlobal::getActiveSelectionList(sel)); - EXPECT_EQ(1, sel.length()); + EXPECT_EQ(1u, sel.length()); MObject xformMobj; EXPECT_TRUE(sel.getDependNode(0, xformMobj)); MFnTransform xformMfn(xformMobj); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TranslatorContext.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TranslatorContext.cpp index d53b1e194f..207a0253a7 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TranslatorContext.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/nodes/test_TranslatorContext.cpp @@ -60,7 +60,7 @@ TEST(TranslatorContext, PrimLookup) EXPECT_TRUE(obj == cnref.object()); EXPECT_TRUE(path == cnref.path()); EXPECT_TRUE(TfToken("transform") == cnref.translatorId()); - EXPECT_EQ(1, cnref.createdNodes().size()); + EXPECT_EQ(1u, cnref.createdNodes().size()); EXPECT_TRUE(obj2 == cnref.createdNodes()[0].object()); } @@ -186,14 +186,14 @@ TEST(TranslatorContext, TranslatorContext) { AL::usdmaya::fileio::translators::MObjectHandleArray handles; context->getMObjects(SdfPath("/root/rig"), handles); - ASSERT_EQ(handles.size(), 1); + ASSERT_EQ(handles.size(), 1u); EXPECT_TRUE(handles[0].object() == obj); } { AL::usdmaya::fileio::translators::MObjectHandleArray handles; context->getMObjects(prim, handles); - ASSERT_EQ(handles.size(), 1); + ASSERT_EQ(handles.size(), 1u); EXPECT_TRUE(handles[0].object() == obj); } context->removeItems(prim); @@ -222,7 +222,7 @@ TEST(TranslatorContext, TranslatorContext) { AL::usdmaya::fileio::translators::MObjectHandleArray handles; context->getMObjects(SdfPath("/root/rig"), handles); - ASSERT_EQ(handles.size(), 1); + ASSERT_EQ(handles.size(), 1u); EXPECT_TRUE(handles[0].object() == obj); } translatorId = context->getTranslatorIdForPath(SdfPath("/root/rig")); @@ -245,11 +245,11 @@ TEST(TranslatorContext, TranslatorContext) SdfPathVector itemsToRemove; context->preRemoveEntry(SdfPath("/root/rig"), itemsToRemove); - ASSERT_EQ(itemsToRemove.size(), 1); + ASSERT_EQ(itemsToRemove.size(), 1u); // preRemoveEntry is often called multiple times before changes are handled. context->preRemoveEntry(SdfPath("/root"), itemsToRemove); // Make sure prims have not been added twice - ASSERT_EQ(itemsToRemove.size(), 1); + ASSERT_EQ(itemsToRemove.size(), 1u); context->removeEntries(itemsToRemove); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffGeom.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffGeom.cpp index 3c4ada5deb..aa4305219d 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffGeom.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffGeom.cpp @@ -65,7 +65,7 @@ TEST(DiffGeom, pointTests) geom.CreateFaceVertexCountsAttr(VtValue(vfc)); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -103,7 +103,7 @@ TEST(DiffGeom, pointTests) geom.CreateFaceVertexCountsAttr(VtValue(svfc)); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -161,7 +161,7 @@ TEST(DiffGeom, normalTests) geom.SetNormalsInterpolation(UsdGeomTokens->vertex); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -172,7 +172,7 @@ TEST(DiffGeom, normalTests) geom.CreatePointsAttr(VtValue(points)); VtArray normals(numN); - for(int i = 0 ; i < numN; ++i) + for(size_t i = 0 ; i < numN; ++i) { normals[i][0] = N[i][0]; normals[i][1] = N[i][1]; @@ -219,7 +219,7 @@ TEST(DiffGeom, normalTests) geom.SetNormalsInterpolation(UsdGeomTokens->vertex); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -228,7 +228,7 @@ TEST(DiffGeom, normalTests) geom.CreatePointsAttr(VtValue(points)); VtArray normals(numN); - for(int i = 0 ; i < numN; ++i) + for(size_t i = 0 ; i < numN; ++i) { normals[i][0] = N[i][0]; normals[i][1] = N[i][1]; @@ -267,7 +267,7 @@ TEST(DiffGeom, normalTests) geom.SetNormalsInterpolation(UsdGeomTokens->faceVarying); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -278,7 +278,7 @@ TEST(DiffGeom, normalTests) geom.CreatePointsAttr(VtValue(points)); VtArray normals(numN); - for(int i = 0 ; i < numN; ++i) + for(size_t i = 0 ; i < numN; ++i) { normals[i][0] = N[i][0]; normals[i][1] = N[i][1]; @@ -325,7 +325,7 @@ TEST(DiffGeom, normalTests) geom.SetNormalsInterpolation(UsdGeomTokens->faceVarying); VtArray points(numP); - for(int i = 0 ; i < numP; ++i) + for(size_t i = 0 ; i < numP; ++i) { points[i][0] = P[i][0]; points[i][1] = P[i][1]; @@ -334,7 +334,7 @@ TEST(DiffGeom, normalTests) geom.CreatePointsAttr(VtValue(points)); VtArray normals(numN); - for(int i = 0 ; i < numN; ++i) + for(size_t i = 0 ; i < numN; ++i) { normals[i][0] = N[i][0]; normals[i][1] = N[i][1]; diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffPrimVar.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffPrimVar.cpp index 6d0125e0b1..27aa98b454 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffPrimVar.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/test_DiffPrimVar.cpp @@ -80,7 +80,7 @@ TEST(DiffPrimVar, diffGeomVerts) // hopefully nothing will have changed here uint32_t result = AL::usdmaya::utils::diffGeom(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents); - EXPECT_EQ(0, result); + EXPECT_EQ(0u, result); MPoint p, pm; fn.getPoint(4, p); @@ -139,7 +139,7 @@ TEST(DiffPrimVar, diffGeomNormals) // hopefully nothing will have changed here uint32_t result = AL::usdmaya::utils::diffGeom(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents); - EXPECT_EQ(0, result); + EXPECT_EQ(0u, result); MIntArray vertexList; fn.getPolygonVertices(2, vertexList); @@ -202,7 +202,7 @@ TEST(DiffPrimVar, diffFaceVertices) // hopefully nothing will have changed here uint32_t result = AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents); - EXPECT_EQ(0, result); + EXPECT_EQ(0u, result); // a command that will extrude the final triangle, and delete the 4 new faces. // Result should be the same number of poly counts, but the face vertices will have changed @@ -293,7 +293,7 @@ TEST(DiffPrimVar, diffHoles1) UsdPrim geomPrim = stage->GetPrimAtPath(primPath); UsdGeomMesh geom(geomPrim); - EXPECT_EQ(0, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); + EXPECT_EQ(0u, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); { MUintArray invisbleFaces; @@ -354,7 +354,7 @@ TEST(DiffPrimVar, diffCreaseEdges) UsdPrim geomPrim = stage->GetPrimAtPath(primPath); UsdGeomMesh geom(geomPrim); - EXPECT_EQ(0, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); + EXPECT_EQ(0u, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); ASSERT_TRUE(MGlobal::executeCommand("delete pCube1")); @@ -439,7 +439,7 @@ TEST(DiffPrimVar, diffCreaseVertices) UsdPrim geomPrim = stage->GetPrimAtPath(primPath); UsdGeomMesh geom(geomPrim); - EXPECT_EQ(0, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); + EXPECT_EQ(0u, AL::usdmaya::utils::diffFaceVertices(geom, fn, UsdTimeCode::Default(), AL::usdmaya::utils::kAllComponents)); ASSERT_TRUE(MGlobal::executeCommand("delete pCubeShape1")); ASSERT_TRUE(MGlobal::executeCommand("delete pCube1")); @@ -523,15 +523,15 @@ TEST(DiffPrimVar, diffUvSetNames) AL::usdmaya::utils::PrimVarDiffReport r; MStringArray names = AL::usdmaya::utils::hasNewUvSet(geom, fn, r); - EXPECT_EQ(0, names.length()); - EXPECT_EQ(0, r.size()); + EXPECT_EQ(0u, names.length()); + EXPECT_EQ(0u, r.size()); fn.createUVSetWithName("newUvSet"); r.clear(); names = AL::usdmaya::utils::hasNewUvSet(geom, fn, r); - EXPECT_EQ(0, r.size()); - ASSERT_EQ(1, names.length()); + EXPECT_EQ(0u, r.size()); + ASSERT_EQ(1u, names.length()); EXPECT_EQ(MString("newUvSet"), names[0]); // extract the uv coords, modify them slightly, and pass back to maya @@ -543,7 +543,7 @@ TEST(DiffPrimVar, diffUvSetNames) r.clear(); names = AL::usdmaya::utils::hasNewUvSet(geom, fn, r); - ASSERT_EQ(1, r.size()); + ASSERT_EQ(1u, r.size()); { const AL::usdmaya::utils::PrimVarDiffEntry& pve = r[0]; @@ -558,7 +558,7 @@ TEST(DiffPrimVar, diffUvSetNames) EXPECT_TRUE(fn.setUVs(us, vs, &name) == MS::kSuccess); r.clear(); names = AL::usdmaya::utils::hasNewUvSet(geom, fn, r); - ASSERT_EQ(0, r.size()); + ASSERT_EQ(0u, r.size()); MIntArray uvCounts, mayaUvIndices; EXPECT_TRUE(fn.getAssignedUVs(uvCounts, mayaUvIndices, &name) == MS::kSuccess); @@ -568,7 +568,7 @@ TEST(DiffPrimVar, diffUvSetNames) r.clear(); names = AL::usdmaya::utils::hasNewUvSet(geom, fn, r); - ASSERT_EQ(1, r.size()); + ASSERT_EQ(1u, r.size()); { const AL::usdmaya::utils::PrimVarDiffEntry& pve = r[0]; @@ -588,7 +588,7 @@ TEST(DiffPrimVar, diffColourSetNames) MStringArray result; ASSERT_TRUE(MGlobal::executeCommand("polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 2 -ch 0", result) == MS::kSuccess); - ASSERT_EQ(1, result.length()); + ASSERT_EQ(1u, result.length()); { MSelectionList sl; @@ -641,15 +641,15 @@ TEST(DiffPrimVar, diffColourSetNames) AL::usdmaya::utils::PrimVarDiffReport r; MStringArray names = AL::usdmaya::utils::hasNewColourSet(geom, fn, r); - EXPECT_EQ(0, names.length()); - EXPECT_EQ(0, r.size()); + EXPECT_EQ(0u, names.length()); + EXPECT_EQ(0u, r.size()); colours[colours.length() - 1].r = 0.1f; fn.setColors(colours, &setName); names = AL::usdmaya::utils::hasNewColourSet(geom, fn, r); - EXPECT_EQ(0, names.length()); - ASSERT_EQ(1, r.size()); + EXPECT_EQ(0u, names.length()); + ASSERT_EQ(1u, r.size()); { const AL::usdmaya::utils::PrimVarDiffEntry& pve = r[0]; @@ -664,14 +664,14 @@ TEST(DiffPrimVar, diffColourSetNames) r.clear(); names = AL::usdmaya::utils::hasNewColourSet(geom, fn, r); - EXPECT_EQ(0, names.length()); - ASSERT_EQ(0, r.size()); + EXPECT_EQ(0u, names.length()); + ASSERT_EQ(0u, r.size()); fn.createColorSetWithName("newColorSet"); names = AL::usdmaya::utils::hasNewColourSet(geom, fn, r); - EXPECT_EQ(0, r.size()); - ASSERT_EQ(1, names.length()); + EXPECT_EQ(0u, r.size()); + ASSERT_EQ(1u, names.length()); EXPECT_EQ(MString("newColorSet"), names[0]); } } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_AnimationTranslator.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_AnimationTranslator.cpp index 0d6c70576b..ce1be1824b 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_AnimationTranslator.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_AnimationTranslator.cpp @@ -48,10 +48,6 @@ void setUp() m_outTime = time1Fn.findPlug("outTime"); } -void tearDown() -{ -} - } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_CameraTranslator.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_CameraTranslator.cpp index 1ad56ffbf5..1245cac317 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_CameraTranslator.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_CameraTranslator.cpp @@ -224,7 +224,7 @@ TEST(translators_CameraTranslator, cameraShapeName) MFnDagNode camDag(camObj); ASSERT_EQ(MString("AL_usdmaya_Transform"), camDag.typeName()); ASSERT_EQ(MString("cam"), camDag.name()); - ASSERT_EQ(1, camDag.childCount()); + ASSERT_EQ(1u, camDag.childCount()); MFnDagNode shapeDag(camDag.child(0)); ASSERT_EQ(MString("camera"), shapeDag.typeName()); ASSERT_EQ(MString("camShape"), shapeDag.name()); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_MeshTranslator.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_MeshTranslator.cpp index 733c3210cb..152f52f82c 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_MeshTranslator.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_MeshTranslator.cpp @@ -285,7 +285,7 @@ TEST(translators_MeshTranslator, constantUvExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(1, received.size()); + ASSERT_EQ(1u, received.size()); EXPECT_NEAR(0.5f, received[0][0], 1e-5f); EXPECT_NEAR(0.5f, received[0][1], 1e-5f); } @@ -316,7 +316,7 @@ TEST(translators_MeshTranslator, constantUvExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(1, received.size()); + ASSERT_EQ(1u, received.size()); EXPECT_NEAR(0.5f, received[0][0], 1e-5f); EXPECT_NEAR(0.5f, received[0][1], 1e-5f); } @@ -694,7 +694,7 @@ TEST(translators_MeshTranslator, constantColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(1, received.size()); + ASSERT_EQ(1u, received.size()); EXPECT_NEAR(0.3f, received[0][0], 1e-5f); EXPECT_NEAR(0.4f, received[0][1], 1e-5f); EXPECT_NEAR(0.5f, received[0][2], 1e-5f); @@ -729,7 +729,7 @@ TEST(translators_MeshTranslator, constantColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(1, received.size()); + ASSERT_EQ(1u, received.size()); EXPECT_NEAR(0.3f, received[0][0], 1e-5f); EXPECT_NEAR(0.4f, received[0][1], 1e-5f); EXPECT_NEAR(0.5f, received[0][2], 1e-5f); @@ -791,7 +791,7 @@ TEST(translators_MeshTranslator, vertexColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(8, received.size()); + ASSERT_EQ(8u, received.size()); for(int i = 0; i < 8; ++i) { @@ -830,7 +830,7 @@ TEST(translators_MeshTranslator, vertexColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(8, received.size()); + ASSERT_EQ(8u, received.size()); for(int i = 0; i < 8; ++i) { EXPECT_NEAR(0.3f * i, received[i][0], 1e-5f); @@ -901,7 +901,7 @@ TEST(translators_MeshTranslator, uniformColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(6, received.size()); + ASSERT_EQ(6u, received.size()); for(int i = 0; i < 6; ++i) { @@ -940,7 +940,7 @@ TEST(translators_MeshTranslator, uniformColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(6, received.size()); + ASSERT_EQ(6u, received.size()); for(int i = 0; i < 6; ++i) { EXPECT_NEAR(0.3f * float(i), received[i][0], 1e-5f); @@ -1008,7 +1008,7 @@ TEST(translators_MeshTranslator, faceVaryingColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(24, received.size()); + ASSERT_EQ(24u, received.size()); for(int i = 0; i < 24; ++i) { @@ -1047,7 +1047,7 @@ TEST(translators_MeshTranslator, faceVaryingColourExport) VtArray received; pvar.Get(&received); - ASSERT_EQ(24, received.size()); + ASSERT_EQ(24u, received.size()); for(int i = 0; i < 24; ++i) { EXPECT_NEAR(0.01f * i, received[i][0], 1e-5f); @@ -1115,7 +1115,7 @@ TEST(translators_MeshTranslator, reverseNormalsFlag) VtArray normals; mesh.GetNormalsAttr().Get(&normals); - ASSERT_EQ(24, normals.size()); + ASSERT_EQ(24u, normals.size()); for(size_t i = 0; i < 24; ++i) { EXPECT_EQ(expectedNormals[i], normals[i]); @@ -1181,7 +1181,7 @@ TEST(translators_MeshTranslator, reverseNormalsFlag) VtArray normals; mesh.GetNormalsAttr().Get(&normals); - ASSERT_EQ(24, normals.size()); + ASSERT_EQ(24u, normals.size()); for(size_t i = 0; i < 24; ++i) { EXPECT_EQ(expectedNormals[i], normals[i]); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_NurbsCurveTranslator.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_NurbsCurveTranslator.cpp index f0b1660f1c..405904fe7e 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_NurbsCurveTranslator.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_NurbsCurveTranslator.cpp @@ -165,7 +165,7 @@ TEST(translators_NurbsCurveTranslator, test_widths) floatData.setObject(value); // test the values came through! - ASSERT_EQ(floatData.length(), 5); + ASSERT_EQ(floatData.length(), 5u); EXPECT_FLOAT_EQ(floatData[0], 0.025f); EXPECT_FLOAT_EQ(floatData[1], 0.025f); EXPECT_FLOAT_EQ(floatData[2], 0.025f); diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_PythonBindings.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_PythonBindings.cpp index 940268f987..46cf556a25 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_PythonBindings.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_PythonBindings.cpp @@ -82,7 +82,7 @@ TEST(translators_PythonBindings, unknownType) auto pythonTranslators = TranslatorManufacture::getPythonTranslators(); - ASSERT_EQ(pythonTranslators.size(), 1); + ASSERT_EQ(pythonTranslators.size(), 1u); TranslatorManufacture::clearPythonTranslators(); } diff --git a/plugin/al/usdmayautils/AL/usdmaya/utils/DgNodeHelper.cpp b/plugin/al/usdmayautils/AL/usdmaya/utils/DgNodeHelper.cpp index 4eb6feefe2..c417de48bf 100644 --- a/plugin/al/usdmayautils/AL/usdmaya/utils/DgNodeHelper.cpp +++ b/plugin/al/usdmayautils/AL/usdmaya/utils/DgNodeHelper.cpp @@ -6065,6 +6065,10 @@ void DgNodeHelper::copyAttributeValue(const MPlug& plug, UsdAttribute& usdAttr, usdAttr.Set(m, timeCode); } } + break; + default: + {} + break; } } break; diff --git a/plugin/al/usdmayautils/AL/usdmaya/utils/DiffPrimVar.cpp b/plugin/al/usdmayautils/AL/usdmaya/utils/DiffPrimVar.cpp index 1fef9ebcf2..93704ec759 100644 --- a/plugin/al/usdmayautils/AL/usdmaya/utils/DiffPrimVar.cpp +++ b/plugin/al/usdmayautils/AL/usdmaya/utils/DiffPrimVar.cpp @@ -68,7 +68,7 @@ uint32_t diffGeom(UsdGeomPointBased& geom, MFnMesh& mesh, UsdTimeCode timeCode, const int32_t* const usdNormalIndices = (const int32_t*)indexData.cdata(); if(usdNormals && usdNormalIndices) { - if(mesh.numNormals() != normalData.size()) + if(size_t(mesh.numNormals()) != normalData.size()) { result |= kNormals; } @@ -399,7 +399,7 @@ class ColourSetBuilder //---------------------------------------------------------------------------------------------------------------------- void ColourSetBuilder::constructNewlyAddedSets(MStringArray& setNames, const std::vector& primvars) { - for(int i = 0; i < setNames.length(); ++i) + for(int i = 0; unsigned(i) < setNames.length(); ++i) { for(auto it = primvars.begin(), end = primvars.end(); it != end; ++it) { diff --git a/plugin/al/usdmayautils/AL/usdmaya/utils/MeshUtils.cpp b/plugin/al/usdmayautils/AL/usdmaya/utils/MeshUtils.cpp index 5d889238ff..c6e479aed4 100644 --- a/plugin/al/usdmayautils/AL/usdmaya/utils/MeshUtils.cpp +++ b/plugin/al/usdmayautils/AL/usdmaya/utils/MeshUtils.cpp @@ -202,13 +202,11 @@ void MeshImportContext::gatherFaceConnectsAndVertices() // According to the docs for UsdGeomMesh: If 'normals' and 'primvars:normals' are both specified, the latter has precedence. const TfToken primvarNormalsToken("primvars:normals"); TfToken interpolation = mesh.GetNormalsInterpolation(); - bool isIndexed = false; bool hasNormalsOpinion = false; if(mesh.HasPrimvar(primvarNormalsToken)) { UsdGeomPrimvar primvar = mesh.GetPrimvar(primvarNormalsToken); interpolation = primvar.GetInterpolation(); - isIndexed = primvar.IsIndexed(); hasNormalsOpinion = true; primvar.Get(&normalsData, m_timeCode); } @@ -955,7 +953,7 @@ void MeshImportContext::applyPrimVars(bool createUvs, bool createColours) mayaIndices.setLength(connects.length()); for (uint32_t i = 0, idx = 0, n = counts.length(); i < n; ++i) { - for (uint32_t j = 0; j < counts[i]; ++j) + for (uint32_t j = 0; j < uint32_t(counts[i]); ++j) { mayaIndices[idx++] = i; } @@ -974,7 +972,7 @@ void MeshImportContext::applyPrimVars(bool createUvs, bool createColours) } } - if (mayaIndices.length() != fnMesh.numFaceVertices()) + if (mayaIndices.length() != unsigned(fnMesh.numFaceVertices())) { TF_DEBUG(ALUTILS_INFO).Msg("Incompatible colour indices for colour set \"%s\" on mesh \"%s\"\n", colourSetName.asChar(), fnMesh.name().asChar()); @@ -2009,7 +2007,7 @@ void MeshExportContext::copyNormalData(UsdTimeCode time, bool copyAsPrimvar) missing[normalIndices[i]] = faceConnects[i]; } else - if(it->second != faceConnects[i]) + if(it->second != uint32_t(faceConnects[i])) { isPerVertex = false; } @@ -2074,7 +2072,7 @@ void MeshExportContext::copyNormalData(UsdTimeCode time, bool copyAsPrimvar) bool isOrdered = true; for(uint32_t i = 0, n = normalIndices.length(); i < n; ++i) { - if(normalIndices[i] != i) + if(uint32_t(normalIndices[i]) != i) { isOrdered = false; break; diff --git a/plugin/al/usdtransaction/AL/usd/transaction/tests/testTransaction.cpp b/plugin/al/usdtransaction/AL/usd/transaction/tests/testTransaction.cpp index 0c4600c44e..2b2ea6aeb8 100644 --- a/plugin/al/usdtransaction/AL/usd/transaction/tests/testTransaction.cpp +++ b/plugin/al/usdtransaction/AL/usd/transaction/tests/testTransaction.cpp @@ -116,56 +116,56 @@ class TransactionTest : public TfWeakBase, public ::testing::Test { TEST_F(TransactionTest, Transaction) { Transaction transaction(m_stage, m_stage->GetSessionLayer()); - EXPECT_EQ(opened(), 0); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 0u); + EXPECT_EQ(closed(), 0u); // Open notice should be triggered EXPECT_TRUE(transaction.Open()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); // Opening same transaction is allowed, but should not trigger notices EXPECT_TRUE(transaction.Open()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); // Close notices should not be emitted until last close EXPECT_TRUE(transaction.Close()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); // Close notice should be triggered EXPECT_TRUE(transaction.Close()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 1); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 1u); // This should fail and no notices should be sent EXPECT_FALSE(transaction.Close()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 1); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 1u); } /// Test that ScopedTransaction works as expected TEST_F(TransactionTest, ScopedTransaction) { - EXPECT_EQ(opened(), 0); + EXPECT_EQ(opened(), 0u); { ScopedTransaction outer(m_stage, m_stage->GetSessionLayer()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); { /// Opening a transaction for same layer should not trigger notices ScopedTransaction inner(m_stage, m_stage->GetSessionLayer()); - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); } - EXPECT_EQ(opened(), 1); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 1u); + EXPECT_EQ(closed(), 0u); { /// Opening a transaction for different layer should trigger notices ScopedTransaction inner(m_stage, m_stage->GetRootLayer()); - EXPECT_EQ(opened(), 2); - EXPECT_EQ(closed(), 0); + EXPECT_EQ(opened(), 2u); + EXPECT_EQ(closed(), 0u); } - EXPECT_EQ(opened(), 2); - EXPECT_EQ(closed(), 1); + EXPECT_EQ(opened(), 2u); + EXPECT_EQ(closed(), 1u); } - EXPECT_EQ(closed(), 2); + EXPECT_EQ(closed(), 2u); } /// Test that CloseNotice reports changes as expected From 1940ac12477a968a10c59d7db6fc57d8f71e2013 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Thu, 9 Jan 2020 13:10:20 -0800 Subject: [PATCH 5/8] Addressed code review comments. --- lib/CMakeLists.txt | 219 +++++++++--------- lib/fileio/primUpdater.cpp | 1 + lib/fileio/primUpdater.h | 27 ++- lib/fileio/primUpdaterContext.cpp | 13 +- lib/fileio/primUpdaterContext.h | 9 +- lib/fileio/primUpdaterRegistry.cpp | 1 + lib/fileio/primUpdaterRegistry.h | 27 ++- lib/fileio/shading/shadingModeRegistry.h | 4 - lib/python/__init__.py | 4 + lib/usd/translators/CMakeLists.txt | 1 - .../AL/usdmaya/nodes/ProxyDrawOverride.cpp | 5 + .../AL/usdmaya/nodes/ProxyShapeUI.cpp | 7 + plugin/pxr/maya/lib/usdMaya/chaser.cpp | 42 ---- 13 files changed, 160 insertions(+), 200 deletions(-) create mode 100644 lib/python/__init__.py delete mode 100644 plugin/pxr/maya/lib/usdMaya/chaser.cpp diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index eab78a2fde..0e54add297 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -44,137 +44,136 @@ list(APPEND mayaUsd_src # base/debugCodes.cpp # - fileio/registryHelper.cpp - fileio/primReaderContext.cpp - fileio/primReaderArgs.cpp - fileio/primReader.cpp - fileio/primReaderRegistry.cpp - fileio/functorPrimReader.cpp fileio/fallbackPrimReader.cpp - fileio/primWriterContext.cpp - fileio/primWriterArgs.cpp - fileio/primWriter.cpp - fileio/primWriterRegistry.cpp + fileio/functorPrimReader.cpp fileio/functorPrimWriter.cpp - fileio/writeJobContext.cpp fileio/instancedNodeWriter.cpp - fileio/transformWriter.cpp - fileio/shaderWriter.cpp + fileio/primReader.cpp + fileio/primReaderArgs.cpp + fileio/primReaderContext.cpp + fileio/primReaderRegistry.cpp fileio/primUpdater.cpp fileio/primUpdaterContext.cpp fileio/primUpdaterRegistry.cpp + fileio/primWriter.cpp + fileio/primWriterArgs.cpp + fileio/primWriterContext.cpp + fileio/primWriterRegistry.cpp + fileio/registryHelper.cpp + fileio/shaderWriter.cpp + fileio/transformWriter.cpp + fileio/writeJobContext.cpp # fileio/chaser/chaser.cpp fileio/chaser/chaserRegistry.cpp # fileio/jobs/jobArgs.cpp + fileio/jobs/modelKindProcessor.cpp fileio/jobs/readJob.cpp fileio/jobs/writeJob.cpp - fileio/jobs/modelKindProcessor.cpp # - fileio/translators/translatorUtil.cpp - fileio/translators/translatorXformable.cpp - fileio/translators/translatorXformable_decompose.cpp - fileio/translators/translatorPrim.cpp - fileio/translators/translatorGprim.cpp + fileio/shading/shadingModeDisplayColor.cpp + fileio/shading/shadingModeExporter.cpp + fileio/shading/shadingModeExporterContext.cpp + fileio/shading/shadingModeImporter.cpp + fileio/shading/shadingModePxrRis.cpp + fileio/shading/shadingModeRegistry.cpp + fileio/shading/shadingModeUseRegistry.cpp + # fileio/translators/skelBindingsProcessor.cpp - fileio/translators/translatorMaterial.cpp fileio/translators/translatorCamera.cpp fileio/translators/translatorCurves.cpp + fileio/translators/translatorGprim.cpp + fileio/translators/translatorMaterial.cpp fileio/translators/translatorMesh.cpp - fileio/translators/translatorMesh_SubDiv.cpp fileio/translators/translatorMesh_PrimVars.cpp + fileio/translators/translatorMesh_SubDiv.cpp fileio/translators/translatorNurbsPatch.cpp + fileio/translators/translatorPrim.cpp fileio/translators/translatorRfMLight.cpp fileio/translators/translatorSkel.cpp - # - fileio/shading/shadingModeDisplayColor.cpp - fileio/shading/shadingModeExporterContext.cpp - fileio/shading/shadingModeExporter.cpp - fileio/shading/shadingModeImporter.cpp - fileio/shading/shadingModePxrRis.cpp - fileio/shading/shadingModeRegistry.cpp - fileio/shading/shadingModeUseRegistry.cpp + fileio/translators/translatorUtil.cpp + fileio/translators/translatorXformable.cpp + fileio/translators/translatorXformable_decompose.cpp # fileio/utils/adaptor.cpp + fileio/utils/meshUtil.cpp fileio/utils/readUtil.cpp + fileio/utils/roundTripUtil.cpp + fileio/utils/shadingUtil.cpp fileio/utils/userTaggedAttribute.cpp fileio/utils/writeUtil.cpp - fileio/utils/shadingUtil.cpp - fileio/utils/meshUtil.cpp - fileio/utils/roundTripUtil.cpp fileio/utils/xformStack.cpp # - utils/colorSpace.cpp - utils/diagnosticDelegate.cpp - utils/query.cpp - utils/util.cpp - utils/utilFileSystem.cpp - utils/blockSceneModificationContext.cpp - utils/stageCache.cpp - utils/query.cpp - utils/undoHelperCommand + listeners/notice.cpp + listeners/proxyShapeNotice.cpp + listeners/stageNoticeListener.cpp # - nodes/pointBasedDeformerNode.cpp nodes/hdImagingShape.cpp - nodes/usdPrimProvider.cpp + nodes/pointBasedDeformerNode.cpp nodes/proxyShapeBase.cpp nodes/proxyShapePlugin.cpp nodes/stageData.cpp nodes/stageNode.cpp + nodes/usdPrimProvider.cpp # - listeners/stageNoticeListener.cpp - listeners/notice.cpp - listeners/proxyShapeNotice.cpp - # - render/vp2RenderDelegate/bboxGeom.cpp - render/vp2RenderDelegate/debugCodes.cpp - render/vp2RenderDelegate/render_param.cpp - render/vp2RenderDelegate/instancer.cpp - render/vp2RenderDelegate/draw_item.cpp - render/vp2RenderDelegate/material.cpp - render/vp2RenderDelegate/mesh.cpp - render/vp2RenderDelegate/proxyRenderDelegate.cpp - render/vp2RenderDelegate/render_delegate.cpp - render/vp2RenderDelegate/sampler.cpp - render/vp2RenderDelegate/tokens.cpp - # - render/vp2ShaderFragments/shaderFragments.cpp + render/px_vp20/glslProgram.cpp + render/px_vp20/utils.cpp + render/px_vp20/utils_legacy.cpp # render/pxrUsdMayaGL/batchRenderer.cpp render/pxrUsdMayaGL/debugCodes.cpp render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp render/pxrUsdMayaGL/hdImagingShapeUI.cpp render/pxrUsdMayaGL/hdRenderer.cpp + render/pxrUsdMayaGL/instancerImager.cpp + render/pxrUsdMayaGL/instancerShapeAdapter.cpp render/pxrUsdMayaGL/proxyDrawOverride.cpp + render/pxrUsdMayaGL/proxyShapeDelegate.cpp render/pxrUsdMayaGL/proxyShapeUI.cpp render/pxrUsdMayaGL/sceneDelegate.cpp render/pxrUsdMayaGL/shapeAdapter.cpp render/pxrUsdMayaGL/softSelectHelper.cpp render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp render/pxrUsdMayaGL/userData.cpp - render/pxrUsdMayaGL/instancerImager.cpp - render/pxrUsdMayaGL/instancerShapeAdapter.cpp - render/pxrUsdMayaGL/proxyShapeDelegate.cpp # - render/px_vp20/glslProgram.cpp - render/px_vp20/utils.cpp - render/px_vp20/utils_legacy.cpp + render/vp2RenderDelegate/bboxGeom.cpp + render/vp2RenderDelegate/debugCodes.cpp + render/vp2RenderDelegate/draw_item.cpp + render/vp2RenderDelegate/instancer.cpp + render/vp2RenderDelegate/material.cpp + render/vp2RenderDelegate/mesh.cpp + render/vp2RenderDelegate/proxyRenderDelegate.cpp + render/vp2RenderDelegate/render_delegate.cpp + render/vp2RenderDelegate/render_param.cpp + render/vp2RenderDelegate/sampler.cpp + render/vp2RenderDelegate/tokens.cpp + # + render/vp2ShaderFragments/shaderFragments.cpp + # + utils/blockSceneModificationContext.cpp + utils/colorSpace.cpp + utils/diagnosticDelegate.cpp + utils/query.cpp + utils/stageCache.cpp + utils/undoHelperCommand + utils/util.cpp + utils/utilFileSystem.cpp ) list(APPEND mayaUsdShaderFragments_xmls # Copied from pxrUsdPreviewSurface with change to support multiple lights + render/vp2ShaderFragments/Float4ToFloatW.xml render/vp2ShaderFragments/Float4ToFloatX.xml render/vp2ShaderFragments/Float4ToFloatY.xml render/vp2ShaderFragments/Float4ToFloatZ.xml - render/vp2ShaderFragments/Float4ToFloatW.xml + render/vp2ShaderFragments/UsdPreviewSurface.xml render/vp2ShaderFragments/lightingContributions.xml render/vp2ShaderFragments/opacityToTransparency.xml render/vp2ShaderFragments/scaledDiffusePassThrough.xml render/vp2ShaderFragments/scaledSpecularPassThrough.xml render/vp2ShaderFragments/usdPreviewSurfaceCombiner.xml render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml - render/vp2ShaderFragments/UsdPreviewSurface.xml # New fragments render/vp2ShaderFragments/FallbackCPVShader.xml render/vp2ShaderFragments/FallbackShader.xml @@ -192,7 +191,6 @@ list(APPEND mayaUsdShaderFragments_xmls if(UFE_FOUND) list(APPEND mayaUsd_src ufe/Global.cpp - ufe/Utils.cpp ufe/ProxyShapeHandler.cpp ufe/ProxyShapeHierarchy.cpp ufe/ProxyShapeHierarchyHandler.cpp @@ -213,16 +211,17 @@ if(UFE_FOUND) ufe/UsdUndoDeleteCommand.cpp ufe/UsdUndoDuplicateCommand.cpp ufe/UsdUndoRenameCommand.cpp + ufe/Utils.cpp # ufe/private/Utils.cpp ) if(CMAKE_UFE_V2_FEATURES_AVAILABLE) list(APPEND mayaUsd_src - ufe/UsdUndoCreateGroupCommand.cpp ufe/UsdAttribute.cpp ufe/UsdAttributes.cpp ufe/UsdAttributesHandler.cpp + ufe/UsdUndoCreateGroupCommand.cpp ) endif() endif() @@ -233,25 +232,25 @@ list(APPEND mayaUsdBase_headers ) list(APPEND mayaUsdFileio_headers - fileio/registryHelper.h - fileio/primReaderContext.h - fileio/primReaderArgs.h - fileio/primReader.h - fileio/primReaderRegistry.h - fileio/functorPrimReader.h fileio/fallbackPrimReader.h - fileio/primWriterContext.h - fileio/primWriterArgs.h - fileio/primWriter.h - fileio/primWriterRegistry.h + fileio/functorPrimReader.h fileio/functorPrimWriter.h - fileio/writeJobContext.h fileio/instancedNodeWriter.h - fileio/transformWriter.h - fileio/shaderWriter.h + fileio/primReader.h + fileio/primReaderArgs.h + fileio/primReaderContext.h + fileio/primReaderRegistry.h fileio/primUpdater.h fileio/primUpdaterContext.h fileio/primUpdaterRegistry.h + fileio/primWriter.h + fileio/primWriterArgs.h + fileio/primWriterContext.h + fileio/primWriterRegistry.h + fileio/registryHelper.h + fileio/shaderWriter.h + fileio/transformWriter.h + fileio/writeJobContext.h ) list(APPEND mayaUsdChaser_headers @@ -261,9 +260,9 @@ list(APPEND mayaUsdChaser_headers list(APPEND mayaUsdJobs_headers fileio/jobs/jobArgs.h + fileio/jobs/modelKindProcessor.h fileio/jobs/readJob.h fileio/jobs/writeJob.h - fileio/jobs/modelKindProcessor.h ) list(APPEND mayaUsdShading_headers @@ -275,56 +274,55 @@ list(APPEND mayaUsdShading_headers list(APPEND mayaUsdUtilsIO_headers fileio/utils/adaptor.h + fileio/utils/meshUtil.h fileio/utils/readUtil.h + fileio/utils/roundTripUtil.h + fileio/utils/shadingUtil.h fileio/utils/userTaggedAttribute.h fileio/utils/writeUtil.h - fileio/utils/shadingUtil.h - fileio/utils/meshUtil.h - fileio/utils/roundTripUtil.h fileio/utils/xformStack.h ) list(APPEND mayaUsdTranslators_headers - fileio/translators/translatorUtil.h - fileio/translators/translatorXformable.h - fileio/translators/translatorPrim.h - fileio/translators/translatorGprim.h fileio/translators/skelBindingsProcessor.h - fileio/translators/translatorMaterial.h fileio/translators/translatorCamera.h fileio/translators/translatorCurves.h + fileio/translators/translatorGprim.h + fileio/translators/translatorMaterial.h fileio/translators/translatorMesh.h fileio/translators/translatorNurbsPatch.h + fileio/translators/translatorPrim.h fileio/translators/translatorRfMLight.h fileio/translators/translatorSkel.h + fileio/translators/translatorUtil.h + fileio/translators/translatorXformable.h ) list(APPEND mayaUsdUtils_headers + utils/blockSceneModificationContext.h utils/colorSpace.h utils/diagnosticDelegate.h utils/query.h - utils/util.h - utils/utilFileSystem.h - utils/blockSceneModificationContext.h utils/stageCache.h - utils/query.h utils/undoHelperCommand.h + utils/util.h + utils/utilFileSystem.h ) list(APPEND mayaUsdNodes_headers - nodes/pointBasedDeformerNode.h nodes/hdImagingShape.h - nodes/usdPrimProvider.h + nodes/pointBasedDeformerNode.h nodes/proxyShapeBase.h nodes/proxyShapePlugin.h nodes/stageData.h nodes/stageNode.h + nodes/usdPrimProvider.h ) list(APPEND mayaUsdListeners_headers - listeners/stageNoticeListener.h listeners/notice.h listeners/proxyShapeNotice.h + listeners/stageNoticeListener.h ) list(APPEND mayaUsdVP2RenderDelegate_headers @@ -334,7 +332,6 @@ list(APPEND mayaUsdVP2RenderDelegate_headers if(UFE_FOUND) list(APPEND mayaUsdUfe_headers ufe/Global.h - ufe/Utils.h ufe/ProxyShapeHandler.h ufe/ProxyShapeHierarchy.h ufe/ProxyShapeHierarchyHandler.h @@ -355,14 +352,15 @@ if(UFE_FOUND) ufe/UsdUndoDeleteCommand.h ufe/UsdUndoDuplicateCommand.h ufe/UsdUndoRenameCommand.h + ufe/Utils.h ) if(CMAKE_UFE_V2_FEATURES_AVAILABLE) list(APPEND mayaUsdUfe_headers - ufe/UsdUndoCreateGroupCommand.h ufe/UsdAttribute.h ufe/UsdAttributes.h ufe/UsdAttributesHandler.h + ufe/UsdUndoCreateGroupCommand.h ) endif() endif() @@ -370,12 +368,13 @@ endif() list(APPEND mayaUsdPxrUsdMayaGL_headers render/pxrUsdMayaGL/batchRenderer.h render/pxrUsdMayaGL/debugCodes.h - render/pxrUsdMayaGL/hdImagingShapeUI.h render/pxrUsdMayaGL/hdImagingShapeDrawOverride.h + render/pxrUsdMayaGL/hdImagingShapeUI.h + render/pxrUsdMayaGL/hdRenderer.h render/pxrUsdMayaGL/instancerImager.h render/pxrUsdMayaGL/instancerShapeAdapter.h - render/pxrUsdMayaGL/proxyShapeUI.h render/pxrUsdMayaGL/proxyDrawOverride.h + render/pxrUsdMayaGL/proxyShapeUI.h render/pxrUsdMayaGL/renderParams.h render/pxrUsdMayaGL/sceneDelegate.h render/pxrUsdMayaGL/shapeAdapter.h @@ -385,6 +384,7 @@ list(APPEND mayaUsdPxrUsdMayaGL_headers ) list(APPEND mayaUsdPxVP20_headers + render/px_vp20/glslProgram.h render/px_vp20/utils.h render/px_vp20/utils_legacy.h ) @@ -513,6 +513,7 @@ if(UFE_FOUND) mayaUsd_promoteHeaderList(${mayaUsdUfe_headers}) endif() mayaUsd_promoteHeaderList(${mayaUsdPxrUsdMayaGL_headers}) +mayaUsd_promoteHeaderList(${mayaUsdPxVP20_headers}) # install public headers install(FILES ${CMAKE_BINARY_DIR}/include/mayaUsd/mayaUsd.h @@ -573,6 +574,10 @@ install(FILES ${mayaUsdPxrUsdMayaGL_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/render/pxrUsdMayaGL ) +install(FILES ${mayaUsdPxVP20_headers} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mayaUsd/render/px_vp20 +) + install(FILES ${mayaUsdShaderFragments_xmls} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/usd/mayaUsd_ShaderFragments/resources ) @@ -634,10 +639,6 @@ if(UFE_FOUND) install(FILES $ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/${PROJECT_NAME} OPTIONAL) endif() - install(FILES ufe/__init__.py - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/${PROJECT_NAME} - ) - if (CMAKE_UFE_V2_FEATURES_AVAILABLE) # We need an empty __init__.py file in each subfolder so it is considered a python module. install(FILES ae/__init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae) @@ -745,8 +746,6 @@ endif() install(CODE "file(TOUCH \"${PYLIB_INSTALL_PREFIX}/../__init__.py\")") -install(CODE - "file(WRITE \"${PYLIB_INSTALL_PREFIX}/__init__.py\" - \"from ${PYTHON_LIBRARY_NAME} import *\")") +install(FILES python/__init__.py DESTINATION ${PYLIB_INSTALL_PREFIX}) add_subdirectory(usd) diff --git a/lib/fileio/primUpdater.cpp b/lib/fileio/primUpdater.cpp index 4208bfcce5..6b6a785e7b 100644 --- a/lib/fileio/primUpdater.cpp +++ b/lib/fileio/primUpdater.cpp @@ -1,5 +1,6 @@ // // Copyright 2018 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/lib/fileio/primUpdater.h b/lib/fileio/primUpdater.h index bf1bbd603d..928d2f27d3 100644 --- a/lib/fileio/primUpdater.h +++ b/lib/fileio/primUpdater.h @@ -1,5 +1,6 @@ // // Copyright 2018 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,8 +17,6 @@ #ifndef PXRUSDMAYA_MAYAPRIMUPDATER_H #define PXRUSDMAYA_MAYAPRIMUPDATER_H -/// \file usdMaya/primUpdater.h - #include "../base/api.h" #include "primUpdaterContext.h" #include "../utils/util.h" @@ -41,7 +40,13 @@ class UsdMayaPrimUpdater UsdMayaPrimUpdater() = default; virtual ~UsdMayaPrimUpdater() = default; - enum class Supports { Invalid = 0, Push = 1 << 0, Pull = 1 << 1, Clear = 1 << 2, All = Push | Pull | Clear}; + enum class Supports { + Invalid = 0, + Push = 1 << 0, + Pull = 1 << 1, + Clear = 1 << 2, + All = Push | Pull | Clear + }; MAYAUSD_CORE_PUBLIC virtual bool Push(UsdMayaPrimUpdaterContext* context); @@ -54,20 +59,20 @@ class UsdMayaPrimUpdater /// The source Maya DAG path that we are consuming. /// - /// If this prim writer is for a Maya DG node and not a DAG node, this will + /// If this prim updater is for a Maya DG node and not a DAG node, this will /// return an invalid MDagPath. MAYAUSD_CORE_PUBLIC const MDagPath& GetDagPath() const; - /// The MObject for the Maya node being written by this writer. + /// The MObject for the Maya node being updated by this updater. MAYAUSD_CORE_PUBLIC const MObject& GetMayaObject() const; - /// The path of the destination USD prim to which we are writing. + /// The path of the destination USD prim which we are updating. MAYAUSD_CORE_PUBLIC const SdfPath& GetUsdPath() const; - /// The destination USD prim to which we are writing. + /// The destination USD prim which we are updating. template UsdPrim GetUsdPrim(UsdMayaPrimUpdaterContext& context) const { @@ -97,12 +102,12 @@ class UsdMayaPrimUpdater } private: - /// The MDagPath for the Maya node being written, valid only for DAG node - /// prim writers. + /// The MDagPath for the Maya node being updated, valid only for DAG node + /// prim updaters. const MDagPath _dagPath; - /// The MObject for the Maya node being written, valid for both DAG and DG - /// node prim writers. + /// The MObject for the Maya node being updated, valid for both DAG and DG + /// node prim updaters. const MObject _mayaObject; const SdfPath _usdPath; diff --git a/lib/fileio/primUpdaterContext.cpp b/lib/fileio/primUpdaterContext.cpp index 682f77c574..1e21210f33 100644 --- a/lib/fileio/primUpdaterContext.cpp +++ b/lib/fileio/primUpdaterContext.cpp @@ -1,5 +1,6 @@ // // Copyright 2016 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,18 +26,6 @@ UsdMayaPrimUpdaterContext::UsdMayaPrimUpdaterContext( { } -const UsdTimeCode& -UsdMayaPrimUpdaterContext::GetTimeCode() const -{ - return _timeCode; -} - -UsdStageRefPtr -UsdMayaPrimUpdaterContext::GetUsdStage() const -{ - return _stage; -} - void UsdMayaPrimUpdaterContext::Clear(const SdfPath&) { diff --git a/lib/fileio/primUpdaterContext.h b/lib/fileio/primUpdaterContext.h index 804076f9a5..c01f0cad7f 100644 --- a/lib/fileio/primUpdaterContext.h +++ b/lib/fileio/primUpdaterContext.h @@ -1,5 +1,6 @@ // // Copyright 2016 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,8 +17,6 @@ #ifndef PXRUSDMAYA_PRIMUPDATERCONTEXT_H #define PXRUSDMAYA_PRIMUPDATERCONTEXT_H -/// \file usdMaya/primUpdaterContext.h - #include "../base/api.h" #include "pxr/pxr.h" @@ -40,12 +39,10 @@ class UsdMayaPrimUpdaterContext const UsdStageRefPtr& stage); /// \brief returns the time frame where data should be edited. - MAYAUSD_CORE_PUBLIC - const UsdTimeCode& GetTimeCode() const; + const UsdTimeCode& GetTimeCode() const { return _timeCode; } /// \brief returns the usd stage that is being written to. - MAYAUSD_CORE_PUBLIC - UsdStageRefPtr GetUsdStage() const; + UsdStageRefPtr GetUsdStage() const { return _stage; } MAYAUSD_CORE_PUBLIC virtual void Clear(const SdfPath&); diff --git a/lib/fileio/primUpdaterRegistry.cpp b/lib/fileio/primUpdaterRegistry.cpp index 866bc59df2..a2bb16d683 100644 --- a/lib/fileio/primUpdaterRegistry.cpp +++ b/lib/fileio/primUpdaterRegistry.cpp @@ -1,5 +1,6 @@ // // Copyright 2016 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/lib/fileio/primUpdaterRegistry.h b/lib/fileio/primUpdaterRegistry.h index 8b9074f0fa..37ae0be759 100644 --- a/lib/fileio/primUpdaterRegistry.h +++ b/lib/fileio/primUpdaterRegistry.h @@ -1,5 +1,6 @@ // // Copyright 2016 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,8 +17,6 @@ #ifndef PXRUSDMAYA_PRIM_UPDATER_REGISTRY_H #define PXRUSDMAYA_PRIM_UPDATER_REGISTRY_H -/// \file usdMaya/primUpdaterRegistry.h - #include "pxr/pxr.h" #include "../base/api.h" @@ -95,18 +94,18 @@ struct UsdMayaPrimUpdaterRegistry static void Register(const TfType& type, UsdMayaPrimUpdater::Supports sup, UpdaterFactoryFn fn); /// \brief Register \p fn as a reader provider for \p T. -/// -/// Example for registering a reader factory in your custom plugin, assuming -/// that MyType is registered with the TfType system: -/// \code{.cpp} -/// class MyReader : public UsdMayaPrimUpdater { -/// static UsdMayaPrimReaderSharedPtr Create( -/// const UsdMayaPrimReaderArgs&); -/// }; -/// TF_REGISTRY_FUNCTION_WITH_TAG(UsdMayaPrimUpdaterRegistry, MyType) { -/// UsdMayaPrimUpdaterRegistry::Register(MyReader::Create); -/// } -/// \endcode + /// + /// Example for registering a reader factory in your custom plugin, assuming + /// that MyType is registered with the TfType system: + /// \code{.cpp} + /// class MyReader : public UsdMayaPrimUpdater { + /// static UsdMayaPrimReaderSharedPtr Create( + /// const UsdMayaPrimReaderArgs&); + /// }; + /// TF_REGISTRY_FUNCTION_WITH_TAG(UsdMayaPrimUpdaterRegistry, MyType) { + /// UsdMayaPrimUpdaterRegistry::Register(MyReader::Create); + /// } + /// \endcode template static void Register(UsdMayaPrimUpdater::Supports sup, UpdaterFactoryFn fn) { diff --git a/lib/fileio/shading/shadingModeRegistry.h b/lib/fileio/shading/shadingModeRegistry.h index 96e84a95a6..08ee309a2c 100644 --- a/lib/fileio/shading/shadingModeRegistry.h +++ b/lib/fileio/shading/shadingModeRegistry.h @@ -60,19 +60,15 @@ class UsdMayaShadingModeRegistry : public TfWeakBase { public: - MAYAUSD_CORE_PUBLIC static UsdMayaShadingModeExporterCreator GetExporter(const TfToken& name) { return GetInstance()._GetExporter(name); } - MAYAUSD_CORE_PUBLIC static UsdMayaShadingModeImporter GetImporter(const TfToken& name) { return GetInstance()._GetImporter(name); } - MAYAUSD_CORE_PUBLIC static TfTokenVector ListExporters() { return GetInstance()._ListExporters(); } - MAYAUSD_CORE_PUBLIC static TfTokenVector ListImporters() { return GetInstance()._ListImporters(); } diff --git a/lib/python/__init__.py b/lib/python/__init__.py new file mode 100644 index 0000000000..5b7257d96c --- /dev/null +++ b/lib/python/__init__.py @@ -0,0 +1,4 @@ +from . import _PyMayaUsd +from pxr import Tf +Tf.PrepareModule(_PyMayaUsd, locals()) +del _PyMayaUsd, Tf diff --git a/lib/usd/translators/CMakeLists.txt b/lib/usd/translators/CMakeLists.txt index 17d6b61816..46a0b6228b 100644 --- a/lib/usd/translators/CMakeLists.txt +++ b/lib/usd/translators/CMakeLists.txt @@ -26,7 +26,6 @@ list(APPEND DEPENDANT_LIBRARIES usdSkel usdUtils vt - ${Boost_PYTHON_LIBRARY} ${MAYA_LIBRARIES} ${LIBRARY_NAME} ) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyDrawOverride.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyDrawOverride.cpp index 8c9cc657c8..865238f0cd 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyDrawOverride.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyDrawOverride.cpp @@ -37,6 +37,7 @@ #include "ufe/runTimeMgr.h" #include "ufe/globalSelection.h" #include "ufe/observableSelection.h" +#include "ufe/log.h" #endif namespace AL { @@ -810,6 +811,10 @@ bool ProxyDrawOverride::userSelect( globalSelection->append(si); } break; + case MGlobal::kAddToHeadOfList: + // No such operation on UFE selection. + UFE_LOG("UFE does not support prepend to selection."); + break; } } } diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp index 6f33ced864..f9c789302a 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp @@ -39,6 +39,7 @@ #include "ufe/runTimeMgr.h" #include "ufe/globalSelection.h" #include "ufe/observableSelection.h" +#include "ufe/log.h" #endif #include "pxr/usd/usd/modelAPI.h" @@ -602,6 +603,12 @@ bool ProxyShapeUI::select(MSelectInfo& selectInfo, MSelectionList& selectionList } } break; + case MGlobal::kAddToHeadOfList: + { + // No such operation on UFE selection. + UFE_LOG("UFE does not support prepend to selection."); + } + break; } } diff --git a/plugin/pxr/maya/lib/usdMaya/chaser.cpp b/plugin/pxr/maya/lib/usdMaya/chaser.cpp deleted file mode 100644 index c70c48dc0a..0000000000 --- a/plugin/pxr/maya/lib/usdMaya/chaser.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright 2016 Pixar -// -// 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. -// -#include "usdMaya/chaser.h" - -PXR_NAMESPACE_OPEN_SCOPE - -bool -UsdMayaChaser::ExportDefault() -{ - // Do nothing by default. - return true; -} - -bool -UsdMayaChaser::ExportFrame(const UsdTimeCode& time) -{ - // Do nothing by default. - return true; -} - -bool -UsdMayaChaser::PostExport() -{ - // Do nothing by default. - return true; -} - -PXR_NAMESPACE_CLOSE_SCOPE - From 5f8341216f8fa67f1d8d41b3197c49dca472781a Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Fri, 10 Jan 2020 07:06:33 -0800 Subject: [PATCH 6/8] Addressed code review comments part 2. --- plugin/adsk/plugin/importTranslator.cpp | 7 ++++--- plugin/adsk/plugin/importTranslator.h | 3 +-- plugin/pxr/maya/lib/usdMaya/CMakeLists.txt | 2 +- .../lib/usdMaya/instancerShapeAdapterWithSceneAssembly.cpp | 2 +- .../lib/usdMaya/instancerShapeAdapterWithSceneAssembly.h | 4 ++-- plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.cpp | 3 ++- plugin/pxr/maya/lib/usdMaya/readJobWithSceneAssembly.h | 3 ++- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugin/adsk/plugin/importTranslator.cpp b/plugin/adsk/plugin/importTranslator.cpp index 17d8b2034f..2fecc955e4 100644 --- a/plugin/adsk/plugin/importTranslator.cpp +++ b/plugin/adsk/plugin/importTranslator.cpp @@ -1,5 +1,6 @@ // // Copyright 2016 Pixar +// Copyright 2019 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -58,7 +59,7 @@ UsdMayaImportTranslator::reader( const MString& optionsString, MPxFileTranslator::FileAccessMode /*mode*/) { - std::string fileName(file.fullName().asChar()); + std::string fileName(file.fullName().asChar(), file.fullName().length()); std::string primPath("/"); std::map variants; @@ -72,14 +73,14 @@ UsdMayaImportTranslator::reader( MStringArray optionList; MStringArray theOption; optionsString.split(';', optionList); - for(int i=0; i<(int)optionList.length(); ++i) { + for(int i=0, n=optionList.length(); i +#include + namespace { #define CMD_NAME "usdUndoHelperCmd" @@ -41,6 +43,11 @@ UsdMayaUndoHelperCommand::_dgModifierFunc = nullptr; MStatus UsdMayaUndoHelperCommand::initialize(MFnPlugin& plugin) { + if (_registrationCount < 0) { + MGlobal::displayError("Illegal initialization of " CMD_NAME); + return MS::kFailure; + } + // If we're already registered, do nothing. if (_registrationCount++ > 0) { return MS::kSuccess; @@ -58,6 +65,11 @@ UsdMayaUndoHelperCommand::initialize(MFnPlugin& plugin) MStatus UsdMayaUndoHelperCommand::finalize(MFnPlugin& plugin) { + if (_registrationCount <= 0) { + MGlobal::displayError("Illegal finalization of " CMD_NAME); + return MS::kFailure; + } + // If more than one plugin still has us registered, do nothing. if (_registrationCount-- > 1) { return MS::kSuccess;