[Bf-extensions-cvs] [ed38f8e] master: Improves: Add Poll to mesh tools

Eugenio Pignataro noreply at git.blender.org
Sat Aug 30 22:42:12 CEST 2014


Commit: ed38f8e9d8615bb3e8112ae590d87f0655cf833c
Author: Eugenio Pignataro
Date:   Sat Aug 30 17:42:00 2014 -0300
Branches: master
https://developer.blender.org/rBACed38f8e9d8615bb3e8112ae590d87f0655cf833c

Improves: Add Poll to mesh tools

===================================================================

M	oscurart_tools/oscurart_meshes.py

===================================================================

diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index 20d5dd2..5060b77 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -48,6 +48,10 @@ class reConst (bpy.types.Operator):
     bl_options = {"REGISTER", "UNDO"}
     OFFSET=bpy.props.FloatProperty(name="Offset", default=0.001, min=-0, max=0.1)
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     def execute(self,context):
         defReconst(self, self.OFFSET)
         return {'FINISHED'}
@@ -78,6 +82,10 @@ class SelectMenor (bpy.types.Operator):
     bl_label = "Select Side"
     bl_options = {"REGISTER", "UNDO"}
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     side = bpy.props.BoolProperty(name="Greater than zero", default=False)
     offset = bpy.props.FloatProperty(name="Offset", default=0)
     def execute(self,context):
@@ -94,7 +102,12 @@ class SelectMenor (bpy.types.Operator):
 class resymVertexGroups (bpy.types.Operator):
     bl_idname = "mesh.resym_vertex_weights_osc"
     bl_label = "Resym Vertex Weights"
-    bl_options = {"REGISTER", "UNDO"}
+    bl_options = {"REGISTER", "UNDO"}    
+
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+    
     def execute(self,context):
 
         with open("%s_%s_SYM_TEMPLATE.xml" % (os.path.join(os.path.dirname(bpy.data.filepath),bpy.context.scene.name),bpy.context.object.name)) as file:
@@ -118,6 +131,11 @@ class OscExportVG (bpy.types.Operator):
     bl_idname = "file.export_groups_osc"
     bl_label = "Export Groups"
     bl_options = {"REGISTER", "UNDO"}
+
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+    
     def execute(self,context):
         
         ob = bpy.context.object
@@ -138,6 +156,11 @@ class OscImportVG (bpy.types.Operator):
     bl_idname = "file.import_groups_osc"
     bl_label = "Import Groups"
     bl_options = {"REGISTER", "UNDO"}
+
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False    
+    
     def execute(self,context):
         
         ob = bpy.context.object    
@@ -224,6 +247,10 @@ class OscResymSave (bpy.types.Operator):
     bl_label = "Resym save XML Map"
     bl_options = {"REGISTER", "UNDO"}
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     quality = bpy.props.IntProperty(default=4, name="Quality")
     
     def execute (self, context):
@@ -235,6 +262,10 @@ class OscResymMesh (bpy.types.Operator):
     bl_label = "Resym save Apply XML"
     bl_options = {"REGISTER", "UNDO"}
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     selected=bpy.props.BoolProperty(default=False, name="Only Selected")
     
     side = bpy.props.EnumProperty(
@@ -326,6 +357,10 @@ class OscOverlapUv(bpy.types.Operator):
     bl_idname = "mesh.overlap_uv_faces"
     bl_label = "Overlap Uvs"
     bl_options = {"REGISTER", "UNDO"}
+
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
     
     presicion = bpy.props.IntProperty(default=4, min=1, max=10, name="precision" )
     
@@ -352,6 +387,10 @@ class OscExportVC (bpy.types.Operator):
     bl_label = "Export Vertex Colors"
     bl_options = {"REGISTER", "UNDO"}
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     def execute(self, context):
         DefOscExportVC()
         return {'FINISHED'}    
@@ -361,6 +400,10 @@ class OscImportVC (bpy.types.Operator):
     bl_label = "Import Vertex Colors"
     bl_options = {"REGISTER", "UNDO"}
 
+    @classmethod
+    def poll(cls, context):
+        return True if context.active_object is not None and context.object.type == "MESH" else False
+
     def execute(self, context):
         DefOscImportVC()
         return {'FINISHED'}              
@@ -430,3 +473,5 @@ class ModalIndexOperator(bpy.types.Operator):
 
 
 
+
+



More information about the Bf-extensions-cvs mailing list