Commit: 070d9da1e80eca920f1f58b6fb0eafd66570a259
Author: Sebastián Barschkis
Date:   Wed Jul 11 00:24:04 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB070d9da1e80eca920f1f58b6fb0eafd66570a259

improvements to keyframe parameters

===================================================================

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       source/blender/blenkernel/intern/smoke.c
M       source/blender/makesrna/intern/rna_smoke.c

===================================================================

diff --git a/intern/mantaflow/extern/manta_fluid_API.h 
b/intern/mantaflow/extern/manta_fluid_API.h
index ab06f5f2025..1d51231b583 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -182,7 +182,6 @@ int fluid_bake_mesh(struct FLUID* fluid, struct 
SmokeModifierData *smd, int fram
 int fluid_bake_particles(struct FLUID* fluid, struct SmokeModifierData *smd, 
int framenr);
 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);
 void fluid_adapt_timestep(struct FLUID* fluid);
diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 3ba0c697d7e..e85fe585532 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -1393,7 +1393,7 @@ int FLUID::bakeGuiding(SmokeModifierData *smd, int 
framenr)
        return 1;
 }
 
-void FLUID::updateVariablesLow(SmokeModifierData *smd)
+void FLUID::updateVariables(SmokeModifierData *smd)
 {
        std::string tmpString, finalString;
        std::vector<std::string> pythonCommands;
@@ -1403,20 +1403,17 @@ void FLUID::updateVariablesLow(SmokeModifierData *smd)
                tmpString += smoke_variables;
        if (mUsingLiquid)
                tmpString += liquid_variables;
-       finalString = parseScript(tmpString, smd);
-       pythonCommands.push_back(finalString);
-
-       runPythonString(pythonCommands);
-}
-
-void FLUID::updateVariablesHigh(SmokeModifierData *smd)
-{
-       std::string tmpString, finalString;
-       std::vector<std::string> pythonCommands;
-
-       tmpString += fluid_variables_noise;
-       if (mUsingSmoke)
+       if (mUsingGuiding)
+               tmpString += fluid_variables_guiding;
+       if (mUsingNoise) {
+               tmpString += fluid_variables_noise;
                tmpString += smoke_variables_noise;
+       }
+       if (mUsingDrops || mUsingBubbles || mUsingFloats || mUsingTracers)
+               tmpString += fluid_variables_particles;
+       if (mUsingMesh)
+               tmpString += fluid_variables_mesh;
+
        finalString = parseScript(tmpString, smd);
        pythonCommands.push_back(finalString);
 
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index d308789b70f..2ac158da543 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -91,8 +91,7 @@ public:
        int bakeMesh(SmokeModifierData *smd, int framenr);
        int bakeParticles(SmokeModifierData *smd, int framenr);
        int bakeGuiding(SmokeModifierData *smd, int framenr);
-       void updateVariablesLow(SmokeModifierData *smd);
-       void updateVariablesHigh(SmokeModifierData *smd);
+       void updateVariables(SmokeModifierData *smd);
 
        // IO for Mantaflow scene script
        void exportSmokeScript(struct SmokeModifierData *smd);
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp 
b/intern/mantaflow/intern/manta_fluid_API.cpp
index c201a3c80f2..91d4f8874dc 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -906,13 +906,7 @@ extern "C" int fluid_bake_guiding(FLUID* fluid, 
SmokeModifierData *smd, int fram
 extern "C" void fluid_update_variables(FLUID* fluid, SmokeModifierData *smd)
 {
        if (fluid)
-               fluid->updateVariablesLow(smd);
-}
-
-extern "C" void fluid_update_variables_high(FLUID* fluid, SmokeModifierData 
*smd)
-{
-       if (fluid)
-               fluid->updateVariablesHigh(smd);
+               fluid->updateVariables(smd);
 }
 
 extern "C" int fluid_get_frame(FLUID* fluid)
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 68863e2052e..b68b7738dee 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -3139,7 +3139,6 @@ static void smoke_step(
        // loop as long as time_per_frame (sum of sudivdt) does not exceed dt 
(actual framelength)
        while (time_per_frame < dt)
        {
-               fluid_update_variables(sds->fluid, smd);
                fluid_adapt_timestep(sds->fluid);
                sdt = fluid_get_timestep(sds->fluid);
                time_per_frame += sdt;
@@ -3300,6 +3299,9 @@ static void smokeModifier_process(
                /* Simulate step and write cache. Optionally also read py 
objects once from previous frame (bake started from resume operator) */
                if (is_baking)
                {
+                       /* Ensure fresh variables at every animation step */
+                       fluid_update_variables(sds->fluid, smd);
+
                        if (sds->cache_flag & FLUID_CACHE_BAKING_DATA)
                        {
                                if (sds->flags & MOD_SMOKE_GUIDING)
diff --git a/source/blender/makesrna/intern/rna_smoke.c 
b/source/blender/makesrna/intern/rna_smoke.c
index f1a4ff06fde..a6960ea54a3 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -1705,14 +1705,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA 
*brna)
        RNA_def_property_int_sdna(prop, NULL, "guiding_beta");
        RNA_def_property_range(prop, 1, 50);
        RNA_def_property_ui_text(prop, "Size", "Guiding size (higher value 
results in larger vortices)");
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, 
"rna_Smoke_reset");
 
        prop = RNA_def_property(srna, "guiding_vel_factor", PROP_FLOAT, 
PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "guiding_vel_factor");
        RNA_def_property_range(prop, 0.0, 100.0);
        RNA_def_property_ui_text(prop, "Weight", "Guiding velocity factor 
(higher value results in bigger guiding velocities)");
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, 
"rna_Smoke_reset");
 
        prop = RNA_def_property(srna, "guiding_source", PROP_ENUM, PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to