[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48866] trunk/blender/source/blender/ blenloader/intern/readfile.c: Fix #32067: since BMesh, files < 2.59. 3 no longer have their texface converted

Sergey Sharybin sergey.vfx at gmail.com
Thu Jul 12 17:36:22 CEST 2012


Revision: 48866
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48866
Author:   nazgul
Date:     2012-07-12 15:36:22 +0000 (Thu, 12 Jul 2012)
Log Message:
-----------
Fix #32067: since BMesh, files < 2.59.3 no longer have their texface converted

Issue was caused by performing conversion from FTFaces to materials from
the end of lib_link_mesh, where tesselated faces were cleared already.

This conversion can't be switched to BMesh structures because in future
MTexPolys could be changed in a way, that versioning stuff wouldn't work
any more. Another issue is that making such a conversion per-mesh would
lead to quite a code spagetti, which is difficult to follow.

Solved by splitting per-mesh cycle in lib_link_mesh, so now it consists
of three steps:

- Do linking stuff such as custom data layers, materials. Perform a
  Conversion stuff like tessface -> polys.

- Convert all MTFaces to materials. This conversion handles all meshes
  and creates needed materials.

- Free tessfaces, mark mesh as linked.

Such a separation shouldn't noticeably affect on speed of linking.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-07-12 15:14:50 UTC (rev 48865)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-07-12 15:36:22 UTC (rev 48866)
@@ -3688,7 +3688,14 @@
 				
 				G.main = gmain;
 			}
-			
+		}
+	}
+
+	/* convert texface options to material */
+	convert_tface_mt(fd, main);
+
+	for (me = main->mesh.first; me; me = me->id.next) {
+		if (me->id.flag & LIB_NEEDLINK) {
 			/*
 			 * Re-tessellate, even if the polys were just created from tessfaces, this
 			 * is important because it:
@@ -3704,13 +3711,10 @@
 #else
 			BKE_mesh_tessface_clear(me);
 #endif
-			
+
 			me->id.flag -= LIB_NEEDLINK;
 		}
 	}
-	
-	/* convert texface options to material */
-	convert_tface_mt(fd, main);
 }
 
 static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)




More information about the Bf-blender-cvs mailing list