From b35a96e195b100dbad68721065f431b168b7945b Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 3 Aug 2021 12:36:59 +0200 Subject: Fix T90346: particle force field self effect amount off by one When calculating the particle step in `get_effector_tot`, we have to round up (otherwise we might get an extra round in the for-loop in `BKE_effectors_apply` for certain cases). Example from the report: - 10.000 particles, Effector Amount 3 - was rounding the step down to 3333 - going into the for-loop for 0, 3333, 6666 and 9999 (4 times) - now rounding the step up to 3334 - going into the for-loop for 0, 3334 and 6668 (3 times as desired) Maniphest Tasks: T90346 Differential Revision: https://developer.blender.org/D12113 --- source/blender/blenkernel/intern/effect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index fc1721eaf3a..334118ddf3f 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -861,7 +861,7 @@ static void get_effector_tot( int totpart = eff->psys->totpart; int amount = eff->psys->part->effector_amount; - *step = (totpart > amount) ? totpart / amount : 1; + *step = (totpart > amount) ? (int)ceil((float)totpart / (float)amount) : 1; } } else { -- cgit v1.2.3