Skip to content

Commit 3b1441e

Browse files
committed
- Fixup ImGui::GetKeyIndex usage
1 parent 872b36a commit 3b1441e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

libs/node_editor/imgui_node_editor.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,15 +4391,16 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
43914391
Action candidateAction = None;
43924392

43934393
auto& io = ImGui::GetIO();
4394-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X)))
4394+
// FIX(zig-gamedev): ImGui::GetKeyIndex was removed from imgui since imgui-node-editor v0.9.3 was released.
4395+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_X))
43954396
candidateAction = Cut;
4396-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C)))
4397+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_C))
43974398
candidateAction = Copy;
4398-
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
4399+
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_V))
43994400
candidateAction = Paste;
44004401
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(GetKeyIndexForD()))
44014402
candidateAction = Duplicate;
4402-
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
4403+
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_Space))
44034404
candidateAction = CreateNode;
44044405

44054406
if (candidateAction != None)
@@ -4953,7 +4954,8 @@ ed::EditorAction::AcceptResult ed::DeleteItemsAction::Accept(const Control& cont
49534954
return False;
49544955

49554956
auto& io = ImGui::GetIO();
4956-
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)) && Editor->AreShortcutsEnabled())
4957+
// FIX(zig-gamedev): ImGui::GetKeyIndex was removed from imgui since imgui-node-editor v0.9.3 was released.
4958+
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGuiKey_Delete) && Editor->AreShortcutsEnabled())
49574959
{
49584960
auto& selection = Editor->GetSelectedObjects();
49594961
if (!selection.empty())

0 commit comments

Comments
 (0)