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-02-27 14:35:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-02-27 14:35:39 +0400
commit47c373c7a970fa4bd26453a6e35a4b066f2b77e4 (patch)
tree43d916fb86bcf797afa834649706669694225fe8 /source/blender/blenkernel/intern
parent120297734b4a01d93e5223e02f255b5aef01e281 (diff)
style cleanup (mostly whitespace)
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c2
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/booleanops_mesh.c12
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c3
-rw-r--r--source/blender/blenkernel/intern/collision.c36
-rw-r--r--source/blender/blenkernel/intern/deform.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c15
-rw-r--r--source/blender/blenkernel/intern/displist.c2
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c4
-rw-r--r--source/blender/blenkernel/intern/effect.c13
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/font.c6
-rw-r--r--source/blender/blenkernel/intern/group.c2
-rw-r--r--source/blender/blenkernel/intern/icons.c2
-rw-r--r--source/blender/blenkernel/intern/idprop.c6
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/blenkernel/intern/implicit.c2
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c10
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/ocean.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c166
-rw-r--r--source/blender/blenkernel/intern/particle_system.c186
-rw-r--r--source/blender/blenkernel/intern/pointcache.c4
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c104
-rw-r--r--source/blender/blenkernel/intern/softbody.c404
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c4
-rw-r--r--source/blender/blenkernel/intern/tracking.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c7
31 files changed, 508 insertions, 506 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 0a6d8b7c041..61a8ea19621 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2541,7 +2541,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
}
}
}
- nr_tris_to_pile = nr_verts-2 ;
+ nr_tris_to_pile = nr_verts - 2;
if ( nr_tris_to_pile==1 || nr_tris_to_pile==2 )
{
const int indices[] = {offs+0, offs+1, offs+2, offs+0, offs+2, (offs+3)&0x3 };
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 000d74f110a..c181548eb19 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1497,8 +1497,8 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
/* Determine if the current frame is within the strip's range */
length = strip->end-strip->start;
actlength = strip->actend-strip->actstart;
- striptime = (scene_cfra-(strip->start)) / length;
- stripframe = (scene_cfra-(strip->start)) ;
+ striptime = (scene_cfra - strip->start) / length;
+ stripframe = (scene_cfra - strip->start);
if (striptime>=0.0) {
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index bfafd96b95e..77523980a64 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1649,7 +1649,7 @@ int count_duplilist(Object *ob)
for(; psys; psys=psys->next)
pdup += psys->totpart;
- if(pdup==0){
+ if(pdup==0) {
Mesh *me= ob->data;
return me->totvert;
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 36646c85dc1..c9eb19c0f32 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -194,7 +194,7 @@ static void copy_bonechildren(Bone* newBone, Bone* oldBone, Bone* actBone, Bone
/* For each child in the list, update it's children */
newChildBone = newBone->childbase.first;
- for (curBone = oldBone->childbase.first; curBone; curBone = curBone->next){
+ for (curBone = oldBone->childbase.first; curBone; curBone = curBone->next) {
newChildBone->parent = newBone;
copy_bonechildren(newChildBone, curBone, actBone, newActBone);
newChildBone = newChildBone->next;
diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c
index 8dbf2c1c828..ea626df5018 100644
--- a/source/blender/blenkernel/intern/booleanops_mesh.c
+++ b/source/blender/blenkernel/intern/booleanops_mesh.c
@@ -45,7 +45,7 @@
void
CSG_DestroyMeshDescriptor(
CSG_MeshDescriptor *mesh
-){
+) {
// Call mesh descriptors destroy function....
mesh->m_destroy_func(mesh);
}
@@ -66,7 +66,7 @@ static
void
CSG_DestroyCSGMeshInternals(
CSG_MeshDescriptor *mesh
-){
+) {
CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator));
CSG_FreeFaceDescriptor(&(mesh->m_face_iterator));
}
@@ -102,7 +102,7 @@ MakeCSGMeshFromBlenderBase(
CSG_LoadBlenderMesh(
Object * obj,
CSG_MeshDescriptor *output
-){
+) {
Mesh *me;
if (output == NULL || obj == NULL) return 0;
@@ -132,7 +132,7 @@ CSG_LoadBlenderMesh(
int
CSG_AddMeshToBlender(
CSG_MeshDescriptor *mesh
-){
+) {
Mesh *me_new = NULL;
Object *ob_new = NULL;
float inv_mat[4][4];
@@ -172,7 +172,7 @@ CSG_PerformOp(
CSG_MeshDescriptor *mesh2,
int int_op_type,
CSG_MeshDescriptor *output
-){
+) {
CSG_OperationType op_type;
CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction();
@@ -241,7 +241,7 @@ NewBooleanMeshTest(
struct Base * base,
struct Base * base_select,
int op_type
-){
+) {
CSG_MeshDescriptor m1,m2,output;
CSG_MeshDescriptor output2,output3;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 9ad59574fa3..43621b3550e 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -118,7 +118,6 @@ static int cdDM_getNumTessFaces(DerivedMesh *dm)
printf("%s: has no faces!, call DM_ensure_tessface() if you need them\n");
}
#endif
-
return dm->numTessFaceData;
}
@@ -807,7 +806,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
GPU_normal_setup( dm );
GPU_uv_setup( dm );
if( col != NULL ) {
- /*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
+ /*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
col = 0;
} else if( mcol && dm->drawObject->colType == CD_MCOL ) {
col = 0;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 10a955760f0..ecb1ae4bed3 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -194,10 +194,10 @@ gsl_poly_solve_cubic (double a, double b, double c,
if (R == 0 && Q == 0)
{
- *x0 = - a / 3 ;
- *x1 = - a / 3 ;
- *x2 = - a / 3 ;
- return 3 ;
+ *x0 = - a / 3;
+ *x1 = - a / 3;
+ *x2 = - a / 3;
+ return 3;
}
else if (CR2 == CQ3)
{
@@ -222,7 +222,7 @@ gsl_poly_solve_cubic (double a, double b, double c,
*x1 = - sqrtQ - a / 3;
*x2 = 2 * sqrtQ - a / 3;
}
- return 3 ;
+ return 3;
}
else if (CR2 < CQ3) /* equivalent to R2 < Q3 */
{
@@ -237,14 +237,14 @@ gsl_poly_solve_cubic (double a, double b, double c,
/* Sort *x0, *x1, *x2 into increasing order */
if (*x0 > *x1)
- mySWAP(*x0, *x1) ;
+ mySWAP(*x0, *x1);
if (*x1 > *x2)
{
- mySWAP(*x1, *x2) ;
+ mySWAP(*x1, *x2);
if (*x0 > *x1)
- mySWAP(*x0, *x1) ;
+ mySWAP(*x0, *x1);
}
return 3;
@@ -253,7 +253,7 @@ gsl_poly_solve_cubic (double a, double b, double c,
{
double sgnR = (R >= 0 ? 1 : -1);
double A = -sgnR * pow (fabs (R) + sqrt (R2 - Q3), 1.0/3.0);
- double B = Q / A ;
+ double B = Q / A;
*x0 = A + B - a / 3;
return 1;
}
@@ -297,27 +297,27 @@ gsl_poly_solve_quadratic (double a, double b, double c,
{
double sgnb = (b > 0 ? 1 : -1);
double temp = -0.5 * (b + sgnb * sqrt (disc));
- double r1 = temp / a ;
- double r2 = c / temp ;
+ double r1 = temp / a;
+ double r2 = c / temp;
if (r1 < r2)
{
- *x0 = r1 ;
- *x1 = r2 ;
+ *x0 = r1;
+ *x1 = r2;
}
else
{
- *x0 = r2 ;
- *x1 = r1 ;
+ *x0 = r2;
+ *x1 = r1;
}
}
return 2;
}
else if (disc == 0)
{
- *x0 = -0.5 * b / a ;
- *x1 = -0.5 * b / a ;
- return 2 ;
+ *x0 = -0.5 * b / a;
+ *x1 = -0.5 * b / a;
+ return 2;
}
else
{
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index a95cd8d00d8..822293c35e1 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -51,7 +51,7 @@ void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
outbase->first= outbase->last= NULL;
- for (defgroup = inbase->first; defgroup; defgroup=defgroup->next){
+ for (defgroup = inbase->first; defgroup; defgroup=defgroup->next) {
defgroupn= defgroup_duplicate(defgroup);
BLI_addtail(outbase, defgroupn);
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 217eb0d68c6..a5097054de2 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -349,7 +349,7 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
for(base = scene->base.first; base; base= base->next) {
if((base->lay & ob->lay) && base->object->pd) {
Object *ob1= base->object;
- if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
+ if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
node2 = dag_get_node(dag, ob1);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Field Collision");
}
@@ -380,7 +380,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
node->customdata_mask= 0;
if (ob->type == OB_ARMATURE) {
- if (ob->pose){
+ if (ob->pose) {
bPoseChannel *pchan;
bConstraint *con;
@@ -1421,7 +1421,8 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
retval = 1;
}
// else if (itA->node->color == DAG_BLACK) { // cross or forward
-// ;
+//
+// }
}
itA = itA->next;
}
@@ -1770,7 +1771,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
if (node) {
node = pop_queue(nqueue);
if (node->ob == sce) // we are done
- break ;
+ break;
node->color = DAG_BLACK;
time++;
@@ -2068,7 +2069,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
sce->theDag->time++; // so we know which nodes were accessed
lasttime= sce->theDag->time;
for(itA = firstnode->child; itA; itA= itA->next) {
- if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
+ if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
ob= (Object*)(itA->node->ob);
if(ob->recalc & OB_RECALC_ALL) {
@@ -2565,7 +2566,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
if(idtype == ID_MC) {
- for(obt=bmain->object.first; obt; obt= obt->id.next){
+ for(obt=bmain->object.first; obt; obt= obt->id.next) {
bConstraint *con;
for (con = obt->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -2890,7 +2891,7 @@ void DAG_pose_sort(Object *ob)
if (node) {
node = pop_queue(nqueue);
if (node->ob == NULL) // we are done
- break ;
+ break;
node->color = DAG_BLACK;
/* put node in new list */
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 3a67c66165a..ea84f73b27f 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1110,7 +1110,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if(forRender || nu->hide==0) {
int resolu= nu->resolu, resolv= nu->resolv;
- if(forRender){
+ if(forRender) {
if(cu->resolu_ren) resolu= cu->resolu_ren;
if(cu->resolv_ren) resolv= cu->resolv_ren;
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 9a8946ae61e..edd1bc6d679 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4161,7 +4161,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
/*
* Spread Effect
*/
- if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD) {
+ if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD) {
float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*surface->spread_speed*timescale;
/* Copy current surface to the previous points array to read unmodified values */
@@ -4204,7 +4204,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
/*
* Shrink Effect
*/
- if (surface->effect & MOD_DPAINT_EFFECT_DO_SHRINK) {
+ if (surface->effect & MOD_DPAINT_EFFECT_DO_SHRINK) {
float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*surface->shrink_speed*timescale;
/* Copy current surface to the previous points array to read unmodified values */
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 69d860bfb08..82a5d9aba3a 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -508,7 +508,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
falloff=0.0f;
else if(eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
falloff=0.0f;
- else switch(eff->pd->falloff){
+ else switch(eff->pd->falloff) {
case PFIELD_FALL_SPHERE:
falloff*= falloff_func_dist(eff->pd, efd->distance);
break;
@@ -610,8 +610,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
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 {
ParticleSimulationData sim= {NULL};
sim.scene= eff->scene;
@@ -809,7 +810,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);
}
@@ -836,7 +837,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
copy_v3_v3(force, efd->vec_to_point);
- switch(pd->forcefield){
+ switch(pd->forcefield) {
case PFIELD_WIND:
copy_v3_v3(force, efd->nor);
mul_v3_fl(force, strength * efd->falloff);
@@ -1000,7 +1001,7 @@ 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);
}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 95c0aa60991..8098706e370 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -571,7 +571,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
* 2) if before first frame or after last frame, make sure some cycling is in use
*/
if (evaltime < prevkey[0]) {
- if (data->before_mode) {
+ if (data->before_mode) {
side= -1;
mode= data->before_mode;
cycles= data->before_cycles;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index f45899ff365..5a37a65ddbf 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -333,7 +333,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->flagu = CU_NURB_CYCLIC;
bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp");
- if (bp == NULL){
+ if (bp == NULL) {
MEM_freeN(nu2);
return;
}
@@ -399,7 +399,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
while(nu1)
{
bezt1 = nu1->bezt;
- if (bezt1){
+ if (bezt1) {
nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb),"duplichar_nurb");
if (nu2 == NULL) break;
memcpy(nu2, nu1, sizeof(struct Nurb));
@@ -419,7 +419,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
i = nu2->pntsu;
bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple),"duplichar_bezt2");
- if (bezt2 == NULL){
+ if (bezt2 == NULL) {
MEM_freeN(nu2);
break;
}
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 7ac395212ab..183483ef7a8 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -123,7 +123,7 @@ void unlink_group(Group *group)
#endif
}
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
+ for(psys=ob->particlesystem.first; psys; psys=psys->next) {
if(psys->part->dup_group==group)
psys->part->dup_group= NULL;
#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index bcbce2bc1c2..58c88682d3f 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -263,7 +263,7 @@ int BKE_icon_getid(struct ID* id)
id->icon_id = get_next_free_id();
- if (!id->icon_id){
+ if (!id->icon_id) {
printf("BKE_icon_getid: Internal error - not enough IDs\n");
return 0;
}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 3bcb262fac8..093399832a1 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -489,7 +489,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
- if((loop= IDP_GetPropertyFromGroup(group, prop->name))) {
+ if ((loop= IDP_GetPropertyFromGroup(group, prop->name))) {
BLI_insertlink(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
@@ -506,7 +506,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
or 1 if it succeeded in adding to the group.*/
int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
{
- if(IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
+ if (IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
group->len++;
BLI_addtail(&group->data.group, prop);
return 1;
@@ -517,7 +517,7 @@ int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
- if(IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
+ if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
group->len++;
BLI_insertlink(&group->data.group, previous, pnew);
return 1;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index f848ee3a676..3cc73d7f7f1 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1122,11 +1122,11 @@ int BKE_add_image_extension(char *string, const char imtype)
}
#endif
#ifdef WITH_CINEON
- else if(imtype==R_IMF_IMTYPE_CINEON){
+ else if(imtype==R_IMF_IMTYPE_CINEON) {
if (!BLI_testextensie(string, ".cin"))
extension= ".cin";
}
- else if(imtype==R_IMF_IMTYPE_DPX){
+ else if(imtype==R_IMF_IMTYPE_DPX) {
if (!BLI_testextensie(string, ".dpx"))
extension= ".dpx";
}
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 757d3ddf9ac..f54a885c55e 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -1697,7 +1697,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
while(search)
{
// only handle active springs
- // if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)){}
+ // if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)) {}
cloth_calc_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX, time);
search = search->next;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 8a615b379e8..63c9d799f04 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1329,7 +1329,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
// XXX old animation system! --------------------------------------
{
bActionStrip *strip;
- for (strip=ob->nlastrips.first; strip; strip=strip->next){
+ for (strip=ob->nlastrips.first; strip; strip=strip->next) {
LIBTAG(strip->object);
LIBTAG(strip->act);
LIBTAG(strip->ipo);
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 0f6fedb0b08..4a988f0b278 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -233,13 +233,13 @@ int BKE_mesh_validate_arrays( Mesh *me,
if(remove == FALSE) {
if(mf->v4) {
if(mf->v1 == mf->v2) { PRINT(" face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v3) { PRINT(" face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v4) { PRINT(" face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v3) { PRINT(" face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v4) { PRINT(" face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v2 == mf->v3) { PRINT(" face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
- if(mf->v2 == mf->v4) { PRINT(" face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes; }
+ if(mf->v2 == mf->v3) { PRINT(" face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
+ if(mf->v2 == mf->v4) { PRINT(" face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes; }
- if(mf->v3 == mf->v4) { PRINT(" face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes; }
+ if(mf->v3 == mf->v4) { PRINT(" face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes; }
}
else {
if(mf->v1 == mf->v2) { PRINT(" faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 12f403d028f..a6795ed3a7d 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1073,7 +1073,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
/* loop over tracks, deactivating*/
for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- for (nls= nlt->strips.first; nls; nls= nls->next) {
+ for (nls= nlt->strips.first; nls; nls= nls->next) {
if (nls != strip)
nls->flag &= ~NLASTRIP_FLAG_ACTIVE;
else
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index f1412981935..00a66edc2b4 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -422,7 +422,7 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
{
if (oc->_do_disp_y)
{
- ocr->disp[1] = INTERP(oc->_disp_y) ;
+ ocr->disp[1] = INTERP(oc->_disp_y);
}
if (oc->_do_normals)
{
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 38a73daab2a..fc20ae8d636 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -167,7 +167,7 @@ ParticleSystem *psys_get_current(Object *ob)
ParticleSystem *psys;
if(ob==NULL) return NULL;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
+ for(psys=ob->particlesystem.first; psys; psys=psys->next) {
if(psys->flag & PSYS_CURRENT)
return psys;
}
@@ -219,12 +219,12 @@ Object *psys_get_lattice(ParticleSimulationData *sim)
{
Object *lattice=NULL;
- if(psys_in_edit_mode(sim->scene, sim->psys)==0){
+ if(psys_in_edit_mode(sim->scene, sim->psys)==0) {
ModifierData *md = (ModifierData*)psys_get_modifier(sim->ob, sim->psys);
- for(; md; md=md->next){
- if(md->type==eModifierType_Lattice){
+ for(; md; md=md->next) {
+ if(md->type==eModifierType_Lattice) {
LatticeModifierData *lmd = (LatticeModifierData *)md;
lattice=lmd->object;
break;
@@ -523,7 +523,7 @@ void psys_free_pdd(ParticleSystem *psys)
/* free everything */
void psys_free(Object *ob, ParticleSystem * psys)
{
- if(psys){
+ if(psys) {
int nr = 0;
ParticleSystem * tpsys;
@@ -536,14 +536,14 @@ void psys_free(Object *ob, ParticleSystem * psys)
if(psys->edit && psys->free_edit)
psys->free_edit(psys->edit);
- if(psys->child){
+ if(psys->child) {
MEM_freeN(psys->child);
psys->child = NULL;
psys->totchild = 0;
}
// check if we are last non-visible particle system
- for(tpsys=ob->particlesystem.first; tpsys; tpsys=tpsys->next){
+ for(tpsys=ob->particlesystem.first; tpsys; tpsys=tpsys->next) {
if(tpsys->part)
{
if(ELEM(tpsys->part->ren_as,PART_DRAW_OB,PART_DRAW_GR))
@@ -557,7 +557,7 @@ void psys_free(Object *ob, ParticleSystem * psys)
if(!nr)
ob->transflag &= ~OB_DUPLIPARTS;
- if(psys->part){
+ if(psys->part) {
psys->part->id.us--;
psys->part=NULL;
}
@@ -744,7 +744,7 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
psys_free_path_cache(psys, NULL);
- if(psys->child){
+ if(psys->child) {
MEM_freeN(psys->child);
psys->child= 0;
psys->totchild= 0;
@@ -1029,10 +1029,10 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
interp_v3_v3v3v3v3(result->co, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
- if(velocity){
+ if(velocity) {
float temp[3];
- if(dt>0.999f){
+ if(dt>0.999f) {
key_curve_position_weights(dt-0.001f, t, type);
interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
sub_v3_v3v3(result->vel, result->co, temp);
@@ -1351,7 +1351,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
keytime = (real_t - keys[1].time) / dfra;
/* convert velocity to timestep size */
- if(pind->keyed || pind->cache || point_vel){
+ if(pind->keyed || pind->cache || point_vel) {
invdt = dfra * 0.04f * (psys ? psys->part->timetweak : 1.f);
mul_v3_fl(keys[1].vel, invdt);
mul_v3_fl(keys[2].vel, invdt);
@@ -1424,7 +1424,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
interp_v3_v3v3v3v3(vec, v1, v2, v3, v4, w);
- if(nor){
+ if(nor) {
if(mface->flag & ME_SMOOTH)
interp_v3_v3v3v3v3(nor, n1, n2, n3, n4, w);
else
@@ -1434,7 +1434,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
else {
interp_v3_v3v3v3(vec, v1, v2, v3, w);
- if(nor){
+ if(nor) {
if(mface->flag & ME_SMOOTH)
interp_v3_v3v3v3(nor, n1, n2, n3, w);
else
@@ -1443,8 +1443,8 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
}
/* calculate tangent vectors */
- if(utan && vtan){
- if(tface){
+ if(utan && vtan) {
+ if(tface) {
uv1= tface->uv[0];
uv2= tface->uv[1];
uv3= tface->uv[2];
@@ -1459,7 +1459,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
map_to_sphere( uv4, uv4+1,v4[0], v4[1], v4[2]);
}
- if(v4){
+ if(v4) {
s1= uv3[0] - uv1[0];
s2= uv4[0] - uv1[0];
@@ -1570,7 +1570,7 @@ static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int
if(values==0 || index==-1)
return 0.0;
- switch(from){
+ switch(from) {
case PART_FROM_VERT:
return values[index];
case PART_FROM_FACE:
@@ -1824,10 +1824,10 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
ModifierData *md;
ParticleSystemModifierData *psmd;
- for(md=ob->modifiers.first; md; md=md->next){
- if(md->type==eModifierType_ParticleSystem){
+ for(md=ob->modifiers.first; md; md=md->next) {
+ if(md->type==eModifierType_ParticleSystem) {
psmd= (ParticleSystemModifierData*) md;
- if(psmd->psys==psys){
+ if(psmd->psys==psys) {
return psmd;
}
}
@@ -1842,22 +1842,22 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
{
/* TODO */
float zerovec[3]={0.0f,0.0f,0.0f};
- if(vec){
+ if(vec) {
copy_v3_v3(vec,zerovec);
}
- if(nor){
+ if(nor) {
copy_v3_v3(nor,zerovec);
}
- if(utan){
+ if(utan) {
copy_v3_v3(utan,zerovec);
}
- if(vtan){
+ if(vtan) {
copy_v3_v3(vtan,zerovec);
}
- if(orco){
+ if(orco) {
copy_v3_v3(orco,zerovec);
}
- if(ornor){
+ if(ornor) {
copy_v3_v3(ornor,zerovec);
}
}
@@ -1866,8 +1866,8 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
/************************************************/
void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
- if(psmd){
- if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT){
+ if(psmd) {
+ if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
if(vec)
copy_v3_v3(vec,fuv);
@@ -2007,13 +2007,13 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
inp_y=dot_v3v3(y_vec, vec_one);
inp_z=dot_v3v3(z_vec, vec_one);
- if(inp_y > 0.5f){
+ if(inp_y > 0.5f) {
copy_v3_v3(state_co, y_vec);
mul_v3_fl(y_vec, amplitude*(float)cos(t));
mul_v3_fl(z_vec, amplitude/2.f*(float)sin(2.f*t));
}
- else if(inp_z > 0.0f){
+ else if(inp_z > 0.0f) {
mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f));
madd_v3_v3fl(state_co, y_vec, -0.5f);
@@ -2041,7 +2041,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
shape = 2.f*(float)M_PI * (1.f+shape);
- if(t<shape){
+ if(t<shape) {
shape = t/shape;
shape = (float)sqrt((double)shape);
interp_v3_v3v3(result, result, state_co, shape);
@@ -2064,7 +2064,7 @@ static float do_clump(ParticleKey *state, ParticleKey *par, float time, float cl
{
float clump = 0.f;
- if(par && clumpfac!=0.0f){
+ if(par && clumpfac!=0.0f) {
float cpow;
if(clumppow < 0.0f)
@@ -2208,7 +2208,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
totstrength *= weight;
}
- if(totstrength != 0.0f){
+ if(totstrength != 0.0f) {
if(totstrength > 1.0f)
mul_v3_fl(effect, 1.0f / totstrength);
CLAMP(totstrength, 0.0f, 1.0f);
@@ -2287,7 +2287,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
}
static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec)
{
- if(*cur_length + length > max_length){
+ if(*cur_length + length > max_length) {
mul_v3_fl(dvec, (max_length - *cur_length) / length);
add_v3_v3v3(state->co, (state - 1)->co, dvec);
keys->steps = k;
@@ -2325,12 +2325,12 @@ float *psys_cache_vgroup(DerivedMesh *dm, ParticleSystem *psys, int vgroup)
/* hair dynamics pinning vgroup */
}
- else if(psys->vgroup[vgroup]){
+ else if(psys->vgroup[vgroup]) {
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- if(dvert){
+ if(dvert) {
int totvert=dm->getNumVerts(dm), i;
vg=MEM_callocN(sizeof(float)*totvert, "vg_cache");
- if(psys->vg_neg&(1<<vgroup)){
+ if(psys->vg_neg&(1<<vgroup)) {
for(i=0; i<totvert; i++)
vg[i]= 1.0f - defvert_find_weight(&dvert[i], psys->vgroup[vgroup] - 1);
}
@@ -2357,14 +2357,14 @@ void psys_find_parents(ParticleSimulationData *sim)
tree=BLI_kdtree_new(totparent);
- for(p=0,cpa=sim->psys->child; p<totparent; p++,cpa++){
+ for(p=0,cpa=sim->psys->child; p<totparent; p++,cpa++) {
psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
BLI_kdtree_insert(tree, p, orco, NULL);
}
BLI_kdtree_balance(tree);
- for(; p<totchild; p++,cpa++){
+ for(; p<totchild; p++,cpa++) {
psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
cpa->parent=BLI_kdtree_find_nearest(tree, orco, NULL, NULL);
}
@@ -2426,7 +2426,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
steps = (int)pow(2.0, (double)pset->draw_step);
}
- if(totchild && part->childtype==PART_CHILD_FACES){
+ if(totchild && part->childtype==PART_CHILD_FACES) {
totparent=(int)(totchild*part->parents*0.3f);
if(G.rendering && part->child_nbr && part->ren_child_nbr)
@@ -2479,7 +2479,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
/* set correct ipo timing */
#if 0 // XXX old animation system
- if(part->flag&PART_ABS_TIME && part->ipo){
+ if(part->flag&PART_ABS_TIME && part->ipo) {
calc_ipo(part->ipo, cfra);
execute_ipo((ID *)part, part->ipo);
}
@@ -2509,7 +2509,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
if(!pcache)
return;
- if(ctx->between){
+ if(ctx->between) {
ParticleData *pa = psys->particles + cpa->pa[0];
int w, needupdate;
float foffset, wsum=0.f;
@@ -2638,8 +2638,8 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
/* create the child path */
- for(k=0,child=child_keys; k<=ctx->steps; k++,child++){
- if(ctx->between){
+ for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ if(ctx->between) {
int w=0;
zero_v3(child->co);
@@ -2696,7 +2696,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
}
- for(k=0,child=child_keys; k<=ctx->steps; k++,child++){
+ for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
t = (float)k/(float)ctx->steps;
if(ctx->totparent)
@@ -2720,7 +2720,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
do_child_modifiers(&ctx->sim, &ptex, (ParticleKey *)par, par_rot, cpa, orco, hairmat, (ParticleKey *)child, t);
/* we have to correct velocity because of kink & clump */
- if(k>1){
+ if(k>1) {
sub_v3_v3v3((child-1)->vel, child->co, (child-2)->co);
mul_v3_fl((child-1)->vel, 0.5);
@@ -2732,7 +2732,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
sub_v3_v3v3(child->vel, child->co, (child-1)->co);
/* check if path needs to be cut before actual end of data points */
- if(k){
+ if(k) {
sub_v3_v3v3(dvec, child->co, (child-1)->co);
length = 1.0f/(float)ctx->steps;
k = check_path_length(k, child_keys, child, max_length, &cur_length, length, dvec);
@@ -2763,7 +2763,7 @@ static void *exec_child_path_cache(void *data)
ChildParticle *cpa;
int i, totchild= ctx->totchild, first= 0;
- if(thread->tot > 1){
+ if(thread->tot > 1) {
first= ctx->parent_pass? 0 : ctx->totparent;
totchild= ctx->parent_pass? ctx->totparent : ctx->totchild;
}
@@ -2988,7 +2988,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
dietime = birthtime + pa_length * (dietime - birthtime);
/*--interpolate actual path from data points--*/
- for(k=0, ca=cache[p]; k<=steps; k++, ca++){
+ for(k=0, ca=cache[p]; k<=steps; k++, ca++) {
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
@@ -3062,7 +3062,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
psys->totcached = totpart;
- if(psys->lattice){
+ if(psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
@@ -3125,7 +3125,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/*---first main loop: create all actual particles' paths---*/
- for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++){
+ for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++) {
if(edit->totcached && !(point->flag & PEP_EDIT_RECALC))
continue;
@@ -3142,7 +3142,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* should init_particle_interpolation set this ? */
- if(pset->brushtype==PE_BRUSH_WEIGHT){
+ if(pset->brushtype==PE_BRUSH_WEIGHT) {
pind.hkey[0] = NULL;
/* pa != NULL since the weight brush is only available for hair */
pind.hkey[1] = pa->hair;
@@ -3172,7 +3172,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/*--interpolate actual path from data points--*/
- for(k=0, ca=cache[i]; k<=steps; k++, ca++){
+ for(k=0, ca=cache[i]; k<=steps; k++, ca++) {
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
@@ -3202,7 +3202,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/* selection coloring in edit mode */
- if(pset->brushtype==PE_BRUSH_WEIGHT){
+ if(pset->brushtype==PE_BRUSH_WEIGHT) {
float t2;
if(k==0) {
@@ -3225,8 +3225,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
pind.hkey[0] = pind.hkey[1] - 1;
}
else {
- if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT){
- if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT){
+ if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT) {
+ if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
copy_v3_v3(ca->col, sel_col);
}
else{
@@ -3235,7 +3235,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
}
else{
- if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT){
+ if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
interp_v3_v3v3(ca->col, nosel_col, sel_col, keytime);
}
@@ -3282,7 +3282,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/************************************************/
void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
{
- if(time){
+ if(time) {
memcpy(to,from,sizeof(ParticleKey));
}
else{
@@ -3669,7 +3669,7 @@ void make_local_particlesettings(ParticleSettings *part)
/* test objects */
for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
ParticleSystem *psys=ob->particlesystem.first;
- for(; psys; psys=psys->next){
+ for(; psys; psys=psys->next) {
if(psys->part==part) {
if(ob->id.lib) is_lib= TRUE;
else is_local= TRUE;
@@ -3691,7 +3691,7 @@ void make_local_particlesettings(ParticleSettings *part)
/* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
- for(psys= ob->particlesystem.first; psys; psys=psys->next){
+ for(psys= ob->particlesystem.first; psys; psys=psys->next) {
if(psys->part==part && ob->id.lib==0) {
psys->part= part_new;
part_new->id.us++;
@@ -3763,9 +3763,9 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
ptex->length= 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
ptex->length*= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
- for(m=0; m<MAX_MTEX; m++, mtexp++){
+ for(m=0; m<MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
- if(mtex && mtex->mapto){
+ if(mtex && mtex->mapto) {
float def=mtex->def_var;
short blend=mtex->blendtype;
short texco = mtex->texco;
@@ -3831,9 +3831,9 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
ptex->time = (float)(pa - sim->psys->particles)/(float)sim->psys->totpart;
- for(m=0; m<MAX_MTEX; m++, mtexp++){
+ for(m=0; m<MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
- if(mtex && mtex->mapto){
+ if(mtex && mtex->mapto) {
float def=mtex->def_var;
short blend=mtex->blendtype;
short texco = mtex->texco;
@@ -3869,7 +3869,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
if((event & mtex->mapto) & PAMAP_TIME) {
/* the first time has to set the base value for time regardless of blend mode */
- if((setvars&MAP_PA_TIME)==0){
+ if((setvars&MAP_PA_TIME)==0) {
int flip= (mtex->timefac < 0.0f);
float timefac= fabsf(mtex->timefac);
ptex->time *= 1.0f - timefac;
@@ -3912,10 +3912,10 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra,
ParticleSettings *part = psys->part;
float time, life;
- if(part->childtype==PART_CHILD_FACES){
+ if(part->childtype==PART_CHILD_FACES) {
int w=0;
time=0.0;
- while(w<4 && cpa->pa[w]>=0){
+ while(w<4 && cpa->pa[w]>=0) {
time+=cpa->w[w]*(psys->particles+cpa->pa[w])->time;
w++;
}
@@ -4001,7 +4001,7 @@ static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *pte
/* state is safe to cast, since only co and vel are used */
guided = do_guides(sim->psys->effectors, (ParticleKey*)state, cpa->parent, t);
- if(guided==0){
+ if(guided==0) {
float clump = do_clump(state, par, t, part->clumpfac, part->clumppow, ptex ? ptex->clump : 1.f);
if(kink_freq != 0.f) {
@@ -4054,7 +4054,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
t=state->time;
CLAMP(t, 0.0f, 1.0f);
- if(p<totpart){
+ if(p<totpart) {
/* interpolate pathcache directly if it exist */
if(psys->pathcache) {
ParticleCacheKey result;
@@ -4098,7 +4098,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
}
}
}
- else if(totchild){
+ else if(totchild) {
//invert_m4_m4(imat,ob->obmat);
/* interpolate childcache directly if it exists */
@@ -4115,16 +4115,16 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
if(state->time < 0.0f)
t = psys_get_child_time(psys, cpa, -state->time, NULL, NULL);
- if(totchild && part->childtype==PART_CHILD_FACES){
+ if(totchild && part->childtype==PART_CHILD_FACES) {
/* part->parents could still be 0 so we can't test with totparent */
between=1;
}
- if(between){
+ if(between) {
int w = 0;
float foffset;
/* get parent states */
- while(w<4 && cpa->pa[w]>=0){
+ while(w<4 && cpa->pa[w]>=0) {
keys[w].time = state->time;
psys_get_particle_on_path(sim, cpa->pa[w], keys+w, 1);
w++;
@@ -4179,7 +4179,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* correct child ipo timing */
#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
+ if((part->flag&PART_ABS_TIME)==0 && part->ipo) {
calc_ipo(part->ipo, 100.0f*t);
execute_ipo((ID *)part, part->ipo);
}
@@ -4193,14 +4193,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* TODO: assign vertex groups */
get_child_modifier_parameters(part, &ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex);
- if(between){
+ if(between) {
int w=0;
state->co[0] = state->co[1] = state->co[2] = 0.0f;
state->vel[0] = state->vel[1] = state->vel[2] = 0.0f;
/* child position is the weighted sum of parent positions */
- while(w<4 && cpa->pa[w]>=0){
+ while(w<4 && cpa->pa[w]>=0) {
state->co[0] += cpa->w[w] * keys[w].co[0];
state->co[1] += cpa->w[w] * keys[w].co[1];
state->co[2] += cpa->w[w] * keys[w].co[2];
@@ -4227,11 +4227,11 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
do_child_modifiers(sim, &ptex, par, par->rot, cpa, orco, hairmat, state, t);
/* try to estimate correct velocity */
- if(vel){
+ if(vel) {
ParticleKey tstate;
float length = len_v3(state->vel);
- if(t>=0.001f){
+ if(t>=0.001f) {
tstate.time=t-0.001f;
psys_get_particle_on_path(sim,p,&tstate,0);
sub_v3_v3v3(state->vel,state->co,tstate.co);
@@ -4263,11 +4263,11 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
/* negative time means "use current time" */
cfra = state->time > 0 ? state->time : BKE_curframe(sim->scene);
- if(p>=totpart){
+ if(p>=totpart) {
if(!psys->totchild)
return 0;
- if(part->childtype == PART_CHILD_FACES){
+ if(part->childtype == PART_CHILD_FACES) {
if(!(psys->flag & PSYS_KEYED))
return 0;
@@ -4303,13 +4303,13 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
cfra = MIN2(cfra, pa->dietime);
}
- if(sim->psys->flag & PSYS_KEYED){
+ if(sim->psys->flag & PSYS_KEYED) {
state->time= -cfra;
psys_get_particle_on_path(sim, p, state,1);
return 1;
}
else{
- if(cpa){
+ if(cpa) {
float mat[4][4];
ParticleKey *key1;
float t = (cfra - pa->time) / pa->lifetime;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 8d12460b71b..206d9036ba7 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -306,7 +306,7 @@ static int get_psys_tot_child(struct Scene *scene, ParticleSystem *psys)
static void alloc_child_particles(ParticleSystem *psys, int tot)
{
- if(psys->child){
+ if(psys->child) {
/* only re-allocate if we have to */
if(psys->part->childtype && psys->totchild == tot) {
memset(psys->child, 0, tot*sizeof(ChildParticle));
@@ -415,13 +415,13 @@ static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *fi
alloc_child_particles(psys, totpart);
cpa = psys->child;
- for(i=0; i<child_nbr; i++){
- for(p=0; p<psys->totpart; p++,cpa++){
+ for(i=0; i<child_nbr; i++) {
+ for(p=0; p<psys->totpart; p++,cpa++) {
float length=2.0;
cpa->parent=p;
/* create even spherical distribution inside unit sphere */
- while(length>=1.0f){
+ while(length>=1.0f) {
cpa->fuv[0]=2.0f*BLI_frand()-1.0f;
cpa->fuv[1]=2.0f*BLI_frand()-1.0f;
cpa->fuv[2]=2.0f*BLI_frand()-1.0f;
@@ -449,7 +449,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
copy_v3_v3(max, mv->co);
mv++;
- for(i=1; i<totvert; i++, mv++){
+ for(i=1; i<totvert; i++, mv++) {
min[0]=MIN2(min[0],mv->co[0]);
min[1]=MIN2(min[1],mv->co[1]);
min[2]=MIN2(min[2],mv->co[2]);
@@ -483,9 +483,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1]+= d < delta[1] ? d/2.f : delta[1]/2.f;
min[2]+= d < delta[2] ? d/2.f : delta[2]/2.f;
- for(i=0,p=0,pa=psys->particles; i<res; i++){
- for(j=0; j<res; j++){
- for(k=0; k<res; k++,p++,pa++){
+ for(i=0,p=0,pa=psys->particles; i<res; i++) {
+ for(j=0; j<res; j++) {
+ for(k=0; k<res; k++,p++,pa++) {
pa->fuv[0] = min[0] + (float)i*d;
pa->fuv[1] = min[1] + (float)j*d;
pa->fuv[2] = min[2] + (float)k*d;
@@ -496,7 +496,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
/* enable particles near verts/edges/faces/inside surface */
- if(from==PART_FROM_VERT){
+ if(from==PART_FROM_VERT) {
float vec[3];
pa=psys->particles;
@@ -505,7 +505,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1] -= d/2.0f;
min[2] -= d/2.0f;
- for(i=0,mv=mvert; i<totvert; i++,mv++){
+ for(i=0,mv=mvert; i<totvert; i++,mv++) {
sub_v3_v3v3(vec,mv->co,min);
vec[0]/=delta[0];
vec[1]/=delta[1];
@@ -515,7 +515,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
+(int)(vec[2]*(size[2]-1)))->flag &= ~PARS_UNEXIST;
}
}
- else if(ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)){
+ else if(ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
float co1[3], co2[3];
MFace *mface= NULL, *mface_array;
@@ -526,13 +526,13 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
totface=dm->getNumTessFaces(dm);
mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
- for(a=0; a<amax; a++){
- if(a==0){ a0mul=res*res; a1mul=res; a2mul=1; }
- else if(a==1){ a0mul=res; a1mul=1; a2mul=res*res; }
+ for(a=0; a<amax; a++) {
+ if(a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
+ else if(a==1) { a0mul=res; a1mul=1; a2mul=res*res; }
else{ a0mul=1; a1mul=res*res; a2mul=res; }
- for(a1=0; a1<size[(a+1)%3]; a1++){
- for(a2=0; a2<size[(a+2)%3]; a2++){
+ for(a1=0; a1<size[(a+1)%3]; a1++) {
+ for(a2=0; a2<size[(a+2)%3]; a2++) {
mface= mface_array;
pa = psys->particles + a1*a1mul + a2*a2mul;
@@ -543,22 +543,22 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
co1[a] -= 0.001f*d;
/* lets intersect the faces */
- for(i=0; i<totface; i++,mface++){
+ for(i=0; i<totface; i++,mface++) {
copy_v3_v3(v1, mvert[mface->v1].co);
copy_v3_v3(v2, mvert[mface->v2].co);
copy_v3_v3(v3, mvert[mface->v3].co);
- if(isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)){
+ if(isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
if(from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else /* store number of intersections */
(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
}
- if(mface->v4){
+ if(mface->v4) {
copy_v3_v3(v4, mvert[mface->v4].co);
- if(isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)){
+ if(isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
if(from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else
@@ -567,10 +567,10 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
}
- if(from==PART_FROM_VOLUME){
+ if(from==PART_FROM_VOLUME) {
int in=pa->hair_index%2;
if(in) pa->hair_index++;
- for(i=0; i<size[0]; i++){
+ for(i=0; i<size[0]; i++) {
if(in || (pa+i*a0mul)->hair_index%2)
(pa+i*a0mul)->flag &= ~PARS_UNEXIST;
/* odd intersections == in->out / out->in */
@@ -584,9 +584,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
if(psys->part->flag & PART_GRID_HEXAGONAL) {
- for(i=0,p=0,pa=psys->particles; i<res; i++){
- for(j=0; j<res; j++){
- for(k=0; k<res; k++,p++,pa++){
+ for(i=0,p=0,pa=psys->particles; i<res; i++) {
+ for(j=0; j<res; j++) {
+ for(k=0; k<res; k++,p++,pa++) {
if(j%2)
pa->fuv[0] += d/2.f;
@@ -599,11 +599,11 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
}
- if(psys->part->flag & PART_GRID_INVERT){
- for(i=0; i<size[0]; i++){
- for(j=0; j<size[1]; j++){
+ if(psys->part->flag & PART_GRID_INVERT) {
+ for(i=0; i<size[0]; i++) {
+ for(j=0; j<size[1]; j++) {
pa=psys->particles + res*(i*res + j);
- for(k=0; k<size[2]; k++, pa++){
+ for(k=0; k<size[2]; k++, pa++) {
pa->flag ^= PARS_UNEXIST;
}
}
@@ -612,7 +612,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
if(psys->part->grid_rand > 0.f) {
float rfac = d * psys->part->grid_rand;
- for(p=0,pa=psys->particles; p<psys->totpart; p++,pa++){
+ for(p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
if(pa->flag & PARS_UNEXIST)
continue;
@@ -765,7 +765,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
pa->fuv[1] = pa->fuv[2] = pa->fuv[3] = 0.0;
#if ONLY_WORKING_WITH_PA_VERTS
- if(ctx->tree){
+ if(ctx->tree) {
KDTreeNearest ptn[3];
int w, maxw;
@@ -773,7 +773,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
- for(w=0; w<maxw; w++){
+ for(w=0; w<maxw; w++) {
pa->verts[w]=ptn->num;
}
}
@@ -785,7 +785,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
pa->num = i = ctx->index[p];
mface = dm->getTessFaceData(dm,i,CD_MFACE);
- switch(distr){
+ switch(distr) {
case PART_DISTR_JIT:
if(ctx->jitlevel == 1) {
if(mface->v4)
@@ -810,7 +810,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
pa->foffset= 0.0f;
/* experimental */
- if(from==PART_FROM_VOLUME){
+ if(from==PART_FROM_VOLUME) {
MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
tot=dm->getNumTessFaces(dm);
@@ -825,25 +825,25 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
min_d=2.0;
intersect=0;
- for(i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++){
+ for(i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
if(i==pa->num) continue;
v1=mvert[mface->v1].co;
v2=mvert[mface->v2].co;
v3=mvert[mface->v3].co;
- if(isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)){
- if(cur_d<min_d){
+ if(isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)) {
+ if(cur_d<min_d) {
min_d=cur_d;
pa->foffset=cur_d*50.0f; /* to the middle of volume */
intersect=1;
}
}
- if(mface->v4){
+ if(mface->v4) {
v4=mvert[mface->v4].co;
- if(isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)){
- if(cur_d<min_d){
+ if(isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)) {
+ if(cur_d<min_d) {
min_d=cur_d;
pa->foffset=cur_d*50.0f; /* to the middle of volume */
intersect=1;
@@ -853,7 +853,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
if(intersect==0)
pa->foffset=0.0;
- else switch(distr){
+ else switch(distr) {
case PART_DISTR_JIT:
pa->foffset*= ctx->jit[p%(2*ctx->jitlevel)];
break;
@@ -883,7 +883,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
cpa->num = ctx->index[p];
- if(ctx->tree){
+ if(ctx->tree) {
KDTreeNearest ptn[10];
int w,maxw;//, do_seams;
float maxd /*, mind,dd */, totw= 0.0f;
@@ -898,24 +898,24 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
/* mind=ptn[0].dist; */ /* UNUSED */
/* the weights here could be done better */
- for(w=0; w<maxw; w++){
+ for(w=0; w<maxw; w++) {
parent[w]=ptn[w].index;
pweight[w]=(float)pow(2.0,(double)(-6.0f*ptn[w].dist/maxd));
}
- for(;w<10; w++){
+ for(;w<10; w++) {
parent[w]=-1;
pweight[w]=0.0f;
}
- for(w=0,i=0; w<maxw && i<4; w++){
- if(parent[w]>=0){
+ for(w=0,i=0; w<maxw && i<4; w++) {
+ if(parent[w]>=0) {
cpa->pa[i]=parent[w];
cpa->w[i]=pweight[w];
totw+=pweight[w];
i++;
}
}
- for(;i<4; i++){
+ for(;i<4; i++) {
cpa->pa[i]=-1;
cpa->w[i]=0.0f;
}
@@ -993,7 +993,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
int p, totchild = get_psys_tot_child(scene, psys);
if(psys->child && totchild) {
- for(p=0,cpa=psys->child; p<totchild; p++,cpa++){
+ for(p=0,cpa=psys->child; p<totchild; p++,cpa++) {
cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
cpa->foffset= 0.0f;
cpa->parent=0;
@@ -1057,7 +1057,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
else {
/* Grid distribution */
- if(part->distr==PART_DISTR_GRID && from != PART_FROM_VERT){
+ if(part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
BLI_srandom(31415926 + psys->seed);
dm= CDDM_from_mesh((Mesh*)ob->data, ob);
distribute_grid(dm,psys);
@@ -1079,7 +1079,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
tree=BLI_kdtree_new(totpart);
- for(p=0,pa=psys->particles; p<totpart; p++,pa++){
+ for(p=0,pa=psys->particles; p<totpart; p++,pa++) {
psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1);
BLI_kdtree_insert(tree, p, orco, ornor);
@@ -1128,7 +1128,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* Get total number of emission elements and allocate needed arrays */
totelem = (from == PART_FROM_VERT) ? dm->getNumVerts(dm) : dm->getNumTessFaces(dm);
- if(totelem == 0){
+ if(totelem == 0) {
distribute_invalid(scene, psys, children ? PART_FROM_CHILD : 0);
if(G.f & G_DEBUG)
@@ -1147,14 +1147,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
jitter_offset = MEM_callocN(sizeof(float)*totelem, "particle_distribution_jitoff");
/* Calculate weights from face areas */
- if((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT){
+ if((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT) {
MVert *v1, *v2, *v3, *v4;
float totarea=0.f, co1[3], co2[3], co3[3], co4[3];
float (*orcodata)[3];
orcodata= dm->getVertDataArray(dm, CD_ORCO);
- for(i=0; i<totelem; i++){
+ for(i=0; i<totelem; i++) {
MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
if(orcodata) {
@@ -1206,13 +1206,13 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
/* Calculate weights from vgroup */
vweight = psys_cache_vgroup(dm,psys,PSYS_VG_DENSITY);
- if(vweight){
+ if(vweight) {
if(from==PART_FROM_VERT) {
for(i=0;i<totelem; i++)
element_weight[i]*=vweight[i];
}
else { /* PART_FROM_FACE / PART_FROM_VOLUME */
- for(i=0;i<totelem; i++){
+ for(i=0;i<totelem; i++) {
MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
@@ -1402,7 +1402,7 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
PARTICLE_PSMD;
int distr_error=0;
- if(psmd){
+ if(psmd) {
if(psmd->dm)
distribute_particles_on_dm(sim, from);
else
@@ -1411,7 +1411,7 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
else
distribute_particles_on_shape(sim, from);
- if(distr_error){
+ if(distr_error) {
distribute_invalid(sim->scene, sim->psys, from);
fprintf(stderr,"Particle distribution error!\n");
@@ -1467,7 +1467,7 @@ void psys_threads_free(ParticleThread *threads)
if(ctx->vg_roughe)
MEM_freeN(ctx->vg_roughe);
- if(ctx->sim.psys->lattice){
+ if(ctx->sim.psys->lattice) {
end_latt_deform(ctx->sim.psys->lattice);
ctx->sim.psys->lattice= NULL;
}
@@ -1602,7 +1602,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
normalize_v3(nor);
/* -tangent */
- if(part->tanfac!=0.0f){
+ if(part->tanfac!=0.0f) {
//float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
float phase=0.0f;
mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase)));
@@ -1620,7 +1620,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -velocity (boids need this even if there's no random velocity) */
- if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){
+ if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) {
r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f);
r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f);
@@ -1630,7 +1630,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
}
/* -angular velocity */
- if(part->avemode==PART_AVE_RAND){
+ if(part->avemode==PART_AVE_RAND) {
r_ave[0] = 2.0f * (PSYS_FRAND(p + 13) - 0.5f);
r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f);
r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f);
@@ -1640,7 +1640,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
}
/* -rotation */
- if(part->randrotfac != 0.0f){
+ if(part->randrotfac != 0.0f) {
r_rot[0] = 2.0f * (PSYS_FRAND(p + 16) - 0.5f);
r_rot[1] = 2.0f * (PSYS_FRAND(p + 17) - 0.5f);
r_rot[2] = 2.0f * (PSYS_FRAND(p + 18) - 0.5f);
@@ -1685,12 +1685,12 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -velocity from: */
/* *reactions */
- if(dtime > 0.f){
+ if(dtime > 0.f) {
sub_v3_v3v3(vel, pa->state.vel, pa->prev_state.vel);
}
/* *emitter velocity */
- if(dtime != 0.f && part->obfac != 0.f){
+ if(dtime != 0.f && part->obfac != 0.f) {
sub_v3_v3v3(vel, loc, state->co);
mul_v3_fl(vel, part->obfac/dtime);
}
@@ -1736,9 +1736,9 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -rotation */
unit_qt(state->rot);
- if(part->rotmode){
+ if(part->rotmode) {
/* create vector into which rotation is aligned */
- switch(part->rotmode){
+ switch(part->rotmode) {
case PART_ROT_NOR:
copy_v3_v3(rot_vec, nor);
break;
@@ -1781,8 +1781,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
zero_v3(state->ave);
- if(part->avemode){
- switch(part->avemode){
+ if(part->avemode) {
+ switch(part->avemode) {
case PART_AVE_SPIN:
copy_v3_v3(state->ave, vel);
break;
@@ -1835,7 +1835,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
}
- if(part->type == PART_HAIR){
+ if(part->type == PART_HAIR) {
pa->lifetime = 100.0f;
}
else{
@@ -1966,7 +1966,7 @@ static void set_keyed_keys(ParticleSimulationData *sim)
psys_get_particle_state(&ksim, p%ksim.psys->totpart, key, 1);
- if(psys->flag & PSYS_KEYED_TIMING){
+ if(psys->flag & PSYS_KEYED_TIMING) {
key->time = pa->time + pt->time;
if(pt->duration != 0.0f && k+1 < totkeys) {
copy_particle_key(key+1, key, 1);
@@ -2099,7 +2099,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
if(pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
integrator = PART_INT_EULER;
- switch(integrator){
+ switch(integrator) {
case PART_INT_EULER:
steps=1;
break;
@@ -2118,7 +2118,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
states->time = 0.f;
- for(i=0; i<steps; i++){
+ for(i=0; i<steps; i++) {
zero_v3(force);
zero_v3(impulse);
@@ -2133,13 +2133,13 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
/* calculate next state */
add_v3_v3(states[i].vel, impulse);
- switch(integrator){
+ switch(integrator) {
case PART_INT_EULER:
madd_v3_v3v3fl(pa->state.co, states->co, states->vel, dtime);
madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
break;
case PART_INT_MIDPOINT:
- if(i==0){
+ if(i==0) {
madd_v3_v3v3fl(states[1].co, states->co, states->vel, dtime*0.5f);
madd_v3_v3v3fl(states[1].vel, states->vel, acceleration, dtime*0.5f);
states[1].time = dtime*0.5f;
@@ -2151,7 +2151,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
}
break;
case PART_INT_RK4:
- switch(i){
+ switch(i) {
case 0:
copy_v3_v3(dx[0], states->vel);
mul_v3_fl(dx[0], dtime);
@@ -2252,7 +2252,7 @@ static void sph_spring_delete(ParticleSystem *psys, int j)
psys->tot_fluidsprings--;
- if (psys->tot_fluidsprings < psys->alloc_fluidsprings/2 && psys->alloc_fluidsprings > PSYS_FLUID_SPRINGS_INITIAL_SIZE){
+ if (psys->tot_fluidsprings < psys->alloc_fluidsprings/2 && psys->alloc_fluidsprings > PSYS_FLUID_SPRINGS_INITIAL_SIZE) {
psys->alloc_fluidsprings /= 2;
psys->fluid_springs = (ParticleSpring*)MEM_reallocN(psys->fluid_springs, psys->alloc_fluidsprings * sizeof(ParticleSpring));
}
@@ -2508,7 +2508,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
madd_v3_v3fl(force, vec, -10.f * spring_constant * (1.f - rij/h) * (spring->rest_length - rij));
}
- else if(fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames){
+ else if(fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames) {
ParticleSpring temp_spring;
temp_spring.particle_index[0] = index;
temp_spring.particle_index[1] = pfn->index;
@@ -2621,7 +2621,7 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo
madd_v3_v3fl(force, state->vel, -part->dragfac * pa->size * pa->size * len_v3(state->vel));
/* brownian force */
- if(part->brownfac != 0.0f){
+ if(part->brownfac != 0.0f) {
force[0] += (BLI_frand()-0.5f) * part->brownfac;
force[1] += (BLI_frand()-0.5f) * part->brownfac;
force[2] += (BLI_frand()-0.5f) * part->brownfac;
@@ -2684,8 +2684,8 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
{
float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep;
- if((part->flag & PART_ROT_DYN)==0){
- if(part->avemode==PART_AVE_SPIN){
+ if((part->flag & PART_ROT_DYN)==0) {
+ if(part->avemode==PART_AVE_SPIN) {
float angle;
float len1 = len_v3(pa->prev_state.vel);
float len2 = len_v3(pa->state.vel);
@@ -2704,7 +2704,7 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
}
rotfac=len_v3(pa->state.ave);
- if(rotfac == 0.0f){ /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
+ if(rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
rot1[0]=1.0f;
rot1[1]=rot1[2]=rot1[3]=0;
}
@@ -3145,7 +3145,7 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
if(hit->dist == 0.0f)
hit->dist = col->original_ray_length = 0.000001f;
- for(coll = colliders->first; coll; coll=coll->next){
+ for(coll = colliders->first; coll; coll=coll->next) {
/* for boids: don't check with current ground object */
if(coll->ob == col->skip)
continue;
@@ -3400,7 +3400,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
}
/* 10 iterations to catch multiple collisions */
- while(collision_count < COLLISION_MAX_COLLISIONS){
+ while(collision_count < COLLISION_MAX_COLLISIONS) {
if(collision_detect(pa, &col, &hit, sim->colliders)) {
collision_count++;
@@ -3432,7 +3432,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
distr=1;
- if(distr){
+ if(distr) {
if(alloc)
realloc_particles(sim, sim->psys->totpart);
@@ -3830,18 +3830,18 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* store this, so we can do multiple loops over particles */
pa->state.time = dfra;
- if(dietime <= cfra && psys->cfra < dietime){
+ if(dietime <= cfra && psys->cfra < dietime) {
/* particle dies some time between this and last step */
pa->state.time = dietime - ((birthtime > psys->cfra) ? birthtime : psys->cfra);
pa->alive = PARS_DYING;
}
- else if(birthtime <= cfra && birthtime >= psys->cfra){
+ else if(birthtime <= cfra && birthtime >= psys->cfra) {
/* particle is born some time between this and last step*/
reset_particle(sim, pa, dfra*timestep, cfra);
pa->alive = PARS_ALIVE;
pa->state.time = cfra - birthtime;
}
- else if(dietime < cfra){
+ else if(dietime < cfra) {
/* nothing to be done when particle is dead */
}
@@ -3923,7 +3923,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* finalize particle state and time after dynamics */
LOOP_DYNAMIC_PARTICLES {
- if(pa->alive == PARS_DYING){
+ if(pa->alive == PARS_DYING) {
pa->alive=PARS_DEAD;
pa->state.time=pa->dietime;
}
@@ -3982,7 +3982,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
else
pa->alive = PARS_ALIVE;
- if(psys->lattice){
+ if(psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
@@ -3997,7 +3997,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
{
ParticleSystem *psys = sim->psys;
- if(psys->particles){
+ if(psys->particles) {
MEM_freeN(psys->particles);
psys->particles = 0;
psys->totpart = 0;
@@ -4263,7 +4263,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
update_children(sim);
/* cleanup */
- if(psys->lattice){
+ if(psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
@@ -4322,7 +4322,7 @@ void psys_check_boid_data(ParticleSystem *psys)
pa->boid = bpa++;
}
}
- else if(pa->boid){
+ else if(pa->boid) {
MEM_freeN(pa->boid);
LOOP_PARTICLES
pa->boid = NULL;
@@ -4466,7 +4466,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
/* first step is negative so particles get killed and reset */
psys->cfra= 1.0f;
- for(i=0; i<=part->hair_step; i++){
+ for(i=0; i<=part->hair_step; i++) {
hcfra=100.0f*(float)i/(float)psys->part->hair_step;
if((part->flag & PART_HAIR_REGROW)==0)
BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index bf9ed8b17e3..705f198865a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -275,7 +275,7 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
if(cfra > pa->state.time)
memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey));
- if(old_data){
+ if(old_data) {
/* old format cache */
memcpy(&pa->state, old_data, sizeof(ParticleKey));
return;
@@ -3015,7 +3015,7 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
PointCache *cache = pid->cache;
int last_exact = cache->last_exact;
- if (!G.relbase_valid){
+ if (!G.relbase_valid) {
cache->flag &= ~PTCACHE_DISK_CACHE;
if (G.f & G_DEBUG)
printf("File must be saved before using disk cache!\n");
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index d88a5c26c2c..aebdf3cef65 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -495,7 +495,7 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
/* rt = rt1 over rt2 (alpha from rt1) */
fac= fac2;
- mfac= 1.0f - (fac2*rt1[3]) ;
+ mfac= 1.0f - (fac2 * rt1[3]);
if(fac <= 0.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
@@ -906,9 +906,9 @@ static void makeGammaTables(float gamma)
/* multiplication factors used in scaling the interpolation. */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++ ) {
gamfactor_table[i] = inv_color_step
- * (gamma_range_table[i + 1] - gamma_range_table[i]) ;
+ * (gamma_range_table[i + 1] - gamma_range_table[i]);
inv_gamfactor_table[i] = inv_color_step
- * (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]) ;
+ * (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
}
} /* end of void makeGammaTables(float gamma) */
@@ -971,7 +971,7 @@ static void gamtabs(float gamma)
else if(gamma==1.0f) igamtab1[a-1]= 256*a-1;
else {
val= a/256.0f;
- igamtab1[a-1]= (65535.0*pow(val, gamma)) -1 ;
+ igamtab1[a - 1]= (65535.0 * pow(val, gamma)) - 1;
}
}
@@ -1631,7 +1631,7 @@ float hyp3,hyp4,b4,b5
if(wipezone->flip) x = xo - x;
angle = wipezone->angle;
- if(wipe->forward){
+ if(wipe->forward) {
posx = facf0 * xo;
posy = facf0 * yo;
} else{
@@ -1699,9 +1699,9 @@ float hyp3,hyp4,b4,b5
hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
- if(b2 < b1 && b2 < b3 ){
+ if(b2 < b1 && b2 < b3 ) {
output = in_band(hwidth,hyp,0,1);
- } else if(b2 > b1 && b2 > b3 ){
+ } else if(b2 > b1 && b2 > b3 ) {
output = in_band(hwidth,hyp2,0,1);
} else {
if( hyp < hwidth && hyp2 > hwidth )
@@ -1724,7 +1724,7 @@ float hyp3,hyp4,b4,b5
widthf = wipe->edgeWidth*2.0f*(float)M_PI;
temp1 = 2.0f * (float)M_PI * facf0;
- if(wipe->forward){
+ if(wipe->forward) {
temp1 = 2.0f*(float)M_PI - temp1;
}
@@ -1736,7 +1736,7 @@ float hyp3,hyp4,b4,b5
else if(x<=0 && y <= 0) temp2 += (float)M_PI;
else if(x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
- if(wipe->forward){
+ if(wipe->forward) {
temp3 = temp1-(widthf*0.5f)*facf0;
temp4 = temp1+(widthf*0.5f)*(1-facf0);
} else{
@@ -1775,10 +1775,10 @@ float hyp3,hyp4,b4,b5
temp2 = yo*(1-facf0/2)-yo*facf0/2;
pointdist = sqrt(temp1*temp1 + temp2*temp2);
- if(b2 < b1 && b2 < b3 ){
+ if(b2 < b1 && b2 < b3 ) {
if(hwidth < pointdist)
output = in_band(wipezone,hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ){
+ } else if(b2 > b1 && b2 > b3 ) {
if(hwidth < pointdist)
output = in_band(wipezone,hwidth,hyp2,facf0,0,1);
} else {
@@ -1799,10 +1799,10 @@ float hyp3,hyp4,b4,b5
hyp = abs(angle*x+y+(-posy/2-angle*posx/2))*wipezone->pythangle;
hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))*wipezone->pythangle;
- if(b2 < b1 && b2 < b3 ){
+ if(b2 < b1 && b2 < b3 ) {
if(hwidth < pointdist)
output *= in_band(wipezone,hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ){
+ } else if(b2 > b1 && b2 > b3 ) {
if(hwidth < pointdist)
output *= in_band(wipezone,hwidth,hyp2,facf0,0,1);
} else {
@@ -1911,10 +1911,10 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
}
rt+=4;
- if(rt1 !=NULL){
+ if(rt1 !=NULL) {
rt1+=4;
}
- if(rt2 !=NULL){
+ if(rt2 !=NULL) {
rt2+=4;
}
}
@@ -1969,10 +1969,10 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
}
rt+=4;
- if(rt1 !=NULL){
+ if(rt1 !=NULL) {
rt1+=4;
}
- if(rt2 !=NULL){
+ if(rt2 !=NULL) {
rt2+=4;
}
}
@@ -2107,7 +2107,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
}
// Translate
- if(!transform->percent){
+ if(!transform->percent) {
float rd_s = (scene->r.size/100.0f);
translate_x = transform->xIni*rd_s+(x/2.0f);
@@ -2173,7 +2173,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
/* Allocate memory for the filter elements */
halfWidth = ((quality+1)*blur);
filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
- if (!filter){
+ if (!filter) {
MEM_freeN (temp);
return;
}
@@ -2185,7 +2185,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
/* Blancmange (bmange@airdmhor.gen.nz) */
k = -1.0f/(2.0f*(float)M_PI*blur*blur);
- for (ix = 0;ix< halfWidth;ix++){
+ for (ix = 0;ix< halfWidth;ix++) {
weight = (float)exp(k*(ix*ix));
filter[halfWidth - ix] = weight;
filter[halfWidth + ix] = weight;
@@ -2201,16 +2201,16 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
filter[ix]/=fval;
/* Blur the rows */
- for (y=0;y<height;y++){
+ for (y=0;y<height;y++) {
/* Do the left & right strips */
- for (x=0;x<halfWidth;x++){
+ for (x=0;x<halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
curColor[0]=curColor[1]=curColor[2]=0;
curColor2[0]=curColor2[1]=curColor2[2]=0;
- for (i=x-halfWidth;i<x+halfWidth;i++){
- if ((i>=0)&&(i<width)){
+ for (i=x-halfWidth;i<x+halfWidth;i++) {
+ if ((i>=0)&&(i<width)) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2234,11 +2234,11 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
}
/* Do the main body */
- for (x=halfWidth;x<width-halfWidth;x++){
+ for (x=halfWidth;x<width-halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
curColor[0]=curColor[1]=curColor[2]=0;
- for (i=x-halfWidth;i<x+halfWidth;i++){
+ for (i=x-halfWidth;i<x+halfWidth;i++) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2255,15 +2255,15 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
/* Blur the columns */
- for (x=0;x<width;x++){
+ for (x=0;x<width;x++) {
/* Do the top & bottom strips */
- for (y=0;y<halfWidth;y++){
+ for (y=0;y<halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
curColor[0]=curColor[1]=curColor[2]=0;
curColor2[0]=curColor2[1]=curColor2[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- if ((i>=0)&&(i<height)){
+ for (i=y-halfWidth;i<y+halfWidth;i++) {
+ if ((i>=0)&&(i<height)) {
/* Bottom */
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2287,11 +2287,11 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
}
/* Do the main body */
- for (y=halfWidth;y<height-halfWidth;y++){
+ for (y=halfWidth;y<height-halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
curColor[0]=curColor[1]=curColor[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
+ for (i=y-halfWidth;i<y+halfWidth;i++) {
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
@@ -2342,7 +2342,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
/* Allocate memory for the filter elements */
halfWidth = ((quality+1)*blur);
filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
- if (!filter){
+ if (!filter) {
MEM_freeN (temp);
return;
}
@@ -2355,7 +2355,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
k = -1.0f/(2.0f*(float)M_PI*blur*blur);
- for (ix = 0;ix< halfWidth;ix++){
+ for (ix = 0;ix< halfWidth;ix++) {
weight = (float)exp(k*(ix*ix));
filter[halfWidth - ix] = weight;
filter[halfWidth + ix] = weight;
@@ -2371,16 +2371,16 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
filter[ix]/=fval;
/* Blur the rows */
- for (y=0;y<height;y++){
+ for (y=0;y<height;y++) {
/* Do the left & right strips */
- for (x=0;x<halfWidth;x++){
+ for (x=0;x<halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
curColor[0]=curColor[1]=curColor[2]=0.0f;
curColor2[0]=curColor2[1]=curColor2[2]=0.0f;
- for (i=x-halfWidth;i<x+halfWidth;i++){
- if ((i>=0)&&(i<width)){
+ for (i=x-halfWidth;i<x+halfWidth;i++) {
+ if ((i>=0)&&(i<width)) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2404,11 +2404,11 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
}
/* Do the main body */
- for (x=halfWidth;x<width-halfWidth;x++){
+ for (x=halfWidth;x<width-halfWidth;x++) {
index=(x+y*width)*4;
fx=0;
curColor[0]=curColor[1]=curColor[2]=0;
- for (i=x-halfWidth;i<x+halfWidth;i++){
+ for (i=x-halfWidth;i<x+halfWidth;i++) {
curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2425,15 +2425,15 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
/* Blur the columns */
- for (x=0;x<width;x++){
+ for (x=0;x<width;x++) {
/* Do the top & bottom strips */
- for (y=0;y<halfWidth;y++){
+ for (y=0;y<halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
curColor[0]=curColor[1]=curColor[2]=0;
curColor2[0]=curColor2[1]=curColor2[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- if ((i>=0)&&(i<height)){
+ for (i=y-halfWidth;i<y+halfWidth;i++) {
+ if ((i>=0)&&(i<height)) {
/* Bottom */
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2457,11 +2457,11 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
}
/* Do the main body */
- for (y=halfWidth;y<height-halfWidth;y++){
+ for (y=halfWidth;y<height-halfWidth;y++) {
index=(x+y*width)*4;
fy=0;
curColor[0]=curColor[1]=curColor[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
+ for (i=y-halfWidth;i<y+halfWidth;i++) {
curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
@@ -2491,8 +2491,8 @@ static void RVAddBitmaps_byte (unsigned char* a, unsigned char* b, unsigned char
{
int x,y,index;
- for (y=0;y<height;y++){
- for (x=0;x<width;x++){
+ for (y=0;y<height;y++) {
+ for (x=0;x<width;x++) {
index=(x+y*width)*4;
c[index+GlowR]=MIN2(255,a[index+GlowR]+b[index+GlowR]);
c[index+GlowG]=MIN2(255,a[index+GlowG]+b[index+GlowG]);
@@ -2507,8 +2507,8 @@ static void RVAddBitmaps_float (float* a, float* b, float* c,
{
int x,y,index;
- for (y=0;y<height;y++){
- for (x=0;x<width;x++){
+ for (y=0;y<height;y++) {
+ for (x=0;x<width;x++) {
index=(x+y*width)*4;
c[index+GlowR]= MIN2(1.0f, a[index+GlowR]+b[index+GlowR]);
c[index+GlowG]= MIN2(1.0f, a[index+GlowG]+b[index+GlowG]);
@@ -2534,7 +2534,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
/* Isolate the intensity */
intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
- if (intensity>0){
+ if (intensity>0) {
out[index+GlowR]=MIN2(255*clamp, (in[index+GlowR]*boost*intensity)/255);
out[index+GlowG]=MIN2(255*clamp, (in[index+GlowG]*boost*intensity)/255);
out[index+GlowB]=MIN2(255*clamp, (in[index+GlowB]*boost*intensity)/255);
@@ -2563,7 +2563,7 @@ static void RVIsolateHighlights_float (float* in, float* out,
/* Isolate the intensity */
intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
- if (intensity>0){
+ if (intensity>0) {
out[index+GlowR]=MIN2(clamp, (in[index+GlowR]*boost*intensity));
out[index+GlowG]=MIN2(clamp, (in[index+GlowG]*boost*intensity));
out[index+GlowB]=MIN2(clamp, (in[index+GlowB]*boost*intensity));
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index e48a17ac274..063a274715c 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -113,7 +113,7 @@ typedef struct ReferenceVert {
typedef struct ReferenceState {
float com[3]; /* center of mass*/
ReferenceVert *ivert; /* list of intial values */
-}ReferenceState ;
+}ReferenceState;
/*private scratch pad for caching and other data only needed when alive*/
@@ -196,7 +196,7 @@ static float sb_time_scale(Object *ob)
/* defining the frames to *real* time relation */
{
SoftBody *sb= ob->soft; /* is supposed to be there */
- if (sb){
+ if (sb) {
return(sb->physics_speed);
/*hrms .. this could be IPO as well :)
estimated range [0.001 sluggish slug - 100.0 very fast (i hope ODE solver can handle that)]
@@ -226,10 +226,10 @@ static float sb_time_scale(Object *ob)
static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */
{
float f = -1999.99f;
- if (ob){
+ if (ob) {
SoftBody *sb= ob->soft; /* is supposed to be there */
if (!(ob->softflag & OB_SB_GOAL)) return (0.0f);
- if (sb&&bp){
+ if (sb&&bp) {
if (bp->goal < 0.0f) return (0.0f);
f = sb->mingoal + bp->goal*ABS(sb->maxgoal - sb->mingoal);
f = pow(f, 4.0f);
@@ -242,9 +242,9 @@ static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */
static float _final_mass(Object *ob,BodyPoint *bp)
{
- if (ob){
+ if (ob) {
SoftBody *sb= ob->soft; /* is supposed to be there */
- if (sb&&bp){
+ if (sb&&bp) {
return(bp->mass*sb->nodemass);
}
}
@@ -319,7 +319,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
pccd_M->mvert = MEM_dupallocN(cmd->xnew);
/* note that xnew coords are already in global space, */
/* determine the ortho BB */
- for (i=0; i < pccd_M->totvert; i++){
+ for (i=0; i < pccd_M->totvert; i++) {
/* evaluate limits */
copy_v3_v3(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -341,7 +341,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
/* anyhoo we need to walk the list of faces and find OBB they live in */
- for (i=0; i < pccd_M->totface; i++){
+ for (i=0; i < pccd_M->totface; i++) {
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
@@ -369,7 +369,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -397,8 +397,8 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
/* first some paranoia checks */
- if (!cmd) return ;
- if (!cmd->numverts || !cmd->numfaces) return ;
+ if (!cmd) return;
+ if (!cmd->numverts || !cmd->numfaces) return;
if ((pccd_M->totvert != cmd->numverts) ||
(pccd_M->totface != cmd->numfaces)) return;
@@ -417,7 +417,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
pccd_M->mvert = MEM_dupallocN(cmd->xnew);
/* note that xnew coords are already in global space, */
/* determine the ortho BB */
- for (i=0; i < pccd_M->totvert; i++){
+ for (i=0; i < pccd_M->totvert; i++) {
/* evaluate limits */
copy_v3_v3(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -445,7 +445,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
/* anyhoo we need to walk the list of faces and find OBB they live in */
- for (i=0; i < pccd_M->totface; i++){
+ for (i=0; i < pccd_M->totface; i++) {
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
@@ -473,7 +473,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -508,7 +508,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(v,pccd_M->mprevvert[mface->v4].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -523,12 +523,12 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
mface++;
}
- return ;
+ return;
}
static void ccd_mesh_free(ccd_Mesh *ccdm)
{
- if (ccdm && (ccdm->savety == CCD_SAVETY )){ /*make sure we're not nuking objects we don't know*/
+ if (ccdm && (ccdm->savety == CCD_SAVETY )) { /*make sure we're not nuking objects we don't know*/
MEM_freeN(ccdm->mface);
MEM_freeN(ccdm->mvert);
if (ccdm->mprevvert) MEM_freeN(ccdm->mprevvert);
@@ -575,7 +575,7 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash *
/*Only proceed for mesh object in same layer */
if (base->object->type==OB_MESH && (base->lay & vertexowner->lay)) {
ob= base->object;
- if (ob == vertexowner){
+ if (ob == vertexowner) {
/* if vertexowner is given we don't want to check collision with owner object */
base = base->next;
continue;
@@ -618,9 +618,9 @@ static void add_mesh_quad_diag_springs(Object *ob)
MFace *mface= me->mface;
/*BodyPoint *bp;*/ /*UNUSED*/
BodySpring *bs, *bs_new;
- int a ;
+ int a;
- if (ob->soft){
+ if (ob->soft) {
int nofquads;
//float s_shear = ob->soft->shearstiff*ob->soft->shearstiff;
@@ -667,7 +667,7 @@ static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counte
BodyPoint *bp,*bpo;
BodySpring *bs,*bs2,*bs3= NULL;
int a,b,c,notthis= 0,v0;
- if (!sb->bspring){return;} /* we are 2nd order here so 1rst should have been build :) */
+ if (!sb->bspring) {return;} /* we are 2nd order here so 1rst should have been build :) */
/* first run counting second run adding */
*counter = 0;
if (addsprings) bs3 = ob->soft->bspring+ob->soft->totspring;
@@ -675,36 +675,36 @@ static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counte
/*scan for neighborhood*/
bpo = NULL;
v0 = (sb->totpoint-a);
- for (b=bp->nofsprings;b>0;b--){
+ for (b=bp->nofsprings;b>0;b--) {
bs = sb->bspring + bp->springs[b-1];
/*nasty thing here that springs have two ends
so here we have to make sure we examine the other */
- if (v0 == bs->v1){
+ if (v0 == bs->v1) {
bpo = sb->bpoint+bs->v2;
notthis = bs->v2;
}
else {
- if (v0 == bs->v2){
+ if (v0 == bs->v2) {
bpo = sb->bpoint+bs->v1;
notthis = bs->v1;
}
else {printf("oops we should not get here - add_2nd_order_springs");}
}
- if (bpo){/* so now we have a 2nd order humpdidump */
- for (c=bpo->nofsprings;c>0;c--){
+ if (bpo) {/* so now we have a 2nd order humpdidump */
+ for (c=bpo->nofsprings;c>0;c--) {
bs2 = sb->bspring + bpo->springs[c-1];
- if ((bs2->v1 != notthis) && (bs2->v1 > v0)){
+ if ((bs2->v1 != notthis) && (bs2->v1 > v0)) {
(*counter)++;/*hit */
- if (addsprings){
+ if (addsprings) {
bs3->v1= v0;
bs3->v2= bs2->v1;
bs3->springtype = SB_BEND;
bs3++;
}
}
- if ((bs2->v2 !=notthis)&&(bs2->v2 > v0)){
+ if ((bs2->v2 !=notthis)&&(bs2->v2 > v0)) {
(*counter)++;/*hit */
- if (addsprings){
+ if (addsprings) {
bs3->v1= v0;
bs3->v2= bs2->v2;
bs3->springtype = SB_BEND;
@@ -739,7 +739,7 @@ static void add_2nd_order_springs(Object *ob,float stiffness)
ob->soft->bspring = bs_new;
add_2nd_order_roller(ob,stiffness,&counter,1); /* adding */
- ob->soft->totspring +=counter ;
+ ob->soft->totspring += counter;
}
}
@@ -782,10 +782,10 @@ static void build_bps_springlist(Object *ob)
}
/* scan for attached inner springs */
for (b=sb->totspring, bs= sb->bspring; b>0; b--, bs++) {
- if (( (sb->totpoint-a) == bs->v1) ){
+ if (( (sb->totpoint-a) == bs->v1) ) {
add_bp_springlist(bp,sb->totspring -b);
}
- if (( (sb->totpoint-a) == bs->v2) ){
+ if (( (sb->totpoint-a) == bs->v2) ) {
add_bp_springlist(bp,sb->totspring -b);
}
}/*for springs*/
@@ -809,9 +809,9 @@ static void calculate_collision_balls(Object *ob)
min = 1e22f;
max = -1e22f;
/* first estimation based on attached */
- for (b=bp->nofsprings;b>0;b--){
+ for (b=bp->nofsprings;b>0;b--) {
bs = sb->bspring + bp->springs[b-1];
- if (bs->springtype == SB_EDGE){
+ if (bs->springtype == SB_EDGE) {
akku += bs->len;
akku_count++,
min = MIN2(bs->len,min);
@@ -820,19 +820,19 @@ static void calculate_collision_balls(Object *ob)
}
if (akku_count > 0) {
- if (sb->sbc_mode == SBC_MODE_MANUAL){
+ if (sb->sbc_mode == SBC_MODE_MANUAL) {
bp->colball=sb->colball;
}
- if (sb->sbc_mode == SBC_MODE_AVG){
+ if (sb->sbc_mode == SBC_MODE_AVG) {
bp->colball = akku/(float)akku_count*sb->colball;
}
- if (sb->sbc_mode == SBC_MODE_MIN){
+ if (sb->sbc_mode == SBC_MODE_MIN) {
bp->colball=min*sb->colball;
}
- if (sb->sbc_mode == SBC_MODE_MAX){
+ if (sb->sbc_mode == SBC_MODE_MAX) {
bp->colball=max*sb->colball;
}
- if (sb->sbc_mode == SBC_MODE_AVGMINMAX){
+ if (sb->sbc_mode == SBC_MODE_AVGMINMAX) {
bp->colball = (min + max)/2.0f*sb->colball;
}
}
@@ -905,17 +905,17 @@ static void free_softbody_baked(SoftBody *sb)
}
static void free_scratch(SoftBody *sb)
{
- if (sb->scratch){
+ if (sb->scratch) {
/* todo make sure everything is cleaned up nicly */
- if (sb->scratch->colliderhash){
+ if (sb->scratch->colliderhash) {
BLI_ghash_free(sb->scratch->colliderhash, NULL,
(GHashValFreeFP) ccd_mesh_free); /*this hoepfully will free all caches*/
sb->scratch->colliderhash = NULL;
}
- if (sb->scratch->bodyface){
+ if (sb->scratch->bodyface) {
MEM_freeN(sb->scratch->bodyface);
}
- if (sb->scratch->Ref.ivert){
+ if (sb->scratch->Ref.ivert) {
MEM_freeN(sb->scratch->Ref.ivert);
}
MEM_freeN(sb->scratch);
@@ -931,7 +931,7 @@ static void free_softbody_intern(SoftBody *sb)
int a;
BodyPoint *bp;
- if (sb->bpoint){
+ if (sb->bpoint) {
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
/* free spring list */
if (bp->springs != NULL) {
@@ -1041,7 +1041,7 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
#endif
- if (ccdm){
+ if (ccdm) {
#if 0 /* UNUSED */
mface= ccdm->mface;
mvert= ccdm->mvert;
@@ -1115,7 +1115,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
if (ob->pd && ob->pd->deflect) {
MVert *mvert= NULL;
MVert *mprevvert= NULL;
- if (ccdm){
+ if (ccdm) {
mvert= ccdm->mvert;
a = ccdm->totvert;
mprevvert= ccdm->mprevvert;
@@ -1142,19 +1142,19 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
/* use mesh*/
if (mvert) {
- while(a){
+ while(a) {
copy_v3_v3(nv1,mvert[a-1].co);
- if (mprevvert){
+ if (mprevvert) {
mul_v3_fl(nv1,time);
Vec3PlusStVec(nv1,(1.0f-time),mprevvert[a-1].co);
}
/* origin to face_v2*/
sub_v3_v3(nv1, face_v2);
facedist = dot_v3v3(nv1,d_nvect);
- if (ABS(facedist)<outerfacethickness){
- if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ){
+ if (ABS(facedist)<outerfacethickness) {
+ if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ) {
float df;
- if (facedist > 0){
+ if (facedist > 0) {
df = (outerfacethickness-facedist)/outerfacethickness;
}
else {
@@ -1208,7 +1208,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
MVert *mvert= NULL;
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
- if (ccdm){
+ if (ccdm) {
mface= ccdm->mface;
mvert= ccdm->mvert;
mprevvert= ccdm->mprevvert;
@@ -1251,15 +1251,15 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
}
- if (mvert){
+ if (mvert) {
copy_v3_v3(nv1,mvert[mface->v1].co);
copy_v3_v3(nv2,mvert[mface->v2].co);
copy_v3_v3(nv3,mvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(nv4,mvert[mface->v4].co);
}
- if (mprevvert){
+ if (mprevvert) {
mul_v3_fl(nv1,time);
Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
@@ -1269,7 +1269,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
mul_v3_fl(nv3,time);
Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
mul_v3_fl(nv4,time);
Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
}
@@ -1284,12 +1284,12 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
if (
isect_line_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) ||
isect_line_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
- isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) ){
+ isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
Vec3PlusStVec(force,-0.5f,d_nvect);
*damp=tune*ob->pd->pdef_sbdamp;
deflected = 2;
}
- if (mface->v4){ /* quad */
+ if (mface->v4) { /* quad */
/* switch origin to be nv4 */
sub_v3_v3v3(edge1, nv3, nv4);
sub_v3_v3v3(edge2, nv1, nv4);
@@ -1299,7 +1299,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
/* isect_line_tri_v3(nv1, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
we did that edge already */
isect_line_tri_v3(nv3, nv4, face_v1, face_v2, face_v3, &t, NULL) ||
- isect_line_tri_v3(nv4, nv1, face_v1, face_v2, face_v3, &t, NULL) ){
+ isect_line_tri_v3(nv4, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
Vec3PlusStVec(force,-0.5f,d_nvect);
*damp=tune*ob->pd->pdef_sbdamp;
deflected = 2;
@@ -1326,7 +1326,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
float tune = -10.0f;
float feedback[3];
- if (sb && sb->scratch->totface){
+ if (sb && sb->scratch->totface) {
bf = sb->scratch->bodyface;
@@ -1336,7 +1336,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
bf->flag &= ~BFF_INTERSECT;
feedback[0]=feedback[1]=feedback[2]=0.0f;
if (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
- &damp, feedback, ob->lay ,ob , timenow)){
+ &damp, feedback, ob->lay ,ob , timenow)) {
Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
@@ -1347,7 +1347,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
feedback[0]=feedback[1]=feedback[2]=0.0f;
if ((bf->v4) && (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
- &damp, feedback, ob->lay ,ob , timenow))){
+ &damp, feedback, ob->lay ,ob , timenow))) {
Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
@@ -1358,12 +1358,12 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
/*---edges intruding*/
/*+++ close vertices*/
- if (( bf->flag & BFF_INTERSECT)==0){
+ if (( bf->flag & BFF_INTERSECT)==0) {
bf->flag &= ~BFF_CLOSEVERT;
tune = -1.0f;
feedback[0]=feedback[1]=feedback[2]=0.0f;
if (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
- &damp, feedback, ob->lay ,ob , timenow)){
+ &damp, feedback, ob->lay ,ob , timenow)) {
Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
@@ -1374,7 +1374,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
feedback[0]=feedback[1]=feedback[2]=0.0f;
if ((bf->v4) && (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
- &damp, feedback, ob->lay ,ob , timenow))){
+ &damp, feedback, ob->lay ,ob , timenow))) {
Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
@@ -1392,7 +1392,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
- if (bf->v4){
+ if (bf->v4) {
sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
}
}
@@ -1436,7 +1436,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
MVert *mvert= NULL;
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
- if (ccdm){
+ if (ccdm) {
mface= ccdm->mface;
mvert= ccdm->mvert;
mprevvert= ccdm->mprevvert;
@@ -1479,15 +1479,15 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
}
- if (mvert){
+ if (mvert) {
copy_v3_v3(nv1,mvert[mface->v1].co);
copy_v3_v3(nv2,mvert[mface->v2].co);
copy_v3_v3(nv3,mvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(nv4,mvert[mface->v4].co);
}
- if (mprevvert){
+ if (mprevvert) {
mul_v3_fl(nv1,time);
Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
@@ -1497,7 +1497,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
mul_v3_fl(nv3,time);
Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
mul_v3_fl(nv4,time);
Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
}
@@ -1510,7 +1510,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
- if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)){
+ if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) {
float v1[3],v2[3];
float intrusiondepth,i1,i2;
sub_v3_v3v3(v1, edge_v1, nv2);
@@ -1522,14 +1522,14 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
*damp=ob->pd->pdef_sbdamp;
deflected = 2;
}
- if (mface->v4){ /* quad */
+ if (mface->v4) { /* quad */
/* switch origin to be nv4 */
sub_v3_v3v3(edge1, nv3, nv4);
sub_v3_v3v3(edge2, nv1, nv4);
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
- if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)){
+ if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)) {
float v1[3],v2[3];
float intrusiondepth,i1,i2;
sub_v3_v3v3(v1, edge_v1, nv4);
@@ -1561,18 +1561,18 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
float damp;
float feedback[3];
- if (sb && sb->totspring){
+ if (sb && sb->totspring) {
for (a=ifirst; a<ilast; a++) {
BodySpring *bs = &sb->bspring[a];
bs->ext_force[0]=bs->ext_force[1]=bs->ext_force[2]=0.0f;
feedback[0]=feedback[1]=feedback[2]=0.0f;
bs->flag &= ~BSF_INTERSECT;
- if (bs->springtype == SB_EDGE){
+ if (bs->springtype == SB_EDGE) {
/* +++ springs colliding */
- if (ob->softflag & OB_SB_EDGECOLL){
+ if (ob->softflag & OB_SB_EDGECOLL) {
if ( sb_detect_edge_collisionCached (sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos,
- &damp,feedback,ob->lay,ob,timenow)){
+ &damp,feedback,ob->lay,ob,timenow)) {
add_v3_v3(bs->ext_force, feedback);
bs->flag |= BSF_INTERSECT;
//bs->cf=damp;
@@ -1584,7 +1584,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
/* +++ springs seeing wind ... n stuff depending on their orientation*/
/* note we don't use sb->mediafrict but use sb->aeroedge for magnitude of effect*/
- if (sb->aeroedge){
+ if (sb->aeroedge) {
float vel[3],sp[3],pr[3],force[3];
float f,windfactor = 0.25f;
/*see if we have wind*/
@@ -1613,7 +1613,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
project_v3_v3v3(pr,vel,sp);
sub_v3_v3(vel, pr);
normalize_v3(vel);
- if (ob->softflag & OB_SB_AERO_ANGLE){
+ if (ob->softflag & OB_SB_AERO_ANGLE) {
normalize_v3(sp);
Vec3PlusStVec(bs->ext_force,f*(1.0f-ABS(dot_v3v3(vel,sp))),vel);
}
@@ -1676,7 +1676,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
sb_threads[i].timenow = timenow;
sb_threads[i].ilast = left;
left = left - dec;
- if (left >0){
+ if (left >0) {
sb_threads[i].ifirst = left;
}
else
@@ -1714,17 +1714,17 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
mindist = ABS(dot_v3v3(pos,a));
cp = ABS(dot_v3v3(pos,b));
- if ( mindist < cp ){
+ if ( mindist < cp ) {
mindist = cp;
winner =2;
}
cp = ABS(dot_v3v3(pos,c));
- if (mindist < cp ){
+ if (mindist < cp ) {
mindist = cp;
winner =3;
}
- switch (winner){
+ switch (winner) {
case 1: copy_v3_v3(w,ca); break;
case 2: copy_v3_v3(w,cb); break;
case 3: copy_v3_v3(w,cc);
@@ -1766,7 +1766,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
- if (ccdm){
+ if (ccdm) {
mface= ccdm->mface;
mvert= ccdm->mvert;
mprevvert= ccdm->mprevvert;
@@ -1822,16 +1822,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
continue;
}
- if (mvert){
+ if (mvert) {
copy_v3_v3(nv1,mvert[mface->v1].co);
copy_v3_v3(nv2,mvert[mface->v2].co);
copy_v3_v3(nv3,mvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
copy_v3_v3(nv4,mvert[mface->v4].co);
}
- if (mprevvert){
+ if (mprevvert) {
/* grab the average speed of the collider vertices
before we spoil nvX
humm could be done once a SB steps but then we' need to store that too
@@ -1841,7 +1841,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
sub_v3_v3v3(vv1,nv1,mprevvert[mface->v1].co);
sub_v3_v3v3(vv2,nv2,mprevvert[mface->v2].co);
sub_v3_v3v3(vv3,nv3,mprevvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
sub_v3_v3v3(vv4,nv4,mprevvert[mface->v4].co);
}
@@ -1854,7 +1854,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
mul_v3_fl(nv3,time);
Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
- if (mface->v4){
+ if (mface->v4) {
mul_v3_fl(nv4,time);
Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
}
@@ -1872,13 +1872,13 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
// so rules are
//
- if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){
- if (isect_point_tri_prism_v3(opco, nv1, nv2, nv3) ){
+ if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) {
+ if (isect_point_tri_prism_v3(opco, nv1, nv2, nv3) ) {
force_mag_norm =(float)exp(-ee*facedist);
if (facedist > outerfacethickness*ff)
force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness);
*damp=ob->pd->pdef_sbdamp;
- if (facedist > 0.0f){
+ if (facedist > 0.0f) {
*damp *= (1.0f - facedist/outerfacethickness);
Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
deflected = 3;
@@ -1888,7 +1888,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
Vec3PlusStVec(innerforceaccu,force_mag_norm,d_nvect);
if (deflected < 2) deflected = 2;
}
- if ((mprevvert) && (*damp > 0.0f)){
+ if ((mprevvert) && (*damp > 0.0f)) {
choose_winner(ve,opco,nv1,nv2,nv3,vv1,vv2,vv3);
add_v3_v3(avel, ve);
cavel ++;
@@ -1897,7 +1897,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
ci++;
}
}
- if (mface->v4){ /* quad */
+ if (mface->v4) { /* quad */
/* switch origin to be nv4 */
sub_v3_v3v3(edge1, nv3, nv4);
sub_v3_v3v3(edge2, nv1, nv4);
@@ -1907,13 +1907,13 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
/* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
facedist = dot_v3v3(dv1,d_nvect);
- if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){
- if (isect_point_tri_prism_v3(opco, nv1, nv3, nv4) ){
+ if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) {
+ if (isect_point_tri_prism_v3(opco, nv1, nv3, nv4) ) {
force_mag_norm =(float)exp(-ee*facedist);
if (facedist > outerfacethickness*ff)
force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness);
*damp=ob->pd->pdef_sbdamp;
- if (facedist > 0.0f){
+ if (facedist > 0.0f) {
*damp *= (1.0f - facedist/outerfacethickness);
Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
deflected = 3;
@@ -1924,7 +1924,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
if (deflected < 2) deflected = 2;
}
- if ((mprevvert) && (*damp > 0.0f)){
+ if ((mprevvert) && (*damp > 0.0f)) {
choose_winner(ve,opco,nv1,nv3,nv4,vv1,vv3,vv4);
add_v3_v3(avel, ve);
cavel ++;
@@ -1941,7 +1941,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
closest_to_line_segment_v3(ve, opco, nv1, nv2);
sub_v3_v3v3(ve,opco,ve);
dist = normalize_v3(ve);
- if ((dist < outerfacethickness)&&(dist < mindistedge )){
+ if ((dist < outerfacethickness)&&(dist < mindistedge )) {
copy_v3_v3(coledge,ve);
mindistedge = dist,
deflected=1;
@@ -1950,7 +1950,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
closest_to_line_segment_v3(ve, opco, nv2, nv3);
sub_v3_v3v3(ve,opco,ve);
dist = normalize_v3(ve);
- if ((dist < outerfacethickness)&&(dist < mindistedge )){
+ if ((dist < outerfacethickness)&&(dist < mindistedge )) {
copy_v3_v3(coledge,ve);
mindistedge = dist,
deflected=1;
@@ -1959,16 +1959,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
closest_to_line_segment_v3(ve, opco, nv3, nv1);
sub_v3_v3v3(ve,opco,ve);
dist = normalize_v3(ve);
- if ((dist < outerfacethickness)&&(dist < mindistedge )){
+ if ((dist < outerfacethickness)&&(dist < mindistedge )) {
copy_v3_v3(coledge,ve);
mindistedge = dist,
deflected=1;
}
- if (mface->v4){ /* quad */
+ if (mface->v4) { /* quad */
closest_to_line_segment_v3(ve, opco, nv3, nv4);
sub_v3_v3v3(ve,opco,ve);
dist = normalize_v3(ve);
- if ((dist < outerfacethickness)&&(dist < mindistedge )){
+ if ((dist < outerfacethickness)&&(dist < mindistedge )) {
copy_v3_v3(coledge,ve);
mindistedge = dist,
deflected=1;
@@ -1977,7 +1977,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
closest_to_line_segment_v3(ve, opco, nv1, nv4);
sub_v3_v3v3(ve,opco,ve);
dist = normalize_v3(ve);
- if ((dist < outerfacethickness)&&(dist < mindistedge )){
+ if ((dist < outerfacethickness)&&(dist < mindistedge )) {
copy_v3_v3(coledge,ve);
mindistedge = dist,
deflected=1;
@@ -1995,21 +1995,21 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
BLI_ghashIterator_step(ihash);
} /* while () */
- if (deflected == 1){ // no face but 'outer' edge cylinder sees vert
+ if (deflected == 1) { // no face but 'outer' edge cylinder sees vert
force_mag_norm =(float)exp(-ee*mindistedge);
if (mindistedge > outerfacethickness*ff)
force_mag_norm =(float)force_mag_norm*fa*(mindistedge - outerfacethickness)*(mindistedge - outerfacethickness);
Vec3PlusStVec(force,force_mag_norm,coledge);
*damp=ob->pd->pdef_sbdamp;
- if (mindistedge > 0.0f){
+ if (mindistedge > 0.0f) {
*damp *= (1.0f - mindistedge/outerfacethickness);
}
}
- if (deflected == 2){ // face inner detected
+ if (deflected == 2) { // face inner detected
add_v3_v3(force, innerforceaccu);
}
- if (deflected == 3){ // face outer detected
+ if (deflected == 3) { // face outer detected
add_v3_v3(force, outerforceaccu);
}
@@ -2017,7 +2017,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
if (cavel) mul_v3_fl(avel,1.0f/(float)cavel);
copy_v3_v3(vel,avel);
if (ci) *intrusion /= ci;
- if (deflected){
+ if (deflected) {
normalize_v3_v3(facenormal, force);
}
return deflected;
@@ -2040,9 +2040,9 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
{
float m,delta_ij;
int i ,j;
- if (L < len){
+ if (L < len) {
for (i=0;i<3;i++)
- for (j=0;j<3;j++){
+ for (j=0;j<3;j++) {
delta_ij = (i==j ? (1.0f): (0.0f));
m=factor*(dir[i]*dir[j] + (1-L/len)*(delta_ij - dir[i]*dir[j]));
nlMatrixAdd(ia+i,op+ic+j,m);
@@ -2050,7 +2050,7 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
}
else{
for (i=0;i<3;i++)
- for (j=0;j<3;j++){
+ for (j=0;j<3;j++) {
m=factor*dir[i]*dir[j];
nlMatrixAdd(ia+i,op+ic+j,m);
}
@@ -2081,7 +2081,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
int ia,ic;
#endif
/* prepare depending on which side of the spring we are on */
- if (bpi == bs->v1){
+ if (bpi == bs->v1) {
bp1 = &sb->bpoint[bs->v1];
bp2 = &sb->bpoint[bs->v2];
#if 0 /* UNUSED */
@@ -2089,7 +2089,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
ic =3*bs->v2;
#endif
}
- else if (bpi == bs->v2){
+ else if (bpi == bs->v2) {
bp1 = &sb->bpoint[bs->v2];
bp2 = &sb->bpoint[bs->v1];
#if 0 /* UNUSED */
@@ -2119,7 +2119,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
kw = (bp1->springweight+bp2->springweight)/2.0f;
kw = kw * kw;
kw = kw * kw;
- switch (bs->springtype){
+ switch (bs->springtype) {
case SB_EDGE:
case SB_HANDLE:
forcefactor *= kw;
@@ -2146,7 +2146,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
Vec3PlusStVec(bp1->force,-kd,dir);
/* do jacobian stuff if needed */
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int op =3*sb->totpoint;
//float mvel = -forcetime*kd;
//float mpos = -forcetime*forcefactor;
@@ -2154,7 +2154,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
// dfdx_spring(ia,ia,op,dir,bs->len,distance,-mpos);
/* depending on my vel */
// dfdv_goal(ia,ia,mvel); // well that ignores geometie
- if (bp2->goal < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+ if (bp2->goal < SOFTGOALSNAP) { /* ommit this bp when it snaps */
/* depending on other pos */
// dfdx_spring(ia,ic,op,dir,bs->len,distance,mpos);
/* depending on other vel */
@@ -2203,7 +2203,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->force[0]= bp->force[1]= bp->force[2]= 0.0;
/* naive ball self collision */
/* needs to be done if goal snaps or not */
- if (do_selfcollision){
+ if (do_selfcollision) {
int attached;
BodyPoint *obp;
BodySpring *bs;
@@ -2220,17 +2220,17 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* mathematically it is completly nuts, but performace is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
distance = normalize_v3(def);
- if (distance < compare ){
+ if (distance < compare ) {
/* exclude body points attached with a spring */
attached = 0;
- for (b=obp->nofsprings;b>0;b--){
+ for (b=obp->nofsprings;b>0;b--) {
bs = sb->bspring + obp->springs[b-1];
- if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)){
+ if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) {
attached=1;
continue;}
}
- if (!attached){
- float f = bstune/(distance) + bstune/(compare*compare)*distance - 2.0f*bstune/compare ;
+ if (!attached) {
+ float f = bstune / (distance) + bstune / (compare * compare) * distance - 2.0f * bstune / compare;
mid_v3_v3v3(velcenter, bp->vec, obp->vec);
sub_v3_v3v3(dvel,velcenter,bp->vec);
@@ -2251,7 +2251,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
}
/* naive ball self collision done */
- if (_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+ if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
float auxvect[3];
float velgoal[3];
@@ -2260,14 +2260,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* true elastic goal */
float ks,kd;
sub_v3_v3v3(auxvect,bp->pos,bp->origT);
- ks = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ;
+ ks = 1.0f / (1.0f - _final_goal(ob, bp) * sb->goalspring) - 1.0f;
bp->force[0]+= -ks*(auxvect[0]);
bp->force[1]+= -ks*(auxvect[1]);
bp->force[2]+= -ks*(auxvect[2]);
/* calulate damping forces generated by goals*/
sub_v3_v3v3(velgoal,bp->origS, bp->origE);
- kd = sb->goalfrict * sb_fric_force_scale(ob) ;
+ kd = sb->goalfrict * sb_fric_force_scale(ob);
add_v3_v3v3(auxvect,velgoal,bp->vec);
if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
@@ -2284,7 +2284,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* done goal stuff */
/* gravitation */
- if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
+ if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
float gravity[3];
copy_v3_v3(gravity, scene->physics_settings.gravity);
mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob,bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
@@ -2330,8 +2330,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
float kd = 1.0f;
- if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)){
- if (intrusion < 0.0f){
+ if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+ if (intrusion < 0.0f) {
sb->scratch->flag |= SBF_DOFUZZY;
bp->loc_flag |= SBF_DOFUZZY;
bp->choke = sb->choke*0.01f;
@@ -2349,12 +2349,12 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* +++springs */
iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
if (ob->softflag & OB_SB_EDGES) {
- if (sb->bspring){ /* spring list exists at all ? */
+ if (sb->bspring) { /* spring list exists at all ? */
int b;
BodySpring *bs;
- for (b=bp->nofsprings;b>0;b--){
+ for (b=bp->nofsprings;b>0;b--) {
bs = sb->bspring + bp->springs[b-1];
- if (do_springcollision || do_aero){
+ if (do_springcollision || do_aero) {
add_v3_v3(bp->force, bs->ext_force);
if (bs->flag & BSF_INTERSECT)
bp->choke = bs->cf;
@@ -2408,7 +2408,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
sb_threads[i].timenow = timenow;
sb_threads[i].ilast = left;
left = left - dec;
- if (left >0){
+ if (left >0) {
sb_threads[i].ifirst = left;
}
else
@@ -2486,7 +2486,7 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags)
{
/* redirection to the new threaded Version */
- if (!(G.rt & 0x10)){ // 16
+ if (!(G.rt & 0x10)) { // 16
softbody_calc_forcesEx(scene, ob, forcetime, timenow, nl_flags);
return;
}
@@ -2516,14 +2516,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* jacobian
NLboolean success;
- if (nl_flags){
+ if (nl_flags) {
nlBegin(NL_SYSTEM);
nlBegin(NL_MATRIX);
}
*/
- if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
+ if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(gravity, scene->physics_settings.gravity);
mul_v3_fl(gravity, sb_grav_force_scale(ob)*sb->effector_weights->global_gravity);
}
@@ -2549,7 +2549,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
/* clear forces accumulator */
bp->force[0]= bp->force[1]= bp->force[2]= 0.0;
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
//int op =3*sb->totpoint;
/* dF/dV = v */
@@ -2572,7 +2572,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* naive ball self collision */
/* needs to be done if goal snaps or not */
- if (do_selfcollision){
+ if (do_selfcollision) {
int attached;
BodyPoint *obp;
int c,b;
@@ -2592,17 +2592,17 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
distance = normalize_v3(def);
- if (distance < compare ){
+ if (distance < compare ) {
/* exclude body points attached with a spring */
attached = 0;
- for (b=obp->nofsprings;b>0;b--){
+ for (b=obp->nofsprings;b>0;b--) {
bs = sb->bspring + obp->springs[b-1];
- if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)){
+ if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) {
attached=1;
continue;}
}
- if (!attached){
- float f = tune/(distance) + tune/(compare*compare)*distance - 2.0f*tune/compare ;
+ if (!attached) {
+ float f = tune / (distance) + tune / (compare * compare) * distance - 2.0f * tune/compare;
mid_v3_v3v3(velcenter, bp->vec, obp->vec);
sub_v3_v3v3(dvel,velcenter,bp->vec);
@@ -2611,7 +2611,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
Vec3PlusStVec(bp->force,sb->balldamp,dvel);
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
//int ic =3*(sb->totpoint-c);
//int op =3*sb->totpoint;
@@ -2649,7 +2649,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
}
/* naive ball self collision done */
- if (_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+ if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
float auxvect[3];
float velgoal[3];
@@ -2657,12 +2657,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
if (ob->softflag & OB_SB_GOAL) {
/* true elastic goal */
sub_v3_v3v3(auxvect,bp->pos,bp->origT);
- ks = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ;
+ ks = 1.0f / (1.0f- _final_goal(ob, bp) * sb->goalspring) - 1.0f;
bp->force[0]+= -ks*(auxvect[0]);
bp->force[1]+= -ks*(auxvect[1]);
bp->force[2]+= -ks*(auxvect[2]);
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
//int op =3*(sb->totpoint);
/* depending on my pos */
@@ -2672,14 +2672,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* calulate damping forces generated by goals*/
sub_v3_v3v3(velgoal,bp->origS, bp->origE);
- kd = sb->goalfrict * sb_fric_force_scale(ob) ;
+ kd = sb->goalfrict * sb_fric_force_scale(ob);
add_v3_v3v3(auxvect,velgoal,bp->vec);
if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
bp->force[0]-= kd * (auxvect[0]);
bp->force[1]-= kd * (auxvect[1]);
bp->force[2]-= kd * (auxvect[2]);
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
normalize_v3(auxvect);
/* depending on my vel */
@@ -2729,7 +2729,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->force[1]-= bp->vec[1]*kd;
bp->force[2]-= bp->vec[2]*kd;
/* friction in media done */
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
/* da/dv = */
@@ -2747,9 +2747,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
kd = 1.0f;
- if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)){
- if ((!nl_flags)&&(intrusion < 0.0f)){
- if (G.rt & 0x01){ // 17 we did check for bit 0x10 before
+ if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+ if ((!nl_flags)&&(intrusion < 0.0f)) {
+ if (G.rt & 0x01) { // 17 we did check for bit 0x10 before
/*fixing bug [17428] this forces adaptive step size to tiny steps
in some situations .. keeping G.rt==17 option for old files 'needing' the bug
*/
@@ -2778,7 +2778,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
}
Vec3PlusStVec(bp->force,kd,defforce);
- if (nl_flags & NLF_BUILD){
+ if (nl_flags & NLF_BUILD) {
// int ia =3*(sb->totpoint-a);
// int op =3*sb->totpoint;
//dfdx_goal(ia,ia,op,mpos); // don't do unless you know
@@ -2793,10 +2793,10 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* +++springs */
if (ob->softflag & OB_SB_EDGES) {
- if (sb->bspring){ /* spring list exists at all ? */
- for (b=bp->nofsprings;b>0;b--){
+ if (sb->bspring) { /* spring list exists at all ? */
+ for (b=bp->nofsprings;b>0;b--) {
bs = sb->bspring + bp->springs[b-1];
- if (do_springcollision || do_aero){
+ if (do_springcollision || do_aero) {
add_v3_v3(bp->force, bs->ext_force);
if (bs->flag & BSF_INTERSECT)
bp->choke = bs->cf;
@@ -2818,7 +2818,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* finish matrix and solve */
#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM
- if (nl_flags & NLF_SOLVE){
+ if (nl_flags & NLF_SOLVE) {
//double sct,sst=PIL_check_seconds_timer();
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
int iv =3*(sb->totpoint-a);
@@ -2839,7 +2839,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
success= nlSolveAdvanced(NULL, 1);
// nlPrintMatrix(); /* for debug purpose .. anyhow cropping B vector looks like working */
- if (success){
+ if (success) {
float f;
int index =0;
/* for debug purpose .. anyhow cropping B vector looks like working */
@@ -2921,7 +2921,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
else timeovermass = forcetime/0.009999f;
- if (_final_goal(ob,bp) < SOFTGOALSNAP){
+ if (_final_goal(ob,bp) < SOFTGOALSNAP) {
/* this makes t~ = t */
if (mid_flags & MID_PRESERVE) copy_v3_v3(dx,bp->vec);
@@ -2933,12 +2933,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* some nasty if's to have heun in here too */
copy_v3_v3(dv,bp->force);
- if (mode == 1){
+ if (mode == 1) {
copy_v3_v3(bp->prevvec, bp->vec);
copy_v3_v3(bp->prevdv, dv);
}
- if (mode ==2){
+ if (mode ==2) {
/* be optimistic and execute step */
bp->vec[0] = bp->prevvec[0] + 0.5f * (dv[0] + bp->prevdv[0]);
bp->vec[1] = bp->prevvec[1] + 0.5f * (dv[1] + bp->prevdv[1]);
@@ -2960,7 +2960,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* the freezer coming sooner or later */
/*
- if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )){
+ if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
bp->frozen /=2;
}
else{
@@ -2969,12 +2969,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
mul_v3_fl(dx,bp->frozen);
*/
/* again some nasty if's to have heun in here too */
- if (mode ==1){
+ if (mode ==1) {
copy_v3_v3(bp->prevpos,bp->pos);
copy_v3_v3(bp->prevdx ,dx);
}
- if (mode ==2){
+ if (mode ==2) {
bp->pos[0] = bp->prevpos[0] + 0.5f * ( dx[0] + bp->prevdx[0]);
bp->pos[1] = bp->prevpos[1] + 0.5f * ( dx[1] + bp->prevdx[1]);
bp->pos[2] = bp->prevpos[2] + 0.5f * ( dx[2] + bp->prevdx[2]);
@@ -2986,10 +2986,10 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
the collider object signals to get out by pushing hard. on the other hand
we don't want to end up in deep space so we add some <viscosity>
to balance that out */
- if (bp->choke2 > 0.0f){
+ if (bp->choke2 > 0.0f) {
mul_v3_fl(bp->vec,(1.0f - bp->choke2));
}
- if (bp->choke > 0.0f){
+ if (bp->choke > 0.0f) {
mul_v3_fl(bp->vec,(1.0f - bp->choke));
}
@@ -3007,18 +3007,18 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
} /*for*/
if (sb->totpoint) mul_v3_fl(cm,1.0f/sb->totpoint);
- if (sb->scratch){
+ if (sb->scratch) {
copy_v3_v3(sb->scratch->aabbmin,aabbmin);
copy_v3_v3(sb->scratch->aabbmax,aabbmax);
}
- if (err){ /* so step size will be controlled by biggest difference in slope */
+ if (err) { /* so step size will be controlled by biggest difference in slope */
if (sb->solverflags & SBSO_OLDERR)
*err = MAX2(maxerrpos,maxerrvel);
else
*err = maxerrpos;
//printf("EP %f EV %f \n",maxerrpos,maxerrvel);
- if (fuzzy){
+ if (fuzzy) {
*err /= sb->fuzzyness;
}
}
@@ -3125,7 +3125,7 @@ static void softbody_apply_goalsnap(Object *ob)
int a;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- if (_final_goal(ob,bp) >= SOFTGOALSNAP){
+ if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
copy_v3_v3(bp->prevpos,bp->pos);
copy_v3_v3(bp->pos,bp->origT);
}
@@ -3141,7 +3141,7 @@ static void apply_spring_memory(Object *ob)
int a;
float b,l,r;
- if (sb && sb->totspring){
+ if (sb && sb->totspring) {
b = sb->plastic;
for (a=0; a<sb->totspring; a++) {
bs = &sb->bspring[a];
@@ -3149,7 +3149,7 @@ static void apply_spring_memory(Object *ob)
bp2 =&sb->bpoint[bs->v2];
l = len_v3v3(bp1->pos,bp2->pos);
r = bs->len/l;
- if (( r > 1.05f) || (r < 0.95f)){
+ if (( r > 1.05f) || (r < 0.95f)) {
bs->len = ((100.0f - b) * bs->len + b*l)/100.0f;
}
}
@@ -3170,7 +3170,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
bp->origT[0] = bp->origS[0] + f*(bp->origE[0] - bp->origS[0]);
bp->origT[1] = bp->origS[1] + f*(bp->origE[1] - bp->origS[1]);
bp->origT[2] = bp->origS[2] + f*(bp->origE[2] - bp->origS[2]);
- if (_final_goal(ob,bp) >= SOFTGOALSNAP){
+ if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
bp->vec[0] = bp->origE[0] - bp->origS[0];
bp->vec[1] = bp->origE[1] - bp->origS[1];
bp->vec[2] = bp->origE[2] - bp->origS[2];
@@ -3209,8 +3209,8 @@ static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex
}
if (dv) {
/* Lets see if this vert is in the weight group */
- for (i=0; i<dv->totweight; i++){
- if (dv->dw[i].def_nr == groupindex){
+ for (i=0; i<dv->totweight; i++) {
+ if (dv->dw[i].def_nr == groupindex) {
*target= dv->dw[i].weight; /* got it ! */
break;
}
@@ -3245,7 +3245,7 @@ static void springs_from_mesh(Object *ob)
}
/* recalculate spring length for meshes here */
/* public version shrink to fit */
- if (sb->springpreload != 0 ){
+ if (sb->springpreload != 0 ) {
scale = sb->springpreload / 100.0f;
}
for (a=0; a<sb->totspring; a++) {
@@ -3298,7 +3298,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
else{
/* in consequence if no group was set .. but we want to animate it laters */
/* logically attach to goal with default first */
- if (ob->softflag & OB_SB_GOAL){bp->goal = sb->defgoal;}
+ if (ob->softflag & OB_SB_GOAL) {bp->goal = sb->defgoal;}
}
/* to proove the concept
@@ -3309,7 +3309,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
{
int grp= defgroup_name_index (ob,sb->namedVG_Mass);
/* printf("VGN %s %d \n",sb->namedVG_Mass,grp); */
- if (grp > -1){
+ if (grp > -1) {
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
/* 2.5 bp->mass = bp->mass * sb->nodemass; */
/* printf("bp->mass %f \n",bp->mass); */
@@ -3323,7 +3323,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
{
int grp= defgroup_name_index (ob,sb->namedVG_Spring_K);
//printf("VGN %s %d \n",sb->namedVG_Spring_K,grp);
- if (grp > -1){
+ if (grp > -1) {
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
//printf("bp->springweight %f \n",bp->springweight);
@@ -3460,7 +3460,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *
if (dostiff) {
- if (w){
+ if (w) {
if ( v && u ) {
bs->v1 = bpc;
bs->v2 = bpc-dw-dv-1;
@@ -3477,7 +3477,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *
}
}
- if (w < lt->pntsw -1){
+ if (w < lt->pntsw -1) {
if ( v && u ) {
bs->v1 = bpc;
bs->v2 = bpc+dw-dv-1;
@@ -3511,11 +3511,11 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
totvert= lt->pntsu*lt->pntsv*lt->pntsw;
- if (ob->softflag & OB_SB_EDGES){
+ if (ob->softflag & OB_SB_EDGES) {
totspring = ((lt->pntsu -1) * lt->pntsv
+ (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+lt->pntsu*lt->pntsv*(lt->pntsw -1);
- if (ob->softflag & OB_SB_QUADS){
+ if (ob->softflag & OB_SB_QUADS) {
totspring += 4*(lt->pntsu -1) * (lt->pntsv -1) * (lt->pntsw-1);
}
}
@@ -3528,7 +3528,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
/* weights from bpoints, same code used as for mesh vertices */
/* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/
/* new! take the weights from lattice vertex anyhow */
- if (ob->softflag & OB_SB_GOAL){
+ if (ob->softflag & OB_SB_GOAL) {
BodyPoint *bp= sb->bpoint;
BPoint *bpnt= lt->def;
/* jow_go_for2_5 */
@@ -3540,7 +3540,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
}
/* create some helper edges to enable SB lattice to be useful at all */
- if (ob->softflag & OB_SB_EDGES){
+ if (ob->softflag & OB_SB_EDGES) {
makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob);
build_bps_springlist(ob); /* link bps to springs */
}
@@ -3561,7 +3561,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
totvert= count_curveverts(&cu->nurb);
- if (ob->softflag & OB_SB_EDGES){
+ if (ob->softflag & OB_SB_EDGES) {
if (ob->type==OB_CURVE) {
totspring= totvert - BLI_countlist(&cu->nurb);
}
@@ -3648,10 +3648,10 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts, int local)
{
SoftBody *sb= ob->soft;
- if (sb){
+ if (sb) {
BodyPoint *bp= sb->bpoint;
int a;
- if (sb->solverflags & SBSO_ESTIMATEIPO){SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
+ if (sb->solverflags & SBSO_ESTIMATEIPO) {SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
/* inverse matrix is not uptodate... */
invert_m4_m4(ob->imat, ob->obmat);
@@ -3924,8 +3924,8 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
ccd_update_deflector_hash(scene, ob, sb->scratch->colliderhash);
- if (sb->scratch->needstobuildcollider){
- if (query_external_colliders(scene, ob)){
+ if (sb->scratch->needstobuildcollider) {
+ if (query_external_colliders(scene, ob)) {
ccd_build_deflector_hash(scene, ob, sb->scratch->colliderhash);
}
sb->scratch->needstobuildcollider=0;
@@ -3941,7 +3941,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
/* loops = counter for emergency brake
* we don't want to lock up the system if physics fail
*/
- int loops =0 ;
+ int loops = 0;
SoftHeunTol = sb->rklimit; /* humm .. this should be calculated from sb parameters and sizes */
/* adjust loop limits */
@@ -3970,7 +3970,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
if (err > SoftHeunTol) { /* error needs to be scaled to some quantity */
- if (forcetime > forcetimemin){
+ if (forcetime > forcetimemin) {
forcetime = MAX2(forcetime / 2.0f,forcetimemin);
softbody_restore_prev_step(ob);
//printf("down,");
@@ -3982,7 +3982,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
else {
float newtime = forcetime * 1.1f; /* hope for 1.1 times better conditions in next step */
- if (sb->scratch->flag & SBF_DOFUZZY){
+ if (sb->scratch->flag & SBF_DOFUZZY) {
//if (err > SoftHeunTol/(2.0f*sb->fuzzyness)) { /* stay with this stepsize unless err really small */
newtime = forcetime;
//}
@@ -4001,7 +4001,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
forcetime = MAX2(dtime - timedone,newtime);
}
loops++;
- if (sb->solverflags & SBSO_MONITOR ){
+ if (sb->solverflags & SBSO_MONITOR ) {
sct=PIL_check_seconds_timer();
if (sct-sst > 0.5f) printf("%3.0f%% \r",100.0f*timedone/dtime);
}
@@ -4013,8 +4013,8 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
interpolate_exciter(ob, 2, 2);
softbody_apply_goalsnap(ob);
- // if (G.f & G_DEBUG){
- if (sb->solverflags & SBSO_MONITOR ){
+ // if (G.f & G_DEBUG) {
+ if (sb->solverflags & SBSO_MONITOR ) {
if (loops > HEUNWARNLIMIT) /* monitor high loop counts */
printf("\r needed %d steps/frame",loops);
}
@@ -4028,7 +4028,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
{
/* do semi "fake" implicit euler */
}/*SOLVER SELECT*/
- else if (sb->solver_ID == 3){
+ else if (sb->solver_ID == 3) {
/* do "stupid" semi "fake" implicit euler */
//removed
@@ -4036,9 +4036,9 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
else{
printf("softbody no valid solver ID!");
}/*SOLVER SELECT*/
- if (sb->plastic){ apply_spring_memory(ob);}
+ if (sb->plastic) { apply_spring_memory(ob);}
- if (sb->solverflags & SBSO_MONITOR ){
+ if (sb->solverflags & SBSO_MONITOR ) {
sct=PIL_check_seconds_timer();
if ((sct-sst > 0.5f) || (G.f & G_DEBUG)) printf(" solver time %f sec %s \n",sct-sst,ob->id.name);
}
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 1a181edf914..f06f2cdb760 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2444,7 +2444,7 @@ static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
MLoopUV *mloopuv;
int i, j;
- for(i=0; i < numTex; i++){
+ for(i=0; i < numTex; i++) {
texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
texpoly = CustomData_get_n(pdata, CD_MTEXPOLY, polyindex, i);
@@ -2456,7 +2456,7 @@ static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata,
}
}
- for(i=0; i < numCol; i++){
+ for(i=0; i < numCol; i++) {
mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, loopstart, i);
mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 138abb73b49..ede2eb7f461 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -173,7 +173,7 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
}
}
}
- else if(event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
+ else if(event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
float dim[2];
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
{
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index d47ba1274b1..9d68e1d899c 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1154,12 +1154,13 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
/* not all versions of ffmpeg include that, so here we go ... */
-static const AVOption *my_av_find_opt(void *v, const char *name,
- const char *unit, int mask, int flags){
+static const AVOption *my_av_find_opt(void *v, const char *name,
+ const char *unit, int mask, int flags)
+{
AVClass *c= *(AVClass**)v;
const AVOption *o= c->option;
- for(;o && o->name; o++){
+ for(;o && o->name; o++) {
if(!strcmp(o->name, name) &&
(!unit || (o->unit && !strcmp(o->unit, unit))) &&
(o->flags & mask) == flags )