[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3333] contrib/py/scripts/addons/ oscurart_tools.py: BugFix Selection

Eugenio Pignataro info at oscurart.com.ar
Wed May 2 20:12:14 CEST 2012


Revision: 3333
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3333
Author:   oscurart
Date:     2012-05-02 18:12:13 +0000 (Wed, 02 May 2012)
Log Message:
-----------
BugFix Selection 

Modified Paths:
--------------
    contrib/py/scripts/addons/oscurart_tools.py

Modified: contrib/py/scripts/addons/oscurart_tools.py
===================================================================
--- contrib/py/scripts/addons/oscurart_tools.py	2012-05-02 16:19:49 UTC (rev 3332)
+++ contrib/py/scripts/addons/oscurart_tools.py	2012-05-02 18:12:13 UTC (rev 3333)
@@ -2609,6 +2609,45 @@
 
         return {'FINISHED'}
           
+
+## ------------------------------------ SELECTION -------------------------------------- 
+
+def select():
+
+    if bpy.context.mode=="OBJECT":
+        obj = bpy.context.object
+        sel = len(bpy.context.selected_objects)
+
+        if sel==0:
+            bpy.selection=[]
+        else:
+            if sel==1:
+                bpy.selection=[]
+                bpy.selection.append(obj)
+            elif sel>len(bpy.selection):
+                for sobj in bpy.context.selected_objects:
+                    if (sobj in bpy.selection)==False:
+                        bpy.selection.append(sobj)
+
+            elif sel<len(bpy.selection):
+                for it in bpy.selection:
+                    if (it in bpy.context.selected_objects)==False:
+                        bpy.selection.remove(it)
+
+
+
+class Selection(bpy.types.Header):
+    bl_label = "Selection"
+    bl_space_type = "VIEW_3D"
+
+    def __init__(self):
+        select()
+
+    def draw(self, context):
+        layout = self.layout
+        row = layout.row()
+        row.label("Sel: "+str(len(bpy.selection)))
+
      
    
 ##======================================================================================FIN DE SCRIPTS    
@@ -2667,3 +2706,4 @@
 bpy.utils.register_class(OscApplyOverrides)
 bpy.utils.register_class(OscRestoreOverrides)
 bpy.utils.register_class(OscCheckOverrides)
+bpy.utils.register_class(Selection)



More information about the Bf-extensions-cvs mailing list