From 58c88bcf7636abce291168af189284181f2f7033 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Thu, 30 Jul 2009 15:00:26 +0000 Subject: BF2.5: First commit of smoke code. Not working: a) rendering (since volumterics branch is not merged yet) b) moving collision objects of any kind c) saving of collision objects (because that's what I am working on) d) pointcache e) A bunch of other things I already know of So please do not report any bugs on this one yet :-) --- source/blender/blenloader/intern/readfile.c | 65 +++++++++++++++++++++++++++- source/blender/blenloader/intern/writefile.c | 13 ++++++ 2 files changed, 77 insertions(+), 1 deletion(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3029e482312..8a376a0a170 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -94,6 +94,7 @@ #include "DNA_sdna_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_smoke_types.h" #include "DNA_sound_types.h" #include "DNA_space_types.h" #include "DNA_texture_types.h" @@ -3539,6 +3540,17 @@ static void lib_link_object(FileData *fd, Main *main) if(fluidmd && fluidmd->fss) fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo); } + + { + SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke); + + if(smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) + { + smd->domain->coll_group = newlibadr_us(fd, ob->id.lib, smd->domain->coll_group); + smd->domain->eff_group = newlibadr_us(fd, ob->id.lib, smd->domain->eff_group); + smd->domain->fluid_group = newlibadr_us(fd, ob->id.lib, smd->domain->fluid_group); + } + } /* texture field */ if(ob->pd) @@ -3630,6 +3642,44 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) fluidmd->fss= newdataadr(fd, fluidmd->fss); fluidmd->fss->meshSurfNormals = 0; } + else if (md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_DOMAIN) + { + smd->flow = NULL; + smd->coll = NULL; + if(smd->domain) + smd->domain = newdataadr(fd, smd->domain); + + smd->domain->fluid = NULL; + smd->domain->tvox = NULL; + smd->domain->tray = NULL; + smd->domain->tvoxbig = NULL; + smd->domain->traybig = NULL; + smd->domain->bind = NULL; + smd->domain->max_textures = 0; + smd->domain->viewsettings = 0; // reset view for new frame + } + else if(smd->type==MOD_SMOKE_TYPE_FLOW) + { + smd->domain = NULL; + smd->coll = NULL; + smd->flow = newdataadr(fd, smd->flow); + smd->flow->psys = newdataadr(fd, smd->flow->psys); + } + else if(smd->type==MOD_SMOKE_TYPE_COLL) + { + smd->flow = NULL; + smd->domain = NULL; + smd->coll = NULL; + /* + smd->coll = newdataadr(fd, smd->coll); + smd->coll->points = NULL; + smd->coll->numpoints = 0; + */ + } + } else if (md->type==eModifierType_Collision) { CollisionModifierData *collmd = (CollisionModifierData*) md; @@ -4846,7 +4896,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc) } else if(sl->spacetype==SPACE_LOGIC) { SpaceLogic *slogic= (SpaceLogic *)sl; - + if(slogic->gpd) { slogic->gpd= newdataadr(fd, slogic->gpd); direct_link_gpencil(fd, slogic->gpd); @@ -10130,6 +10180,19 @@ static void expand_modifier(FileData *fd, Main *mainvar, ModifierData *md) expand_doit(fd, mainvar, dmd->map_object); expand_doit(fd, mainvar, dmd->texture); } + else if (md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) + { + //if(smd->domain->coll_group) + expand_doit(fd, mainvar, smd->domain->coll_group); + //if(smd->domain->fluid_group) + expand_doit(fd, mainvar, smd->domain->fluid_group); + //if(smd->domain->eff_group) + expand_doit(fd, mainvar, smd->domain->eff_group); + } + } } static void expand_object(FileData *fd, Main *mainvar, Object *ob) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 0f693b6de31..da68132700d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -130,6 +130,7 @@ Any case: direct data is ALWAYS after the lib block #include "DNA_sdna_types.h" #include "DNA_sequence_types.h" #include "DNA_sensor_types.h" +#include "DNA_smoke_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" #include "DNA_sound_types.h" @@ -1116,6 +1117,18 @@ static void write_modifiers(WriteData *wd, ListBase *modbase, int write_undo) writestruct(wd, DATA, "ClothCollSettings", 1, clmd->coll_parms); write_pointcaches(wd, clmd->point_cache, PTCACHE_WRITE_CLOTH); } + else if(md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_DOMAIN) + writestruct(wd, DATA, "SmokeDomainSettings", 1, smd->domain); + else if(smd->type==MOD_SMOKE_TYPE_FLOW) + writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow); + /* + else if(smd->type==MOD_SMOKE_TYPE_COLL) + writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll); + */ + } else if(md->type==eModifierType_Fluidsim) { FluidsimModifierData *fluidmd = (FluidsimModifierData*) md; -- cgit v1.2.3