poll() as a python '@staticmethod' was too limiting and didnt allow useful base class...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 9 Aug 2010 01:37:09 +0000 (01:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 9 Aug 2010 01:37:09 +0000 (01:37 +0000)
now rna functions that dont have a 'self' are automatically assumed '@classmethods'.

de-duplicated poll functions and made some minor tweaks too.

54 files changed:
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_mdd.py
release/scripts/io/export_ply.py
release/scripts/io/import_shape_mdd.py
release/scripts/io/netrender/operators.py
release/scripts/io/netrender/ui.py
release/scripts/modules/rna_prop_ui.py
release/scripts/op/fcurve_euler_filter.py
release/scripts/op/mesh.py
release/scripts/op/object.py
release/scripts/op/object_align.py
release/scripts/op/sequencer.py
release/scripts/op/uv.py
release/scripts/op/uvcalc_follow_active.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/templates/operator.py
release/scripts/templates/operator_simple.py
release/scripts/templates/operator_uv.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_armature_rigify.py
release/scripts/ui/properties_data_bone.py
release/scripts/ui/properties_data_camera.py
release/scripts/ui/properties_data_curve.py
release/scripts/ui/properties_data_empty.py
release/scripts/ui/properties_data_lamp.py
release/scripts/ui/properties_data_lattice.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_data_metaball.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_game.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_object_constraint.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_field.py
release/scripts/ui/properties_physics_fluid.py
release/scripts/ui/properties_physics_smoke.py
release/scripts/ui/properties_physics_softbody.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/properties_texture.py
release/scripts/ui/properties_world.py
release/scripts/ui/space_console.py
release/scripts/ui/space_image.py
release/scripts/ui/space_logic.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_userpref_keymap.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/python/intern/bpy_rna.c

index 702edc6ae70bad8c8c0b45beb7fb4808fbc4d81b..2a8b43c4e8454961fbf44a942142b07e6f095902 100644 (file)
@@ -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
index 14116058f4485e6b7f99d51c41dfa47128a535be..5c2e0cb5f95f4ccfcf9fd8fa80b0aac6e2280497 100644 (file)
@@ -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):
index 46b38c3c9e6c2a567541decf43725ed50d7b115c..2d45e18ef770bd562f1a2fef8b25c83445a145c6 100644 (file)
@@ -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')
 
index aacfa6d07b2e96fc306423fa9cc265104c549c09..f4d7cae75a3fd0ed0045f0ad6c4e71c043efb8a0 100644 (file)
@@ -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):
index 3245decc806f045763ce8b022925814c7ba7cb88..d74726dce2e9998dacc5a9e60a8e9321874297eb 100644 (file)
@@ -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')
 
index 35f356e0a6519096c0bc782d6c30893484e6cd54..55c2d11e28e4c4adbd0bcfda4f71ef315012dfb2 100644 (file)
@@ -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]"
 
index d5269803ffda1753f5f85fd000169bc2dc518a83..1dcee85820bb1dc19fd98644c46aad1f31edda80 100644 (file)
@@ -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
index eda27240fb5134893654b0810ff6168d93349ee2..63762855737c69df47981ce4338fc402a80aa533 100644 (file)
@@ -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)
 
index cc973d94e2a7331c71de5c3b8082b5849e5bb518..c6f5ddd12e4cbf66d0bbb9ec88e9252b696c3046 100644 (file)
@@ -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):
index 1074ee7b482b15eabb93dbc6e3a3ec7b2cf03f6d..736ec41ba14ea3911520a521ff70d23ec6a0be06 100644 (file)
@@ -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')
 
index e3ee4e000625238f9514b6dd4d66e59610eeb489..476db76735e8a82dd6523b8ba7f8c709c5bbd835 100644 (file)
@@ -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')
 
index d156ccf37c0f202de2c777ffa43d85770c37baf9..dc9b7c34523725444594448cb151db14a21ba6c2 100644 (file)
@@ -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):
index 63480cae180016185fd6bf974c5f25d3cd1d6086..cbb7d00e659720d10b9f30dae73fd0cd7de6ba5b 100644 (file)
@@ -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:
index 0d6e1904ff2fb7369d35906374d0c60556a0086f..7d67718185870d1d7977b10088e5a9b3475088c6 100644 (file)
@@ -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')
 
index 5aeae37aaf633e8b48209710e9e1ab041ad7eea6..f02ee497999f6b13c6d5bc34eed5b4dba77e3e3b 100644 (file)
@@ -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')
 
index b52a2c41c2680262963569bd91af881108981342..fbda1955013f89350a9eccc0ff400a46f009e310 100644 (file)
@@ -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):
index 9a875c6899ead0eb8412b6ae6cae9b86f1655f6a..5a525784b511fb134f01a55936acf565736a3ebf 100644 (file)
@@ -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):
index 55afe586a1e832a2293c860f929dbf7c74c3503d..853bfa666eb90851b9809a9d9074d79d85eac723 100644 (file)
@@ -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):
index f27f5300857010004a1070611ced999d3981c0a9..46ce15f090d258de628b5a86c46f67aac50fb6d5 100644 (file)
@@ -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')
 
index 2f5ffd0803f10d98d8ec3c0c190d41dae43e70b7..3d8f2cdc09285c6998a3ff9997cd4f5592ba05b7 100644 (file)
@@ -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)
 
index d0a6821c16b94d7498788eb7953f98b1921b9aec..070f1fb76787cc7b26aae3e09c0b78cc13526681 100644 (file)
@@ -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')
 
index 108845ae8fcdc2590eff0e10338d879aa0e303f1..1296ccd7e7063df6de9ca27e8ffc69b5441f7e6c 100644 (file)
@@ -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):
index 75bf2eb86d2f54134359a4f76ca00d8ac43f2872..cda2b79c909e7621b9cbf71b7360ab7acdec2800 100644 (file)
@@ -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
 
index 43f2f3497bbf2e1c08a9b0a360bca7975ebeb412..1262f6739b736476fa93ec93ee58c3488f215517 100644 (file)
@@ -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):
index b4725647a0adb367f2ff4f9b3d6ec5bd23dffce0..bf2f3b3d0bab6bc34a0b810457cd531d66a573e9 100644 (file)
@@ -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')
 
 
index b2ab9cf9cfb20cc9f7c4a401701ace164b9465b3..9a58622974e1dc8e470b8031a6f50f2a8e580508 100644 (file)
@@ -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
index a2dfeb191b869e980caa5a8c4038d51de34c37f1..5e313b79d85778fbcd672d66db1a772f6a5aeaf8 100644 (file)
@@ -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"
 
 
index dd75850f1d3387dc09065ec9c02ef9b84f6eacf1..1be2ce824fa74830928263a2d7cedf9ccc0482f1 100644 (file)
@@ -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
 
index dbc0f642c7cf4b91513a3b0550cbef6de2c66dae..a6b1bb75cbe8bbe8adfd0e85aa1b98eeb0f46ac0 100644 (file)
@@ -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):
index ad16dce50304b939ad16da8686ebf302e8e3143a..2847810f41715822f7d568b66f89b0e47abfb5b3 100644 (file)
 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):
index 6d3225553bac82f9073a03e01ba297bc7759bb56..608976f373cce7a847dc9015be09549edd3fa5be 100644 (file)
@@ -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
index 6dfc3fc95a144652b9533d01d1a92e7b1f3c82eb..d14c8c05c637663f420b7f31bfa5f868757dbe91 100644 (file)
@@ -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):
index f5d61a22b8f7634bb073f806008acff73fa25655..6923e60a3df9d280cbd8a33f61b359523a980bf0 100644 (file)
@@ -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
 
index 87ca702fa69a268b20f7fd2ba60272f0b9d1c84b..b3a96841d71985c2ec5de91c8c3aec2fb9c538d9 100644 (file)
@@ -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):
index 0d830c121ee4ded7e58a937dc6d7fb398085ad1f..72e804a1cefc2c790308fedb6fcb26c8d2e2b347 100644 (file)
@@ -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
 
index d711dc9d9cf3b4808f8c7c71e2996dc2ceb31801..0755b9be6036f2f1f754afad3b9331792aa2885c 100644 (file)
@@ -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):
index bf9fb1ab9961d26cd0be25406ea440f8f528422f..b67232f888d0ca3f3d3782b188b6811793248cef 100644 (file)
@@ -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)
index 7f0352fa052c347088c106161033cb2253714af3..2c25270eb394ba44b2f4fa896396aaef09807965 100644 (file)
@@ -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')
 
index 4831bafa490e5f53b04ae0a779c9f98dcaf4cf7d..3538b88afcf9c8c23e1051fae71527d871903709 100644 (file)
@@ -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')
 
index 50e0910adc9619fe1f293006149db0fd6b0a60b6..5240e6477d8d8a235b6914b912f97d4cd4085244 100644 (file)
@@ -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):
index 7b080445aee9226bb73f5e7605b46a9027e9db34..cd11179dc2577976be87241a1a6245e801be10a6 100644 (file)
@@ -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
 
index 37af2b511b877cb0595b2d91a1b9d0dcf7d6ebeb..3ed8dfb72b8aa5df2a7363c2e439ae06f2e80405 100644 (file)
@@ -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):
index 32c572d849b03ad63c58a0784242e75c7dd6de9d..b675576ec3f1f53c5a981ab773c55a14b3f859f9 100644 (file)
@@ -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
index 9825ba94d17433bd1321513ddf61f3b03fdcd48c..eec1caf58f713ced1050aea0d44d3e72f06d01f8 100644 (file)
@@ -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'
 
index dbe08c16a77316b29a7ffce75dc4e178d2e6293f..feda3a54b417c0916701d46be39a19ffcae9a300 100644 (file)
@@ -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):
index 2bd394809d519c4ee4cad5dd074f15c718fb6978..99d41244431b167c0aa2b65972446997b2926e30 100644 (file)
 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
 
index 370e49c4475405d2bacd899883d9dec9795e12b0..f2d99c6e44788ead6d4749a637b189cc4d587a11 100644 (file)
@@ -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
 
index df3735265840cc4eb0fa762acea117556521fa48..3a828bfb6d0c47048d9667d271f46f701e7e12c0 100644 (file)
@@ -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)
index cdc1dcb12c30c9729c3bab242b78211241052417..71ab6540132117566ec8f71862b0a4d5058f9a72 100644 (file)
@@ -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):
index cf57df137591725eee270f4004f1a5190675e297..049d22a44edc5a3b9f0ddc59afebc9fe54bce999 100644 (file)
@@ -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')
 
index 460ae88d1f72d8a388a352bd6859a318e78c2971..9a482b896527d53353fc6980592924a0c02ce274 100644 (file)
@@ -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
 
index 47788a48ba4cdf4b11c4eaecdbbba5e2707b2ab5..a3e945f460a10a40140df6cd235d30c6de706b3d 100644 (file)
@@ -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()
index af435f1da7739e6c2bafd7b0d90ac87c3298eac9..ee3a1a2a43c90e85bf8955d7774b77100b8c6483 100644 (file)
@@ -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):
index e92503626758b01cc4101421496bbfe49863f5cf..ff273fa098dcfb9a1135f69b42a19feef4d31ebc 100644 (file)
@@ -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;
                        }