[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4579] contrib/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] refactoring again.

paul geraskin paul_geraskin at mail.ru
Fri Jun 14 14:55:35 CEST 2013


Revision: 4579
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4579
Author:   mifth
Date:     2013-06-14 12:55:34 +0000 (Fri, 14 Jun 2013)
Log Message:
-----------
[TextureAtlas] refactoring again.

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-14 12:29:07 UTC (rev 4578)
+++ contrib/py/scripts/addons/uv_texture_atlas.py	2013-06-14 12:55:34 UTC (rev 4579)
@@ -341,8 +341,8 @@
                   if object.type == 'MESH' and bpy.data.groups[group_name] in object.users_group:
 
                          ### remove UV
-                         if object.data.uv_textures[group_name] is not None:
-                             tex = object.data.uv_textures[group_name]
+                         tex = object.data.uv_textures.get(group_name)
+                         if tex is not None:
                              object.data.uv_textures.remove(tex)
 
                          #### remove from group
@@ -482,19 +482,20 @@
             scene.objects.active = object
             bpy.ops.object.mode_set(mode='EDIT')
             
-          
+            tex = None
             if context.object.data.uv_textures.active is None:
-                context.object.data.uv_textures.new()
-                context.object.data.uv_textures.active.name = self.group_name
+                tex = context.object.data.uv_textures.new()
+                tex.name = self.group_name
             else:    
                 if self.group_name not in context.object.data.uv_textures:
-                    context.object.data.uv_textures.new()
-                    context.object.data.uv_textures.active.name = self.group_name
-                    context.object.data.uv_textures[self.group_name].active = True
-                    context.object.data.uv_textures[self.group_name].active_render = True
+                    tex = context.object.data.uv_textures.new()
+                    tex.name = self.group_name
+                    tex.active = True
+                    tex.active_render = True
                 else:
-                    context.object.data.uv_textures[self.group_name].active = True
-                    context.object.data.uv_textures[self.group_name].active_render = True
+                    tex = context.object.data.uv_textures[self.group_name]
+                    tex.active = True
+                    tex.active_render = True
           
             bpy.ops.mesh.select_all(action='SELECT')
           



More information about the Bf-extensions-cvs mailing list