Skip to content

Commit

Permalink
Merge pull request #4049 from dj-mcg/pr/Remove_RfM_Light_Readers
Browse files Browse the repository at this point in the history
Removing some readers for Renderman-for-Maya lights
  • Loading branch information
seando-adsk authored Jan 8, 2025
2 parents 51580d3 + 420fc74 commit 145b6ad
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 189 deletions.
31 changes: 0 additions & 31 deletions lib/usd/translators/lightReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 0 additions & 3 deletions lib/usd/translators/plugInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
"UsdGeomNurbsPatch",
"UsdGeomScope",
"UsdGeomXform",
"UsdLuxCylinderLight",
"UsdLuxDiskLight",
"UsdLuxDistantLight",
"UsdLuxDomeLight",
"UsdLuxGeometryLight",
"UsdLuxRectLight",
"UsdLuxSphereLight",
Expand Down
60 changes: 0 additions & 60 deletions test/lib/usd/translators/UsdImportRfMLightTest/RfMLightsTest.usda
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)
Expand All @@ -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"]
)
Expand Down
96 changes: 1 addition & 95 deletions test/lib/usd/translators/testUsdImportRfMLight.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from pxr import Usd

from maya import OpenMaya
from maya import OpenMayaAnim
from maya import cmds
from maya import standalone

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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'
Expand All @@ -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'

Expand Down Expand Up @@ -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')

Expand Down

0 comments on commit 145b6ad

Please sign in to comment.