diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-13 16:17:27 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-13 16:17:27 +0400 |
commit | 11c83d843206648a33bcc8b4d754577ec0a51d2a (patch) | |
tree | 58af33c372ba5d77f68d6ed7b37e5aecd6e6c678 /source/blender/blenloader | |
parent | b1019a56b54294fc91293c5c43ef46d54950ae84 (diff) |
Ocean Sim modifier patch
by Matt Ebb, Hamed Zaghaghi
This adds a new Modifier "Ocean" to simulate large-scale wave motion.
Details can be found in the wiki documentation [1], the project homepage [2] and the patch tracker [3]
The modifier is disabled by default for now. To enable it, the WITH_OCEANSIM (cmake) / WITH_BF_OCEANSIM (scons) flags have to be set. The code depends on fftw3, so this also has to be enabled.
[1]
http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Simulation/Ocean
[2]
http://www.savetheoceansim.com
[3]
http://projects.blender.org/tracker/?group_id=9&atid=127&func=detail&aid=28338
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 32 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3fd661a52da..9e3feedc5d9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -120,6 +120,7 @@ #include "BKE_modifier.h" #include "BKE_multires.h" #include "BKE_node.h" // for tree type defines +#include "BKE_ocean.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_particle.h" @@ -3101,6 +3102,8 @@ static void lib_link_texture(FileData *fd, Main *main) if(tex->pd) tex->pd->object= newlibadr(fd, tex->id.lib, tex->pd->object); if(tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object); + if(tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object); + if(tex->nodetree) lib_link_ntree(fd, &tex->id, tex->nodetree); @@ -3152,6 +3155,8 @@ static void direct_link_texture(FileData *fd, Tex *tex) tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData"); } + tex->ot= newdataadr(fd, tex->ot); + tex->nodetree= newdataadr(fd, tex->nodetree); if(tex->nodetree) direct_link_nodetree(fd, tex->nodetree); @@ -4368,6 +4373,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) SWITCH_INT(mmd->bindcos[a]) } } + else if (md->type==eModifierType_Ocean) { + OceanModifierData *omd = (OceanModifierData*) md; + omd->oceancache = NULL; + omd->ocean = NULL; + omd->refresh = (MOD_OCEAN_REFRESH_ADD|MOD_OCEAN_REFRESH_RESET|MOD_OCEAN_REFRESH_SIM); + } else if (md->type==eModifierType_Warp) { WarpModifierData *tmd = (WarpModifierData *) md; @@ -11846,6 +11857,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + + /* put compatibility code here until next subversion bump */ + if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) { + Object *ob; + Tex *tex; + + + /* ocean res is now squared, reset old ones - will be massive */ + for(ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + for(md= ob->modifiers.first; md; md= md->next) { + if (md->type == eModifierType_Ocean) { + OceanModifierData *omd = (OceanModifierData *)md; + omd->resolution = 7; + omd->oceancache = NULL; + } + } + } + } + + /* put compatibility code here until next subversion bump */ if (main->versionfile < 256) { bScreen *sc; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 11a80d0d41a..2bb70ce20b5 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1815,6 +1815,7 @@ static void write_textures(WriteData *wd, ListBase *idbase) if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve); } if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd); + if(tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot); /* nodetree is integral part of texture, no libdata */ if(tex->nodetree) { |