From b07dcbbc2dad1309d55472f527b35fe24515be32 Mon Sep 17 00:00:00 2001 From: Dan McGarry Date: Wed, 27 Jul 2022 09:12:48 -0700 Subject: [PATCH] RfM Translator Test Improvements Add a test for when Usd properties are suppressed Test now run in separate test cases Improved error messaging --- .../usd/translators/testUsdExportRfMLight.py | 147 +++++++------ .../usd/translators/testUsdImportRfMLight.py | 194 ++++++++++-------- 2 files changed, 189 insertions(+), 152 deletions(-) diff --git a/test/lib/usd/translators/testUsdExportRfMLight.py b/test/lib/usd/translators/testUsdExportRfMLight.py index aa703fbf3d..f3af3acf71 100644 --- a/test/lib/usd/translators/testUsdExportRfMLight.py +++ b/test/lib/usd/translators/testUsdExportRfMLight.py @@ -55,6 +55,11 @@ def setUpClass(cls): def tearDownClass(cls): standalone.uninitialize() + def _assertGfIsClose(self, a, b, ep): + if Gf.IsClose(a, b, ep): + return + raise self.failureException("%s != %s (ep=%f)" % (a, b, ep)) + def testStageOpens(self): """ Tests that the USD stage was opened successfully. @@ -114,20 +119,22 @@ def _ValidateUsdLuxLight(self, lightTypeName): return expectedIntensity = 1.0 + (testNumber * 0.1) + self._assertGfIsClose(lightSchema.GetIntensityAttr().Get(), + expectedIntensity, 1e-6) self.assertTrue(Gf.IsClose(lightSchema.GetIntensityAttr().Get(), expectedIntensity, 1e-6)) expectedExposure = 0.1 * testNumber - self.assertTrue(Gf.IsClose(lightSchema.GetExposureAttr().Get(), - expectedExposure, 1e-6)) + self._assertGfIsClose(lightSchema.GetExposureAttr().Get(), + expectedExposure, 1e-6) expectedDiffuse = 1.0 + (testNumber * 0.1) - self.assertTrue(Gf.IsClose(lightSchema.GetDiffuseAttr().Get(), - expectedDiffuse, 1e-6)) + self._assertGfIsClose(lightSchema.GetDiffuseAttr().Get(), + expectedDiffuse, 1e-6) expectedSpecular = 1.0 + (testNumber * 0.1) - self.assertTrue(Gf.IsClose(lightSchema.GetSpecularAttr().Get(), - expectedSpecular, 1e-6)) + self._assertGfIsClose(lightSchema.GetSpecularAttr().Get(), + expectedSpecular, 1e-6) if lightTypeName == 'EnvDayLight': # PxrEnvDayLight doesn't have any of the below attributes. @@ -143,16 +150,16 @@ def _ValidateUsdLuxLight(self, lightTypeName): expectedNormalize) expectedColor = Gf.Vec3f(0.1 * testNumber) - self.assertTrue(Gf.IsClose(lightSchema.GetColorAttr().Get(), - expectedColor, 1e-6)) + self._assertGfIsClose(lightSchema.GetColorAttr().Get(), + expectedColor, 1e-6) expectedEnableTemperature = True self.assertEqual(lightSchema.GetEnableColorTemperatureAttr().Get(), expectedEnableTemperature) expectedTemperature = 6500.0 + testNumber - self.assertTrue(Gf.IsClose(lightSchema.GetColorTemperatureAttr().Get(), - expectedTemperature, 1e-6)) + self._assertGfIsClose(lightSchema.GetColorTemperatureAttr().Get(), + expectedTemperature, 1e-6) def _ValidateDiskLightXformAnimation(self): lightPrimPath = '/RfMLightsTest/Lights/DiskLight' @@ -184,8 +191,8 @@ def _ValidateUsdLuxDistantLightAngle(self): self.assertTrue(distantLight) expectedAngle = 0.73 - self.assertTrue(Gf.IsClose(distantLight.GetAngleAttr().Get(), - expectedAngle, 1e-6)) + self._assertGfIsClose(distantLight.GetAngleAttr().Get(), + expectedAngle, 1e-6) def _ValidateUsdLuxRectLightTextureFile(self): lightPrimPath = '/RfMLightsTest/Lights/RectLight' @@ -264,46 +271,46 @@ def _ValidateUsdRiPxrEnvDayLight(self): expectedDay) expectedHaziness = 1.9 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:haziness").Get(), - expectedHaziness, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:haziness").Get(), + expectedHaziness, 1e-6) expectedHour = 9.9 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:hour").Get(), - expectedHour, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:hour").Get(), + expectedHour, 1e-6) expectedLatitude = 90.0 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:latitude").Get(), - expectedLatitude, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:latitude").Get(), + expectedLatitude, 1e-6) expectedLongitude = -90.0 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:longitude").Get(), - expectedLongitude, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:longitude").Get(), + expectedLongitude, 1e-6) expectedMonth = 9 self.assertEqual(envDayLight.GetAttribute("inputs:ri:light:month").Get(), expectedMonth) expectedSkyTint = Gf.Vec3f(0.9) - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:skyTint").Get(), - expectedSkyTint, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:skyTint").Get(), + expectedSkyTint, 1e-6) expectedSunDirection = Gf.Vec3f(0.0, 0.0, 0.9) - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:sunDirection").Get(), - expectedSunDirection, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:sunDirection").Get(), + expectedSunDirection, 1e-6) expectedSunSize = 0.9 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:sunSize").Get(), - expectedSunSize, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:sunSize").Get(), + expectedSunSize, 1e-6) expectedSunTint = Gf.Vec3f(0.9) - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:sunTint").Get(), - expectedSunTint, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:sunTint").Get(), + expectedSunTint, 1e-6) expectedYear = 2019 self.assertEqual(envDayLight.GetAttribute("inputs:ri:light:year").Get(), expectedYear) expectedZone = 9.0 - self.assertTrue(Gf.IsClose(envDayLight.GetAttribute("inputs:ri:light:zone").Get(), - expectedZone, 1e-6)) + self._assertGfIsClose(envDayLight.GetAttribute("inputs:ri:light:zone").Get(), + expectedZone, 1e-6) def _ValidateUsdLuxShapingAPI(self): lightPrimPath = '/RfMLightsTest/Lights/DiskLight' @@ -316,28 +323,34 @@ def _ValidateUsdLuxShapingAPI(self): self.assertTrue(shapingAPI) expectedFocus = 0.2 - self.assertTrue(Gf.IsClose(shapingAPI.GetShapingFocusAttr().Get(), - expectedFocus, 1e-6)) + self._assertGfIsClose(shapingAPI.GetShapingFocusAttr().Get(), + expectedFocus, 1e-6) expectedFocusTint = Gf.Vec3f(0.2) - self.assertTrue(Gf.IsClose(shapingAPI.GetShapingFocusTintAttr().Get(), - expectedFocusTint, 1e-6)) + self._assertGfIsClose(shapingAPI.GetShapingFocusTintAttr().Get(), + expectedFocusTint, 1e-6) expectedConeAngle = 92.0 - self.assertTrue(Gf.IsClose(shapingAPI.GetShapingConeAngleAttr().Get(), - expectedConeAngle, 1e-6)) + self._assertGfIsClose(shapingAPI.GetShapingConeAngleAttr().Get(), + expectedConeAngle, 1e-6) expectedConeSoftness = 0.2 - self.assertTrue(Gf.IsClose(shapingAPI.GetShapingConeSoftnessAttr().Get(), - expectedConeSoftness, 1e-6)) + self._assertGfIsClose(shapingAPI.GetShapingConeSoftnessAttr().Get(), + expectedConeSoftness, 1e-6) expectedProfilePath = './DiskLight_profile.ies' self.assertEqual(shapingAPI.GetShapingIesFileAttr().Get(), expectedProfilePath) expectedProfileScale = 1.2 - self.assertTrue(Gf.IsClose(shapingAPI.GetShapingIesAngleScaleAttr().Get(), - expectedProfileScale, 1e-6)) + self._assertGfIsClose(shapingAPI.GetShapingIesAngleScaleAttr().Get(), + expectedProfileScale, 1e-6) + + def _ValidateUsdLuxSuppressed(self): + ''' makes sure suppressed properties are not written out ''' + lightPrimPath = '/RfMLightsTest/Lights/DiskLight' + lightPrim = self._stage.GetPrimAtPath(lightPrimPath) + self.assertFalse(bool(lightPrim.GetAttribute('inputs:ri:light:shadowSubset'))) def _ValidateUsdLuxShadowAPI(self): lightPrimPath = '/RfMLightsTest/Lights/RectLight' @@ -352,50 +365,56 @@ def _ValidateUsdLuxShadowAPI(self): self.assertTrue(shadowAPI.GetShadowEnableAttr().Get()) expectedShadowColor = Gf.Vec3f(0.6) - self.assertTrue(Gf.IsClose(shadowAPI.GetShadowColorAttr().Get(), - expectedShadowColor, 1e-6)) + self._assertGfIsClose(shadowAPI.GetShadowColorAttr().Get(), + expectedShadowColor, 1e-6) expectedShadowDistance = -0.6 - self.assertTrue(Gf.IsClose(shadowAPI.GetShadowDistanceAttr().Get(), - expectedShadowDistance, 1e-6)) + self._assertGfIsClose(shadowAPI.GetShadowDistanceAttr().Get(), + expectedShadowDistance, 1e-6) expectedShadowFalloff = -0.6 - self.assertTrue(Gf.IsClose(shadowAPI.GetShadowFalloffAttr().Get(), - expectedShadowFalloff, 1e-6)) + self._assertGfIsClose(shadowAPI.GetShadowFalloffAttr().Get(), + expectedShadowFalloff, 1e-6) expectedShadowFalloffGamma = 0.6 - self.assertTrue(Gf.IsClose(shadowAPI.GetShadowFalloffGammaAttr().Get(), - expectedShadowFalloffGamma, 1e-6)) + self._assertGfIsClose(shadowAPI.GetShadowFalloffGammaAttr().Get(), + expectedShadowFalloffGamma, 1e-6) - def testExportRenderManForMayaLights(self): - """ - Tests that RenderMan for Maya lights export as UsdLux schema USD prims - correctly. - """ + def testExportCylinderLight(self): self._ValidateUsdLuxLight('CylinderLight') + def testExportDiskLight(self): self._ValidateUsdLuxLight('DiskLight') self._ValidateDiskLightXformAnimation() + self._ValidateUsdLuxShapingAPI() + self._ValidateUsdLuxSuppressed() + def testExportDistantLight(self): self._ValidateUsdLuxLight('DistantLight') + self._ValidateUsdLuxDistantLightAngle() + + def testExportDomeLight(self): self._ValidateUsdLuxLight('DomeLight') - self._ValidateUsdLuxLight('MeshLight') - self._ValidateUsdLuxLight('RectLight') - self._ValidateUsdLuxLight('SphereLight') - self._ValidateUsdLuxLight('AovLight') - self._ValidateUsdLuxLight('EnvDayLight') + self._ValidateUsdLuxDomeLightTextureFile() - self._ValidateUsdLuxDistantLightAngle() + def testExportMeshLight(self): + self._ValidateUsdLuxLight('MeshLight') + def testExportRectLight(self): + self._ValidateUsdLuxLight('RectLight') self._ValidateUsdLuxRectLightTextureFile() - self._ValidateUsdLuxDomeLightTextureFile() + self._ValidateUsdLuxShadowAPI() - self._ValidateUsdRiPxrAovLight() - self._ValidateUsdRiPxrEnvDayLight() + def testExportSphereLight(self): + self._ValidateUsdLuxLight('SphereLight') - self._ValidateUsdLuxShapingAPI() + def testExportAovLight(self): + self._ValidateUsdLuxLight('AovLight') + self._ValidateUsdRiPxrAovLight() - self._ValidateUsdLuxShadowAPI() + def testExportEnvDayLight(self): + self._ValidateUsdLuxLight('EnvDayLight') + self._ValidateUsdRiPxrEnvDayLight() if __name__ == '__main__': diff --git a/test/lib/usd/translators/testUsdImportRfMLight.py b/test/lib/usd/translators/testUsdImportRfMLight.py index 39c4cbd7fc..7466787dfb 100644 --- a/test/lib/usd/translators/testUsdImportRfMLight.py +++ b/test/lib/usd/translators/testUsdImportRfMLight.py @@ -50,6 +50,11 @@ def setUpClass(cls): def tearDownClass(cls): standalone.uninitialize() + def _assertGfIsClose(self, a, b, ep): + if Gf.IsClose(a, b, ep): + return + raise self.failureException("%s != %s (ep=%f)" % (a, b, ep)) + def testStageOpens(self): """ Tests that the USD stage being imported opens successfully. @@ -114,20 +119,20 @@ def _ValidateMayaLight(self, lightTypeName): return expectedIntensity = 1.0 + (testNumber * 0.1) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.intensity' % nodePath), - expectedIntensity, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.intensity' % nodePath), + expectedIntensity, 1e-6) expectedExposure = 0.1 * testNumber - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.exposure' % nodePath), - expectedExposure, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.exposure' % nodePath), + expectedExposure, 1e-6) expectedDiffuse = 1.0 + (testNumber * 0.1) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.diffuse' % nodePath), - expectedDiffuse, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.diffuse' % nodePath), + expectedDiffuse, 1e-6) expectedSpecular = 1.0 + (testNumber * 0.1) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.specular' % nodePath), - expectedSpecular, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.specular' % nodePath), + expectedSpecular, 1e-6) if lightTypeName == 'EnvDayLight': # PxrEnvDayLight doesn't have any of the below attributes. @@ -138,18 +143,18 @@ def _ValidateMayaLight(self, lightTypeName): self.assertTrue(cmds.getAttr('%s.areaNormalize' % nodePath)) expectedColor = 0.1 * testNumber - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.lightColorR' % nodePath), - expectedColor, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.lightColorG' % nodePath), - expectedColor, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.lightColorB' % nodePath), - expectedColor, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.lightColorR' % nodePath), + expectedColor, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.lightColorG' % nodePath), + expectedColor, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.lightColorB' % nodePath), + expectedColor, 1e-6) self.assertTrue(cmds.getAttr('%s.enableTemperature' % nodePath)) expectedTemperature = 6500.0 + testNumber - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.temperature' % nodePath), - expectedTemperature, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.temperature' % nodePath), + expectedTemperature, 1e-6) def _ValidatePxrDiskLightTransformAnimation(self): nodePath = '|RfMLightsTest|Lights|DiskLight' @@ -172,14 +177,14 @@ def _ValidatePxrDiskLightTransformAnimation(self): 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.assertTrue(Gf.IsClose(float(frame), value, 1e-6)) + self._assertGfIsClose(float(frame), value, 1e-6) def _ValidatePxrDistantLightAngle(self): nodePath = '|RfMLightsTest|Lights|DistantLight|DistantLightShape' expectedAngle = 0.73 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.angleExtent' % nodePath), - expectedAngle, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.angleExtent' % nodePath), + expectedAngle, 1e-6) def _ValidatePxrRectLightTextureFile(self): nodePath = '|RfMLightsTest|Lights|RectLight|RectLightShape' @@ -236,89 +241,93 @@ def _ValidatePxrEnvDayLight(self): self.assertEqual(cmds.getAttr('%s.day' % nodePath), expectedDay) expectedHaziness = 1.9 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.haziness' % nodePath), - expectedHaziness, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.haziness' % nodePath), + expectedHaziness, 1e-6) expectedHour = 9.9 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.hour' % nodePath), - expectedHour, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.hour' % nodePath), + expectedHour, 1e-6) expectedLatitude = 90.0 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.latitude' % nodePath), - expectedLatitude, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.latitude' % nodePath), + expectedLatitude, 1e-6) expectedLongitude = -90.0 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.longitude' % nodePath), - expectedLongitude, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.longitude' % nodePath), + expectedLongitude, 1e-6) expectedMonth = 9 self.assertEqual(cmds.getAttr('%s.month' % nodePath), expectedMonth) expectedSkyTint = Gf.Vec3f(0.9) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.skyTintR' % nodePath), - expectedSkyTint[0], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.skyTintG' % nodePath), - expectedSkyTint[1], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.skyTintB' % nodePath), - expectedSkyTint[2], 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.skyTintR' % nodePath), + expectedSkyTint[0], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.skyTintG' % nodePath), + expectedSkyTint[1], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.skyTintB' % nodePath), + expectedSkyTint[2], 1e-6) expectedSunDirection = Gf.Vec3f(0.0, 0.0, 0.9) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunDirectionX' % nodePath), - expectedSunDirection[0], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunDirectionY' % nodePath), - expectedSunDirection[1], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunDirectionZ' % nodePath), - expectedSunDirection[2], 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.sunDirectionX' % nodePath), + expectedSunDirection[0], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.sunDirectionY' % nodePath), + expectedSunDirection[1], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.sunDirectionZ' % nodePath), + expectedSunDirection[2], 1e-6) expectedSunSize = 0.9 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunSize' % nodePath), - expectedSunSize, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.sunSize' % nodePath), + expectedSunSize, 1e-6) expectedSunTint = Gf.Vec3f(0.9) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunTintR' % nodePath), - expectedSunTint[0], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunTintG' % nodePath), - expectedSunTint[1], 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.sunTintB' % nodePath), - expectedSunTint[2], 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.sunTintR' % nodePath), + expectedSunTint[0], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.sunTintG' % nodePath), + expectedSunTint[1], 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.sunTintB' % nodePath), + expectedSunTint[2], 1e-6) expectedYear = 2019 self.assertEqual(cmds.getAttr('%s.year' % nodePath), expectedYear) expectedZone = 9.0 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.zone' % nodePath), - expectedZone, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.zone' % nodePath), + expectedZone, 1e-6) def _ValidateMayaLightShaping(self): nodePath = '|RfMLightsTest|Lights|DiskLight|DiskLightShape' expectedFocus = 0.2 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.emissionFocus' % nodePath), - expectedFocus, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.emissionFocus' % nodePath), + expectedFocus, 1e-6) expectedFocusTint = 0.2 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.emissionFocusTintR' % nodePath), - expectedFocusTint, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.emissionFocusTintG' % nodePath), - expectedFocusTint, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.emissionFocusTintB' % nodePath), - expectedFocusTint, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintR' % nodePath), + expectedFocusTint, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintG' % nodePath), + expectedFocusTint, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.emissionFocusTintB' % nodePath), + expectedFocusTint, 1e-6) expectedConeAngle = 92.0 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.coneAngle' % nodePath), - expectedConeAngle, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.coneAngle' % nodePath), + expectedConeAngle, 1e-6) expectedConeSoftness = 0.2 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.coneSoftness' % nodePath), - expectedConeSoftness, 1e-6)) + 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.assertTrue(Gf.IsClose(cmds.getAttr('%s.iesProfileScale' % nodePath), - expectedProfileScale, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.iesProfileScale' % nodePath), + expectedProfileScale, 1e-6) + + expectedProfileNormalize = False + self.assertEqual(cmds.getAttr('%s.iesProfileNormalize' % nodePath), + expectedProfileNormalize) def _ValidateMayaLightShadow(self): nodePath = '|RfMLightsTest|Lights|RectLight|RectLightShape' @@ -328,24 +337,24 @@ def _ValidateMayaLightShadow(self): expectedShadowsEnabled) expectedShadowColor = 0.6 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowColorR' % nodePath), - expectedShadowColor, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowColorG' % nodePath), - expectedShadowColor, 1e-6)) - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowColorB' % nodePath), - expectedShadowColor, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.shadowColorR' % nodePath), + expectedShadowColor, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.shadowColorG' % nodePath), + expectedShadowColor, 1e-6) + self._assertGfIsClose(cmds.getAttr('%s.shadowColorB' % nodePath), + expectedShadowColor, 1e-6) expectedShadowDistance = -0.6 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowDistance' % nodePath), - expectedShadowDistance, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.shadowDistance' % nodePath), + expectedShadowDistance, 1e-6) expectedShadowFalloff = -0.6 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowFalloff' % nodePath), - expectedShadowFalloff, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.shadowFalloff' % nodePath), + expectedShadowFalloff, 1e-6) expectedShadowFalloffGamma = 0.6 - self.assertTrue(Gf.IsClose(cmds.getAttr('%s.shadowFalloffGamma' % nodePath), - expectedShadowFalloffGamma, 1e-6)) + self._assertGfIsClose(cmds.getAttr('%s.shadowFalloffGamma' % nodePath), + expectedShadowFalloffGamma, 1e-6) def _ValidatePxrLightImportedUnderScope(self): # This tests a case where the "Scope" translator was treating lights as @@ -365,33 +374,42 @@ def testImportRenderManForMayaLights(self): """ self.assertTrue(cmds.pluginInfo('RenderMan_for_Maya', query=True, 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._ValidateMayaLight('DomeLight') - self._ValidateMayaLight('MeshLight') - self._ValidateMayaLight('RectLight') - self._ValidateMayaLight('SphereLight') - self._ValidateMayaLight('AovLight') - self._ValidateMayaLight('EnvDayLight') - self._ValidatePxrDistantLightAngle() - self._ValidatePxrRectLightTextureFile() + def testImportDomeLight(self): + self._ValidateMayaLight('DomeLight') self._ValidatePxrDomeLightTextureFile() - self._ValidatePxrAovLight() - self._ValidatePxrEnvDayLight() - - self._ValidateMayaLightShaping() + def testImportMeshLight(self): + self._ValidateMayaLight('MeshLight') + def testImportRectLight(self): + self._ValidateMayaLight('RectLight') + self._ValidatePxrRectLightTextureFile() self._ValidateMayaLightShadow() - self._ValidatePxrLightImportedUnderScope() + def testImportSphereLight(self): + self._ValidateMayaLight('SphereLight') + + def testImportAovLight(self): + self._ValidateMayaLight('AovLight') + self._ValidatePxrAovLight() + + def testImportEnvDayLight(self): + self._ValidateMayaLight('EnvDayLight') + self._ValidatePxrEnvDayLight() if __name__ == '__main__':