diff options
author | matc <matc> | 2019-03-19 19:16:49 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-03-19 19:21:30 +0300 |
commit | 2cc303700b65b70e731848e36dd24790b0a88166 (patch) | |
tree | dc2656c46705d65088c5fbe81c409739186afe0a /release | |
parent | 3b04a867b928cba3fe167a9d563de662618d4af3 (diff) |
Fix: Add poll methods for quick effects operators
Differential Revision: https://developer.blender.org/D4259
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/object_quick_effects.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 37c4af593c5..54673b24520 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -46,8 +46,12 @@ def object_ensure_material(obj, mat_name): obj.data.materials.append(mat) return mat +class ObjectModeOperator: + @classmethod + def poll(cls, context): + return context.mode == 'OBJECT' -class QuickFur(Operator): +class QuickFur(ObjectModeOperator, Operator): bl_idname = "object.quick_fur" bl_label = "Quick Fur" bl_options = {'REGISTER', 'UNDO'} @@ -77,7 +81,7 @@ class QuickFur(Operator): def execute(self, context): fake_context = context.copy() mesh_objects = [obj for obj in context.selected_objects - if obj.type == 'MESH' and obj.mode == 'OBJECT'] + if obj.type == 'MESH'] if not mesh_objects: self.report({'ERROR'}, "Select at least one mesh object") @@ -112,7 +116,7 @@ class QuickFur(Operator): return {'FINISHED'} -class QuickExplode(Operator): +class QuickExplode(ObjectModeOperator, Operator): bl_idname = "object.quick_explode" bl_label = "Quick Explode" bl_options = {'REGISTER', 'UNDO'} @@ -318,7 +322,7 @@ def grid_location(x, y): return (x * 200, y * 150) -class QuickSmoke(Operator): +class QuickSmoke(ObjectModeOperator, Operator): bl_idname = "object.quick_smoke" bl_label = "Quick Smoke" bl_options = {'REGISTER', 'UNDO'} @@ -422,7 +426,7 @@ class QuickSmoke(Operator): return {'FINISHED'} -class QuickFluid(Operator): +class QuickFluid(ObjectModeOperator, Operator): bl_idname = "object.quick_fluid" bl_label = "Quick Fluid" bl_options = {'REGISTER', 'UNDO'} |