[Bf-blender-cvs] [bb37d1d33b9] fluid-mantaflow: cleanup in manta C api
Sebastián Barschkis
noreply at git.blender.org
Sun Mar 26 20:41:21 CEST 2017
Commit: bb37d1d33b938c43983cd66094c852d74e4d2ef5
Author: Sebastián Barschkis
Date: Thu Mar 16 22:31:57 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBbb37d1d33b938c43983cd66094c852d74e4d2ef5
cleanup in manta C api
no need to pass smoke modifier data as argument anymore
===================================================================
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
===================================================================
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 134be315393..667360e9aaf 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -41,7 +41,7 @@ void smoke_free(struct FLUID *smoke);
size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */);
size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z, int max_z */);
void smoke_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
-void smoke_step(struct FLUID *smoke, struct SmokeModifierData *smd);
+void smoke_step(struct FLUID *smoke, int startFrame);
void smoke_dissolve(struct FLUID *smoke, int speed, int log);
void smoke_dissolve_wavelet(struct FLUID *smoke, int speed, int log);
void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacles);
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 47cb44e0f02..d9ebb3a97ca 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -131,7 +131,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
initDomain(smd);
initLiquid(smd);
- updatePointers(smd);
+ updatePointers();
if (mUsingHighRes) {
// Make sure that string vector does not contain any previous commands
@@ -148,7 +148,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
initDomainHigh(smd);
initLiquidHigh(smd);
- updatePointersHigh(smd);
+ updatePointersHigh();
}
return;
@@ -162,7 +162,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
if (mUsingFire) initFire(smd);
if (mUsingColors) initColors(smd);
- updatePointers(smd); // Needs to be after heat, fire, color init
+ updatePointers(); // Needs to be after heat, fire, color init
if (mUsingHighRes) {
// Make sure that string vector does not contain any previous commands
@@ -181,7 +181,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
if (mUsingFire) initFireHigh(smd);
if (mUsingColors) initColorsHigh(smd);
- updatePointersHigh(smd); // Needs to be after fire, color init
+ updatePointersHigh(); // Needs to be after fire, color init
}
}
}
@@ -353,20 +353,16 @@ void FLUID::initLiquidHigh(SmokeModifierData *smd)
mUsingHighRes = true;
}
-void FLUID::step(SmokeModifierData *smd)
+void FLUID::step(int startFrame)
{
// manta_write_effectors(this); // TODO in Mantaflow
- // Get the frame number for this step
- ModifierData *md = ((ModifierData*) smd);
- int startFrame = md->scene->r.cfra - 1; // Current frame is always one ahead
-
// Run manta step and handover current frame number
mCommands.clear();
std::ostringstream manta_step;
manta_step << "manta_step(" << startFrame << ")";
mCommands.push_back(manta_step.str());
-
+
runPythonString(mCommands);
}
@@ -893,7 +889,7 @@ void FLUID::updateMeshData(const char* filename)
gzclose( gzf );
}
-void FLUID::updatePointers(SmokeModifierData *smd)
+void FLUID::updatePointers()
{
std::cout << "Updating pointers low res" << std::endl;
@@ -942,7 +938,7 @@ void FLUID::updatePointers(SmokeModifierData *smd)
}
}
-void FLUID::updatePointersHigh(SmokeModifierData *smd)
+void FLUID::updatePointersHigh()
{
std::cout << "Updating pointers high res" << std::endl;
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 4b8eccf4d25..a8f6304478a 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -40,7 +40,7 @@ public:
virtual ~FLUID();
// Manta step, handling everything
- void step(struct SmokeModifierData *smd);
+ void step(int startFrame);
// Grid initialization functions
void initHeat(struct SmokeModifierData *smd);
@@ -52,8 +52,8 @@ public:
void initLiquidHigh(SmokeModifierData *smd);
// Pointer transfer Mantaflow -> Blender
- void updatePointers(struct SmokeModifierData *smd);
- void updatePointersHigh(struct SmokeModifierData *smd);
+ void updatePointers();
+ void updatePointersHigh();
// 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 70bbfc632a8..8bab7f6ef4d 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -61,12 +61,12 @@ extern "C" void smoke_manta_export(FLUID* smoke, SmokeModifierData *smd)
smoke->exportSmokeData(smd);
}
-extern "C" void smoke_step(FLUID *smoke, SmokeModifierData *smd)
+extern "C" void smoke_step(FLUID *fluid, int startFrame)
{
- smoke->step(smd);
- smoke->updatePointers(smd);
- if (smoke->usingHighRes())
- smoke->updatePointersHigh(smd);
+ fluid->step(startFrame);
+ fluid->updatePointers();
+ if (fluid->usingHighRes())
+ fluid->updatePointersHigh();
}
static void data_dissolve(float *density, float *heat, float *r, float *g, float *b, int total_cells, int speed, int log)
@@ -442,7 +442,7 @@ extern "C" void smoke_ensure_heat(FLUID *smoke, struct SmokeModifierData *smd)
{
if (smoke) {
smoke->initHeat(smd);
- smoke->updatePointers(smd);
+ smoke->updatePointers();
}
}
@@ -450,11 +450,11 @@ extern "C" void smoke_ensure_fire(FLUID *smoke, struct SmokeModifierData *smd)
{
if (smoke) {
smoke->initFire(smd);
- smoke->updatePointers(smd);
+ smoke->updatePointers();
}
if (smoke && smoke->usingHighRes()) {
smoke->initFireHigh(smd);
- smoke->updatePointersHigh(smd);
+ smoke->updatePointersHigh();
}
}
@@ -462,11 +462,11 @@ extern "C" void smoke_ensure_colors(FLUID *smoke, struct SmokeModifierData *smd)
{
if (smoke) {
smoke->initColors(smd);
- smoke->updatePointers(smd);
+ smoke->updatePointers();
}
if (smoke && smoke->usingHighRes()) {
smoke->initColorsHigh(smd);
- smoke->updatePointersHigh(smd);
+ smoke->updatePointersHigh();
}
}
@@ -474,7 +474,7 @@ extern "C" void liquid_ensure_init(FLUID *smoke, struct SmokeModifierData *smd)
{
if (smoke) {
smoke->initLiquid(smd);
- smoke->updatePointers(smd);
+ smoke->updatePointers();
}
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 37c1e0e5a31..7aa96bbcbe2 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -2907,7 +2907,7 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds,
pdEndEffectors(&effectors);
}
-static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps)
+static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps, int startFrame)
{
SmokeDomainSettings *sds = smd->domain;
/* stability values copied from wturbulence.cpp */
@@ -2989,7 +2989,7 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *
#ifndef WITH_MANTA
smoke_step(sds->fluid, gravity, dtSubdiv);
#else
- smoke_step(sds->fluid, smd);
+ smoke_step(sds->fluid, startFrame);
#endif
}
}
@@ -3310,7 +3310,7 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
}
#endif
}
- step(scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base);
+ step(scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base, startframe);
}
// create shadows before writing cache so they get stored
if (sds->type == MOD_SMOKE_DOMAIN_TYPE_GAS) {
More information about the Bf-blender-cvs
mailing list