Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-24 10:18:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 10:18:31 +0400
commit69e6894b15271884623ea6f56ead06db83acbe99 (patch)
treeb68200606afaca06cf7552f6b12fc20ebd30d487 /source/blender/blenkernel/intern/effect.c
parent7b99ae0ad3017e373be2a344e30d190b70ca66b4 (diff)
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r--source/blender/blenkernel/intern/effect.c194
1 files changed, 97 insertions, 97 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index f3abc20fab7..ff3eea8736d 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -105,7 +105,7 @@ EffectorWeights *BKE_add_effector_weights(Group *group)
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
int i;
- for(i=0; i<NUM_PFIELD_TYPES; i++)
+ for (i=0; i<NUM_PFIELD_TYPES; i++)
weights->weight[i] = 1.0f;
weights->global_gravity = 1.0f;
@@ -157,13 +157,13 @@ typedef struct VeNoCo {
/* -------------------------- Effectors ------------------ */
void free_partdeflect(PartDeflect *pd)
{
- if(!pd)
+ if (!pd)
return;
- if(pd->tex)
+ if (pd->tex)
pd->tex->id.us--;
- if(pd->rng)
+ if (pd->rng)
rng_free(pd->rng);
MEM_freeN(pd);
@@ -172,34 +172,34 @@ void free_partdeflect(PartDeflect *pd)
static void precalculate_effector(EffectorCache *eff)
{
unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
- if(!eff->pd->rng)
+ if (!eff->pd->rng)
eff->pd->rng = rng_new(eff->pd->seed + cfra);
else
rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
- if(eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
+ if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
Curve *cu= eff->ob->data;
- if(cu->flag & CU_PATH) {
- if(cu->path==NULL || cu->path->data==NULL)
+ if (cu->flag & CU_PATH) {
+ if (cu->path==NULL || cu->path->data==NULL)
makeDispListCurveTypes(eff->scene, eff->ob, 0);
- if(cu->path && cu->path->data) {
+ if (cu->path && cu->path->data) {
where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
mul_m4_v3(eff->ob->obmat, eff->guide_loc);
mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir);
}
}
}
- else if(eff->pd->shape == PFIELD_SHAPE_SURFACE) {
+ else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) {
eff->surmd = (SurfaceModifierData *)modifiers_findByType ( eff->ob, eModifierType_Surface );
- if(eff->ob->type == OB_CURVE)
+ if (eff->ob->type == OB_CURVE)
eff->flag |= PE_USE_NORMAL_DATA;
}
- else if(eff->psys)
+ else if (eff->psys)
psys_update_particle_tree(eff->psys, eff->scene->r.cfra);
/* Store object velocity */
- if(eff->ob) {
+ if (eff->ob) {
float old_vel[3];
where_is_object_time(eff->scene, eff->ob, cfra - 1.0f);
@@ -225,13 +225,13 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
{
EffectorCache *eff = NULL;
- if( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
+ if ( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
return;
if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal )
return;
- if(*effectors == NULL)
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
eff = new_effector_cache(scene, ob, NULL, ob->pd);
@@ -245,21 +245,21 @@ static void add_particles_to_effectors(ListBase **effectors, Scene *scene, Effec
{
ParticleSettings *part= psys->part;
- if( !psys_check_enabled(ob, psys) )
+ if ( !psys_check_enabled(ob, psys) )
return;
- if( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
+ if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
return;
- if( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
- if(*effectors == NULL)
+ if ( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd));
}
if (part->pd2 && part->pd2->forcefield && weights->weight[part->pd2->forcefield] != 0.0f) {
- if(*effectors == NULL)
+ if (*effectors == NULL)
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd2));
@@ -273,33 +273,33 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
unsigned int layer= ob_src->lay;
ListBase *effectors = NULL;
- if(weights->group) {
+ if (weights->group) {
GroupObject *go;
- for(go= weights->group->gobject.first; go; go= go->next) {
- if( (go->ob->lay & layer) ) {
- if( go->ob->pd && go->ob->pd->forcefield )
+ for (go= weights->group->gobject.first; go; go= go->next) {
+ if ( (go->ob->lay & layer) ) {
+ if ( go->ob->pd && go->ob->pd->forcefield )
add_object_to_effectors(&effectors, scene, weights, go->ob, ob_src);
- if( go->ob->particlesystem.first ) {
+ if ( go->ob->particlesystem.first ) {
ParticleSystem *psys= go->ob->particlesystem.first;
- for( ; psys; psys=psys->next )
+ for ( ; psys; psys=psys->next )
add_particles_to_effectors(&effectors, scene, weights, go->ob, psys, psys_src);
}
}
}
}
else {
- for(base = scene->base.first; base; base= base->next) {
- if( (base->lay & layer) ) {
- if( base->object->pd && base->object->pd->forcefield )
+ for (base = scene->base.first; base; base= base->next) {
+ if ( (base->lay & layer) ) {
+ if ( base->object->pd && base->object->pd->forcefield )
add_object_to_effectors(&effectors, scene, weights, base->object, ob_src);
- if( base->object->particlesystem.first ) {
+ if ( base->object->particlesystem.first ) {
ParticleSystem *psys= base->object->particlesystem.first;
- for( ; psys; psys=psys->next )
+ for ( ; psys; psys=psys->next )
add_particles_to_effectors(&effectors, scene, weights, base->object, psys, psys_src);
}
}
@@ -310,11 +310,11 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
void pdEndEffectors(ListBase **effectors)
{
- if(*effectors) {
+ if (*effectors) {
EffectorCache *eff = (*effectors)->first;
- for(; eff; eff=eff->next) {
- if(eff->guide_data)
+ for (; eff; eff=eff->next) {
+ if (eff->guide_data)
MEM_freeN(eff->guide_data);
}
@@ -334,10 +334,10 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
point->size = pa->size;
point->charge = 0.0f;
- if(part->pd && part->pd->forcefield == PFIELD_CHARGE)
+ if (part->pd && part->pd->forcefield == PFIELD_CHARGE)
point->charge += part->pd->f_strength;
- if(part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
+ if (part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
point->charge += part->pd2->f_strength;
point->vel_to_sec = 1.0f;
@@ -345,7 +345,7 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
point->flag = 0;
- if(sim->psys->part->flag & PART_ROT_DYN) {
+ if (sim->psys->part->flag & PART_ROT_DYN) {
point->ave = state->ave;
point->rot = state->rot;
}
@@ -406,24 +406,24 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
float norm[3], len = 0.0;
float visibility = 1.0, absorption = 0.0;
- if(!(eff->pd->flag & PFIELD_VISIBILITY))
+ if (!(eff->pd->flag & PFIELD_VISIBILITY))
return visibility;
- if(!colls)
+ if (!colls)
colls = get_collider_cache(eff->scene, eff->ob, NULL);
- if(!colls)
+ if (!colls)
return visibility;
negate_v3_v3(norm, efd->vec_to_point);
len = normalize_v3(norm);
// check all collision objects
- for(col = colls->first; col; col = col->next)
+ for (col = colls->first; col; col = col->next)
{
CollisionModifierData *collmd = col->collmd;
- if(col->ob == eff->ob)
+ if (col->ob == eff->ob)
continue;
if (collmd->bvhtree) {
@@ -439,13 +439,13 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
// visibility is only between 0 and 1, calculated from 1-absorption
visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
- if(visibility <= 0.0f)
+ if (visibility <= 0.0f)
break;
}
}
}
- if(!colliders)
+ if (!colliders)
free_collider_cache(&colls);
return visibility;
@@ -472,13 +472,13 @@ static float wind_func(struct RNG *rng, float strength)
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
{
/* first quick checks */
- if(usemax && fac > maxdist)
+ if (usemax && fac > maxdist)
return 0.0f;
- if(usemin && fac < mindist)
+ if (usemin && fac < mindist)
return 1.0f;
- if(!usemin)
+ if (!usemin)
mindist = 0.0;
return pow((double)(1.0f+fac-mindist), (double)(-power));
@@ -502,9 +502,9 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
fac = dot_v3v3(efd->nor, efd->vec_to_point2);
- if(eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
+ if (eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
falloff=0.0f;
- else if(eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
+ else if (eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
falloff=0.0f;
else switch(eff->pd->falloff) {
case PFIELD_FALL_SPHERE:
@@ -513,7 +513,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
case PFIELD_FALL_TUBE:
falloff*= falloff_func_dist(eff->pd, ABS(fac));
- if(falloff == 0.0f)
+ if (falloff == 0.0f)
break;
madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac);
@@ -522,7 +522,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
break;
case PFIELD_FALL_CONE:
falloff*= falloff_func_dist(eff->pd, ABS(fac));
- if(falloff == 0.0f)
+ if (falloff == 0.0f)
break;
r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
@@ -543,20 +543,20 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
BLI_bvhtree_find_nearest(surmd->bvhtree->tree, co, &nearest, surmd->bvhtree->nearest_callback, surmd->bvhtree);
- if(nearest.index != -1) {
+ if (nearest.index != -1) {
copy_v3_v3(surface_co, nearest.co);
- if(surface_nor) {
+ if (surface_nor) {
copy_v3_v3(surface_nor, nearest.no);
}
- if(surface_vel) {
+ if (surface_vel) {
MFace *mface = CDDM_get_tessface(surmd->dm, nearest.index);
copy_v3_v3(surface_vel, surmd->v[mface->v1].co);
add_v3_v3(surface_vel, surmd->v[mface->v2].co);
add_v3_v3(surface_vel, surmd->v[mface->v3].co);
- if(mface->v4)
+ if (mface->v4)
add_v3_v3(surface_vel, surmd->v[mface->v4].co);
mul_v3_fl(surface_vel, mface->v4 ? 0.25f : 0.333f);
@@ -571,7 +571,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
float cfra = eff->scene->r.cfra;
int ret = 0;
- if(eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
+ if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
/* closest point in the object surface is an effector */
float vec[3];
@@ -584,9 +584,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->size = 0.0f;
}
- else if(eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
+ else if (eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
- if(eff->ob->derivedFinal) {
+ if (eff->ob->derivedFinal) {
DerivedMesh *dm = eff->ob->derivedFinal;
dm->getVertCo(dm, *efd->index, efd->loc);
@@ -603,12 +603,12 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
ret = 1;
}
}
- else if(eff->psys) {
+ else if (eff->psys) {
ParticleData *pa = eff->psys->particles + *efd->index;
ParticleKey state;
/* exclude the particle itself for self effecting particles */
- if(eff->psys == point->psys && *efd->index == point->index) {
+ if (eff->psys == point->psys && *efd->index == point->index) {
/* pass */
}
else {
@@ -623,7 +623,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* TODO */
//if(eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
- // if(pa->dietime < eff->psys->cfra)
+ // if (pa->dietime < eff->psys->cfra)
// eff->flag |= PE_VELOCITY_TO_IMPULSE;
//}
@@ -634,7 +634,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->nor[1] = efd->nor[2] = 0.f;
mul_qt_v3(state.rot, efd->nor);
- if(real_velocity)
+ if (real_velocity)
copy_v3_v3(efd->vel, state.vel);
efd->size = pa->size;
@@ -648,13 +648,13 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* use z-axis as normal*/
normalize_v3_v3(efd->nor, ob->obmat[2]);
- if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
+ if (eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
float temp[3], translate[3];
sub_v3_v3v3(temp, point->loc, ob->obmat[3]);
project_v3_v3v3(translate, temp, efd->nor);
/* for vortex the shape chooses between old / new force */
- if(eff->pd->forcefield == PFIELD_VORTEX)
+ if (eff->pd->forcefield == PFIELD_VORTEX)
add_v3_v3v3(efd->loc, ob->obmat[3], translate);
else /* normally efd->loc is closest point on effector xy-plane */
sub_v3_v3v3(efd->loc, point->loc, translate);
@@ -663,7 +663,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
copy_v3_v3(efd->loc, ob->obmat[3]);
}
- if(real_velocity)
+ if (real_velocity)
copy_v3_v3(efd->vel, eff->velocity);
*eff->ob = obcopy;
@@ -673,15 +673,15 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
ret = 1;
}
- if(ret) {
+ if (ret) {
sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc);
efd->distance = len_v3(efd->vec_to_point);
/* rest length for harmonic effector, will have to see later if this could be extended to other effectors */
- if(eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
+ if (eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
mul_v3_fl(efd->vec_to_point, (efd->distance-eff->pd->f_size)/efd->distance);
- if(eff->flag & PE_USE_NORMAL_DATA) {
+ if (eff->flag & PE_USE_NORMAL_DATA) {
copy_v3_v3(efd->vec_to_point2, efd->vec_to_point);
copy_v3_v3(efd->nor2, efd->nor);
}
@@ -696,24 +696,24 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
}
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
{
- if(eff->pd->shape == PFIELD_SHAPE_POINTS) {
+ if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
efd->index = p;
*p = 0;
*tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
- if(*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
+ if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
*p = point->index % *tot;
*tot = *p+1;
}
}
- else if(eff->psys) {
+ else if (eff->psys) {
efd->index = p;
*p = 0;
*tot = eff->psys->totpart;
- if(eff->pd->forcefield == PFIELD_CHARGE) {
+ if (eff->pd->forcefield == PFIELD_CHARGE) {
/* Only the charge of the effected particle is used for
* interaction, not fall-offs. If the fall-offs aren't the
* same this will be unphysical, but for animation this
@@ -722,13 +722,13 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
*/
efd->charge = eff->pd->f_strength;
}
- else if(eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
+ else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
/* every particle is mapped to only one harmonic effector particle */
*p= point->index % eff->psys->totpart;
*tot= *p + 1;
}
- if(eff->psys->part->effector_amount) {
+ if (eff->psys->part->effector_amount) {
int totpart = eff->psys->totpart;
int amount = eff->psys->part->effector_amount;
@@ -748,7 +748,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
int hasrgb;
short mode = eff->pd->tex_mode;
- if(!eff->pd->tex)
+ if (!eff->pd->tex)
return;
result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL;
@@ -757,18 +757,18 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
copy_v3_v3(tex_co,point->loc);
- if(eff->pd->flag & PFIELD_TEX_2D) {
+ if (eff->pd->flag & PFIELD_TEX_2D) {
float fac=-dot_v3v3(tex_co, efd->nor);
madd_v3_v3fl(tex_co, efd->nor, fac);
}
- if(eff->pd->flag & PFIELD_TEX_OBJECT) {
+ if (eff->pd->flag & PFIELD_TEX_OBJECT) {
mul_m4_v3(eff->ob->imat, tex_co);
}
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result);
- if(hasrgb && mode==PFIELD_TEX_RGB) {
+ if (hasrgb && mode==PFIELD_TEX_RGB) {
force[0] = (0.5f - result->tr) * strength;
force[1] = (0.5f - result->tg) * strength;
force[2] = (0.5f - result->tb) * strength;
@@ -787,7 +787,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
tex_co[2] += nabla;
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3);
- if(mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
+ if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
force[0] = (result[0].tin - result[1].tin) * strength;
force[1] = (result[0].tin - result[2].tin) * strength;
force[2] = (result[0].tin - result[3].tin) * strength;
@@ -808,7 +808,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
}
}
- if(eff->pd->flag & PFIELD_TEX_2D) {
+ if (eff->pd->flag & PFIELD_TEX_2D) {
float fac = -dot_v3v3(force, efd->nor);
madd_v3_v3fl(force, efd->nor, fac);
}
@@ -826,10 +826,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
float damp = pd->f_damp;
float noise_factor = pd->f_noise;
- if(noise_factor > 0.0f) {
+ if (noise_factor > 0.0f) {
strength += wind_func(rng, noise_factor);
- if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
damp += wind_func(rng, noise_factor);
}
@@ -846,7 +846,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
case PFIELD_VORTEX:
/* old vortex force */
- if(pd->shape == PFIELD_SHAPE_POINT) {
+ if (pd->shape == PFIELD_SHAPE_POINT) {
cross_v3_v3v3(force, efd->nor, efd->vec_to_point);
normalize_v3(force);
mul_v3_fl(force, strength * efd->distance * efd->falloff);
@@ -864,7 +864,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
}
break;
case PFIELD_MAGNET:
- if(eff->pd->shape == PFIELD_SHAPE_POINT)
+ if (eff->pd->shape == PFIELD_SHAPE_POINT)
/* magnetic field of a moving charge */
cross_v3_v3v3(temp, efd->nor, efd->vec_to_point);
else
@@ -898,7 +898,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
/* Boid field is handled completely in boids code. */
return;
case PFIELD_TURBULENCE:
- if(pd->flag & PFIELD_GLOBAL_CO) {
+ if (pd->flag & PFIELD_GLOBAL_CO) {
copy_v3_v3(temp, point->loc);
}
else {
@@ -920,20 +920,20 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
}
- if(pd->flag & PFIELD_DO_LOCATION) {
+ if (pd->flag & PFIELD_DO_LOCATION) {
madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec);
- if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
}
}
- if(pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
+ if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
float xvec[3] = {1.0f, 0.0f, 0.0f};
float dave[3];
mul_qt_v3(point->rot, xvec);
cross_v3_v3v3(dave, xvec, force);
- if(pd->f_flow != 0.0f) {
+ if (pd->f_flow != 0.0f) {
madd_v3_v3fl(dave, point->ave, -pd->f_flow * efd->falloff);
}
add_v3_v3(point->ave, dave);
@@ -975,21 +975,21 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
/* Check for min distance here? (yes would be cool to add that, ton) */
- if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
+ if (effectors) for(eff = effectors->first; eff; eff=eff->next) {
/* object effectors were fully checked to be OK to evaluate! */
get_effector_tot(eff, &efd, point, &tot, &p, &step);
- for(; p<tot; p+=step) {
- if(get_effector_data(eff, &efd, point, 0)) {
+ for (; p<tot; p+=step) {
+ if (get_effector_data(eff, &efd, point, 0)) {
efd.falloff= effector_falloff(eff, &efd, point, weights);
- if(efd.falloff > 0.0f)
+ if (efd.falloff > 0.0f)
efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
- if(efd.falloff <= 0.0f)
+ if (efd.falloff <= 0.0f)
; /* don't do anything */
- else if(eff->pd->forcefield == PFIELD_TEXTURE)
+ else if (eff->pd->forcefield == PFIELD_TEXTURE)
do_texture_effector(eff, &efd, point, force);
else {
float temp1[3]={0,0,0}, temp2[3];
@@ -998,13 +998,13 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
do_physical_effector(eff, &efd, point, force);
// for softbody backward compatibility
- if(point->flag & PE_WIND_AS_SPEED && impulse) {
+ if (point->flag & PE_WIND_AS_SPEED && impulse) {
sub_v3_v3v3(temp2, force, temp1);
sub_v3_v3v3(impulse, impulse, temp2);
}
}
}
- else if(eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
+ else if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
/* special case for harmonic effector */
add_v3_v3v3(impulse, impulse, efd.vel);
}