[Bf-blender-cvs] [ebaa0f00553] fluid-mantaflow: Merge branch 'master' into fluid-mantaflow
Sebastián Barschkis
noreply at git.blender.org
Sat Jul 7 15:57:46 CEST 2018
Commit: ebaa0f0055386bc863a28843138ca3971dfb5f51
Author: Sebastián Barschkis
Date: Tue Jun 12 13:50:58 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBebaa0f0055386bc863a28843138ca3971dfb5f51
Merge branch 'master' into fluid-mantaflow
===================================================================
===================================================================
diff --cc release/scripts/addons
index 69bf667c547,ebd058d7a64..628a3460b56
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 69bf667c5477ea814ac6003a62ab81037ab840d4
-Subproject commit ebd058d7a6438d137522063bb3286c8acc325ca6
++Subproject commit 628a3460b56bec6018e38b4a71dd7e11e4c96469
diff --cc release/scripts/addons_contrib
index cd57934bd04,47470215783..f178e6c933a
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit cd57934bd04c174fc3402888d01a74e6e6653b2f
-Subproject commit 474702157831f1a58bb50f5240ab8b1b02b6ba37
++Subproject commit f178e6c933a25c621a5cc7d92935b66cd2ec2f5d
diff --cc source/blender/blenkernel/BKE_smoke.h
index 3ea6fc56acb,a54d50cb154..660ecc9abbb
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@@ -37,14 -37,13 +37,12 @@@ typedef float (*bresenham_callback)(flo
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_highres_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]);
void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
-void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
void smokeModifier_createType(struct SmokeModifierData *smd);
- void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData *tsmd);
-
- void smoke_step(struct Scene *scene, struct Object *ob, struct SmokeModifierData *smd, int frame, bool is_first_frame);
+ void smokeModifier_copy(const SmokeModifierData *smd, struct SmokeModifierData *tsmd);
float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
int smoke_get_data_flags(struct SmokeDomainSettings *sds);
diff --cc source/blender/blenkernel/intern/particle_system.c
index 322f9631606,9eaebc2c55c..cab5c593041
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@@ -3808,219 -3797,9 +3809,221 @@@ static void cached_step(ParticleSimulat
}
}
- static void particles_manta_step(ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params)
++static void particles_manta_step(
++ Main *UNUSED(bmain), ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params)
+{
+ ParticleSystem *psys = sim->psys;
+ if (psys->particles) {
+ MEM_freeN(psys->particles);
+ psys->particles = 0;
+ psys->totpart = 0;
+ }
+ if (psys->part) {
+ psys->part->totpart = 0;
+ psys->part->sta = 0;
+ psys->part->lifetime = 0;
+ }
+
+ /* manta sim particle import handling, actual loading of particles from file happens in FLUID helper. Here just pointer exchange */
+#ifdef WITH_MANTA
+ {
+ Object *ob = sim->ob;
+ SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
+
+ if (smd && smd->domain && smd->domain->fluid) {
+ SmokeDomainSettings *sds= smd->domain;
+
+ ParticleSettings *part = psys->part;
+ ParticleData *pa=NULL;
+
+ int p, totpart, tottypepart = 0;
+ int flagActivePart, activeParts = 0;
+ float posX, posY, posZ, velX, velY, velZ;
+ float resX, resY, resZ;
+ int upres[3] = {1};
+ char debugStrBuffer[256];
+
+ // Helper for scaling
+ float min[3], max[3], size[3], cell_size_scaled[3], max_size;
+
+ // Sanity check: parts also enabled in fluid domain?
+ if ((part->type == PART_MANTA_FLIP && (sds->particle_type & MOD_SMOKE_PARTICLE_FLIP)==0) ||
+ (part->type == PART_MANTA_DROP && (sds->particle_type & MOD_SMOKE_PARTICLE_DROP)==0) ||
+ (part->type == PART_MANTA_BUBBLE && (sds->particle_type & MOD_SMOKE_PARTICLE_BUBBLE)==0) ||
+ (part->type == PART_MANTA_FLOAT && (sds->particle_type & MOD_SMOKE_PARTICLE_FLOAT)==0) ||
+ (part->type == PART_MANTA_TRACER && (sds->particle_type & MOD_SMOKE_PARTICLE_TRACER)==0) )
+ {
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "particles_manta_step::error - found particle system that is not enabled in fluid domain\n");
+ return;
+ }
+
+ // Count particle amount. tottypepart only important for snd particles
+ if (part->type == PART_MANTA_FLIP) {
+ tottypepart = totpart = liquid_get_num_flip_particles(sds->fluid);
+ }
+ if (part->type == PART_MANTA_DROP || part->type == PART_MANTA_BUBBLE || part->type == PART_MANTA_FLOAT || part->type == PART_MANTA_TRACER) {
+ totpart = liquid_get_num_snd_particles(sds->fluid);
+
+ // tottypepart is the amount of particles of a snd particle type
+ for (p=0; p<totpart; p++) {
+ flagActivePart = liquid_get_snd_particle_flag_at(sds->fluid, p);
+ if ((part->type == PART_MANTA_DROP) && (flagActivePart & PDROPLET)) tottypepart++;
+ if ((part->type == PART_MANTA_BUBBLE) && (flagActivePart & PBUBBLE)) tottypepart++;
+ if ((part->type == PART_MANTA_FLOAT) && (flagActivePart & PFLOATER)) tottypepart++;
+ if ((part->type == PART_MANTA_TRACER) && (flagActivePart & PTRACER)) tottypepart++;
+ }
+ }
+
+ // Sanity check: no particle files present yet
+ if (!tottypepart)
+ return;
+
+ tottypepart = (use_render_params) ? tottypepart : (part->disp*tottypepart) / 100;
+
+ part->totpart = tottypepart;
+ part->sta = part->end = 1.0f;
+ part->lifetime = sim->scene->r.efra + 1;
+
+ /* allocate particles */
+ realloc_particles(sim, part->totpart);
+
+ for (p=0, pa=psys->particles; p<totpart; p++) {
+
+ if (part->type == PART_MANTA_FLIP) {
+ flagActivePart = liquid_get_flip_particle_flag_at(sds->fluid, p);
+
+// // Upres FLIP have custom (upscaled) res values
+ // TODO (sebbas): Future option might load highres FLIP particle system
+// if (sds->flags & MOD_SMOKE_MESH) {
+// resX = (float) fluid_get_mesh_res_x(sds->fluid);
+// resY = (float) fluid_get_mesh_res_y(sds->fluid);
+// resZ = (float) fluid_get_mesh_res_z(sds->fluid);
+//
+// upres[0] = upres[1] = upres[2] = fluid_get_mesh_upres(sds->fluid);
+// }
+// else
+ {
+ resX = (float) fluid_get_res_x(sds->fluid);
+ resY = (float) fluid_get_res_y(sds->fluid);
+ resZ = (float) fluid_get_res_z(sds->fluid);
+
+ upres[0] = upres[1] = upres[2] = 1;
+ }
+ }
+ else if (part->type == PART_MANTA_DROP || part->type == PART_MANTA_BUBBLE || part->type == PART_MANTA_FLOAT || part->type == PART_MANTA_TRACER) {
+ flagActivePart = liquid_get_snd_particle_flag_at(sds->fluid, p);
+
+ resX = (float) fluid_get_particle_res_x(sds->fluid);
+ resY = (float) fluid_get_particle_res_y(sds->fluid);
+ resZ = (float) fluid_get_particle_res_z(sds->fluid);
+
+ upres[0] = upres[1] = upres[2] = fluid_get_particle_upres(sds->fluid);
+ }
+ else {
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "particles_manta_step::error - unknown particle system type\n");
+ return;
+ }
+ // printf("part->type: %d, flagActivePart: %d\n", part->type, flagActivePart);
+
+ // check if type of particle type matches current particle system type (only important for snd particles)
+ if ((part->type == PART_MANTA_DROP) && (flagActivePart & PDROPLET)==0) continue;
+ if ((part->type == PART_MANTA_BUBBLE) && (flagActivePart & PBUBBLE)==0) continue;
+ if ((part->type == PART_MANTA_FLOAT) && (flagActivePart & PFLOATER)==0) continue;
+ if ((part->type == PART_MANTA_TRACER) && (flagActivePart & PTRACER)==0) continue;
+
+ // printf("system type is %d and particle type is %d\n", part->type, flagActivePart);
+
+ if (part->type == PART_MANTA_FLIP) {
+ posX = liquid_get_flip_particle_position_x_at(sds->fluid, p);
+ posY = liquid_get_flip_particle_position_y_at(sds->fluid, p);
+ posZ = liquid_get_flip_particle_position_z_at(sds->fluid, p);
+ velX = liquid_get_flip_particle_velocity_x_at(sds->fluid, p);
+ velY = liquid_get_flip_particle_velocity_y_at(sds->fluid, p);
+ velZ = liquid_get_flip_particle_velocity_z_at(sds->fluid, p);
+ }
+ else if (part->type == PART_MANTA_DROP || part->type == PART_MANTA_BUBBLE || part->type == PART_MANTA_FLOAT || part->type == PART_MANTA_TRACER) {
+ posX = liquid_get_snd_particle_position_x_at(sds->fluid, p);
+ posY = liquid_get_snd_particle_position_y_at(sds->fluid, p);
+ posZ = liquid_get_snd_particle_position_z_at(sds->fluid, p);
+ velX = liquid_get_snd_particle_velocity_x_at(sds->fluid, p);
+ velY = liquid_get_snd_particle_velocity_y_at(sds->fluid, p);
+ velZ = liquid_get_snd_particle_velocity_z_at(sds->fluid, p);
+ }
+
+ // Only show active particles, i.e. filter out dead particles that just Mantaflow needs
+ if ((flagActivePart & PDELETE)==0) { // mantaflow convention: PDELETE == inactive particle
+ activeParts++;
+
+ // Use particle system settings for particle size
+ pa->size = part->size;
+ if (part->randsize > 0.0f)
+ pa->size *= 1.0f - part->randsize * psys_frand(psys, p + 1);
+
+ // Get size (dimension) but considering scaling scaling
+ copy_v3_v3(cell_size_scaled, sds->cell_size);
+ mul_v3_v3(cell_size_scaled, ob->size);
+ VECMADD(min, sds->p0, cell_size_scaled, sds->res_min);
+ VECMADD(max, sds->p0, cell_size_scaled, sds->res_max);
+ sub_v3_v3v3(size, max, min);
+
+ // Biggest dimension will be used for upscaling
+ max_size = MAX3(size[0] / (float) upres[0], size[1] / (float) upres[1], size[2] / (float) upres[2]);
+// max_size = MAX3(size[0], size[1], size[2]);
+
+ // set particle position
+ pa->state.co[0] = posX;
+ pa->state.co[1] = posY;
+ pa->state.co[2] = posZ;
+
+ // normalize to unit cube around 0
+ pa->state.co[0] -= resX * 0.5f;
+ pa->stat
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list