Rework/New: Object & Mesh Select Pies #21

Merged
Demeter Dzadik merged 10 commits from selection_pies into main 2024-09-08 13:06:57 +02:00
Showing only changes of commit 6013fc43f8 - Show all commits

View File

@ -276,16 +276,27 @@ class OBJECT_OT_select_symmetry_object(Operator, ObjectSelectOperatorMixin):
bl_label = "Select Opposite Object"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
scene_obs = context.scene.objects
sel_obs = context.selected_objects[:]
active_obj = context.active_object
flipped_objs = [scene_obs.get(flip_name(ob.name)) for ob in sel_obs]
flipped_active = scene_obs.get(flip_name(active_obj.name))
if not (flipped_active or any(flipped_objs)):
cls.poll_message_set("No selected objects with corresponding opposite objects.")
return False
return True
def execute(self, context):
objs = context.selected_objects[:]
scene_obs = context.scene.objects
sel_obs = context.selected_objects[:]
active_obj = context.active_object
flipped_objs = [context.scene.objects.get(flip_name(ob.name)) for ob in objs]
flipped_active = context.scene.objects.get(flip_name(active_obj.name))
flipped_objs = [scene_obs.get(flip_name(ob.name)) for ob in sel_obs]
flipped_active = scene_obs.get(flip_name(active_obj.name))
notflipped = len(
[objs[i] for i in range(len(objs)) if objs[i] == flipped_objs[i]]
)
notflipped = sum([flipped_obj in (obj, None) for obj, flipped_obj in zip(sel_obs, flipped_objs)])
if notflipped > 0:
self.report({'WARNING'}, f"{notflipped} objects had no opposite.")