[Bf-blender-cvs] [79c3e8db26d] master: Fix linking errors WITH_MOD_FLUID=OFF
Campbell Barton
noreply at git.blender.org
Mon Dec 16 22:47:44 CET 2019
Commit: 79c3e8db26da63f5c2a88b2523f5ff5a24e3ae48
Author: Campbell Barton
Date: Tue Dec 17 08:38:08 2019 +1100
Branches: master
https://developer.blender.org/rB79c3e8db26da63f5c2a88b2523f5ff5a24e3ae48
Fix linking errors WITH_MOD_FLUID=OFF
===================================================================
M source/blender/blenkernel/intern/effect.c
M source/blender/blenkernel/intern/fluid.c
M source/blender/editors/physics/CMakeLists.txt
M source/blender/editors/physics/physics_fluid.c
M source/blender/gpu/intern/gpu_draw.c
M source/blender/makesrna/intern/rna_fluid.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/intern/MOD_fluid.c
===================================================================
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 91f83110675..8971021329a 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1024,6 +1024,7 @@ static void do_physical_effector(EffectorCache *eff,
break;
case PFIELD_SMOKEFLOW:
zero_v3(force);
+#ifdef WITH_FLUID
if (pd->f_source) {
float density;
if ((density = BKE_fluid_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
@@ -1036,6 +1037,7 @@ static void do_physical_effector(EffectorCache *eff,
madd_v3_v3fl(total_force, point->vel, -pd->f_flow * influence);
}
}
+#endif
break;
}
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index c45b87f8a71..45461133dfe 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -87,6 +87,8 @@
#include "BLI_kdtree.h"
#include "BLI_voxel.h"
+#ifdef WITH_FLUID
+
static ThreadMutex object_update_lock = BLI_MUTEX_INITIALIZER;
struct Mesh;
@@ -95,11 +97,11 @@ struct Scene;
struct FluidModifierData;
// timestep default value for nice appearance 0.1f
-#define DT_DEFAULT 0.1f
+# define DT_DEFAULT 0.1f
-#define ADD_IF_LOWER_POS(a, b) (min_ff((a) + (b), max_ff((a), (b))))
-#define ADD_IF_LOWER_NEG(a, b) (max_ff((a) + (b), min_ff((a), (b))))
-#define ADD_IF_LOWER(a, b) (((b) > 0) ? ADD_IF_LOWER_POS((a), (b)) : ADD_IF_LOWER_NEG((a), (b)))
+# define ADD_IF_LOWER_POS(a, b) (min_ff((a) + (b), max_ff((a), (b))))
+# define ADD_IF_LOWER_NEG(a, b) (max_ff((a) + (b), min_ff((a), (b))))
+# define ADD_IF_LOWER(a, b) (((b) > 0) ? ADD_IF_LOWER_POS((a), (b)) : ADD_IF_LOWER_NEG((a), (b)))
void BKE_fluid_reallocate_fluid(FluidDomainSettings *mds, int res[3], int free_old)
{
@@ -856,11 +858,11 @@ void fluidModifier_createType(struct FluidModifierData *mmd)
mmd->domain->cache_high_comp = SM_CACHE_LIGHT;
/* OpenVDB cache options */
-#ifdef WITH_OPENVDB_BLOSC
+# ifdef WITH_OPENVDB_BLOSC
mmd->domain->openvdb_comp = VDB_COMPRESSION_BLOSC;
-#else
+# else
mmd->domain->openvdb_comp = VDB_COMPRESSION_ZIP;
-#endif
+# endif
mmd->domain->clipping = 1e-3f;
mmd->domain->data_depth = 0;
}
@@ -1300,10 +1302,10 @@ static void obstacles_from_mesh_task_cb(void *__restrict userdata,
data->velocityZ[index] += (data->mes->type == FLUID_EFFECTOR_TYPE_GUIDE) ?
hit_vel[2] * data->mes->vel_multi :
hit_vel[2];
-#if 0
+# if 0
/* Debugging: Print object velocities. */
printf("adding effector object vel: [%f, %f, %f], dx is: %f\n", hit_vel[0], hit_vel[1], hit_vel[2], mds->dx);
-#endif
+# endif
}
}
}
@@ -1576,10 +1578,10 @@ static void update_obstacles(Depsgraph *depsgraph,
scene->r.subframe = 0.0f;
scene->r.cfra = frame;
}
-#if 0
+# if 0
/* Debugging: Print subframe information. */
printf("effector: frame: %d // scene current frame: %d // scene current subframe: %f\n", frame, scene->r.cfra, scene->r.subframe);
-#endif
+# endif
/* TODO (sebbas): Using BKE_scene_frame_get(scene) instead of new DEG_get_ctime(depsgraph) as
* subframes dont work with the latter yet. */
BKE_object_modifier_update_subframe(
@@ -2403,10 +2405,10 @@ static void sample_mesh(FluidFlowSettings *mfs,
velocity_map[index * 3] += hit_vel[0] * mfs->vel_multi;
velocity_map[index * 3 + 1] += hit_vel[1] * mfs->vel_multi;
velocity_map[index * 3 + 2] += hit_vel[2] * mfs->vel_multi;
-#if 0
+# if 0
/* Debugging: Print flow object velocities. */
printf("adding flow object vel: [%f, %f, %f]\n", hit_vel[0], hit_vel[1], hit_vel[2]);
-#endif
+# endif
}
velocity_map[index * 3] += mfs->vel_coord[0];
velocity_map[index * 3 + 1] += mfs->vel_coord[1];
@@ -3303,10 +3305,10 @@ static void update_flowsfluids(struct Depsgraph *depsgraph,
}
/* Sanity check: subframe portion must be between 0 and 1 */
CLAMP(scene->r.subframe, 0.0f, 1.0f);
-#if 0
+# if 0
/* Debugging: Print subframe information. */
printf("flow: frame (is first: %d): %d // scene current frame: %d // scene current subframe: %f\n", is_first_frame, frame, scene->r.cfra, scene->r.subframe);
-#endif
+# endif
/* Update frame time, this is considering current subframe fraction
* BLI_mutex_lock() called in manta_step(), so safe to update subframe here
* TODO (sebbas): Using BKE_scene_frame_get(scene) instead of new DEG_get_ctime(depsgraph)
@@ -3351,10 +3353,10 @@ static void update_flowsfluids(struct Depsgraph *depsgraph,
}
}
}
-#if 0
+# if 0
/* Debugging: Print time information. */
printf("flow: frame: %d // time per frame: %f // frame length: %f // dt: %f\n", frame, time_per_frame, frame_length, dt);
-#endif
+# endif
/* Adjust domain size if needed. Only do this once for every frame */
if (mds->type == FLUID_DOMAIN_TYPE_GAS && mds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN) {
@@ -3683,10 +3685,10 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec
num_normals = manta_liquid_get_num_normals(mds->fluid);
num_faces = manta_liquid_get_num_triangles(mds->fluid);
-#if 0
+# if 0
/* Debugging: Print number of vertices, normals, and faces. */
printf("num_verts: %d, num_normals: %d, num_faces: %d\n", num_verts, num_normals, num_faces);
-#endif
+# endif
if (!num_verts || !num_faces) {
return NULL;
@@ -3732,10 +3734,10 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec
mverts->co[0] *= max_size / fabsf(ob->scale[0]);
mverts->co[1] *= max_size / fabsf(ob->scale[1]);
mverts->co[2] *= max_size / fabsf(ob->scale[2]);
-#if 0
+# if 0
/* Debugging: Print coordinates of vertices. */
printf("mverts->co[0]: %f, mverts->co[1]: %f, mverts->co[2]: %f\n", mverts->co[0], mverts->co[1], mverts->co[2]);
-#endif
+# endif
}
// Normals
@@ -3747,10 +3749,10 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec
no[2] = manta_liquid_get_normal_z_at(mds->fluid, i);
normal_float_to_short_v3(no_s, no);
-#if 0
+# if 0
/* Debugging: Print coordinates of normals. */
printf("no_s[0]: %d, no_s[1]: %d, no_s[2]: %d\n", no_s[0], no_s[1], no_s[2]);
-#endif
+# endif
}
// Triangles
@@ -3765,10 +3767,10 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec
mloops[0].v = manta_liquid_get_triangle_x_at(mds->fluid, i);
mloops[1].v = manta_liquid_get_triangle_y_at(mds->fluid, i);
mloops[2].v = manta_liquid_get_triangle_z_at(mds->fluid, i);
-#if 0
+# if 0
/* Debugging: Print mesh faces. */
printf("mloops[0].v: %d, mloops[1].v: %d, mloops[2].v: %d\n", mloops[0].v, mloops[1].v, mloops[2].v);
-#endif
+# endif
}
BKE_mesh_ensure_normals(me);
@@ -3799,10 +3801,10 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec
velarray[i].vel[0] = manta_liquid_get_vertvel_x_at(mds->fluid, i) * (mds->dx / time_mult);
velarray[i].vel[1] = manta_liquid_get_vertvel_y_at(mds->fluid, i) * (mds->dx / time_mult);
velarray[i].vel[2] = manta_liquid_get_vertvel_z_at(mds->fluid, i) * (mds->dx / time_mult);
-#if 0
+# if 0
/* Debugging: Print velocities of vertices. */
printf("velarray[%d].vel[0]: %f, velarray[%d].vel[1]: %f, velarray[%d].vel[2]: %f\n", i, velarray[i].vel[0], i, velarray[i].vel[1], i, velarray[i].vel[2]);
-#endif
+# endif
}
return me;
@@ -4770,3 +4772,5 @@ void BKE_fluid_delete_particle_system(struct Object *ob, const int particle_type
}
}
}
+
+#endif /* WITH_FLUID */
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index ee8d345524e..0998280c381 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -60,6 +60,7 @@ if(WITH_MOD_FLUID)
list(APPEND LIB
bf_intern_mantaflow
)
+ add_definitions(-DWITH_FLUID)
endif()
if(WITH_INTERNATIONAL)
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 2642f000762..5c52bde7c4e 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -494,7 +494,9 @@ static void fluid_free_startjob(void *customdata, short *stop, short *do_update,
if (fluid_is_free_guiding(job) || fluid_is_free_all(job)) {
cache_map |= FLUID_DOMAIN_OUTDATED_GUIDING;
}
+#ifdef WITH_FLUID
BKE_fluid_cache_free(mds, job->ob, cache_map);
+#endif
*do_update = true;
*stop = 0;
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 2ac202b8ddf..dca52355f10 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -940,12 +940,14 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
/* *************************** Transfer functions *************************** */
+#ifdef WITH_FLUID
+
enum {
TFUNC_FLAME_SPECTRUM = 0,
TFUNC_COLOR_RAMP = 1,
};
-#define TFUNC_WIDTH 256
+# define TFUNC_WIDTH 256
static void create_flame_spectrum_texture(float *data)
{
@@ -1160,6 +1162,8 @@ static GPUTexture *create_flame_texture(FluidDomainSettings *mds, int highres)
return tex;
}
+#endif /* WITH_FLUID */
+
void GPU_free_smoke(FluidModifierData *mmd)
{
if (mmd->type & MOD_FLUID_TYPE_DOMAIN && mmd->domain) {
@@ -1197,6 +1201,9 @@ void GPU_free_smoke(FluidModifierData *mmd)
void GPU_create_smoke_coba_field(FluidModifierData *mmd)
{
+#ifndef WITH_FLUID
+ UNUSED_VARS(mmd);
+#else
if (mmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *mds = mmd->domain;
@@ -1207,10 +1214,14 @@ void GPU_create_smoke_coba_field(FluidModifierData *mmd)
mds->tex_coba = create_transfer_function(TFUNC_COLOR_RAMP, mds->coba);
}
}
+#endif
}
vo
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list