[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3123] trunk/py/scripts/addons/ io_scene_x3d/import_x3d.py: x3d now works with BMesh updates

Campbell Barton ideasman42 at gmail.com
Thu Mar 15 21:04:50 CET 2012


Revision: 3123
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3123
Author:   campbellbarton
Date:     2012-03-15 20:04:44 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
x3d now works with BMesh updates

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_x3d/import_x3d.py

Modified: trunk/py/scripts/addons/io_scene_x3d/import_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/import_x3d.py	2012-03-15 18:32:58 UTC (rev 3122)
+++ trunk/py/scripts/addons/io_scene_x3d/import_x3d.py	2012-03-15 20:04:44 UTC (rev 3123)
@@ -1675,7 +1675,7 @@
         #   bpymesh.faces.extend(faces, smooth=True)
 
     bpymesh.validate()
-    bpymesh.update()
+    # bpymesh.update()  # cant call now, because it would convert tessface
 
     if len(bpymesh.faces) != len(faces):
         print('\tWarning: adding faces did not work! file is invalid, not adding UVs or vcolors')
@@ -1687,7 +1687,7 @@
     if coords_tex:
         #print(ifs_texpoints)
         # print(geom)
-        uvlay = bpymesh.uv_textures.new()
+        uvlay = bpymesh.tessface_uv_textures.new()
 
         for i, f in enumerate(uvlay.data):
             f.image = bpyima
@@ -1762,7 +1762,7 @@
             # This should be safe because when 2 axies have the same length, the lower index will be used.
             axis_v += 1
 
-        uvlay = bpymesh.uv_textures.new()
+        uvlay = bpymesh.tessface_uv_textures.new()
 
         # HACK !!! - seems to be compatible with Cosmo though.
         depth_v = depth_u = max(depth_v, depth_u)
@@ -1782,7 +1782,7 @@
     # Add vcote
     if vcolor:
         # print(ifs_vcol)
-        collay = bpymesh.vertex_colors.new()
+        collay = bpymesh.tessface_vertex_colors.new()
 
         for f_idx, f in enumerate(collay.data):
             fv = bpymesh.faces[f_idx].vertices[:]
@@ -1829,6 +1829,8 @@
     # XXX25
     # bpymesh.vertices.delete([0, ])  # EEKADOODLE
 
+    bpymesh.update()
+
     return bpymesh, ccw
 
 
@@ -2169,17 +2171,17 @@
                 if bpymat:
                     bpydata.materials.append(bpymat)
 
-                if bpydata.uv_textures:
+                if bpydata.tessface_uv_textures:
 
                     if depth == 32:  # set the faces alpha flag?
                         transp = Mesh.FaceTranspModes.ALPHA
-                        for f in bpydata.uv_textures.active.data:
+                        for f in bpydata.tessface_uv_textures.active.data:
                             f.blend_type = 'ALPHA'
 
                     if texmtx:
                         # Apply texture transform?
                         uv_copy = Vector()
-                        for f in bpydata.uv_textures.active.data:
+                        for f in bpydata.tessface_uv_textures.active.data:
                             fuv = f.uv
                             for i, uv in enumerate(fuv):
                                 uv_copy.x = uv[0]



More information about the Bf-extensions-cvs mailing list