Rework/New: Object & Mesh Select Pies #21
@ -30,7 +30,11 @@ class PIE_MT_object_selection(Menu):
|
||||
# 9 - TOP - RIGHT
|
||||
pie.operator("object.select_siblings_of_active", text="Siblings", icon='PARTICLES')
|
||||
# 1 - BOTTOM - LEFT
|
||||
pie.operator("object.select_active_camera", text=f"Active Camera", icon='OUTLINER_OB_CAMERA')
|
||||
text = "Active Camera"
|
||||
cam = get_current_camera(context)
|
||||
if cam:
|
||||
text += f" ({cam.name})"
|
||||
pie.operator("object.select_active_camera", text=text, icon='OUTLINER_OB_CAMERA')
|
||||
# 3 - BOTTOM - RIGHT
|
||||
pie.menu("PIE_MT_object_selection_more", text="Select Menu", icon='THREE_DOTS')
|
||||
|
||||
@ -60,6 +64,26 @@ class PIE_MT_object_selection_more(Menu):
|
||||
layout.operator("object.select_pattern", text="Select Pattern...", icon='FILTER')
|
||||
layout.operator('object.select_by_name_search', icon='VIEWZOOM')
|
||||
|
||||
layout.separator()
|
||||
layout.menu("VIEW3D_MT_select_any_camera", text="Select Camera", icon='OUTLINER_OB_CAMERA')
|
||||
|
||||
|
||||
class VIEW3D_MT_select_any_camera(Menu):
|
||||
bl_idname = "VIEW3D_MT_select_any_camera"
|
||||
bl_label = "Select Camera"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
active_cam = get_current_camera(context)
|
||||
|
||||
all_cams = [obj for obj in sorted(context.scene.objects, key=lambda o: o.name) if obj.type == 'CAMERA']
|
||||
|
||||
for cam in all_cams:
|
||||
icon = 'OUTLINER_DATA_CAMERA'
|
||||
if cam == active_cam:
|
||||
icon = 'OUTLINER_OB_CAMERA'
|
||||
layout.operator('object.select_object_by_name', text=cam.name, icon=icon).obj_name=cam.name
|
||||
|
||||
|
||||
### Object relationship selection operators.
|
||||
|
||||
@ -224,12 +248,15 @@ class OBJECT_OT_select_active_camera(Operator, ObjectSelectOperatorMixin):
|
||||
if not cam:
|
||||
cls.poll_message_set("No active camera.")
|
||||
return False
|
||||
if not cam.visible_get():
|
||||
cls.poll_message_set("Camera is hidden, it cannot be selected.")
|
||||
return False
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
super().execute(context)
|
||||
cam = get_current_camera(context)
|
||||
if context.mode != 'MODE':
|
||||
if context.active_object and context.mode != 'MODE':
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
cam.select_set(True)
|
||||
context.view_layer.objects.active = cam
|
||||
@ -391,6 +418,10 @@ class OBJECT_OT_select_object_by_name(Operator, ObjectSelectOperatorMixin):
|
||||
self.report({'ERROR'}, "Object name not found in scene: " + self.obj_name)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if not obj.visible_get():
|
||||
self.report({'ERROR'}, "Object is hidden, so it cannot be selected.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
super().execute(context)
|
||||
|
||||
obj.select_set(True)
|
||||
@ -565,6 +596,8 @@ class PIE_MT_mesh_selection_more(Menu):
|
||||
registry = [
|
||||
PIE_MT_object_selection,
|
||||
PIE_MT_object_selection_more,
|
||||
VIEW3D_MT_select_any_camera,
|
||||
|
||||
OBJECT_OT_select_children_of_active,
|
||||
OBJECT_OT_select_siblings_of_active,
|
||||
OBJECT_OT_select_parent_object,
|
||||
|
Loading…
Reference in New Issue
Block a user