[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4597] contrib/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] patch by IdeasMan42.

paul geraskin paul_geraskin at mail.ru
Tue Jun 25 12:36:13 CEST 2013


Revision: 4597
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4597
Author:   mifth
Date:     2013-06-25 10:36:13 +0000 (Tue, 25 Jun 2013)
Log Message:
-----------
[TextureAtlas] patch by IdeasMan42. 2

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 09:51:42 UTC (rev 4596)
+++ contrib/py/scripts/addons/uv_texture_atlas.py	2013-06-25 10:36:13 UTC (rev 4597)
@@ -505,50 +505,31 @@
         # create lightmap uv layout
 
         # Create/Update Image
-        image = None
-        if self.group_name not in bpy.data.images:
+        image = bpy.data.images.get(self.group_name)
+        if image is None:
             image = bpy.data.images.new(name=self.group_name, width=self.resolution, height=self.resolution)
-        else:
-            image = bpy.data.images[self.group_name]
 
         image.generated_type = 'COLOR_GRID'
         image.generated_width = self.resolution
         image.generated_height = self.resolution
 
-        #
         for object in bpy.data.groups[self.group_name].objects:
-            bpy.ops.object.select_all(action='DESELECT')
-            object.hide = False
-            object.select = True
-            scene.objects.active = object
-            bpy.ops.object.mode_set(mode='EDIT')
-
-            tex = None
-            if context.object.data.uv_textures.active is None:
-                tex = context.object.data.uv_textures.new()
+            if object.data.uv_textures.active is None:
+                tex = object.data.uv_textures.new()
                 tex.name = self.group_name
             else:
-                if self.group_name not in context.object.data.uv_textures:
-                    tex = context.object.data.uv_textures.new()
+                if self.group_name not in object.data.uv_textures:
+                    tex = object.data.uv_textures.new()
                     tex.name = self.group_name
                     tex.active = True
                     tex.active_render = True
                 else:
-                    tex = context.object.data.uv_textures[self.group_name]
+                    tex = object.data.uv_textures[self.group_name]
                     tex.active = True
                     tex.active_render = True
-
-            bpy.ops.mesh.select_all(action='SELECT')
-
-            # set Image
-            bpy.ops.mesh.select_all(action='SELECT')
-            context.area.type = 'IMAGE_EDITOR'
-            bpy.data.screens[context.screen.name].areas[
-                1].spaces[0].image = bpy.data.images[self.group_name]
-            context.area.type = 'VIEW_3D'
-
-            if scene.objects.active is not None:
-                bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+                    
+            for face_tex in tex.data:
+                face_tex.image = image
         return{'FINISHED'}
 
 



More information about the Bf-extensions-cvs mailing list