diff options
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7e6897a2858..fe8f5ebdca6 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -770,7 +770,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP force[1] = (0.5f - result->tg) * strength; force[2] = (0.5f - result->tb) * strength; } - else { + else if (nabla != 0) { strength/=nabla; tex_co[0] += nabla; @@ -810,6 +810,9 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP force[2] = (dgdx - drdy) * strength; } } + else { + zero_v3(force); + } if (eff->pd->flag & PFIELD_TEX_2D) { float fac = -dot_v3v3(force, efd->nor); @@ -1127,7 +1130,7 @@ static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem) BLI_ghash_insert(debug_data->gh, elem, elem); } -void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], float r, float g, float b, const char *category, unsigned int hash) +void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, unsigned int hash) { unsigned int category_hash = BLI_ghashutil_strhash_p(category); SimDebugElement *elem; @@ -1146,8 +1149,18 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[ elem->color[0] = r; elem->color[1] = g; elem->color[2] = b; - copy_v3_v3(elem->v1, v1); - copy_v3_v3(elem->v2, v2); + if (v1) + copy_v3_v3(elem->v1, v1); + else + zero_v3(elem->v1); + if (v2) + copy_v3_v3(elem->v2, v2); + else + zero_v3(elem->v2); + if (str) + BLI_strncpy(elem->str, str, sizeof(elem->str)); + else + elem->str[0] = '\0'; debug_data_insert(_sim_debug_data, elem); } |