diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 02:39:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 12:48:17 +0300 |
commit | 735515a3f9e4c41738bf714d682b13db64adb638 (patch) | |
tree | 04b551336131bc84ecc664a77ae0cefdded78d0b /source/blender/blenkernel/intern/particle_child.c | |
parent | 14a49950ff11f43b7a5a73da545339b969de97f0 (diff) |
Cleanup: style, use braces for blenkernel
Diffstat (limited to 'source/blender/blenkernel/intern/particle_child.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_child.c | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index c967449248d..b74fd3ff684 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -56,10 +56,12 @@ static void psys_path_iter_get(ParticlePathIterator *iter, if (parent) { iter->parent_key = parent + index; - if (index > 0) + if (index > 0) { mul_qt_qtqt(iter->parent_rotation, iter->parent_key->rot, parent->rot); - else + } + else { copy_qt_qt(iter->parent_rotation, parent->rot); + } } else { iter->parent_key = NULL; @@ -110,8 +112,9 @@ static void do_kink_spiral_deform(ParticleKey *state, float radius = amplitude * expf(b * theta); /* a bit more intuitive than using negative frequency for this */ - if (amplitude < 0.0f) + if (amplitude < 0.0f) { theta = -theta; + } cross_v3_v3v3(spiral_axis, dir, kink); normalize_v3(spiral_axis); @@ -276,8 +279,9 @@ static void do_kink_spiral(ParticleThreadContext *ctx, } totlen = 0.0f; - for (k = 0, key = keys; k < end_index - 1; k++, key++) + for (k = 0, key = keys; k < end_index - 1; k++, key++) { totlen += len_v3v3((key + 1)->co, key->co); + } *r_totkeys = end_index; *r_max_length = totlen; @@ -426,16 +430,19 @@ void do_kink(ParticleKey *state, float kink[3] = {1.f, 0.f, 0.f}, par_vec[3], q1[4] = {1.f, 0.f, 0.f, 0.f}; float t, dt = 1.f, result[3]; - if (ELEM(type, PART_KINK_NO, PART_KINK_SPIRAL)) + if (ELEM(type, PART_KINK_NO, PART_KINK_SPIRAL)) { return; + } CLAMP(time, 0.f, 1.f); if (shape != 0.0f && !ELEM(type, PART_KINK_BRAID)) { - if (shape < 0.0f) + if (shape < 0.0f) { time = (float)pow(time, 1.f + shape); - else + } + else { time = (float)pow(time, 1.f / (1.f - shape)); + } } t = time * freq * (float)M_PI; @@ -452,8 +459,9 @@ void do_kink(ParticleKey *state, kink[axis] = 1.f; - if (obmat) + if (obmat) { mul_mat3_m4_v3(obmat, kink); + } mul_qt_v3(par_rot, kink); @@ -569,10 +577,12 @@ void do_kink(ParticleKey *state, } /* blend the start of the kink */ - if (dt < 1.f) + if (dt < 1.f) { interp_v3_v3v3(state->co, state->co, result, dt); - else + } + else { copy_v3_v3(state->co, result); + } } static float do_clump_level(float result[3], @@ -594,15 +604,19 @@ static float do_clump_level(float result[3], else if (clumpfac != 0.0f) { float cpow; - if (clumppow < 0.0f) + if (clumppow < 0.0f) { cpow = 1.0f + clumppow; - else + } + else { cpow = 1.0f + 9.0f * clumppow; + } - if (clumpfac < 0.0f) /* clump roots instead of tips */ + if (clumpfac < 0.0f) { /* clump roots instead of tips */ clump = -clumpfac * pa_clump * (float)pow(1.0 - (double)time, (double)cpow); - else + } + else { clump = clumpfac * pa_clump * (float)pow((double)time, (double)cpow); + } interp_v3_v3v3(result, co, par_co, clump); } @@ -696,8 +710,9 @@ static void do_rough_curve(const float loc[3], float rough[3]; float rco[3]; - if (!roughcurve) + if (!roughcurve) { return; + } fac *= clamp_f(curvemapping_evaluateF(roughcurve, 0, time), 0.0f, 1.0f); @@ -840,7 +855,7 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, do_twist(modifier_ctx, state, t); - if (part->flag & PART_CHILD_EFFECT) + if (part->flag & PART_CHILD_EFFECT) { /* state is safe to cast, since only co and vel are used */ guided = do_guides(sim->depsgraph, sim->psys->part, @@ -848,6 +863,7 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, (ParticleKey *)state, cpa->parent, t); + } if (guided == 0) { float orco_offset[3]; @@ -888,8 +904,9 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, do_rough_curve(modifier_ctx->orco, mat, t, rough1, part->rough1_size, roughcurve, state); } else { - if (rough1 > 0.f) + if (rough1 > 0.f) { do_rough(modifier_ctx->orco, mat, t, rough1, part->rough1_size, 0.0, state); + } if (rough2 > 0.f) { float vec[3]; |