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



