New Object Display Pie (Shift+W) #26

Merged
Demeter Dzadik merged 4 commits from object_display_pie into main 2024-09-08 13:07:19 +02:00
2 changed files with 87 additions and 0 deletions
Showing only changes of commit 1a2d96840b - Show all commits

View File

@ -37,6 +37,7 @@ module_names = (
"pie_mesh_align",
"pie_mesh_delete",
"pie_mesh_merge",
"pie_object_display",
"pie_object_parenting",
"pie_proportional_editing",
"pie_relationship_delete",

View File

@ -0,0 +1,86 @@
# SPDX-FileCopyrightText: 2016-2024 Blender Foundation
#
# SPDX-License-Identifier: GPL-3.0-or-later
from bpy.types import Menu
from .hotkeys import register_hotkey
class PIE_MT_object_display(Menu):
bl_idname = "PIE_MT_object_display"
bl_label = "Object Display"
def draw(self, context):
pie = self.layout.menu_pie()
obj = context.active_object
# 4 - LEFT
pie.prop(obj, 'show_in_front', icon='XRAY')
# 6 - RIGHT
if obj.type in ('MESH', 'CURVE'):
pie.prop(obj, 'show_wire', text="Wireframe", icon='SHADING_WIRE')
else:
pie.separator()
# 2 - BOTTOM
pie.prop_menu_enum(obj, 'display_type', text="Object Display", icon='THREE_DOTS')
# 8 - TOP
if obj.type in ('MESH', 'CURVE'):
pie.box().prop(obj, 'color')
else:
pie.separator()
# 7 - TOP - LEFT
if obj.type == 'ARMATURE':
pie.prop(obj.data, 'show_names', text="Bone Names", icon='FILE_TEXT')
else:
pie.prop(obj, 'show_name', text="Object Name", icon='FILE_TEXT')
# 9 - TOP - RIGHT
pie.separator()
# 1 - BOTTOM - LEFT
if obj.type == 'ARMATURE':
pie.prop(obj.data, 'show_axes', text="Bone Axes", icon='EMPTY_AXIS')
else:
pie.prop(obj, 'show_axis', icon='EMPTY_AXIS')
# 3 - BOTTOM - RIGHT
if obj.type in ('MESH', 'CURVE'):
pie.menu('OBJECT_MT_set_object_shading', icon='THREE_DOTS')
elif obj.type == 'ARMATURE':
pie.prop_menu_enum(obj.data, 'display_type', text="Bone Display", icon='THREE_DOTS')
elif obj.type == 'EMPTY':
pie.prop_menu_enum(obj, 'empty_display_type', icon='THREE_DOTS')
else:
pie.separator()
class OBJECT_MT_set_object_shading(Menu):
bl_idname = "OBJECT_MT_set_object_shading"
bl_label = "Shading Operators"
def draw(self, context):
layout = self.layout
layout.operator('object.shade_flat', icon='MESH_UVSPHERE')
layout.operator('object.shade_smooth', icon='NODE_MATERIAL')
if context.active_object.type == 'MESH':
layout.operator('object.shade_auto_smooth', icon='MODIFIER')
registry = [
PIE_MT_object_display,
OBJECT_MT_set_object_shading,
]
def register():
register_hotkey(
'wm.call_menu_pie',
op_kwargs={'name': 'PIE_MT_object_display'},
hotkey_kwargs={'type': "W", 'value': "PRESS", 'shift': True},
key_cat="3D View",
)