Skip to content

Commit 914224c

Browse files
committed
Modify hidden connection marker.
1 parent 30e653d commit 914224c

14 files changed

Lines changed: 218 additions & 118 deletions

Sources/BuiltInNodes/BI_UINodePanels.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,21 +274,21 @@ void NodeUISlotPanel::Draw (NUIE::NodeUIDrawingEnvironment& env, const NUIE::Rec
274274
drawingImage.AddInputSlotConnPosition (slotId, slotRect.GetLeftCenter ());
275275
drawingImage.AddInputSlotRect (slotId, slotRect);
276276

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 ();
283-
}
284-
285-
if (slotMarker == NUIE::SkinParams::SlotMarker::Circle) {
277+
if (skinParams.GetSlotMarker () == NUIE::SkinParams::SlotMarker::Circle) {
286278
NUIE::Rect markerRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetSlotMarkerSize ());
287279
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillEllipse (markerRect, skinParams.GetSlotTextBackgroundColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
288280
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingEllipse (markerRect, skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
289-
} else if (slotMarker == NUIE::SkinParams::SlotMarker::FilledCircle) {
290-
NUIE::Rect markerRect = NUIE::Rect::FromCenterAndSize (slotRect.GetLeftCenter (), skinParams.GetSlotMarkerSize ());
291-
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillEllipse (markerRect, skinParams.GetConnectionLinePen ().GetColor ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
281+
}
282+
283+
if (skinParams.GetHiddenSlotMarker () == NUIE::SkinParams::HiddenSlotMarker::Arrow) {
284+
bool hasHiddenConnection = (uiSlot->GetConnectionDisplayMode () == NUIE::ConnectionDisplayMode::Hidden && node.IsInputSlotConnected (uiSlot->GetId ()));
285+
if (hasHiddenConnection) {
286+
const NUIE::Size markerSize = skinParams.GetSlotMarkerSize ();
287+
NUIE::Point hiddenConnectionCenter = slotRect.GetLeftCenter () - NUIE::Point (markerSize.GetWidth () / 3.0 * 2.0, 0.0);
288+
NUIE::Rect markerRect = NUIE::Rect::FromCenterAndSize (hiddenConnectionCenter, skinParams.GetSlotMarkerSize ());
289+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingLine (markerRect.GetTopCenter (), markerRect.GetLeftCenter (), skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
290+
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingLine (markerRect.GetLeftCenter (), markerRect.GetBottomCenter (), skinParams.GetConnectionLinePen ())), NUIE::DrawingContext::ItemPreviewMode::HideInPreview);
291+
}
292292
}
293293

294294
drawingImage.AddItem (NUIE::DrawingItemConstPtr (new NUIE::DrawingFillRect (slotRect, skinParams.GetSlotTextBackgroundColor ())));

Sources/MacOSEmbeddingDemo/Application.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ - (void) windowDidResize : (NSNotification *) notification
127127
/*slotTextColor*/ NUIE::Color (0, 0, 0),
128128
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
129129
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
130-
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::FilledCircle,
130+
/*hiddenSlotMarker*/ NUIE::SkinParams::HiddenSlotMarker::Arrow,
131131
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
132132
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
133133
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),

Sources/NodeEngineTest/GeometryTest.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,47 @@ TEST (RectTest)
9292
ASSERT (IsEqual (r1.Expand (Size (5.0, 6.0)), Rect::FromCenterAndSize (r1.GetCenter (), r1.GetSize () + Size (5.0, 6.0))));
9393
}
9494

95+
TEST (RectExpandTest)
96+
{
97+
{
98+
Rect rect (0.0, 0.0, 1.0, 1.0);
99+
100+
Rect expandedHorizontally = rect.ExpandHorizontally (1.0, 1.0);
101+
ASSERT (IsEqual (expandedHorizontally.GetLeft (), -1.0));
102+
ASSERT (IsEqual (expandedHorizontally.GetRight (), 2.0));
103+
104+
Rect expandedVertically = rect.ExpandVertically (1.0, 1.0);
105+
ASSERT (IsEqual (expandedVertically.GetTop (), -1.0));
106+
ASSERT (IsEqual (expandedVertically.GetBottom (), 2.0));
107+
}
108+
109+
{
110+
Rect rect (0.0, 0.0, 1.0, 1.0);
111+
112+
Rect expandedHorizontally = rect.ExpandHorizontally (1.0, 0.0);
113+
ASSERT (IsEqual (expandedHorizontally.GetLeft (), -1.0));
114+
ASSERT (IsEqual (expandedHorizontally.GetRight (), 1.0));
115+
116+
Rect expandedVertically = rect.ExpandVertically (1.0, 0.0);
117+
ASSERT (IsEqual (expandedVertically.GetTop (), -1.0));
118+
ASSERT (IsEqual (expandedVertically.GetBottom (), 1.0));
119+
}
120+
121+
{
122+
Rect rect (1.0, 1.0, 2.0, 2.0);
123+
124+
Rect expandedHorizontally = rect.ExpandHorizontally (2.0, 3.0);
125+
ASSERT (IsEqual (expandedHorizontally, Rect (-1.0, 1.0, 7.0, 2.0)));
126+
ASSERT (IsEqual (expandedHorizontally.GetWidth (), 7.0));
127+
ASSERT (IsEqual (expandedHorizontally.GetHeight (), 2.0));
128+
129+
Rect expandedVertically = rect.ExpandVertically (2.0, 3.0);
130+
ASSERT (IsEqual (expandedVertically, Rect (1.0, -1.0, 2.0, 7.0)));
131+
ASSERT (IsEqual (expandedVertically.GetWidth (), 2.0));
132+
ASSERT (IsEqual (expandedVertically.GetHeight (), 7.0));
133+
}
134+
}
135+
95136
TEST (BoundingRectTest_FromRects)
96137
{
97138
BoundingRect boundingRect;

Sources/NodeEngineTest/NodeEditorVisualTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const BasicSkinParams& GetSkinParamsWithMarkers ()
3232
/*nodeContentBackgroundColor*/ NUIE::Color (236, 236, 236),
3333
/*slotTextColor*/ NUIE::Color (0, 0, 0),
3434
/*slotTextBackgroundColor*/ NUIE::Color (246, 246, 246),
35-
/*slotMarker*/ SkinParams::SlotMarker::Circle,
36-
/*hiddenSlotMarker*/ NUIE::SkinParams::SlotMarker::FilledCircle,
35+
/*slotMarker*/ NUIE::SkinParams::SlotMarker::Circle,
36+
/*hiddenSlotMarker*/ NUIE::SkinParams::HiddenSlotMarker::Arrow,
3737
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
3838
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (41, 127, 255), 0.25),
3939
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),
@@ -590,8 +590,8 @@ TEST (SkinParamsTest)
590590
/*nodeContentBackgroundColor*/ NUIE::Color (180, 200, 180),
591591
/*slotTextColor*/ NUIE::Color (100, 100, 0),
592592
/*slotTextBackgroundColor*/ NUIE::Color (180, 250, 250),
593-
/*slotMarker*/ SkinParams::SlotMarker::None,
594-
/*hiddenSlotMarker*/ SkinParams::SlotMarker::None,
593+
/*slotMarker*/ NUIE::SkinParams::SlotMarker::None,
594+
/*hiddenSlotMarker*/NUIE::SkinParams::HiddenSlotMarker::None,
595595
/*slotMarkerSize*/ NUIE::Size (8.0, 8.0),
596596
/*selectionBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 0, 255), 0.25),
597597
/*disabledBlendColor*/ NUIE::BlendColor (NUIE::Color (0, 138, 184), 0.2),

Sources/NodeEngineTest/VisualTestFiles/HideConnectionsTest_ConnectionHidden.svg

Lines changed: 4 additions & 1 deletion
Loading

Sources/NodeEngineTest/VisualTestFiles/HideConnectionsTest_Viewer2Selected.svg

Lines changed: 4 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)