From 196a3e410458182105b0356d1f9c9230637b216f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Aug 2007 08:40:14 +0000 Subject: 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. --- source/blender/blenkernel/intern/exotic.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index fe52a3fc198..0f1f8c6078a 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -3025,7 +3025,7 @@ void write_vrml(char *str) /* 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 @@ void write_vrml(char *str) 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 @@ void write_dxf(char *str) 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; -- cgit v1.2.3