Skip to content

Commit 3f1e13e

Browse files
committed
Rectangle slot marker for hidden connections.
1 parent c9be4ed commit 3f1e13e

8 files changed

Lines changed: 42 additions & 54 deletions

File tree

Sources/BuiltInNodes/BI_UINodePanels.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,25 @@ void NodeUISlotPanel::Draw (NUIE::NodeUIDrawingEnvironment& env, const NUIE::Rec
273273
NUIE::Rect textRect = slotRect.Expand (NUIE::Size (2.0 * -nodePadding, -nodePadding));
274274
drawingImage.AddInputSlotConnPosition (slotId, slotRect.GetLeftCenter ());
275275
drawingImage.AddInputSlotRect (slotId, slotRect);
276-
if (skinParams.GetSlotMarker () == NUIE::SkinParams::SlotMarker::Circle) {
277-
bool drawHiddenConnectionMarker = uiSlot->GetConnectionDisplayMode () == NUIE::ConnectionDisplayMode::Hidden && node.IsInputSlotConnected (uiSlot->GetId ());
278-
if (drawHiddenConnectionMarker) {
279-
NUIE::Rect bigConnCircleRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetHiddenConnectionMarkerBigSize ());
280-
NUIE::Rect smallConnCircleRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetHiddenConnectionMarkerSmallSize ());
281-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillEllipse (bigConnCircleRect, skinParams.GetSlotTextBackgroundColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
282-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingEllipse (bigConnCircleRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
283-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingEllipse (smallConnCircleRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
284-
} else {
285-
NUIE::Rect connCircleRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetSlotMarkerSize ());
286-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillEllipse (connCircleRect, skinParams.GetSlotTextBackgroundColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
287-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingEllipse (connCircleRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
288-
}
276+
277+
NUIE::SkinParams::SlotMarker slotMarker = NUIE::SkinParams::SlotMarker::None;
278+
bool hasHiddenConnection = (uiSlot->GetConnectionDisplayMode () == NUIE::ConnectionDisplayMode::Hidden && node.IsInputSlotConnected (uiSlot->GetId ()));
279+
if (!hasHiddenConnection) {
280+
slotMarker = skinParams.GetSlotMarker ();
281+
} else {
282+
slotMarker = skinParams.GetHiddenSlotMarker ();
289283
}
284+
285+
if (slotMarker == NUIE::SkinParams::SlotMarker::Circle) {
286+
NUIE::Rect markerRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetSlotMarkerSize ());
287+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillEllipse (markerRect, skinParams.GetSlotTextBackgroundColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
288+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingEllipse (markerRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
289+
} else if (slotMarker == NUIE::SkinParams::SlotMarker::Rectangle) {
290+
NUIE::Rect markerRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetSlotMarkerSize ());
291+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillRect (markerRect, skinParams.GetSlotTextBackgroundColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
292+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingRect (markerRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
293+
}
294+
290295
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillRect (slotRect, skinParams.GetSlotTextBackgroundColor ())));
291296
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingText (textRect, skinParams.GetNodeContentTextFont (), uiSlot->GetName ().GetLocalized (), NUIE::HorizontalAnchor::Left, NUIE::VerticalAnchor::Center, skinParams.GetSlotTextColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
292297
});

Sources/MacOSEmbeddingDemo/Application.mm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,8 @@ - (void) windowDidResize : (NSNotification *) notification
112112
static const NUIE::BasicSkinParams skinParams (
113113
/*backgroundColor*/ NUIE::Color (250, 250, 250),
114114
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
115-
/*connectionMarker */ NUIE::SkinParams::ConnectionMarker::Circle,
115+
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::Circle,
116116
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
117-
/*hiddenConnectionMarkerBigSize*/ NUIE::Size (11.0, 11.0),
118-
/*hiddenConnectionMarkerSmallSize*/ NUIE::Size (6.0, 6.0),
119117
/*nodePadding*/ 5.0,
120118
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
121119
/*nodeHeaderTextFont*/ NUIE::Font (L"Helvetica", 16.0),
@@ -129,6 +127,7 @@ - (void) windowDidResize : (NSNotification *) notification
129127
/*slotTextColor*/ NUIE::Color (0, 0, 0),
130128
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
131129
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
130+
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::Rectangle,
132131
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
133132
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
134133
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),

Sources/NodeEngineTest/NodeEditorVisualTest.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const BasicSkinParams& GetSkinParamsWithMarkers ()
1919
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
2020
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::Circle,
2121
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
22-
/*hiddenConnectionMarkerBigSize*/ NUIE::Size (11.0, 11.0),
23-
/*hiddenConnectionMarkerSmallSize*/ NUIE::Size (6.0, 6.0),
2422
/*nodePadding*/ 5.0,
2523
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
2624
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
@@ -34,6 +32,7 @@ const BasicSkinParams& GetSkinParamsWithMarkers ()
3432
/*slotTextColor*/ NUIE::Color (0, 0, 0),
3533
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
3634
/*slotMarker*/ SkinParams::SlotMarker::Circle,
35+
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::Rectangle,
3736
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
3837
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
3938
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),
@@ -578,8 +577,6 @@ TEST (SkinParamsTest)
578577
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (0, 0, 200), 5.0),
579578
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::None,
580579
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
581-
/*hiddenConnectionMarkerBigSize*/ NUIE::Size (11.0, 11.0),
582-
/*hiddenConnectionMarkerSmallSize*/ NUIE::Size (6.0, 6.0),
583580
/*nodePadding*/ 10.0,
584581
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (0, 200, 0), 5.0),
585582
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
@@ -593,6 +590,7 @@ TEST (SkinParamsTest)
593590
/*slotTextColor*/ NUIE::Color (100, 100, 0),
594591
/*slotTextBackgroundColor*/ NUIE::Color (180, 250, 250),
595592
/*slotMarker*/ SkinParams::SlotMarker::None,
593+
/*hiddenSlotMarker*/ SkinParams::SlotMarker::None,
596594
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
597595
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 0, 255), 0.25),
598596
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),
@@ -649,7 +647,7 @@ TEST (HideConnectionsTest)
649647
env.RightClick (env.viewer2InputSlotRect.GetCenter ());
650648
ASSERT (env.CheckReference (L"HideConnectionsTest_ConnectionHidden.svg"));
651649
}
652-
650+
653651
{ // select viewer 2
654652
env.Click (env.viewer2HeaderPoint);
655653
ASSERT (env.CheckReference (L"HideConnectionsTest_Viewer2Selected.svg"));

Sources/NodeEngineTest/VisualTestFiles/HideConnectionsTest_ConnectionHidden.svg

Lines changed: 2 additions & 3 deletions
Loading

Sources/NodeEngineTest/VisualTestFiles/HideConnectionsTest_Viewer2Selected.svg

Lines changed: 2 additions & 3 deletions
Loading

Sources/NodeUIEngine/NUIE_SkinParams.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ BasicSkinParams::BasicSkinParams (
2929
const Pen& connectionLinePen,
3030
ConnectionMarker connectionMarker,
3131
const Size& connectionMarkerSize,
32-
const Size& hiddenConnectionMarkerBigSize,
33-
const Size& hiddenConnectionMarkerSmallSize,
3432
const double& nodePadding,
3533
const Pen& nodeBorderPen,
3634
const Font& nodeHeaderTextFont,
@@ -44,6 +42,7 @@ BasicSkinParams::BasicSkinParams (
4442
const Color& slotTextColor,
4543
const Color& slotTextBackgroundColor,
4644
SlotMarker slotMarker,
45+
SlotMarker hiddenSlotMarker,
4746
const Size& slotMarkerSize,
4847
const BlendColor& disabledBlendColor,
4948
const BlendColor& selectionBlendColor,
@@ -62,8 +61,6 @@ BasicSkinParams::BasicSkinParams (
6261
connectionLinePen (connectionLinePen),
6362
connectionMarker (connectionMarker),
6463
connectionMarkerSize (connectionMarkerSize),
65-
hiddenConnectionMarkerBigSize (hiddenConnectionMarkerBigSize),
66-
hiddenConnectionMarkerSmallSize (hiddenConnectionMarkerSmallSize),
6764
nodePadding (nodePadding),
6865
nodeBorderPen (nodeBorderPen),
6966
nodeHeaderTextFont (nodeHeaderTextFont),
@@ -77,6 +74,7 @@ BasicSkinParams::BasicSkinParams (
7774
slotTextColor (slotTextColor),
7875
slotTextBackgroundColor (slotTextBackgroundColor),
7976
slotMarker (slotMarker),
77+
hiddenSlotMarker (hiddenSlotMarker),
8078
slotMarkerSize (slotMarkerSize),
8179
disabledBlendColor (disabledBlendColor),
8280
selectionBlendColor (selectionBlendColor),
@@ -119,16 +117,6 @@ const Size& BasicSkinParams::GetConnectionMarkerSize () const
119117
return connectionMarkerSize;
120118
}
121119

122-
const NUIE::Size& BasicSkinParams::GetHiddenConnectionMarkerBigSize () const
123-
{
124-
return hiddenConnectionMarkerBigSize;
125-
}
126-
127-
const NUIE::Size& BasicSkinParams::GetHiddenConnectionMarkerSmallSize () const
128-
{
129-
return hiddenConnectionMarkerSmallSize;
130-
}
131-
132120
double BasicSkinParams::GetNodePadding () const
133121
{
134122
return nodePadding;
@@ -194,6 +182,11 @@ SkinParams::SlotMarker BasicSkinParams::GetSlotMarker () const
194182
return slotMarker;
195183
}
196184

185+
SkinParams::SlotMarker BasicSkinParams::GetHiddenSlotMarker () const
186+
{
187+
return hiddenSlotMarker;
188+
}
189+
197190
const Size& BasicSkinParams::GetSlotMarkerSize () const
198191
{
199192
return slotMarkerSize;
@@ -266,8 +259,6 @@ const BasicSkinParams& GetDefaultSkinParams ()
266259
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
267260
/*connectionMarker*/ NUIE::SkinParams::ConnectionMarker::None,
268261
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
269-
/*hiddenConnectionMarkerBigSize*/ NUIE::Size (11.0, 11.0),
270-
/*hiddenConnectionMarkerSmallSize*/ NUIE::Size (6.0, 6.0),
271262
/*nodePadding*/ 5.0,
272263
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
273264
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
@@ -281,6 +272,7 @@ const BasicSkinParams& GetDefaultSkinParams ()
281272
/*slotTextColor*/ NUIE::Color (0, 0, 0),
282273
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
283274
/*slotMarker*/ NUIE::SkinParams::SlotMarker::None,
275+
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::None,
284276
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
285277
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
286278
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),

Sources/NodeUIEngine/NUIE_SkinParams.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class SkinParams
3838
enum class SlotMarker
3939
{
4040
None,
41-
Circle
41+
Circle,
42+
Rectangle
4243
};
4344

4445
SkinParams ();
@@ -48,8 +49,6 @@ class SkinParams
4849
virtual const Pen& GetConnectionLinePen () const = 0;
4950
virtual ConnectionMarker GetConnectionMarker () const = 0;
5051
virtual const Size& GetConnectionMarkerSize () const = 0;
51-
virtual const Size& GetHiddenConnectionMarkerBigSize () const = 0;
52-
virtual const Size& GetHiddenConnectionMarkerSmallSize () const = 0;
5352

5453
virtual double GetNodePadding () const = 0;
5554
virtual const Pen& GetNodeBorderPen () const = 0;
@@ -67,6 +66,7 @@ class SkinParams
6766
virtual const Color& GetSlotTextColor () const = 0;
6867
virtual const Color& GetSlotTextBackgroundColor () const = 0;
6968
virtual SlotMarker GetSlotMarker () const = 0;
69+
virtual SlotMarker GetHiddenSlotMarker () const = 0;
7070
virtual const Size& GetSlotMarkerSize () const = 0;
7171

7272
virtual const BlendColor& GetDisabledBlendColor () const = 0;
@@ -98,8 +98,6 @@ class BasicSkinParams : public SkinParams
9898
const Pen& connectionLinePen,
9999
ConnectionMarker connectionMarker,
100100
const Size& connectionMarkerSize,
101-
const Size& hiddenConnectionMarkerBigSize,
102-
const Size& hiddenConnectionMarkerSmallSize,
103101
const double& nodePadding,
104102
const Pen& nodeBorderPen,
105103
const Font& nodeHeaderTextFont,
@@ -113,6 +111,7 @@ class BasicSkinParams : public SkinParams
113111
const Color& slotTextColor,
114112
const Color& slotTextBackgroundColor,
115113
SlotMarker slotMarker,
114+
SlotMarker hiddenSlotMarker,
116115
const Size& slotMarkerSize,
117116
const BlendColor& disabledBlendColor,
118117
const BlendColor& selectionBlendColor,
@@ -133,8 +132,6 @@ class BasicSkinParams : public SkinParams
133132
virtual const Pen& GetConnectionLinePen () const override;
134133
virtual ConnectionMarker GetConnectionMarker () const override;
135134
virtual const Size& GetConnectionMarkerSize () const override;
136-
virtual const Size& GetHiddenConnectionMarkerBigSize () const override;
137-
virtual const Size& GetHiddenConnectionMarkerSmallSize () const override;
138135

139136
virtual double GetNodePadding () const override;
140137
virtual const Font& GetNodeContentTextFont () const override;
@@ -150,6 +147,7 @@ class BasicSkinParams : public SkinParams
150147
virtual const Color& GetSlotTextColor () const override;
151148
virtual const Color& GetSlotTextBackgroundColor () const override;
152149
virtual SlotMarker GetSlotMarker () const override;
150+
virtual SlotMarker GetHiddenSlotMarker () const override;
153151
virtual const Size& GetSlotMarkerSize () const override;
154152

155153
virtual const BlendColor& GetDisabledBlendColor () const override;
@@ -173,8 +171,6 @@ class BasicSkinParams : public SkinParams
173171
Pen connectionLinePen;
174172
ConnectionMarker connectionMarker;
175173
Size connectionMarkerSize;
176-
Size hiddenConnectionMarkerBigSize;
177-
Size hiddenConnectionMarkerSmallSize;
178174

179175
double nodePadding;
180176
Pen nodeBorderPen;
@@ -192,6 +188,7 @@ class BasicSkinParams : public SkinParams
192188
Color slotTextColor;
193189
Color slotTextBackgroundColor;
194190
SlotMarker slotMarker;
191+
SlotMarker hiddenSlotMarker;
195192
Size slotMarkerSize;
196193

197194
BlendColor disabledBlendColor;

Sources/WindowsReferenceApp/AppUIEnvironment.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ static const NUIE::BasicSkinParams& GetAppSkinParams ()
1919
/*connectionLinePen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
2020
/*connectionMarker */ NUIE::SkinParams::ConnectionMarker::Circle,
2121
/*connectionMarkerSize*/ NUIE::Size (8.0, 8.0),
22-
/*hiddenConnectionMarkerBigSize*/ NUIE::Size (11.0, 11.0),
23-
/*hiddenConnectionMarkerSmallSize*/ NUIE::Size (6.0, 6.0),
2422
/*nodePadding*/ 5.0,
2523
/*nodeBorderPen*/ NUIE::Pen (NUIE::Color (38, 50, 56), 1.0),
2624
/*nodeHeaderTextFont*/ NUIE::Font (L"Arial", 16.0),
@@ -34,6 +32,7 @@ static const NUIE::BasicSkinParams& GetAppSkinParams ()
3432
/*slotTextColor*/ NUIE::Color (0, 0, 0),
3533
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
3634
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
35+
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::Rectangle,
3736
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
3837
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
3938
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),

0 commit comments

Comments
 (0)