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