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 /source/blender/makesrna/intern/rna_wm_api.c | |
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 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 5df35ed4210..0f72cfa8b9d 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -186,7 +186,7 @@ void RNA_api_operator(StructRNA *srna) /* poll */ func= RNA_def_function(srna, "poll", NULL); RNA_def_function_ui_description(func, "Test if the operator can be called or not."); - RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); RNA_def_pointer(func, "context", "Context", "", ""); @@ -246,7 +246,7 @@ void RNA_api_macro(StructRNA *srna) /* poll */ func= RNA_def_function(srna, "poll", NULL); RNA_def_function_ui_description(func, "Test if the operator can be called or not."); - RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); RNA_def_pointer(func, "context", "Context", "", ""); |