Skip to content

Commit

Permalink
fixup! LightTool : Add viewport tool for editing lights
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Jun 29, 2023
1 parent abfb514 commit 37736fc
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/GafferSceneUI/LightTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 37736fc

Please sign in to comment.