From c21709bf619de25b0efd9dfd6da4b00f33f26199 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Thu, 10 Aug 2023 11:50:06 -0400 Subject: [PATCH] LightFilterVisualiser : Support USD lights --- Changes.md | 10 ++++++++++ .../IECoreGLPreview/LightFilterVisualiser.cpp | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/Changes.md b/Changes.md index e198a3adffd..fda94fccdfc 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,16 @@ 1.3.x.x (relative to 1.3.1.0) ======= +Improvements +------------ + +- Viewer : Added visualisation of light filters for USD lights. + +Fixes +----- + +- Viewer : Fixed crash when visualising lights with a light filter intended for a different renderer. + 1.3.1.0 (relative to 1.3.0.0) ======= diff --git a/src/GafferScene/IECoreGLPreview/LightFilterVisualiser.cpp b/src/GafferScene/IECoreGLPreview/LightFilterVisualiser.cpp index 14ac8e438b5..e048251b0e0 100644 --- a/src/GafferScene/IECoreGLPreview/LightFilterVisualiser.cpp +++ b/src/GafferScene/IECoreGLPreview/LightFilterVisualiser.cpp @@ -132,6 +132,17 @@ Visualisations LightFilterVisualiser::allVisualisations( const IECore::CompoundO boost::split( tokens, attributeName, boost::is_any_of(":") ); const IECoreScene::ShaderNetwork *lightShaderNetwork = attributes->member( tokens.front() + ":light" ); + // If the light is a USD light, the renderer-specific `lightShaderNetwork` won't be valid + if( !lightShaderNetwork ) + { + lightShaderNetwork = attributes->member( "light" ); + } + + if( !lightShaderNetwork ) + { + continue; + } + // It's possible that we found a light filter defined in world space // that isn't assigned to a light just yet. If we found a filter in // light space it must have a valid light shader, though.