Page MenuHome

Show only applicable operators in context menus when nothing is selected
Needs ReviewPublic

Authored by William Reynish (billreynish) on Feb 23 2020, 1:49 PM.

Details

Summary

This follows from the design doc here: T74158

A weak point of our context menus, is that currently they don't show correct operators when nothing is selected - we just give users a list of operators that don't work in the case, and which throw a variety of error messages. I find this to be a poor user experience.


In a situation like this, when nothing is selected, the operators in here don't do anything - sometimes they silently fail, other times the user is presented with an error message, as seen here:


or

This patch makes it so we show the Add menu, plus other operators that make sense in this case. This has the additional benefit of making the Add menu more discoverable.

Only the 3D View Object Mode and mesh Edit Mode are covered here, but if accepted, other editors and modes can be added too.

Here's the 3D View Object Context Menu with nothing selected:

Currently there is support for:

  • 3D View Object Mode
  • 3D View Mesh Edit Mode
  • 3D View Curve Edit Mode
  • 3D View GP Edit Mode (although the check is different. Here it's a bool, which is faster I think)
  • 3D View Armature Edit Mode
  • 3D View Armature Pose Mode
  • Sequencer
  • F-Curve Editor

This patch is missing checks for:

  • 3DView Lattice Edit Mode (checks for selection, content needed)
  • 3DView Meta Ball Edit Mode (checks for selection, content needed)
  •  UV Editor
  •  Dope Sheet
  •  NLA Editor
  •  Text Editor
  •  Info Editor

Diff Detail

Repository
rB Blender
Branch
D6914-update (branched from master)
Build Status
Buildable 7218
Build 7218: arc lint + arc unit

Event Timeline

William Reynish (billreynish) edited the summary of this revision. (Show Details)
Brecht Van Lommel (brecht) added inline comments.
release/scripts/startup/bl_ui/space_view3d.py
2356

It would make sense maybe to show both copy & paste, but have copy grayed out? To me it's a bit to have one without the other, and having them both together also explains better what the paste operator does. And then add a separator after the add menu.

3502

I'd put a separator between add and knife.

This revision is now accepted and ready to land.Feb 24 2020, 10:11 PM

The snap menu's cursor operations are valid even without selection, if we are being strict on including operations that can be used when there is no selection, this menu could be added back.

Having the knife accessible feels a bit odd, noted inline.

release/scripts/startup/bl_ui/space_view3d.py
3502

It's a bit odd showing the knife tool when there is nothing selected.

It's more an editing function than a creation tool, and if we're showing arbitrary tools that happen to work without selection - we could include loop-cut & poly-build too.

@Campbell Barton (campbellbarton) the Knife tool happens to work without selections, that’s why. It’s not about adding exceptions - on the contrary.

@Campbell Barton (campbellbarton) the Knife tool happens to work without selections, that’s why. It’s not about adding exceptions - on the contrary.

There are other tools that happen to work without selections too. Loopcut as an example, poly-build could be included too.

Does it make sense to include arbitrary tools which happen to work without selections when users will typically use the toolbar or key shortcuts to access them?

  • Add separator in the Mesh edit mode context menus
  • Add support for Armature Edit and Pose modes
Campbell Barton (campbellbarton) requested changes to this revision.Feb 25 2020, 12:01 PM

Some of the context menus have "Reveal", shouldn't this be added in all cases where hide/reveal is available?

release/scripts/startup/bl_ui/space_view3d.py
3364

No need for the else block, since there is a return above.

4527

Ditto, else shouldn't be needed here.

This revision now requires changes to proceed.Feb 25 2020, 12:01 PM

@Campbell Barton (campbellbarton) agree it's inconsistent. I would probably rather remove it from Pose Mode than add it everywhere else.

  • Remove unnecessary use of else statements
  • Remove Hide/Reveal from pose mode context menus for consistency
  • Add support for the node editors and Sequencer
  • Add support for the Graph Editor

Remove comment that is no longer applicable.

Campbell Barton (campbellbarton) requested changes to this revision.EditedFeb 26 2020, 1:06 AM

Could this patch be completed for all context menus before final review?

  • Rename doesn't require selected, it uses active (Object, Armature, Pose, Node, Sequencer).
  • Sequencer "Toggle Meta" doesn't require selection to exit.
  • Sequencer "Remove Gaps" & "Insert Gaps" doesn't require selection.
  • Sequencer "Add Modifier" uses the active strip, not selection.
  • Sequencer Mute/Unmute menu also has actions that operate on unselected strips.
This revision now requires changes to proceed.Feb 26 2020, 1:06 AM

Update Sequencer context menus to show the items mentioned above

Perhaps the delete context menu (in edit mode) can also be ignored when there's no selection. Right now you are prompted with the delete menu even when you (accidentally) did not select anything.

  • Add support for GP edit mode. Thanks to @antonioya for the heads up
William Reynish (billreynish) edited the summary of this revision. (Show Details)
William Reynish (billreynish) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)

Add meta-element and lattice selection checks (content is marked TODO)

Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)