[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11731] trunk/blender/source/blender/ blenkernel/intern/exotic.c: VRML and DXF were saving all meshes that had at least one user - so all meshes in other scenes , and meshes without object users like textmesh.

Campbell Barton cbarton at metavr.com
Mon Aug 20 10:40:14 CEST 2007


Revision: 11731
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11731
Author:   campbellbarton
Date:     2007-08-20 10:40:14 +0200 (Mon, 20 Aug 2007)

Log Message:
-----------
VRML and DXF were saving all meshes that had at least one user - so all meshes in other scenes, and meshes without object users like textmesh.
used the flag LIB_DOIT to tag meshes used in the current scene and only write those.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/exotic.c

Modified: trunk/blender/source/blender/blenkernel/intern/exotic.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/exotic.c	2007-08-20 08:34:25 UTC (rev 11730)
+++ trunk/blender/source/blender/blenkernel/intern/exotic.c	2007-08-20 08:40:14 UTC (rev 11731)
@@ -3025,7 +3025,7 @@
 	
 	/* FIRST: write all the datablocks */
 	
-	fprintf(fp, "#VRML V1.0 ascii\n\n# Blender V2.0\n\n# 'Switch' is used as a hack, to ensure it is not part of the drawing\n\n");
+	fprintf(fp, "#VRML V1.0 ascii\n\n# Blender V%d\n\n# 'Switch' is used as a hack, to ensure it is not part of the drawing\n\n", G.version);
 	fprintf(fp, "Separator {\n");
 	fprintf(fp, "Switch {\n");
 
@@ -3037,9 +3037,16 @@
 		ma= ma->id.next;
 	}
 
+	/* only write meshes we're using in this scene */
+	flag_listbase_ids(&G.main->mesh, LIB_DOIT, 0);
+	
+	for(base= G.scene->base.first; base; base= base->next)
+		if(base->object->type== OB_MESH)
+			((ID *)base->object->data)->flag |= LIB_DOIT;	
+	
 	me= G.main->mesh.first;
 	while(me) {
-		if(me->id.us) {
+		if(me->id.flag & LIB_DOIT) { /* is the mesh used in this scene ? */
 			write_mesh_vrml(fp, me);
 		}
 		me= me->id.next;
@@ -3342,10 +3349,18 @@
 	write_group(0, "SECTION");
     write_group(2, "BLOCKS");
 
+    
+	/* only write meshes we're using in this scene */
+	flag_listbase_ids(&G.main->mesh, LIB_DOIT, 0);
+	
+	for(base= G.scene->base.first; base; base= base->next)
+		if(base->object->type== OB_MESH)
+			((ID *)base->object->data)->flag |= LIB_DOIT;	
+	
 	/* Write all the meshes */
 	me= G.main->mesh.first;
 	while(me) {
-		if(me->id.us) {
+		if(me->id.flag & LIB_DOIT) { /* is the mesh used in this scene ? */
 			write_mesh_dxf(fp, me);
 		}
 		me= me->id.next;





More information about the Bf-blender-cvs mailing list