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

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

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

View 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):