Skip to content

Commit

Permalink
LightPositionTool : Disable for non-lights
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Mar 19, 2024
1 parent 39a7839 commit 6e8a067
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 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 Down
10 changes: 8 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

0 comments on commit 6e8a067

Please sign in to comment.