diff options
author | Nils Thuerey <nils@thuerey.de> | 2006-06-12 10:18:57 +0400 |
---|---|---|
committer | Nils Thuerey <nils@thuerey.de> | 2006-06-12 10:18:57 +0400 |
commit | a0d94e672730e854d05157133a755ee3257f373a (patch) | |
tree | a6eb2e3bf7d2b7771abdd4e6f9edfb139f8bd87f /source | |
parent | 9262cdbd0ec738ee5d470f87198f65c4977d9b44 (diff) |
- added fix for fluidsim copying bug
(surface mesh structs werent handled correctly,
copying is now done in a new function)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/bad_level_call_stubs/stubs.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 5 | ||||
-rw-r--r-- | source/blender/src/fluidsim.c | 31 |
3 files changed, 36 insertions, 2 deletions
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index b927cbe98ef..1bad2de5bbc 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -60,6 +60,7 @@ void insert_vert_ipo(struct IpoCurve *icu, float x, float y); struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e); void elbeemDebugOut(char *msg); void fluidsimSettingsFree(struct FluidsimSettings* sb); +void fluidsimSettingsCopy(struct FluidsimSettings* sb); /* readfile.c */ @@ -224,6 +225,7 @@ struct DispListMesh *NewBooleanMeshDLM(struct Object *ob, struct Object *ob_sele // bobj read/write debug messages void elbeemDebugOut(char *msg) {} void fluidsimSettingsFree(struct FluidsimSettings* sb) {} +void fluidsimSettingsCopy(struct FluidsimSettings* sb) {} /*new render funcs */ void externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta) {} diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f76137c586f..d4aa87ec87a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -902,8 +902,9 @@ Object *copy_object(Object *ob) obn->soft= copy_softbody(ob->soft); /* NT copy fluid sim setting memory */ - if(obn->fluidsimSettings) obn->fluidsimSettings = MEM_dupallocN(ob->fluidsimSettings); - else obn->fluidsimSettings = NULL; + //if(obn->fluidsimSettings) obn->fluidsimSettings = MEM_dupallocN(ob->fluidsimSettings); + //else obn->fluidsimSettings = NULL; + obn->fluidsimSettings = fluidsimSettingsCopy(ob->fluidsimSettings); obn->derivedDeform = NULL; obn->derivedFinal = NULL; diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c index 858c01834b9..8f028d9670f 100644 --- a/source/blender/src/fluidsim.c +++ b/source/blender/src/fluidsim.c @@ -208,6 +208,37 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) return fss; } +/* duplicate struct, analogous to free */ +FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) +{ + FluidsimSettings *dupfss; + Mesh *dupFsMesh = NULL; + + if(!fss) return NULL; + dupfss = MEM_dupallocN(fss); + + dupFsMesh = fss->meshSurface; + if(dupFsMesh) { + dupfss->meshSurface = MEM_dupallocN(dupFsMesh); + if(dupFsMesh->mvert) dupfss->meshSurface->mvert = MEM_dupallocN(dupFsMesh->mvert); + if(dupFsMesh->medge) dupfss->meshSurface->medge = MEM_dupallocN(dupFsMesh->medge); + if(dupFsMesh->mface) dupfss->meshSurface->mface = MEM_dupallocN(dupFsMesh->mface); + } + + dupFsMesh = fss->meshBB; + if(dupFsMesh) { + dupfss->meshBB = MEM_dupallocN(dupFsMesh); + if(dupFsMesh->mvert) dupfss->meshBB->mvert = MEM_dupallocN(dupFsMesh->mvert); + if(dupFsMesh->medge) dupfss->meshBB->medge = MEM_dupallocN(dupFsMesh->medge); + if(dupFsMesh->mface) dupfss->meshBB->mface = MEM_dupallocN(dupFsMesh->mface); + } + + if(fss->meshSurfNormals) dupfss->meshSurfNormals = MEM_dupallocN(fss->meshSurfNormals); + + return dupfss; +} + + /* free struct */ void fluidsimSettingsFree(FluidsimSettings *fss) { |