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.
This commit is contained in:
2010-08-05 16:05:30 +00:00
parent 5d18274cac
commit 163f6055d2
54 changed files with 845 additions and 368 deletions

View File

@@ -30,7 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
bl_label = "Crossfade sounds"
bl_options = {'REGISTER', 'UNDO'}
def poll(self, context):
@staticmethod
def poll(context):
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
return context.scene.sequence_editor.active_strip.type == 'SOUND'
else:
@@ -83,7 +84,8 @@ class SequencerCutMulticam(bpy.types.Operator):
camera = IntProperty(name="Camera",
default=1, min=1, max=32, soft_min=1, soft_max=32)
def poll(self, context):
@staticmethod
def poll(context):
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
else:
@@ -117,7 +119,8 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
bl_label = "Deinterlace Movies"
bl_options = {'REGISTER', 'UNDO'}
def poll(self, context):
@staticmethod
def poll(context):
if context.scene and context.scene.sequence_editor:
return True
else: