Skip to content

Commit 3bab401

Browse files
committed
Editor: Minimum supported version is now Dear ImGui 1.89 (August 2022)
1 parent a4a34ab commit 3bab401

File tree

3 files changed

+14
-56
lines changed

3 files changed

+14
-56
lines changed

docs/CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ v0.10.0 (WIP):
44
From this point ed::EndCreate() and ed::EndDelete() can only be called when
55
ed::BeginCreate() and ed::BeginDelete() calls were successful.
66

7+
BREAKING: Editor: Minimum supported version is now Dear ImGui 1.89 (August 2022)
8+
79
RESTRUCTURE:
810
Removed local copy of all dependencies in favor of auto checkout. This should also reduce
911
user confusion and attempt to use ancient version of ImGui embedded in the repository.

imgui_node_editor.cpp

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -40,46 +40,10 @@ namespace ax {
4040
namespace NodeEditor {
4141
namespace Detail {
4242

43-
# if !defined(IMGUI_VERSION_NUM) || (IMGUI_VERSION_NUM < 18822)
44-
# define DECLARE_KEY_TESTER(Key) \
45-
DECLARE_HAS_NESTED(Key, Key) \
46-
struct KeyTester_ ## Key \
47-
{ \
48-
template <typename T> \
49-
static int Get(typename std::enable_if<has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
50-
{ \
51-
return ImGui::GetKeyIndex(T::Key); \
52-
} \
53-
\
54-
template <typename T> \
55-
static int Get(typename std::enable_if<!has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
56-
{ \
57-
return -1; \
58-
} \
59-
}
60-
61-
DECLARE_KEY_TESTER(ImGuiKey_F);
62-
DECLARE_KEY_TESTER(ImGuiKey_D);
63-
64-
static inline int GetKeyIndexForF()
65-
{
66-
return KeyTester_ImGuiKey_F::Get<ImGuiKey_>(nullptr);
67-
}
68-
69-
static inline int GetKeyIndexForD()
70-
{
71-
return KeyTester_ImGuiKey_D::Get<ImGuiKey_>(nullptr);
72-
}
73-
# else
74-
static inline ImGuiKey GetKeyIndexForF()
75-
{
76-
return ImGuiKey_F;
77-
}
78-
79-
static inline ImGuiKey GetKeyIndexForD()
80-
{
81-
return ImGuiKey_D;
82-
}
43+
# if !defined(IMGUI_VERSION_NUM)
44+
# error IMGUI_VERSION_NUM is not defined, please update Dear ImGui copy to at least 1.89 (August 2022)
45+
# elif IMGUI_VERSION_NUM < 18900
46+
# error Please update Dear ImGui copy to at least 1.89 (August 2022)
8347
# endif
8448

8549
} // namespace Detail
@@ -129,11 +93,7 @@ static const float c_SelectionFadeOutDuration = 0.15f; // seconds
12993
static const auto c_MaxMoveOverEdgeSpeed = 10.0f;
13094
static const auto c_MaxMoveOverEdgeDistance = 300.0f;
13195

132-
#if IMGUI_VERSION_NUM > 18101
13396
static const auto c_AllRoundCornersFlags = ImDrawFlags_RoundCornersAll;
134-
#else
135-
static const auto c_AllRoundCornersFlags = 15;
136-
#endif
13797

13898

13999
//------------------------------------------------------------------------------
@@ -2565,7 +2525,7 @@ ed::Control ed::EditorContext::BuildControl(bool allowOffscreen)
25652525
# if IMGUI_VERSION_NUM >= 18836
25662526
if (m_IsHoveredWithoutOverlapp)
25672527
ImGui::SetItemKeyOwner(ImGuiKey_MouseWheelY);
2568-
# elif IMGUI_VERSION_NUM >= 17909
2528+
# else
25692529
if (m_IsHoveredWithoutOverlapp)
25702530
ImGui::SetItemUsingMouseWheel();
25712531
# endif
@@ -3333,7 +3293,7 @@ ed::EditorAction::AcceptResult ed::NavigateAction::Accept(const Control& control
33333293

33343294
auto& io = ImGui::GetIO();
33353295

3336-
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(GetKeyIndexForF()) && Editor->AreShortcutsEnabled())
3296+
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGuiKey_F) && Editor->AreShortcutsEnabled())
33373297
{
33383298
const auto zoomMode = io.KeyShift ? NavigateAction::ZoomMode::WithMargin : NavigateAction::ZoomMode::None;
33393299

@@ -4391,15 +4351,15 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
43914351
Action candidateAction = None;
43924352

43934353
auto& io = ImGui::GetIO();
4394-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X)))
4354+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_X))
43954355
candidateAction = Cut;
4396-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C)))
4356+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_C))
43974357
candidateAction = Copy;
4398-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
4358+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_V))
43994359
candidateAction = Paste;
4400-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(GetKeyIndexForD()))
4360+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_D))
44014361
candidateAction = Duplicate;
4402-
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
4362+
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_Space))
44034363
candidateAction = CreateNode;
44044364

44054365
if (candidateAction != None)
@@ -4953,7 +4913,7 @@ ed::EditorAction::AcceptResult ed::DeleteItemsAction::Accept(const Control& cont
49534913
return False;
49544914

49554915
auto& io = ImGui::GetIO();
4956-
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)) && Editor->AreShortcutsEnabled())
4916+
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGuiKey_Delete) && Editor->AreShortcutsEnabled())
49574917
{
49584918
auto& selection = Editor->GetSelectedObjects();
49594919
if (!selection.empty())

imgui_node_editor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@ struct Style
245245
PivotAlignment = ImVec2(0.5f, 0.5f);
246246
PivotSize = ImVec2(0.0f, 0.0f);
247247
PivotScale = ImVec2(1, 1);
248-
#if IMGUI_VERSION_NUM > 18101
249248
PinCorners = ImDrawFlags_RoundCornersAll;
250-
#else
251-
PinCorners = ImDrawCornerFlags_All;
252-
#endif
253249
PinRadius = 0.0f;
254250
PinArrowSize = 0.0f;
255251
PinArrowWidth = 0.0f;

0 commit comments

Comments
 (0)