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/ui/properties_data_camera.py | |
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/ui/properties_data_camera.py')
-rw-r--r-- | release/scripts/ui/properties_data_camera.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py index 5152e004f28..15d513b5a25 100644 --- a/release/scripts/ui/properties_data_camera.py +++ b/release/scripts/ui/properties_data_camera.py @@ -28,16 +28,17 @@ class DataButtonsPanel(): bl_region_type = 'WINDOW' bl_context = "data" - def poll(self, context): - engine = context.scene.render.engine - return context.camera and (engine in self.COMPAT_ENGINES) - class DATA_PT_context_camera(DataButtonsPanel, bpy.types.Panel): bl_label = "" bl_show_header = False COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.camera and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -65,11 +66,21 @@ class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel, bpy.types.Pan _context_path = "object.data" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.camera and (engine in __class__.COMPAT_ENGINES) + class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel): bl_label = "Lens" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.camera and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -131,6 +142,11 @@ class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel): bl_label = "Display" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.camera and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout |