Skip to content

Commit

Permalink
Merge pull request #5723 from ericmehl/lightPositionToolImprovements
Browse files Browse the repository at this point in the history
LightPositionTool improvements
  • Loading branch information
johnhaddon authored Mar 20, 2024
2 parents 39a7839 + 1417404 commit 96634c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
1.4.x.x (relative to 1.4.0.0b4)
=======

Improvements
------------

- LightPosition Tool : The tool is now only visible for members of the `__lights` set, instead of all objects.

API
---

Expand All @@ -11,6 +16,7 @@ Fixes
-----

- PlugAlgo : Updated `canSetValueFromData()`, `setValueFromData()` and `getValueAsData()` with support for missing types.
- LightPosition Tool : Fixed lingering shadow pivot point after placing a shadow pivot, switching to highlight mode and switching back to shadow mode [^1].

1.4.0.0b4 (relative to 1.4.0.0b3)
=========
Expand Down
11 changes: 9 additions & 2 deletions src/GafferSceneUI/LightPositionTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ const float g_arrowHandleSelectionSize = g_circleHandleSelectionWidth * 2.f;

const float g_unitConeHeight = 1.5f;

InternedString g_lightsSetName( "__lights" );

const char *constantFragSource()
{
return
Expand Down Expand Up @@ -666,8 +668,14 @@ void LightPositionTool::updateHandles( float rasterScale )

handles()->setTransform( s.orientedTransform( Orientation::Local ) );

Context::Scope scopedContext( s.context() );

if( !m_drag )
{
bool isLight = s.scene()->set( g_lightsSetName )->readable().match( s.path() ) & IECore::PathMatcher::ExactMatch;
m_distanceHandle->setVisible( isLight );
m_rotateHandle->setVisible( isLight );

bool singleSelection = selection().size() == 1;

TranslationRotation trDistanceHandle( s, Orientation::World );
Expand Down Expand Up @@ -706,8 +714,6 @@ void LightPositionTool::updateHandles( float rasterScale )
// to pivot, and the rotation around the Z-axis. Any variance from those
// contraints invalidates the stored parameters.

Context::Scope scopedContext( s.context() );

const M44f transform = s.scene()->fullTransform( s.path() ) * sceneToTransform;
const V3f p = transform.translation();

Expand Down Expand Up @@ -920,6 +926,7 @@ void LightPositionTool::plugSet( Plug *plug )
{
auto h = static_cast<DistanceHandle *>( m_distanceHandle.get() );
h->setRequiresPivot( modePlug()->getValue() == (int)Mode::Shadow );
updateHandles( m_rotateHandle->getRasterScale() );
}
}

Expand Down

0 comments on commit 96634c5

Please sign in to comment.