[Bf-blender-cvs] [1e45e1b6b21] functions: don't check for events when there are none

Jacques Lucke noreply at git.blender.org
Sun Jun 30 16:00:37 CEST 2019


Commit: 1e45e1b6b21387f4a679a2ea48fc2cc591d16998
Author: Jacques Lucke
Date:   Sun Jun 30 09:53:24 2019 +0200
Branches: functions
https://developer.blender.org/rB1e45e1b6b21387f4a679a2ea48fc2cc591d16998

don't check for events when there are none

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

M	source/blender/simulations/bparticles/simulate.cpp

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

diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index f9c1281e792..013a0f0cb5f 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -343,18 +343,24 @@ BLI_NOINLINE static void simulate_block(BlockAllocator &block_allocator,
 
   ArrayRef<EventAction *> events = particle_type.event_actions();
 
-  SmallVector<uint> unfinished_particle_indices;
-  simulate_with_max_n_events(10,
-                             block_allocator,
-                             block,
-                             attribute_offsets,
-                             durations,
-                             end_time,
-                             events,
-                             unfinished_particle_indices);
+  if (events.size() == 0) {
+    ParticleSet all_particles_in_block(block, static_number_range_ref(block.active_range()));
+    apply_remaining_offsets(all_particles_in_block, attribute_offsets);
+  }
+  else {
+    SmallVector<uint> unfinished_particle_indices;
+    simulate_with_max_n_events(10,
+                               block_allocator,
+                               block,
+                               attribute_offsets,
+                               durations,
+                               end_time,
+                               events,
+                               unfinished_particle_indices);
 
-  ParticleSet remaining_particles(block, unfinished_particle_indices);
-  apply_remaining_offsets(remaining_particles, attribute_offsets);
+    ParticleSet remaining_particles(block, unfinished_particle_indices);
+    apply_remaining_offsets(remaining_particles, attribute_offsets);
+  }
 
   attribute_offsets_core.free_buffers();
 }



More information about the Bf-blender-cvs mailing list