Commit: 0bc63068cec3cdbe2d380b2e6c2813a1b1b1d663
Author: Martin Felke
Date:   Thu Jan 5 01:39:28 2017 +0100
Branches: fracture_modifier
https://developer.blender.org/rB0bc63068cec3cdbe2d380b2e6c2813a1b1b1d663

crash fix for particle grid emission, do not allow to re-distribute particles 
there...

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

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 6bc50c2..e882391 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3850,7 +3850,8 @@ static void particles_fluid_step(ParticleSimulationData 
*sim, int UNUSED(cfra),
 #endif // WITH_MOD_FLUID
 }
 
-static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float 
UNUSED(cfra))
+static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float 
UNUSED(cfra),
+                          ParticleSettings *part)
 {
        ParticleSystem *psys = sim->psys;
        int oldtotpart = psys->totpart;
@@ -3859,8 +3860,11 @@ static int emit_particles(ParticleSimulationData *sim, 
PTCacheID *pid, float UNU
        if (totpart != oldtotpart)
                realloc_particles(sim, totpart);
 
-       //always allow redistribution of particles !
-       //return totpart - oldtotpart;
+       //always allow redistribution of particles, except on grid !
+       if (part->distr == PART_DISTR_GRID) {
+               return totpart - oldtotpart;
+       }
+
        return 1;
 }
 
@@ -3905,9 +3909,9 @@ static void system_step(ParticleSimulationData *sim, 
float cfra, const bool use_
 
 /* 1. emit particles and redo particles if needed */
        oldtotpart = psys->totpart;
-       emitcount = emit_particles(sim, pid, cfra);
+       emitcount = emit_particles(sim, pid, cfra, part);
        if (emitcount || psys->recalc & PSYS_RECALC_RESET) {
-               if (distribute_particles(sim, part->from)) {
+               if (distribute_particles(sim, part->from) || part->distr == 
PART_DISTR_GRID) {
                        initialize_all_particles(sim);
                        /* reset only just created particles (on startframe all 
particles are recreated) */
                        reset_all_particles(sim, 0.0, cfra, oldtotpart);
@@ -4279,9 +4283,9 @@ void particle_system_update(Scene *scene, Object *ob, 
ParticleSystem *psys, cons
                                        if (psys->recalc & PSYS_RECALC_RESET)
                                                psys_reset(psys, 
PSYS_RESET_ALL);
 
-                                       if (emit_particles(&sim, NULL, cfra) || 
(psys->recalc & PSYS_RECALC_RESET)) {
+                                       if (emit_particles(&sim, NULL, cfra, 
part) || (psys->recalc & PSYS_RECALC_RESET)) {
                                                free_keyed_keys(psys);
-                                               if (distribute_particles(&sim, 
part->from)) {
+                                               if (distribute_particles(&sim, 
part->from) || part->distr == PART_DISTR_GRID) {
                                                        
initialize_all_particles(&sim);
                                                }
                                                else {

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

Reply via email to