[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4561] contrib/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] removed bpy.

paul geraskin paul_geraskin at mail.ru
Mon Jun 10 14:46:44 CEST 2013


Revision: 4561
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4561
Author:   mifth
Date:     2013-06-10 12:46:44 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
[TextureAtlas] removed bpy.

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-10 12:21:35 UTC (rev 4560)
+++ contrib/py/scripts/addons/uv_texture_atlas.py	2013-06-10 12:46:44 UTC (rev 4561)
@@ -52,7 +52,7 @@
         row = self.layout.row(align=True)
 
         # Resolution and Unwrap types (only if Lightmap group is added)
-        if len(bpy.context.scene.ms_lightmap_groups) > 0:
+        if len(context.scene.ms_lightmap_groups) > 0:
             row.prop(context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index], 'resolution', text='Resolution',expand=True)
             row = self.layout.row()
             row.prop(context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index], 'unwrap_type', text='Lightmap',expand=True)
@@ -81,22 +81,22 @@
     bl_description = "Auto Unwrapping"
     
     def execute(self, context):
-        old_context = bpy.context.area.type
+        old_context = context.area.type
 
         
-        group = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index]
-        bpy.context.area.type = 'VIEW_3D'
-        if bpy.context.scene.objects.active != None:
+        group = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index]
+        context.area.type = 'VIEW_3D'
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
     
         if group.bake == True and len(bpy.data.groups[group.name].objects) > 0:
 
-             res = int(bpy.context.scene.ms_lightmap_groups[group.name].resolution)
+             res = int(context.scene.ms_lightmap_groups[group.name].resolution)
              bpy.ops.object.ms_create_lightmap(group_name=group.name, resolution=res)  
              bpy.ops.object.ms_merge_objects(group_name=group.name, unwrap=True)
              bpy.ops.object.ms_separate_objects(group_name=group.name) 
                  
-        bpy.context.area.type = old_context
+        context.area.type = old_context
 
         return{'FINISHED'}   
         
@@ -107,22 +107,22 @@
     bl_description = "Makes Manual Unwrapping Object"
     
     def execute(self, context):
-        old_context = bpy.context.area.type
+        old_context = context.area.type
 
         
-        group = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index]
-        bpy.context.area.type = 'VIEW_3D'
-        if bpy.context.scene.objects.active != None:
+        group = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index]
+        context.area.type = 'VIEW_3D'
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
     
         if group.bake == True and len(bpy.data.groups[group.name].objects) > 0:
 
-             res = int(bpy.context.scene.ms_lightmap_groups[group.name].resolution)
+             res = int(context.scene.ms_lightmap_groups[group.name].resolution)
              bpy.ops.object.ms_create_lightmap(group_name=group.name, resolution=res)  
                     
              bpy.ops.object.ms_merge_objects(group_name=group.name, unwrap=False)
 
-        bpy.context.area.type = old_context
+        context.area.type = old_context
         return{'FINISHED'}
     
 
@@ -132,19 +132,19 @@
     bl_description = "Removes Manual Unwrapping Object"
     
     def execute(self, context):
-        old_context = bpy.context.area.type
+        old_context = context.area.type
 
         
-        group = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index]
-        bpy.context.area.type = 'VIEW_3D'
-        if bpy.context.scene.objects.active != None:
+        group = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index]
+        context.area.type = 'VIEW_3D'
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
     
         if group.bake == True and len(bpy.data.groups[group.name].objects) > 0:
 
              bpy.ops.object.ms_separate_objects(group_name=group.name) 
                       
-        bpy.context.area.type = old_context
+        context.area.type = old_context
         #bpy.ops.object.select_all(action='DESELECT')
         return{'FINISHED'}
         
@@ -191,7 +191,7 @@
     
     def execute(self, context):
         
-        group_name = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index].name
+        group_name = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index].name
             
         #Create a New Group if it was deleted.
         isExist = False
@@ -202,10 +202,10 @@
             bpy.data.groups.new(group_name)
 
         # Add objects to  ag roup    
-        if bpy.context.scene.objects.active != None:    
+        if context.scene.objects.active != None:    
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)    
             
-        for object in bpy.context.selected_objects:
+        for object in context.selected_objects:
             if object.type == 'MESH' and bpy.data.groups[group_name] not in object.users_group:
                 bpy.data.groups[group_name].objects.link(object)
                                     
@@ -219,9 +219,9 @@
     
     def execute(self, context):
         
-        group_name = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index].name
+        group_name = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index].name
 
-        if bpy.context.scene.objects.active != None:
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
         bpy.ops.object.select_all(action='DESELECT')
         for object in bpy.data.groups[group_name].objects:
@@ -250,17 +250,17 @@
     
     def execute(self, context):
         ### set 3dView context
-        old_context = bpy.context.area.type        
-        bpy.context.area.type = 'VIEW_3D'
+        old_context = context.area.type        
+        context.area.type = 'VIEW_3D'
         
-        if bpy.context.scene.objects.active != None:
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
         
-        for group in bpy.context.scene.ms_lightmap_groups:        
+        for group in context.scene.ms_lightmap_groups:        
             group_name = group.name
 
-            for object in bpy.context.selected_objects:
-                  bpy.context.scene.objects.active = object
+            for object in context.selected_objects:
+                  context.scene.objects.active = object
         
                   if object.type == 'MESH' and bpy.data.groups[group_name] in object.users_group:
 
@@ -272,7 +272,7 @@
                          object.hide_render = False
 
                          
-        bpy.context.area.type = old_context
+        context.area.type = old_context
         return {'FINISHED'}          
 
 class removeOtherUVs(bpy.types.Operator):
@@ -282,20 +282,20 @@
     
     
     def execute(self, context):
-        group_name = bpy.context.scene.ms_lightmap_groups[bpy.context.scene.ms_lightmap_groups_index].name
+        group_name = context.scene.ms_lightmap_groups[context.scene.ms_lightmap_groups_index].name
         
         # set 3dView context
-        old_context = bpy.context.area.type        
-        bpy.context.area.type = 'VIEW_3D'
+        old_context = context.area.type        
+        context.area.type = 'VIEW_3D'
         
-        if bpy.context.scene.objects.active != None:
+        if context.scene.objects.active != None:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
         #bpy.ops.object.select_all(action='DESELECT')
             
             
         # Remove other UVs of selected objects
-        for object in bpy.context.selected_objects:
-              bpy.context.scene.objects.active = object
+        for object in context.selected_objects:
+              context.scene.objects.active = object
               if object.type == 'MESH' and bpy.data.groups[group_name] in object.users_group:
     
                    #remove UVs
@@ -311,7 +311,7 @@
                    UVLIST = [] #clear array
                   
                   
-        bpy.context.area.type = old_context                  
+        context.area.type = old_context                  
         return {'FINISHED'}          
         
         
@@ -325,15 +325,15 @@
     def execute(self, context):
         group = bpy.data.groups.new(self.name)
         
-        item = bpy.context.scene.ms_lightmap_groups.add() 
+        item = context.scene.ms_lightmap_groups.add() 
         item.name = group.name
         item.resolution = '1024'
-        bpy.context.scene.ms_lightmap_groups_index = len(bpy.context.scene.ms_lightmap_groups)-1
+        context.scene.ms_lightmap_groups_index = len(context.scene.ms_lightmap_groups)-1
         
-        if len(bpy.context.selected_objects) > 0:
-             for object in bpy.context.selected_objects:
-                 bpy.context.scene.objects.active = object
-                 if bpy.context.active_object.type == 'MESH':
+        if len(context.selected_objects) > 0:
+             for object in context.selected_objects:
+                 context.scene.objects.active = object
+                 if context.active_object.type == 'MESH':
                      bpy.data.groups[group.name].objects.link(object)
 
         
@@ -350,8 +350,8 @@
     
 
     def execute(self, context):
-        idx = bpy.context.scene.ms_lightmap_groups_index
-        group_name = bpy.context.scene.ms_lightmap_groups[idx].name
+        idx = context.scene.ms_lightmap_groups_index
+        group_name = context.scene.ms_lightmap_groups[idx].name
         
         # Remove Group
         for groupObj in bpy.data.groups:
@@ -361,13 +361,13 @@
                  for obj in bpy.data.groups[group_name].objects:
                       obj.hide_render = False
         
-                 bpy.data.groups.remove(bpy.data.groups[bpy.context.scene.ms_lightmap_groups[idx].name])
+                 bpy.data.groups.remove(bpy.data.groups[context.scene.ms_lightmap_groups[idx].name])
                  
         # Remove Lightmap Group         

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list