[Bf-blender-cvs] [55e94f70085] fluid-mantaflow: Merge branch 'master' into fluid-mantaflow
Sebastián Barschkis
noreply at git.blender.org
Mon Jul 30 17:26:48 CEST 2018
Commit: 55e94f70085837c57248ad850d32eb79ea1ab928
Author: Sebastián Barschkis
Date: Mon Jul 30 17:24:37 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB55e94f70085837c57248ad850d32eb79ea1ab928
Merge branch 'master' into fluid-mantaflow
===================================================================
===================================================================
diff --cc release/scripts/addons
index 628a3460b56,9ae033c49c1..81b789cdd26
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 628a3460b56bec6018e38b4a71dd7e11e4c96469
-Subproject commit 9ae033c49c1b16718eac6306bdc271a5e6e6bf38
++Subproject commit 81b789cdd263dcb21fcbe7a5713eef5c2f5dfc78
diff --cc release/scripts/startup/bl_operators/object_quick_effects.py
index 3e50184b9ed,c2592f13d66..a7383988ed3
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@@ -303,23 -307,24 +307,24 @@@ class QuickSmoke(Operator)
bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty(
- name="Smoke Style",
- items=(('SMOKE', "Smoke", ""),
- ('FIRE', "Fire", ""),
- ('BOTH', "Smoke + Fire", ""),
- ),
- default='SMOKE',
- )
+ name="Smoke Style",
+ items=(
+ ('SMOKE', "Smoke", ""),
+ ('FIRE', "Fire", ""),
+ ('BOTH', "Smoke + Fire", ""),
+ ),
+ default='SMOKE',
+ )
show_flows = BoolProperty(
- name="Render Smoke Objects",
- description="Keep the smoke objects visible during rendering",
- default=False,
- )
+ name="Render Smoke Objects",
+ description="Keep the smoke objects visible during rendering",
+ default=False,
+ )
def execute(self, context):
- if not bpy.app.build_options.mod_smoke:
- self.report({'ERROR'}, "Built without Smoke modifier support")
+ if not bpy.app.build_options.manta:
+ self.report({'ERROR'}, "Built without Fluid Mantaflow modifier")
return {'CANCELLED'}
fake_context = context.copy()
diff --cc source/blender/blenkernel/intern/pointcache.c
index 23333da347c,104f8482635..09baa64cef8
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@@ -578,15 -576,10 +578,15 @@@ static void ptcache_smoke_error(void *s
#define SMOKE_CACHE_VERSION "1.04"
-static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
+static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
- {
+ {
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
+
+ if (!(sds->flags & MOD_SMOKE_USE_VOLUME_CACHE)) {
+ return 0;
+ }
+
int ret = 0;
int fluid_fields = smoke_get_data_flags(sds);
@@@ -596,11 -589,11 +596,11 @@@
ptcache_file_write(pf, &sds->active_fields, 1, sizeof(int));
ptcache_file_write(pf, &sds->res, 3, sizeof(int));
ptcache_file_write(pf, &sds->dx, 1, sizeof(float));
-
+
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b, *phi, *pp, *pvel, *ppSnd, *pvelSnd, *plifeSnd, *shadow;
+ int *obstacles, numParts = 0, numPartsSnd = 0;
unsigned int in_len = sizeof(float)*(unsigned int)res;
unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer");
//int mode = res >= 1000000 ? 2 : 1;
@@@ -652,23 -635,8 +652,23 @@@
ptcache_file_write(pf, &sds->res_max, 3, sizeof(int));
ptcache_file_write(pf, &sds->active_color, 3, sizeof(float));
+ if (pp) {
+ MEM_freeN(out);
+ out = (unsigned char *)MEM_callocN(numParts*sizeof(float)*3 + numParts*sizeof(int), "pointcache_lzo_buffer");
+ ptcache_file_compressed_write(pf, (unsigned char *) pp, numParts*sizeof(float)*3 + numParts*sizeof(int), out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *) pvel, numParts*sizeof(float)*3, out, mode);
+ }
+
+ if (ppSnd) {
+ MEM_freeN(out);
+ out = (unsigned char *)MEM_callocN(numPartsSnd*sizeof(float)*3 + numPartsSnd*sizeof(int), "pointcache_lzo_buffer");
+ ptcache_file_compressed_write(pf, (unsigned char *) ppSnd, numPartsSnd*sizeof(float)*3 + numPartsSnd*sizeof(int), out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *) pvelSnd, numPartsSnd*sizeof(float)*3, out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *) plifeSnd, numPartsSnd*sizeof(float), out, mode);
+ }
+
MEM_freeN(out);
-
+
ret = 1;
}
@@@ -709,19 -675,11 +709,19 @@@
MEM_freeN(out);
out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
- ptcache_file_compressed_write(pf, (unsigned char *)tcu, in_len, out, mode);
- ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode);
- ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode);
+ if (tcu) {
+ ptcache_file_compressed_write(pf, (unsigned char *)tcu, in_len, out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode);
+ }
+ if (tcu2) {
+ ptcache_file_compressed_write(pf, (unsigned char *)tcu2, in_len, out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *)tcv2, in_len, out, mode);
+ ptcache_file_compressed_write(pf, (unsigned char *)tcw2, in_len, out, mode);
+ }
+
MEM_freeN(out);
-
+
ret = 1;
}
@@@ -867,29 -810,26 +867,29 @@@ static int ptcache_smoke_read(PTCacheFi
sds->dx = ch_dx;
VECCOPY(sds->res, ch_res);
sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2];
- if (sds->flags & MOD_SMOKE_HIGHRES) {
- smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
+ if (sds->flags & MOD_SMOKE_NOISE) {
+ smoke_reallocate_highres_fluid(sds, ch_dx, ch_res);
}
}
-
+
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b, *phi, *pp, *pvel, *ppSnd, *pvelSnd, *plifeSnd, *shadow;
+ int *obstacles, numParts = 0, numPartsSnd = 0;
unsigned int out_len = (unsigned int)res * sizeof(float);
+ unsigned char *buffer;
- smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &vx, &vy, &vz, &r, &g, &b, &obstacles, &shadow);
+ liquid_export(sds->fluid, &phi, &pp, &pvel, &ppSnd, &pvelSnd, &plifeSnd);
- ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
- ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len);
- if (cache_fields & SM_ACTIVE_HEAT) {
+ if (dens) {
+ ptcache_file_compressed_read(pf, (unsigned char *)shadow, out_len);
+ ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len);
+ }
+ if (heat && cache_fields & SM_ACTIVE_HEAT) {
ptcache_file_compressed_read(pf, (unsigned char *)heat, out_len);
- ptcache_file_compressed_read(pf, (unsigned char *)heatold, out_len);
}
- if (cache_fields & SM_ACTIVE_FIRE) {
+ if (flame && cache_fields & SM_ACTIVE_FIRE) {
ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)fuel, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)react, out_len);
diff --cc source/blender/blenloader/intern/readfile.c
index dd29d5d8c56,bdfae79a1d0..96e7bb0590d
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -5177,22 -5182,22 +5182,22 @@@ static void direct_link_modifiers(FileD
}
else if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
-
+
if (smd->type == MOD_SMOKE_TYPE_DOMAIN) {
smd->flow = NULL;
- smd->coll = NULL;
+ smd->effec = NULL;
smd->domain = newdataadr(fd, smd->domain);
smd->domain->smd = smd;
-
+
smd->domain->fluid = NULL;
smd->domain->fluid_mutex = BLI_rw_mutex_alloc();
smd->domain->wt = NULL;
smd->domain->tex = NULL;
smd->domain->tex_shadow = NULL;
smd->domain->tex_wt = NULL;
+ smd->domain->mesh_velocities = NULL;
smd->domain->coba = newdataadr(fd, smd->domain->coba);
-
+
smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights);
if (!smd->domain->effector_weights)
smd->domain->effector_weights = BKE_add_effector_weights(NULL);
diff --cc source/blender/editors/physics/physics_fluid.c
index 13d40b81240,1cd2528b3ca..8580d492ac3
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@@ -1128,668 -1118,3 +1128,669 @@@ void FLUID_OT_bake(wmOperatorType *ot
ot->exec = fluid_bake_exec;
ot->poll = ED_operator_object_active_editable;
}
+
+/***************************** Bake Fluid Mantaflow ******************************/
+
+typedef struct FluidMantaflowJob {
+ /* from wmJob */
+ void *owner;
+ short *stop, *do_update;
+ float *progress;
+ const char *type;
+ const char *name;
+
+ struct Main *bmain;
+ Scene *scene;
+ Object *ob;
+
+ SmokeModifierData *smd;
+
+ int success;
+ double start;
+
+ int* pause_frame;
+} FluidMantaflowJob;
+
+static bool fluid_manta_initjob(bContext *C, FluidMantaflowJob *job, wmOperator *op, char *error_msg, int error_size)
+{
+ SmokeModifierData *smd = NULL;
+ SmokeDomainSettings *sds;
+ Object *ob = CTX_data_active_object(C);
+
+ smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
+ if (!smd) {
+ BLI_strncpy(error_msg, N_("Bake failed: no Fluid modifier found"), error_size);
+ return false;
+ }
+ sds = smd->domain;
+ if (!sds) {
+ BLI_strncpy(error_msg, N_("Bake failed: invalid domain"), error_size);
+ return false;
+ }
+
+ job->bmain = CTX_data_main(C);
+ job->scene = CTX_data_scene(C);
+ job->ob = CTX_data_active_object(C);
+ job->smd = smd;
+ job->type = op->type->idname;
+ job->name = op->type->name;
+
+ return true;
+}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list