[Bf-blender-cvs] [b88e77517fa] fluid-mantaflow: some cleanup and simplifications
Sebastián Barschkis
noreply at git.blender.org
Wed Dec 6 22:23:41 CET 2017
Commit: b88e77517faa274832aa0ab10c677b174ec0059a
Author: Sebastián Barschkis
Date: Tue Dec 5 18:19:36 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBb88e77517faa274832aa0ab10c677b174ec0059a
some cleanup and simplifications
===================================================================
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/strings/smoke_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M source/blender/blenkernel/BKE_smoke.h
M source/blender/blenkernel/intern/pointcache.c
M source/blender/blenkernel/intern/smoke.c
M source/blender/editors/physics/physics_fluid.c
===================================================================
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 47ed527b306..f4efba099f6 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -54,7 +54,7 @@ int FLUID::with_debug(0);
FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
{
if (with_debug)
- std::cout << "FLUID: " << mCurrentID << std::endl;
+ std::cout << "FLUID: " << mCurrentID << " with res(" << res[0] << ", " << res[1] << ", " << res[2] << ")" << std::endl;
smd->domain->fluid = this;
@@ -482,7 +482,7 @@ void FLUID::step(int framenr)
FLUID::~FLUID()
{
if (with_debug)
- std::cout << "FLUID: " << mCurrentID << std::endl;
+ std::cout << "~FLUID: " << mCurrentID << " with res(" << mResX << ", " << mResY << ", " << mResZ << ")" << std::endl;
// Destruction string for Python
std::string tmpString = "";
@@ -719,7 +719,7 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
if ((smd->domain->border_collisions & MOD_SMOKE_BORDER_TOP) == 0) ss << "Z";
}
} else if (varName == "RES")
- ss << smd->domain->maxres;
+ ss << mMaxRes;
else if (varName == "RESX")
ss << mResX;
else if (varName == "RESY")
diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h
index e5bd6687139..23f9f1d4557 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -198,6 +198,9 @@ def smoke_pre_step_low_$ID$():\n\
z_invel_s$ID$.multConst(Real(gs_s$ID$.z))\n\
copyRealToVec3(sourceX=x_invel_s$ID$, sourceY=y_invel_s$ID$, sourceZ=z_invel_s$ID$, target=invel_s$ID$)\n\
\n\
+ x_vel_s$ID$.multConst(Real(gs_s$ID$.x))\n\
+ y_vel_s$ID$.multConst(Real(gs_s$ID$.y))\n\
+ z_vel_s$ID$.multConst(Real(gs_s$ID$.z))\n\
copyRealToVec3(sourceX=x_vel_s$ID$, sourceY=y_vel_s$ID$, sourceZ=z_vel_s$ID$, target=vel_s$ID$)\n\
copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n\
\n\
@@ -216,6 +219,7 @@ def smoke_pre_step_high_$ID$():\n\
const std::string smoke_post_step_low = "\n\
def smoke_post_step_low_$ID$():\n\
+ mantaMsg('Smoke post step low')\n\
forces_s$ID$.clear()\n\
if using_guiding_s$ID$:\n\
weightGuide_s$ID$.clear()\n\
@@ -225,10 +229,14 @@ def smoke_post_step_low_$ID$():\n\
phiObs_s$ID$.setConst(9999)\n\
phiOutIn_s$ID$.setConst(9999)\n\
\n\
- copyVec3ToReal(source=vel_s$ID$, targetX=x_vel_s$ID$, targetY=y_vel_s$ID$, targetZ=z_vel_s$ID$)\n";
+ copyVec3ToReal(source=vel_s$ID$, targetX=x_vel_s$ID$, targetY=y_vel_s$ID$, targetZ=z_vel_s$ID$)\n\
+ x_vel_s$ID$.multConst( 1.0/Real(gs_s$ID$.x) )\n\
+ y_vel_s$ID$.multConst( 1.0/Real(gs_s$ID$.y) )\n\
+ z_vel_s$ID$.multConst( 1.0/Real(gs_s$ID$.z) )\n";
const std::string smoke_post_step_high = "\n\
def smoke_post_step_high_$ID$():\n\
+ mantaMsg('Smoke post step high')\n\
copyVec3ToReal(source=uv_s$ID$[0], targetX=texture_u_s$ID$, targetY=texture_v_s$ID$, targetZ=texture_w_s$ID$)\n\
copyVec3ToReal(source=uv_s$ID$[1], targetX=texture_u2_s$ID$, targetY=texture_v2_s$ID$, targetZ=texture_w2_s$ID$)\n";
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index d4e60e5ddc6..1abdc6e9f58 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -461,6 +461,7 @@ class PHYSICS_PT_smoke_diffusion(PhysicButtonsPanel, Panel):
class PHYSICS_PT_smoke_guiding(PhysicButtonsPanel, Panel):
bl_label = "Fluid Guiding"
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index b4de2f21eb8..28ddbe183f5 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -37,7 +37,7 @@ typedef float (*bresenham_callback)(float *result, float *input, int res[3], int
struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm);
-void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
+void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, int res[3], int free_old);
void smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 5199c27834e..1acb1dfd373 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -861,7 +861,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
- smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
+ smoke_reallocate_fluid(sds, ch_res, 1);
sds->dx = ch_dx;
VECCOPY(sds->res, ch_res);
sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2];
@@ -1187,7 +1187,7 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
- smoke_reallocate_fluid(sds, cache_dx, cache_res, 1);
+ smoke_reallocate_fluid(sds, cache_res, 1);
sds->dx = cache_dx;
copy_v3_v3_int(sds->res, cache_res);
sds->total_cells = cache_res[0] * cache_res[1] * cache_res[2];
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 57b2db55f01..4fec3d21ccf 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -136,7 +136,7 @@ float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3])
#ifdef WITH_SMOKE
-void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
+void smoke_reallocate_fluid(SmokeDomainSettings *sds, int res[3], int free_old)
{
if (free_old && sds->fluid)
smoke_free(sds->fluid);
@@ -304,7 +304,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
VECCOPY(sds->res_max, res);
/* allocate fluid */
- smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
+ smoke_reallocate_fluid(sds, sds->res, 0);
smd->time = scene->r.cfra;
@@ -2181,7 +2181,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
struct FLUID *fluid_old = sds->fluid;
/* allocate new fluid data */
- smoke_reallocate_fluid(sds, sds->dx, res, 0);
+ smoke_reallocate_fluid(sds, res, 0);
if (sds->flags & MOD_SMOKE_HIGHRES) {
smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
}
@@ -3017,6 +3017,8 @@ static DerivedMesh *createLiquidMesh(SmokeDomainSettings *sds, DerivedMesh *orgd
num_normals = liquid_get_num_normals(sds->fluid);
num_faces = liquid_get_num_triangles(sds->fluid);
+// printf("num_verts: %d, num_normals: %d, num_faces: %d\n", num_verts, num_normals, num_faces);
+
if (!num_verts || !num_normals || !num_faces)
return NULL;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index bae86795218..40f035a6aa3 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1141,7 +1141,7 @@ static int manta_make_file_exec(bContext *C, wmOperator *op)
smd = (SmokeModifierData *)modifiers_findByType(smokeDomain, eModifierType_Smoke);
if (smd->domain->fluid == NULL)
- smoke_reallocate_fluid(smd->domain, smd->domain->dx, smd->domain->res, 1);
+ smoke_reallocate_fluid(smd->domain, smd->domain->res, 1);
if (smd->domain->fluid && smd->domain->type == MOD_SMOKE_DOMAIN_TYPE_GAS)
smoke_manta_export(smd->domain->fluid, smd);
More information about the Bf-blender-cvs
mailing list