Commit: 9cde58c2144ff80c023e1564044b25921662243a
Author: Sebastián Barschkis
Date:   Wed Jun 21 23:17:34 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB9cde58c2144ff80c023e1564044b25921662243a

Fix T51837: Added num particles sanity check when reading particle files. Also 
fixed num particles field for pVel files

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

M       intern/mantaflow/intern/FLUID.cpp
M       source/blender/blenkernel/intern/particle_system.c

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

diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index f38ad9168e9..a2ad21c1a17 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -1022,7 +1022,10 @@ void FLUID::updateParticleData(const char* filename)
                }
        }
        // Reading particle data file v1 with velocities
-       else if (!strcmp(ID, "PD01")) {
+       else if (!strcmp(ID, "PD01"))
+       {
+               mNumParticles = ibuffer[0];
+
                mParticleVelocitiesX.resize(mNumParticles);
                mParticleVelocitiesY.resize(mNumParticles);
                mParticleVelocitiesZ.resize(mNumParticles);
diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index b1e21aa67cc..af2e312f48c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3766,20 +3766,18 @@ static void particles_manta_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
 
                if (smd && smd->domain && smd->domain->fluid) {
                        SmokeDomainSettings *sds= smd->domain;
-                       int  curFrame = sim->scene->r.cfra -1; // warning - 
sync with derived mesh fsmesh loading
 
                        ParticleSettings *part = psys->part;
                        ParticleData *pa=NULL;
 
                        int p, totpart;
                        int flagActivePart, activeParts = 0, fileParts = 0;
+                       totpart = liquid_get_num_particles(sds->fluid);
 
                        // Sanity check: no particle files present yet
-                       // TODO (sebbas): need better way to catch cases where 
pp is not yet present
-                       if (curFrame == 0)
+                       if (!totpart)
                                return;
 
-                       totpart = liquid_get_num_particles(sds->fluid);
                        totpart = (use_render_params) ? totpart : 
(part->disp*totpart) / 100;
 
                        part->totpart = totpart;

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

Reply via email to