Skip to content

Commit

Permalink
Launch wrapper : Clean up 3Delight env variables
Browse files Browse the repository at this point in the history
`DL_SHADERS_PATH` and `DL_RESOURCES_PATH` are no longer used by
3Delight. Pointing `OSL_SHADER_PATHS` to 3Delight's `osl` subdirectory
removes the need for the `osl/` prefix in shader names.
  • Loading branch information
ericmehl authored and johnhaddon committed Sep 13, 2023
1 parent 2ff04ae commit 3f778d2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 41 deletions.
5 changes: 3 additions & 2 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ Improvements

- Resample, Resize, Blur, ImageTransform : Improved performance, resulting in a 3x speedup in an obscure case, and a 5-10% speedup in more common cases.
- ImageSampler : Added `interpolate` plug to control interpolation. Previously created ImageSamplers are unaffected, but interpolation is off by default for newly created ImageSamplers.
- 3Delight : Moved shaders to `3Delight/Shader` menu and removed outdated shaders from the menu.
- 3Delight :
- Moved shaders to `3Delight/Shader` menu and removed outdated shaders from the menu.
- Shaders (including light shaders) are only loaded from the `osl` subdirectory of the 3Delight installation.

Fixes
-----

- DispatchDialogue : Changed the button label for the results display from "Ok" to "Close".
- Viewer : Fixed display of infinite values in the pixel inspectors. These were being incorrectly displayed as `nan` instead of `inf`.


API
---

Expand Down
7 changes: 3 additions & 4 deletions bin/gaffer
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,10 @@ if [[ -n $DELIGHT ]] ; then

appendToPath "$DELIGHT/bin" PATH
appendToPath "$DELIGHT/python" PYTHONPATH
appendToPath "$DELIGHT/shaders" DL_SHADERS_PATH

appendToPath "$DELIGHT" OSL_SHADER_PATHS

appendToPath "$GAFFER_ROOT/renderMan/displayDrivers" DL_RESOURCES_PATH
# The `$DELIGHT` component is included for backward compatibility and can be removed
# when users have had time to update to `$DELIGHT/osl` pathed shaders.
appendToPath "$DELIGHT/osl:$DELIGHT" OSL_SHADER_PATHS

fi

Expand Down
7 changes: 3 additions & 4 deletions bin/gaffer.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ rem 3Delight
if "%DELIGHT%" NEQ "" (
call :appendToPath "%DELIGHT%\bin" PATH
call :appendToPath "%DELIGHT%\python" PYTHONPATH
call :appendToPath "%DELIGHT%\shaders" DL_SHADERS_PATH

call :appendToPath "%DELIGHT%" OSL_SHADER_PATHS

call :appendToPath "%GAFFER_ROOT%\renderMan\displayDrivers" DL_RESOURCES_PATH
rem The %DELIGHT% component is included for backward compatibility and can be removed
rem when users have had time to update to %DELIGHT%\osl pathed shaders.
call :appendToPath "%DELIGHT%\osl;%DELIGHT%" OSL_SHADER_PATHS
)

rem cycles
Expand Down
4 changes: 2 additions & 2 deletions python/GafferDelightTest/InteractiveDelightRenderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def _cameraVisibilityAttribute( self ) :
def _createMatteShader( self ) :

shader = GafferOSL.OSLShader()
shader.loadShader( "maya/osl/lambert" )
shader.loadShader( "lambert" )
return shader, shader["parameters"]["i_color"]

def _createPointLight( self ) :

light = GafferOSL.OSLLight()
light["shape"].setValue( light.Shape.Sphere )
light["radius"].setValue( 0.01 )
light.loadShader( "maya/osl/pointLight" )
light.loadShader( "pointLight" )
light["attributes"].addChild( Gaffer.NameValuePlug( "dl:visibility.camera", False ) )

return light, light["parameters"]["i_color"]
Expand Down
42 changes: 21 additions & 21 deletions startup/GafferScene/delightLights.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,28 @@

import Gaffer

Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "type", "spot" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "coneAngleParameter", "coneAngle" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "penumbraAngleParameter", "penumbraAngle" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "penumbraType", "outset" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/spotLight", "colorParameter", "i_color" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "type", "spot" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "coneAngleParameter", "coneAngle" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "penumbraAngleParameter", "penumbraAngle" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "penumbraType", "outset" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:spotLight", "colorParameter", "i_color" )

Gaffer.Metadata.registerValue( "osl:light:maya/osl/pointLight", "type", "point" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/pointLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/pointLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/pointLight", "colorParameter", "i_color" )
Gaffer.Metadata.registerValue( "osl:light:pointLight", "type", "point" )
Gaffer.Metadata.registerValue( "osl:light:pointLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:pointLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:pointLight", "colorParameter", "i_color" )

Gaffer.Metadata.registerValue( "osl:light:maya/osl/distantLight", "type", "distant" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/distantLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/distantLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/distantLight", "colorParameter", "i_color" )
Gaffer.Metadata.registerValue( "osl:light:distantLight", "type", "distant" )
Gaffer.Metadata.registerValue( "osl:light:distantLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:distantLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:distantLight", "colorParameter", "i_color" )

Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "type", "environment" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "textureNameParameter", "image" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "colorParameter", "tint" )
Gaffer.Metadata.registerValue( "osl:light:maya/osl/environmentLight", "visualiserOrientation", imath.M44f().rotate( imath.V3f( 0, math.pi, 0 ) ) )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "type", "environment" )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "textureNameParameter", "image" )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "intensityParameter", "intensity" )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "exposureParameter", "exposure" )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "colorParameter", "tint" )
Gaffer.Metadata.registerValue( "osl:light:environmentLight", "visualiserOrientation", imath.M44f().rotate( imath.V3f( 0, math.pi, 0 ) ) )

8 changes: 4 additions & 4 deletions startup/gui/lightEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
shader = GafferOSL.OSLShader()

for light in [
"maya/osl/pointLight",
"maya/osl/spotLight",
"maya/osl/distantLight",
"maya/osl/environmentLight"
"pointLight",
"spotLight",
"distantLight",
"environmentLight"
] :
shader.loadShader( light )
for parameter in shader["parameters"] :
Expand Down
8 changes: 4 additions & 4 deletions startup/gui/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ def __lightCreator( nodeName, shaderName, shape ) :
return node

for label, shader, shape in [
[ "PointLight", "maya/osl/pointLight", GafferOSL.OSLLight.Shape.Sphere ],
[ "SpotLight", "maya/osl/spotLight", GafferOSL.OSLLight.Shape.Disk ],
[ "DistantLight", "maya/osl/distantLight", "distant" ],
[ "EnvironmentLight", "maya/osl/environmentLight", "environment" ],
[ "PointLight", "pointLight", GafferOSL.OSLLight.Shape.Sphere ],
[ "SpotLight", "spotLight", GafferOSL.OSLLight.Shape.Disk ],
[ "DistantLight", "distantLight", "distant" ],
[ "EnvironmentLight", "environmentLight", "environment" ],
] :
nodeMenu.append(
"/3Delight/Light/" + label,
Expand Down

0 comments on commit 3f778d2

Please sign in to comment.