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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user