[Bf-blender-cvs] [c79955fd288] soc-2021-simulation-display: Fix: Error while storing effectors forces, upto 3 effectors' forces can be stored now.
soumya pochiraju
noreply at git.blender.org
Wed Aug 18 09:31:19 CEST 2021
Commit: c79955fd288ba29730275babd94f850726701dc5
Author: soumya pochiraju
Date: Wed Aug 18 12:57:35 2021 +0530
Branches: soc-2021-simulation-display
https://developer.blender.org/rBc79955fd288ba29730275babd94f850726701dc5
Fix: Error while storing effectors forces, upto 3 effectors' forces can be stored now.
===================================================================
M source/blender/blenkernel/intern/effect.c
===================================================================
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 98da104ed23..8aa36fc5ed4 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1172,6 +1172,7 @@ void BKE_effectors_apply(ListBase *effectors,
/* Check for min distance here? (yes would be cool to add that, ton) */
int num_eff_forces = 0;
+ float out_force[3] = {0, 0, 0};
if (effectors) {
for (eff = effectors->first; eff; eff = eff->next) {
/* object effectors were fully checked to be OK to evaluate! */
@@ -1186,7 +1187,7 @@ void BKE_effectors_apply(ListBase *effectors,
efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
}
if (efd.falloff > 0.0f) {
- float out_force[3] = {0, 0, 0};
+ zero_v3(out_force);
if (eff->pd->forcefield == PFIELD_TEXTURE) {
do_texture_effector(eff, &efd, point, out_force);
@@ -1214,13 +1215,9 @@ void BKE_effectors_apply(ListBase *effectors,
add_v3_v3v3(impulse, impulse, efd.vel);
}
- if (r_eff_forces != NULL) {
- if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
- copy_v3_v3(r_eff_forces[num_eff_forces], impulse);
- }
- else {
- copy_v3_v3(r_eff_forces[num_eff_forces], force);
- }
+ if (r_eff_forces != NULL && num_eff_forces < 3) {
+ copy_v3_v3(r_eff_forces[num_eff_forces], out_force);
+ num_eff_forces++;
}
}
}
More information about the Bf-blender-cvs
mailing list