diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-17 20:00:27 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-17 20:00:27 +0300 |
commit | a04573f4aacb2bfcceba3d5bbfce2df5d372167e (patch) | |
tree | b47b6afb1f5ebb21f7d690a21bcec15c9e53e32f /source/blender/blenkernel | |
parent | 0b60fb5ec245db5b14bd51bce216efff462fad75 (diff) |
Fluid: Fix that maps old smoke and fluid modifiers to new manta modifier
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_fluid.h | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 117 |
3 files changed, 137 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index dfccd0732ee..9855c2202cc 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ * \note Use #STRINGIFY() rather than defining with quotes. */ #define BLENDER_VERSION 282 -#define BLENDER_SUBVERSION 5 +#define BLENDER_SUBVERSION 6 /** Several breakages with 280, e.g. collections vs layers. */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_fluid.h b/source/blender/blenkernel/BKE_fluid.h index 3e389cfec58..af8e79275eb 100644 --- a/source/blender/blenkernel/BKE_fluid.h +++ b/source/blender/blenkernel/BKE_fluid.h @@ -66,4 +66,23 @@ void BKE_fluid_particle_system_create(struct Main *bmain, const int psys_type); void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_type); +void BKE_fluid_cachetype_mesh_set(struct FluidDomainSettings *settings, int cache_mesh_format); +void BKE_fluid_cachetype_data_set(struct FluidDomainSettings *settings, int cache_data_format); +void BKE_fluid_cachetype_particle_set(struct FluidDomainSettings *settings, + int cache_particle_format); +void BKE_fluid_cachetype_noise_set(struct FluidDomainSettings *settings, int cache_noise_format); +void BKE_fluid_collisionextents_set(struct FluidDomainSettings *settings, int value, bool clear); +void BKE_fluid_particles_set(struct FluidDomainSettings *settings, int value, bool clear); + +void BKE_fluid_domain_type_set(struct Object *object, + struct FluidDomainSettings *settings, + int type); +void BKE_fluid_flow_type_set(struct Object *object, struct FluidFlowSettings *settings, int type); +void BKE_fluid_effector_type_set(struct Object *object, + struct FluidEffectorSettings *settings, + int type); +void BKE_fluid_flow_behavior_set(struct Object *object, + struct FluidFlowSettings *settings, + int behavior); + #endif /* __BKE_FLUID_H__ */ diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 81c7c700cc2..e1eeb7f611d 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -4803,4 +4803,121 @@ void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_typ } } +void BKE_fluid_cachetype_mesh_set(FluidDomainSettings *settings, int cache_mesh_format) +{ + if (cache_mesh_format == settings->cache_mesh_format) { + return; + } + /* TODO(sebbas): Clear old caches. */ + settings->cache_mesh_format = cache_mesh_format; +} + +void BKE_fluid_cachetype_data_set(FluidDomainSettings *settings, int cache_data_format) +{ + if (cache_data_format == settings->cache_data_format) { + return; + } + /* TODO(sebbas): Clear old caches. */ + settings->cache_data_format = cache_data_format; +} + +void BKE_fluid_cachetype_particle_set(FluidDomainSettings *settings, int cache_particle_format) +{ + if (cache_particle_format == settings->cache_particle_format) { + return; + } + /* TODO(sebbas): Clear old caches. */ + settings->cache_particle_format = cache_particle_format; +} + +void BKE_fluid_cachetype_noise_set(FluidDomainSettings *settings, int cache_noise_format) +{ + if (cache_noise_format == settings->cache_noise_format) { + return; + } + /* TODO(sebbas): Clear old caches. */ + settings->cache_noise_format = cache_noise_format; +} + +void BKE_fluid_collisionextents_set(FluidDomainSettings *settings, int value, bool clear) +{ + if (clear) { + settings->border_collisions &= value; + } + else { + settings->border_collisions |= value; + } +} + +void BKE_fluid_particles_set(FluidDomainSettings *settings, int value, bool clear) +{ + if (clear) { + settings->particle_type &= ~value; + } + else { + settings->border_collisions |= value; + } +} + +void BKE_fluid_domain_type_set(Object *object, FluidDomainSettings *settings, int type) +{ + /* Set common values for liquid/smoke domain: cache type, + * border collision and viewport draw-type. */ + if (type == FLUID_DOMAIN_TYPE_GAS) { + BKE_fluid_cachetype_mesh_set(settings, FLUID_DOMAIN_FILE_BIN_OBJECT); + BKE_fluid_cachetype_data_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_cachetype_particle_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_cachetype_noise_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_FRONT, 1); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BACK, 1); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_RIGHT, 1); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_LEFT, 1); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_TOP, 1); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BOTTOM, 1); + object->dt = OB_WIRE; + } + else if (type == FLUID_DOMAIN_TYPE_LIQUID) { + BKE_fluid_cachetype_mesh_set(settings, FLUID_DOMAIN_FILE_BIN_OBJECT); + BKE_fluid_cachetype_data_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_cachetype_particle_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_cachetype_noise_set(settings, FLUID_DOMAIN_FILE_UNI); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_FRONT, 0); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BACK, 0); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_RIGHT, 0); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_LEFT, 0); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_TOP, 0); + BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BOTTOM, 0); + BKE_fluid_particles_set(settings, FLUID_DOMAIN_PARTICLE_FLIP, 0); + object->dt = OB_SOLID; + } + + /* Set actual domain type. */ + settings->type = type; +} + +void BKE_fluid_flow_behavior_set(Object *UNUSED(object), FluidFlowSettings *settings, int behavior) +{ + settings->behavior = behavior; +} + +void BKE_fluid_flow_type_set(Object *object, FluidFlowSettings *settings, int type) +{ + /* By default, liquid flow objects should behave like their geometry (geomtery behavior), + * gas flow objects should continously produce smoke (inflow behavior). */ + if (type == FLUID_FLOW_TYPE_LIQUID) { + BKE_fluid_flow_behavior_set(object, settings, FLUID_FLOW_BEHAVIOR_GEOMETRY); + } + else { + BKE_fluid_flow_behavior_set(object, settings, FLUID_FLOW_BEHAVIOR_INFLOW); + } + + /* Set actual flow type. */ + settings->type = type; +} + +void BKE_fluid_effector_type_set(Object *UNUSED(object), FluidEffectorSettings *settings, int type) +{ + settings->type = type; +} + #endif /* WITH_FLUID */ |