diff --git a/Changes.md b/Changes.md index 6205de9b911..841de8bfe51 100644 --- a/Changes.md +++ b/Changes.md @@ -15,7 +15,8 @@ Improvements - Spreadsheet : - Popups for string cells and row names are now sized to fit their column. - Added "Triple" and "Quadruple" width options to the spreadsheet row name popup menu. -- LightTool : Changed spot light tool tip location so that it follows the cone during drag. +- LightTool : + - Changed spot light and quad light edge tool tip locations so that they follow the cone and edge during drag. 1.3.4.0 (relative to 1.3.3.0) ======= diff --git a/src/GafferSceneUI/LightTool.cpp b/src/GafferSceneUI/LightTool.cpp index 9dceb4aeaff..f362e72a21a 100644 --- a/src/GafferSceneUI/LightTool.cpp +++ b/src/GafferSceneUI/LightTool.cpp @@ -2055,10 +2055,12 @@ class EdgeHandle : public LightToolHandle m_oppositeScaleAttributeName( oppositeScaleAttributeName ), m_edgeMargin( edgeMargin ), m_tipPlugSuffix( tipPlugSuffix ), + m_edgeScale( 1.f ), m_oppositeScale( 1.f ), m_orientation(), - m_oppositeAdditionalScale( 1.f ) + m_oppositeAdditionalScale( 1.f ), + m_tooltipT( 0 ) { } @@ -2245,8 +2247,14 @@ class EdgeHandle : public LightToolHandle edgeSegment.p1 += offset; edgeSegment *= m_orientation; - V3f eventClosest; - setTooltipPosition( edgeSegment.closestPoints( LineSegment3f( eventLine.p0, eventLine.p1 ), eventClosest ) ); + if( !m_drag ) + { + V3f eventClosest; + const V3f closestPoint = edgeSegment.closestPoints( LineSegment3f( eventLine.p0, eventLine.p1 ), eventClosest ); + m_tooltipT = ( closestPoint - edgeSegment.p0 ).length() / edgeSegment.length(); + } + + setTooltipPosition( edgeSegment( m_tooltipT ) ); } private : @@ -2318,6 +2326,7 @@ class EdgeHandle : public LightToolHandle float m_oppositeScale; M44f m_orientation; float m_oppositeAdditionalScale; + float m_tooltipT; // Parameter `t` along the edge set at the start of the drag std::optional m_drag; };