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:
2010-08-09 01:37:09 +00:00
parent 7fcbbad5a4
commit a6f13f9d7b
54 changed files with 596 additions and 815 deletions

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