Skip to content

Commit 7ca9e37

Browse files
committed
Disable node hiding by default.
1 parent 53d30ed commit 7ca9e37

5 files changed

Lines changed: 54 additions & 4 deletions

File tree

Sources/NodeEngineTest/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
#include "SimpleTest.hpp"
44
#include "NE_Debug.hpp"
5+
#include "NUIE_FeatureSet.hpp"
56

67
int main (int, char* argv[])
78
{
89
EnableLeakDetection ();
10+
NUIE::EnableFeature ("HideConnections", true);
911

1012
std::string executablePath (argv[0]);
1113
std::wstring wExecutablePath (executablePath.begin (), executablePath.end ());
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "NUIE_FeatureSet.hpp"
2+
3+
#include <unordered_map>
4+
5+
namespace NUIE
6+
{
7+
8+
static std::unordered_map<std::string, bool> features;
9+
10+
void EnableFeature (const std::string& featureId, bool enabled)
11+
{
12+
auto found = features.find (featureId);
13+
if (found == features.end ()) {
14+
features.insert ({ featureId, enabled });
15+
return;
16+
}
17+
found->second = enabled;
18+
}
19+
20+
bool IsFeatureEnabled (const std::string& featureId)
21+
{
22+
auto found = features.find (featureId);
23+
if (found == features.end ()) {
24+
return false;
25+
}
26+
return found->second;
27+
}
28+
29+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef NUIE_FEATURESET_HPP
2+
#define NUIE_FEATURESET_HPP
3+
4+
#include <string>
5+
6+
namespace NUIE
7+
{
8+
9+
void EnableFeature (const std::string& featureId, bool enabled);
10+
bool IsFeatureEnabled (const std::string& featureId);
11+
12+
}
13+
14+
#endif

Sources/NodeUIEngine/NUIE_UIInputSlot.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "NUIE_UIInputSlot.hpp"
22
#include "NUIE_NodeMenuCommands.hpp"
33
#include "NUIE_NodeUIManagerCommands.hpp"
4+
#include "NUIE_FeatureSet.hpp"
45

56
namespace NUIE
67
{
@@ -68,10 +69,12 @@ void UIInputSlot::RegisterCommands (InputSlotCommandRegistrator& commandRegistra
6869
ConnectionDisplayMode connDisplayMode;
6970
};
7071

71-
InputSlotGroupCommandPtr connectionDisplayGroupCommand (new NodeGroupCommand<InputSlotCommandPtr> (NE::LocString (L"Connection Display")));
72-
connectionDisplayGroupCommand->AddChildCommand (InputSlotCommandPtr (new SetConnectionDisplayModeCommand (NE::LocString (L"Normal"), connDisplayMode == ConnectionDisplayMode::Normal, ConnectionDisplayMode::Normal)));
73-
connectionDisplayGroupCommand->AddChildCommand (InputSlotCommandPtr (new SetConnectionDisplayModeCommand (NE::LocString (L"Hidden"), connDisplayMode == ConnectionDisplayMode::Hidden, ConnectionDisplayMode::Hidden)));
74-
commandRegistrator.RegisterSlotGroupCommand (connectionDisplayGroupCommand);
72+
if (IsFeatureEnabled ("HideConnections")) {
73+
InputSlotGroupCommandPtr connectionDisplayGroupCommand (new NodeGroupCommand<InputSlotCommandPtr> (NE::LocString (L"Connection Display")));
74+
connectionDisplayGroupCommand->AddChildCommand (InputSlotCommandPtr (new SetConnectionDisplayModeCommand (NE::LocString (L"Normal"), connDisplayMode == ConnectionDisplayMode::Normal, ConnectionDisplayMode::Normal)));
75+
connectionDisplayGroupCommand->AddChildCommand (InputSlotCommandPtr (new SetConnectionDisplayModeCommand (NE::LocString (L"Hidden"), connDisplayMode == ConnectionDisplayMode::Hidden, ConnectionDisplayMode::Hidden)));
76+
commandRegistrator.RegisterSlotGroupCommand (connectionDisplayGroupCommand);
77+
}
7578
}
7679

7780
NE::Stream::Status UIInputSlot::Read (NE::InputStream& inputStream)

Sources/WindowsReferenceApp/Application.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "Application.hpp"
2+
#include "NUIE_FeatureSet.hpp"
23
#include "WAS_WindowsAppUtils.hpp"
34
#include "WAS_GdiplusUtils.hpp"
45

@@ -25,6 +26,7 @@ void Application::Init (HWND hwnd)
2526
{
2627
InitFileMenu (hwnd);
2728
InitToolbar (hwnd);
29+
NUIE::EnableFeature ("HideConnections", true);
2830
uiEnvironment.Init (&nodeEditor, &fileMenu, &toolbar, hwnd);
2931
}
3032

0 commit comments

Comments
 (0)