Page MenuHome

Object Context Menu tweaks for consistency
ClosedPublic

Authored by William Reynish (billreynish) on Jan 19 2021, 11:26 AM.

Details

Summary

Small tweak to the object context menu.

Currently, the object context menu includes a couple of inconsistencies between object types. This is a small patch that fixes these.

  • Adds the same ability to Join and Set Origin to all supported object types
  • Adds Set Active Camera for cameras
  • Adds Adjust Stroke Width for GP Objects
  • Adds Trace Image to Grease Pencil for Image Empties
  • A number of naming changes for consistency and clarity
    • Use 'Adjust...' for all entries that adjust properties rather than being normal operators
    • Follow naming conventions (ie Draw -> Display etc)
    • Less naming ambiguity and more correctness and consistency

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 12361
Build 12361: arc lint + arc unit

Event Timeline

William Reynish (billreynish) requested review of this revision.Jan 19 2021, 11:26 AM
William Reynish (billreynish) created this revision.

Accidentally included changes from a different patch

Campbell Barton (campbellbarton) requested changes to this revision.Jan 21 2021, 6:01 AM

The direction of this patch seems fine, the way object types are handled gets confusing in this patch.
Grouping {'MESH', 'CURVE', 'SURFACE', 'GPENCIL'} means if we want to add a mesh-only check later.

We could instead, have shared logic first, individual object types after. e.g. P1901

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

This fails if obj is None (checked below).

This revision now requires changes to proceed.Jan 21 2021, 6:01 AM
  • Use less confusing logic. This context menu is now divided into 3 sections, going from specific to the current selection at the top, to general towards the bottom:
    • Operators for Individual object types
    • Operators shared among some object types
    • Operators for all object types
  • Fix some wrong checks that made wrong operators appear for incompatible object types (such as Set Origin for text objects)

The object context menu is overall not changed much here from master - it's simply more consistent across object types and also more correct.

Accepting, it'd be good to check if the grease-pencil devs are OK with this, or - make that a separate patch.

release/scripts/startup/bl_ui/space_view3d.py
2447–2448

This can be removed if it's going to remain empty.

2517

among, also below.

2530

This shouldn't be needed. Multiple separators are now de-duplicated.

2540

among

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

Clarification: the if selected_objects_len == 1: shouldn't be needed.

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

I added that here to make sure there is always a separator after this group, even when the Join operator doesn't appear. Not sure how else to do that.

  • Fix spelling
  • Remove empty check for GP objects
William Reynish (billreynish) marked 2 inline comments as done.Jan 22 2021, 11:32 AM

Changes for cameras:

  • Add Set Active Camera operator
  • Rename Camera Lens Angle to Adjust Focal Length

Include the term 'adjust' to clarify that this will allow editing a value, and is not a normal operator. The lens angle part is at best ambiguous or at worst incorrect. Angle can mean the direction the camera points in, whereas focal length means exactly what this is, and only that.

  • Rename DOF Distance to Adjust Focus Distance

Include the term 'adjust' to clarify that this will allow editing a value, and is not a normal operator. The 'DOF Distance' part is absolutely not correct terminology. The depth of field is the part that is in in focus. Changing the 'depth of field distance' would mean to change the length of area that is in focus, which is a factor of the sensor size, the focal length and the F-stop. Additionally, this name change avoids having to use an abbreviation. Focus distance is unambiguous and more correct.

  • Updates for curves and lights to include similar consistent naming logic as for cameras
    • Use 'Adjust' again to communicate that you are affecting a value.
    • Add 'Light' to the names to help communicate what is affected. It was somewhat ambiguous
    • Improve the naming for area lamps. Use X/Y Size when affecting non-uniform area light types, but just Size when adjusting uniform area lights. Previously it would say 'X' when it was in fact affecting uniform areas.
  • Rename Empty Draw Size to Empty Display Size (following naming conventions)
  • Similar changes for curves

Overall I like the change, it's much better to have operator labels phrased as actions rather than just the name of the property they affect.

Having the specific context sensitive settings at the top is also nice.

For spot_blend and spot_size, the labels here are now slightly different from the property names. The differences are small, but it's probably good to stay consistent-- for example choosing "Blend" or "Blending" for both the property name and this menu item (and also the header label for the modal).

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

This should probably have a check for whether the object is actually an image empty:
if (obj.empty_display_type == 'IMAGE'):
Also, using the grease pencil icon (, icon='OUTLINER_OB_GREASEPENCIL') is helps to distinguish it, since it's different than the other operators exposed here.

  • De-duplicate separator
  • Fix 'Width Size' header text to use correct terminology
  • Make it show Batch Rename when you have more than one object selected

Address review comments

William Reynish (billreynish) marked 3 inline comments as done.Jan 22 2021, 8:06 PM
  • Simplify check for None
William Reynish (billreynish) marked an inline comment as done.Jan 22 2021, 8:26 PM
  • Add back Convert To but in a submenu that only shows for objects that can be converted
  • Add Adjust Stroke Thickness for GPencil objects

After feedback from the GP team, remove Adjust Stroke Thickness.

Campbell Barton (campbellbarton) requested changes to this revision.Jan 25 2021, 2:22 AM
  • I don't see any issues with the "Adjust ..." naming, as long as they follow property names (this could be applied separately as it's not related to re-organizing the menu).
  • Before applying this patch, object types for object.convert, object.origin_set and object.join need to be double checked, I noticed metaballs is missing from convert - but others may be missing too.
  • Rather keep changes to rename operator out of this patch, see note inline.
release/scripts/startup/bl_ui/space_view3d.py
2560–2566

I don't think this is a good change, batch rename is quite a spesific operation, it's always available in the "Edit" menu, and swapping this out means you can't easily rename the active item - based on the selection.

Further, this change could be made for other context menus too (but has not been), so this seems more like a design decision that's outside the scope of this patch.

This revision now requires changes to proceed.Jan 25 2021, 2:22 AM
  • Add Convert to Font and Metaballs
  • Address review comments
William Reynish (billreynish) marked an inline comment as done.Jan 25 2021, 9:29 AM

Applied label changes rB5f55022276a8: UI: tweak object context menu labels these were clear & straightforward improvements.

Updated this patch on master.

Applied light power scale change to 2.92 branch rB52022cba788e: UI: increase the context menu's light power as this is a more of a fix.

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

This works for empty objects too - which instance collections.

  • Add check for Collection Instances
William Reynish (billreynish) marked an inline comment as done.Jan 25 2021, 11:06 AM

Fix accessing the menu without an active object

This revision is now accepted and ready to land.Jan 25 2021, 11:29 AM