From 37736fcc6510a5034c0d00313cb9297088e859af Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Wed, 28 Jun 2023 16:28:10 -0400 Subject: [PATCH] fixup! LightTool : Add viewport tool for editing lights --- src/GafferSceneUI/LightTool.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/GafferSceneUI/LightTool.cpp b/src/GafferSceneUI/LightTool.cpp index 52a996cbc49..3ad588ec6c2 100644 --- a/src/GafferSceneUI/LightTool.cpp +++ b/src/GafferSceneUI/LightTool.cpp @@ -707,7 +707,7 @@ class SpotLightHandle : public LightToolHandle bool handleDragMove( const GafferUI::DragDropEvent &event ) override { - if( m_inspections.empty() ) + if( m_inspections.empty() || !allInspectionsEnabled() ) { return true; } @@ -1006,18 +1006,7 @@ class SpotLightHandle : public LightToolHandle const Color3f highlightColor3 = standardStyle->getColor( StandardStyle::Color::HighlightColor ); const Color4f highlightColor4 = Color4f( highlightColor3.x, highlightColor3.y, highlightColor3.z, 1.f ); - bool enabled = true; - for( auto &[coneInspection, originalConeAngle, penumbraInspection, originalPenumbraAngle] : m_inspections ) - { - if( m_handleType == HandleType::Cone ) - { - enabled &= coneInspection ? coneInspection->editable() : false; - } - else - { - enabled &= penumbraInspection ? penumbraInspection->editable() : false; - } - } + const bool enabled = allInspectionsEnabled(); spokeGroup->getState()->add( new IECoreGL::Color( @@ -1415,6 +1404,24 @@ class SpotLightHandle : public LightToolHandle return result; } + bool allInspectionsEnabled() const + { + bool enabled = true; + for( auto &[coneInspection, originalConeAngle, penumbraInspection, originalPenumbraAngle] : m_inspections ) + { + if( m_handleType == HandleType::Cone ) + { + enabled &= coneInspection ? coneInspection->editable() : false; + } + else + { + enabled &= penumbraInspection ? penumbraInspection->editable() : false; + } + } + + return enabled; + } + ParameterInspectorPtr m_coneAngleInspector; ParameterInspectorPtr m_penumbraAngleInspector;