[Bf-blender-cvs] [fc31bd2950e] fluid-mantaflow: fluid guiding overhaul
Sebastián Barschkis
noreply at git.blender.org
Sat Jul 7 15:57:48 CEST 2018
Commit: fc31bd2950e3a0efe51da33bdeaba60653171f13
Author: Sebastián Barschkis
Date: Sat Jul 7 15:56:39 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBfc31bd2950e3a0efe51da33bdeaba60653171f13
fluid guiding overhaul
- fluid guiding now has a separate cache. velocities from guiding
objects can be baked into this cache
- alternatively, another another (baked) fluid domain can be set as the
parent. its velocities will then used for the guiding effect (e.g. use
smoke sim to guide liquid sim)
- minor other updates: refactored manta-script exporter, fixed liquid
leak (fractions completely disabled now), naming cleanups, fix for
smoke resume bake (was missing velocity reload)
===================================================================
M intern/mantaflow/CMakeLists.txt
M intern/mantaflow/extern/manta_fluid_API.h
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/FLUID.h
M intern/mantaflow/intern/manta_fluid_API.cpp
M intern/mantaflow/intern/manta_pp/omp/gitinfo.h
M intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
M intern/mantaflow/intern/manta_pp/omp/plugin/secondaryparticles.cpp
M intern/mantaflow/intern/manta_pp/omp/registration.cpp
M intern/mantaflow/intern/manta_pp/tbb/gitinfo.h
M intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
M intern/mantaflow/intern/manta_pp/tbb/plugin/secondaryparticles.cpp
M intern/mantaflow/intern/manta_pp/tbb/registration.cpp
M intern/mantaflow/intern/strings/liquid_script.h
M intern/mantaflow/intern/strings/shared_script.h
M intern/mantaflow/intern/strings/smoke_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M source/blender/blenkernel/intern/smoke.c
M source/blender/editors/physics/physics_fluid.c
M source/blender/editors/physics/physics_intern.h
M source/blender/editors/physics/physics_ops.c
M source/blender/makesdna/DNA_smoke_types.h
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/modifiers/intern/MOD_smoke.c
===================================================================
diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt
index a345f282092..a652e2c48b3 100644
--- a/intern/mantaflow/CMakeLists.txt
+++ b/intern/mantaflow/CMakeLists.txt
@@ -160,6 +160,7 @@ set(SRC
${MANTA_PP}/plugin/meshplugins.cpp
# ${MANTA_PP}/plugin/numpyconvert.cpp
${MANTA_PP}/plugin/pressure.cpp
+ ${MANTA_PP}/plugin/secondaryparticles
${MANTA_PP}/plugin/sndparticles.cpp
${MANTA_PP}/plugin/surfaceturbulence.cpp
# ${MANTA_PP}/plugin/tfplugins.cpp
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 61656e7901d..ab06f5f2025 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -172,6 +172,7 @@ int fluid_read_data(struct FLUID* fluid, struct SmokeModifierData *smd, int fram
int fluid_read_noise(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_read_mesh(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_read_particles(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
+int fluid_read_guiding(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr, bool sourceDomain);
int fluid_update_liquid_structures(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_update_mesh_structures(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_update_particle_structures(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
@@ -179,7 +180,8 @@ int fluid_bake_data(struct FLUID* fluid, struct SmokeModifierData *smd, int fram
int fluid_bake_noise(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_bake_mesh(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
int fluid_bake_particles(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
-void fluid_update_variables_low(struct FLUID* fluid, struct SmokeModifierData *smd);
+int fluid_bake_guiding(struct FLUID* fluid, struct SmokeModifierData *smd, int framenr);
+void fluid_update_variables(struct FLUID* fluid, struct SmokeModifierData *smd);
void fluid_update_variables_high(struct FLUID* fluid, struct SmokeModifierData *smd);
int fluid_get_frame(struct FLUID* fluid);
float fluid_get_timestep(struct FLUID* fluid);
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 5514185c07c..02f1ffd7fb9 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -50,7 +50,7 @@
std::atomic<bool> FLUID::mantaInitialized(false);
std::atomic<int> FLUID::solverID(0);
-int FLUID::with_debug(0);
+int FLUID::with_debug(1);
FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
{
@@ -63,10 +63,10 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
mUsingFire = smd->domain->active_fields & SM_ACTIVE_FIRE;
mUsingColors = smd->domain->active_fields & SM_ACTIVE_COLORS;
mUsingObstacle = smd->domain->active_fields & SM_ACTIVE_OBSTACLE;
- mUsingGuiding = smd->domain->active_fields & SM_ACTIVE_GUIDING;
mUsingInvel = smd->domain->active_fields & SM_ACTIVE_INVEL;
mUsingNoise = smd->domain->flags & MOD_SMOKE_NOISE;
mUsingMesh = smd->domain->flags & MOD_SMOKE_MESH;
+ mUsingGuiding = smd->domain->flags & MOD_SMOKE_GUIDING || smd->domain->active_fields & SM_ACTIVE_GUIDING;
mUsingLiquid = smd->domain->type == MOD_SMOKE_DOMAIN_TYPE_LIQUID;
mUsingSmoke = smd->domain->type == MOD_SMOKE_DOMAIN_TYPE_GAS;
mUsingDrops = smd->domain->particle_type & MOD_SMOKE_PARTICLE_DROP;
@@ -165,7 +165,6 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
initDomain(smd);
initLiquid(smd);
if (mUsingObstacle) initObstacle(smd);
- if (mUsingGuiding) initGuiding(smd);
if (mUsingInvel) initInVelocity(smd);
if (mUsingDrops || mUsingBubbles || mUsingFloats || mUsingTracers) {
@@ -190,6 +189,11 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
initMesh(smd);
initLiquidMesh(smd);
}
+
+ if (mUsingGuiding) {
+ mResGuiding = (smd->domain->guiding_parent) ? smd->domain->guide_res : smd->domain->res;
+ initGuiding(smd);
+ }
updatePointers();
return;
@@ -203,9 +207,12 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
if (mUsingFire) initFire(smd);
if (mUsingColors) initColors(smd);
if (mUsingObstacle) initObstacle(smd);
- if (mUsingGuiding) initGuiding(smd);
if (mUsingInvel) initInVelocity(smd);
+ if (mUsingGuiding) {
+ mResGuiding = (smd->domain->guiding_parent) ? smd->domain->guide_res : smd->domain->res;
+ initGuiding(smd);
+ }
updatePointers(); // Needs to be after heat, fire, color init
if (mUsingNoise) {
@@ -242,11 +249,13 @@ void FLUID::initDomain(SmokeModifierData *smd)
std::string tmpString = fluid_variables
+ fluid_solver
+ fluid_alloc
- + fluid_bake_helper
+ + fluid_cache_helper
+ + fluid_bake_multiprocessing
+ fluid_bake_data
+ fluid_bake_noise
+ fluid_bake_mesh
+ fluid_bake_particles
+ + fluid_bake_guiding
+ fluid_file_import
+ fluid_file_export
+ fluid_save_data
@@ -313,7 +322,7 @@ void FLUID::initHeat(SmokeModifierData *smd)
{
if (!mHeat) {
std::vector<std::string> pythonCommands;
- std::string tmpString = smoke_alloc_heat_low
+ std::string tmpString = smoke_alloc_heat
+ smoke_with_heat;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -327,7 +336,7 @@ void FLUID::initFire(SmokeModifierData *smd)
{
if (!mFuel) {
std::vector<std::string> pythonCommands;
- std::string tmpString = smoke_alloc_fire_low
+ std::string tmpString = smoke_alloc_fire
+ smoke_with_fire;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -355,8 +364,8 @@ void FLUID::initColors(SmokeModifierData *smd)
{
if (!mColorR) {
std::vector<std::string> pythonCommands;
- std::string tmpString = smoke_alloc_colors_low
- + smoke_init_colors_low
+ std::string tmpString = smoke_alloc_colors
+ + smoke_init_colors
+ smoke_with_colors;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -370,8 +379,8 @@ void FLUID::initColorsHigh(SmokeModifierData *smd)
{
if (!mColorRHigh) {
std::vector<std::string> pythonCommands;
- std::string tmpString = smoke_alloc_colors_high
- + smoke_init_colors_high
+ std::string tmpString = smoke_alloc_colors_noise
+ + smoke_init_colors_noise
+ smoke_with_colors;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -434,7 +443,7 @@ void FLUID::initObstacle(SmokeModifierData *smd)
{
if (!mPhiObsIn) {
std::vector<std::string> pythonCommands;
- std::string tmpString = fluid_alloc_obstacle_low
+ std::string tmpString = fluid_alloc_obstacle
+ fluid_with_obstacle;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -448,8 +457,12 @@ void FLUID::initGuiding(SmokeModifierData *smd)
{
if (!mPhiGuideIn) {
std::vector<std::string> pythonCommands;
- std::string tmpString = fluid_alloc_guiding_low
- + fluid_with_guiding;
+ std::string tmpString = fluid_variables_guiding
+ + fluid_solver_guiding
+ + fluid_alloc_guiding
+ + fluid_save_guiding
+ + fluid_load_vel
+ + fluid_load_guiding;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -462,7 +475,7 @@ void FLUID::initInVelocity(SmokeModifierData *smd)
{
if (!mInVelocityX) {
std::vector<std::string> pythonCommands;
- std::string tmpString = fluid_alloc_invel_low
+ std::string tmpString = fluid_alloc_invel
+ fluid_with_invel;
std::string finalString = parseScript(tmpString, smd);
pythonCommands.push_back(finalString);
@@ -672,7 +685,7 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
else if (varName == "USING_OBSTACLE")
ss << (smd->domain->active_fields & SM_ACTIVE_OBSTACLE ? "True" : "False");
else if (varName == "USING_GUIDING")
- ss << (smd->domain->active_fields & SM_ACTIVE_GUIDING ? "True" : "False");
+ ss << (smd->domain->flags & MOD_SMOKE_GUIDING || smd->domain->active_fields & SM_ACTIVE_GUIDING ? "True" : "False");
else if (varName == "USING_INVEL")
ss << (smd->domain->active_fields & SM_ACTIVE_INVEL ? "True" : "False");
else if (varName == "SOLVER_DIM")
@@ -745,6 +758,14 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
} else if (varName == "PARTICLE_RESZ") {
if (is2D) { ss << 1;}
else { ss << mResZParticle;}
+ } else if (varName == "GUIDING_RESX")
+ ss << mResGuiding[0];
+ else if (varName == "GUIDING_RESY") {
+ if (is2D) { ss << mResGuiding[2];}
+ else { ss << mResGuiding[1];}
+ } else if (varName == "GUIDING_RESZ") {
+ if (is2D) { ss << 1;}
+ else { ss << mResGuiding[2];}
} else if (varName == "WLT_STR")
ss << smd->domain->strength;
else if (varName == "NOISE_POSSCALE")
@@ -797,6 +818,8 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
ss << smd->domain->mesh_smoothen_pos;
else if (varName == "MESH_SMOOTHEN_NEG")
ss << smd->domain->mesh_smoothen_neg;
+ else if (varName == "USING_MESH")
+ ss << (smd->domain->flags & MOD_SMOKE_MESH ? "True" : "False");
else if (varName == "USING_IMPROVED_MESH")
ss << (smd->domain->mesh_generator == SM_MESH_IMPROVED ? "True" : "False");
else if (varName == "PARTICLE_BAND_WIDTH")
@@ -859,15 +882,22 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
ss << smd->domain->guiding_alpha;
else if (varName == "GUIDING_BETA")
ss << smd->domain->guiding_beta;
- else if (varName == "GRAVITY_X")
+ else if (varName == "GUIDING_FACTOR")
+ ss << smd->domain->guiding_vel_factor;
+ else if (varName == "GUIDING_MODE") {
+ if (smd->domain->guiding_mode == SM_GUIDING_OVERRIDE) { ss << "0"; }
+ else if (smd->domain->guiding_mode == SM_GUIDING_MAXIMUM) { ss << "1"; }
+ else if (smd->domain->guiding_mode == SM_GUIDING_AVERAGED) { ss << "2"; }
+ else { ss << "
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list