[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3343] contrib/py/scripts/addons/ space_view3d_paint_bprojection.py: BProjection: improvement of zoom view 3D , it zoom on the selected mesh and plan stay in the same location

geo kgeo kgeogeo at hotmail.com
Thu May 3 14:36:17 CEST 2012


Revision: 3343
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3343
Author:   kgeogeo
Date:     2012-05-03 12:36:17 +0000 (Thu, 03 May 2012)
Log Message:
-----------
BProjection: improvement of zoom view 3D, it zoom on the selected mesh and plan stay in the same location

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

Modified: contrib/py/scripts/addons/space_view3d_paint_bprojection.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-05-03 11:51:01 UTC (rev 3342)
+++ contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-05-03 12:36:17 UTC (rev 3343)
@@ -705,7 +705,7 @@
             createcustomprops(context)
             cm = bpy.context.object.mode
             tmp = context.object
-            for ob in (ob for ob in bpy.data.objects if ob.type == 'MESH'):
+            for ob in (ob for ob in bpy.data.objects if ob.type == 'MESH' and ob.hide == False and context.scene in ob.users_scene):
                 context.scene.objects.active = ob
                 bpy.ops.object.mode_set(mode = cm, toggle=False) 
             
@@ -730,11 +730,8 @@
             ob.vertex_groups.active.name = 'texture plane'   
             bpy.ops.uv.unwrap()
             
-            bpy.ops.mesh.select_all(action='SELECT')
-            bpy.ops.uv.select_all(action='DESELECT') 
             bpy.ops.mesh.select_all(action='DESELECT')                                
             bpy.ops.object.vertex_group_select()
-            bpy.ops.uv.select_all(action='SELECT')
             
             bpy.ops.object.editmode_toggle()
             for i in range(4):
@@ -829,7 +826,7 @@
                                    
             bpy.ops.mesh.select_all(action='DESELECT')                    
             
-            ob.vertex_groups.active.name = 'texture plane'
+            ob.vertex_groups.active_index = ob.vertex_groups['texture plane'].index
             bpy.ops.object.vertex_group_select()
             bpy.ops.mesh.delete()
             bpy.ops.object.vertex_group_remove()
@@ -875,7 +872,7 @@
                     km.keymap_items.remove(kmi)
             
             tmp = context.object
-            for ob in (ob for ob in bpy.data.objects if ob.type == 'MESH'):
+            for ob in (ob for ob in bpy.data.objects if ob.type == 'MESH' and ob.hide == False and context.scene in ob.users_scene):
                 context.scene.objects.active = ob
                 bpy.ops.object.mode_set(mode = 'OBJECT', toggle=False) 
             
@@ -930,7 +927,7 @@
                 bpy.ops.mesh.reveal()
                                        
                 bpy.ops.mesh.select_all(action='DESELECT')                               
-                ob.vertex_groups.active.name = 'texture plane'
+                ob.vertex_groups.active_index = ob.vertex_groups['texture plane'].index
                 bpy.ops.object.vertex_group_select()
                 lo_b = [ob for ob in bpy.data.objects if ob.type == 'MESH']
                 bpy.ops.mesh.separate(type='SELECTED')
@@ -959,21 +956,16 @@
                 context.scene.objects.active = bplane
                 for ms in (ms for ms in bplane.material_slots if ms.name != 'Material for BProjection'):
                     bplane.active_material = ms.material
-                    bpy.ops.object.material_slot_remove() 
+                    bpy.ops.object.material_slot_remove()
+                
+                for gs in (gs for gs in bplane.vertex_groups if gs.name != 'texture plane'):
+                    bplane.vertex_groups.active_index = gs.index
+                    bpy.ops.object.vertex_group_remove()
               
                 context.scene.objects.active = new_ob
                 cm = new_ob.mode
                 bpy.ops.object.mode_set(mode = 'OBJECT', toggle=False) 
                 bpy.ops.object.join()
-                
-                bpy.ops.object.editmode_toggle()
-                bpy.ops.mesh.select_all(action='SELECT')
-                bpy.ops.uv.select_all(action='DESELECT') 
-                bpy.ops.mesh.select_all(action='DESELECT')                                
-                new_ob.vertex_groups.active.name = 'texture plane'
-                bpy.ops.object.vertex_group_select()
-                bpy.ops.uv.select_all(action='SELECT')          
-                bpy.ops.object.editmode_toggle()
     
                 em.hide = False
                 em.select = True
@@ -991,7 +983,7 @@
                 em.custom_active_object = new_ob.name
                 tmp = em.custom_c3d
                 em.custom_c3d = False
-                bpy.ops.object.active_view(index = shape_index-1)
+                #bpy.ops.object.active_view(index = shape_index-1)
                 bpy.ops.object.mode_set(mode = cm, toggle=False)
                         
                 sd = context.space_data



More information about the Bf-extensions-cvs mailing list