poll() as a python '@staticmethod' was too limiting and didnt allow useful base class poll functions in many cases.

now rna functions that dont have a 'self' are automatically assumed '@classmethods'.

de-duplicated poll functions and made some minor tweaks too.
This commit is contained in:
Campbell Barton 2010-08-09 01:37:09 +00:00
parent 7fcbbad5a4
commit a6f13f9d7b
54 changed files with 596 additions and 815 deletions

@ -1133,8 +1133,8 @@ class Export3DS(bpy.types.Operator):
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@staticmethod
def poll(context): # Poll isnt working yet
@classmethod
def poll(cls, context): # Poll isnt working yet
return context.active_object != None
# Add to a menu

@ -3361,8 +3361,8 @@ class ExportFBX(bpy.types.Operator):
BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object
def execute(self, context):

@ -165,8 +165,8 @@ class ExportMDD(bpy.types.Operator):
frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')

@ -275,8 +275,8 @@ class ExportPLY(bpy.types.Operator):
use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):

@ -120,8 +120,8 @@ class importMDD(bpy.types.Operator):
#fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')

@ -31,8 +31,8 @@ class RENDER_OT_netslave_bake(bpy.types.Operator):
bl_idname = "render.netslavebake"
bl_label = "Bake all in file"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -89,8 +89,8 @@ class RENDER_OT_netclientanim(bpy.types.Operator):
bl_idname = "render.netclientanim"
bl_label = "Animation on network"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -116,8 +116,8 @@ class RENDER_OT_netclientrun(bpy.types.Operator):
bl_idname = "render.netclientstart"
bl_label = "Start Service"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -133,8 +133,8 @@ class RENDER_OT_netclientsend(bpy.types.Operator):
bl_idname = "render.netclientsend"
bl_label = "Send job"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -163,8 +163,8 @@ class RENDER_OT_netclientsendframe(bpy.types.Operator):
bl_idname = "render.netclientsendframe"
bl_label = "Send current frame job"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -193,8 +193,8 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
bl_idname = "render.netclientstatus"
bl_label = "Client Status"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -233,8 +233,8 @@ class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
bl_idname = "render.netclientblacklistslave"
bl_label = "Client Blacklist Slave"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -263,8 +263,8 @@ class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
bl_idname = "render.netclientwhitelistslave"
bl_label = "Client Whitelist Slave"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -294,8 +294,8 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
bl_idname = "render.netclientslaves"
bl_label = "Client Slaves"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -339,8 +339,8 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
bl_idname = "render.netclientcancel"
bl_label = "Client Cancel"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
@ -368,8 +368,8 @@ class RENDER_OT_netclientcancelall(bpy.types.Operator):
bl_idname = "render.netclientcancelall"
bl_label = "Client Cancel All"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -395,8 +395,8 @@ class netclientdownload(bpy.types.Operator):
bl_idname = "render.netclientdownload"
bl_label = "Client Download"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
@ -440,8 +440,8 @@ class netclientscan(bpy.types.Operator):
bl_idname = "render.netclientscan"
bl_label = "Client Scan"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return True
def execute(self, context):
@ -463,8 +463,8 @@ class netclientweb(bpy.types.Operator):
bl_idname = "render.netclientweb"
bl_label = "Open Master Monitor"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.server_address != "[default]"

@ -93,9 +93,9 @@ class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Network Settings"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
return base_poll(__class__, context)
@classmethod
def poll(cls, context):
return base_poll(cls, context)
def draw(self, context):
layout = self.layout
@ -131,10 +131,10 @@ class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slave Settings"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return base_poll(__class__, context) and scene.network_render.mode == "RENDER_SLAVE"
return base_poll(cls, context) and scene.network_render.mode == "RENDER_SLAVE"
def draw(self, context):
layout = self.layout
@ -156,10 +156,10 @@ class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Master Settings"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return base_poll(__class__, context) and scene.network_render.mode == "RENDER_MASTER"
return base_poll(cls, context) and scene.network_render.mode == "RENDER_MASTER"
def draw(self, context):
layout = self.layout
@ -174,10 +174,10 @@ class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Job Settings"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return base_poll(__class__, context) and scene.network_render.mode == "RENDER_CLIENT"
return base_poll(cls, context) and scene.network_render.mode == "RENDER_CLIENT"
def draw(self, context):
layout = self.layout
@ -214,14 +214,14 @@ class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slaves Status"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
return base_poll(__class__, context) and netsettings.server_address != "[default]"
return base_poll(cls, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@ -252,14 +252,14 @@ class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slaves Blacklist"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
return base_poll(__class__, context) and netsettings.server_address != "[default]"
return base_poll(cls, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@ -289,14 +289,14 @@ class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Jobs"
COMPAT_ENGINES = {'NET_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
return base_poll(__class__, context) and netsettings.server_address != "[default]"
return base_poll(cls, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout

@ -132,6 +132,10 @@ class PropertyPanel():
bl_label = "Custom Properties"
bl_default_closed = True
@classmethod
def poll(cls, context):
bool(eval("context.%s" % cls._context_path))
def draw(self, context):
draw(self.layout, context, self._context_path)

@ -48,8 +48,8 @@ class DiscontFilterOp(bpy.types.Operator):
bl_idname = "graph.euler_filter"
bl_label = "Filter out discontinuities in the active fcurves"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):

@ -28,8 +28,8 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
bl_label = "Select Interior Faces"
bl_options = {'REGISTER', 'UNDO'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
@ -70,8 +70,8 @@ class MeshMirrorUV(bpy.types.Operator):
bl_label = "Copy Mirrored UV coords"
bl_options = {'REGISTER', 'UNDO'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')

@ -80,8 +80,8 @@ class SelectCamera(bpy.types.Operator):
bl_label = "Select Camera"
bl_options = {'REGISTER', 'UNDO'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.scene.camera is not None
def execute(self, context):
@ -110,8 +110,8 @@ class SelectHierarchy(bpy.types.Operator):
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.object
def execute(self, context):
@ -169,8 +169,8 @@ class SubdivisionSet(bpy.types.Operator):
relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obs = context.selected_editable_objects
return (obs is not None)
@ -382,8 +382,8 @@ class ShapeTransfer(bpy.types.Operator):
return {'FINISHED'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.mode != 'EDIT')
@ -413,8 +413,8 @@ class JoinUVs(bpy.types.Operator):
bl_idname = "object.join_uvs"
bl_label = "Join as UVs"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@ -472,8 +472,8 @@ class MakeDupliFace(bpy.types.Operator):
bl_idname = "object.make_dupli_face"
bl_label = "Make DupliFace"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')

@ -263,8 +263,8 @@ class AlignObjects(bpy.types.Operator):
align_z = BoolProperty(name="Align Z",
description="Align in the Z axis", default=False)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.mode == 'OBJECT'
def execute(self, context):

@ -30,8 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
bl_label = "Crossfade sounds"
bl_options = {'REGISTER', 'UNDO'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, 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:
@ -84,8 +84,8 @@ class SequencerCutMulticam(bpy.types.Operator):
camera = IntProperty(name="Camera",
default=1, min=1, max=32, soft_min=1, soft_max=32)
@staticmethod
def poll(context):
@classmethod
def poll(cls, 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:
@ -119,8 +119,8 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
bl_label = "Deinterlace Movies"
bl_options = {'REGISTER', 'UNDO'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if context.scene and context.scene.sequence_editor:
return True
else:

@ -39,8 +39,8 @@ class ExportUVLayout(bpy.types.Operator):
description="File format to export the UV layout to",
default='SVG')
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')

@ -249,8 +249,8 @@ class FollowActiveQuads(bpy.types.Operator):
description="Method to space UV edge loops",
default="LENGTH")
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.type == 'MESH')

@ -1124,8 +1124,8 @@ class SmartProject(bpy.types.Operator):
description="Margin to reduce bleed from adjacent islands.",
default=0.0, min=0.0, max=1.0)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):

@ -23,8 +23,8 @@ class ExportSomeData(bpy.types.Operator):
description="Choose between two items",
default='OPT_A')
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):

@ -9,8 +9,8 @@ class SimpleOperator(bpy.types.Operator):
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):

@ -30,8 +30,8 @@ class UvOperator(bpy.types.Operator):
bl_idname = "uv.simple_operator"
bl_label = "Simple UV Operator"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')

@ -21,17 +21,17 @@ import bpy
from rna_prop_ui import PropertyPanel
class DataButtonsPanel():
class ArmatureButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.armature
class DATA_PT_context_arm(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -51,11 +51,12 @@ class DATA_PT_context_arm(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_arm(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Skeleton"
def draw(self, context):
@ -85,7 +86,7 @@ class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
col.prop(arm, "deform_quaternion", text="Quaternion")
class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
@ -109,11 +110,11 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
col.prop(arm, "delay_deform", text="Delay Refresh")
class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Bone Groups"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
def draw(self, context):
@ -158,7 +159,7 @@ class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
# TODO: this panel will soon be depreceated too
class DATA_PT_ghost(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Ghost"
def draw(self, context):
@ -186,12 +187,12 @@ class DATA_PT_ghost(DataButtonsPanel, bpy.types.Panel):
col.prop(arm, "ghost_only_selected", text="Selected Only")
class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "iTaSC parameters"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
return (ob and ob.pose)
@ -245,8 +246,8 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
#bl_label = "Bones Motion Paths"
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
# XXX: include posemode check?
return (context.object) and (context.armature)
@ -272,8 +273,8 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
#bl_label = "Bones Onion Skinning"
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
# XXX: include posemode check?
return (context.object) and (context.armature)

@ -42,8 +42,8 @@ class DATA_PT_template(bpy.types.Panel):
templates = []
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if not context.armature:
return False
obj = context.object
@ -261,8 +261,8 @@ class ActiveAssign(bpy.types.Operator):
bl_idname = "pose.metarig_assign"
bl_label = "Assign to the active posebone"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')
@ -280,8 +280,8 @@ class ActiveClear(bpy.types.Operator):
bl_idname = "pose.metarig_clear"
bl_label = "Metarig Clear Type"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')

@ -26,8 +26,8 @@ class BoneButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "bone"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.bone or context.edit_bone)
@ -48,6 +48,7 @@ class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@property
def _context_path(self):
@ -108,8 +109,8 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.bone
def draw(self, context):
@ -184,8 +185,8 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Display"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.bone
def draw(self, context):
@ -220,8 +221,8 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Inverse Kinematics"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.active_pose_bone
def draw(self, context):

@ -21,22 +21,22 @@ import bpy
from rna_prop_ui import PropertyPanel
class DataButtonsPanel():
class CameraButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return context.camera and (engine in cls.COMPAT_ENGINES)
class DATA_PT_context_camera(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_context_camera(CameraButtonsPanel, 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
@ -53,25 +53,15 @@ class DATA_PT_context_camera(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
_context_path = "object.data"
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.camera and (engine in __class__.COMPAT_ENGINES)
_context_path = "object.data"
class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_camera(CameraButtonsPanel, 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
@ -121,15 +111,10 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
col.prop(cam, "dof_distance", text="Distance")
class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_camera_display(CameraButtonsPanel, 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

@ -21,34 +21,34 @@ import bpy
from rna_prop_ui import PropertyPanel
class DataButtonsPanel():
class CurveButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
class DataButtonsPanelCurve(DataButtonsPanel):
class CurveButtonsPanelCurve(CurveButtonsPanel):
'''Same as above but for curves only'''
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
class DataButtonsPanelActive(DataButtonsPanel):
class CurveButtonsPanelActive(CurveButtonsPanel):
'''Same as above but for curves only'''
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
curve = context.curve
return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
class DATA_PT_context_curve(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -69,11 +69,12 @@ class DATA_PT_context_curve(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Shape"
def draw(self, context):
@ -124,11 +125,11 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
col.prop(curve, "auto_texspace")
class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Geometry"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
obj = context.object
if obj and obj.type == 'SURFACE':
return False
@ -157,7 +158,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
col.prop(curve, "bevel_object", text="")
class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel):
bl_label = "Path Animation"
def draw_header(self, context):
@ -188,7 +189,7 @@ class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
col.prop(curve, "use_time_offset", text="Offset Children")
class DATA_PT_active_spline(DataButtonsPanelActive, bpy.types.Panel):
class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel):
bl_label = "Active Spline"
def draw(self, context):
@ -259,11 +260,11 @@ class DATA_PT_active_spline(DataButtonsPanelActive, bpy.types.Panel):
layout.prop(act_spline, "smooth")
class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Font"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
@ -315,11 +316,11 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
col.prop(char, "use_small_caps")
class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Paragraph"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
@ -344,11 +345,11 @@ class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
col.prop(text, "offset_y", text="Y")
class DATA_PT_textboxes(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Text Boxes"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):

@ -25,8 +25,8 @@ class DataButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'EMPTY')

@ -34,16 +34,16 @@ class DataButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "data"
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return context.lamp and (engine in cls.COMPAT_ENGINES)
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.lamp and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
self.layout.template_preview(context.lamp)
@ -52,11 +52,6 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.lamp and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -75,24 +70,14 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
_context_path = "object.data"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.lamp and (engine in __class__.COMPAT_ENGINES)
_context_path = "object.data"
class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lamp"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.lamp and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -135,11 +120,11 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
bl_label = "Sky & Atmosphere"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type == 'SUN') and (engine in __class__.COMPAT_ENGINES)
return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -206,11 +191,11 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in __class__.COMPAT_ENGINES)
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -326,11 +311,11 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
bl_label = "Area Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type == 'AREA') and (engine in __class__.COMPAT_ENGINES)
return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
lamp = context.lamp
@ -354,11 +339,11 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
bl_label = "Spot Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type == 'SPOT') and (engine in __class__.COMPAT_ENGINES)
return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -389,12 +374,12 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in __class__.COMPAT_ENGINES)
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
lamp = context.lamp

@ -26,8 +26,8 @@ class DataButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.lattice
@ -52,6 +52,7 @@ class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"

@ -47,22 +47,22 @@ class MESH_MT_shape_key_specials(bpy.types.Menu):
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
class DataButtonsPanel():
class MeshButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return context.mesh and (engine in cls.COMPAT_ENGINES)
class DATA_PT_context_mesh(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_context_mesh(MeshButtonsPanel, 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.mesh and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -79,25 +79,15 @@ class DATA_PT_context_mesh(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_mesh(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
_context_path = "object.data"
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.mesh and (engine in __class__.COMPAT_ENGINES)
_context_path = "object.data"
class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Normals"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.mesh and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -116,15 +106,10 @@ class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
col.prop(mesh, "double_sided")
class DATA_PT_settings(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Settings"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.mesh and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -133,15 +118,15 @@ class DATA_PT_settings(DataButtonsPanel, bpy.types.Panel):
layout.prop(mesh, "texture_mesh")
class DATA_PT_vertex_groups(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Groups"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.type in ('MESH', 'LATTICE') and (engine in __class__.COMPAT_ENGINES))
return (obj and obj.type in ('MESH', 'LATTICE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -182,15 +167,15 @@ class DATA_PT_vertex_groups(DataButtonsPanel, bpy.types.Panel):
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Shape Keys"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in __class__.COMPAT_ENGINES))
return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -274,15 +259,10 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
row.prop(key, "slurph")
class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
bl_label = "UV Texture"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.mesh and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -302,12 +282,12 @@ class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
layout.prop(lay, "name")
class DATA_PT_texface(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Texture Face"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
rd = context.scene.render
@ -348,15 +328,10 @@ class DATA_PT_texface(DataButtonsPanel, bpy.types.Panel):
col.label(text="No UV Texture")
class DATA_PT_vertex_colors(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Colors"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
engine = context.scene.render.engine
return context.mesh and (engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout

@ -26,8 +26,8 @@ class DataButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "data"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.meta_ball
@ -52,6 +52,7 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
@ -82,8 +83,8 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
bl_label = "Active Element"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.meta_ball and context.meta_ball.active_element)
def draw(self, context):

@ -20,13 +20,13 @@
import bpy
class DataButtonsPanel():
class ModifierButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "modifier"
class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
bl_label = "Modifiers"
def draw(self, context):

@ -30,11 +30,11 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
rd = context.scene.render
return ob and ob.game and (rd.engine in __class__.COMPAT_ENGINES)
return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -157,11 +157,11 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Collision Bounds"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
game = context.object.game
rd = context.scene.render
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in __class__.COMPAT_ENGINES)
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
game = context.active_object.game
@ -190,16 +190,16 @@ class RenderButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "render"
@classmethod
def poll(cls, context):
rd = context.scene.render
return (rd.engine in cls.COMPAT_ENGINES)
class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Game"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -212,11 +212,6 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Standalone Player"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -250,11 +245,6 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stereo"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -309,11 +299,6 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -339,11 +324,6 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -369,11 +349,6 @@ class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
rd = context.scene.render
return (rd.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -396,8 +371,8 @@ class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.scene) and (rd.use_game_engine)
@ -419,10 +394,10 @@ class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -442,10 +417,10 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
world = context.world
@ -471,10 +446,10 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.scene
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout

@ -58,6 +58,10 @@ class MaterialButtonsPanel():
bl_context = "material"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@classmethod
def poll(cls, context):
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
@ -72,13 +76,13 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
# An exception, dont call the parent poll func because
# this manages materials for all engine types
engine = context.scene.render.engine
return (context.material or context.object) and (engine in __class__.COMPAT_ENGINES)
return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -126,23 +130,19 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "material"
@staticmethod
def poll(context):
return context.material and (context.scene.render.engine in __class__.COMPAT_ENGINES)
class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -176,11 +176,11 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -223,9 +223,9 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
return context.material and (context.scene.render.engine in __class__.COMPAT_ENGINES)
@classmethod
def poll(cls, context):
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -249,11 +249,11 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -294,11 +294,11 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -329,11 +329,11 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -396,11 +396,11 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Specular"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -462,11 +462,11 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@ -513,11 +513,11 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
@ -571,11 +571,11 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@ -633,11 +633,11 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (engine in __class__.COMPAT_ENGINES)
return mat and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@ -664,11 +664,11 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Halo"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type == 'HALO') and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -713,11 +713,11 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Flare"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type == 'HALO') and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
halo = context.material.halo
@ -750,11 +750,11 @@ class VolumeButtonsPanel():
bl_context = "material"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type == 'VOLUME') and (engine in __class__.COMPAT_ENGINES)
return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):

@ -274,8 +274,8 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
#bl_label = "Object Motion Paths"
bl_context = "object"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object)
def draw(self, context):
@ -300,8 +300,8 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # in
#bl_label = "Object Onion Skinning"
bl_context = "object"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object)
def draw(self, context):
@ -311,9 +311,12 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # in
self.draw_settings(context, ob.animation_visualisation)
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object"
def register():
pass

@ -678,8 +678,8 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Object Constraints"
bl_context = "constraint"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.object)
def draw(self, context):
@ -697,8 +697,8 @@ class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Bone Constraints"
bl_context = "bone_constraint"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.pose_bone)
def draw(self, context):

@ -45,16 +45,20 @@ class ParticleButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "particle"
@classmethod
def poll(cls, context):
return particle_panel_poll(cls, context)
class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return (context.particle_system or context.object) and (engine in __class__.COMPAT_ENGINES)
return (context.particle_system or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -136,17 +140,13 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Pa
COMPAT_ENGINES = {'BLENDER_RENDER'}
_context_path = "particle_system.settings"
@staticmethod
def poll(context):
return particle_panel_poll(__class__, context)
class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Emission"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if particle_panel_poll(PARTICLE_PT_emission, context):
return not context.particle_system.point_cache.external
else:
@ -204,15 +204,15 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
return psys.settings.type == 'HAIR' and (engine in __class__.COMPAT_ENGINES)
return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
#cloth = context.cloth.collision_settings
@ -262,8 +262,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
@ -273,7 +273,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in __class__.COMPAT_ENGINES
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in cls.COMPAT_ENGINES
def draw(self, context):
psys = context.particle_system
@ -285,8 +285,8 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Velocity"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if particle_panel_poll(PARTICLE_PT_velocity, context):
psys = context.particle_system
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
@ -333,8 +333,8 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Rotation"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if particle_panel_poll(PARTICLE_PT_rotation, context):
psys = context.particle_system
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
@ -376,8 +376,8 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if particle_panel_poll(PARTICLE_PT_physics, context):
return not context.particle_system.point_cache.external
else:
@ -570,8 +570,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Boid Brain"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
@ -580,7 +580,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
return False
if psys.point_cache.external:
return False
return psys.settings.physics_type == 'BOIDS' and engine in __class__.COMPAT_ENGINES
return psys.settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
@ -671,15 +671,15 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Render"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
return engine in __class__.COMPAT_ENGINES
return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
@ -836,15 +836,15 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
return engine in __class__.COMPAT_ENGINES
return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
@ -892,9 +892,9 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
return particle_panel_poll(__class__, context)
@classmethod
def poll(cls, context):
return particle_panel_poll(cls, context)
def draw(self, context):
layout = self.layout
@ -974,10 +974,6 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
return particle_panel_poll(__class__, context)
def draw(self, context):
part = context.particle_system.settings
effector_weights_ui(self, context, part.effector_weights)
@ -991,10 +987,6 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
return particle_panel_poll(__class__, context)
def draw(self, context):
layout = self.layout
@ -1023,10 +1015,6 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
return particle_panel_poll(__class__, context)
def draw(self, context):
layout = self.layout

@ -43,8 +43,8 @@ class PhysicButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@ -133,8 +133,8 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Cache"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.cloth
def draw(self, context):
@ -146,8 +146,8 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Collision"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.cloth
def draw_header(self, context):
@ -185,8 +185,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Stiffness Scaling"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.cloth
def draw_header(self, context):
@ -221,8 +221,8 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Field Weights"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.cloth)
def draw(self, context):

@ -29,8 +29,8 @@ class PhysicButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.object) and (not rd.use_game_engine)
@ -160,8 +160,8 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Collision"
#bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)

@ -25,8 +25,8 @@ class PhysicButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@ -203,8 +203,8 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain World"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.fluid
return md and md.settings and (md.settings.type == 'DOMAIN')
@ -253,8 +253,8 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Boundary"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.fluid
return md and md.settings and (md.settings.type == 'DOMAIN')
@ -281,8 +281,8 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Particles"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.fluid
return md and md.settings and (md.settings.type == 'DOMAIN')

@ -29,8 +29,8 @@ class PhysicButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@ -123,8 +123,8 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Groups"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@ -151,8 +151,8 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Cache"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@ -172,8 +172,8 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@ -207,8 +207,8 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution Cache"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN') and md.domain_settings.highres
@ -228,8 +228,8 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Field Weights"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
smoke = context.smoke
return (smoke and smoke.smoke_type == 'DOMAIN')

@ -33,8 +33,8 @@ class PhysicButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@ -88,8 +88,8 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Cache"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.soft_body
def draw(self, context):
@ -101,8 +101,8 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Goal"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@ -144,8 +144,8 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Edges"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@ -198,8 +198,8 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Self Collision"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@ -230,8 +230,8 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Solver"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.soft_body
def draw(self, context):
@ -266,8 +266,8 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Field Weights"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.soft_body)
def draw(self, context):

@ -40,16 +40,16 @@ class RenderButtonsPanel():
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.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
@ -71,11 +71,6 @@ 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,11 +173,6 @@ 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
@ -207,11 +197,6 @@ 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
@ -254,11 +239,6 @@ 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
@ -297,11 +277,6 @@ 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
@ -417,8 +392,8 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
@ -484,11 +459,6 @@ 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
@ -518,11 +488,6 @@ 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
@ -542,11 +507,6 @@ 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
@ -593,11 +553,6 @@ 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
@ -642,11 +597,6 @@ 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

@ -26,8 +26,8 @@ class SceneButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "scene"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.scene
@ -44,6 +44,7 @@ class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "scene"
@ -108,8 +109,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Active Keying Set"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
def draw(self, context):

@ -68,16 +68,16 @@ class TextureButtonsPanel():
bl_region_type = 'WINDOW'
bl_context = "texture"
@classmethod
def poll(cls, context):
tex = context.texture
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -96,13 +96,13 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
if not hasattr(context, "texture_slot"):
return False
return ((context.material or context.world or context.lamp or context.brush or context.texture)
and (engine in __class__.COMPAT_ENGINES))
and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -156,13 +156,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
_context_path = "texture"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context): # use alternate poll since NONE texture type is ok
engine = context.scene.render.engine
return context.texture and (engine in __class__.COMPAT_ENGINES)
_context_path = "texture"
class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
@ -170,11 +165,6 @@ class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in __class__.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -205,21 +195,21 @@ class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
class TextureSlotPanel(TextureButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
if not hasattr(context, "texture_slot"):
return False
engine = context.scene.render.engine
return TextureButtonsPanel.poll(self, context) and (engine in __class__.COMPAT_ENGINES)
return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES)
class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
bl_label = "Mapping"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush and not context.sculpt_object:
return False
@ -228,7 +218,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
return False
engine = context.scene.render.engine
return (engine in __class__.COMPAT_ENGINES)
return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -311,8 +301,8 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
bl_label = "Influence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush:
return False
@ -321,7 +311,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
return False
engine = context.scene.render.engine
return (engine in __class__.COMPAT_ENGINES)
return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
@ -428,7 +418,12 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
class TextureTypePanel(TextureButtonsPanel):
pass
@classmethod
def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
@ -436,12 +431,6 @@ class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
tex_type = 'CLOUDS'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -467,12 +456,6 @@ class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
tex_type = 'WOOD'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -503,12 +486,6 @@ class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
tex_type = 'MARBLE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -536,12 +513,6 @@ class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel):
tex_type = 'MAGIC'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -561,12 +532,6 @@ class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
tex_type = 'BLEND'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -585,12 +550,6 @@ class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel):
tex_type = 'STUCCI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -615,12 +574,6 @@ class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -648,12 +601,6 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -692,12 +639,6 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -749,12 +690,6 @@ class TEXTURE_PT_plugin(TextureTypePanel, bpy.types.Panel):
tex_type = 'PLUGIN'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -768,12 +703,6 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
tex_type = 'ENVIRONMENT_MAP'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -814,12 +743,6 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
tex_type = 'ENVIRONMENT_MAP'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -833,12 +756,6 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
tex_type = 'MUSGRAVE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -878,12 +795,6 @@ class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
tex_type = 'VORONOI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -925,12 +836,6 @@ class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
tex_type = 'DISTORTED_NOISE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
tex = context.texture
engine = context.scene.render.engine
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -953,11 +858,11 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Voxel Data"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
return tex and (tex.type == 'VOXEL_DATA' and (engine in __class__.COMPAT_ENGINES))
return tex and (tex.type == 'VOXEL_DATA' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -992,11 +897,11 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Point Density"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
return tex and (tex.type == 'POINT_DENSITY' and (engine in __class__.COMPAT_ENGINES))
return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@ -1048,11 +953,11 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Turbulence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
return tex and (tex.type == 'POINT_DENSITY' and (engine in __class__.COMPAT_ENGINES))
return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw_header(self, context):
layout = self.layout

@ -27,15 +27,20 @@ class WorldButtonsPanel():
bl_context = "world"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@classmethod
def poll(cls, context):
rd = context.scene.render
return (rd.engine in cls.COMPAT_ENGINES)
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.world) and (not rd.use_game_engine) and (rd.engine in __class__.COMPAT_ENGINES)
return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
self.layout.template_preview(context.world)
@ -46,10 +51,10 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
return (not rd.use_game_engine) and (rd.engine in __class__.COMPAT_ENGINES)
return (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -66,7 +71,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
@ -189,8 +194,8 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Indirect Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
light = context.world.lighting
return light.gather_method == 'APPROXIMATE'

@ -138,8 +138,8 @@ class ConsoleAutocomplete(bpy.types.Operator):
bl_idname = "console.autocomplete"
bl_label = "Console Autocomplete"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return context.space_data.console_type != 'REPORT'
def execute(self, context):

@ -20,6 +20,17 @@
import bpy
class BrushButtonsPanel():
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@classmethod
def poll(cls, context):
sima = context.space_data
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
class IMAGE_MT_view(bpy.types.Menu):
bl_label = "View"
@ -333,8 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Image"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima.image)
@ -353,8 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Game Properties"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
rd = context.scene.render
sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
@ -397,8 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Histogram"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@ -416,8 +427,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Waveform"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@ -436,8 +447,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Vectorscope"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@ -454,8 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Sample Line"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@ -472,8 +483,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Scope Samples"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return sima
@ -493,8 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Display"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return (sima and (sima.image or sima.show_uvedit))
@ -551,8 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Paint"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
sima = context.space_data
return sima.show_paint
@ -591,18 +602,10 @@ class IMAGE_PT_paint(bpy.types.Panel):
col.prop(brush, "clone_alpha", text="Alpha")
class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Texture"
bl_default_closed = True
@staticmethod
def poll(context):
sima = context.space_data
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
def draw(self, context):
layout = self.layout
@ -616,18 +619,10 @@ class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
class IMAGE_PT_paint_stroke(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Stroke"
bl_default_closed = True
@staticmethod
def poll(context):
sima = context.space_data
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
def draw(self, context):
layout = self.layout
@ -648,18 +643,10 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
layout.prop(brush, "use_wrap")
class IMAGE_PT_paint_curve(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Curve"
bl_default_closed = True
@staticmethod
def poll(context):
sima = context.space_data
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
def draw(self, context):
layout = self.layout

@ -25,8 +25,8 @@ class LOGIC_PT_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Properties"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
ob = context.active_object
return ob and ob.game

@ -320,9 +320,9 @@ class SequencerButtonsPanel():
def has_sequencer(context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
@staticmethod
def poll(context):
return __class__.has_sequencer(context) and (act_strip(context) is not None)
@classmethod
def poll(cls, context):
return cls.has_sequencer(context) and (act_strip(context) is not None)
class SequencerButtonsPanel_Output():
@ -333,9 +333,9 @@ class SequencerButtonsPanel_Output():
def has_preview(context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
@staticmethod
def poll(context):
return __class__.has_preview(context)
@classmethod
def poll(cls, context):
return cls.has_preview(context)
class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
@ -388,9 +388,9 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Effect Strip"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@ -518,9 +518,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Strip Input"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@ -593,9 +593,9 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@ -634,9 +634,9 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@ -659,9 +659,9 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Filter"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@ -721,9 +721,9 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Proxy"
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = act_strip(context)

@ -246,8 +246,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
class TEXT_MT_edit(bpy.types.Menu):
bl_label = "Edit"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.space_data.text)
def draw(self, context):

@ -142,8 +142,8 @@ class USERPREF_PT_interface(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INTERFACE')
@ -237,8 +237,8 @@ class USERPREF_PT_edit(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDITING')
@ -352,8 +352,8 @@ class USERPREF_PT_system(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM')
@ -517,8 +517,8 @@ class USERPREF_PT_theme(bpy.types.Panel):
for i, attr in enumerate(props_ls):
colsub_pair[i % 2].row().prop(themedata, attr)
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'THEMES')
@ -650,8 +650,8 @@ class USERPREF_PT_file(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILES')
@ -722,8 +722,8 @@ class USERPREF_PT_input(InputKeyMapPanel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT')
@ -817,8 +817,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
_addons_fake_modules = {}
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'ADDONS')

@ -763,8 +763,8 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
bl_idname = "wm.keyconfig_remove"
bl_label = "Remove Key Config"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
wm = context.manager
return wm.active_keyconfig.user_defined

@ -714,8 +714,8 @@ class VIEW3D_MT_object_clear(bpy.types.Menu):
class VIEW3D_MT_object_specials(bpy.types.Menu):
bl_label = "Specials"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
# add more special types
return context.object
@ -1940,8 +1940,8 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "View"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
view = context.space_data
return (view)
@ -1977,8 +1977,8 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Item"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.space_data and context.active_object)
def draw(self, context):
@ -2003,8 +2003,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
bl_label = "Display"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
view = context.space_data
return (view)
@ -2071,8 +2071,8 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Mesh Display"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
# The active object check is needed because of localmode
return (context.active_object and (context.mode == 'EDIT_MESH'))
@ -2108,8 +2108,8 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Curve Display"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
editmesh = context.mode == 'EDIT_CURVE'
return (editmesh)
@ -2131,8 +2131,8 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
bl_label = "Background Images"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
view = context.space_data
# bg = context.space_data.background_image
return (view)
@ -2181,8 +2181,8 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
bl_label = "Transform Orientations"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
view = context.space_data
return (view)
@ -2209,8 +2209,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
bl_label = "Skeleton Sketching"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
scene = context.space_data
ob = context.active_object
return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
@ -2266,9 +2266,9 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
return ""
@staticmethod
def poll(context):
member = __class__._active_context_member(context)
@classmethod
def poll(cls, context):
member = cls._active_context_member(context)
if member:
context_member = getattr(context, member)
return context_member and context_member.keys()

@ -493,9 +493,9 @@ class PaintPanel():
class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
bl_label = "Brush"
@staticmethod
def poll(context):
return __class__.paint_settings(context)
@classmethod
def poll(cls, context):
return cls.paint_settings(context)
def draw(self, context):
layout = self.layout
@ -721,9 +721,9 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
bl_label = "Texture"
bl_default_closed = True
@staticmethod
def poll(context):
settings = __class__.paint_settings(context)
@classmethod
def poll(cls, context):
settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.texture_paint_object))
@ -820,9 +820,9 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
bl_label = "Tool"
bl_default_closed = True
@staticmethod
def poll(context):
settings = __class__.paint_settings(context)
@classmethod
def poll(cls, context):
settings = cls.paint_settings(context)
return (settings and settings.brush and
(context.sculpt_object or context.texture_paint_object or
context.vertex_paint_object or context.weight_paint_object))
@ -856,9 +856,9 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
bl_label = "Stroke"
bl_default_closed = True
@staticmethod
def poll(context):
settings = __class__.paint_settings(context)
@classmethod
def poll(cls, context):
settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.vertex_paint_object or
context.weight_paint_object or
@ -954,15 +954,15 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
bl_label = "Curve"
bl_default_closed = True
@staticmethod
def poll(context):
settings = __class__.paint_settings(context)
@classmethod
def poll(cls, context):
settings = cls.paint_settings(context)
return (settings and settings.brush and settings.brush.curve)
def draw(self, context):
layout = self.layout
settings = __class__.paint_settings(context)
settings = cls.paint_settings(context)
brush = settings.brush
layout.template_curve_mapping(brush, "curve", brush=True)
@ -979,8 +979,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
bl_label = "Options"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
@ -1018,8 +1018,8 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
@ -1053,8 +1053,8 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):
@ -1173,8 +1173,8 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
bl_context = "texturepaint"
bl_label = "Project Paint"
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
brush = context.tool_settings.image_paint.brush
return (brush and brush.imagepaint_tool != 'SMEAR')
@ -1244,8 +1244,8 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
bl_label = "Options"
bl_default_closed = True
@staticmethod
def poll(context):
@classmethod
def poll(cls, context):
return (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):

@ -4447,10 +4447,18 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
}
else {
Py_DECREF(item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */
if (PyFunction_Check(item)==0) {
PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function", class_type, py_class_name, RNA_function_identifier(func));
return -1;
if(flag & FUNC_NO_SELF) {
if (PyMethod_Check(item)==0) {
PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
return -1;
}
item= ((PyMethodObject *)item)->im_func;
}
else {
if (PyFunction_Check(item)==0) {
PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function, not a %.200s", class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
return -1;
}
}
func_arg_count= rna_function_arg_count(func);
@ -4460,6 +4468,11 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
arg_count = PyLong_AsSsize_t(py_arg_count);
Py_DECREF(py_arg_count);
/* note, the number of args we check for and the number of args we give to
* @classmethods are different (quirk of python), this is why rna_function_arg_count() doesn't return the value -1*/
if(flag & FUNC_NO_SELF)
func_arg_count++;
if (arg_count != func_arg_count) {
PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d", class_type, py_class_name, RNA_function_identifier(func), func_arg_count, arg_count);
return -1;
@ -4605,7 +4618,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
args = PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
if(is_static) {
i= 0;
}