diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
commit | b8a71efeba70d6c3ebc579f5043daa4162da86e8 (patch) | |
tree | d2d89da2a59f8955583f4968a35e48c578fd4d4c /source/blender | |
parent | 81d8f17843f92c6d6abbacb652ca22917910f4bc (diff) |
style cleanup: follow style guide for/with/if spacing
Diffstat (limited to 'source/blender')
120 files changed, 1002 insertions, 1001 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index a58189c6018..1fab96b2075 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -53,7 +53,7 @@ static int AVI_DEBUG=0; static char DEBUG_FCC[4]; -#define DEBUG_PRINT(x) if(AVI_DEBUG) printf("AVI DEBUG: " x); +#define DEBUG_PRINT(x) if (AVI_DEBUG) printf("AVI DEBUG: " x); /* local functions */ char *fcc_to_char (unsigned int fcc); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index f05ceb81735..074ea741f3a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1165,7 +1165,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, if (indices) { w = MEM_callocN(sizeof(float)*numVerts, "Temp weight array DM_update_weight_mcol"); i = num; - while(i--) + while (i--) w[indices[i]] = weights[i]; } @@ -2906,7 +2906,7 @@ static void navmesh_drawColored(DerivedMesh *dm) #endif glDisable(GL_LIGHTING); - /* if(GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */ + /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */ DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" ); //glShadeModel(GL_SMOOTH); glBegin(glmode = GL_QUADS); diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 993a33ca468..a14988d78b1 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -83,7 +83,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint); /* first find out goal/predator with highest priority */ - if (effectors) for(cur = effectors->first; cur; cur=cur->next) { + if (effectors) for (cur = effectors->first; cur; cur=cur->next) { Object *eob = cur->ob; PartDeflect *pd = cur->pd; @@ -252,7 +252,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * //check boids in own system if (acbr->options & BRULE_ACOLL_WITH_BOIDS) { neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn); - if (neighbors > 1) for(n=1; n<neighbors; n++) { + if (neighbors > 1) for (n=1; n<neighbors; n++) { copy_v3_v3(co1, pa->prev_state.co); copy_v3_v3(vel1, pa->prev_state.vel); copy_v3_v3(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co); @@ -298,7 +298,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * if (epsys) { neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn); - if (neighbors > 0) for(n=0; n<neighbors; n++) { + if (neighbors > 0) for (n=0; n<neighbors; n++) { copy_v3_v3(co1, pa->prev_state.co); copy_v3_v3(vel1, pa->prev_state.vel); copy_v3_v3(co2, (epsys->particles + ptn[n].index)->prev_state.co); @@ -945,7 +945,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) //planned for near future //cond = state->conditions.first; - //for(; cond; cond=cond->next) { + //for (; cond; cond=cond->next) { // if (boid_condition_is_true(cond)) { // pa->boid->state_id = cond->state_id; // state = get_boid_state(boids, pa); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index e3be9c4c236..b457e71affd 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -36,7 +36,6 @@ #include "GL/glew.h" -#include "BLI_scanfill.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" @@ -45,6 +44,7 @@ #include "BLI_array.h" #include "BLI_smallhash.h" #include "BLI_utildefines.h" +#include "BLI_scanfill.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -629,13 +629,13 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, else { if (index) { orig = *index++; - if (orig == ORIGINDEX_NONE) { if(nors) nors += 3; continue; } + if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; } if (drawParamsMapped) draw_option = drawParamsMapped(userData, orig); - else { if(nors) nors += 3; continue; } + else { if (nors) nors += 3; continue; } } else if (drawParamsMapped) draw_option = drawParamsMapped(userData, i); - else { if(nors) nors += 3; continue; } + else { if (nors) nors += 3; continue; } } if (draw_option != DM_DRAW_OPTION_SKIP) { diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 9f3f3a7aeb1..a725b5f4c52 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -448,7 +448,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res * loops requesting data from ourselfs in a context callback */ /* Ok, this looks evil... - * if(ret) done= -(-ret | -done); + * if (ret) done= -(-ret | -done); * * Values in order of importance * (0, -1, 1) - Where 1 is highest priority diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index c84db44a674..7aae0d52fe7 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -453,7 +453,7 @@ void freeNurb(Nurb *nu) nu->knotsu= NULL; if (nu->knotsv) MEM_freeN(nu->knotsv); nu->knotsv= NULL; - /* if(nu->trim.first) freeNurblist(&(nu->trim)); */ + /* if (nu->trim.first) freeNurblist(&(nu->trim)); */ MEM_freeN(nu); @@ -1025,7 +1025,7 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu *fp= basisu[i]*bp->vec[3]; sumdiv+= *fp; } - if (sumdiv != 0.0f) if(sumdiv < 0.999f || sumdiv > 1.001f) { + if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) { /* is normalizing needed? */ fp= sum; for (i= istart; i<=iend; i++, fp++) { diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 35824d895db..783652e9a75 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -614,7 +614,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O effectors = pdInitEffectors(scene, ob, psys, part->effector_weights); - if (effectors) for(eff = effectors->first; eff; eff=eff->next) { + if (effectors) for (eff = effectors->first; eff; eff=eff->next) { if (eff->psys) { node2 = dag_get_node(dag, eff->ob); dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field"); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index ff3eea8736d..cb8220c8fb3 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -975,7 +975,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we /* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */ /* Check for min distance here? (yes would be cool to add that, ton) */ - if (effectors) for(eff = effectors->first; eff; eff=eff->next) { + if (effectors) for (eff = effectors->first; eff; eff=eff->next) { /* object effectors were fully checked to be OK to evaluate! */ get_effector_tot(eff, &efd, point, &tot, &p, &step); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b696e10986a..3b91afbc126 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2055,7 +2055,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f // printf("loaded new result %p\n", ima->rr); /* free result if new one found */ if (ima->rr) { - // if(oldrr) printf("freed previous result %p\n", oldrr); + // if (oldrr) printf("freed previous result %p\n", oldrr); if (oldrr) RE_FreeRenderResult(oldrr); } else { diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 2787674036b..32bdac9d35e 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -247,7 +247,7 @@ DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], float (*fLongVectorB)[3], // due to non-commutative nature of floating point ops this makes the sim give // different results each time you run it! // schedule(guided, 2) -//#pragma omp parallel for reduction(+: temp) if(verts > CLOTH_OPENMP_LIMIT) +//#pragma omp parallel for reduction(+: temp) if (verts > CLOTH_OPENMP_LIMIT) for (i = 0; i < (long)verts; i++) { temp += dot_v3v3(fLongVectorA[i], fLongVectorB[i]); } @@ -597,7 +597,7 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector zero_lfvector(to, vcount); -#pragma omp parallel sections private(i) if(vcount > CLOTH_OPENMP_LIMIT) +#pragma omp parallel sections private(i) if (vcount > CLOTH_OPENMP_LIMIT) { #pragma omp section { @@ -978,7 +978,7 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv) unsigned int i = 0; // Take only the diagonal blocks of A -// #pragma omp parallel for private(i) if(lA[0].vcount > CLOTH_OPENMP_LIMIT) +// #pragma omp parallel for private(i) if (lA[0].vcount > CLOTH_OPENMP_LIMIT) for (i = 0; i<lA[0].vcount; i++) { // block diagonalizer @@ -1472,7 +1472,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec } /* gather velocities & density */ - if (smoothfac > 0.0f) for(v = 0; v < numverts; v++) { + if (smoothfac > 0.0f) for (v = 0; v < numverts; v++) { i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0); j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1); k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2); @@ -1486,7 +1486,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec } /* gather colliders */ - if (colliders && collfac > 0.0f) for(col = colliders->first; col; col = col->next) + if (colliders && collfac > 0.0f) for (col = colliders->first; col; col = col->next) { MVert *loc0 = col->collmd->x; MVert *loc1 = col->collmd->xnew; @@ -1695,7 +1695,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; @@ -1706,7 +1706,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_apply_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX); search = search->next; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 300198ce7ea..097e7a4eb5e 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -410,7 +410,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) k1=k[0]=k[1]=k[2]=k[3]= firstkey; t[0]=t[1]=t[2]=t[3]= k1->pos; - /* if(fac<0.0 || fac>1.0) return 1; */ + /* if (fac<0.0 || fac>1.0) return 1; */ if (k1->next==NULL) return 1; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index eb28e9f641a..2dcfb744cd2 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1138,7 +1138,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8]; /* make sure input name is terminated properly */ - /* if( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */ + /* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */ /* removed since this is only ever called from one place - campbell */ while (1) { @@ -1452,7 +1452,7 @@ void test_idbutton(char *name) /* search for id */ idtest= BLI_findstring(lb, name, offsetof(ID, name) + 2); - if (idtest) if( new_id(lb, idtest, name)==0 ) sort_alpha_id(lb, idtest); + if (idtest) if ( new_id(lb, idtest, name)==0 ) sort_alpha_id(lb, idtest); } void text_idbutton(struct ID *id, char *text) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index fe21295ff83..da5e02c17f1 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -353,7 +353,7 @@ int is_basis_mball(Object *ob) } /* return nonzero if ob1 is a basis mball for ob */ -int is_mball_basis_for(Object *ob1, Object *ob2) +int is_mball_basis_for (Object *ob1, Object *ob2) { int basis1nr, basis2nr; char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME]; diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index c0f488faf3f..cd49002a351 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -93,7 +93,7 @@ static int search_polyloop_cmp(const void *v1, const void *v2) return sp1->loopstart > sp2->loopstart ? 1 : sp1->loopstart < sp2->loopstart ? -1 : 0; } -#define PRINT if(do_verbose) printf +#define PRINT if (do_verbose) printf int BKE_mesh_validate_arrays(Mesh *mesh, MVert *mverts, unsigned int totvert, diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f9634ef2301..dd1546d694b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2135,7 +2135,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) float guidetime, radius, weight, angle, totstrength = 0.0f; float vec_to_point[3]; - if (effectors) for(eff = effectors->first; eff; eff=eff->next) { + if (effectors) for (eff = effectors->first; eff; eff=eff->next) { pd = eff->pd; if (pd->forcefield != PFIELD_GUIDE) @@ -3747,9 +3747,9 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co return 1; } -#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);} -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0f, 1.0f); } +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);} +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); } +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 4a1f0a425cb..445e34e43c7 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -920,7 +920,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch cpa->w[i]=0.0f; } - if (totw>0.0f) for(w=0; w<4; w++) + if (totw>0.0f) for (w=0; w<4; w++) cpa->w[w]/=totw; cpa->parent=cpa->pa[0]; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 643dd217e4d..63135ea8641 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -965,7 +965,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup continue; /* hair needs to be included in id-list for cache edit mode to work */ - /* if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */ + /* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */ /* continue; */ if (psys->part->type == PART_FLUID) @@ -2003,7 +2003,7 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite) if (cache->flag & PTCACHE_DISK_CACHE) { error += !ptcache_mem_frame_to_disk(pid, pm); - // if(pm) /* pm is always set */ + // if (pm) /* pm is always set */ { ptcache_data_free(pm); ptcache_extra_free(pm); @@ -2839,7 +2839,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker) cache->flag &= ~PTCACHE_BAKED; } } - else for(SETLOOPER(scene, sce_iter, base)) { + else for (SETLOOPER(scene, sce_iter, base)) { /* cache/bake everything in the scene */ BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); @@ -2928,7 +2928,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker) BKE_ptcache_write(pid, 0); } } - else for(SETLOOPER(scene, sce_iter, base)) { + else for (SETLOOPER(scene, sce_iter, base)) { BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); for (pid=pidlist.first; pid; pid=pid->next) { diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 21f724732ec..3aadfa309c5 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -141,7 +141,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) /* clear the error list */ BLI_dynlib_get_error_as_string(NULL); - /* if(pis->handle) BLI_dynlib_close(pis->handle); */ + /* if (pis->handle) BLI_dynlib_close(pis->handle); */ /* pis->handle= 0; */ /* open the needed object */ diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index cd1b05971f5..3f40c2bd429 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -109,7 +109,7 @@ void open_plugin_tex(PluginTex *pit) BLI_dynlib_get_error_as_string(NULL); /* no BLI_dynlib_close! multiple opened plugins... */ - /* if(pit->handle) BLI_dynlib_close(pit->handle); */ + /* if (pit->handle) BLI_dynlib_close(pit->handle); */ /* pit->handle= 0; */ /* open the needed object */ @@ -376,7 +376,7 @@ int do_colorband(const ColorBand *coba, float in, float out[4]) CBData left, right; /* we're looking for first pos > in */ - for (a=0; a<coba->tot; a++, cbd1++) if(cbd1->pos > in) break; + for (a=0; a<coba->tot; a++, cbd1++) if (cbd1->pos > in) break; if (a==coba->tot) { cbd2= cbd1-1; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 24087d625f0..bdecc6884ea 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1382,7 +1382,7 @@ int BKE_tracking_next(MovieTrackingContext *context) if (!ibuf_new) return 0; - #pragma omp parallel for private(a) shared(ibuf_new, ok) if(map_size>1) + #pragma omp parallel for private(a) shared(ibuf_new, ok) if (map_size>1) for (a= 0; a<map_size; a++) { TrackContext *track_context = NULL; MovieTrackingTrack *track; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 90031d961c3..641d0373a64 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -657,7 +657,7 @@ static int scanfill(PolyFill *pf) ed2= ed1->next; /* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */ - /* if(callLocalInterruptCallBack()) break; */ + /* if (callLocalInterruptCallBack()) break; */ if (totface>maxface) { /* printf("Fill error: endless loop. Escaped at vert %d, tot: %d.\n", a, verts); */ a= verts; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index cce1d2136e2..01ebd1dce57 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -262,7 +262,7 @@ static void bli_builddir(const char *dirname, const char *relname) if (files) { dlink = (struct dirlink *) dirbase->first; - while(dlink) { + while (dlink) { memset(&files[actnum], 0 , sizeof(struct direntry)); files[actnum].relname = dlink->name; files[actnum].path = BLI_strdupcat(dirname, dlink->name); diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 17edc18b7bb..19d9c2a9c65 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -79,7 +79,7 @@ static void *thread_tls_data; * BLI_init_threads(&lb, do_something_func, maxthreads); * * while (cont) { - * if(BLI_available_threads(&lb) && !(escape loop event)) { + * if (BLI_available_threads(&lb) && !(escape loop event)) { * // get new job (data pointer) * // tag job 'processed * BLI_insert_thread(&lb, job); @@ -88,17 +88,17 @@ static void *thread_tls_data; * * // find if a job is ready, this the do_something_func() should write in job somewhere * cont= 0; - * for(go over all jobs) - * if(job is ready) { - * if(job was not removed) { + * for (go over all jobs) + * if (job is ready) { + * if (job was not removed) { * BLI_remove_thread(&lb, job); * } * } * else cont= 1; * } * // conditions to exit loop - * if(if escape loop event) { - * if(BLI_available_threadslots(&lb)==maxthreads) + * if (if escape loop event) { + * if (BLI_available_threadslots(&lb)==maxthreads) * break; * } * } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0026f3fa74d..6f4ceb78157 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -432,7 +432,7 @@ static void add_main_to_main(Main *mainvar, Main *from) set_listbasepointers(mainvar, lbarray); a= set_listbasepointers(from, fromarray); - while(a--) { + while (a--) { BLI_movelisttolist(lbarray[a], fromarray[a]); } } @@ -457,11 +457,11 @@ static void split_libdata(ListBase *lb, Main *first) Main *mainvar; id= lb->first; - while(id) { + while (id) { idnext= id->next; if (id->lib) { mainvar= first; - while(mainvar) { + while (mainvar) { if (mainvar->curlib==id->lib) { lbn= which_libbase(mainvar, GS(id->name)); BLI_remlink(lb, id); @@ -495,7 +495,7 @@ void blo_split_main(ListBase *mainlist, Main *main) } i= set_listbasepointers(main, lbarray); - while(i--) + while (i--) split_libdata(lbarray[i], main->next); } @@ -908,7 +908,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s chunk= filedata->memfile->chunks.first; seek= 0; - while(chunk) { + while (chunk) { if (seek + chunk->size > (unsigned) filedata->seek) break; seek+= chunk->size; chunk= chunk->next; @@ -946,7 +946,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s totread += readsize; filedata->seek += readsize; seek += readsize; - } while(totread < size); + } while (totread < size); return totread; } @@ -1363,7 +1363,7 @@ void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd) for (ptr= ptr->next; ptr; ptr= ptr->next) { int i= set_listbasepointers(ptr, lbarray); - while(i--) { + while (i--) { ID *id; for (id= lbarray[i]->first; id; id= id->next) oldnewmap_insert(fd->libmap, id, id, GS(id->name)); @@ -1384,7 +1384,7 @@ static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead) blocksize= filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ]; nblocks= bhead->nr; - while(nblocks--) { + while (nblocks--) { DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data); data+= blocksize; @@ -1423,7 +1423,7 @@ static void link_list(FileData *fd, ListBase *lb) /* only direct data */ lb->first= newdataadr(fd, lb->first); ln= lb->first; prev= NULL; - while(ln) { + while (ln) { ln->next= newdataadr(fd, ln->next); ln->prev= prev; prev= ln; @@ -1446,7 +1446,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ ln= lb->first; prev= NULL; - while(ln) { + while (ln) { poin= newdataadr(fd, ln->next); if (ln->next) { oldnewmap_insert(fd->globmap, ln->next, poin, 0); @@ -1480,7 +1480,7 @@ static void test_pointer_array(FileData *fd, void **mat) ipoin=imat= MEM_mallocN( len*4, "newmatar"); lpoin= *mat; - while(len-- > 0) { + while (len-- > 0) { if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) SWITCH_LONGINT(*lpoin); *ipoin= (int) ((*lpoin) >> 3); @@ -1495,7 +1495,7 @@ static void test_pointer_array(FileData *fd, void **mat) lpoin=lmat= MEM_mallocN( len*8, "newmatar"); ipoin= *mat; - while(len-- > 0) { + while (len-- > 0) { *lpoin= *ipoin; ipoin++; lpoin++; @@ -1724,7 +1724,7 @@ static void lib_link_ipo(FileData *fd, Main *main) Ipo *ipo; ipo= main->ipo.first; - while(ipo) { + while (ipo) { if (ipo->id.flag & LIB_NEEDLINK) { IpoCurve *icu; for (icu= ipo->curve.first; icu; icu= icu->next) { @@ -1744,7 +1744,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo) link_list(fd, &(ipo->curve)); icu= ipo->curve.first; - while(icu) { + while (icu) { icu->bezt= newdataadr(fd, icu->bezt); icu->bp= newdataadr(fd, icu->bp); icu->driver= newdataadr(fd, icu->driver); @@ -2582,7 +2582,7 @@ static void lib_link_armature(FileData *fd, Main *main) arm= main->armature.first; - while(arm) { + while (arm) { if (arm->id.flag & LIB_NEEDLINK) { if (arm->adt) lib_link_animdata(fd, &arm->id, arm->adt); arm->id.flag -= LIB_NEEDLINK; @@ -2636,7 +2636,7 @@ static void lib_link_camera(FileData *fd, Main *main) Camera *ca; ca= main->camera.first; - while(ca) { + while (ca) { if (ca->id.flag & LIB_NEEDLINK) { if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt); @@ -2666,7 +2666,7 @@ static void lib_link_lamp(FileData *fd, Main *main) int a; la= main->lamp.first; - while(la) { + while (la) { if (la->id.flag & LIB_NEEDLINK) { if (la->adt) lib_link_animdata(fd, &la->id, la->adt); @@ -2718,7 +2718,7 @@ static void lib_link_key(FileData *fd, Main *main) Key *key; key= main->key.first; - while(key) { + while (key) { /*check if we need to generate unique ids for the shapekeys*/ if (!key->uidgen) { KeyBlock *block; @@ -2754,14 +2754,14 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb) cp= key->elemstr; poin= data; - while( cp[0] ) { /* cp[0]==amount */ + while ( cp[0] ) { /* cp[0]==amount */ switch(cp[1]) { /* cp[1]= type */ case IPO_FLOAT: case IPO_BPOINT: case IPO_BEZTRIPLE: b= cp[0]; - while(b--) { + while (b--) { SWITCH_INT((*poin)); poin+= 4; } @@ -2787,7 +2787,7 @@ static void direct_link_key(FileData *fd, Key *key) key->refkey= newdataadr(fd, key->refkey); kb= key->block.first; - while(kb) { + while (kb) { kb->data= newdataadr(fd, kb->data); @@ -2806,7 +2806,7 @@ static void lib_link_mball(FileData *fd, Main *main) int a; mb= main->mball.first; - while(mb) { + while (mb) { if (mb->id.flag & LIB_NEEDLINK) { if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt); @@ -2846,7 +2846,7 @@ static void lib_link_world(FileData *fd, Main *main) int a; wrld= main->world.first; - while(wrld) { + while (wrld) { if (wrld->id.flag & LIB_NEEDLINK) { if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt); @@ -2895,7 +2895,7 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main) VFont *vf; vf= main->vfont.first; - while(vf) { + while (vf) { if (vf->id.flag & LIB_NEEDLINK) { vf->id.flag -= LIB_NEEDLINK; } @@ -2916,7 +2916,7 @@ static void lib_link_text(FileData *UNUSED(fd), Main *main) Text *text; text= main->text.first; - while(text) { + while (text) { if (text->id.flag & LIB_NEEDLINK) { text->id.flag -= LIB_NEEDLINK; } @@ -2950,7 +2950,7 @@ static void direct_link_text(FileData *fd, Text *text) text->sell= newdataadr(fd, text->sell); ln= text->lines.first; - while(ln) { + while (ln) { ln->line= newdataadr(fd, ln->line); ln->format= NULL; @@ -2993,7 +2993,7 @@ static void link_ibuf_list(FileData *fd, ListBase *lb) lb->first= newimaadr(fd, lb->first); ln= lb->first; prev= NULL; - while(ln) { + while (ln) { ln->next= newimaadr(fd, ln->next); ln->prev= prev; prev= ln; @@ -3046,7 +3046,7 @@ static void lib_link_curve(FileData *fd, Main *main) int a; cu= main->curve.first; - while(cu) { + while (cu) { if (cu->id.flag & LIB_NEEDLINK) { if (cu->adt) lib_link_animdata(fd, &cu->id, cu->adt); @@ -3076,13 +3076,13 @@ static void switch_endian_knots(Nurb *nu) if (nu->knotsu) { len= KNOTSU(nu); - while(len--) { + while (len--) { SWITCH_INT(nu->knotsu[len]); } } if (nu->knotsv) { len= KNOTSV(nu); - while(len--) { + while (len--) { SWITCH_INT(nu->knotsv[len]); } } @@ -3129,7 +3129,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->editfont= NULL; nu= cu->nurb.first; - while(nu) { + while (nu) { nu->bezt= newdataadr(fd, nu->bezt); nu->bp= newdataadr(fd, nu->bp); nu->knotsu= newdataadr(fd, nu->knotsu); @@ -3152,7 +3152,7 @@ static void lib_link_texture(FileData *fd, Main *main) Tex *tex; tex= main->tex.first; - while(tex) { + while (tex) { if (tex->id.flag & LIB_NEEDLINK) { if (tex->adt) lib_link_animdata(fd, &tex->id, tex->adt); @@ -3238,7 +3238,7 @@ static void lib_link_material(FileData *fd, Main *main) int a; ma= main->mat.first; - while(ma) { + while (ma) { if (ma->id.flag & LIB_NEEDLINK) { if (ma->adt) lib_link_animdata(fd, &ma->id, ma->adt); @@ -3383,7 +3383,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) int a; part= main->particle.first; - while(part) { + while (part) { if (part->id.flag & LIB_NEEDLINK) { if (part->adt) lib_link_animdata(fd, &part->id, part->adt); part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system @@ -3679,7 +3679,7 @@ static void lib_link_mesh(FileData *fd, Main *main) Mesh *me; me= main->mesh.first; - while(me) { + while (me) { if (me->id.flag & LIB_NEEDLINK) { int i; @@ -3951,7 +3951,7 @@ static void lib_link_latt(FileData *fd, Main *main) Lattice *lt; lt= main->latt.first; - while(lt) { + while (lt) { if (lt->id.flag & LIB_NEEDLINK) { if (lt->adt) lib_link_animdata(fd, <->id, lt->adt); @@ -4006,7 +4006,7 @@ static void lib_link_object(FileData *fd, Main *main) int warn=0, a; ob= main->object.first; - while(ob) { + while (ob) { if (ob->id.flag & LIB_NEEDLINK) { if (ob->id.properties) IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); if (ob->adt) lib_link_animdata(fd, &ob->id, ob->adt); @@ -4095,7 +4095,7 @@ static void lib_link_object(FileData *fd, Main *main) } sens= ob->sensors.first; - while(sens) { + while (sens) { for (a=0; a<sens->totlinks; a++) sens->links[a]= newglobadr(fd, sens->links[a]); @@ -4112,7 +4112,7 @@ static void lib_link_object(FileData *fd, Main *main) } cont= ob->controllers.first; - while(cont) { + while (cont) { for (a=0; a<cont->totlinks; a++) cont->links[a]= newglobadr(fd, cont->links[a]); @@ -4127,7 +4127,7 @@ static void lib_link_object(FileData *fd, Main *main) } act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_SOUND) { bSoundActuator *sa= act->data; sa->sound= newlibadr_us(fd, ob->id.lib, sa->sound); @@ -4591,7 +4591,7 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->effect); paf= ob->effect.first; - while(paf) { + while (paf) { if (paf->type==EFF_PARTICLE) { paf->keys= NULL; } @@ -4674,7 +4674,7 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->prop); prop= ob->prop.first; - while(prop) { + while (prop) { prop->poin= newdataadr(fd, prop->poin); if (prop->poin==NULL) prop->poin= &prop->data; prop= prop->next; @@ -4682,7 +4682,7 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->sensors); sens= ob->sensors.first; - while(sens) { + while (sens) { sens->data= newdataadr(fd, sens->data); sens->links= newdataadr(fd, sens->links); test_pointer_array(fd, (void **)&sens->links); @@ -4700,7 +4700,7 @@ static void direct_link_object(FileData *fd, Object *ob) ob->state = 1; } cont= ob->controllers.first; - while(cont) { + while (cont) { cont->data= newdataadr(fd, cont->data); cont->links= newdataadr(fd, cont->links); test_pointer_array(fd, (void **)&cont->links); @@ -4711,7 +4711,7 @@ static void direct_link_object(FileData *fd, Object *ob) link_glob_list(fd, &ob->actuators); act= ob->actuators.first; - while(act) { + while (act) { act->data= newdataadr(fd, act->data); act= act->next; } @@ -4793,7 +4793,7 @@ static void lib_link_scene(FileData *fd, Main *main) TimeMarker *marker; sce= main->scene.first; - while(sce) { + while (sce) { if (sce->id.flag & LIB_NEEDLINK) { /*Link ID Properties -- and copy this comment EXACTLY for easy finding of library blocks that implement this.*/ @@ -5227,7 +5227,7 @@ static void lib_link_screen(FileData *fd, Main *main) sc->animtimer= NULL; /* saved in rare cases */ sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl; sa->full= newlibadr(fd, sc->id.lib, sa->full); @@ -5398,7 +5398,7 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user) ID *idn= lb->first; char *name= id->name+2; - while(idn) { + while (idn) { if (idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) { if (idn->lib==id->lib) { if (user && idn->us==0) idn->us++; @@ -5471,7 +5471,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) copy_v3_v3(sc->scene->cursor, oldscene->cursor); sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { @@ -5906,7 +5906,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc) link_list(fd, &sconsole->scrollback); link_list(fd, &sconsole->history); - //for(cl= sconsole->scrollback.first; cl; cl= cl->next) + //for (cl= sconsole->scrollback.first; cl; cl= cl->next) // cl->line= newdataadr(fd, cl->line); /*comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression, @@ -6032,7 +6032,7 @@ static void lib_link_speaker(FileData *fd, Main *main) Speaker *spk; spk= main->speaker.first; - while(spk) { + while (spk) { if (spk->id.flag & LIB_NEEDLINK) { if (spk->adt) lib_link_animdata(fd, &spk->id, spk->adt); @@ -6080,7 +6080,7 @@ static void lib_link_sound(FileData *fd, Main *main) bSound *sound; sound= main->sound.first; - while(sound) { + while (sound) { if (sound->id.flag & LIB_NEEDLINK) { sound->id.flag -= LIB_NEEDLINK; sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system @@ -6103,14 +6103,14 @@ static void lib_link_group(FileData *fd, Main *main) GroupObject *go; int add_us; - while(group) { + while (group) { if (group->id.flag & LIB_NEEDLINK) { group->id.flag -= LIB_NEEDLINK; add_us= 0; go= group->gobject.first; - while(go) { + while (go) { go->ob= newlibadr(fd, group->id.lib, go->ob); if (go->ob) { go->ob->flag |= OB_FROMGROUP; @@ -6142,7 +6142,7 @@ static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase) link_list(fd, tracksbase); track= tracksbase->first; - while(track) { + while (track) { track->markers= newdataadr(fd, track->markers); track= track->next; @@ -6178,7 +6178,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) link_list(fd, &tracking->objects); object= tracking->objects.first; - while(object) { + while (object) { direct_link_movieTracks(fd, &object->tracks); direct_link_movieReconstruction(fd, &object->reconstruction); @@ -6191,7 +6191,7 @@ static void lib_link_movieclip(FileData *fd, Main *main) MovieClip *clip; clip= main->movieclip.first; - while(clip) { + while (clip) { if (clip->id.flag & LIB_NEEDLINK) { if (clip->adt) lib_link_animdata(fd, &clip->id, clip->adt); @@ -6248,7 +6248,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a { bhead = blo_nextbhead(fd, bhead); - while(bhead && bhead->code==DATA) { + while (bhead && bhead->code==DATA) { void *data; #if 0 /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */ @@ -6615,7 +6615,7 @@ static void sort_shape_fix(Main *main) KeyBlock *kb; int sorted= 0; - while(sorted==0) { + while (sorted==0) { sorted= 1; for (key= main->key.first; key; key= key->id.next) { for (kb= key->block.first; kb; kb= kb->next) { @@ -7303,7 +7303,7 @@ static PartEff *do_version_give_parteff_245(Object *ob) PartEff *paf; paf= ob->effect.first; - while(paf) { + while (paf) { if (paf->type==EFF_PARTICLE) return paf; paf= paf->next; } @@ -7324,7 +7324,7 @@ static void do_version_free_effects_245(ListBase *lb) Effect *eff; eff= lb->first; - while(eff) { + while (eff) { BLI_remlink(lb, eff); do_version_free_effect_245(eff); eff= lb->first; @@ -7471,7 +7471,7 @@ static void do_versions_seq_unique_name_all_strips( { Sequence * seq = seqbasep->first; - while(seq) { + while (seq) { seqbase_unique_name_recursive(&sce->ed->seqbase, seq); if (seq->seqbase.first) { do_versions_seq_unique_name_all_strips( @@ -7812,7 +7812,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile == 100) { /* tex->extend and tex->imageflag have changed: */ Tex *tex = main->tex.first; - while(tex) { + while (tex) { if (tex->id.flag & LIB_NEEDLINK) { if (tex->extend==0) { @@ -7830,7 +7830,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 101) { /* frame mapping */ Scene *sce = main->scene.first; - while(sce) { + while (sce) { sce->r.framapto= 100; sce->r.images= 100; sce->r.framelen= 1.0; @@ -7840,7 +7840,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 102) { /* init halo's at 1.0 */ Material *ma = main->mat.first; - while(ma) { + while (ma) { ma->add= 1.0; ma= ma->id.next; } @@ -7849,7 +7849,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* new variable in object: colbits */ Object *ob = main->object.first; int a; - while(ob) { + while (ob) { ob->colbits= 0; if (ob->totcol) { for (a=0; a<ob->totcol; a++) { @@ -7862,7 +7862,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 104) { /* timeoffs moved */ Object *ob = main->object.first; - while(ob) { + while (ob) { if (ob->transflag & 1) { ob->transflag -= 1; //ob->ipoflag |= OB_OFFS_OB; @@ -7872,7 +7872,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 105) { Object *ob = main->object.first; - while(ob) { + while (ob) { ob->dupon= 1; ob->dupoff= 0; ob->dupsta= 1; ob->dupend= 100; ob= ob->id.next; @@ -7881,7 +7881,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 106) { /* mcol changed */ Mesh *me = main->mesh.first; - while(me) { + while (me) { if (me->mcol) vcol_to_fcol(me); me= me->id.next; } @@ -7890,12 +7890,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 107) { Object *ob; Scene *sce = main->scene.first; - while(sce) { + while (sce) { sce->r.mode |= R_GAMMA; sce= sce->id.next; } ob= main->object.first; - while(ob) { + while (ob) { //ob->ipoflag |= OB_OFFS_PARENT; if (ob->dt==0) ob->dt= OB_SOLID; ob= ob->id.next; @@ -7905,9 +7905,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 109) { /* new variable: gridlines */ bScreen *sc = main->screen.first; - while(sc) { + while (sc) { ScrArea *sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl= sa->spacedata.first; while (sl) { if (sl->spacetype==SPACE_VIEW3D) { @@ -7924,7 +7924,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 113) { Material *ma = main->mat.first; - while(ma) { + while (ma) { if (ma->flaresize==0.0f) ma->flaresize= 1.0f; ma->subsize= 1.0f; ma->flareboost= 1.0f; @@ -7963,21 +7963,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 153) { Scene *sce = main->scene.first; - while(sce) { + while (sce) { if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f; sce= sce->id.next; } } if (main->versionfile <= 163) { Scene *sce = main->scene.first; - while(sce) { + while (sce) { if (sce->r.frs_sec==0) sce->r.frs_sec= 25; sce= sce->id.next; } } if (main->versionfile <= 164) { Mesh *me= main->mesh.first; - while(me) { + while (me) { me->smoothresh= 30; me= me->id.next; } @@ -7988,11 +7988,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) int nr; char *cp; - while(me) { + while (me) { if (me->tface) { nr= me->totface; tface= me->tface; - while(nr--) { + while (nr--) { cp= (char *)&tface->col[0]; if (cp[1]>126) cp[1]= 255; else cp[1]*=2; if (cp[2]>126) cp[2]= 255; else cp[2]*=2; @@ -8019,7 +8019,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 169) { Mesh *me= main->mesh.first; - while(me) { + while (me) { if (me->subdiv==0) me->subdiv= 1; me= me->id.next; } @@ -8027,11 +8027,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 169) { bScreen *sc= main->screen.first; - while(sc) { + while (sc) { ScrArea *sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl= sa->spacedata.first; - while(sl) { + while (sl) { if (sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo*) sl; sipo->v2d.max[0]= 15000.0; @@ -8060,11 +8060,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 171) { bScreen *sc= main->screen.first; - while(sc) { + while (sc) { ScrArea *sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl= sa->spacedata.first; - while(sl) { + while (sl) { if (sl->spacetype==SPACE_TEXT) { SpaceText *st= (SpaceText*) sl; st->lheight= 12; @@ -8080,7 +8080,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 173) { int a, b; Mesh *me= main->mesh.first; - while(me) { + while (me) { if (me->tface) { TFace *tface= me->tface; for (a=0; a<me->totface; a++, tface++) { @@ -8099,12 +8099,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma = main->mat.first; /* let faces have default add factor of 0.0 */ - while(ma) { + while (ma) { if (!(ma->mode & MA_HALO)) ma->add = 0.0; ma = ma->id.next; } - while(ob) { + while (ob) { ob->mass= 1.0f; ob->damping= 0.1f; /*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */ @@ -8114,7 +8114,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 193) { Object *ob= main->object.first; - while(ob) { + while (ob) { ob->inertia= 1.0f; ob->rdamping= 0.1f; ob= ob->id.next; @@ -8124,7 +8124,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 196) { Mesh *me= main->mesh.first; int a, b; - while(me) { + while (me) { if (me->tface) { TFace *tface= me->tface; for (a=0; a<me->totface; a++, tface++) { @@ -8140,7 +8140,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 200) { Object *ob= main->object.first; - while(ob) { + while (ob) { ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS); /* 64 is do_fh */ ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS); @@ -8194,9 +8194,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob= main->object.first; bActuator *act; bObjectActuator *oa; - while(ob) { + while (ob) { act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_OBJECT) { oa= act->data; oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */ @@ -8213,13 +8213,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bActuator *act; bObjectActuator *oa; bSound *sound; - while(ob) { + while (ob) { /* please check this for demo20 files like * original Egypt levels etc. converted * rotation factor of 50 is not workable */ act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_OBJECT) { oa= act->data; @@ -8253,7 +8253,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bEditObjectActuator *oa; bRaySensor *rs; bCollisionSensor *cs; - while(ob) { + while (ob) { /* Set anisotropic friction off for old objects, * values to 1.0. */ ob->gameflag &= ~OB_ANISOTROPIC_FRICTION; @@ -8262,7 +8262,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ob->anisotropicFriction[2] = 1.0; act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_EDIT_OBJECT) { /* Zero initial velocity for newly * added objects */ @@ -8323,16 +8323,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* added alpha in obcolor */ ob= main->object.first; - while(ob) { + while (ob) { ob->col[3]= 1.0; ob= ob->id.next; } /* added alpha in obcolor */ ob= main->object.first; - while(ob) { + while (ob) { act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_OBJECT) { /* multiply velocity with 50 in old files */ oa= act->data; @@ -8381,7 +8381,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while (ob) { prop= ob->prop.first; - while(prop) { + while (prop) { if (prop->type == GPROP_TIME) { // convert old GPROP_TIME values from int to float *((float *)&prop->data) = (float) prop->data; @@ -8466,7 +8466,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce= main->scene.first; // new variables for std-alone player and runtime - while(sce) { + while (sce) { sce->r.xplay= 640; sce->r.yplay= 480; @@ -8480,7 +8480,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce= main->scene.first; // new variables for std-alone player and runtime - while(sce) { + while (sce) { sce->r.depth= 32; @@ -8803,9 +8803,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 231) { /* new bit flags for showing/hiding grid floor and axes */ bScreen *sc = main->screen.first; - while(sc) { + while (sc) { ScrArea *sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl= sa->spacedata.first; while (sl) { if (sl->spacetype==SPACE_VIEW3D) { @@ -8833,7 +8833,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) World *wrld; /* introduction of raytrace */ - while(ma) { + while (ma) { if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f; if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f; @@ -8846,12 +8846,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma= ma->id.next; } sce= main->scene.first; - while(sce) { + while (sce) { if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f; sce= sce->id.next; } la= main->lamp.first; - while(la) { + while (la) { if (la->k==0.0f) la->k= 1.0; if (la->ray_samp==0) la->ray_samp= 1; if (la->ray_sampy==0) la->ray_sampy= 1; @@ -8862,7 +8862,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) la= la->id.next; } wrld= main->world.first; - while(wrld) { + while (wrld) { if (wrld->range==0.0f) { wrld->range= 1.0f/wrld->exposure; } @@ -8871,9 +8871,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* new bit flags for showing/hiding grid floor and axes */ - while(sc) { + while (sc) { ScrArea *sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl= sa->spacedata.first; while (sl) { if (sl->spacetype==SPACE_VIEW3D) { @@ -8899,7 +8899,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bScreen *sc; Scene *sce; - while(tex) { + while (tex) { if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) { tex->flag |= TEX_CHECKER_ODD; } @@ -8921,7 +8921,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex= tex->id.next; } - while(wrld) { + while (wrld) { if (wrld->aodist==0.0f) { wrld->aodist= 10.0f; wrld->aobias= 0.05f; @@ -8950,7 +8950,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } sce= main->scene.first; - while(sce) { + while (sce) { if (sce->r.ocres==0) sce->r.ocres= 64; sce= sce->id.next; } @@ -8961,7 +8961,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma= main->mat.first; /* Object *ob= main->object.first; */ - while(ma) { + while (ma) { if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0; if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0; if (ma->pr_lamp==0) ma->pr_lamp= 3; @@ -8970,7 +8970,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* this should have been done loooong before! */ #if 0 /* deprecated in 2.5+ */ - while(ob) { + while (ob) { if (ob->ipowin==0) ob->ipowin= ID_OB; ob= ob->id.next; } @@ -9024,11 +9024,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Sequence *seq; Editing *ed; - while(tex) { + while (tex) { if (tex->nabla==0.0f) tex->nabla= 0.025f; tex= tex->id.next; } - while(sce) { + while (sce) { ed= sce->ed; if (ed) { SEQ_BEGIN(sce->ed, seq) { @@ -9047,7 +9047,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma; bScreen *sc; - while(cam) { + while (cam) { if (cam->ortho_scale==0.0f) { cam->ortho_scale= 256.0f/cam->lens; if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n"); @@ -9176,7 +9176,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Key *key; Scene *sce= main->scene.first; - while(sce) { + while (sce) { if (sce->toolsettings == NULL) { sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct"); sce->toolsettings->cornertype=0; @@ -9506,7 +9506,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { @@ -9832,7 +9832,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { @@ -10810,7 +10810,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Sequence *seq; Editing *ed; - while(sce) { + while (sce) { ed= sce->ed; if (ed) { SEQP_BEGIN(ed, seq) { @@ -10994,7 +10994,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) //BKE_ptcache_ids_from_object(&pidlist, ob); - //for(pid=pidlist.first; pid; pid=pid->next) + //for (pid=pidlist.first; pid; pid=pid->next) // pid->cache->flag |= PTCACHE_DISK_CACHE; //BLI_freelistN(&pidlist); @@ -11023,7 +11023,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (ob = main->object.first; ob; ob = ob->id.next) { //BKE_ptcache_ids_from_object(&pidlist, ob); - //for(pid=pidlist.first; pid; pid=pid->next) { + //for (pid=pidlist.first; pid; pid=pid->next) { // if (pid->ptcaches->first == NULL) // pid->ptcaches->first = pid->ptcaches->last = pid->cache; //} @@ -11290,7 +11290,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */ - if (do_gravity) for(part= main->particle.first; part; part= part->id.next) + if (do_gravity) for (part= main->particle.first; part; part= part->id.next) part->effector_weights->global_gravity = part->acc[2]/-9.81f; for (ob = main->object.first; ob; ob = ob->id.next) { @@ -11412,7 +11412,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { { Scene *sce= main->scene.first; - while(sce) { + while (sce) { if (sce->r.frame_step==0) sce->r.frame_step= 1; if (sce->r.mblur_samples==0) @@ -11429,10 +11429,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* ensure all nodes have unique names */ bNodeTree *ntree= main->nodetree.first; - while(ntree) { + while (ntree) { bNode *node=ntree->nodes.first; - while(node) { + while (node) { nodeUniqueName(ntree, node); node= node->next; } @@ -11487,7 +11487,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (convert) { - while(ma) { + while (ma) { if (ma->ramp_col) { ColorBand *band = (ColorBand *)ma->ramp_col; for (i=0; i<band->tot; i++) { @@ -11510,7 +11510,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma=ma->id.next; } - while(tex) { + while (tex) { if (tex->coba) { ColorBand *band = (ColorBand *)tex->coba; for (i=0; i<band->tot; i++) { @@ -11521,7 +11521,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex=tex->id.next; } - while(wo) { + while (wo) { srgb_to_linearrgb_v3_v3(&wo->ambr, &wo->ambr); srgb_to_linearrgb_v3_v3(&wo->horr, &wo->horr); srgb_to_linearrgb_v3_v3(&wo->zenr, &wo->zenr); @@ -11967,7 +11967,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (scene->nodetree) { bNode *node=scene->nodetree->nodes.first; - while(node) { + while (node) { if (node->type == CMP_NODE_COLORBALANCE) { NodeColorBalance *n= (NodeColorBalance *)node->storage; n->lift[0] += 1.f; @@ -11982,7 +11982,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) { bNode *node=ntree->nodes.first; - while(node) { + while (node) { if (node->type == CMP_NODE_COLORBALANCE) { NodeColorBalance *n= (NodeColorBalance *)node->storage; n->lift[0] += 1.f; @@ -12331,7 +12331,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */ for (ob= main->object.first; ob; ob= ob->id.next) { bActuator *act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_OBJECT) { /* multiply velocity with 50 in old files */ bObjectActuator *oa= act->data; @@ -12383,7 +12383,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Fix for sample line scope initializing with no height */ for (sc= main->screen.first; sc; sc= sc->id.next) { sa= sc->areabase.first; - while(sa) { + while (sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { if (sl->spacetype==SPACE_IMAGE) { @@ -12954,7 +12954,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) clip->tracking.camera.pixel_aspect= 1.f; track= clip->tracking.tracks.first; - while(track) { + while (track) { if (track->pyramid_levels==0) track->pyramid_levels= 2; @@ -13100,7 +13100,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (tracking->objects.first == NULL) BKE_tracking_new_object(tracking, "Camera"); - while(tracking_object) { + while (tracking_object) { if (!tracking_object->scale) tracking_object->scale= 1.0f; @@ -13472,7 +13472,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) bfd->type= BLENFILETYPE_BLEND; BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); - while(bhead) { + while (bhead) { switch(bhead->code) { case DATA: case DNA1: @@ -13651,7 +13651,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) if (id==NULL) { read_libblock(fd, ptr, bhead, LIB_READ+LIB_INDIRECT, NULL); // commented because this can print way too much - // if(G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name); + // if (G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name); /* for outliner dependency only */ ptr->curlib->parent= mainvar->curlib; @@ -13671,7 +13671,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) change_idid_adr_fd(fd, bhead->old, id); // commented because this can print way too much - // if(G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name); + // if (G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name); } MEM_freeN(lib); @@ -13687,7 +13687,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) happens which invokes same ID... in that case the lookup table needs this entry */ oldnewmap_insert(fd->libmap, bhead->old, id, 1); // commented because this can print way too much - // if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name); + // if (G.f & G_DEBUG) printf("expand: already read %s\n", id->name); } } } @@ -14174,7 +14174,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, psys->part); sens= ob->sensors.first; - while(sens) { + while (sens) { if (sens->type==SENS_TOUCH) { bTouchSensor *ts= sens->data; expand_doit(fd, mainvar, ts->ma); @@ -14187,7 +14187,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) } cont= ob->controllers.first; - while(cont) { + while (cont) { if (cont->type==CONT_PYTHON) { bPythonCont *pc= cont->data; expand_doit(fd, mainvar, pc->text); @@ -14196,7 +14196,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) } act= ob->actuators.first; - while(act) { + while (act) { if (act->type==ACT_SOUND) { bSoundActuator *sa= act->data; expand_doit(fd, mainvar, sa->sound); @@ -14357,14 +14357,14 @@ static void expand_main(FileData *fd, Main *mainvar) if (fd==NULL) return; - while(doit) { + while (doit) { doit= 0; a= set_listbasepointers(mainvar, lbarray); - while(a--) { + while (a--) { id= lbarray[a]->first; - while(id) { + while (id) { if (id->flag & LIB_TEST) { switch(GS(id->name)) { @@ -14770,7 +14770,7 @@ static int mainvar_count_libread_blocks(Main *mainvar) int a, tot= 0; a= set_listbasepointers(mainvar, lbarray); - while(a--) { + while (a--) { ID *id; for (id= lbarray[a]->first; id; id= id->next) @@ -14787,12 +14787,12 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) ListBase *lbarray[MAX_LIBARRAY]; int a, doit= 1; - while(doit) { + while (doit) { doit= 0; /* test 1: read libdata */ mainptr= mainl->next; - while(mainptr) { + while (mainptr) { int tot= mainvar_count_libread_blocks(mainptr); // printf("found LIB_READ %s\n", mainptr->curlib->name); @@ -14810,7 +14810,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* allow typing in a new lib path */ if (G.rt==-666) { - while(fd==NULL) { + while (fd==NULL) { char newlib_path[FILE_MAX] = { 0 }; printf("Missing library...'\n"); printf(" current file: %s\n", G.main->name); @@ -14857,10 +14857,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if (fd) { doit= 1; a= set_listbasepointers(mainptr, lbarray); - while(a--) { + while (a--) { ID *id= lbarray[a]->first; - while(id) { + while (id) { ID *idn= id->next; if (id->flag & LIB_READ) { ID *realid= NULL; @@ -14886,7 +14886,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* dang FileData... now new libraries need to be appended to original filedata, * it is not a good replacement for the old global (ton) */ - while( fd->mainlist.first ) { + while ( fd->mainlist.first ) { Main *mp= fd->mainlist.first; BLI_remlink(&fd->mainlist, mp); BLI_addtail(&basefd->mainlist, mp); @@ -14901,9 +14901,9 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* test if there are unread libblocks */ for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) { a= set_listbasepointers(mainptr, lbarray); - while(a--) { + while (a--) { ID *id= lbarray[a]->first; - while(id) { + while (id) { ID *idn= id->next; if (id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index bb66fa2d92c..32af95c3a84 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -267,7 +267,7 @@ static void mywrite( WriteData *wd, void *adr, int len) writedata_do_write(wd, adr, writelen); adr = (char*)adr + writelen; len -= writelen; - } while(len > 0); + } while (len > 0); return; } @@ -853,7 +853,7 @@ static void write_boid_state(WriteData *wd, BoidState *state) break; } } - //for(; cond; cond=cond->next) + //for (; cond; cond=cond->next) // writestruct(wd, DATA, "BoidCondition", 1, cond); } @@ -915,7 +915,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) int a; part= idbase->first; - while(part) { + while (part) { if (part->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_PA, "ParticleSettings", 1, part); @@ -931,7 +931,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) dw->index = 0; if (part->dup_group) { /* can be NULL if lining fails or set to None */ go = part->dup_group->gobject.first; - while(go && go->ob != dw->ob) { + while (go && go->ob != dw->ob) { go=go->next; dw->index++; } @@ -1004,7 +1004,7 @@ static void write_properties(WriteData *wd, ListBase *lb) bProperty *prop; prop= lb->first; - while(prop) { + while (prop) { writestruct(wd, DATA, "bProperty", 1, prop); if (prop->poin && prop->poin != &prop->data) @@ -1019,7 +1019,7 @@ static void write_sensors(WriteData *wd, ListBase *lb) bSensor *sens; sens= lb->first; - while(sens) { + while (sens) { writestruct(wd, DATA, "bSensor", 1, sens); writedata(wd, DATA, sizeof(void *)*sens->totlinks, sens->links); @@ -1080,7 +1080,7 @@ static void write_controllers(WriteData *wd, ListBase *lb) bController *cont; cont= lb->first; - while(cont) { + while (cont) { writestruct(wd, DATA, "bController", 1, cont); writedata(wd, DATA, sizeof(void *)*cont->totlinks, cont->links); @@ -1105,7 +1105,7 @@ static void write_actuators(WriteData *wd, ListBase *lb) bActuator *act; act= lb->first; - while(act) { + while (act) { writestruct(wd, DATA, "bActuator", 1, act); switch(act->type) { @@ -1412,7 +1412,7 @@ static void write_objects(WriteData *wd, ListBase *idbase) Object *ob; ob= idbase->first; - while(ob) { + while (ob) { if (ob->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_OB, "Object", 1, ob); @@ -1469,7 +1469,7 @@ static void write_vfonts(WriteData *wd, ListBase *idbase) PackedFile * pf; vf= idbase->first; - while(vf) { + while (vf) { if (vf->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_VF, "VFont", 1, vf); @@ -1495,7 +1495,7 @@ static void write_keys(WriteData *wd, ListBase *idbase) KeyBlock *kb; key= idbase->first; - while(key) { + while (key) { if (key->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_KE, "Key", 1, key); @@ -1505,7 +1505,7 @@ static void write_keys(WriteData *wd, ListBase *idbase) /* direct data */ kb= key->block.first; - while(kb) { + while (kb) { writestruct(wd, DATA, "KeyBlock", 1, kb); if (kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data); kb= kb->next; @@ -1523,7 +1523,7 @@ static void write_cameras(WriteData *wd, ListBase *idbase) Camera *cam; cam= idbase->first; - while(cam) { + while (cam) { if (cam->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_CA, "Camera", 1, cam); @@ -1542,7 +1542,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase) MetaElem *ml; mb= idbase->first; - while(mb) { + while (mb) { if (mb->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_MB, "MetaBall", 1, mb); @@ -1553,7 +1553,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase) if (mb->adt) write_animdata(wd, mb->adt); ml= mb->elems.first; - while(ml) { + while (ml) { writestruct(wd, DATA, "MetaElem", 1, ml); ml= ml->next; } @@ -1575,7 +1575,7 @@ static void write_curves(WriteData *wd, ListBase *idbase) Nurb *nu; cu= idbase->first; - while(cu) { + while (cu) { if (cu->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_CU, "Curve", 1, cu); @@ -1593,12 +1593,12 @@ static void write_curves(WriteData *wd, ListBase *idbase) else { /* is also the order of reading */ nu= cu->nurb.first; - while(nu) { + while (nu) { writestruct(wd, DATA, "Nurb", 1, nu); nu= nu->next; } nu= cu->nurb.first; - while(nu) { + while (nu) { if (nu->type == CU_BEZIER) writestruct(wd, DATA, "BezTriple", nu->pntsu, nu->bezt); else { @@ -1705,7 +1705,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase) #endif mesh= idbase->first; - while(mesh) { + while (mesh) { if (mesh->id.us>0 || wd->current) { /* write LibData */ if (!save_for_old_blender) { @@ -1837,7 +1837,7 @@ static void write_lattices(WriteData *wd, ListBase *idbase) Lattice *lt; lt= idbase->first; - while(lt) { + while (lt) { if (lt->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_LT, "Lattice", 1, lt); @@ -1888,7 +1888,7 @@ static void write_images(WriteData *wd, ListBase *idbase) ima= idbase->first; - while(ima) { + while (ima) { if (ima->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_IM, "Image", 1, ima); @@ -1913,7 +1913,7 @@ static void write_textures(WriteData *wd, ListBase *idbase) Tex *tex; tex= idbase->first; - while(tex) { + while (tex) { if (tex->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_TE, "Tex", 1, tex); @@ -1954,7 +1954,7 @@ static void write_materials(WriteData *wd, ListBase *idbase) int a; ma= idbase->first; - while(ma) { + while (ma) { if (ma->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_MA, "Material", 1, ma); @@ -1992,7 +1992,7 @@ static void write_worlds(WriteData *wd, ListBase *idbase) int a; wrld= idbase->first; - while(wrld) { + while (wrld) { if (wrld->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_WO, "World", 1, wrld); @@ -2022,7 +2022,7 @@ static void write_lamps(WriteData *wd, ListBase *idbase) int a; la= idbase->first; - while(la) { + while (la) { if (la->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_LA, "Lamp", 1, la); @@ -2066,7 +2066,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) ToolSettings *tos; sce= scebase->first; - while(sce) { + while (sce) { /* write LibData */ writestruct(wd, ID_SCE, "Scene", 1, sce); if (sce->id.properties) IDP_WriteProperty(sce->id.properties, wd); @@ -2076,7 +2076,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) /* direct data */ base= sce->base.first; - while(base) { + while (base) { writestruct(wd, DATA, "Base", 1, base); base= base->next; } @@ -2279,7 +2279,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase) ScrEdge *se; sc= scrbase->first; - while(sc) { + while (sc) { /* write LibData */ /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */ @@ -2309,7 +2309,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase) } sl= sa->spacedata.first; - while(sl) { + while (sl) { for (ar= sl->regionbase.first; ar; ar= ar->next) write_region(wd, ar, sl->spacetype); @@ -2431,7 +2431,7 @@ static void write_libraries(WriteData *wd, Main *main) /* test: is lib being used */ foundone= 0; - while(tot--) { + while (tot--) { for (id= lbarray[tot]->first; id; id= id->next) { if (id->us>0 && (id->flag & LIB_EXTERN)) { foundone= 1; @@ -2444,7 +2444,7 @@ static void write_libraries(WriteData *wd, Main *main) if (foundone) { writestruct(wd, ID_LI, "Library", 1, main->curlib); - while(a--) { + while (a--) { for (id= lbarray[a]->first; id; id= id->next) { if (id->us>0 && (id->flag & LIB_EXTERN)) { writestruct(wd, ID_ID, "ID", 1, id); @@ -2472,7 +2472,7 @@ static void write_bone(WriteData *wd, Bone* bone) // Write Children cbone= bone->childbase.first; - while(cbone) { + while (cbone) { write_bone(wd, cbone); cbone= cbone->next; } @@ -2493,7 +2493,7 @@ static void write_armatures(WriteData *wd, ListBase *idbase) /* Direct data */ bone= arm->bonebase.first; - while(bone) { + while (bone) { write_bone(wd, bone); bone=bone->next; } @@ -2512,7 +2512,7 @@ static void write_texts(WriteData *wd, ListBase *idbase) TextMarker *mrk; text= idbase->first; - while(text) { + while (text) { if ( (text->flags & TXT_ISMEM) && (text->flags & TXT_ISEXT)) text->flags &= ~TXT_ISEXT; /* write LibData */ @@ -2555,7 +2555,7 @@ static void write_speakers(WriteData *wd, ListBase *idbase) Speaker *spk; spk= idbase->first; - while(spk) { + while (spk) { if (spk->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_SPK, "Speaker", 1, spk); @@ -2574,7 +2574,7 @@ static void write_sounds(WriteData *wd, ListBase *idbase) PackedFile * pf; sound= idbase->first; - while(sound) { + while (sound) { if (sound->id.us>0 || wd->current) { /* write LibData */ writestruct(wd, ID_SO, "bSound", 1, sound); @@ -2605,7 +2605,7 @@ static void write_groups(WriteData *wd, ListBase *idbase) if (group->id.properties) IDP_WriteProperty(group->id.properties, wd); go= group->gobject.first; - while(go) { + while (go) { writestruct(wd, DATA, "GroupObject", 1, go); go= go->next; } @@ -2663,7 +2663,7 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks) MovieTrackingTrack *track; track= tracks->first; - while(track) { + while (track) { writestruct(wd, DATA, "MovieTrackingTrack", 1, track); if (track->markers) @@ -2684,7 +2684,7 @@ static void write_movieclips(WriteData *wd, ListBase *idbase) MovieClip *clip; clip= idbase->first; - while(clip) { + while (clip) { if (clip->id.us>0 || wd->current) { MovieTracking *tracking= &clip->tracking; MovieTrackingObject *object; @@ -2697,7 +2697,7 @@ static void write_movieclips(WriteData *wd, ListBase *idbase) write_movieReconstruction(wd, &tracking->reconstruction); object= tracking->objects.first; - while(object) { + while (object) { writestruct(wd, DATA, "MovieTrackingObject", 1, object); write_movieTracks(wd, &object->tracks); @@ -2855,7 +2855,7 @@ static int do_history(const char *name, ReportList *reports) return 1; } - while(hisnr > 1) { + while (hisnr > 1) { BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1); BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr); diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index d6eb406ced7..5f8ceeeebb3 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -40,7 +40,7 @@ void forEachObjectInScene(Scene *sce, Functor &f) void AnimationExporter::exportAnimations(Scene *sce) { - if(hasAnimations(sce)) { + if (hasAnimations(sce)) { this->scene = sce; openLibrary(); @@ -59,7 +59,7 @@ void AnimationExporter::operator() (Object *ob) /* bool isMatAnim = false; */ /* UNUSED */ //Export transform animations - if(ob->adt && ob->adt->action) + if (ob->adt && ob->adt->action) { fcu = (FCurve*)ob->adt->action->curves.first; @@ -88,7 +88,7 @@ void AnimationExporter::operator() (Object *ob) } //Export Lamp parameter animations - if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) + if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) { fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); while (fcu) { @@ -102,7 +102,7 @@ void AnimationExporter::operator() (Object *ob) } //Export Camera parameter animations - if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) + if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) { fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); while (fcu) { @@ -117,11 +117,11 @@ void AnimationExporter::operator() (Object *ob) } //Export Material parameter animations. - for(int a = 0; a < ob->totcol; a++) + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if (ma->adt && ma->adt->action) { /* isMatAnim = true; */ fcu = (FCurve*)ma->adt->action->curves.first; @@ -152,7 +152,7 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob ) { char * transformName = extract_transform_name( fcu->rna_path ); - if( !strcmp(transformName, "rotation_quaternion") ) { + if ( !strcmp(transformName, "rotation_quaternion") ) { for ( int i = 0 ; i < fcu->totvert ; i++){ *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1]; } @@ -184,7 +184,7 @@ std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) char* boneName = strtok((char *)rna_path.c_str(), "\""); boneName = strtok(NULL,"\""); - if( boneName != NULL ) + if ( boneName != NULL ) return /*id_name(ob) + "_" +*/ std::string(boneName); else return id_name(ob); @@ -257,7 +257,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa std::string output_id; //quat rotations are skipped for now, because of complications with determining axis. - if(quatRotation) + if (quatRotation) { float * eul = get_eul_source_for_quat(ob); float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); @@ -317,7 +317,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa target = get_camera_id(ob) + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true); - if( ma ) + if ( ma ) target = translate_id(id_name(ma)) + "-effect" +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true); } @@ -348,7 +348,7 @@ bool AnimationExporter::is_bone_deform_group(Bone * bone) { bool is_def; //Check if current bone is deform - if((bone->flag & BONE_NO_DEFORM) == 0 ) return true; + if ((bone->flag & BONE_NO_DEFORM) == 0 ) return true; //Check child bones else { @@ -374,11 +374,11 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B { std::string bone_name = getObjectBoneName(ob_arm,fcu); int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name); - if(val==0) break; + if (val==0) break; fcu = fcu->next; } - if(!(fcu)) return; + if (!(fcu)) return; bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); if (!pchan) return; @@ -779,7 +779,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob // SECOND_LIFE_COMPATIBILITY // AFAIK animation to second life is via BVH, but no // reason to not have the collada-animation be correct - if(export_settings->second_life) + if (export_settings->second_life) { float temp[4][4]; copy_m4_m4(temp, bone->arm_mat); @@ -788,7 +788,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob mult_m4_m4m4(mat, mat, temp); - if(bone->parent) + if (bone->parent) { copy_m4_m4(temp, bone->parent->arm_mat); temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; @@ -1134,21 +1134,21 @@ bool AnimationExporter::hasAnimations(Scene *sce) FCurve *fcu = 0; //Check for object transform animations - if(ob->adt && ob->adt->action) + if (ob->adt && ob->adt->action) fcu = (FCurve*)ob->adt->action->curves.first; //Check for Lamp parameter animations - else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) + else if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); //Check for Camera parameter animations - else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) + else if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); //Check Material Effect parameter animations. - for(int a = 0; a < ob->totcol; a++) + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if (ma->adt && ma->adt->action) { fcu = (FCurve*)ma->adt->action->curves.first; } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 097e9902de5..0e66a292e94 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -119,7 +119,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) bez.vec[1][1] = bc_get_float_value(output, j * dim + i); - if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || + if ( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); @@ -132,7 +132,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) // outtangent bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps; bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1); - if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) + if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) bez.ipo = BEZT_IPO_BEZ; else bez.ipo = BEZT_IPO_CONST; @@ -964,25 +964,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , if (ef != NULL) { /* can be NULL [#28909] */ const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); COLLADAFW::EffectCommon *efc = commonEffects[0]; - if((animType->material & MATERIAL_SHININESS) != 0){ + if ((animType->material & MATERIAL_SHININESS) != 0){ const COLLADAFW::FloatOrParam *shin = &(efc->getShininess()); const COLLADAFW::UniqueId& listid = shin->getAnimationList(); Assign_float_animations( listid, AnimCurves , "specular_hardness" ); } - if((animType->material & MATERIAL_IOR) != 0){ + if ((animType->material & MATERIAL_IOR) != 0){ const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); const COLLADAFW::UniqueId& listid = ior->getAnimationList(); Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); } - if((animType->material & MATERIAL_SPEC_COLOR) != 0){ + if ((animType->material & MATERIAL_SPEC_COLOR) != 0){ const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); Assign_color_animations( listid, AnimCurves , "specular_color" ); } - if((animType->material & MATERIAL_DIFF_COLOR) != 0){ + if ((animType->material & MATERIAL_DIFF_COLOR) != 0){ const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); Assign_color_animations( listid, AnimCurves , "diffuse_color" ); @@ -1185,7 +1185,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); if (ef != NULL) { /* can be NULL [#28909] */ const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - if(!commonEffects.empty()) { + if (!commonEffects.empty()) { COLLADAFW::EffectCommon *efc = commonEffects[0]; types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 47d41a9680f..743d3c2a158 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -193,7 +193,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, while( i != child_objects.end() ) { - if((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) + if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) { float backup_parinv[4][4]; copy_m4_m4(backup_parinv, (*i)->parentinv); @@ -210,7 +210,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, // TODO: when such objects are animated as // single matrix the tweak must be applied // to the result. - if(export_settings->second_life) + if (export_settings->second_life) { // tweak objects parentinverse to match compatibility float temp[4][4]; @@ -274,7 +274,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: } // SECOND_LIFE_COMPATIBILITY - if(export_settings->second_life) + if (export_settings->second_life) { // Remove rotations vs armature from transform // parent_rest_rot * mat * irest_rot @@ -285,7 +285,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: mult_m4_m4m4(mat, mat, temp); - if(bone->parent) + if (bone->parent) { copy_m4_m4(temp, bone->parent->arm_mat); temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; @@ -370,18 +370,18 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm) for (j = 0; j < vert->totweight; j++) { int joint_index = joint_index_by_def_index[vert->dw[j].def_nr]; - if(joint_index != -1 && vert->dw[j].weight > 0.0f) + if (joint_index != -1 && vert->dw[j].weight > 0.0f) { jw[joint_index] += vert->dw[j].weight; sumw += vert->dw[j].weight; } } - if(sumw > 0.0f) + if (sumw > 0.0f) { float invsumw = 1.0f/sumw; vcounts.push_back(jw.size()); - for(std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) + for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) { joints.push_back((*m).first); weights.push_back(invsumw*(*m).second); @@ -502,7 +502,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase float inv_bind_mat[4][4]; // SECOND_LIFE_COMPATIBILITY - if(export_settings->second_life) + if (export_settings->second_life) { // Only translations, no rotation vs armature float temp[4][4]; @@ -560,7 +560,7 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co source.prepareToAppendValues(); - for(std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) { + for (std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) { source.appendValues(*i); } @@ -597,7 +597,7 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou // write deformer index - weight index pairs int weight_index = 0; - for(std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) + for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) { weightselem.appendValues(*i, weight_index++); } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 8a5461710f6..50ec2985552 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -278,7 +278,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(node->getUniqueId().toAscii()); - if(etit != uid_tags_map.end()) + if (etit != uid_tags_map.end()) { et = etit->second; //else return; @@ -306,7 +306,7 @@ void ArmatureImporter::fix_leaf_bones( ) float vec[3] = {0.0f, 0.0f, 0.1f}; // if parent: take parent length and direction - if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head); + if (leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head); copy_v3_v3(leaf.bone->tail, leaf.bone->head); add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); @@ -767,7 +767,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) std::map<COLLADAFW::UniqueId, Object*>::iterator arm; for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) { - if(arm->first == node->getUniqueId() ) + if (arm->first == node->getUniqueId() ) return arm->second; } return NULL; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 6e04a1773bb..647a871e5b1 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -130,7 +130,7 @@ extern char build_rev[]; char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n) { int layer_index = CustomData_get_layer_index(data, type); - if(layer_index < 0) return NULL; + if (layer_index < 0) return NULL; return data->layers[layer_index+n].name; } @@ -139,7 +139,7 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) { /* get the layer index of the active layer of type */ int layer_index = CustomData_get_active_layer_index(data, type); - if(layer_index < 0) return NULL; + if (layer_index < 0) return NULL; return data->layers[layer_index].name; } @@ -178,30 +178,30 @@ void DocumentExporter::exportCurrentScene(Scene *sce) switch(RNA_property_enum_get(&unit_settings, system)) { case USER_UNIT_NONE: case USER_UNIT_METRIC: - if(linearmeasure == 0.001f) { + if (linearmeasure == 0.001f) { unitname = "millimeter"; } - else if(linearmeasure == 0.01f) { + else if (linearmeasure == 0.01f) { unitname = "centimeter"; } - else if(linearmeasure == 0.1f) { + else if (linearmeasure == 0.1f) { unitname = "decimeter"; } - else if(linearmeasure == 1.0f) { + else if (linearmeasure == 1.0f) { unitname = "meter"; } - else if(linearmeasure == 1000.0f) { + else if (linearmeasure == 1000.0f) { unitname = "kilometer"; } break; case USER_UNIT_IMPERIAL: - if(linearmeasure == 0.0254f) { + if (linearmeasure == 0.0254f) { unitname = "inch"; } - else if(linearmeasure == 0.3048f) { + else if (linearmeasure == 0.3048f) { unitname = "foot"; } - else if(linearmeasure == 0.9144f) { + else if (linearmeasure == 0.9144f) { unitname = "yard"; } break; @@ -211,7 +211,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) asset.setUnit(unitname, linearmeasure); asset.setUpAxisType(COLLADASW::Asset::Z_UP); - if(U.author[0] != '\0') { + if (U.author[0] != '\0') { asset.getContributor().mAuthor = U.author; } else { @@ -227,13 +227,13 @@ void DocumentExporter::exportCurrentScene(Scene *sce) asset.add(); // <library_cameras> - if(has_object_type(sce, OB_CAMERA)) { + if (has_object_type(sce, OB_CAMERA)) { CamerasExporter ce(&sw, this->export_settings); ce.exportCameras(sce); } // <library_lights> - if(has_object_type(sce, OB_LAMP)) { + if (has_object_type(sce, OB_LAMP)) { LightsExporter le(&sw, this->export_settings); le.exportLights(sce); } @@ -251,7 +251,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) me.exportMaterials(sce); // <library_geometries> - if(has_object_type(sce, OB_MESH)) { + if (has_object_type(sce, OB_MESH)) { GeometryExporter ge(&sw, this->export_settings); ge.exportGeom(sce); } @@ -262,7 +262,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) // <library_controllers> ArmatureExporter arm_exporter(&sw, this->export_settings); - if(has_object_type(sce, OB_ARMATURE)) { + if (has_object_type(sce, OB_ARMATURE)) { arm_exporter.export_controllers(sce); } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 4ad79e0b309..9e604978f64 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -126,7 +126,7 @@ bool DocumentImporter::import() return false; } - if(errorHandler.hasError()) + if (errorHandler.hasError()) return false; /** TODO set up scene graph and such here */ @@ -161,7 +161,7 @@ void DocumentImporter::start(){} void DocumentImporter::finish() { - if(mImportStage!=General) + if (mImportStage!=General) return; /** TODO Break up and put into 2-pass parsing of DAE */ @@ -339,7 +339,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod // transformation matrix and apply it to the newly instantiated // object to account for node hierarchy transforms in // .dae - if(source_node) { + if (source_node) { COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix(); COLLADABU::Math::Matrix4 bmat4 = mat4.transpose(); // transpose to get blender row-major order float mat[4][4]; @@ -492,7 +492,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // this method called on post process after writeGeometry, writeMaterial, etc. @@ -515,7 +515,7 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; Scene *sce = CTX_data_scene(mContext); @@ -533,7 +533,7 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; return mesh_importer.write_geometry(geom); @@ -543,7 +543,7 @@ bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom ) \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId(); @@ -699,10 +699,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia } } - if(ef->getOpacity().isTexture()) { + if (ef->getOpacity().isTexture()) { COLLADAFW::Texture ctex = ef->getOpacity().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); - if(mtex != NULL) { + if (mtex != NULL) { mtex->mapto = MAP_ALPHA; mtex->tex->imaflag |= TEX_USEALPHA; i++; @@ -732,7 +732,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; const COLLADAFW::UniqueId& uid = effect->getUniqueId(); @@ -744,7 +744,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) Material *ma = uid_effect_map[uid]; std::map<COLLADAFW::UniqueId, Material*>::iterator iter; - for(iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ ) + for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ ) { if ( iter->second == ma ) { this->FW_object_map[iter->first] = effect; @@ -770,7 +770,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; Camera *cam = NULL; @@ -886,7 +886,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // XXX maybe it is necessary to check if the path is absolute or relative @@ -911,7 +911,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; Lamp *lamp = NULL; @@ -920,7 +920,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(light->getUniqueId().toAscii()); - if(etit != uid_tags_map.end()) + if (etit != uid_tags_map.end()) et = etit->second; la_id = light->getOriginalId(); @@ -934,7 +934,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) } // if we find an ExtraTags for this, use that instead. - if(et && et->isProfile("blender")) { + if (et && et->isProfile("blender")) { et->setData("type", &(lamp->type)); et->setData("flag", &(lamp->flag)); et->setData("mode", &(lamp->mode)); @@ -1007,12 +1007,12 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->b = col.getBlue(); } - if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { + if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { att2 = quadatt; d = sqrt(1.0f/quadatt); } // linear light - else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { + else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { att1 = linatt; d = (1.0f/linatt); } @@ -1041,9 +1041,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->type = LA_SPOT; lamp->att1 = att1; lamp->att2 = att2; - if(IS_EQ(att1, 0.0f) && att2 > 0) + if (IS_EQ(att1, 0.0f) && att2 > 0) lamp->falloff_type = LA_FALLOFF_INVSQUARE; - if(IS_EQ(att2, 0.0f) && att1 > 0) + if (IS_EQ(att2, 0.0f) && att1 > 0) lamp->falloff_type = LA_FALLOFF_INVLINEAR; lamp->spotsize = light->getFallOffAngle().getValue(); lamp->spotblend = light->getFallOffExponent().getValue(); @@ -1061,9 +1061,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->type = LA_LOCAL; lamp->att1 = att1; lamp->att2 = att2; - if(IS_EQ(att1, 0.0f) && att2 > 0) + if (IS_EQ(att1, 0.0f) && att2 > 0) lamp->falloff_type = LA_FALLOFF_INVSQUARE; - if(IS_EQ(att2, 0.0f) && att1 > 0) + if (IS_EQ(att2, 0.0f) && att1 > 0) lamp->falloff_type = LA_FALLOFF_INVLINEAR; } break; @@ -1084,7 +1084,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) // this function is called only for animations that pass COLLADAFW::validate bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // return true; @@ -1094,7 +1094,7 @@ bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim ) // called on post-process stage after writeVisualScenes bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* animationList ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // return true; @@ -1111,7 +1111,7 @@ bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerD // this is called on postprocess, before writeVisualScenes bool DocumentImporter::writeController( const COLLADAFW::Controller* controller ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; return armature_importer.write_controller(controller); @@ -1129,7 +1129,7 @@ bool DocumentImporter::writeKinematicsScene( const COLLADAFW::KinematicsScene* k ExtraTags* DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid) { - if(uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) { + if (uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) { return NULL; } return uid_tags_map[uid.toAscii()]; diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 0dbd44f2b73..dd20e7b85b0 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -63,7 +63,7 @@ bool EffectsExporter::hasEffects(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -79,7 +79,7 @@ bool EffectsExporter::hasEffects(Scene *sce) void EffectsExporter::exportEffects(Scene *sce) { - if(hasEffects(sce)) { + if (hasEffects(sce)) { this->scene = sce; openLibrary(); MaterialFunctor mf; @@ -129,7 +129,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) ep.setProfileType(COLLADASW::EffectProfile::COMMON); ep.openProfile(); // set shader type - one of three blinn, phong or lambert - if(ma->spec>0.0f) { + if (ma->spec>0.0f) { if (ma->spec_shader == MA_SPEC_BLINN) { writeBlinn(ep, ma); } @@ -140,7 +140,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) } } else { - if(ma->diff_shader == MA_DIFF_LAMBERT) { + if (ma->diff_shader == MA_DIFF_LAMBERT) { writeLambert(ep, ma); } else { @@ -177,7 +177,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) // ambient /* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */ - if(this->scene->world) + if (this->scene->world) cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f); else cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f); @@ -220,7 +220,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if(!ima) continue; + if (!ima) continue; std::string key(id_name(ima)); key = translate_id(key); @@ -266,7 +266,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if(!ima) continue; + if (!ima) continue; // we assume map input is always TEXCO_UV diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp index d6d3aa87cfd..6606fe1a27b 100644 --- a/source/blender/collada/ExtraHandler.cpp +++ b/source/blender/collada/ExtraHandler.cpp @@ -54,7 +54,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength) { char buf[1024]; - if(currentElement.length() == 0 || currentExtraTags == 0) return false; + if (currentElement.length() == 0 || currentExtraTags == 0) return false; BLI_snprintf(buf, textLength+1, "%s", text); currentExtraTags->addTag(currentElement, std::string(buf)); @@ -65,11 +65,11 @@ bool ExtraHandler::parseElement ( const char* profileName, const unsigned long& elementHash, const COLLADAFW::UniqueId& uniqueId ) { - if(BLI_strcaseeq(profileName, "blender")) { + if (BLI_strcaseeq(profileName, "blender")) { //printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str()); currentUid = uniqueId; ExtraTags *et = dimp->getExtraTags(uniqueId); - if(!et) { + if (!et) { et = new ExtraTags(std::string(profileName)); dimp->addExtraTags(uniqueId, et); } diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp index b1b1936e254..c5a126894cb 100644 --- a/source/blender/collada/ExtraTags.cpp +++ b/source/blender/collada/ExtraTags.cpp @@ -56,7 +56,7 @@ bool ExtraTags::addTag( std::string tag, std::string data) int ExtraTags::asInt( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return -1; } @@ -66,7 +66,7 @@ int ExtraTags::asInt( std::string tag, bool *ok) float ExtraTags::asFloat( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return -1.0f; } @@ -76,7 +76,7 @@ float ExtraTags::asFloat( std::string tag, bool *ok) std::string ExtraTags::asString( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return ""; } @@ -89,28 +89,28 @@ void ExtraTags::setData(std::string tag, short *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = (short)tmp; } void ExtraTags::setData(std::string tag, int *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = tmp; } void ExtraTags::setData(std::string tag, float *data) { bool ok = false; float tmp = asFloat(tag, &ok); - if(ok) + if (ok) *data = tmp; } void ExtraTags::setData(std::string tag, char *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = (char)tmp; } diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 2af1df90f51..ca112abc0af 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -109,7 +109,7 @@ void GeometryExporter::operator()(Object *ob) // XXX slow if (ob->totcol) { - for(int a = 0; a < ob->totcol; a++) { + for (int a = 0; a < ob->totcol; a++) { createPolylist(a, has_uvs, has_color, ob, geom_id, norind); } } diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 3926cb48253..3775a63c71d 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -51,7 +51,7 @@ bool ImagesExporter::hasImages(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -71,7 +71,7 @@ bool ImagesExporter::hasImages(Scene *sce) void ImagesExporter::exportImages(Scene *sce) { - if(hasImages(sce)) { + if (hasImages(sce)) { openLibrary(); MaterialFunctor mf; mf.forEachMaterialInScene<ImagesExporter>(sce, *this, this->export_settings->selected); diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp index 40ca1bc3b0e..a605bdeefcc 100644 --- a/source/blender/collada/InstanceWriter.cpp +++ b/source/blender/collada/InstanceWriter.cpp @@ -43,7 +43,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob) { - for(int a = 0; a < ob->totcol; a++) { + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList(); diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index d74a1d1033d..51242b36b64 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -73,7 +73,7 @@ void LightsExporter::operator()(Object *ob) constatt = 1.0f; - if(la->falloff_type==LA_FALLOFF_INVLINEAR) { + if (la->falloff_type==LA_FALLOFF_INVLINEAR) { linatt = 1.0f / d; quadatt = 0.0f; } diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index b66779953ef..1e3358c9216 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -35,7 +35,7 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSe void MaterialsExporter::exportMaterials(Scene *sce) { - if(hasMaterials(sce)) { + if (hasMaterials(sce)) { openLibrary(); MaterialFunctor mf; @@ -53,7 +53,7 @@ bool MaterialsExporter::hasMaterials(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2539756dbdf..e50005634ba 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -145,7 +145,7 @@ void WVDataWrapper::print() void UVDataWrapper::getUV(int uv_index, float *uv) { int stride = mVData->getStride(0); - if(stride==0) stride = 2; + if (stride==0) stride = 2; switch(mVData->getType()) { case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: @@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray(); - for(unsigned int j = 0; j < vca.getCount(); j++){ + for (unsigned int j = 0; j < vca.getCount(); j++){ int count = vca[j]; if (count < 3) { fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n", @@ -291,7 +291,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup } } - else if(type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) { + else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) { fprintf(stderr, "Primitive type %s is not supported.\n", type_str); return false; } @@ -310,7 +310,7 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) // vertices COLLADAFW::MeshVertexData& pos = mesh->getPositions(); int stride = pos.getStride(0); - if(stride==0) stride = 3; + if (stride==0) stride = 3; me->totvert = mesh->getPositions().getFloatValues()->getCount() / stride; me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert); @@ -742,12 +742,12 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi size_t setindex = ctexture.getSetIndex(); std::string uvname = ctexture.getSemantic(); - if(setindex==-1) return NULL; + if (setindex==-1) return NULL; const CustomData *data = &me->fdata; int layer_index = CustomData_get_layer_index(data, CD_MTFACE); - if(layer_index == -1) return NULL; + if (layer_index == -1) return NULL; CustomDataLayer *cdl = &data->layers[layer_index+setindex]; @@ -798,7 +798,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId>::iterator it; it=materials_mapped_to_geom.find(*geom_uid); while(it!=materials_mapped_to_geom.end()) { - if(it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found + if (it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found it++; } // first time we get geom_uid, ma_uid pair. Save for later check. @@ -913,7 +913,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta // loop through geom's materials for (unsigned int i = 0; i < mat_array.getCount(); i++) { - if(mat_array[i].getReferencedMaterial().isValid()) { + if (mat_array[i].getReferencedMaterial().isValid()) { texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid, &color_texture, layername, texture_face, material_texture_mapping_map, i); diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index b6be8a57f7a..9010fd5062a 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -47,7 +47,7 @@ void SceneExporter::exportHierarchy(Scene *sce) Object *ob = base->object; if (!ob->parent) { - if(sce->lay & ob->lay) { + if (sce->lay & ob->lay) { switch(ob->type) { case OB_MESH: case OB_CAMERA: @@ -144,17 +144,17 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce) // empty object else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP - if((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) { + if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) { GroupObject *go = NULL; Group *gr = ob->dup_group; /* printf("group detected '%s'\n", gr->id.name+2); */ - for(go = (GroupObject*)(gr->gobject.first); go; go=go->next) { + for (go = (GroupObject*)(gr->gobject.first); go; go=go->next) { printf("\t%s\n", go->ob->id.name); } } } - for(std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) + for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) { writeNodes(*i, sce); } diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 10a965308b1..f441833233c 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -95,18 +95,18 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) */ /* Using parentinv should allow use of existing curves */ - if(ob->parent) + if (ob->parent) { // If parentinv is identity don't add it. bool add_parinv = false; - for(int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { float f = (i % 4 == i / 4) ? 1.0f : 0.0f; add_parinv |= (ob->parentinv[i % 4][i / 4] != f); } - if(add_parinv) + if (add_parinv) { double dmat[4][4]; UnitConverter converter; diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 39114f6543b..70bf0556b5b 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -44,7 +44,7 @@ extern "C" int collada_import(bContext *C, const char *filepath) { DocumentImporter imp (C, filepath); - if(imp.import()) return 1; + if (imp.import()) return 1; return 0; } @@ -58,9 +58,9 @@ extern "C" export_settings.filepath = (char *)filepath; /* annoying, collada crashes if file cant be created! [#27162] */ - if(!BLI_exists(filepath)) { + if (!BLI_exists(filepath)) { BLI_make_existing_file(filepath); /* makes the dir if its not there */ - if(BLI_file_touch(filepath) == 0) { + if (BLI_file_touch(filepath) == 0) { return 0; } } diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index d7263e07eb8..fc4093bd795 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -206,7 +206,7 @@ std::string translate_id(const std::string &id) { id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; } - // It's so much workload now, the if() should speed up things. + // It's so much workload now, the if () should speed up things. if (id_translated != id) { // Search duplicates diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index c3aa73510d1..4aed29defbc 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -61,8 +61,8 @@ int bc_test_parent_loop(Object *par, Object *ob) { /* test if 'ob' is a parent somewhere in par's parents */ - if(par == NULL) return 0; - if(ob == par) return 1; + if (par == NULL) return 0; + if (ob == par) return 1; return bc_test_parent_loop(par->parent, ob); } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index fbcda86eb75..aeab4f27179 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3673,7 +3673,7 @@ static int is_u_selected(Nurb *nu, int u) /* what about resolu == 2? */ bp= nu->bp+u; for (v=0; v<nu->pntsv-1; v++, bp+=nu->pntsu) { - if (v) if(bp->f1 & SELECT) return 1; + if (v) if (bp->f1 & SELECT) return 1; } return 0; @@ -6376,7 +6376,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) bp->vec[0]+= fac*grid; fac= (float)b -1.5f; bp->vec[1]+= fac*grid; - if (a==1 || a==2) if(b==1 || b==2) { + if (a==1 || a==2) if (b==1 || b==2) { bp->vec[2]+= grid; } mul_m4_v3(mat,bp->vec); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b9002648709..b6821abf243 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -81,7 +81,7 @@ /* avoid unneeded calls to ui_get_but_val */ #define UI_BUT_VALUE_UNSET DBL_MAX -#define UI_GET_BUT_VALUE_INIT(_but, _value) if(_value == DBL_MAX) { (_value)= ui_get_but_val(_but); } +#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value)= ui_get_but_val(_but); } /* * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 25c616cc67e..a2f253cecaf 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -161,12 +161,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f; - coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f; - coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f; - coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f; - coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f; - coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f; + coltop[0]= color[0]+shadetop; if (coltop[0]>1.0f) coltop[0]= 1.0f; + coltop[1]= color[1]+shadetop; if (coltop[1]>1.0f) coltop[1]= 1.0f; + coltop[2]= color[2]+shadetop; if (coltop[2]>1.0f) coltop[2]= 1.0f; + coldown[0]= color[0]+shadedown; if (coldown[0]<0.0f) coldown[0]= 0.0f; + coldown[1]= color[1]+shadedown; if (coldown[1]<0.0f) coldown[1]= 0.0f; + coldown[2]= color[2]+shadedown; if (coldown[2]<0.0f) coldown[2]= 0.0f; glShadeModel(GL_SMOOTH); glBegin(mode); @@ -269,12 +269,12 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0f) colLeft[0]= 1.0f; - colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0f) colLeft[1]= 1.0f; - colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0f) colLeft[2]= 1.0f; - colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0f) colRight[0]= 0.0f; - colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0f) colRight[1]= 0.0f; - colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0f) colRight[2]= 0.0f; + colLeft[0]= color[0]+shadeLeft; if (colLeft[0]>1.0f) colLeft[0]= 1.0f; + colLeft[1]= color[1]+shadeLeft; if (colLeft[1]>1.0f) colLeft[1]= 1.0f; + colLeft[2]= color[2]+shadeLeft; if (colLeft[2]>1.0f) colLeft[2]= 1.0f; + colRight[0]= color[0]+shadeRight; if (colRight[0]<0.0f) colRight[0]= 0.0f; + colRight[1]= color[1]+shadeRight; if (colRight[1]<0.0f) colRight[1]= 0.0f; + colRight[2]= color[2]+shadeRight; if (colRight[2]<0.0f) colRight[2]= 0.0f; glShadeModel(GL_SMOOTH); glBegin(mode); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index ff72c13aa34..13962777da3 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1342,8 +1342,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, dir1 &= (UI_TOP|UI_DOWN); } - if (dir2==0) if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN; - if (dir2==0) if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT; + if (dir2==0) if (dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN; + if (dir2==0) if (dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT; /* no space at all? don't change */ if (left || right) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index d47bd44d8f7..91ff4000541 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -953,7 +953,7 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event) // if there are problems because of this, then rna needs changed update functions. // // object_test_constraints(ob); - // if(ob->pose) update_pose_constraint_flags(ob->pose); + // if (ob->pose) update_pose_constraint_flags(ob->pose); if (ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB); else DAG_id_tag_update(&ob->id, OB_RECALC_OB); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 22ecf6198d7..3717591e412 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -908,7 +908,7 @@ static int object_delete_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_bases) { - /* if(base->object->type==OB_LAMP) islamp= 1; */ + /* if (base->object->type==OB_LAMP) islamp= 1; */ /* deselect object -- it could be used in other scenes */ base->object->flag &= ~SELECT; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 906ee65b45d..341ba368729 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1115,7 +1115,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) base->object->lay= lay; base->object->flag &= ~SELECT; base->flag &= ~SELECT; - /* if(base->object->type==OB_LAMP) islamp= 1; */ + /* if (base->object->type==OB_LAMP) islamp= 1; */ } CTX_DATA_END; } @@ -1127,7 +1127,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) local= base->lay & 0xFF000000; base->lay= lay + local; base->object->lay= lay; - /* if(base->object->type==OB_LAMP) islamp= 1; */ + /* if (base->object->type==OB_LAMP) islamp= 1; */ } CTX_DATA_END; } diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 36571fc0ced..959bda22263 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -227,7 +227,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob) /* currently editmode isn't supported by mesh so * ignore here for now too */ - /* if(lt->editlatt) lt= lt->editlatt->latt; */ + /* if (lt->editlatt) lt= lt->editlatt->latt; */ for (w=0; w<lt->pntsw; w++) { for (v=0; v<lt->pntsv; v++) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 68d464da261..bf3a9fff4e2 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -90,15 +90,15 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys); #define KEY_K PTCacheEditKey *key; int k #define POINT_P PTCacheEditPoint *point; int p #define LOOP_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) -#define LOOP_VISIBLE_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!(point->flag & PEP_HIDE)) -#define LOOP_SELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point_is_selected(point)) -#define LOOP_UNSELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!point_is_selected(point)) -#define LOOP_EDITED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_EDIT_RECALC) -#define LOOP_TAGGED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_TAG) +#define LOOP_VISIBLE_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!(point->flag & PEP_HIDE)) +#define LOOP_SELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point_is_selected(point)) +#define LOOP_UNSELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!point_is_selected(point)) +#define LOOP_EDITED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_EDIT_RECALC) +#define LOOP_TAGGED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_TAG) #define LOOP_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) -#define LOOP_VISIBLE_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if(!(key->flag & PEK_HIDE)) -#define LOOP_SELECTED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE)) -#define LOOP_TAGGED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if(key->flag & PEK_TAG) +#define LOOP_VISIBLE_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (!(key->flag & PEK_HIDE)) +#define LOOP_SELECTED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if ((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE)) +#define LOOP_TAGGED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (key->flag & PEK_TAG) #define KEY_WCO (key->flag & PEK_USE_WCO ? key->world_co : key->co) @@ -2152,7 +2152,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) hkey= pa->hair; LOOP_KEYS { - while(key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) { + while (key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) { key++; hkey++; } @@ -2366,7 +2366,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* remove tagged particles - don't do mirror here! */ remove_tagged_particles(ob, psys, 0); totremoved += removed; - } while(removed); + } while (removed); if (totremoved == 0) return OPERATOR_CANCELLED; @@ -2645,7 +2645,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) newpa->fuv[1]= pa->fuv[1]; newpa->fuv[2]= pa->fuv[0]; newpa->fuv[3]= pa->fuv[3]; - while(rotation-- > 0) + while (rotation-- > 0) if (me->mface[pa->num].v4) { SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]); } @@ -3214,7 +3214,7 @@ static int brush_add(PEData *data, short number) for (i=0; i<number; i++) { if (number>1) { dmx=dmy=size; - while(dmx*dmx+dmy*dmy>size2) { + while (dmx*dmx+dmy*dmy>size2) { dmx=(short)((2.0f*BLI_frand()-1.0f)*size); dmy=(short)((2.0f*BLI_frand()-1.0f)*size); } @@ -3891,7 +3891,7 @@ void PE_undo_push(Scene *scene, const char *str) if (!edit) return; /* remove all undos after (also when curundo==NULL) */ - while(edit->undo.last != edit->curundo) { + while (edit->undo.last != edit->curundo) { undo= edit->undo.last; BLI_remlink(&edit->undo, undo); free_PTCacheUndo(undo); @@ -3906,13 +3906,13 @@ void PE_undo_push(Scene *scene, const char *str) /* and limit amount to the maximum */ nr= 0; undo= edit->undo.last; - while(undo) { + while (undo) { nr++; if (nr==U.undosteps) break; undo= undo->prev; } if (undo) { - while(edit->undo.first!=undo) { + while (edit->undo.first!=undo) { PTCacheUndo *first= edit->undo.first; BLI_remlink(&edit->undo, first); free_PTCacheUndo(first); @@ -3973,7 +3973,7 @@ static void PTCacheUndo_clear(PTCacheEdit *edit) if (edit==NULL) return; undo= edit->undo.first; - while(undo) { + while (undo) { free_PTCacheUndo(undo); undo= undo->next; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 48b1afad891..9deb64ef60a 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -599,11 +599,11 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge) oneselected= 0; while (se) { if (se->v1->flag + se->v2->flag==1) { - if (dir=='h') if(se->v1->vec.y==se->v2->vec.y) { + if (dir=='h') if (se->v1->vec.y==se->v2->vec.y) { se->v1->flag= se->v2->flag= 1; oneselected= 1; } - if (dir=='v') if(se->v1->vec.x==se->v2->vec.x) { + if (dir=='v') if (se->v1->vec.x==se->v2->vec.x) { se->v1->flag= se->v2->flag= 1; oneselected= 1; } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 3508f8e7f11..8cdacea9bd7 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -229,7 +229,7 @@ static void imapaint_tri_weights(Object *ob, h[1]= (co[1] - view[1])*2.0f/view[3] - 1; h[2]= 1.0f; - /* solve for(w1,w2,w3)/perspdiv in: + /* solve for (w1,w2,w3)/perspdiv in: * h * perspdiv = Project * Model * (w1 * v1 + w2 * v2 + w3 * v3) */ wmat[0][0]= pv1[0]; wmat[1][0]= pv2[0]; wmat[2][0]= pv3[0]; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 1ca3ac1ec9a..425cee38af0 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -393,7 +393,7 @@ static int console_insert_exec(bContext *C, wmOperator *op) static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { - // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + // if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if (!RNA_string_length(op->ptr, "text")) { /* if alt/ctrl/super are pressed pass through */ if (event->ctrl || event->oskey) { @@ -512,12 +512,12 @@ static int console_clear_exec(bContext *C, wmOperator *op) /*ConsoleLine *ci= */ console_history_verify(C); if (scrollback) { /* last item in mistory */ - while(sc->scrollback.first) + while (sc->scrollback.first) console_scrollback_free(sc, sc->scrollback.first); } if (history) { - while(sc->history.first) + while (sc->history.first) console_history_free(sc, sc->history.first); } @@ -577,7 +577,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op) { /* add a duplicate of the new arg and remove all other instances */ ConsoleLine *cl; - while((cl= console_history_find(sc, ci->line, ci))) + while ((cl= console_history_find(sc, ci->line, ci))) console_history_free(sc, cl); console_history_add(C, (ConsoleLine *)sc->history.last); @@ -626,7 +626,7 @@ static int console_history_append_exec(bContext *C, wmOperator *op) if (rem_dupes) { ConsoleLine *cl; - while((cl= console_history_find(sc, ci->line, ci))) + while ((cl= console_history_find(sc, ci->line, ci))) console_history_free(sc, cl); if (strcmp(str, ci->line)==0) { @@ -815,7 +815,7 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op)) buf_step= buf_str; - while((buf_next=buf_step) && buf_next[0] != '\0') { + while ((buf_next=buf_step) && buf_next[0] != '\0') { buf_step= strchr(buf_next, '\n'); if (buf_step) { *buf_step= '\0'; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 202a82be4b4..71ead483d06 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1179,7 +1179,7 @@ void filelist_from_main(struct FileList *filelist) id= lb->first; filelist->numfiles= 0; - while(id) { + while (id) { if (!filelist->hide_dot || id->name[2] != '.') { filelist->numfiles++; } @@ -1204,7 +1204,7 @@ void filelist_from_main(struct FileList *filelist) id= lb->first; totlib= totbl= 0; - while(id) { + while (id) { ok = 1; if (ok) { if (!filelist->hide_dot || id->name[2] != '.') { diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 5de0dd3fccd..be53b03bec6 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2260,7 +2260,7 @@ static int image_record_composite_exec(bContext *C, wmOperator *op) if (!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; - while(image_record_composite_apply(C, op)) + while (image_record_composite_apply(C, op)) ; image_record_composite_exit(C, op); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 04bb97ee431..c55ba069e11 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -292,7 +292,7 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick tvc->iter_index++; - } while(tvc->step(tvc)); + } while (tvc->step(tvc)); } tvc->end(tvc); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 23272a5d93a..37b284a030d 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -152,22 +152,22 @@ void make_unique_prop_names(bContext *C, char *str) for (a=0; a<obcount; a++) { ob= (Object *)idar[a]; prop= ob->prop.first; - while(prop) { + while (prop) { names[nr++]= prop->name; prop= prop->next; } sens= ob->sensors.first; - while(sens) { + while (sens) { names[nr++]= sens->name; sens= sens->next; } cont= ob->controllers.first; - while(cont) { + while (cont) { names[nr++]= cont->name; cont= cont->next; } act= ob->actuators.first; - while(act) { + while (act) { names[nr++]= act->name; act= act->next; } @@ -211,10 +211,10 @@ static void old_sca_move_sensor(bContext *C, void *datav, void *move_up) if (val>0) { /* now find out which object has this ... */ base= FIRSTBASE; - while(base) { + while (base) { sens= base->object->sensors.first; - while(sens) { + while (sens) { if (sens == sens_to_delete) break; sens= sens->next; } @@ -264,10 +264,10 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up) if (val>0) { /* now find out which object has this ... */ base= FIRSTBASE; - while(base) { + while (base) { cont= base->object->controllers.first; - while(cont) { + while (cont) { if (cont == controller_to_del) break; cont= cont->next; } @@ -276,7 +276,7 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up) if ( val==1 && cont->prev) { /* locate the controller that has the same state mask but is earlier in the list */ tmp = cont->prev; - while(tmp) { + while (tmp) { if (tmp->state_mask & cont->state_mask) break; tmp = tmp->prev; @@ -288,7 +288,7 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up) } else if ( val==2 && cont->next) { tmp = cont->next; - while(tmp) { + while (tmp) { if (tmp->state_mask & cont->state_mask) break; tmp = tmp->next; @@ -320,10 +320,10 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) if (val>0) { /* now find out which object has this ... */ base= FIRSTBASE; - while(base) { + while (base) { act= base->object->actuators.first; - while(act) { + while (act) { if (act == actuator_to_move) break; act= act->next; } @@ -401,7 +401,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_CHANGE_SENS: for (ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; - while(sens) { + while (sens) { if (sens->type != sens->otype) { init_sensor(sens); sens->otype= sens->type; @@ -415,7 +415,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_DEL_SENS: for (ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; - while(sens) { + while (sens) { if (sens->flag & SENS_DEL) { BLI_remlink(&(ob->sensors), sens); free_sensor(sens); @@ -475,7 +475,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_CHANGE_CONT: for (ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; - while(cont) { + while (cont) { if (cont->type != cont->otype) { init_controller(cont); cont->otype= cont->type; @@ -490,7 +490,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_DEL_CONT: for (ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; - while(cont) { + while (cont) { if (cont->flag & CONT_DEL) { BLI_remlink(&(ob->controllers), cont); unlink_controller(cont); @@ -519,7 +519,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_CHANGE_ACT: for (ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; - while(act) { + while (act) { if (act->type != act->otype) { init_actuator(act); act->otype= act->type; @@ -533,7 +533,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) case B_DEL_ACT: for (ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; - while(act) { + while (act) { if (act->flag & ACT_DEL) { BLI_remlink(&(ob->actuators), act); unlink_actuator(act); @@ -551,7 +551,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) didit= 0; for (ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; - while(act) + while (act) { if (act->type==ACT_SOUND) { @@ -567,7 +567,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) break; } - while(sound) + while (sound) { if (nr==sa->sndnr) break; @@ -759,12 +759,12 @@ static void set_sca_ob(Object *ob) bActuator *act; cont= ob->controllers.first; - while(cont) { + while (cont) { cont->mynew= (bController *)ob; cont= cont->next; } act= ob->actuators.first; - while(act) { + while (act) { act->mynew= (bActuator *)ob; act= act->next; } @@ -791,7 +791,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf if (scene==NULL) return NULL; ob= bmain->object.first; - while(ob) { + while (ob) { ob->scavisflag= 0; set_sca_ob(ob); ob= ob->id.next; @@ -801,7 +801,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf lay= scene->lay; base= FIRSTBASE; - while(base) { + while (base) { if (base->lay & lay) { if (base->flag & SELECT) { if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS; @@ -821,16 +821,16 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */ if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) { doit= 1; - while(doit) { + while (doit) { doit= 0; ob= bmain->object.first; - while(ob) { + while (ob) { /* 1st case: select sensor when controller selected */ if ((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) { sens= ob->sensors.first; - while(sens) { + while (sens) { for (a=0; a<sens->totlinks; a++) { if (sens->links[a]) { obt= (Object *)sens->links[a]->mynew; @@ -849,7 +849,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* 2nd case: select cont when act selected */ if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) { cont= ob->controllers.first; - while(cont) { + while (cont) { for (a=0; a<cont->totlinks; a++) { if (cont->links[a]) { obt= (Object *)cont->links[a]->mynew; @@ -868,7 +868,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* 3rd case: select controller when sensor selected */ if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) { sens= ob->sensors.first; - while(sens) { + while (sens) { for (a=0; a<sens->totlinks; a++) { if (sens->links[a]) { obt= (Object *)sens->links[a]->mynew; @@ -885,7 +885,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* 4th case: select actuator when controller selected */ if ( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) { cont= ob->controllers.first; - while(cont) { + while (cont) { for (a=0; a<cont->totlinks; a++) { if (cont->links[a]) { obt= (Object *)cont->links[a]->mynew; @@ -906,7 +906,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* now we count */ ob= bmain->object.first; - while(ob) { + while (ob) { if ( ob->scavisflag ) (*count)++; ob= ob->id.next; } @@ -925,7 +925,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf nr++; } - while(ob) { + while (ob) { if ( (ob->scavisflag) && (ob != obact)) { idar[nr]= (ID *)ob; nr++; @@ -2973,7 +2973,7 @@ static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event) for (a=0; a<count; a++) { ob= (Object *)idar[a]; sens= ob->sensors.first; - while(sens) { + while (sens) { if (event==2) sens->flag |= SENS_SHOW; else if (event==3) sens->flag &= ~SENS_SHOW; sens= sens->next; @@ -3022,7 +3022,7 @@ static void do_controller_menu(bContext *C, void *UNUSED(arg), int event) for (a=0; a<count; a++) { ob= (Object *)idar[a]; cont= ob->controllers.first; - while(cont) { + while (cont) { if (event==2) cont->flag |= CONT_SHOW; else if (event==3) cont->flag &= ~CONT_SHOW; cont= cont->next; @@ -3071,7 +3071,7 @@ static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event) for (a=0; a<count; a++) { ob= (Object *)idar[a]; act= ob->actuators.first; - while(act) { + while (act) { if (event==2) act->flag |= ACT_SHOW; else if (event==3) act->flag &= ~ACT_SHOW; act= act->next; @@ -4511,20 +4511,20 @@ static void logic_buttons_new(bContext *C, ARegion *ar) /* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that we can determine which is actually linked/visible */ act = ob->actuators.first; - while(act) { + while (act) { act->flag &= ~(ACT_LINKED|ACT_VISIBLE); act = act->next; } /* same for sensors */ sens= ob->sensors.first; - while(sens) { + while (sens) { sens->flag &= ~(SENS_VISIBLE); sens = sens->next; } /* mark the linked and visible actuators */ cont= ob->controllers.first; - while(cont) { + while (cont) { flag = ACT_LINKED; /* this controller is visible, mark all its actuator */ @@ -4826,13 +4826,13 @@ void logic_buttons(bContext *C, ARegion *ar) for (a=0; a<count; a++) { ob= (Object *)idar[a]; act= ob->actuators.first; - while(act) { + while (act) { act->flag &= ~(ACT_LINKED|ACT_VISIBLE); act = act->next; } /* same for sensors */ sens= ob->sensors.first; - while(sens) { + while (sens) { sens->flag &= ~(SENS_VISIBLE); sens = sens->next; } @@ -4871,7 +4871,7 @@ void logic_buttons(bContext *C, ARegion *ar) /* note that some of these actuators could be from objects that are not in the display list. * It's ok because those actuators will not be displayed here */ cont= ob->controllers.first; - while(cont) { + while (cont) { for (iact=0; iact<cont->totlinks; iact++) { act = cont->links[iact]; if (act) @@ -4918,7 +4918,7 @@ void logic_buttons(bContext *C, ARegion *ar) yco -= 6; } cont= ob->controllers.first; - while(cont) { + while (cont) { if (cont->state_mask & (1<<stbit)) { /* this controller is visible, mark all its actuator */ for (iact=0; iact<cont->totlinks; iact++) { @@ -5008,7 +5008,7 @@ void logic_buttons(bContext *C, ARegion *ar) if (ob->scaflag & OB_SHOWSENS) { sens= ob->sensors.first; - while(sens) { + while (sens) { if (!(slogic->scaflag & BUTS_SENS_STATE) || (sens->totlinks == 0) || /* always display sensor without links so that is can be edited */ (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */ @@ -5088,7 +5088,7 @@ void logic_buttons(bContext *C, ARegion *ar) if (ob->scaflag & OB_SHOWACT) { act= ob->actuators.first; - while(act) { + while (act) { if (!(slogic->scaflag & BUTS_ACT_STATE) || !(act->flag & ACT_LINKED) || /* always display actuators without links so that is can be edited */ (act->flag & ACT_VISIBLE) || /* this actuator has visible connection, display it */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 1c58c4152f0..73289dce968 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -95,7 +95,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) { TreeElement *te= lb->first; - while(te) { + while (te) { TreeStoreElem *tselem= TREESTORE(te); if (TSELEM_OPEN(tselem,soops)) outliner_height(soops, &te->subtree, h); @@ -108,7 +108,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) { TreeElement *te= lb->first; - while(te) { + while (te) { // TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... te->xend is not set yet @@ -125,7 +125,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx) { TreeElement *te= lb->first; - while(te) { + while (te) { TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... (currently, we're using a fixed length of 100)! #if 0 @@ -1550,7 +1550,7 @@ static void outliner_back(ARegion *ar) ystart= (int)ar->v2d.tot.ymax; ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET; - while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { + while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+UI_UNIT_Y); ystart-= 2*UI_UNIT_Y; } @@ -1568,7 +1568,7 @@ static void outliner_draw_restrictcols(ARegion *ar) ystart= (int)ar->v2d.tot.ymax; ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET; - while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { + while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+UI_UNIT_Y); ystart-= 2*UI_UNIT_Y; } diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index e64804b6090..c7aa4dc4e92 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -631,7 +631,7 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS // XXX select_single_seq(seq, 1); p= ed->seqbasep->first; - while(p) { + while (p) { if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { p= p->next; continue; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 2486875bc04..bcc2c358529 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -866,7 +866,7 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) if (ed==NULL) return; - // XXX25 if(okee("Touch and print selected movies")==0) return; + // XXX25 if (okee("Touch and print selected movies")==0) return; WM_cursor_wait(1); @@ -1739,7 +1739,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* remove seq so overlap tests don't conflict, * see seq_free_sequence below for the real free'ing */ BLI_remlink(ed->seqbasep, seq); - /* if(seq->ipo) seq->ipo->id.us--; */ + /* if (seq->ipo) seq->ipo->id.us--; */ /* XXX, remove fcurve and assign to split image strips */ start_ofs = cfra = seq_tx_get_final_left(seq, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index c111870b5bb..00c2caea258 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -509,7 +509,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) xo= mval[0]; yo= mval[1]; - while(get_mbut()) { + while (get_mbut()) { // getmouseco_areawin(mval); if (abs(mval[0]-xo)+abs(mval[1]-yo) > 4) { transform_markers('g', 0); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8230da838e7..de26fa1f8ca 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2566,10 +2566,10 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int y-= txt_get_span(text->lines.first, *linep) - st->top; if (y>0) { - while (y-- != 0) if((*linep)->next) *linep= (*linep)->next; + while (y-- != 0) if ((*linep)->next) *linep= (*linep)->next; } else if (y<0) { - while (y++ != 0) if((*linep)->prev) *linep= (*linep)->prev; + while (y++ != 0) if ((*linep)->prev) *linep= (*linep)->prev; } @@ -2856,7 +2856,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { int ret; - // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + // if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if (!RNA_string_length(op->ptr, "text")) { /* if alt/ctrl/super are pressed pass through */ if (event->ctrl || event->oskey) { diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index f8472a132e1..452f74e8826 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -517,8 +517,8 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned break; /* Events that should clear markers */ - case UKEY: if(!(qual & LR_ALTKEY)) break; - case ZKEY: if(evnt==ZKEY && !(qual & LR_CTRLKEY)) break; + case UKEY: if (!(qual & LR_ALTKEY)) break; + case ZKEY: if (evnt==ZKEY && !(qual & LR_CTRLKEY)) break; case RETKEY: case ESCKEY: if (marker->flags & (TMARK_EDITALL | TMARK_TEMP)) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 082707fbefb..0ec9e9664f6 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -294,7 +294,8 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m if (textured!=c_textured || texface!=c_texface) { if (textured ) { c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend); - }else { + } + else { GPU_set_tpage(NULL, 0, 0); c_badtex= 0; } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index e30406ea568..eb1d8e1df5c 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1289,7 +1289,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS /* when called while moving in mixed mode, do not draw when... */ if ((drawflags & MAN_TRANS_C)==0) return; - // XXX if(moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]); + // XXX if (moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]); glDisable(GL_DEPTH_TEST); qobj= gluNewQuadric(); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index a1d4c3c990d..092b9c27929 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -724,7 +724,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], if (nu->type == CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; - while(a--) + while (a--) { /* exception */ if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1c5fc18e99f..3e6be67f233 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1049,7 +1049,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit else looking= 1; /* iterate */ - while(looking) { + while (looking) { looking= 0; /* find correct valence edges which are not tagged yet, but connect to tagged one */ @@ -1177,7 +1177,7 @@ static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[ } } - while(stacksize > 0) { + while (stacksize > 0) { int j; stacksize--; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index efb931bf8e5..906856cc64c 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -677,7 +677,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn); #endif - /* this replaces if(i > 0.0) conditional until that is supported */ + /* this replaces if (i > 0.0) conditional until that is supported */ // done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i); if ((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) { @@ -1640,7 +1640,7 @@ void GPU_lamp_free(Object *ob) for (link=ob->gpulamp.first; link; link=link->next) { lamp = link->data; - while(lamp->materials.first) { + while (lamp->materials.first) { nlink = lamp->materials.first; ma = nlink->data; BLI_freelinkN(&lamp->materials, nlink); diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 0f178366b39..a5e7150328b 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -198,7 +198,7 @@ struct IK_Scene // delete scene first if (scene) delete scene; - for(std::vector<IK_Target*>::iterator it = targets.begin(); it != targets.end(); ++it) + for (std::vector<IK_Target*>::iterator it = targets.begin(); it != targets.end(); ++it) delete (*it); targets.clear(); if (channels) @@ -245,7 +245,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co data=(bKinematicConstraint*)con->data; /* exclude tip from chain? */ - if(!(data->flag & CONSTRAINT_IK_TIP)) + if (!(data->flag & CONSTRAINT_IK_TIP)) pchan_tip= pchan_tip->parent; rootbone = data->rootbone; @@ -256,7 +256,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co if (++segcount > 255) // 255 is weak break; - if(segcount==rootbone){ + if (segcount==rootbone){ // reached this end of the chain but if the chain is overlapping with a // previous one, we must go back up to the root of the other chain if ((curchan->flag & POSE_CHAIN) && curchan->iktree.first == NULL){ @@ -289,7 +289,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co // by contruction there can be only one tree per channel and each channel can be part of at most one tree. tree = (PoseTree*)pchan_root->iktree.first; - if(tree==NULL) { + if (tree==NULL) { /* make new tree */ tree= (PoseTree*)MEM_callocN(sizeof(PoseTree), "posetree"); @@ -299,7 +299,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co tree->pchan= (bPoseChannel**)MEM_callocN(segcount*sizeof(void*), "ik tree pchan"); tree->parent= (int*)MEM_callocN(segcount*sizeof(int), "ik tree parent"); - for(a=0; a<segcount; a++) { + for (a=0; a<segcount; a++) { tree->pchan[a]= chanlist[segcount-a-1]; tree->parent[a]= a-1; } @@ -322,19 +322,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++); if (t>=tree->totchannel) break; - for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); + for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); } segcount= segcount-a; target->tip= tree->totchannel + segcount - 1; if (segcount > 0) { - for(parent = a - 1; parent < tree->totchannel; parent++) - if(tree->pchan[parent] == chanlist[segcount-1]->parent) + for (parent = a - 1; parent < tree->totchannel; parent++) + if (tree->pchan[parent] == chanlist[segcount-1]->parent) break; /* shouldn't happen, but could with dependency cycles */ - if(parent == tree->totchannel) + if (parent == tree->totchannel) parent = a - 1; /* resize array */ @@ -350,7 +350,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co MEM_freeN(oldparent); /* add new pose channels at the end, in reverse order */ - for(a=0; a<segcount; a++) { + for (a=0; a<segcount; a++) { tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1]; tree->parent[tree->totchannel+a]= tree->totchannel+a-1; } @@ -401,8 +401,8 @@ int initialize_scene(Object *ob, bPoseChannel *pchan_tip) /* find all IK constraints and validate them */ treecount = 0; - for(con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) { - if(con->type==CONSTRAINT_TYPE_KINEMATIC) { + for (con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) { + if (con->type==CONSTRAINT_TYPE_KINEMATIC) { if (constraint_valid(con)) treecount += initialize_chain(ob, pchan_tip, con); } @@ -428,12 +428,12 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis) if (t > 16.0*KDL::epsilon) { if (axis == 0) return -KDL::atan2(R(1,2), R(2,2)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); + else if (axis == 1) return KDL::atan2(-R(0,2), t); else return -KDL::atan2(R(0,1), R(0,0)); } else { if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); + else if (axis == 1) return KDL::atan2(-R(0,2), t); else return 0.0f; } } @@ -873,7 +873,7 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree) int a, flag, njoint; njoint = 0; - for(a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) { + for (a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) { pchan= tree->pchan[a]; ikchan->pchan = pchan; ikchan->parent = (a>0) ? tree->parent[a] : -1; @@ -881,17 +881,17 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree) /* set DoF flag */ flag = 0; - if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && (!(pchan->ikflag & BONE_IK_XLIMIT) || pchan->limitmin[0]<0.f || pchan->limitmax[0]>0.f)) flag |= IK_XDOF; - if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) && (!(pchan->ikflag & BONE_IK_YLIMIT) || pchan->limitmin[1]<0.f || pchan->limitmax[1]>0.f)) flag |= IK_YDOF; - if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) && (!(pchan->ikflag & BONE_IK_ZLIMIT) || pchan->limitmin[2]<0.f || pchan->limitmax[2]>0.f)) flag |= IK_ZDOF; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if (tree->stretch && (pchan->ikstretch > 0.0)) { flag |= IK_TRANSY; } /* @@ -994,7 +994,7 @@ static void convert_pose(IK_Scene *ikscene) // assume uniform scaling and take Y scale as general scale for the armature scale = len_v3(ikscene->blArmature->obmat[1]); rot = &ikscene->jointArray(0); - for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { + for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1035,7 +1035,7 @@ static void rest_pose(IK_Scene *ikscene) SetToZero(ikscene->jointArray); // except for transY joints rot = &ikscene->jointArray(0); - for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { + for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1133,7 +1133,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) rest_pose(ikscene); } rot = &ikscene->jointArray(0); - for(a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) { + for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1500,7 +1500,7 @@ static void create_scene(Scene *scene, Object *ob) bPoseChannel *pchan; // create the IK scene - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { // by construction there is only one tree PoseTree *tree = (PoseTree*)pchan->iktree.first; if (tree) { @@ -1515,9 +1515,9 @@ static void create_scene(Scene *scene, Object *ob) while(tree) { BLI_remlink(&pchan->iktree, tree); BLI_freelistN(&tree->targets); - if(tree->pchan) MEM_freeN(tree->pchan); - if(tree->parent) MEM_freeN(tree->parent); - if(tree->basis_change) MEM_freeN(tree->basis_change); + if (tree->pchan) MEM_freeN(tree->pchan); + if (tree->parent) MEM_freeN(tree->parent); + if (tree->basis_change) MEM_freeN(tree->basis_change); MEM_freeN(tree); tree = (PoseTree*)pchan->iktree.first; } @@ -1528,7 +1528,7 @@ static void create_scene(Scene *scene, Object *ob) static void init_scene(Object *ob) { if (ob->pose->ikdata) { - for(IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first; + for (IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first; scene != NULL; scene = scene->next) { scene->channels[0].pchan->flag |= POSE_IKTREE; @@ -1550,7 +1550,7 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl } else { // in animation mode, we must get the bone position from action and constraints - for(i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) { + for (i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) { if (!(ikchan->pchan->flag & POSE_DONE)) where_is_pose_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); // tell blender that this channel was controlled by IK, it's cleared on each where_is_pose() @@ -1711,8 +1711,8 @@ void itasc_initialize_tree(struct Scene *scene, Object *ob, float ctime) itasc_clear_data(ob->pose); // we should handle all the constraint and mark them all disabled // for blender but we'll start with the IK constraint alone - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { - if(pchan->constflag & PCHAN_HAS_IK) + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + if (pchan->constflag & PCHAN_HAS_IK) count += initialize_scene(ob, pchan); } // if at least one tree, create the scenes from the PoseTree stored in the channels diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 49ba566b6e8..f5e9e536e41 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -90,7 +90,7 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const // c.u |= (c.u >> 6) & 0x000300; // color_array[1].u = c.u; - if( col0.u > col1.u ) { + if ( col0.u > col1.u ) { // Four-color block: derive the other two colors. color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; @@ -137,7 +137,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const int gdiff = color_array[1].g - color_array[0].g; - if( col0.u > col1.u ) { + if ( col0.u > col1.u ) { // Four-color block: derive the other two colors. color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8; color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; @@ -227,8 +227,8 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const evaluatePalette(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -242,8 +242,8 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const evaluatePaletteNV5x(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -253,7 +253,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const void BlockDXT1::setIndices(int * idx) { indices = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { indices |= (idx[i] & 3) << (2 * i); } } @@ -423,7 +423,7 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const uint8 index_array[16]; indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { block->color(i).a = alpha_array[index_array[i]]; } } @@ -496,7 +496,7 @@ void BlockATI1::decodeBlock(ColorBlock * block) const uint8 index_array[16]; alpha.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.b = c.g = c.r = alpha_array[index_array[i]]; c.a = 255; @@ -525,7 +525,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const x.evaluatePalette(alpha_array); x.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.r = alpha_array[index_array[i]]; } @@ -533,7 +533,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const y.evaluatePalette(alpha_array); y.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.g = alpha_array[index_array[i]]; c.b = 0; @@ -587,8 +587,8 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const evaluatePalette(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -598,7 +598,7 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const void BlockCTX1::setIndices(int * idx) { indices = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { indices |= (idx[i] & 3) << (2 * i); } } diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 0b4a7cabf92..42ef799cf3e 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -59,7 +59,7 @@ ColorBlock::ColorBlock() /// Init the color block from an array of colors. ColorBlock::ColorBlock(const uint * linearImage) { - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { color(i) = Color32(linearImage[i]); } } @@ -67,7 +67,7 @@ ColorBlock::ColorBlock(const uint * linearImage) /// Init the color block with the contents of the given block. ColorBlock::ColorBlock(const ColorBlock & block) { - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { color(i) = block.color(i); } } @@ -181,7 +181,7 @@ bool ColorBlock::isSingleColorNoAlpha() const { Color32 c; int i; - for(i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { if (m_color[i].a != 0) c = m_color[i]; } @@ -189,7 +189,7 @@ bool ColorBlock::isSingleColorNoAlpha() const Color32 mask(0xFF, 0xFF, 0xFF, 0x00); uint u = c.u & mask.u; - for(; i < 16; i++) + for (; i < 16; i++) { if (u != (m_color[i].u & mask.u)) { @@ -207,16 +207,16 @@ bool ColorBlock::isSingleColorNoAlpha() const uint count = 0; // @@ This does not have to be o(n^2) - for(int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { bool unique = true; - for(int j = 0; j < i; j++) { - if( m_color[i] != m_color[j] ) { + for (int j = 0; j < i; j++) { + if ( m_color[i] != m_color[j] ) { unique = false; } } - if( unique ) { + if ( unique ) { count++; } } @@ -230,7 +230,7 @@ Color32 ColorBlock::averageColor() const uint r, g, b, a; r = g = b = a = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { r += m_color[i].r; g += m_color[i].g; b += m_color[i].b; @@ -258,10 +258,10 @@ void ColorBlock::diameterRange(Color32 * start, Color32 * end) const Color32 c0, c1; uint best_dist = 0; - for(int i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { for (int j = i+1; j < 16; j++) { uint dist = colorDistance(m_color[i], m_color[j]); - if( dist > best_dist ) { + if ( dist > best_dist ) { best_dist = dist; c0 = m_color[i]; c1 = m_color[j]; @@ -281,7 +281,7 @@ void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const maxLuminance = minLuminance = colorLuminance(m_color[0]); - for(uint i = 1; i < 16; i++) + for (uint i = 1; i < 16; i++) { uint luminance = colorLuminance(m_color[i]); @@ -305,7 +305,7 @@ void ColorBlock::boundsRange(Color32 * start, Color32 * end) const Color32 minColor(255, 255, 255); Color32 maxColor(0, 0, 0); - for(uint i = 0; i < 16; i++) + for (uint i = 0; i < 16; i++) { if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } @@ -339,7 +339,7 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const Color32 minColor(255, 255, 255, 255); Color32 maxColor(0, 0, 0, 0); - for(uint i = 0; i < 16; i++) + for (uint i = 0; i < 16; i++) { if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } @@ -377,14 +377,14 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const void ColorBlock::sortColorsByAbsoluteValue() { // Dummy selection sort. - for( uint a = 0; a < 16; a++ ) { + for ( uint a = 0; a < 16; a++ ) { uint max = a; Color16 cmax(m_color[a]); - for( uint b = a+1; b < 16; b++ ) { + for ( uint b = a+1; b < 16; b++ ) { Color16 cb(m_color[b]); - if( cb.u > cmax.u ) { + if ( cb.u > cmax.u ) { max = b; cmax = cb; } @@ -404,16 +404,16 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) float min, max; min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis); - for(uint i = 1; i < 16; i++) + for (uint i = 1; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); float val = dot(vec, axis); - if( val < min ) { + if ( val < min ) { mini = i; min = val; } - else if( val > max ) { + else if ( val > max ) { maxi = i; max = val; } @@ -429,16 +429,16 @@ void ColorBlock::sortColors(const Vector3 & axis) { float luma_array[16]; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); luma_array[i] = dot(vec, axis); } // Dummy selection sort. - for( uint a = 0; a < 16; a++ ) { + for ( uint a = 0; a < 16; a++ ) { uint min = a; - for( uint b = a+1; b < 16; b++ ) { - if( luma_array[b] < luma_array[min] ) { + for ( uint b = a+1; b < 16; b++ ) { + if ( luma_array[b] < luma_array[min] ) { min = b; } } @@ -454,7 +454,7 @@ float ColorBlock::volume() const Box bounds; bounds.clearBounds(); - for(int i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b); bounds.addPointToBounds(point); } diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index f98f37e388c..e2874652f02 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -803,7 +803,7 @@ void DDSHeader::swapBytes() this->depth = POSH_LittleU32(this->depth); this->mipmapcount = POSH_LittleU32(this->mipmapcount); - for(int i = 0; i < 11; i++) { + for (int i = 0; i < 11; i++) { this->reserved[i] = POSH_LittleU32(this->reserved[i]); } @@ -899,7 +899,7 @@ bool DirectDrawSurface::isValid() const } const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/); - if( (header.flags & required) != required ) { + if ( (header.flags & required) != required ) { return false; } @@ -909,7 +909,7 @@ bool DirectDrawSurface::isValid() const /* in some files DDSCAPS_TEXTURE is missing: silently ignore */ /* - if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { + if ( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { return false; } */ diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index b7a3d0e43ba..071d94c2076 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -81,13 +81,13 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags) Color32 pixel; Color32 *pixels = 0; - if(!imb_is_a_dds(mem)) + if (!imb_is_a_dds(mem)) return (0); /* check if DDS is valid and supported */ if (!dds.isValid()) { /* no need to print error here, just testing if it is a DDS */ - if(flags & IB_test) + if (flags & IB_test) return (0); printf("DDS: not valid; header follows\n"); diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index a93f47db9a3..0e6567d2c6b 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -471,7 +471,7 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter) ibuf->miptot= 1; - while(curmap < IB_MIPMAP_LEVELS) { + while (curmap < IB_MIPMAP_LEVELS) { if (ibuf->mipmap[curmap]) { @@ -507,7 +507,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) ibuf->miptot= 1; - while(curmap < IB_MIPMAP_LEVELS) { + while (curmap < IB_MIPMAP_LEVELS) { if (use_filter) { ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect); IMB_filterN(nbuf, hbuf); diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 85bd3137ddc..1976242ea4f 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -62,7 +62,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) if (ibuf->rect) { size = ibuf->x * ibuf->y; - while(size-- > 0) { + while (size-- > 0) { rt= cp[0]; cp[0]= cp[3]; cp[3]= rt; @@ -76,7 +76,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) if (ibuf->rect_float) { size = ibuf->x * ibuf->y; - while(size-- > 0) { + while (size-- > 0) { rtf= cpf[0]; cpf[0]= cpf[3]; cpf[3]= rtf; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 33ff769217d..e50f8e16ea5 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -863,7 +863,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, frame_rate = av_q2d(context->iStream->r_frame_rate); pts_time_base = av_q2d(context->iStream->time_base); - while(av_read_frame(context->iFormatCtx, &next_packet) >= 0) { + while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) { int frame_finished = 0; float next_progress = (float)((int)floor(((double) next_packet.pos) * 100 / ((double) stream_size)+0.5)) / 100; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index b4f1415207e..e775d0f7bbd 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -196,7 +196,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len) { int r = 0; - while(len) { + while (len) { r = putlong(outf,*tab++); len -= 4; } @@ -205,7 +205,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len) static void readtab(FILE *inf, unsigned int *tab, int len) { - while(len) { + while (len) { *tab++ = getlong(inf); len -= 4; } @@ -222,7 +222,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf) len= ibuf->x*ibuf->y; zval= ibuf->zbuf; - while(len--) { + while (len--) { zval[0]= BIG_LONG(zval[0]); zval++; } @@ -540,7 +540,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n) { lptr += z; - while(n--) { + while (n--) { *lptr = *cptr++; lptr += 4; } @@ -549,7 +549,7 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n) { lptr += z; - while(n--) { + while (n--) { *lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF; cptr += 2; lptr += 4; @@ -562,14 +562,14 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) float pixel_f; optr += z; - while(1) { + while (1) { pixel = (iptr[0]<<8) | (iptr[1]<<0); iptr += 2; if ( !(count = (pixel & 0x7f)) ) return; if (pixel & 0x80) { - while(count>=8) { + while (count>=8) { optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF; optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF; @@ -582,7 +582,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) iptr += 8*2; count -= 8; } - while(count--) { + while (count--) { *optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; iptr+=2; optr+=4; @@ -592,7 +592,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; iptr += 2; - while(count>=8) { + while (count>=8) { optr[0*4] = pixel_f; optr[1*4] = pixel_f; optr[2*4] = pixel_f; @@ -604,7 +604,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) optr += 8*4; count -= 8; } - while(count--) { + while (count--) { *optr = pixel_f; optr+=4; } @@ -617,12 +617,12 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) unsigned char pixel, count; optr += z; - while(1) { + while (1) { pixel = *iptr++; if ( !(count = (pixel & 0x7f)) ) return; if (pixel & 0x80) { - while(count>=8) { + while (count>=8) { optr[0*4] = iptr[0]; optr[1*4] = iptr[1]; optr[2*4] = iptr[2]; @@ -635,14 +635,14 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) iptr += 8; count -= 8; } - while(count--) { + while (count--) { *optr = *iptr++; optr+=4; } } else { pixel = *iptr++; - while(count>=8) { + while (count>=8) { optr[0*4] = pixel; optr[1*4] = pixel; optr[2*4] = pixel; @@ -654,7 +654,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) optr += 8*4; count -= 8; } - while(count--) { + while (count--) { *optr = pixel; optr+=4; } @@ -764,7 +764,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n) { lumptr += CHANOFFSET(0); - while(n--) { + while (n--) { *lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]); lumptr += 4; rgbptr += 4; @@ -782,18 +782,18 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn ibufend = iptr+cnt*4; optr = rlebuf; - while(iptr<ibufend) { + while (iptr<ibufend) { sptr = iptr; iptr += 8; - while((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0]))) + while ((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0]))) iptr+=4; iptr -= 8; count = (iptr-sptr)/4; - while(count) { + while (count) { todo = count>126 ? 126:count; count -= todo; *optr++ = 0x80|todo; - while(todo>8) { + while (todo>8) { optr[0] = sptr[0*4]; optr[1] = sptr[1*4]; optr[2] = sptr[2*4]; @@ -807,7 +807,7 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn sptr += 8*4; todo -= 8; } - while(todo--) { + while (todo--) { *optr++ = *sptr; sptr += 4; } @@ -815,10 +815,10 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn sptr = iptr; cc = *iptr; iptr += 4; - while( (iptr<ibufend) && (*iptr == cc) ) + while ( (iptr<ibufend) && (*iptr == cc) ) iptr += 4; count = (iptr-sptr)/4; - while(count) { + while (count) { todo = count>126 ? 126:count; count -= todo; *optr++ = todo; diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index 24317278a43..307c634b26a 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -114,7 +114,7 @@ static void check_unused_keys(MovieCache *cache) GHashIterator *iter; iter= BLI_ghashIterator_new(cache->hash); - while(!BLI_ghashIterator_isDone(iter)) { + while (!BLI_ghashIterator_isDone(iter)) { MovieCacheKey *key= BLI_ghashIterator_getKey(iter); MovieCacheItem *item= BLI_ghashIterator_getValue(iter); @@ -322,7 +322,7 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_ iter= BLI_ghashIterator_new(cache->hash); a= 0; - while(!BLI_ghashIterator_isDone(iter)) { + while (!BLI_ghashIterator_isDone(iter)) { MovieCacheKey *key= BLI_ghashIterator_getKey(iter); MovieCacheItem *item= BLI_ghashIterator_getValue(iter); int framenr, curproxy, curflags; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index bb92bd9cc09..3d90267b030 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -187,7 +187,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf) { ImMetaData* info; - for(info= ibuf->metadata; info; info= info->next) + for (info= ibuf->metadata; info; info= info->next) header->insert(info->key, StringAttribute(info->value)); } @@ -231,7 +231,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); - if(ibuf->rect_float) { + if (ibuf->rect_float) { float *from; for (int i = ibuf->y-1; i >= 0; i--) @@ -251,7 +251,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags else { unsigned char *from; - if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) { for (int i = ibuf->y-1; i >= 0; i--) { from= (unsigned char *)ibuf->rect + channels*i*width; @@ -451,7 +451,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname echan= (ExrChannel *)MEM_callocN(sizeof(ExrChannel), "exr tile channel"); - if(layname) { + if (layname) { char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1]; BLI_strncpy(lay, layname, EXR_LAY_MAXNAME); BLI_strncpy(pass, passname, EXR_PASS_MAXNAME); @@ -479,7 +479,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh data->width= width; data->height= height; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) header.channels().insert (echan->name, Channel (FLOAT)); openexr_header_compression(&header, compress); @@ -512,7 +512,7 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int data->height= height; data->mipmap= mipmap; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) header.channels().insert (echan->name, Channel (FLOAT)); header.setTileDescription (TileDescription (tilex, tiley, (mipmap)? MIPMAP_LEVELS: ONE_LEVEL)); @@ -529,9 +529,9 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig { ExrHandle *data= (ExrHandle *)handle; - if(BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ + if (BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ data->ifile = new InputFile(filename); - if(data->ifile) { + if (data->ifile) { Box2i dw = data->ifile->header().dataWindow(); data->width= *width = dw.max.x - dw.min.x + 1; data->height= *height = dw.max.y - dw.min.y + 1; @@ -554,7 +554,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname ExrChannel *echan; char name[EXR_TOT_MAXNAME + 1]; - if(layname) { + if (layname) { char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1]; BLI_strncpy(lay, layname, EXR_LAY_MAXNAME); BLI_strncpy(pass, passname, EXR_PASS_MAXNAME); @@ -566,7 +566,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name)); - if(echan) { + if (echan) { echan->xstride= xstride; echan->ystride= ystride; echan->rect= rect; @@ -587,7 +587,7 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party, int level) FrameBuffer frameBuffer; ExrChannel *echan; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { float *rect= echan->rect - echan->xstride*partx - echan->ystride*party; frameBuffer.insert (echan->name, Slice (FLOAT, (char *)rect, @@ -611,8 +611,8 @@ void IMB_exr_write_channels(void *handle) FrameBuffer frameBuffer; ExrChannel *echan; - if(data->channels.first) { - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + if (data->channels.first) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { /* last scanline, stride negative */ float *rect = echan->rect + echan->xstride*(data->height-1)*data->width; @@ -643,10 +643,10 @@ void IMB_exr_read_channels(void *handle) const StringAttribute *ta = data->ifile->header().findTypedAttribute <StringAttribute> ("BlenderMultiChannel"); short flip = (ta && strncmp(ta->value().c_str(), "Blender V2.43", 13)==0); /* 'previous multilayer attribute, flipped */ - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { - if(echan->rect) { - if(flip) + if (echan->rect) { + if (flip) frameBuffer.insert (echan->name, Slice (FLOAT, (char *)echan->rect, echan->xstride*sizeof(float), echan->ystride*sizeof(float))); else @@ -676,15 +676,15 @@ void IMB_exr_multilayer_convert(void *handle, void *base, ExrLayer *lay; ExrPass *pass; - if(data->layers.first==NULL) { + if (data->layers.first==NULL) { printf("cannot convert multilayer, no layers in handle\n"); return; } - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { void *laybase= addlayer(base, lay->name); - if(laybase) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { + if (laybase) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { addpass(base, laybase, pass->name, pass->rect, pass->totchan, pass->chan_id); pass->rect= NULL; } @@ -699,11 +699,11 @@ void IMB_exr_close(void *handle) ExrLayer *lay; ExrPass *pass; - if(data->ifile) + if (data->ifile) delete data->ifile; - else if(data->ofile) + else if (data->ofile) delete data->ofile; - else if(data->tofile) + else if (data->tofile) delete data->tofile; data->ifile= NULL; @@ -712,9 +712,9 @@ void IMB_exr_close(void *handle) BLI_freelistN(&data->channels); - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) - if(pass->rect) + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) + if (pass->rect) MEM_freeN(pass->rect); BLI_freelistN(&lay->passes); } @@ -730,11 +730,11 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa { int plen, len= strlen(echan->name); - if(len < 4) { + if (len < 4) { printf("multilayer read: name too short: %s\n", echan->name); return 0; } - if(echan->name[len-2]!='.') { + if (echan->name[len-2]!='.') { printf("multilayer read: name has no Channel: %s\n", echan->name); return 0; } @@ -742,19 +742,19 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa len-= 3; while(len>=0) { - if(echan->name[len]=='.') + if (echan->name[len]=='.') break; len--; } BLI_strncpy(passname, echan->name+len+1, EXR_PASS_MAXNAME); plen= strlen(passname); - if(plen < 3) { + if (plen < 3) { printf("multilayer read: should not happen: %s\n", echan->name); return 0; } passname[plen-2]= 0; - if(len<1) + if (len<1) layname[0]= 0; else { BLI_strncpy(layname, echan->name, EXR_LAY_MAXNAME); @@ -768,7 +768,7 @@ static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname) { ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name)); - if(lay==NULL) { + if (lay==NULL) { lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer"); BLI_addtail(lb, lay); BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME); @@ -781,10 +781,10 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname) { ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name)); - if(pass==NULL) { + if (pass==NULL) { pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass"); - if(strcmp(passname, "Combined")==0) + if (strcmp(passname, "Combined")==0) BLI_addhead(lb, pass); else BLI_addtail(lb, pass); @@ -816,29 +816,29 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) /* now try to sort out how to assign memory to the channels */ /* first build hierarchical layer list */ - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { - if( imb_exr_split_channel_name(echan, layname, passname) ) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + if ( imb_exr_split_channel_name(echan, layname, passname) ) { ExrLayer *lay= imb_exr_get_layer(&data->layers, layname); ExrPass *pass= imb_exr_get_pass(&lay->passes, passname); pass->chan[pass->totchan]= echan; pass->totchan++; - if(pass->totchan>=EXR_PASS_MAXCHAN) + if (pass->totchan>=EXR_PASS_MAXCHAN) break; } } - if(echan) { + if (echan) { printf("error, too many channels in one pass: %s\n", echan->name); IMB_exr_close(data); return NULL; } /* with some heuristics, try to merge the channels in buffers */ - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { - if(pass->totchan) { + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { + if (pass->totchan) { pass->rect= (float *)MEM_mapallocN(width*height*pass->totchan*sizeof(float), "pass rect"); - if(pass->totchan==1) { + if (pass->totchan==1) { echan= pass->chan[0]; echan->rect= pass->rect; echan->xstride= 1; @@ -851,14 +851,14 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) memset(lookup, 0, sizeof(lookup)); /* we can have RGB(A), XYZ(W), UVA */ - if(pass->totchan==3 || pass->totchan==4) { - if(pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') { + if (pass->totchan==3 || pass->totchan==4) { + if (pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') { lookup[(unsigned int)'R']= 0; lookup[(unsigned int)'G']= 1; lookup[(unsigned int)'B']= 2; lookup[(unsigned int)'A']= 3; } - else if(pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') { + else if (pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') { lookup[(unsigned int)'X']= 0; lookup[(unsigned int)'Y']= 1; lookup[(unsigned int)'Z']= 2; @@ -869,7 +869,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) lookup[(unsigned int)'V']= 1; lookup[(unsigned int)'A']= 2; } - for(a=0; a<pass->totchan; a++) { + for (a=0; a<pass->totchan; a++) { echan= pass->chan[a]; echan->rect= pass->rect + lookup[(unsigned int)echan->chan_id]; echan->xstride= pass->totchan; @@ -878,7 +878,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) } } else { /* unknown */ - for(a=0; a<pass->totchan; a++) { + for (a=0; a<pass->totchan; a++) { echan= pass->chan[a]; echan->rect= pass->rect + a; echan->xstride= pass->totchan; @@ -928,8 +928,8 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan) /* const Channel &channel = i.channel(); */ /* Not used yet */ const char *str= i.name(); int len= strlen(str); - if(len) { - if(BLI_strcasecmp(chan, str+len-1)==0) { + if (len) { + if (BLI_strcasecmp(chan, str+len-1)==0) { return str; } } @@ -947,8 +947,8 @@ static int exr_has_zbuffer(InputFile *file) static int exr_is_renderresult(InputFile *file) { const StringAttribute *comments= file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel"); - if(comments) -// if(comments->value() == "Blender MultiChannel") + if (comments) +// if (comments->value() == "Blender MultiChannel") return 1; return 0; } @@ -973,13 +973,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) //printf("OpenEXR-load: image data window %d %d %d %d\n", // dw.min.x, dw.min.y, dw.max.x, dw.max.y); - if(0) // debug + if (0) // debug exr_print_filecontents(file); is_multi= exr_is_renderresult(file); /* do not make an ibuf when */ - if(is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) + if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) { printf("Error: can't process EXR multilayer file\n"); } @@ -993,11 +993,11 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) if (!(flags & IB_test)) { - if(is_multi) /* only enters with IB_multilayer flag set */ + if (is_multi) /* only enters with IB_multilayer flag set */ { /* constructs channels for reading, allocates memory in channels */ ExrHandle *handle= imb_exr_begin_read_mem(file, width, height); - if(handle) { + if (handle) { IMB_exr_read_channels(handle); ibuf->userdata= handle; /* potential danger, the caller has to check for this! */ return ibuf; @@ -1026,7 +1026,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) frameBuffer.insert ( exr_rgba_channelname(file, "A"), Slice (FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */ - if(exr_has_zbuffer(file)) + if (exr_has_zbuffer(file)) { float *firstz; @@ -1046,7 +1046,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) // // Disabling this because the sequencer frees immediate. // - // if(flag & IM_rect) + // if (flag & IM_rect) // IMB_rect_from_float(ibuf); } } diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index c8c4a4fd38c..7aceb695d00 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -153,7 +153,7 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI if (fputc(last-1,file) == EOF) return(0); do { if (out(*rect++,file) == EOF) return(0); - } while(--last != 0); + } while (--last != 0); } rectstart = rect; rect = temp; @@ -204,14 +204,14 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) rect = (uchar *) ibuf->rect; if (ibuf->planes <= 8) { - while(size > 0) { + while (size > 0) { if (putc(*rect, file) == EOF) return (0); size--; rect += 4; } } else if (ibuf->planes <= 16) { - while(size > 0) { + while (size > 0) { putc(rect[0], file); if (putc(rect[1], file) == EOF) return (0); size--; @@ -219,7 +219,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } } else if (ibuf->planes <= 24) { - while(size > 0) { + while (size > 0) { putc(rect[2], file); putc(rect[1], file); if (putc(rect[0], file) == EOF) return (0); @@ -228,7 +228,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } } else if (ibuf->planes <= 32) { - while(size > 0) { + while (size > 0) { putc(rect[2], file); putc(rect[1], file); putc(rect[0], file); @@ -384,7 +384,7 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size, cp[0] = 0xff; cp[1] = cp[2] = 0; - while(size > 0) { + while (size > 0) { count = *mem++; if (mem>mem_end) @@ -502,7 +502,7 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in cp[0] = 0xff; cp[1] = cp[2] = 0; - while(size > 0) { + while (size > 0) { if (mem>mem_end) goto partial_load; diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 91df1e78f44..2d477a5f43d 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -76,7 +76,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile) endian_switch = ((ENDIAN_ORDER != endian)) ? 1 : 0; - while(gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) { + while (gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) { if (endian_switch) SWITCH_INT(bhead[1]); /* length */ diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 473934c3b44..987d7c1ade2 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2862,7 +2862,7 @@ static const char *cpp_classes = "" "class CollectionIterator {\n" "public:\n" " CollectionIterator() : t(iter.ptr), init(false) { iter.valid= false; }\n" -" ~CollectionIterator(void) { if(init) Tend(&iter); };\n" +" ~CollectionIterator(void) { if (init) Tend(&iter); };\n" "\n" " operator bool(void)\n" " { return iter.valid != 0; }\n" @@ -2876,7 +2876,7 @@ static const char *cpp_classes = "" "{ return iter.valid != other.iter.valid; }\n" "\n" " void begin(const Pointer& ptr)\n" -" { if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n" +" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n" "\n" "private:\n" " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=" diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 05d1401f8b8..17ff4dd1842 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -149,7 +149,7 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3]) { - while((md=md->next) && md->type==eModifierType_Armature) { + while ((md=md->next) && md->type==eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData*) md; if (amd->multi && amd->prevCos==NULL) amd->prevCos= MEM_dupallocN(vertexCos); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index ed74d657cac..1b96c586cbf 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -227,7 +227,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat); } - else { /* if(cam->type == CAM_ORTHO) */ + else { /* if (cam->type == CAM_ORTHO) */ float orthomat[4][4]; orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 0e09f2d22ee..354bb458ea9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -306,7 +306,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref x= imgx*imgy; dest= new->rect; wb= wbuf->rect; - while(x--) { + while (x--) { val= 1.0f/wb[0]; dest[0]*= val; dest[1]*= val; diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 46b134e4f65..fc6e6847f34 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -385,9 +385,9 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // main loop #ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */ #ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */ - #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided) + #pragma omp parallel for private(y) if (!nqd->preview) schedule(guided) #else - #pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided) + #pragma omp parallel for private(y) if (!nqd->preview && img->y*img->x > 16384) schedule(guided) #endif #endif for (y=0; y<img->y; y++) { diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index b28f6a91dab..38cce50904b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -121,7 +121,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b fp = stackbuf->rect; a = stackbuf->x * stackbuf->y; - while(a--) { + while (a--) { copy_v4_v4(fp, in[0]->vec); fp += 4; } diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c index 805a7e54f04..5a6a92b5e27 100644 --- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c +++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c @@ -83,7 +83,7 @@ static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id) { bNodeType *ntype = list->first; - while(ntype) { + while (ntype) { if (ntype->type == NODE_DYNAMIC && ntype->id == id) break; ntype = ntype->next; diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 22748fec2ea..2b899fde593 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -87,7 +87,7 @@ static void unique_name(bNode *node) char *name = tno->name; i = node; - while(i->prev) i = i->prev; + while (i->prev) i = i->prev; for (; i; i=i->next) { if ( i == node || @@ -127,7 +127,7 @@ static void assign_index(struct bNode *node) int index = 1; tnode = node; - while(tnode->prev) + while (tnode->prev) tnode = tnode->prev; check_index: diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index 3f675a1b9ab..687498ba66e 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -60,7 +60,7 @@ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void * copy_v3_v3(rayface->v2, v2); copy_v3_v3(rayface->v3, v3); - if(v4) + if (v4) { copy_v3_v3(rayface->v4, v4); rayface->quad = 1; @@ -77,13 +77,13 @@ MALWAYS_INLINE void rayface_from_vlak(RayFace *rayface, ObjectInstanceRen *obi, { rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4 ? vlr->v4->co : 0); - if(obi->transform_primitives) + if (obi->transform_primitives) { mul_m4_v3(obi->mat, rayface->v1); mul_m4_v3(obi->mat, rayface->v2); mul_m4_v3(obi->mat, rayface->v3); - if(RE_rayface_isQuad(rayface)) + if (RE_rayface_isQuad(rayface)) mul_m4_v3(obi->mat, rayface->v4); } } @@ -109,11 +109,11 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe { /* for baking selected to active non-traceable materials might still * be in the raytree */ - if(!(vlr->flag & R_TRACEBLE)) + if (!(vlr->flag & R_TRACEBLE)) return 0; /* I know... cpu cycle waste, might do smarter once */ - if(is->mode==RE_RAY_MIRROR) + if (is->mode==RE_RAY_MIRROR) return !(vlr->mat->mode & MA_ONLYCAST); else return (is->lay & obi->lay); @@ -159,21 +159,21 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl sub_v3_v3v3(m, start, co3); det1= dot_v3v3(m, x); - if(divdet != 0.0f) { + if (divdet != 0.0f) { divdet= 1.0f/divdet; v= det1*divdet; - if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { float cros[3]; cross_v3_v3v3(cros, m, t0); u= divdet*dot_v3v3(cros, r); - if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) { l= divdet*dot_v3v3(cros, t1); /* check if intersection is within ray length */ - if(l > -RE_RAYTRACE_EPSILON && l < *lambda) { + if (l > -RE_RAYTRACE_EPSILON && l < *lambda) { uv[0]= u; uv[1]= v; *lambda= l; @@ -184,25 +184,25 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl } /* intersect second triangle in quad */ - if(quad) { + if (quad) { copy_v3_v3(co4, face->v4); sub_v3_v3v3(t0, co3, co4); divdet= dot_v3v3(t0, x); - if(divdet != 0.0f) { + if (divdet != 0.0f) { divdet= 1.0f/divdet; v = det1*divdet; - if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { float cros[3]; cross_v3_v3v3(cros, m, t0); u= divdet*dot_v3v3(cros, r); - if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) { l= divdet*dot_v3v3(cros, t1); - if(l >- RE_RAYTRACE_EPSILON && l < *lambda) { + if (l >- RE_RAYTRACE_EPSILON && l < *lambda) { uv[0]= u; uv[1]= -(1.0f + v + u); *lambda= l; @@ -242,38 +242,38 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace sub_v3_v3v3(m, start, co3); det1= dot_v3v3(m, x); - if(divdet != 0.0f) { + if (divdet != 0.0f) { divdet= 1.0f/divdet; v= det1*divdet; - if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { float cros[3]; cross_v3_v3v3(cros, m, t0); u= divdet*dot_v3v3(cros, r); - if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) + if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) return 1; } } /* intersect second triangle in quad */ - if(quad) { + if (quad) { copy_v3_v3(co4, face->v4); sub_v3_v3v3(t0, co3, co4); divdet= dot_v3v3(t0, x); - if(divdet != 0.0f) { + if (divdet != 0.0f) { divdet= 1.0f/divdet; v = det1*divdet; - if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { + if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) { float cros[3]; cross_v3_v3v3(cros, m, t0); u= divdet*dot_v3v3(cros, r); - if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) + if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) return 2; } } @@ -291,24 +291,24 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i int ok= 0; /* avoid self-intersection */ - if(is->orig.ob == face->ob && is->orig.face == face->face) + if (is->orig.ob == face->ob && is->orig.face == face->face) return 0; /* check if we should intersect this face */ - if(is->check == RE_CHECK_VLR_RENDER) + if (is->check == RE_CHECK_VLR_RENDER) { - if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) + if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) return 0; } - else if(is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL) + else if (is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL) { - if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) + if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) return 0; - if(vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) + if (vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) return 0; } - else if(is->check == RE_CHECK_VLR_BAKE) { - if(vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) + else if (is->check == RE_CHECK_VLR_BAKE) { + if (vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) return 0; } @@ -318,13 +318,13 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i dist= is->dist; ok= isec_tri_quad(is->start, is->dir, face, uv, &dist); - if(ok) { + if (ok) { /* when a shadow ray leaves a face, it can be little outside the edges * of it, causing intersection to be detected in its neighbor face */ - if(is->skip & RE_SKIP_VLR_NEIGHBOUR) + if (is->skip & RE_SKIP_VLR_NEIGHBOUR) { - if(dist < 0.1f && is->orig.ob == face->ob) + if (dist < 0.1f && is->orig.ob == face->ob) { VlakRen * a = (VlakRen*)is->orig.face; VlakRen * b = (VlakRen*)face->face; @@ -332,7 +332,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i /* so there's a shared edge or vertex, let's intersect ray with * face itself, if that's true we can safely return 1, otherwise * we assume the intersection is invalid, 0 */ - if(a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1 + if (a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1 || a->v1==b->v2 || a->v2==b->v2 || a->v3==b->v2 || a->v4==b->v2 || a->v1==b->v3 || a->v2==b->v3 || a->v3==b->v3 || a->v4==b->v3 || (b->v4 && (a->v1==b->v4 || a->v2==b->v4 || a->v3==b->v4 || a->v4==b->v4))) { @@ -341,7 +341,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i ObjectInstanceRen *ob= (ObjectInstanceRen*)is->orig.ob; rayface_from_vlak(&origface, ob, (VlakRen*)is->orig.face); - if(!isec_tri_quad_neighbour(is->start, is->dir, &origface)) + if (!isec_tri_quad_neighbour(is->start, is->dir, &origface)) { return 0; } @@ -375,7 +375,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec) RE_RC_COUNT(isec->raycounter->raycast.test); /* setup vars used on raycast */ - for(i=0; i<3; i++) + for (i=0; i<3; i++) { isec->idot_axis[i] = 1.0f / isec->dir[i]; @@ -388,11 +388,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec) #ifdef RT_USE_LAST_HIT /* last hit heuristic */ - if(isec->mode==RE_RAY_SHADOW && isec->last_hit) + if (isec->mode==RE_RAY_SHADOW && isec->last_hit) { RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.test); - if(RE_rayobject_intersect(isec->last_hit, isec)) + if (RE_rayobject_intersect(isec->last_hit, isec)) { RE_RC_COUNT(isec->raycounter->raycast.hit); RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.hit); @@ -405,7 +405,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec) isec->hit_hint = 0; #endif - if(RE_rayobject_intersect(r, isec)) + if (RE_rayobject_intersect(r, isec)) { RE_RC_COUNT(isec->raycounter->raycast.hit); @@ -420,11 +420,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec) int RE_rayobject_intersect(RayObject *r, Isect *i) { - if(RE_rayobject_isRayFace(r)) + if (RE_rayobject_isRayFace(r)) { return intersect_rayface(r, (RayFace*) RE_rayobject_align(r), i); } - else if(RE_rayobject_isVlakPrimitive(r)) + else if (RE_rayobject_isVlakPrimitive(r)) { //TODO optimize (useless copy to RayFace to avoid duplicate code) VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r); @@ -433,7 +433,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i) return intersect_rayface(r, &nface, i); } - else if(RE_rayobject_isRayAPI(r)) + else if (RE_rayobject_isRayAPI(r)) { r = RE_rayobject_align(r); return r->api->raycast(r, i); @@ -466,11 +466,11 @@ void RE_rayobject_free(RayObject *r) float RE_rayobject_cost(RayObject *r) { - if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) + if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) { return 1.0f; } - else if(RE_rayobject_isRayAPI(r)) + else if (RE_rayobject_isRayAPI(r)) { r = RE_rayobject_align(r); return r->api->cost(r); @@ -485,16 +485,16 @@ float RE_rayobject_cost(RayObject *r) void RE_rayobject_merge_bb(RayObject *r, float *min, float *max) { - if(RE_rayobject_isRayFace(r)) + if (RE_rayobject_isRayFace(r)) { RayFace *face = (RayFace*) RE_rayobject_align(r); DO_MINMAX(face->v1, min, max); DO_MINMAX(face->v2, min, max); DO_MINMAX(face->v3, min, max); - if(RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max); + if (RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max); } - else if(RE_rayobject_isVlakPrimitive(r)) + else if (RE_rayobject_isVlakPrimitive(r)) { VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r); RayFace nface; @@ -503,9 +503,9 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max) DO_MINMAX(nface.v1, min, max); DO_MINMAX(nface.v2, min, max); DO_MINMAX(nface.v3, min, max); - if(RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max); + if (RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max); } - else if(RE_rayobject_isRayAPI(r)) + else if (RE_rayobject_isRayAPI(r)) { r = RE_rayobject_align(r); r->api->bb(r, min, max); @@ -518,11 +518,11 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max) void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max) { - if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) + if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) { return; } - else if(RE_rayobject_isRayAPI(r)) + else if (RE_rayobject_isRayAPI(r)) { r = RE_rayobject_align(r); return r->api->hint_bb(r, hint, min, max); @@ -535,7 +535,7 @@ void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max) int RE_rayobjectcontrol_test_break(RayObjectControl *control) { - if(control->test_break) + if (control->test_break) return control->test_break(control->data); return 0; @@ -543,7 +543,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *control) void RE_rayobject_set_control(RayObject *r, void *data, RE_rayobjectcontrol_test_break_callback test_break) { - if(RE_rayobject_isRayAPI(r)) + if (RE_rayobject_isRayAPI(r)) { r = RE_rayobject_align(r); r->control.data = data; diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp index f5a60308561..165b62cfbe4 100644 --- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp @@ -102,11 +102,11 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray Isect *isec = data->isec; RayObject *face = data->leafs[index]; - if(RE_rayobject_intersect(face,isec)) + if (RE_rayobject_intersect(face,isec)) { hit->index = index; - if(isec->mode == RE_RAY_SHADOW) + if (isec->mode == RE_RAY_SHADOW) hit->dist = 0; else hit->dist = isec->dist; @@ -154,10 +154,10 @@ static void RE_rayobject_blibvh_free(RayObject *o) { BVHObject *obj = (BVHObject*)o; - if(obj->bvh) + if (obj->bvh) BLI_bvhtree_free(obj->bvh); - if(obj->leafs) + if (obj->leafs) MEM_freeN(obj->leafs); MEM_freeN(obj); diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp index c7af501a808..2e803ce0fd3 100644 --- a/source/blender/render/intern/raytrace/rayobject_instance.cpp +++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp @@ -99,7 +99,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec) int changed = 0, i, res; // TODO - this is disabling self intersection on instances - if(isec->orig.ob == obj->ob && obj->ob) + if (isec->orig.ob == obj->ob && obj->ob) { changed = 1; isec->orig.ob = obj->target_ob; @@ -117,7 +117,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec) isec->dist *= normalize_v3(isec->dir); // update idot_axis and bv_index - for(i=0; i<3; i++) + for (i=0; i<3; i++) { isec->idot_axis[i] = 1.0f / isec->dir[i]; @@ -132,7 +132,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec) res = RE_rayobject_intersect(obj->target, isec); // map dist into original coordinate space - if(res == 0) + if (res == 0) { isec->dist = dist; } @@ -161,11 +161,11 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec) copy_v3_v3(isec->dir, dir); copy_v3_v3(isec->idot_axis, idot_axis); - if(changed) + if (changed) isec->orig.ob = obj->ob; // restore bv_index - for(i=0; i<3; i++) + for (i=0; i<3; i++) { isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0; isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i]; @@ -202,9 +202,9 @@ static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max) RE_rayobject_merge_bb(obj->target, m, M); //There must be a faster way than rotating all the 8 vertexs of the BB - for(i=0; i<8; i++) + for (i=0; i<8; i++) { - for(j=0; j<3; j++) t[j] = i&(1<<j) ? M[j] : m[j]; + for (j=0; j<3; j++) t[j] = i&(1<<j) ? M[j] : m[j]; mul_m4_v3(obj->target2global, t); DO_MINMAX(t, min, max); } diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 0411173f07f..197b3f14c7a 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -133,7 +133,7 @@ static void calc_ocval_face(float *v1, float *v2, float *v3, float *v4, short x, copy_v3_v3(max, v1); DO_MINMAX(v2, min, max); DO_MINMAX(v3, min, max); - if(v4) { + if (v4) { DO_MINMAX(v4, min, max); } @@ -155,7 +155,7 @@ static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1, { int ocmin, ocmax; - if(vec1[0]<vec2[0]) { + if (vec1[0]<vec2[0]) { ocmin= OCVALRES*(vec1[0] - xo); ocmax= OCVALRES*(vec2[0] - xo); } @@ -165,7 +165,7 @@ static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1, } ov->ocx= BROW16(ocmin, ocmax); - if(vec1[1]<vec2[1]) { + if (vec1[1]<vec2[1]) { ocmin= OCVALRES*(vec1[1] - yo); ocmax= OCVALRES*(vec2[1] - yo); } @@ -175,7 +175,7 @@ static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1, } ov->ocy= BROW16(ocmin, ocmax); - if(vec1[2]<vec2[2]) { + if (vec1[2]<vec2[2]) { ocmin= OCVALRES*(vec1[2] - zo); ocmax= OCVALRES*(vec2[2] - zo); } @@ -192,15 +192,15 @@ static Branch *addbranch(Octree *oc, Branch *br, short ocb) { int index; - if(br->b[ocb]) return br->b[ocb]; + if (br->b[ocb]) return br->b[ocb]; oc->branchcount++; index= oc->branchcount>>12; - if(oc->adrbranch[index]==NULL) + if (oc->adrbranch[index]==NULL) oc->adrbranch[index]= (Branch*)MEM_callocN(4096*sizeof(Branch), "new oc branch"); - if(oc->branchcount>= BRANCH_ARRAY*4096) { + if (oc->branchcount>= BRANCH_ARRAY*4096) { printf("error; octree branches full\n"); oc->branchcount=0; } @@ -215,10 +215,10 @@ static Node *addnode(Octree *oc) oc->nodecount++; index= oc->nodecount>>12; - if(oc->adrnode[index]==NULL) + if (oc->adrnode[index]==NULL) oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node),"addnode"); - if(oc->nodecount> NODE_ARRAY*NODE_ARRAY) { + if (oc->nodecount> NODE_ARRAY*NODE_ARRAY) { printf("error; octree nodes full\n"); oc->nodecount=0; } @@ -232,7 +232,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3] float fx, fy, fz; // init static vars - if(face) { + if (face) { normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]); d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2]; return 0; @@ -242,25 +242,25 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3] fy= y; fz= z; - if((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) { - if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; + if ((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) { + if ((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; + if ((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; + if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; + if ((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; + if ((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; + if ((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; + if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; } else { - if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; + if ((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; + if ((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; + if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; + if ((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; + if ((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; + if ((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; + if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; } return 0; @@ -277,15 +277,15 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short br= oc->adrbranch[0]; - if(oc->ocres==512) { + if (oc->ocres==512) { oc0= ((x & 1024)+(y & 512)+(z & 256))>>8; br= addbranch(oc, br, oc0); } - if(oc->ocres>=256) { + if (oc->ocres>=256) { oc0= ((x & 512)+(y & 256)+(z & 128))>>7; br= addbranch(oc, br, oc0); } - if(oc->ocres>=128) { + if (oc->ocres>=128) { oc0= ((x & 256)+(y & 128)+(z & 64))>>6; br= addbranch(oc, br, oc0); } @@ -303,12 +303,12 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short br= addbranch(oc, br,oc3); br= addbranch(oc, br,oc4); no= (Node *)br->b[oc5]; - if(no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc)); + if (no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc)); while(no->next) no= no->next; a= 0; - if(no->v[7]) { /* node full */ + if (no->v[7]) { /* node full */ no->next= addnode(oc); no= no->next; } @@ -318,7 +318,7 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short no->v[a]= (RayFace*) RE_rayobject_align(face); - if(quad) + if (quad) calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x>>2, y>>1, z, &no->ov[a]); else calc_ocval_face(rtf[0], rtf[1], rtf[2], NULL, x>>2, y>>1, z, &no->ov[a]); @@ -336,7 +336,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa ocx2= rts[b2][c1]; ocy2= rts[b2][c2]; - if(ocx1==ocx2 && ocy1==ocy2) { + if (ocx1==ocx2 && ocy1==ocy2) { ocface[oc->ocres*ocx1+ocy1]= 1; return; } @@ -346,8 +346,8 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa ox2= rtf[b2][c1]; oy2= rtf[b2][c2]; - if(ox1!=ox2) { - if(ox2-ox1>0.0f) { + if (ox1!=ox2) { + if (ox2-ox1>0.0f) { labdax= (ox1-ocx1-1.0f)/(ox1-ox2); ldx= -1.0f/(ox1-ox2); dx= 1; @@ -363,8 +363,8 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa ldx=0; } - if(oy1!=oy2) { - if(oy2-oy1>0.0f) { + if (oy1!=oy2) { + if (oy2-oy1>0.0f) { labday= (oy1-ocy1-1.0f)/(oy1-oy2); ldy= -1.0f/(oy1-oy2); dy= 1; @@ -385,18 +385,18 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa while(TRUE) { - if(x<0 || y<0 || x>=oc->ocres || y>=oc->ocres); + if (x<0 || y<0 || x>=oc->ocres || y>=oc->ocres); else ocface[oc->ocres*x+y]= 1; labdao=labda; - if(labdax==labday) { + if (labdax==labday) { labdax+=ldx; x+=dx; labday+=ldy; y+=dy; } else { - if(labdax<labday) { + if (labdax<labday) { labdax+=ldx; x+=dx; } @@ -406,8 +406,8 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa } } labda=MIN2(labdax,labday); - if(labda==labdao) break; - if(labda>=1.0f) break; + if (labda==labdao) break; + if (labda>=1.0f) break; } ocface[oc->ocres*ocx2+ocy2]=1; } @@ -416,15 +416,15 @@ static void filltriangle(Octree *oc, short c1, short c2, char *ocface, short *oc { int a, x, y, y1, y2; - for(x=ocmin[c1];x<=ocmax[c1];x++) { + for (x=ocmin[c1];x<=ocmax[c1];x++) { a= oc->ocres*x; - for(y=ocmin[c2];y<=ocmax[c2];y++) { - if(ocface[a+y]) { + for (y=ocmin[c2];y<=ocmax[c2];y++) { + if (ocface[a+y]) { y++; while(ocface[a+y] && y!=ocmax[c2]) y++; - for(y1=ocmax[c2];y1>y;y1--) { - if(ocface[a+y1]) { - for(y2=y;y2<=y1;y2++) ocface[a+y2]=1; + for (y1=ocmax[c2];y1>y;y1--) { + if (ocface[a+y1]) { + for (y2=y;y2<=y1;y2++) ocface[a+y2]=1; y1=0; } } @@ -444,10 +444,10 @@ static void RE_rayobject_octree_free(RayObject *tree) printf("ray coherent %d \n", coherent_ray); printf("accepted %d rejected %d\n", accepted, rejected); #endif - if(oc->ocface) + if (oc->ocface) MEM_freeN(oc->ocface); - if(oc->adrbranch) { + if (oc->adrbranch) { int a= 0; while(oc->adrbranch[a]) { MEM_freeN(oc->adrbranch[a]); @@ -459,7 +459,7 @@ static void RE_rayobject_octree_free(RayObject *tree) } oc->branchcount= 0; - if(oc->adrnode) { + if (oc->adrnode) { int a= 0; while(oc->adrnode[a]) { MEM_freeN(oc->adrnode[a]); @@ -520,27 +520,27 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) copy_v3_v3(co1, face->v1); copy_v3_v3(co2, face->v2); copy_v3_v3(co3, face->v3); - if(face->v4) + if (face->v4) copy_v3_v3(co4, face->v4); - for(c=0;c<3;c++) { + for (c=0;c<3;c++) { rtf[0][c] = (co1[c] - oc->min[c]) * ocfac[c]; rts[0][c] = (short)rtf[0][c]; rtf[1][c] = (co2[c] - oc->min[c]) * ocfac[c]; rts[1][c] = (short)rtf[1][c]; rtf[2][c] = (co3[c] - oc->min[c]) * ocfac[c]; rts[2][c] = (short)rtf[2][c]; - if(RE_rayface_isQuad(face)) { + if (RE_rayface_isQuad(face)) { rtf[3][c] = (co4[c] - oc->min[c]) * ocfac[c]; rts[3][c] = (short)rtf[3][c]; } } - for(c=0;c<3;c++) { + for (c=0;c<3;c++) { oc1= rts[0][c]; oc2= rts[1][c]; oc3= rts[2][c]; - if(!RE_rayface_isQuad(face)) { + if (!RE_rayface_isQuad(face)) { ocmin[c]= MIN3(oc1,oc2,oc3); ocmax[c]= MAX3(oc1,oc2,oc3); } @@ -549,11 +549,11 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) ocmin[c]= MIN4(oc1,oc2,oc3,oc4); ocmax[c]= MAX4(oc1,oc2,oc3,oc4); } - if(ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1; - if(ocmin[c]<0) ocmin[c]=0; + if (ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1; + if (ocmin[c]<0) ocmin[c]=0; } - if(ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) { + if (ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) { ocwrite(oc, face, RE_rayface_isQuad(face), ocmin[0], ocmin[1], ocmin[2], rtf); } else { @@ -564,7 +564,7 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf); d2dda(oc, 1,2,0,2,ocface,rts,rtf); d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf); - if(!RE_rayface_isQuad(face)) { + if (!RE_rayface_isQuad(face)) { d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf); d2dda(oc, 2,0,0,2,ocface,rts,rtf); d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf); @@ -585,14 +585,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) /* init static vars here */ face_in_node(face, 0,0,0, rtf); - for(x=ocmin[0];x<=ocmax[0];x++) { + for (x=ocmin[0];x<=ocmax[0];x++) { a= oc->ocres*x; - for(y=ocmin[1];y<=ocmax[1];y++) { - if(ocface[a+y+ocres2]) { + for (y=ocmin[1];y<=ocmax[1];y++) { + if (ocface[a+y+ocres2]) { b= oc->ocres*y+2*ocres2; - for(z=ocmin[2];z<=ocmax[2];z++) { - if(ocface[b+z] && ocface[a+z]) { - if(face_in_node(NULL, x, y, z, rtf)) + for (z=ocmin[2];z<=ocmax[2];z++) { + if (ocface[b+z] && ocface[a+z]) { + if (face_in_node(NULL, x, y, z, rtf)) ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf); } } @@ -601,14 +601,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) } /* same loops to clear octree, doubt it can be done smarter */ - for(x=ocmin[0];x<=ocmax[0];x++) { + for (x=ocmin[0];x<=ocmax[0];x++) { a= oc->ocres*x; - for(y=ocmin[1];y<=ocmax[1];y++) { + for (y=ocmin[1];y<=ocmax[1];y++) { /* x-y */ ocface[a+y+ocres2]= 0; b= oc->ocres*y + 2*ocres2; - for(z=ocmin[2];z<=ocmax[2];z++) { + for (z=ocmin[2];z<=ocmax[2];z++) { /* y-z */ ocface[b+z]= 0; /* x-z */ @@ -629,7 +629,7 @@ static void RE_rayobject_octree_done(RayObject *tree) INIT_MINMAX(oc->min, oc->max); /* Calculate Bounding Box */ - for(c=0; c<oc->ro_nodes_used; c++) + for (c=0; c<oc->ro_nodes_used; c++) RE_rayobject_merge_bb( RE_rayobject_unalignRayFace(oc->ro_nodes[c]), oc->min, oc->max); /* Alloc memory */ @@ -642,7 +642,7 @@ static void RE_rayobject_octree_done(RayObject *tree) oc->ocface= (char*)MEM_callocN( 3*ocres2 + 8, "ocface"); memset(oc->ocface, 0, 3*ocres2); - for(c=0;c<3;c++) { /* octree enlarge, still needed? */ + for (c=0;c<3;c++) { /* octree enlarge, still needed? */ oc->min[c]-= 0.01f; oc->max[c]+= 0.01f; } @@ -658,7 +658,7 @@ static void RE_rayobject_octree_done(RayObject *tree) oc->ocsize= sqrt(t00*t00+t01*t01+t02*t02); /* global, max size octree */ - for(c=0; c<oc->ro_nodes_used; c++) + for (c=0; c<oc->ro_nodes_used; c++) { octree_fill_rayface(oc, oc->ro_nodes[c]); } @@ -686,19 +686,19 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval) short nr=0; /* return on any first hit */ - if(is->mode==RE_RAY_SHADOW) { + if (is->mode==RE_RAY_SHADOW) { - for(; no; no = no->next) - for(nr=0; nr<8; nr++) + for (; no; no = no->next) + for (nr=0; nr<8; nr++) { RayFace *face = no->v[nr]; OcVal *ov = no->ov+nr; - if(!face) break; + if (!face) break; - if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) + if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { - if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) + if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) return 1; } } @@ -707,17 +707,17 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval) { /* else mirror or glass or shadowtra, return closest face */ int found= 0; - for(; no; no = no->next) - for(nr=0; nr<8; nr++) + for (; no; no = no->next) + for (nr=0; nr<8; nr++) { RayFace *face = no->v[nr]; OcVal *ov = no->ov+nr; - if(!face) break; + if (!face) break; - if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) + if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { - if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) + if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) found= 1; } } @@ -739,43 +739,43 @@ static Node *ocread(Octree *oc, int x, int y, int z) br= oc->adrbranch[0]; - if(oc->ocres==512) { + if (oc->ocres==512) { oc1= ((x & 1024)+(y & 512)+(z & 256))>>8; br= br->b[oc1]; - if(br==NULL) { + if (br==NULL) { return NULL; } } - if(oc->ocres>=256) { + if (oc->ocres>=256) { oc1= ((x & 512)+(y & 256)+(z & 128))>>7; br= br->b[oc1]; - if(br==NULL) { + if (br==NULL) { return NULL; } } - if(oc->ocres>=128) { + if (oc->ocres>=128) { oc1= ((x & 256)+(y & 128)+(z & 64))>>6; br= br->b[oc1]; - if(br==NULL) { + if (br==NULL) { return NULL; } } oc1= ((x & 128)+(y & 64)+(z & 32))>>5; br= br->b[oc1]; - if(br) { + if (br) { oc1= ((x & 64)+(y & 32)+(z & 16))>>4; br= br->b[oc1]; - if(br) { + if (br) { oc1= ((x & 32)+(y & 16)+(z & 8))>>3; br= br->b[oc1]; - if(br) { + if (br) { oc1= ((x & 16)+(y & 8)+(z & 4))>>2; br= br->b[oc1]; - if(br) { + if (br) { oc1= ((x & 8)+(y & 4)+(z & 2))>>1; br= br->b[oc1]; - if(br) { + if (br) { oc1= ((x & 4)+(y & 2)+(z & 1)); return (Node *)br->b[oc1]; } @@ -791,24 +791,24 @@ static int cliptest(float p, float q, float *u1, float *u2) { float r; - if(p<0.0f) { - if(q<p) return 0; - else if(q<0.0f) { + if (p<0.0f) { + if (q<p) return 0; + else if (q<0.0f) { r= q/p; - if(r>*u2) return 0; - else if(r>*u1) *u1=r; + if (r>*u2) return 0; + else if (r>*u1) *u1=r; } } else { - if(p>0.0f) { - if(q<0.0f) return 0; - else if(q<p) { + if (p>0.0f) { + if (q<0.0f) return 0; + else if (q<p) { r= q/p; - if(r<*u1) return 0; - else if(r<*u2) *u2=r; + if (r<*u1) return 0; + else if (r<*u2) *u2=r; } } - else if(q<0.0f) return 0; + else if (q<0.0f) return 0; } return 1; } @@ -836,7 +836,7 @@ static int do_coherence_test(int ocx1, int ocx2, int ocy1, int ocy2, int ocz1, i short *sp; sp= coh_nodes[ (ocx2 & 15) + 16*(ocy2 & 15) + 256*(ocz2 & 15) ]; - if(sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 && + if (sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 && sp[3]==ocx2 && sp[4]==ocy2 && sp[5]==ocz2) return 1; return 0; } @@ -859,7 +859,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2; /* clip with octree */ - if(oc->branchcount==0) return 0; + if (oc->branchcount==0) return 0; /* do this before intersect calls */ #if 0 @@ -877,22 +877,22 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) u2= 1.0f; /* clip with octree cube */ - if(cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) { - if(cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) { + if (cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) { + if (cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) { ldy= is->dir[1]*is->dist; - if(cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) { - if(cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) { + if (cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) { + if (cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) { ldz = is->dir[2]*is->dist; - if(cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) { - if(cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) { + if (cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) { + if (cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) { c1=1; - if(u2<1.0f) { + if (u2<1.0f) { end[0] = start[0]+u2*ldx; end[1] = start[1]+u2*ldy; end[2] = start[2]+u2*ldz; } - if(u1>0.0f) { + if (u1>0.0f) { start[0] += u1*ldx; start[1] += u1*ldy; start[2] += u1*ldz; @@ -904,7 +904,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } } - if(c1==0) return 0; + if (c1==0) return 0; /* reset static variables in ocread */ //ocread(oc, oc->ocres, 0, 0); @@ -924,14 +924,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) ocy2= (int)oy2; ocz2= (int)oz2; - if(ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) { + if (ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) { no= ocread(oc, ocx1, ocy1, ocz1); - if(no) { + if (no) { /* exact intersection with node */ vec1[0]= ox1; vec1[1]= oy1; vec1[2]= oz1; vec2[0]= ox2; vec2[1]= oy2; vec2[2]= oz2; calc_ocval_ray(&ocval, (float)ocx1, (float)ocy1, (float)ocz1, vec1, vec2); - if( testnode(oc, is, no, ocval) ) return 1; + if ( testnode(oc, is, no, ocval) ) return 1; } } else { @@ -945,12 +945,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) doy= oy1-oy2; doz= oz1-oz2; - if(dox<-FLT_EPSILON) { + if (dox<-FLT_EPSILON) { ldx= -1.0f/dox; labdax= (ocx1-ox1+1.0f)*ldx; dx= 1; } - else if(dox>FLT_EPSILON) { + else if (dox>FLT_EPSILON) { ldx= 1.0f/dox; labdax= (ox1-ocx1)*ldx; dx= -1; @@ -961,12 +961,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) dx= 0; } - if(doy<-FLT_EPSILON) { + if (doy<-FLT_EPSILON) { ldy= -1.0f/doy; labday= (ocy1-oy1+1.0f)*ldy; dy= 1; } - else if(doy>FLT_EPSILON) { + else if (doy>FLT_EPSILON) { ldy= 1.0f/doy; labday= (oy1-ocy1)*ldy; dy= -1; @@ -977,12 +977,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) dy= 0; } - if(doz<-FLT_EPSILON) { + if (doz<-FLT_EPSILON) { ldz= -1.0f/doz; labdaz= (ocz1-oz1+1.0f)*ldz; dz= 1; } - else if(doz>FLT_EPSILON) { + else if (doz>FLT_EPSILON) { ldz= 1.0f/doz; labdaz= (oz1-ocz1)*ldz; dz= -1; @@ -1006,7 +1006,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) while(TRUE) { no= ocread(oc, xo, yo, zo); - if(no) { + if (no) { /* calculate ray intersection with octree node */ copy_v3_v3(vec1, vec2); @@ -1017,10 +1017,10 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) calc_ocval_ray(&ocval, (float)xo, (float)yo, (float)zo, vec1, vec2); //is->dist = (u1+ddalabda*(u2-u1))*olabda; - if( testnode(oc, is, no, ocval) ) + if ( testnode(oc, is, no, ocval) ) found = 1; - if(is->dist < (u1+ddalabda*(u2-u1))*olabda) + if (is->dist < (u1+ddalabda*(u2-u1))*olabda) return found; } @@ -1030,17 +1030,17 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) /* traversing ocree nodes need careful detection of smallest values, with proper * exceptions for equal labdas */ eqval= (labdax==labday); - if(labday==labdaz) eqval += 2; - if(labdax==labdaz) eqval += 4; + if (labday==labdaz) eqval += 2; + if (labdax==labdaz) eqval += 4; - if(eqval) { // only 4 cases exist! - if(eqval==7) { // x=y=z + if (eqval) { // only 4 cases exist! + if (eqval==7) { // x=y=z xo+=dx; labdax+=ldx; yo+=dy; labday+=ldy; zo+=dz; labdaz+=ldz; } - else if(eqval==1) { // x=y - if(labday < labdaz) { + else if (eqval==1) { // x=y + if (labday < labdaz) { xo+=dx; labdax+=ldx; yo+=dy; labday+=ldy; } @@ -1048,8 +1048,8 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) zo+=dz; labdaz+=ldz; } } - else if(eqval==2) { // y=z - if(labdax < labday) { + else if (eqval==2) { // y=z + if (labdax < labday) { xo+=dx; labdax+=ldx; } else { @@ -1058,7 +1058,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } } else { // x=z - if(labday < labdax) { + if (labday < labdax) { yo+=dy; labday+=ldy; } else { @@ -1069,13 +1069,13 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } else { // all three different, just three cases exist eqval= (labdax<labday); - if(labday<labdaz) eqval += 2; - if(labdax<labdaz) eqval += 4; + if (labday<labdaz) eqval += 2; + if (labdax<labdaz) eqval += 4; - if(eqval==7 || eqval==5) { // x smallest + if (eqval==7 || eqval==5) { // x smallest xo+=dx; labdax+=ldx; } - else if(eqval==2 || eqval==6) { // y smallest + else if (eqval==2 || eqval==6) { // y smallest yo+=dy; labday+=ldy; } else { // z smallest @@ -1085,9 +1085,9 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } ddalabda=MIN3(labdax,labday,labdaz); - if(ddalabda==labdao) break; + if (ddalabda==labdao) break; /* to make sure the last node is always checked */ - if(labdao>=1.0f) break; + if (labdao>=1.0f) break; } } diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp index f7d38bf0fa3..437d7f433b5 100644 --- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp @@ -71,14 +71,14 @@ void bvh_done<QBVHTree>(QBVHTree *obj) //TODO do this in 1 pass (half memory usage during building) VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder); - if(RE_rayobjectcontrol_test_break(&obj->rayobj.control)) + if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) { BLI_memarena_free(arena1); BLI_memarena_free(arena2); return; } - if(root) { + if (root) { pushup_simd<VBVHNode,4>(root); obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root); } @@ -99,8 +99,8 @@ template<int StackSize> int intersect(QBVHTree *obj, Isect* isec) { //TODO renable hint support - if(RE_rayobject_isAligned(obj->root)) { - if(isec->mode == RE_RAY_SHADOW) + if (RE_rayobject_isAligned(obj->root)) { + if (isec->mode == RE_RAY_SHADOW) return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec); else return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec); @@ -141,7 +141,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize) { static RayObjectAPI bvh_api256 = make_api<Tree,1024>(); - if(maxstacksize <= 1024) return &bvh_api256; + if (maxstacksize <= 1024) return &bvh_api256; assert(maxstacksize <= 256); return 0; } diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp index 6988e3fcc38..54901db8bdd 100644 --- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp +++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp @@ -54,10 +54,10 @@ static void rtbuild_init(RTBuilder *b) b->primitives.end = 0; b->primitives.maxsize = 0; - for(int i=0; i<RTBUILD_MAX_CHILDS; i++) + for (int i=0; i<RTBUILD_MAX_CHILDS; i++) b->child_offset[i] = 0; - for(int i=0; i<3; i++) + for (int i=0; i<3; i++) b->sorted_begin[i] = b->sorted_end[i] = 0; INIT_MINMAX(b->bb, b->bb+3); @@ -74,7 +74,7 @@ RTBuilder* rtbuild_create(int size) builder->primitives.begin = builder->primitives.end = memblock; builder->primitives.maxsize = size; - for(int i=0; i<3; i++) + for (int i=0; i<3; i++) { builder->sorted_begin[i] = (RTBuilder::Object**)MEM_mallocN( sizeof(RTBuilder::Object*)*size,"RTBuilder.sorted_objects"); builder->sorted_end[i] = builder->sorted_begin[i]; @@ -86,10 +86,10 @@ RTBuilder* rtbuild_create(int size) void rtbuild_free(RTBuilder *b) { - if(b->primitives.begin) MEM_freeN(b->primitives.begin); + if (b->primitives.begin) MEM_freeN(b->primitives.begin); - for(int i=0; i<3; i++) - if(b->sorted_begin[i]) + for (int i=0; i<3; i++) + if (b->sorted_begin[i]) MEM_freeN(b->sorted_begin[i]); MEM_freeN(b); @@ -107,16 +107,16 @@ void rtbuild_add(RTBuilder *b, RayObject *o) /* skip objects with invalid bounding boxes, nan causes DO_MINMAX * to do nothing, so we get these invalid values. this shouldn't * happen usually, but bugs earlier in the pipeline can cause it. */ - if(bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5]) + if (bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5]) return; /* skip objects with inf bounding boxes */ - if(!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2])) + if (!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2])) return; - if(!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5])) + if (!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5])) return; /* skip objects with zero bounding box, they are of no use, and * will give problems in rtbuild_heuristic_object_split later */ - if(bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5]) + if (bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5]) return; copy_v3_v3(b->primitives.end->bb, bb); @@ -124,7 +124,7 @@ void rtbuild_add(RTBuilder *b, RayObject *o) b->primitives.end->obj = o; b->primitives.end->cost = RE_rayobject_cost(o); - for(int i=0; i<3; i++) + for (int i=0; i<3; i++) { *(b->sorted_end[i]) = b->primitives.end; b->sorted_end[i]++; @@ -141,7 +141,7 @@ int rtbuild_size(RTBuilder *b) template<class Obj,int Axis> static bool obj_bb_compare(const Obj &a, const Obj &b) { - if(a->bb[Axis] != b->bb[Axis]) + if (a->bb[Axis] != b->bb[Axis]) return a->bb[Axis] < b->bb[Axis]; return a->obj < b->obj; } @@ -149,18 +149,18 @@ static bool obj_bb_compare(const Obj &a, const Obj &b) template<class Item> static void object_sort(Item *begin, Item *end, int axis) { - if(axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> ); - if(axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> ); - if(axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> ); + if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> ); + if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> ); + if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> ); assert(false); } void rtbuild_done(RTBuilder *b, RayObjectControl* ctrl) { - for(int i=0; i<3; i++) - if(b->sorted_begin[i]) + for (int i=0; i<3; i++) + if (b->sorted_begin[i]) { - if(RE_rayobjectcontrol_test_break(ctrl)) break; + if (RE_rayobjectcontrol_test_break(ctrl)) break; object_sort( b->sorted_begin[i], b->sorted_end[i], i ); } } @@ -174,8 +174,8 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp) { rtbuild_init( tmp ); - for(int i=0; i<3; i++) - if(b->sorted_begin[i]) + for (int i=0; i<3; i++) + if (b->sorted_begin[i]) { tmp->sorted_begin[i] = b->sorted_begin[i] + b->child_offset[child ]; tmp->sorted_end [i] = b->sorted_begin[i] + b->child_offset[child+1]; @@ -191,9 +191,9 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp) void rtbuild_calc_bb(RTBuilder *b) { - if(b->bb[0] == 1.0e30f) + if (b->bb[0] == 1.0e30f) { - for(RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++) + for (RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++) RE_rayobject_merge_bb( (*index)->obj , b->bb, b->bb+3); } } @@ -225,20 +225,20 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis) assert(nchilds <= RTBUILD_MAX_CHILDS); //TODO optimize calc of leafs_per_child - for(s=nchilds; s<tot_leafs; s*=nchilds); + for (s=nchilds; s<tot_leafs; s*=nchilds); Mleafs_per_child = s/nchilds; mleafs_per_child = Mleafs_per_child/nchilds; //split min leafs per child b->child_offset[0] = 0; - for(i=1; i<=nchilds; i++) + for (i=1; i<=nchilds; i++) b->child_offset[i] = mleafs_per_child; //split remaining leafs missing_leafs = tot_leafs - mleafs_per_child*nchilds; - for(i=1; i<=nchilds; i++) + for (i=1; i<=nchilds; i++) { - if(missing_leafs > Mleafs_per_child - mleafs_per_child) + if (missing_leafs > Mleafs_per_child - mleafs_per_child) { b->child_offset[i] += Mleafs_per_child - mleafs_per_child; missing_leafs -= Mleafs_per_child - mleafs_per_child; @@ -252,11 +252,11 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis) } //adjust for accumulative offsets - for(i=1; i<=nchilds; i++) + for (i=1; i<=nchilds; i++) b->child_offset[i] += b->child_offset[i-1]; //Count created childs - for(i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--); + for (i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--); split_leafs(b, b->child_offset, i, axis); assert( b->child_offset[0] == 0 && b->child_offset[i] == tot_leafs ); @@ -281,7 +281,7 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis) int size = rtbuild_size(b); assert(nchilds <= RTBUILD_MAX_CHILDS); - if(size <= nchilds) + if (size <= nchilds) { return rtbuild_mean_split(b, nchilds, axis); } @@ -293,12 +293,12 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis) //Calculate child offsets b->child_offset[0] = 0; - for(i=0; i<nchilds-1; i++) + for (i=0; i<nchilds-1; i++) b->child_offset[i+1] = split_leafs_by_plane(b, b->child_offset[i], size, separators[i]); b->child_offset[nchilds] = size; - for(i=0; i<nchilds; i++) - if(b->child_offset[i+1] - b->child_offset[i] == size) + for (i=0; i<nchilds; i++) + if (b->child_offset[i+1] - b->child_offset[i] == size) return rtbuild_mean_split(b, nchilds, axis); return nchilds; @@ -313,7 +313,7 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds) rtbuild_calc_bb(b); la = bb_largest_axis(b->bb,b->bb+3); - for(i=1; i<nchilds; i++) + for (i=1; i<nchilds; i++) separators[i-1] = (b->bb[la+3]-b->bb[la])*i / nchilds; return rtbuild_median_split(b, separators, nchilds, la); @@ -337,23 +337,23 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) assert(size > 1); int baxis = -1, boffset = 0; - if(size > nchilds) + if (size > nchilds) { float bcost = FLT_MAX; baxis = -1, boffset = size/2; SweepCost *sweep = (SweepCost*)MEM_mallocN( sizeof(SweepCost)*size, "RTBuilder.HeuristicSweep" ); - for(int axis=0; axis<3; axis++) + for (int axis=0; axis<3; axis++) { SweepCost sweep_left; RTBuilder::Object **obj = b->sorted_begin[axis]; // float right_cost = 0; - for(int i=size-1; i>=0; i--) + for (int i=size-1; i>=0; i--) { - if(i == size-1) + if (i == size-1) { copy_v3_v3(sweep[i].bb, obj[i]->bb); copy_v3_v3(sweep[i].bb+3, obj[i]->bb+3); @@ -380,9 +380,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) sweep_left.bb[5] = obj[0]->bb[5]; sweep_left.cost = obj[0]->cost; -// right_cost -= obj[0]->cost; if(right_cost < 0) right_cost = 0; +// right_cost -= obj[0]->cost; if (right_cost < 0) right_cost = 0; - for(int i=1; i<size; i++) + for (int i=1; i<size; i++) { //Worst case heuristic (cost of each child is linear) float hcost, left_side, right_side; @@ -398,10 +398,10 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) assert(left_side >= 0); assert(right_side >= 0); - if(left_side > bcost) break; //No way we can find a better heuristic in this axis + if (left_side > bcost) break; //No way we can find a better heuristic in this axis assert(hcost >= 0); - if( hcost < bcost + if ( hcost < bcost || (hcost == bcost && axis < baxis)) //this makes sure the tree built is the same whatever is the order of the sorting axis { bcost = hcost; @@ -412,7 +412,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) DO_MAX( obj[i]->bb+3, sweep_left.bb+3 ); sweep_left.cost += obj[i]->cost; -// right_cost -= obj[i]->cost; if(right_cost < 0) right_cost = 0; +// right_cost -= obj[i]->cost; if (right_cost < 0) right_cost = 0; } //assert(baxis >= 0 && baxis < 3); @@ -423,12 +423,12 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) MEM_freeN(sweep); } - else if(size == 2) + else if (size == 2) { baxis = 0; boffset = 1; } - else if(size == 1) + else if (size == 1) { b->child_offset[0] = 0; b->child_offset[1] = 1; @@ -441,9 +441,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) /* Adjust sorted arrays for childs */ - for(int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true; - for(int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false; - for(int i=0; i<3; i++) + for (int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true; + for (int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false; + for (int i=0; i<3; i++) std::stable_partition( b->sorted_begin[i], b->sorted_end[i], selected_node ); return nchilds; @@ -460,13 +460,13 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis) int i; b->split_axis = split_axis; - for(i=0; i < partitions-1; i++) + for (i=0; i < partitions-1; i++) { assert(nth[i] < nth[i+1] && nth[i+1] < nth[partitions]); - if(split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>); - if(split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>); - if(split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>); + if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>); + if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>); + if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>); } } #endif @@ -500,16 +500,16 @@ int bb_largest_axis(float *min, float *max) sub[0] = max[0]-min[0]; sub[1] = max[1]-min[1]; sub[2] = max[2]-min[2]; - if(sub[0] > sub[1]) + if (sub[0] > sub[1]) { - if(sub[0] > sub[2]) + if (sub[0] > sub[2]) return 0; else return 2; } else { - if(sub[1] > sub[2]) + if (sub[1] > sub[2]) return 1; else return 2; @@ -519,11 +519,11 @@ int bb_largest_axis(float *min, float *max) int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *inner_max) { int i; - for(i=0; i<3; i++) - if(outer_min[i] > inner_min[i]) return 0; + for (i=0; i<3; i++) + if (outer_min[i] > inner_min[i]) return 0; - for(i=0; i<3; i++) - if(outer_max[i] < inner_max[i]) return 0; + for (i=0; i<3; i++) + if (outer_max[i] < inner_max[i]) return 0; return 1; } diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp index 7ce444a2e99..02821d45c50 100644 --- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp @@ -79,11 +79,11 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj) BLI_memarena_use_align(arena2, 16); //Build and optimize the tree - if(0) + if (0) { VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder); - if(RE_rayobjectcontrol_test_break(&obj->rayobj.control)) + if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) { BLI_memarena_free(arena1); BLI_memarena_free(arena2); @@ -106,14 +106,14 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj) //TODO this uses quite a lot of memory, find ways to reduce memory usage during building OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder); - if(RE_rayobjectcontrol_test_break(&obj->rayobj.control)) + if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) { BLI_memarena_free(arena1); BLI_memarena_free(arena2); return; } - if(root) { + if (root) { VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root); obj->root = Reorganize_SVBVH<OVBVHNode>(arena2).transform(root); } @@ -135,8 +135,8 @@ template<int StackSize> int intersect(SVBVHTree *obj, Isect* isec) { //TODO renable hint support - if(RE_rayobject_isAligned(obj->root)) { - if(isec->mode == RE_RAY_SHADOW) + if (RE_rayobject_isAligned(obj->root)) { + if (isec->mode == RE_RAY_SHADOW) return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec); else return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec); @@ -177,7 +177,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize) { static RayObjectAPI bvh_api256 = make_api<Tree,1024>(); - if(maxstacksize <= 1024) return &bvh_api256; + if (maxstacksize <= 1024) return &bvh_api256; assert(maxstacksize <= 256); return 0; } diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp index 75323cfe56a..84395a9ad50 100644 --- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp @@ -87,16 +87,16 @@ void bvh_done<VBVHTree>(VBVHTree *obj) BLI_memarena_use_malloc(arena1); //Build and optimize the tree - if(1) + if (1) { VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder); - if(RE_rayobjectcontrol_test_break(&obj->rayobj.control)) + if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) { BLI_memarena_free(arena1); return; } - if(root) { + if (root) { reorganize(root); remove_useless(root, &root); bvh_refit(root); @@ -137,8 +137,8 @@ template<int StackSize> int intersect(VBVHTree *obj, Isect* isec) { //TODO renable hint support - if(RE_rayobject_isAligned(obj->root)) { - if(isec->mode == RE_RAY_SHADOW) + if (RE_rayobject_isAligned(obj->root)) { + if (isec->mode == RE_RAY_SHADOW) return bvh_node_stack_raycast<VBVHNode,StackSize,false,true>( obj->root, isec); else return bvh_node_stack_raycast<VBVHNode,StackSize,false,false>( obj->root, isec); @@ -159,9 +159,9 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *UNUSED(min), float *UNUSED(m void bfree(VBVHTree *tree) { - if(tot_pushup + tot_pushdown + tot_hints + tot_moves) + if (tot_pushup + tot_pushdown + tot_hints + tot_moves) { - if(G.f & G_DEBUG) { + if (G.f & G_DEBUG) { printf("tot pushups: %d\n", tot_pushup); printf("tot pushdowns: %d\n", tot_pushdown); printf("tot moves: %d\n", tot_moves); @@ -199,7 +199,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize) { static RayObjectAPI bvh_api256 = make_api<Tree,1024>(); - if(maxstacksize <= 1024) return &bvh_api256; + if (maxstacksize <= 1024) return &bvh_api256; assert(maxstacksize <= 256); return 0; } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 7dd11dd1fe0..b6a25985d33 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -766,7 +766,7 @@ static int as_testvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, float if (vlr==0) return 0; asf= asv->faces.first; - while(asf) { + while (asf) { for (a=0; a<4; a++) { if (asf->vlr[a] && asf->vlr[a]!=vlr) { inp = fabsf(dot_v3v3(vlr->n, asf->vlr[a]->n)); @@ -787,7 +787,7 @@ static VertRen *as_findvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, f int a; asf= asv->faces.first; - while(asf) { + while (asf) { for (a=0; a<4; a++) { if (asf->vlr[a] && asf->vlr[a]!=vlr) { /* this face already made a copy for this vertex! */ @@ -844,7 +844,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d ver= RE_findOrAddVert(obr, a); asf= asv->faces.first; - while(asf) { + while (asf) { for (b=0; b<4; b++) { /* is there a reason to make a new vertex? */ @@ -2400,7 +2400,7 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im /* Object Size with parenting */ obt=obr->ob; - while(obt) { + while (obt) { mul_v3_v3v3(temp, obt->size, obt->dscale); scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2]; obt=obt->parent; @@ -2913,7 +2913,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) orco= get_object_orco(re, ob); } - while(dl) { + while (dl) { if (dl->col > ob->totcol) { /* pass */ } @@ -2988,7 +2988,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) startvert= obr->totvert; nr= dl->nr*dl->parts; - while(nr--) { + while (nr--) { ver= RE_findOrAddVert(obr, obr->totvert++); copy_v3_v3(ver->co, fp); @@ -3583,7 +3583,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4]) struct ShadBuf *shb; float viewinv[4][4]; - /* if(la->spsi<16) return; */ + /* if (la->spsi<16) return; */ /* memory alloc */ shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf),"initshadbuf"); @@ -4025,7 +4025,7 @@ void init_render_world(Render *re) /* AO samples should be OSA minimum */ if (re->osa) - while(re->wrld.aosamp*re->wrld.aosamp < re->osa) + while (re->wrld.aosamp*re->wrld.aosamp < re->osa) re->wrld.aosamp++; if (!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE)) re->wrld.mode &= ~(WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 59f8782e816..fa7b9cb7ea1 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -399,7 +399,7 @@ static void env_set_imats(Render *re) float mat[4][4]; base= re->scene->base.first; - while(base) { + while (base) { mult_m4_m4m4(mat, re->viewmat, base->object->obmat); invert_m4_m4(base->object->imat, mat); @@ -519,9 +519,9 @@ void make_envmaps(Render *re) re->stats_draw(re->sdh, &re->i); /* 5 = hardcoded max recursion level */ - while(depth<5) { + while (depth<5) { tex= re->main->tex.first; - while(tex) { + while (tex) { if (tex->id.us && tex->type==TEX_ENVMAP) { if (tex->env && tex->env->object) { EnvMap *env= tex->env; diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 6d8ae20985c..260a2de4858 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -591,7 +591,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max if (count>1) { tot= texres->tr= texres->tb= texres->tg= texres->ta= 0.0; - while(count--) { + while (count--) { boxsampleclip(ibuf, rf, &texr); opp= square_rctf(rf); @@ -1639,7 +1639,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const curmap= 0; previbuf= curibuf= ibuf; - while(curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) { + while (curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) { if (maxd < pixsize) break; previbuf= curibuf; curibuf= ibuf->mipmap[curmap]; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 532d384ec26..436eaefd155 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -466,7 +466,7 @@ static void occ_build_split(OcclusionTree *tree, int begin, int end, int *split) a= begin; enda= end; - while(a<enda) { + while (a<enda) { if (tree->co[a][axis] > mid) { enda--; SWAP(OccFace, tree->face[a], tree->face[enda]); @@ -1226,7 +1226,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float stack[0]= tree->root; totstack= 1; - while(totstack) { + while (totstack) { /* pop point off the stack */ node= stack[--totstack]; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index aa475e8aef0..5db59fcdcc0 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -405,7 +405,7 @@ void RE_FreeRender(Render *re) /* exit blender */ void RE_FreeAllRender(void) { - while(RenderGlobal.renderlist.first) { + while (RenderGlobal.renderlist.first) { RE_FreeRender(RenderGlobal.renderlist.first); } } @@ -811,7 +811,7 @@ static void threaded_tile_processor(Render *re) else nextpa= find_next_part(re, 0); - while(rendering) { + while (rendering) { if (re->test_break(re->tbh)) PIL_sleep_ms(50); @@ -1030,7 +1030,7 @@ static void do_render_blur_3d(Render *re) rres= render_result_new(re, &re->disprect, 0, RR_USE_MEM); /* do the blur steps */ - while(blur--) { + while (blur--) { re->mblur_offs = re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples; re->i.curblur= re->r.mblur_samples-blur; /* stats */ @@ -1743,7 +1743,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override) check_comp= 0; - while(seq) { + while (seq) { if (seq->type == SEQ_SCENE && seq->scene) { if (!seq->scene_camera) { if (!seq->scene->camera && !scene_find_camera(seq->scene)) { @@ -1768,7 +1768,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override) if (scene->r.scemode&R_DOCOMP && scene->use_nodes) { bNode *node= scene->nodetree->nodes.first; - while(node) { + while (node) { if (node->type == CMP_NODE_R_LAYERS) { Scene *sce= node->id ? (Scene*)node->id : scene; diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c index 41b12171b2c..48ce611fed7 100644 --- a/source/blender/render/intern/source/pixelblending.c +++ b/source/blender/render/intern/source/pixelblending.c @@ -309,7 +309,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, /* loop unroll */ -#define MASKFILT(i, j) val= lfilt[i][j]; if(val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; } +#define MASKFILT(i, j) val= lfilt[i][j]; if (val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; } MASKFILT(0, 0) MASKFILT(0, 1) diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 98578c8dc70..826a31e17a8 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -93,7 +93,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) lar= go->lampren; /* test for lamplayer */ - if (lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue; + if (lar->mode & LA_LAYER) if ((lar->lay & har->lay)==0) continue; /* lampdist cacluation */ if (lar->type==LA_SUN || lar->type==LA_HEMI) { @@ -186,7 +186,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) inpr*= soft; } if (lar->mode & LA_ONLYSHADOW) { - /* if(ma->mode & MA_SHADOW) { */ + /* if (ma->mode & MA_SHADOW) { */ /* dot product positive: front side face! */ inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2]; if (inp>0.0f) { diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 7e1ff53d4e7..3346cf3c261 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -140,7 +140,7 @@ void init_render_textures(Render *re) Tex *tex; tex= re->main->tex.first; - while(tex) { + while (tex) { if (tex->id.us) init_render_texture(re, tex); tex= tex->id.next; } @@ -733,7 +733,7 @@ static int texnoise(Tex *tex, TexResult *texres) val= (ran & 3); loop= tex->noisedepth; - while(loop--) { + while (loop--) { ran= (ran>>2); val*= (ran & 3); div*= 3.0f; @@ -3038,7 +3038,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h tex= mtex->tex; if (tex==0) continue; - /* if(mtex->mapto==0) continue; */ + /* if (mtex->mapto==0) continue; */ /* which coords */ co= lo; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 6f0ffcb8470..f5e36125299 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -869,7 +869,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl) rectdaps+= pa->rectx; offs+= pa->rectx; - if (y&1) if(R.test_break(R.tbh)) break; + if (y&1) if (R.test_break(R.tbh)) break; } /* disable scanline updating */ @@ -1328,7 +1328,7 @@ void zbufshade_tile(RenderPart *pa) zbuffer_solid(pa, rl, NULL, NULL); - if (!R.test_break(R.tbh)) { /* NOTE: this if() is not consistent */ + if (!R.test_break(R.tbh)) { /* NOTE: this if () is not consistent */ /* edges only for solid part, ztransp doesn't support it yet anti-aliased */ if (rl->layflag & SCE_LAY_EDGE) { diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index f28931f7b16..d238087cfb1 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1210,7 +1210,7 @@ static int panotestclip(Render *re, int do_pano, float *v) abs4= fabs(v[3]); - if (v[2]< -abs4) c=16; /* this used to be " if(v[2]<0) ", see clippz() */ + if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */ else if (v[2]> abs4) c+= 32; if ( v[1]>abs4) c+=4; diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 25705a9fc99..742d28d89b7 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -1042,8 +1042,8 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int char *ct, *cz; /* simpleclip */ - /* if(xs<0 || ys<0) return 1.0; */ - /* if(xs>=shb->size || ys>=shb->size) return 1.0; */ + /* if (xs<0 || ys<0) return 1.0; */ + /* if (xs>=shb->size || ys>=shb->size) return 1.0; */ /* always test borders of shadowbuffer */ if (xs<0) xs= 0; else if (xs>=shb->size) xs= shb->size-1; diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index ece6e464bdf..5951006c7b5 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -331,7 +331,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) /* soft area */ /* not needed because t0 has been used for p1/p2 as well */ - /* if(doclip && t0<t2) { */ + /* if (doclip && t0<t2) { */ /* *intens *= (t0-t1)/(t2-t1); */ /* } */ @@ -736,7 +736,7 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough normalize_v3(h); /* nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; */ /* Dot product between surface normal and half-way vector */ - /* if(nh<0.0f) nh = 0.0f; */ + /* if (nh<0.0f) nh = 0.0f; */ nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */ if (nv<=0.0f) nv= 0.0f; @@ -746,7 +746,7 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough if (nl<0.0f) return 0.0f; /* value from area light */ /* vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; */ /* Dot product between view vector and halfway vector */ - /* if(vh<=0.0f) vh= 0.0f; */ + /* if (vh<=0.0f) vh= 0.0f; */ Lit_A = saacos(realnl); View_A = saacos( nv ); @@ -1537,7 +1537,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) /* yafray: ignore shading by photonlights, not used in Blender */ if (lar->type==LA_YF_PHOTON) continue; - if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue; + if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue; if ((lar->lay & shi->lay)==0) continue; if (lar->shb || (lar->mode & LA_SHAD_RAY)) { @@ -1759,7 +1759,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) if (lar->type==LA_YF_PHOTON) continue; /* test for lamp layer */ - if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue; + if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue; if ((lar->lay & shi->lay)==0) continue; /* accumulates in shr->diff and shr->spec and shr->shad (diffuse with shadow!) */ diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 9a24e1dbe75..e29623aee22 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -551,7 +551,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float #define CHECK_ADD(n) \ if (apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \ - { if(!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; } + { if (!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; } #define CHECK_ASSIGN(n) \ if (apn->p[n]==0) \ {apn->obi[n]= obi; apn->p[n]= strnr; apn->z[n]= zverg; apn->mask[n]= mask; apn->v[n]= t; apn->u[n]= s; apn->seg[n]= seg; break; } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 9c4afaea0fe..02dcc72f525 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -475,7 +475,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const float hitco[3], *atten_co; float p, ref_col[3]; - if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) return; + if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) return; if ((lar->lay & shi->lay)==0) return; if (lar->energy == 0.0f) return; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index e3068d12265..74c4bf19faf 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -140,7 +140,7 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2) if (my0<0) my0= 0; if (my0>my2) return; - /* if(my0>my2) should still fill in, that way we get spans that skip nicely */ + /* if (my0>my2) should still fill in, that way we get spans that skip nicely */ xx1= maxv[1]-minv[1]; if (xx1>FLT_EPSILON) { @@ -253,7 +253,7 @@ int testclip(const float v[4]) if ( v[1] > abs4) c+=4; else if ( v[1] < -abs4) c+=8; - if (v[2] < -abs4) c+=16; /* this used to be " if(v[2]<0) ", see clippz() */ + if (v[2] < -abs4) c+=16; /* this used to be " if (v[2]<0) ", see clippz() */ else if (v[2]> abs4) c+= 32; return c; @@ -1882,7 +1882,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, clippyra(labda[2], vlzp[v][2],vlzp[v][0], &b2,&b3, arg, zspan->clipcrop); if (b2==0 && b3==1) { - /* completely 'in', but we copy because of last for() loop in this section */; + /* completely 'in', but we copy because of last for () loop in this section */; vlzp[clvl][0]= vlzp[v][0]; vlzp[clvl][1]= vlzp[v][1]; vlzp[clvl][2]= vlzp[v][2]; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 3bf8a3ddf43..588839ad18f 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -775,7 +775,7 @@ void wm_draw_update(bContext *C) wm_method_draw_overlap_all(C, win, 0); else if (drawmethod == USER_DRAW_OVERLAP_FLIP) wm_method_draw_overlap_all(C, win, 1); - else // if(drawmethod == USER_DRAW_TRIPLE) + else // if (drawmethod == USER_DRAW_TRIPLE) wm_method_draw_triple(C, win); win->screen->do_draw_gesture= 0; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 962a59496ef..fb5a531cc38 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2305,7 +2305,7 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers, return handler; } -/* set "postpone" for win->modalhandlers, this is in a running for() loop in wm_handlers_do() */ +/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */ void WM_event_remove_ui_handler(ListBase *handlers, wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone) { diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 3b3280a6f62..4cef3f18e14 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -298,7 +298,7 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test) /* possible suspend ourselfs, waiting for other jobs, or de-suspend */ test->suspended= suspend; - // if(suspend) printf("job suspended: %s\n", test->name); + // if (suspend) printf("job suspended: %s\n", test->name); } /* if job running, the same owner gave it a new job */ @@ -459,7 +459,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) steve->run_customdata= NULL; steve->run_free= NULL; - // if(steve->stop) printf("job ready but stopped %s\n", steve->name); + // if (steve->stop) printf("job ready but stopped %s\n", steve->name); // else printf("job finished %s\n", steve->name); steve->running= 0; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6448fc2ac34..a973eb4fe2c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1214,7 +1214,7 @@ static int wm_resource_check_prev(void) char *res= BLI_get_folder_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, TRUE); - // if(res) printf("USER: %s\n", res); + // if (res) printf("USER: %s\n", res); #if 0 /* ignore the local folder */ if (res == NULL) { @@ -1223,7 +1223,7 @@ static int wm_resource_check_prev(void) } #endif - // if(res) printf("LOCAL: %s\n", res); + // if (res) printf("LOCAL: %s\n", res); if (res) { return FALSE; } |