-
Notifications
You must be signed in to change notification settings - Fork 437
MaterialX Graph Editor : Fix keyboard input for graph #3012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3148,7 +3148,11 @@ void Graph::graphButtons() | |
|
|
||
| // Menu keys | ||
| ImGuiIO& guiIO = ImGui::GetIO(); | ||
| if (guiIO.KeyCtrl && !_fileDialogSave.isOpened() && !_fileDialog.isOpened() && !_fileDialogGeom.isOpened()) | ||
| if (guiIO.KeyCtrl && | ||
| !guiIO.WantTextInput && | ||
| !_fileDialogSave.isOpened() && | ||
| !_fileDialog.isOpened() && | ||
| !_fileDialogGeom.isOpened()) | ||
| { | ||
| if (ImGui::IsKeyReleased(ImGuiKey_O)) | ||
| { | ||
|
|
@@ -3915,7 +3919,10 @@ void Graph::drawHelpMarker(const char* content) | |
|
|
||
| void Graph::addNodePopup(bool cursor) | ||
| { | ||
| bool open_AddPopup = (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && ImGui::IsKeyReleased(ImGuiKey_Tab)) || | ||
| ImGuiIO& io = ImGui::GetIO(); | ||
| bool open_AddPopup = (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && | ||
| !io.WantTextInput && | ||
| ImGui::IsKeyReleased(ImGuiKey_Tab)) || | ||
| (_pinFilterType != mx::EMPTY_STRING && ImGui::IsMouseReleased(0)); | ||
| static char input[32]{ "" }; | ||
| if (open_AddPopup) | ||
|
|
@@ -4039,7 +4046,11 @@ void Graph::addNodePopup(bool cursor) | |
|
|
||
| void Graph::searchNodePopup(bool cursor) | ||
| { | ||
| const bool open_search = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && ImGui::IsKeyDown(ImGuiKey_F) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl); | ||
| const ImGuiIO& io = ImGui::GetIO(); | ||
| const bool open_search = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Must consider children since graph editor and property editor are now children not directly at root. |
||
| !io.WantTextInput && | ||
| io.KeyCtrl && | ||
| ImGui::IsKeyReleased(ImGuiKey_F); | ||
| if (open_search) | ||
| { | ||
| cursor = true; | ||
|
|
@@ -4295,10 +4306,18 @@ void Graph::drawGraph(ImVec2 mousePos) | |
|
|
||
| selectedNodes.resize(nodeCount); | ||
| selectedLinks.resize(linkCount); | ||
| if (io2.KeyCtrl && io2.MouseDown[0]) | ||
| { | ||
| _ctrlClick = true; | ||
| } | ||
|
|
||
| // Keep ctrl-click state frame-local; stale true blocks connection copy in paste. | ||
| _ctrlClick = io2.KeyCtrl && io2.MouseDown[0]; | ||
|
|
||
| const bool graphShortcutContext = | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Robust hotkey filtering checking for graphing area. |
||
| ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && | ||
| !io2.WantTextInput && | ||
| !_fileDialogSave.isOpened() && | ||
| !_fileDialog.isOpened() && | ||
| !_fileDialogGeom.isOpened() && | ||
| !ImGui::IsPopupOpen("add node") && | ||
| !ImGui::IsPopupOpen("search"); | ||
|
|
||
| // Set current node based off of selected node | ||
| if (selectedNodes.size() > 0) | ||
|
|
@@ -4326,7 +4345,7 @@ void Graph::drawGraph(ImVec2 mousePos) | |
| } | ||
|
|
||
| // Check if keyboard shortcuts for copy/cut/paste have been used | ||
| if (ed::BeginShortcut()) | ||
| if (graphShortcutContext && ed::BeginShortcut()) | ||
| { | ||
| if (ed::AcceptCopy()) | ||
| { | ||
|
|
@@ -4465,7 +4484,7 @@ void Graph::drawGraph(ImVec2 mousePos) | |
|
|
||
| // Delete selected nodes and their links if delete key is pressed | ||
| // or if the shortcut for cut is used | ||
| if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow)) | ||
| if (graphShortcutContext) | ||
| { | ||
| bool traverseDownstream = ImGui::IsKeyReleased(ImGuiKey_RightArrow); | ||
| bool traverseUpstream = ImGui::IsKeyReleased(ImGuiKey_LeftArrow); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WantTextInput()added in various places to avoid text input / graph hotkey collisions. Used along with focus tests.