Page MenuHome

UI: Refactor Node Context Menu
ClosedPublic

Authored by Pablo Vazquez (pablovazquez) on Oct 11 2022, 1:40 AM.

Details

Summary
The Problem

The Node Context Menu currently contains options that are not always available, and misses some important entries for accesibility. Sorting and grouping is also not very intuitive and aligned with the rest of Blender:

Solution

This patch covers the following:

  • Add operators to join and remove from frames.
  • Add Insert into Group
  • Sort and group entries more logically.
  • Show group actions only on nodes that support it.
  • Move all toggles to a sub-menu called Toggle.
  • In the Compositor, show Node Preview under Toggle, even though not all nodes have a preview. Should this be shown in custom node trees?
  • When nothing is selected, show Add menu, links actions, and paste.

Some more restrictions can be done but I think they should be done via poll in each operator.

Screenshots

When no nodes are selected:

When a node that can't be grouped is selected:

When a node group is selected:

When more than one node is selected, show link options:

Toggle menu:

Select menu:

Diff Detail

Repository
rB Blender
Branch
node-context-menu (branched from master)
Build Status
Buildable 24213
Build 24213: arc lint + arc unit

Event Timeline

Pablo Vazquez (pablovazquez) requested review of this revision.Oct 11 2022, 1:40 AM
Pablo Vazquez (pablovazquez) created this revision.
  • Check for active node.

Hey! Newcomer-ish here, getting my feet wet at contributing.

Some questions have crossed my mind while reading the patch:

  • If I don't have an active node, the code keeps me from making a group from my selection. Is this intended behaviour? (Regarding line 501)
  • If my active node happens to be an "ungrouppable" node, can't I just group the remaining ones? When accessed with ctrl+G, the "make group" operator seems to simply ignore bad nodes, which is quite convenient.
  • While we're at it, perhaps it'd be time to consider unifying the operator names "Delete and reconnect" and "Dissolve", for consistency's sake? While used in wildly different contexts, they seem intuitively quite similar.

@Pablo Vazquez (pablovazquez) Since you're talking refactor here... 🙂
The Ctrl + Shift + Click hotkey to toggle the new rBc55d38f00b8c: Geometry Nodes: viewport preview is cool but it's somewhat a hidden hotkey and hard to discover, imo... Would be nice to have a "legal" way of accessing it, and the node context menu seems to be the right place for it, don't you think?

Hey! Newcomer-ish here, getting my feet wet at contributing.

Welcome!

Some questions have crossed my mind while reading the patch:

  • If I don't have an active node, the code keeps me from making a group from my selection. Is this intended behaviour? (Regarding line 501)

Good catch, this was an oversight. Will fix it.

  • If my active node happens to be an "ungrouppable" node, can't I just group the remaining ones? When accessed with ctrl+G, the "make group" operator seems to simply ignore bad nodes, which is quite convenient.

Didn't notice that Group Input/Output nodes had that behaviour, neat. The Render Layers node is not as flexible and simply throws an error, perhaps better to allow grouping regardless of selection, and change how that node behaves instead of adding the logic in the menu. I think I'll do this.

  • While we're at it, perhaps it'd be time to consider unifying the operator names "Delete and reconnect" and "Dissolve", for consistency's sake? While used in wildly different contexts, they seem intuitively quite similar.

Nice one! Indeed it's a completely different context and a bit of a strange word to use here but only the first time, and Delete with Reconnect is too long anyway. I think only the menu entry should change, the operator should still be Delete with Reconnect, so it's easier to search as "delete".

Address feedback and minor improvements

  • Add Link to Viewer and Clear Viewer operators.
  • Add Select menu to expose very handy operators such as select linked, grouped, and activate same type.
  • Add "Find" entry when there are no selected nodes.
  • Remove limitation of grouping certain elements, Group Input/Output nodes are already ignored when trying to group. This should be done to the RenderLayers node.
  • Rename Delete with Reconnect to Dissolve (only in the Context Menu, renaming in other place should be a separate patch).
  • Minor changes in icons and separators.
  • Add Exit Group menu entry, when inside a group.

This looks like a great improvement!
My only concern is the "Toggle" sub-menu. The naming seems a little awkward, like it's categorizing by button type rather than some more meaningful distinction.
Some properties like "Mute" could be exposed directly in the menu with a checkbox.

Pablo Vazquez (pablovazquez) edited the summary of this revision. (Show Details)
  • Use checkbox for Mute toggle, as suggested by Hans (thanks!)

This looks like a great improvement!

Thanks! This menu has been in the to-do since 2.80 days, it was time to tackle it.

Some properties like "Mute" could be exposed directly in the menu with a checkbox.

Ah much nicer indeed! Updated the patch.

My only concern is the "Toggle" sub-menu. The naming seems a little awkward, like it's categorizing by button type rather than some more meaningful distinction.

I wasn't too happy with it either. How about Show/Hide?, we use it in other places already. Moving the Mute toggle outside it kind of makes sense now.

Mockup (not part of the patch yet)

I wasn't too happy with it either. How about Show/Hide?, we use it in other places already. Moving the Mute toggle outside it kind of makes sense now.

That looks better to me!

  • Rename Toggle menu to Show/Hide, following other areas in Blender
  • Merge branch 'master'

Generally seems good. Just wanted to mention that the Link to Viewer doesn't quite work right now, because it uses the node/socket under the mouse instead of the active one. Maybe using node.link_viewer works instead of node.select_link_viewer, haven't tried right now.

  • Merge branch 'master'
  • Use node.link_viewer instead of select_link_viewer as suggested by Jacques.

Generally seems good. Just wanted to mention that the Link to Viewer doesn't quite work right now, because it uses the node/socket under the mouse instead of the active one. Maybe using node.link_viewer works instead of node.select_link_viewer, haven't tried right now.

Indeed works much better, thanks!

  • Merge branch 'master'

Looks good to me, and is a nice improvement in my testing. Just two notes:

  • I mentioned earlier that we could use the "Mute" checkbox instead of the operator. That's nice, but it only works with the active node, which seems weird when more than one node is selected. It also doesn't display the shortcut. So maybe better to switch back to the operator for now.
  • Not a big deal, but for the commit message it's best to leave out the videos and images and just leave them for the diff.
This revision is now accepted and ready to land.Nov 17 2022, 11:14 PM

Thanks! Indeed it's better with the mute as an operator.

  • Revert "- Use checkbox for Mute toggle"
This revision was automatically updated to reflect the committed changes.