Commit: d9ba9993d8b441be1513ba27b1bdf752636b09d2
Author: Sebastián Barschkis
Date:   Tue Jul 18 10:27:51 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBd9ba9993d8b441be1513ba27b1bdf752636b09d2

added setup for bubble particles

blender internal particle setup (not manta side), i.e. UI, particle system 
creation / deletion, particle IO.

===================================================================

M       intern/mantaflow/intern/FLUID.cpp
M       intern/mantaflow/intern/strings/liquid_script.h
M       release/scripts/startup/bl_ui/properties_physics_smoke.py
M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenkernel/intern/particle_system.c
M       source/blender/makesdna/DNA_particle_types.h
M       source/blender/makesdna/DNA_smoke_types.h
M       source/blender/makesrna/intern/rna_particle.c
M       source/blender/makesrna/intern/rna_smoke.c

===================================================================

diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index fa8d1b2e2a7..4e09415c683 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -659,6 +659,14 @@ std::string FLUID::getRealValue(const std::string& 
varName,  SmokeModifierData *
                ss << smd->domain->particle_band_width;
        else if (varName == "SNDPARTICLE_VEL_THRESH")
                ss << smd->domain->particle_velocity_threshold;
+       else if (varName == "USING_DROP_PARTS")
+               ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_DROP ? 
"True" : "False");
+       else if (varName == "USING_BUBBLE_PARTS")
+               ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_BUBBLE ? 
"True" : "False");
+       else if (varName == "USING_FLOAT_PARTS")
+               ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_FLOAT ? 
"True" : "False");
+       else if (varName == "USING_TRACER_PARTS")
+               ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_TRACER ? 
"True" : "False");
        else if (varName == "GRAVITY_X")
                ss << smd->domain->gravity[0];
        else if (varName == "GRAVITY_Y")
diff --git a/intern/mantaflow/intern/strings/liquid_script.h 
b/intern/mantaflow/intern/strings/liquid_script.h
index eb8ddbfde91..0e42b170964 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -42,7 +42,13 @@ adjustedNarrowBandWidth_s$ID$ = $PARTICLE_BAND_WIDTH$ # only 
used in adjustNumbe
 particleNumber_s$ID$ = $PARTICLE_NUMBER$\n\
 minParticles_s$ID$   = pow(particleNumber_s$ID$, dim_s$ID$)\n\
 radiusFactor_s$ID$   = $PARTICLE_RADIUS$\n\
-randomness_s$ID$     = $PARTICLE_RANDOMNESS$\n";
+randomness_s$ID$     = $PARTICLE_RANDOMNESS$\n\
+maxVel_s$ID$         = 1 # just declared here, do not set\n\
+\n\
+using_drops_s$ID$   = $USING_DROP_PARTS$\n\
+using_bubbles_s$ID$ = $USING_BUBBLE_PARTS$\n\
+using_floats_s$ID$  = $USING_FLOAT_PARTS$\n\
+using_tracers_s$ID$ = $USING_TRACER_PARTS$\n";
 
 const std::string liquid_variables_high = "\n\
 mantaMsg('Liquid variables high')\n";
@@ -185,8 +191,21 @@ def manta_step_$ID$(framenr):\n\
 const std::string liquid_step_low = "\n\
 def liquid_step_$ID$():\n\
     mantaMsg('Liquid step low')\n\
+    \n\
+    # TODO (sebbas): liquid inflow\n\
+    # add initial velocity\n\
+    #mapWeights_s$ID$.clear() # mis-use mapWeights\n\
+    #setInitialVelocity(flags=flags_s$ID$, vel=vel_s$ID$, invel=invel_s$ID$)\n\
+    #resampleVec3ToMac(source=invel_s$ID$, target=mapWeights_s$ID$)\n\
+    #addGridToPartsVec3(source=invel_s$ID$, parts=pp_s$ID$, 
target=pVel_pp$ID$)\n\
+    \n\
     mantaMsg('Advecting particles')\n\
     pp_s$ID$.advectInGrid(flags=flags_s$ID$, vel=vel_s$ID$, 
integrationMode=IntRK4, deleteInObstacle=False, stopInObstacle=False)\n\
+    \n\
+    mantaMsg('Sampling secondary particles')\n\
+    if (using_drops_s$ID$ or using_bubbles_s$ID$ or using_floats_s$ID$ or 
using_tracers_s$ID$):\n\
+        sampleSndParts(parts=ppSnd_s$ID$, flags=flags_s$ID$, vel=vel_s$ID$, 
partVel=pVelSnd_pp$ID$, partType=pTypeSnd_pp$ID$, phi=phi_s$ID$, 
dropVelThresh=$SNDPARTICLE_VEL_THRESH$, bubbleRise=0.5, minParticles=2, 
maxParticles=8, gravity=gravity_s$ID$, drops=using_drops_s$ID$, 
bubbles=using_bubbles_s$ID$, floats=using_floats_s$ID$, 
tracers=using_tracers_s$ID$)\n\
+    \n\
     mantaMsg('Pushing particles out of obstacles')\n\
     pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObs_s$ID$)\n\
     pushOutofObs(parts=ppSnd_s$ID$, flags=flags_s$ID$, phiObs=phiObs_s$ID$, 
shift=1.0)\n\
@@ -246,8 +265,6 @@ def liquid_step_$ID$():\n\
     if using_highres_s$ID$:\n\
         interpolateGrid(target=phi_xl$ID$, source=phiParts_s$ID$)\n\
     \n\
-    sampleSndParts(parts=ppSnd_s$ID$, flags=flags_s$ID$, vel=vel_s$ID$, 
partVel=pVelSnd_pp$ID$, phi=phi_s$ID$, thresh=$SNDPARTICLE_VEL_THRESH$, 
minParticles=2, maxParticles=8, gravity=gravity_s$ID$)\n\
-    \n\
     # set source grids for resampling, used in adjustNumber!\n\
     pVel_pp$ID$.setSource(vel_s$ID$, isMAC=True)\n\
     adjustNumber(parts=pp_s$ID$, vel=vel_s$ID$, flags=flags_s$ID$, 
minParticles=1*minParticles_s$ID$, maxParticles=2*minParticles_s$ID$, 
phi=phi_s$ID$, exclude=phiObs_s$ID$, radiusFactor=radiusFactor_s$ID$, 
narrowBand=adjustedNarrowBandWidth_s$ID$)\n\
@@ -425,7 +442,11 @@ if 'narrowBandWidth_s$ID$'  in globals() : del 
narrowBandWidth_s$ID$\n\
 if 'combineBandWidth_s$ID$' in globals() : del combineBandWidth_s$ID$\n\
 if 'minParticles_s$ID$'     in globals() : del minParticles_s$ID$\n\
 if 'particleNumber_s$ID$'   in globals() : del particleNumber_s$ID$\n\
-if 'maxVel_s$ID$'           in globals() : del maxVel_s$ID$\n";
+if 'maxVel_s$ID$'           in globals() : del maxVel_s$ID$\n\
+if 'using_drops_s$ID$'      in globals() : del using_drops_s$ID$\n\
+if 'using_bubbles_s$ID$'    in globals() : del using_bubbles_s$ID$\n\
+if 'using_floats_s$ID$'     in globals() : del using_floats_s$ID$\n\
+if 'using_tracers_s$ID$'    in globals() : del using_tracers_s$ID$\n";
 
 const std::string liquid_delete_variables_high = "\n\
 mantaMsg('Deleting highres liquid variables')\n";
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py 
b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 28182fb7bd9..c2092a606ca 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -362,6 +362,7 @@ class PHYSICS_PT_smoke_particles(PhysicButtonsPanel, Panel):
         col.enabled = not domain.point_cache.is_baked
         col.prop(domain, "use_flip_particles", text="FLIP")
         col.prop(domain, "use_drop_particles", text="Drop")
+        col.prop(domain, "use_bubble_particles", text="Bubble")
         col.prop(domain, "use_float_particles", text="Float")
         #col.prop(domain, "use_tracer_particles", text="Tracer")
 
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index bb298a13cd4..f3a5fef204d 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -5847,7 +5847,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, 
DynamicPaintSurface *su
                                        /* Particle brush: */
                                        if (brush->collision == 
MOD_DPAINT_COL_PSYS) {
                                                if (brush->psys && 
brush->psys->part &&
-                                                   
ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID, PART_MANTA_FLIP, 
PART_MANTA_DROP, PART_MANTA_FLOAT, PART_MANTA_TRACER) &&
+                                                   
ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID, PART_MANTA_FLIP, 
PART_MANTA_DROP, PART_MANTA_BUBBLE, PART_MANTA_FLOAT, PART_MANTA_TRACER) &&
                                                    
psys_check_enabled(brushObj, brush->psys, G.is_rendering))
                                                {
                                                        /* Paint a particle 
system */
diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index e53424d1c66..0a0880fdf06 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -550,6 +550,7 @@ static void 
initialize_particle_texture(ParticleSimulationData *sim, ParticleDat
                break;
        case PART_MANTA_FLIP:
        case PART_MANTA_DROP:
+       case PART_MANTA_BUBBLE:
        case PART_MANTA_FLOAT:
        case PART_MANTA_TRACER:
                break;
@@ -3783,6 +3784,7 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
                        // Sanity check: parts also enabled in fluid domain?
                        if ((part->type == PART_MANTA_FLIP && 
!(sds->particle_type & MOD_SMOKE_PARTICLE_FLIP)) ||
                                (part->type == PART_MANTA_DROP && 
!(sds->particle_type & MOD_SMOKE_PARTICLE_DROP)) ||
+                               (part->type == PART_MANTA_BUBBLE && 
!(sds->particle_type & MOD_SMOKE_PARTICLE_BUBBLE)) ||
                                (part->type == PART_MANTA_FLOAT && 
!(sds->particle_type & MOD_SMOKE_PARTICLE_FLOAT)) ||
                                (part->type == PART_MANTA_TRACER && 
!(sds->particle_type & MOD_SMOKE_PARTICLE_TRACER)) )
                        {
@@ -3792,7 +3794,7 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
 
                        if (part->type == PART_MANTA_FLIP)
                                totpart = 
liquid_get_num_flip_particles(sds->fluid);
-                       if (part->type == PART_MANTA_DROP || part->type == 
PART_MANTA_FLOAT || part->type == PART_MANTA_TRACER)
+                       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);
 
                        // Sanity check: no particle files present yet
@@ -3823,7 +3825,7 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
                                        velZ = 
liquid_get_flip_particle_velocity_z_at(sds->fluid, p);
                                        flagActivePart = 
liquid_get_flip_particle_flag_at(sds->fluid, p);
                                }
-                               if (part->type == PART_MANTA_DROP || part->type 
== PART_MANTA_FLOAT || part->type == PART_MANTA_TRACER) {
+                               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);
@@ -3836,9 +3838,10 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
 
                                // printf("system type is %d and particle type 
is %d\n", part->type, type);
                                // check if type of particle type matches 
current particle system type (only important for snd particles)
-                               if ((part->type == PART_MANTA_DROP) && type != 
0) continue; // // mantaflow convention: ParticleType DROP = 0
-                               if ((part->type == PART_MANTA_FLOAT) && type != 
1) continue; // // mantaflow convention: ParticleType FLOAT = 1
-                               if ((part->type == PART_MANTA_TRACER) && type 
!= 2) continue; // // mantaflow convention: ParticleType TRACER = 2
+                               if ((part->type == PART_MANTA_DROP) && (type != 
PDROPLET)) continue;
+                               if ((part->type == PART_MANTA_BUBBLE) && (type 
!= PBUBBLE)) continue;
+                               if ((part->type == PART_MANTA_FLOAT) && (type 
!= PFLOAT)) continue;
+                               if ((part->type == PART_MANTA_TRACER) && (type 
!= PTRACER)) continue;
 
                                // Only allow active particles, i.e. filter out 
dead particles that just Mantaflow needs
                                if (flagActivePart == 0) { // mantaflow 
convention: PNONE = 0 (regu

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to