Commit: c410bb71f2fdbef7ef8b25b3dc64db18574f6701
Author: Sebastián Barschkis
Date:   Fri Jun 9 21:16:24 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBc410bb71f2fdbef7ef8b25b3dc64db18574f6701

filter out dead particles

mantaflow stores dead particles for internal purposes. in blender we just skip 
them, they dont need to be shown in the UI

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

M       source/blender/blenkernel/intern/particle_system.c

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

diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index 5b0d59e8087..ea394f61cba 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3772,7 +3772,7 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
                        ParticleData *pa=NULL;
 
                        int p, totpart;
-                       int activeParts = 0, fileParts = 0;
+                       int flagActivePart, activeParts = 0, fileParts = 0;
 
                        totpart = liquid_get_num_particles(sds->fluid);
                        totpart = (use_render_params) ? totpart : 
(part->disp*totpart) / 100;
@@ -3786,7 +3786,15 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
 
                        for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
 
-                               if (curFrame != 0) { // TODO (sebbas): need 
better way to catch cases where pp is not yet present
+                               // Sanity check: no particle files present yet
+                               // TODO (sebbas): need better way to catch 
cases where pp is not yet present
+                               if (curFrame == 0)
+                                       return;
+
+                               flagActivePart = 
liquid_get_particle_flag_at(sds->fluid, p);
+
+                               // Only allow active particles, i.e. filter out 
dead particles that just Mantaflow needs
+                               if (flagActivePart == 0) { // mantaflow 
convention: PNONE = 0 (regular, active particle)
                                        activeParts++;
 
                                        pa->size = 0.1; // TODO (sebbas): manta 
doesnt store particle sizes -> new field in domainsettings
@@ -3841,9 +3849,8 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
                                        pa->dietime = sim->scene->r.efra + 1;
                                        pa->lifetime = sim->scene->r.efra;
                                        pa->alive = PARS_ALIVE;
-
-                                       fileParts++;
                                }
+                               fileParts++;
                        }
 
                        totpart = psys->totpart = activeParts;

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

Reply via email to