[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26994] trunk/blender/release/scripts/op/ object.py: join as UVs referenced older api function name

Campbell Barton ideasman42 at gmail.com
Wed Feb 17 17:31:37 CET 2010


Revision: 26994
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26994
Author:   campbellbarton
Date:     2010-02-17 17:31:37 +0100 (Wed, 17 Feb 2010)

Log Message:
-----------
join as UVs referenced older api function name

Modified Paths:
--------------
    trunk/blender/release/scripts/op/object.py

Modified: trunk/blender/release/scripts/op/object.py
===================================================================
--- trunk/blender/release/scripts/op/object.py	2010-02-17 16:18:41 UTC (rev 26993)
+++ trunk/blender/release/scripts/op/object.py	2010-02-17 16:31:37 UTC (rev 26994)
@@ -364,34 +364,37 @@
         if is_editmode:
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
-        len_faces = len(mesh.faces)
+        if not mesh.active_uv_texture:
+            self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
+        else:
+            len_faces = len(mesh.faces)
 
-        uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
-        mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array)
+            uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
+            mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array)
 
-        objects = context.selected_editable_objects[:]
+            objects = context.selected_editable_objects[:]
 
-        for obj_other in objects:
-            if obj_other.type == 'MESH':
-                obj_other.data.tag = False
+            for obj_other in objects:
+                if obj_other.type == 'MESH':
+                    obj_other.data.tag = False
 
-        for obj_other in objects:
-            if obj_other != obj and obj_other.type == 'MESH':
-                mesh_other = obj_other.data
-                if mesh_other != mesh:
-                    if mesh_other.tag == False:
-                        mesh_other.tag = True
+            for obj_other in objects:
+                if obj_other != obj and obj_other.type == 'MESH':
+                    mesh_other = obj_other.data
+                    if mesh_other != mesh:
+                        if mesh_other.tag == False:
+                            mesh_other.tag = True
 
-                        if len(mesh_other.faces) != len_faces:
-                            self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
-                        else:
-                            uv_other = mesh_other.active_uv_texture
-                            if not uv_other:
-                                mesh_other.uv_texture_add() # should return the texture it adds
+                            if len(mesh_other.faces) != len_faces:
+                                self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
+                            else:
                                 uv_other = mesh_other.active_uv_texture
+                                if not uv_other:
+                                    mesh_other.add_uv_texture() # should return the texture it adds
+                                    uv_other = mesh_other.active_uv_texture
 
-                            # finally do the copy
-                            uv_other.data.foreach_set("uv_raw", uv_array)
+                                # finally do the copy
+                                uv_other.data.foreach_set("uv_raw", uv_array)
 
         if is_editmode:
             bpy.ops.object.mode_set(mode='EDIT', toggle=False)





More information about the Bf-blender-cvs mailing list