diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-05 20:05:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-05 20:05:30 +0400 |
commit | 163f6055d26383b7fa11df00da09ef63efb8cb6c (patch) | |
tree | d552a9ad0ce4c64a95088264021914008bf8fdf9 /release/scripts/templates | |
parent | 5d18274cacef89fe4e290dbae8427122028ba868 (diff) |
bugfix [#23182] Using self.report() inside poll() gives crash
poll() function is now a static method in python, this is more correct, matching C where the operator is not created to run poll.
def poll(self, context): ...
is now...
@staticmethod
def poll(context): ...
Pythons way of doing static methods is a bit odd but cant be helped :|
This does make subclassing poll functions with COMPAT_ENGINES break, so had to modify quite a few scripts for this.
Diffstat (limited to 'release/scripts/templates')
-rw-r--r-- | release/scripts/templates/operator.py | 3 | ||||
-rw-r--r-- | release/scripts/templates/operator_simple.py | 3 | ||||
-rw-r--r-- | release/scripts/templates/operator_uv.py | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py index 9cb544886da..9a875c6899e 100644 --- a/release/scripts/templates/operator.py +++ b/release/scripts/templates/operator.py @@ -23,7 +23,8 @@ class ExportSomeData(bpy.types.Operator): description="Choose between two items", default='OPT_A') - def poll(self, context): + @staticmethod + def poll(context): return context.active_object != None def execute(self, context): diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index e241afd23b7..55afe586a1e 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -9,7 +9,8 @@ class SimpleOperator(bpy.types.Operator): bl_idname = "object.simple_operator" bl_label = "Simple Object Operator" - def poll(self, context): + @staticmethod + def poll(context): return context.active_object != None def execute(self, context): diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py index f8c8e369ec8..f27f5300857 100644 --- a/release/scripts/templates/operator_uv.py +++ b/release/scripts/templates/operator_uv.py @@ -30,7 +30,8 @@ class UvOperator(bpy.types.Operator): bl_idname = "uv.simple_operator" bl_label = "Simple UV Operator" - def poll(self, context): + @staticmethod + def poll(context): obj = context.active_object return (obj and obj.type == 'MESH') |