Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Reynish <billreynish>2021-01-25 13:26:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-25 13:28:39 +0300
commit5f2c5e5bb8c15bf0d6679351e3482f9c38c00935 (patch)
tree84089a62cb05afbb98f62238eb5ed379064e2c7a /release/scripts/startup/bl_ui
parent7cb65a1e674c462393aadbb8c76283c4e3a8a16f (diff)
UI: object context menu tweaks for consistency
Currently, the object context menu includes some 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. Reviewed By: #grease_pencil Ref D10144
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py69
1 files changed, 38 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index ffac19230b5..e653ead21bb 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2383,28 +2383,16 @@ class VIEW3D_MT_object_context_menu(Menu):
'''
# If something is selected
- if obj is not None and obj.type in {'MESH', 'CURVE', 'SURFACE'}:
- layout.operator("object.shade_smooth", text="Shade Smooth")
- layout.operator("object.shade_flat", text="Shade Flat")
-
- layout.separator()
+ # Individual object types.
if obj is None:
pass
- elif obj.type == 'MESH':
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type")
-
- layout.operator_context = 'INVOKE_DEFAULT'
- # If more than one object is selected
- if selected_objects_len > 1:
- layout.operator("object.join")
-
- layout.separator()
elif obj.type == 'CAMERA':
layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("view3d.object_as_camera", text="Set Active Camera")
+
if obj.data.type == 'PERSP':
props = layout.operator("wm.context_modal_mouse", text="Adjust Focal Length")
props.data_path_iter = "selected_editable_objects"
@@ -2447,22 +2435,7 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.offset"
props.input_scale = 0.01
- props.header_text = "Width Size: %.3f"
-
- layout.separator()
-
- layout.operator("object.convert", text="Convert to Mesh").target = 'MESH'
- layout.operator("object.convert", text="Convert to Grease Pencil").target = 'GPENCIL'
- layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type")
-
- layout.separator()
-
- elif obj.type == 'GPENCIL':
- layout.operator("gpencil.convert", text="Convert to Path").type = 'PATH'
- layout.operator("gpencil.convert", text="Convert to Bezier Curve").type = 'CURVE'
- layout.operator("gpencil.convert", text="Convert to Polygon Curve").type = 'POLY'
-
- layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type")
+ props.header_text = "Offset: %.3f"
layout.separator()
@@ -2477,6 +2450,11 @@ class VIEW3D_MT_object_context_menu(Menu):
layout.separator()
+ if obj.empty_display_type == 'IMAGE':
+ layout.operator("gpencil.trace_image")
+
+ layout.separator()
+
elif obj.type == 'LIGHT':
light = obj.data
@@ -2534,6 +2512,35 @@ class VIEW3D_MT_object_context_menu(Menu):
layout.separator()
+ # Shared among some object types.
+ if obj is not None:
+ if obj.type in {'MESH', 'CURVE', 'SURFACE'}:
+ layout.operator("object.shade_smooth", text="Shade Smooth")
+ layout.operator("object.shade_flat", text="Shade Flat")
+
+ layout.separator()
+
+ if obj.type in {'MESH', 'CURVE', 'SURFACE', 'ARMATURE', 'GPENCIL'}:
+ if selected_objects_len > 1:
+ layout.operator("object.join")
+
+ if obj.type in {'MESH', 'CURVE', 'SURFACE', 'POINTCLOUD', 'META', 'FONT'}:
+ layout.operator_menu_enum("object.convert", "target")
+
+ if obj.type == 'GPENCIL':
+ layout.operator_menu_enum("gpencil.convert", "type", text="Convert To")
+
+ if (
+ obj.type in {'MESH', 'CURVE', 'SURFACE', 'GPENCIL', 'LATTICE', 'ARMATURE', 'META'} or
+ (obj.type == 'EMPTY' and obj.instance_collection is not None)
+ ):
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type")
+ layout.operator_context = 'INVOKE_DEFAULT'
+
+ layout.separator()
+
+ # Shared among all object types
layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')