Graph Editor : UX Updates Towards "Keyboardless" Workflow - #3043
Conversation
- RMB add node - RMB on hamburger in node -> popup menu. Add only delete for now Fix: CTRL-F search without also trigger focus (F).
Add "rename" to menu.
- Bypass imgui node editor F key invocation which is always triggered regardless of modifiers. This is the main source of the bug.
- Disable hamburger on read-only nodes and disallow rename / delete on any read-only graphs.
- Extract out node width computation utility for us bye hamburger as well as previous pin placement.
…ed up pin layouts.
Disable RMB add popup on readonly graphs
| const float BASE_UI_FONT_SIZE = 18.0f; | ||
| const float BASE_PIN_ICON_SIZE = 18.0f; | ||
| const float MIN_PIN_ICON_SIZE = 18.0f; | ||
| const float HDR_TEXT_INDENT = 4.0f; |
There was a problem hiding this comment.
Global header indent
| _layoutPending(false), | ||
| _needsNavigation(false), | ||
| _delete(false), | ||
| _nodeMenuToOpen(-1), |
There was a problem hiding this comment.
Track node menu popup and deletion info if delete chosen
|
|
||
| void Graph::drawNodeMenu(UiNodePtr node) | ||
| { | ||
| const float buttonSize = computeHamburgerSize(); |
There was a problem hiding this comment.
Node menu icon : "hamburger"
|
|
||
| float Graph::computeNodeContentWidth(UiNodePtr node) | ||
| { | ||
| // Compute the node's content width (widest of the title row, shown |
There was a problem hiding this comment.
Utilitly to compute max text width for node
| ImColor(ImColor(85, 85, 85, 255)), 0.f); | ||
| ImGui::Indent(hdrTextIndent); | ||
| ImGui::Text("%s", node->getName().c_str()); | ||
| ImGui::TextUnformatted(node->getName().c_str()); |
There was a problem hiding this comment.
Extend title with node menu icon.
| addPinPopup(); | ||
| readOnlyPopup(); | ||
| ImGui::PopStyleVar(); | ||
| _nodeMenuRects.clear(); |
| _popup = true; | ||
| } | ||
| } | ||
| deleteNodeById(id); |
There was a problem hiding this comment.
Uses common delete node logic.
| // this frame and restore them immediately after. | ||
| if ((io2.KeyCtrl || io2.KeySuper) && ImGui::IsKeyPressed(ImGuiKey_F)) | ||
| { | ||
| ed::EnableShortcuts(false); |
There was a problem hiding this comment.
This was very tricky to fix since you need to superscede the imgui node editor logic which always assumes F key (regardless of modifier) is pressed. Reulsint in CMD/CTRL-F always kicking off "focus on node" logic.
|
|
||
| // Options | ||
| bool _saveNodePositions; | ||
| std::vector<ImVec4> _nodeMenuRects; |
There was a problem hiding this comment.
Used to track node menu location (hamburger) for hover hilighting
| // Create editor config and context. | ||
| ed::Config config; | ||
| config.SettingsFile = nullptr; | ||
| config.DragButtonIndex = 0; |
There was a problem hiding this comment.
Set mapping of mouse buttons.
|
@lfl-eholthouser, @jstone-lucasfilm : if you have some time could you take a look at this PR. It addresses a few issues but naturally not all but maybe useful to allow building on further for upcoming dev days. Thanks. |
|
Thanks for this proposal, @kwokcb! The rename consolidation and the Ctrl+F fix both look like clear improvements, and I'd be glad to see them merged soon. The new On the mouse remap, I'd suggest we reconsider before merging. The PR moves panning to the middle button to avoid a conflict with a right-click menu, but ImGui Node Editor already resolves that conflict for us: its
If the hamburger feature is included in the current PR, I'd expect it to respond to a left click, matching the convention for that control. The MacOS scaling change in A few smaller notes:
Given the above, one option would be to split the rename and Ctrl+F work into a PR we can merge right away, with the context menu work following on the editor's native API. Does that approach sound good to you? |
Updates
Update #3037.
Fixes #3032.
Add "Add node" :
RMBon backgroundAdd "hamburger" control :
RMBbrings up context senstive menu.Changes pan to
MMBto avoid mouse conflicts and maps properly for 2-button mice / pen / touch.LMBusage for select / placement / connection workflow is unchanged. (2)Fix so that focus (
F) does not occur when usingCTRL-F(search)Notes:
(1) Rename is in-menu to avoid constant renaming causing "flashing" in UI and slow re-render on every keystroke.
(2) the remapping of pan should make it more consistent with DCCs / Web based editors and can handle 2-button mice / touch interfaces.
Implementation
Some refactoring for code reuse as much as possible for shared actions between keyboard vs mouse actions.
Results