diff --git a/booleans/boolean_slice.py b/booleans/boolean_slice.py index 814579e..14265fd 100644 --- a/booleans/boolean_slice.py +++ b/booleans/boolean_slice.py @@ -13,7 +13,7 @@ class ND_OT_bool_slice(bpy.types.Operator): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 2 + return len(context.selected_objects) == 2 and all(obj.type == 'MESH' for obj in context.selected_objects) def execute(self, context): diff --git a/booleans/vanilla.py b/booleans/vanilla.py index bfba0bf..4b37f06 100644 --- a/booleans/vanilla.py +++ b/booleans/vanilla.py @@ -20,7 +20,7 @@ class ND_OT_bool_vanilla(bpy.types.Operator): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 2 + return len(context.selected_objects) == 2 and all(obj.type == 'MESH' for obj in context.selected_objects) def execute(self, context): diff --git a/power_mods/array_cubed.py b/power_mods/array_cubed.py index 096a81c..6f22608 100644 --- a/power_mods/array_cubed.py +++ b/power_mods/array_cubed.py @@ -136,7 +136,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/bevel.py b/power_mods/bevel.py index 659b50e..4dddb91 100644 --- a/power_mods/bevel.py +++ b/power_mods/bevel.py @@ -124,7 +124,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/circular_array.py b/power_mods/circular_array.py index 949b551..bc29df2 100644 --- a/power_mods/circular_array.py +++ b/power_mods/circular_array.py @@ -127,8 +127,13 @@ def invoke(self, context, event): @classmethod def poll(cls, context): - if context.mode == 'OBJECT': - return len(context.selected_objects) == 2 + if context.mode == 'OBJECT' and len(context.selected_objects) == 2: + a, b = context.selected_objects + reference_obj = a if a.name != context.object.name else b + + return reference_obj.type == 'MESH' + else: + return False def add_array_modifier(self): diff --git a/power_mods/mirror.py b/power_mods/mirror.py index d05378b..757e907 100644 --- a/power_mods/mirror.py +++ b/power_mods/mirror.py @@ -95,7 +95,14 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) > 0 and len(context.selected_objects) <= 2 + if len(context.selected_objects) == 1 and context.object.type == 'MESH': + return True + + if len(context.selected_objects) == 2: + a, b = context.selected_objects + reference_obj = a if a.name != context.object.name else b + + return reference_obj.type == 'MESH' def add_mirror_modifier(self): diff --git a/power_mods/profile_extrude.py b/power_mods/profile_extrude.py index 6ad33fa..629e350 100644 --- a/power_mods/profile_extrude.py +++ b/power_mods/profile_extrude.py @@ -121,7 +121,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/screw.py b/power_mods/screw.py index 2feafe7..0b826cd 100644 --- a/power_mods/screw.py +++ b/power_mods/screw.py @@ -138,7 +138,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/solidify.py b/power_mods/solidify.py index 9d472da..b71eed0 100644 --- a/power_mods/solidify.py +++ b/power_mods/solidify.py @@ -125,7 +125,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/square_array.py b/power_mods/square_array.py index 02bc1ac..d799c9e 100644 --- a/power_mods/square_array.py +++ b/power_mods/square_array.py @@ -134,7 +134,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/power_mods/weighted_normal_bevel.py b/power_mods/weighted_normal_bevel.py index f2d3030..b130755 100644 --- a/power_mods/weighted_normal_bevel.py +++ b/power_mods/weighted_normal_bevel.py @@ -104,7 +104,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def prepare_new_operator(self, context): diff --git a/sketching/geo_lift.py b/sketching/geo_lift.py index d5223dd..5c72a7a 100644 --- a/sketching/geo_lift.py +++ b/sketching/geo_lift.py @@ -86,7 +86,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def register_mode(self): diff --git a/sketching/view_align.py b/sketching/view_align.py index 35ccf2a..d60eb69 100644 --- a/sketching/view_align.py +++ b/sketching/view_align.py @@ -85,7 +85,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def set_selection_mode(self, context): diff --git a/utils/hydrate.py b/utils/hydrate.py index 09387ad..82451d0 100644 --- a/utils/hydrate.py +++ b/utils/hydrate.py @@ -84,7 +84,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def operate(self, context): diff --git a/utils/name_sync.py b/utils/name_sync.py index 77ce14a..2acda79 100644 --- a/utils/name_sync.py +++ b/utils/name_sync.py @@ -10,7 +10,8 @@ class ND_OT_name_sync(bpy.types.Operator): @classmethod def poll(cls, context): - return len(context.selected_objects) >= 1 + if context.mode == 'OBJECT': + return len(context.selected_objects) >= 1 and all(obj.type == 'MESH' for obj in context.selected_objects) def execute(self, context): diff --git a/utils/seams.py b/utils/seams.py index 9346360..b036611 100644 --- a/utils/seams.py +++ b/utils/seams.py @@ -95,7 +95,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def operate(self, context): diff --git a/utils/set_lod_suffix.py b/utils/set_lod_suffix.py index 3c5426b..dd55841 100644 --- a/utils/set_lod_suffix.py +++ b/utils/set_lod_suffix.py @@ -17,7 +17,8 @@ class ND_OT_set_lod_suffix(bpy.types.Operator): @classmethod def poll(cls, context): - return len(context.selected_objects) >= 1 + if context.mode == 'OBJECT': + return len(context.selected_objects) >= 1 and all(obj.type == 'MESH' for obj in context.selected_objects) def execute(self, context): diff --git a/utils/set_origin.py b/utils/set_origin.py index b412b5b..98a3045 100644 --- a/utils/set_origin.py +++ b/utils/set_origin.py @@ -11,8 +11,11 @@ class ND_OT_set_origin(bpy.types.Operator): @classmethod def poll(cls, context): - if context.mode == 'OBJECT': - return len(context.selected_objects) == 2 + if context.mode == 'OBJECT' and len(context.selected_objects) == 2: + a, b = context.selected_objects + reference_obj = a if a.name != context.object.name else b + + return reference_obj.type == 'MESH' def execute(self, context): diff --git a/utils/smooth.py b/utils/smooth.py index 0076b4d..a279eb5 100644 --- a/utils/smooth.py +++ b/utils/smooth.py @@ -87,7 +87,7 @@ def invoke(self, context, event): @classmethod def poll(cls, context): if context.mode == 'OBJECT': - return len(context.selected_objects) == 1 + return len(context.selected_objects) == 1 and context.object.type == 'MESH' def add_smooth_shading(self, context):