From 420fc74d7f5f0c575cacf87040a8d811b711ef41 Mon Sep 17 00:00:00 2001 From: Dan McGarry Date: Fri, 13 Dec 2024 15:57:09 -0800 Subject: [PATCH] Removing some readers for Renderman-for-Maya lights We moved these to a custom light reader as suggested --- lib/usd/translators/lightReader.cpp | 31 ------ lib/usd/translators/plugInfo.json | 3 - .../UsdImportRfMLightTest/RfMLightsTest.usda | 60 ------------ .../usd/translators/testUsdImportRfMLight.py | 96 +------------------ 4 files changed, 1 insertion(+), 189 deletions(-) diff --git a/lib/usd/translators/lightReader.cpp b/lib/usd/translators/lightReader.cpp index 7c755a525f..c1f0deeccf 100644 --- a/lib/usd/translators/lightReader.cpp +++ b/lib/usd/translators/lightReader.cpp @@ -26,37 +26,6 @@ TF_DEFINE_ENV_SETTING( false, "Whether to import UsdLux as Renderman-for-Maya lights."); -// Unregister the light readers for cylinder, disk and dome lights -// As for now those lights are not supported by import/export to Maya -// This will also disable edit as maya -// User can register a custom light reader for those lights if needed - -/* -PXRUSDMAYA_DEFINE_READER(UsdLuxCylinderLight, args, context) -{ - if (TfGetEnvSetting(MAYAUSD_IMPORT_RFM_LIGHTS)) { - return UsdMayaTranslatorRfMLight::Read(args, context); - } - return false; -} - -PXRUSDMAYA_DEFINE_READER(UsdLuxDiskLight, args, context) -{ - if (TfGetEnvSetting(MAYAUSD_IMPORT_RFM_LIGHTS)) { - return UsdMayaTranslatorRfMLight::Read(args, context); - } - return false; -} - -PXRUSDMAYA_DEFINE_READER(UsdLuxDomeLight, args, context) -{ - if (TfGetEnvSetting(MAYAUSD_IMPORT_RFM_LIGHTS)) { - return UsdMayaTranslatorRfMLight::Read(args, context); - } - return false; -} -*/ - PXRUSDMAYA_DEFINE_READER(UsdLuxDistantLight, args, context) { if (TfGetEnvSetting(MAYAUSD_IMPORT_RFM_LIGHTS)) { diff --git a/lib/usd/translators/plugInfo.json b/lib/usd/translators/plugInfo.json index 376139674e..b2c55deeb8 100644 --- a/lib/usd/translators/plugInfo.json +++ b/lib/usd/translators/plugInfo.json @@ -16,10 +16,7 @@ "UsdGeomNurbsPatch", "UsdGeomScope", "UsdGeomXform", - "UsdLuxCylinderLight", - "UsdLuxDiskLight", "UsdLuxDistantLight", - "UsdLuxDomeLight", "UsdLuxGeometryLight", "UsdLuxRectLight", "UsdLuxSphereLight", diff --git a/test/lib/usd/translators/UsdImportRfMLightTest/RfMLightsTest.usda b/test/lib/usd/translators/UsdImportRfMLightTest/RfMLightsTest.usda index f5d806854b..f7472e42a3 100644 --- a/test/lib/usd/translators/UsdImportRfMLightTest/RfMLightsTest.usda +++ b/test/lib/usd/translators/UsdImportRfMLightTest/RfMLightsTest.usda @@ -66,50 +66,6 @@ def Xform "RfMLightsTest" ( def Xform "Lights" { - def CylinderLight "CylinderLight" ( - prepend apiSchemas = ["ShapingAPI", "ShadowAPI"] - ) - { - color3f inputs:color = (0.1, 0.1, 0.1) - float inputs:colorTemperature = 6501 - float inputs:diffuse = 1.1 - bool inputs:enableColorTemperature = 1 - float inputs:exposure = 0.1 - float inputs:intensity = 1.1 - bool inputs:normalize = 1 - float inputs:specular = 1.1 - double3 xformOp:translate = (1, 1, 1) - uniform token[] xformOpOrder = ["xformOp:translate"] - } - - def DiskLight "DiskLight" ( - prepend apiSchemas = ["ShapingAPI", "ShadowAPI"] - ) - { - color3f inputs:color = (0.2, 0.2, 0.2) - float inputs:colorTemperature = 6502 - float inputs:diffuse = 1.2 - bool inputs:enableColorTemperature = 1 - float inputs:exposure = 0.2 - float inputs:intensity = 1.2 - bool inputs:normalize = 1 - float inputs:specular = 1.2 - float inputs:shaping:cone:angle = 92 - float inputs:shaping:cone:softness = 0.2 - float inputs:shaping:focus = 0.2 - color3f inputs:shaping:focusTint = (0.2, 0.2, 0.2) - float inputs:shaping:ies:angleScale = 1.2 - asset inputs:shaping:ies:file = @./DiskLight_profile.ies@ - double3 xformOp:translate.timeSamples = { - 1: (2, 1, 2), - 2: (2, 2, 2), - 3: (2, 3, 2), - 4: (2, 4, 2), - 5: (2, 5, 2), - } - uniform token[] xformOpOrder = ["xformOp:translate"] - } - def DistantLight "DistantLight" ( prepend apiSchemas = ["ShapingAPI", "ShadowAPI"] ) @@ -127,22 +83,6 @@ def Xform "RfMLightsTest" ( uniform token[] xformOpOrder = ["xformOp:translate"] } - def DomeLight "DomeLight" ( - prepend apiSchemas = ["ShapingAPI", "ShadowAPI"] - ) - { - color3f inputs:color = (0.4, 0.4, 0.4) - float inputs:colorTemperature = 6504 - float inputs:diffuse = 1.4 - bool inputs:enableColorTemperature = 1 - float inputs:exposure = 0.4 - float inputs:intensity = 1.4 - float inputs:specular = 1.4 - asset inputs:texture:file = @./DomeLight_texture.tex@ - double3 xformOp:translate = (4, 4, 4) - uniform token[] xformOpOrder = ["xformOp:translate"] - } - def GeometryLight "MeshLight" ( prepend apiSchemas = ["ShapingAPI", "ShadowAPI"] ) diff --git a/test/lib/usd/translators/testUsdImportRfMLight.py b/test/lib/usd/translators/testUsdImportRfMLight.py index 2258994391..77f1eef40e 100644 --- a/test/lib/usd/translators/testUsdImportRfMLight.py +++ b/test/lib/usd/translators/testUsdImportRfMLight.py @@ -22,7 +22,6 @@ from pxr import Usd from maya import OpenMaya -from maya import OpenMayaAnim from maya import cmds from maya import standalone @@ -84,18 +83,9 @@ def _ValidateMayaLight(self, lightTypeName): self.assertTrue(lightTypeName in cmds.listConnections('defaultLightSet')) testNumber = None - if lightTypeName == 'CylinderLight': - self.assertEqual(depNodeFn.typeName(), 'PxrCylinderLight') - testNumber = 1 - elif lightTypeName == 'DiskLight': - self.assertEqual(depNodeFn.typeName(), 'PxrDiskLight') - testNumber = 2 - elif lightTypeName == 'DistantLight': + if lightTypeName == 'DistantLight': self.assertEqual(depNodeFn.typeName(), 'PxrDistantLight') testNumber = 3 - elif lightTypeName == 'DomeLight': - self.assertEqual(depNodeFn.typeName(), 'PxrDomeLight') - testNumber = 4 elif lightTypeName == 'MeshLight': self.assertEqual(depNodeFn.typeName(), 'PxrMeshLight') testNumber = 5 @@ -124,10 +114,6 @@ def _ValidateMayaLight(self, lightTypeName): self._assertGfIsClose(cmds.getAttr('%s.specular' % nodePath), expectedSpecular, 1e-6) - # PxrDomeLight has no normalize attribute - if lightTypeName != 'DomeLight': - self.assertTrue(cmds.getAttr('%s.areaNormalize' % nodePath)) - expectedColor = Gf.ConvertLinearToDisplay(Gf.Vec3f(0.1 * testNumber)) self._assertGfIsClose(cmds.getAttr('%s.lightColorR' % nodePath), expectedColor[0], 1e-6) @@ -142,28 +128,6 @@ def _ValidateMayaLight(self, lightTypeName): self._assertGfIsClose(cmds.getAttr('%s.temperature' % nodePath), expectedTemperature, 1e-6) - def _ValidatePxrDiskLightTransformAnimation(self): - nodePath = '|RfMLightsTest|Lights|DiskLight' - - depNodeFn = self._GetMayaDependencyNode(nodePath) - - animatedPlugs = OpenMaya.MPlugArray() - OpenMayaAnim.MAnimUtil.findAnimatedPlugs(depNodeFn.object(), - animatedPlugs) - self.assertEqual(animatedPlugs.length(), 1) - - translateYPlug = animatedPlugs[0] - self.assertEqual(translateYPlug.name(), 'DiskLight.translateY') - - animObjs = OpenMaya.MObjectArray() - OpenMayaAnim.MAnimUtil.findAnimation(translateYPlug, animObjs) - self.assertEqual(animObjs.length(), 1) - - animCurveFn = OpenMayaAnim.MFnAnimCurve(animObjs[0]) - timeUnit = OpenMaya.MTime.uiUnit() - for frame in range(int(self.START_TIMECODE), int(self.END_TIMECODE + 1.0)): - value = animCurveFn.evaluate(OpenMaya.MTime(frame, timeUnit)) - self._assertGfIsClose(float(frame), value, 1e-6) def _ValidatePxrDistantLightAngle(self): nodePath = '|RfMLightsTest|Lights|DistantLight|DistantLightShape' @@ -179,52 +143,6 @@ def _ValidatePxrRectLightTextureFile(self): self.assertEqual(cmds.getAttr('%s.lightColorMap' % nodePath), expectedTextureFile) - def _ValidatePxrDomeLightTextureFile(self): - nodePath = '|RfMLightsTest|Lights|DomeLight|DomeLightShape' - - expectedTextureFile = './DomeLight_texture.tex' - self.assertEqual(cmds.getAttr('%s.lightColorMap' % nodePath), - expectedTextureFile) - - def _ValidateMayaLightShaping(self): - nodePath = '|RfMLightsTest|Lights|DiskLight|DiskLightShape' - - expectedFocus = 0.2 - self._assertGfIsClose(cmds.getAttr('%s.emissionFocus' % nodePath), - expectedFocus, 1e-6) - - expectedFocusTint = Gf.ConvertLinearToDisplay(Gf.Vec3f(0.2)) - self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintR' % nodePath), - expectedFocusTint[0], 1e-6) - self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintG' % nodePath), - expectedFocusTint[1], 1e-6) - self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintB' % nodePath), - expectedFocusTint[2], 1e-6) - - expectedConeAngle = 92.0 - self._assertGfIsClose(cmds.getAttr('%s.coneAngle' % nodePath), - expectedConeAngle, 1e-6) - - expectedConeSoftness = 0.2 - self._assertGfIsClose(cmds.getAttr('%s.coneSoftness' % nodePath), - expectedConeSoftness, 1e-6) - - expectedProfilePath = './DiskLight_profile.ies' - self.assertEqual(cmds.getAttr('%s.iesProfile' % nodePath), - expectedProfilePath) - - expectedProfileScale = 1.2 - self._assertGfIsClose(cmds.getAttr('%s.iesProfileScale' % nodePath), - expectedProfileScale, 1e-6) - - expectedProfileNormalize = False - self.assertEqual(cmds.getAttr('%s.iesProfileNormalize' % nodePath), - expectedProfileNormalize) - - expectedProfileNormalize = False - self.assertEqual(cmds.getAttr('%s.iesProfileNormalize' % nodePath), - expectedProfileNormalize) - def _ValidateMayaLightShadow(self): nodePath = '|RfMLightsTest|Lights|RectLight|RectLightShape' @@ -272,22 +190,10 @@ def testImportRenderManForMayaLights(self): loaded=True)) self._ValidatePxrLightImportedUnderScope() - def testImportCylinderLight(self): - self._ValidateMayaLight('CylinderLight') - - def testImportDiskLight(self): - self._ValidateMayaLight('DiskLight') - self._ValidatePxrDiskLightTransformAnimation() - self._ValidateMayaLightShaping() - def testImportDistantLight(self): self._ValidateMayaLight('DistantLight') self._ValidatePxrDistantLightAngle() - def testImportDomeLight(self): - self._ValidateMayaLight('DomeLight') - self._ValidatePxrDomeLightTextureFile() - def testImportMeshLight(self): self._ValidateMayaLight('MeshLight')