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_render.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_render.py')
-rw-r--r-- | release/scripts/ui/properties_render.py | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py index 4e6596957d7..dc0b76645ae 100644 --- a/release/scripts/ui/properties_render.py +++ b/release/scripts/ui/properties_render.py @@ -42,15 +42,16 @@ class RenderButtonsPanel(): bl_context = "render" # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here - def poll(self, context): - rd = context.scene.render - return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES) - class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel): bl_label = "Render" COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -74,6 +75,11 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -178,6 +184,11 @@ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel): bl_label = "Shading" COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -204,6 +215,11 @@ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -248,6 +264,11 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -291,6 +312,11 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel): bl_label = "Output" COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -412,7 +438,8 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): rd = context.scene.render return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA') @@ -483,6 +510,11 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel): bl_label = "Anti-Aliasing" COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw_header(self, context): rd = context.scene.render @@ -514,6 +546,11 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw_header(self, context): rd = context.scene.render @@ -533,6 +570,11 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): bl_label = "Dimensions" COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -581,6 +623,11 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw_header(self, context): rd = context.scene.render @@ -627,6 +674,11 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + rd = context.scene.render + return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout |