[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4599] contrib/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] fix for vertexgroup by IdeasMan42 and some refactoring.

paul geraskin paul_geraskin at mail.ru
Tue Jun 25 17:14:11 CEST 2013


Revision: 4599
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4599
Author:   mifth
Date:     2013-06-25 15:14:11 +0000 (Tue, 25 Jun 2013)
Log Message:
-----------
[TextureAtlas] fix for vertexgroup by IdeasMan42 and some refactoring.

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

Modified: contrib/py/scripts/addons/uv_texture_atlas.py
===================================================================
--- contrib/py/scripts/addons/uv_texture_atlas.py	2013-06-25 13:34:22 UTC (rev 4598)
+++ contrib/py/scripts/addons/uv_texture_atlas.py	2013-06-25 15:14:11 UTC (rev 4599)
@@ -173,14 +173,14 @@
 
     def execute(self, context):
         scene = context.scene
-        old_context = context.area.type
+        #old_context = context.area.type
 
         # Check if group exists
         if check_group_exist(self, context) is False:
             return {'CANCELLED'}
 
         group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
-        context.area.type = 'VIEW_3D'
+        #context.area.type = 'VIEW_3D'
 
         if scene.objects.active is not None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -199,7 +199,7 @@
             else:
                 self.report({'INFO'}, "Not All Objects Are Visible!!!")
 
-        context.area.type = old_context
+        #context.area.type = old_context
         return{'FINISHED'}
 
 
@@ -356,13 +356,13 @@
     def execute(self, context):
         # set 3dView context
         scene = context.scene
-        old_context = context.area.type
+        #old_context = context.area.type
 
         # Check if group exists
         if check_group_exist(self, context) is False:
             return {'CANCELLED'}
 
-        context.area.type = 'VIEW_3D'
+        #context.area.type = 'VIEW_3D'
 
         if scene.objects.active is not None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -384,7 +384,7 @@
                     bpy.data.groups[group_name].objects.unlink(object)
                     object.hide_render = False
 
-        context.area.type = old_context
+        #context.area.type = old_context
         return {'FINISHED'}
 
 
@@ -403,8 +403,8 @@
             return {'CANCELLED'}
 
         # set 3dView context
-        old_context = context.area.type
-        context.area.type = 'VIEW_3D'
+        #old_context = context.area.type
+        #context.area.type = 'VIEW_3D'
 
         if scene.objects.active is not None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -427,7 +427,7 @@
 
                 UVLIST.clear()  # clear array
 
-        context.area.type = old_context
+        #context.area.type = old_context
         return {'FINISHED'}
 
 
@@ -615,14 +615,9 @@
 
             # create vertex groups for each selected object
             scene.objects.active = bpy.data.objects[activeNowObject.name]
-            bpy.ops.object.mode_set(mode='EDIT')
-            bpy.ops.mesh.select_all(action='SELECT')
-            bpy.ops.object.vertex_group_add()
-            bpy.ops.object.vertex_group_assign()
-            id = len(context.object.vertex_groups) - 1
-            context.active_object.vertex_groups[id].name = object.name
-            bpy.ops.mesh.select_all(action='DESELECT')
-            bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+            vgroup = activeNowObject.vertex_groups.new(name=object.name)
+            vgroup.add(list(range(len(activeNowObject.data.vertices))), weight=1.0, type='ADD')
+            id = len(activeNowObject.vertex_groups) - 1
 
             # save object name and object location in merged object
             item = ob_merge.ms_merged_objects.add()



More information about the Bf-extensions-cvs mailing list