Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-08-09 05:37:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-09 05:37:09 +0400
commita6f13f9d7bfef7020d43cb0a8058753e6d7a128d (patch)
tree09535f0341f93288fc492c3318ba2213291345d9 /release/scripts/ui/properties_data_mesh.py
parent7fcbbad5a45acf5b4ef49d16cf6733afd1e481c7 (diff)
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.
Diffstat (limited to 'release/scripts/ui/properties_data_mesh.py')
-rw-r--r--release/scripts/ui/properties_data_mesh.py73
1 files changed, 24 insertions, 49 deletions
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index dd75850f1d3..1be2ce824fa 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -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