Skip to content

Commit

Permalink
fixup! VisualiserTool : Support points and curves
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Jan 28, 2025
1 parent 5ee942d commit 269d03e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Improvements
- VisualiserTool :
- Changed naming requirements for visualising primitive variables. Values in `dataName` now prefix the primitive variable name with `primitiveVariable:`. Setting `dataName` to `vertex:index` will display vertex indices.
- Added `mode` plug. The available modes are :
- Auto : Vertex indices and integers are displayed `Vertex Label`. Other data is displayed as `Color (Auto Range)`.
- Auto : Vertex indices and integers on meshes are displayed `Vertex Label`. All data for curves and points objects are displayed as `Vertex Label`. Other data is displayed as `Color (Auto Range)`.
- Color (Auto Range) : Float, integer, V2f and color data is displayed without modification. Vector data is remapped from `[-1, 1]` to `[0, 1]`.
- Color : Values are remapped from the range `[valueMin, valueMax]` to `[0, 1]`.
- Vertex Label : Values are displayed as a label next to each vertex.
Expand Down
5 changes: 3 additions & 2 deletions python/GafferSceneUI/VisualiserToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@
"""
The method for displaying the data.
- Auto : Vertex indices and integer data are displayed as `Vertex Label`.
Other data is displayed as `Color (Type Range)`.
- Auto : Vertex indices and integers on meshes are displayed `Vertex Label`. All
data for curves and points objects are displayed as `Vertex Label`. Other data is
displayed as `Color (Type Range)`.
- Color (Type Range) : Float and integer data are displayed as grayscale. V2f data
is displayed with the `x` value for red, `y` value for green and `0` for blue. Vector
data is displayed with the `x` value for red, `y` value for green and `z` value for
Expand Down
8 changes: 6 additions & 2 deletions src/GafferSceneUI/VisualiserTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ class VisualiserGadget : public Gadget
// Display value at cursor as text
std::optional<V2f> cursorPos = m_tool->cursorPos();
if( !cursorPos )
if( !cursorPos || !std::holds_alternative<std::monostate>( cursorVertexValue() ) )
{
return;
}
Expand Down Expand Up @@ -1013,7 +1013,11 @@ class VisualiserGadget : public Gadget
continue;
}
if( mode == VisualiserTool::Mode::Auto && vData->typeId() != IntVectorDataTypeId )
if(
mode == VisualiserTool::Mode::Auto &&
primitive->typeId() == MeshPrimitive::staticTypeId() &&
vData->typeId() != IntVectorDataTypeId
)
{
// Will be handled by `renderColorVisualiser()` instead.
continue;
Expand Down

0 comments on commit 269d03e

Please sign in to comment.