diff options
Diffstat (limited to 'source')
213 files changed, 2407 insertions, 2406 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; } diff --git a/source/creator/creator.c b/source/creator/creator.c index 698e1e7be20..b69430cebd5 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -411,7 +411,7 @@ static int set_env(int argc, const char **argv, void *UNUSED(data)) exit(1); } - for(; *ch_src; ch_src++, ch_dst++) { + for (; *ch_src; ch_src++, ch_dst++) { *ch_dst= (*ch_src == '-') ? '_' : (*ch_src)-32; /* toupper() */ } @@ -552,7 +552,7 @@ static int set_engine(int argc, const char **argv, void *data) if (!strcmp(argv[1], "help")) { RenderEngineType *type = NULL; printf("Blender Engine Listing:\n"); - for( type = R_engines.first; type; type = type->next ) { + for ( type = R_engines.first; type; type = type->next ) { printf("\t%s\n", type->idname); } exit(0); @@ -1150,7 +1150,7 @@ int main(int argc, const char **argv) wchar_t ** argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc); int argci = 0; char ** argv = MEM_mallocN(argc * sizeof(char*),"argv array"); - for(argci=0; argci<argc; argci++) + for (argci=0; argci<argc; argci++) { argv[argci] = alloc_utf_8_from_16(argv_16[argci],0); } @@ -1290,7 +1290,7 @@ int main(int argc, const char **argv) BLI_argsFree(ba); #ifdef WIN32 - while(argci) + while (argci) { free(argv[--argci]); } diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index d8bb45707e5..eb31070f265 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -192,7 +192,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool mouse_state = startscene->gm.flag & GAME_SHOW_MOUSE; bool restrictAnimFPS = startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES; - if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */ + if (animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */ // create the canvas, rasterizer and rendertools RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect, ar); @@ -205,7 +205,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c RAS_IRenderTools* rendertools = new KX_BlenderRenderTools(); RAS_IRasterizer* rasterizer = NULL; - if(displaylists) { + if (displaylists) { if (GLEW_VERSION_1_1 && !novertexarrays) rasterizer = new RAS_ListRasterizer(canvas, true, true); else @@ -263,8 +263,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c float camzoom; int draw_letterbox = 0; - if(rv3d->persp==RV3D_CAMOB) { - if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ + if (rv3d->persp==RV3D_CAMOB) { + if (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ camzoom = 1.0f; draw_letterbox = 1; } @@ -318,7 +318,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c blenderdata = bfd->main; startscenename = bfd->curscene->id.name + 2; - if(blenderdata) { + if (blenderdata) { BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name)); BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); #ifdef WITH_PYTHON @@ -341,7 +341,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetAnimRecordMode(animation_record, startFrame); // Quad buffered needs a special window. - if(scene->gm.stereoflag == STEREO_ENABLED){ + if (scene->gm.stereoflag == STEREO_ENABLED){ if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) scene->gm.stereomode); @@ -359,7 +359,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO)); ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat)); ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat)); - if(rv3d->persp == RV3D_ORTHO) + if (rv3d->persp == RV3D_ORTHO) { ketsjiengine->SetCameraOverrideClipping(-v3d->far, v3d->far); } @@ -379,17 +379,17 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool usemat = false, useglslmat = false; - if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) + if (GLEW_ARB_multitexture && GLEW_VERSION_1_1) usemat = true; - if(GPU_glsl_support()) + if (GPU_glsl_support()) useglslmat = true; - else if(gs.matmode == GAME_MAT_GLSL) + else if (gs.matmode == GAME_MAT_GLSL) usemat = false; - if(usemat && (gs.matmode != GAME_MAT_TEXFACE)) + if (usemat && (gs.matmode != GAME_MAT_TEXFACE)) sceneconverter->SetMaterials(true); - if(useglslmat && (gs.matmode == GAME_MAT_GLSL)) + if (useglslmat && (gs.matmode == GAME_MAT_GLSL)) sceneconverter->SetGLSLMaterials(true); KX_Scene* startscene = new KX_Scene(keyboarddevice, @@ -406,12 +406,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c #endif // WITH_PYTHON //initialize Dome Settings - if(scene->gm.stereoflag == STEREO_DOME) + if (scene->gm.stereoflag == STEREO_DOME) ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext); // initialize 3D Audio Settings AUD_I3DDevice* dev = AUD_get3DDevice(); - if(dev) + if (dev) { dev->setSpeedOfSound(scene->audio.speed_of_sound); dev->setDopplerFactor(scene->audio.doppler_factor); @@ -457,7 +457,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (render) { - if(draw_letterbox) { + if (draw_letterbox) { // Clear screen to border color // We do this here since we set the canvas to be within the frames. This means the engine // itself is unaware of the extra space, so we clear the whole region for it. @@ -502,7 +502,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c wm_event_free(event); } - if(win != CTX_wm_window(C)) { + if (win != CTX_wm_window(C)) { exitrequested= KX_EXIT_REQUEST_OUTSIDE; /* window closed while bge runs */ } } @@ -557,7 +557,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c startscene->camera= tmp_camera; } - if(exitrequested != KX_EXIT_REQUEST_OUTSIDE) + if (exitrequested != KX_EXIT_REQUEST_OUTSIDE) { // set the cursor back to normal canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); diff --git a/source/gameengine/BlenderRoutines/BL_System.cpp b/source/gameengine/BlenderRoutines/BL_System.cpp index a97d1a6d5e9..251182a07aa 100644 --- a/source/gameengine/BlenderRoutines/BL_System.cpp +++ b/source/gameengine/BlenderRoutines/BL_System.cpp @@ -44,7 +44,7 @@ static SingletonSystem *_system_instance = NULL; SYS_SystemHandle SYS_GetSystem() { - if(!_system_instance) + if (!_system_instance) _system_instance = new SingletonSystem(); return (SYS_SystemHandle)_system_instance; @@ -52,7 +52,7 @@ SYS_SystemHandle SYS_GetSystem() void SYS_DeleteSystem(SYS_SystemHandle sys) { - if(_system_instance) { + if (_system_instance) { delete _system_instance; _system_instance = NULL; } @@ -61,7 +61,7 @@ void SYS_DeleteSystem(SYS_SystemHandle sys) int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue) { int *result = ((SingletonSystem *)sys)->int_params[paramname]; - if(result) + if (result) return *result; return defaultvalue; @@ -70,7 +70,7 @@ int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defau float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue) { float *result = ((SingletonSystem *)sys)->float_params[paramname]; - if(result) + if (result) return *result; return defaultvalue; @@ -79,7 +79,7 @@ float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue) { STR_String *result = ((SingletonSystem *)sys)->string_params[paramname]; - if(result) + if (result) return *result; return defaultvalue; diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 7a99a4a1419..19a84acf027 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -95,34 +95,34 @@ void DisableForText() { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */ - if(glIsEnabled(GL_BLEND)) glDisable(GL_BLEND); - if(glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST); + if (glIsEnabled(GL_BLEND)) glDisable(GL_BLEND); + if (glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST); - if(glIsEnabled(GL_LIGHTING)) { + if (glIsEnabled(GL_LIGHTING)) { glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); } - if(GLEW_ARB_multitexture) { - for(int i=0; i<MAXTEX; i++) { + if (GLEW_ARB_multitexture) { + for (int i=0; i<MAXTEX; i++) { glActiveTextureARB(GL_TEXTURE0_ARB+i); - if(GLEW_ARB_texture_cube_map) - if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + if (GLEW_ARB_texture_cube_map) + if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) glDisable(GL_TEXTURE_CUBE_MAP_ARB); - if(glIsEnabled(GL_TEXTURE_2D)) + if (glIsEnabled(GL_TEXTURE_2D)) glDisable(GL_TEXTURE_2D); } glActiveTextureARB(GL_TEXTURE0_ARB); } else { - if(GLEW_ARB_texture_cube_map) - if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + if (GLEW_ARB_texture_cube_map) + if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) glDisable(GL_TEXTURE_CUBE_MAP_ARB); - if(glIsEnabled(GL_TEXTURE_2D)) + if (glIsEnabled(GL_TEXTURE_2D)) glDisable(GL_TEXTURE_2D); } } @@ -261,7 +261,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename) int dumpsx, dumpsy; dumprect= screenshot(curarea, &dumpsx, &dumpsy); - if(dumprect) { + if (dumprect) { ImBuf *ibuf; BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index 43166c0698a..9156102ab0d 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -92,23 +92,23 @@ void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool useligh int layer= -1; /* find the layer */ - if(uselights) { - if(m_clientobject) + if (uselights) { + if (m_clientobject) layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer(); } /* avoid state switching */ - if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) + if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) return; m_lastlightlayer = layer; m_lastauxinfo = m_auxilaryClientInfo; /* enable/disable lights as needed */ - if(layer >= 0) + if (layer >= 0) enable = applyLights(layer, viewmat); - if(enable) + if (enable) EnableOpenGLLights(rasty); else DisableOpenGLLights(); @@ -116,7 +116,7 @@ void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool useligh void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) { - if(m_lastlighting == true) + if (m_lastlighting == true) return; glEnable(GL_LIGHTING); @@ -133,7 +133,7 @@ void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) void KX_BlenderRenderTools::DisableOpenGLLights() { - if(m_lastlighting == false) + if (m_lastlighting == false) return; glDisable(GL_LIGHTING); @@ -297,7 +297,7 @@ void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, int width, int height) { - if(mode == RAS_IRenderTools::RAS_TEXT_PADDED) + if (mode == RAS_IRenderTools::RAS_TEXT_PADDED) BL_print_gamedebug_line_padded(text, xco, yco, width, height); else BL_print_gamedebug_line(text, xco, yco, width, height); @@ -317,7 +317,7 @@ void KX_BlenderRenderTools::RenderText( struct MTFace* tface = 0; unsigned int *col = 0; - if(flag & RAS_BLENDERMAT) { + if (flag & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat); tface = bl_mat->GetMTFace(); col = bl_mat->GetMCol(); @@ -350,7 +350,7 @@ int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& view unsigned int count; std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin(); - for(count=0; count<m_numgllights; count++) + for (count=0; count<m_numgllights; count++) glDisable((GLenum)(GL_LIGHT0+count)); viewmat.getValue(glviewmat); @@ -362,7 +362,7 @@ int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& view RAS_LightObject* lightdata = (*lit); KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light; - if(kxlight->ApplyLight(kxscene, objectlayer, count)) + if (kxlight->ApplyLight(kxscene, objectlayer, count)) count++; } glPopMatrix(); @@ -374,16 +374,16 @@ void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer) { int state = rasterizer->GetMotionBlurState(); float motionblurvalue; - if(state) + if (state) { motionblurvalue = rasterizer->GetMotionBlurValue(); - if(state==1) + if (state==1) { //bugfix:load color buffer into accum buffer for the first time(state=1) glAccum(GL_LOAD, 1.0); rasterizer->SetMotionBlurState(2); } - else if(motionblurvalue>=0.0 && motionblurvalue<=1.0) + else if (motionblurvalue>=0.0 && motionblurvalue<=1.0) { glAccum(GL_MULT, motionblurvalue); glAccum(GL_ACCUM, 1-motionblurvalue); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 5d87e7fd969..61379209151 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -365,14 +365,14 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) bPoseChannel *pchan; - if(m_userpose==NULL && m_pose==NULL) { + if (m_userpose==NULL && m_pose==NULL) { BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ } // get_pose_channel accounts for NULL pose, run on both in case one exists but // the channel doesnt - if( !(pchan=get_pose_channel(m_userpose, string)) && + if ( !(pchan=get_pose_channel(m_userpose, string)) && !(pchan=get_pose_channel(m_pose, string)) ) { PyErr_SetString(PyExc_ValueError, "channel doesnt exist"); @@ -428,11 +428,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, return NULL; } - if(PyTuple_Size(args)==2) { + if (PyTuple_Size(args)==2) { if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix return NULL; } - else if(PyTuple_Size(args)==4) { + else if (PyTuple_Size(args)==4) { if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat return NULL; } @@ -441,11 +441,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, return NULL; } - if(pymat) { + if (pymat) { float matrix[4][4]; MT_Matrix4x4 mat; - if(!PyMatTo(pymat, mat)) + if (!PyMatTo(pymat, mat)) return NULL; mat.getValue((float*)matrix); @@ -453,14 +453,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); if (!m_userpose) { - if(!m_pose) + if (!m_pose) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there. pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. - if(pchan) { + if (pchan) { copy_v3_v3(pchan->loc, matrix[3]); mat4_to_size(pchan->size, matrix); mat4_to_quat(pchan->quat, matrix); @@ -476,7 +476,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, // same as above if (!m_userpose) { - if(!m_pose) + if (!m_pose) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } @@ -484,14 +484,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. // for some reason loc.setValue(pchan->loc) fails - if(pchan) { + if (pchan) { pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2]; pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2]; pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */ } } - if(pchan==NULL) { + if (pchan==NULL) { PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels"); return NULL; } @@ -595,9 +595,9 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose(); - if(pose) { + if (pose) { bPoseChannel *pchan; - for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + for (pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { item= PyUnicode_FromString(pchan->name); PyList_Append(ret, item); Py_DECREF(item); diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index dd2e29e4288..f4c437c04ec 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -121,7 +121,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) // fails to link, props are not used in the BGE yet. #if 0 - if(pchan->prop) + if (pchan->prop) pchan->prop= IDP_CopyProperty(pchan->prop); #endif pchan->prop= NULL; @@ -186,7 +186,7 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/) if (schan->rotmode) dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight); } - for(dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) { + for (dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) { /* no 'add' option for constraint blending */ dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight; } @@ -469,7 +469,7 @@ void BL_ArmatureObject::ApplyPose() // in the GE, we use ctime to store the timestep m_pose->ctime = (float)m_timestep; //m_scene->r.cfra++; - if(m_lastapplyframe != m_lastframe) { + if (m_lastapplyframe != m_lastframe) { // update the constraint if any, first put them all off so that only the active ones will be updated SG_DList::iterator<BL_ArmatureConstraint> cit(m_controlledConstraints); for (cit.begin(); !cit.end(); ++cit) { @@ -591,7 +591,7 @@ bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix) ApplyPose(); pchan = get_pose_channel(m_objArma->pose, bone->name); - if(pchan) + if (pchan) matrix.setValue(&pchan->pose_mat[0][0]); RestorePose(); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 33cbbe3ee86..1805214c6a2 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -414,7 +414,7 @@ static void SetDefaultLightMode(Scene* scene) Scene *sce_iter; Base *base; - for(SETLOOPER(scene, sce_iter, base)) + for (SETLOOPER(scene, sce_iter, base)) { if (base->object->type == OB_LAMP) { @@ -440,7 +440,7 @@ static void GetRGB(short type, { case 0: // vertex colors { - if(mmcol) { + if (mmcol) { c0 = KX_Mcol2uint_new(mmcol[0]); c1 = KX_Mcol2uint_new(mmcol[1]); c2 = KX_Mcol2uint_new(mmcol[2]); @@ -511,7 +511,7 @@ bool ConvertMaterial( bool validface = (tface!=0); short type = 0; - if( validmat ) + if ( validmat ) type = 1; // material color material->IdMode = DEFAULT_BLENDER; @@ -519,10 +519,10 @@ bool ConvertMaterial( material->materialindex = mface->mat_nr; // -------------------------------- - if(validmat) { + if (validmat) { // use vertex colors by explicitly setting - if(mat->mode &MA_VERTEXCOLP || glslmat) + if (mat->mode &MA_VERTEXCOLP || glslmat) type = 0; // use lighting? @@ -539,21 +539,21 @@ bool ConvertMaterial( * it is set in the buttons * In GLSL is not working yet :/ 3.2011 */ bool facetex = false; - if(validface && mat->mode &MA_FACETEXTURE) + if (validface && mat->mode &MA_FACETEXTURE) facetex = true; numchan = numchan>MAXTEX?MAXTEX:numchan; if (facetex && numchan == 0) numchan = 1; // foreach MTex - for(int i=0; i<numchan; i++) { + for (int i=0; i<numchan; i++) { // use face tex - if(i==0 && facetex ) { + if (i==0 && facetex ) { facetex = false; Image*tmp = (Image*)(tface->tpage); - if(tmp) { + if (tmp) { material->img[i] = tmp; material->texname[i] = material->img[i]->id.name; material->flag[i] |= MIPMAP; @@ -562,12 +562,12 @@ bool ConvertMaterial( material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ALPHA )?USEALPHA:0; material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ADD )?CALCALPHA:0; - if(material->img[i]->flag & IMA_REFLECT) + if (material->img[i]->flag & IMA_REFLECT) material->mapping[i].mapping |= USEREFL; else { mttmp = getImageFromMaterial( mat, i ); - if(mttmp && mttmp->texco &TEXCO_UV) + if (mttmp && mttmp->texco &TEXCO_UV) { STR_String uvName = mttmp->uvname; @@ -589,24 +589,24 @@ bool ConvertMaterial( } mttmp = getImageFromMaterial( mat, i ); - if( mttmp ) { - if( mttmp->tex ) { - if( mttmp->tex->type == TEX_IMAGE ) { + if ( mttmp ) { + if ( mttmp->tex ) { + if ( mttmp->tex->type == TEX_IMAGE ) { material->mtexname[i] = mttmp->tex->id.name; material->img[i] = mttmp->tex->ima; - if( material->img[i] ) { + if ( material->img[i] ) { material->texname[i] = material->img[i]->id.name; material->flag[i] |= ( mttmp->tex->imaflag &TEX_MIPMAP )?MIPMAP:0; // ----------------------- - if( mttmp->tex->imaflag &TEX_USEALPHA ) { + if ( mttmp->tex->imaflag &TEX_USEALPHA ) { material->flag[i] |= USEALPHA; } // ----------------------- - else if( mttmp->tex->imaflag &TEX_CALCALPHA ) { + else if ( mttmp->tex->imaflag &TEX_CALCALPHA ) { material->flag[i] |= CALCALPHA; } - else if(mttmp->tex->flag &TEX_NEGALPHA) { + else if (mttmp->tex->flag &TEX_NEGALPHA) { material->flag[i] |= USENEGALPHA; } @@ -614,12 +614,12 @@ bool ConvertMaterial( material->flag[i] |= ( mttmp->mapto & MAP_ALPHA )?TEXALPHA:0; material->flag[i] |= ( mttmp->texflag& MTEX_NEGATIVE )?TEXNEG:0; - if(!glslmat && (material->flag[i] & TEXALPHA)) + if (!glslmat && (material->flag[i] & TEXALPHA)) texalpha = 1; } } - else if(mttmp->tex->type == TEX_ENVMAP) { - if( mttmp->tex->env->stype == ENV_LOAD ) { + else if (mttmp->tex->type == TEX_ENVMAP) { + if ( mttmp->tex->env->stype == ENV_LOAD ) { material->mtexname[i] = mttmp->tex->id.name; EnvMap *env = mttmp->tex->env; @@ -643,16 +643,16 @@ bool ConvertMaterial( // mapping methods material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; - if(mttmp->texco & TEXCO_OBJECT) { + if (mttmp->texco & TEXCO_OBJECT) { material->mapping[i].mapping |= USEOBJ; - if(mttmp->object) + if (mttmp->object) material->mapping[i].objconame = mttmp->object->id.name; } - else if(mttmp->texco &TEXCO_REFL) + else if (mttmp->texco &TEXCO_REFL) material->mapping[i].mapping |= USEREFL; - else if(mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) + else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) material->mapping[i].mapping |= USEORCO; - else if(mttmp->texco &TEXCO_UV) + else if (mttmp->texco &TEXCO_UV) { STR_String uvName = mttmp->uvname; @@ -662,9 +662,9 @@ bool ConvertMaterial( material->mapping[i].uvCoName = ""; material->mapping[i].mapping |= USEUV; } - else if(mttmp->texco &TEXCO_NORM) + else if (mttmp->texco &TEXCO_NORM) material->mapping[i].mapping |= USENORM; - else if(mttmp->texco &TEXCO_TANGENT) + else if (mttmp->texco &TEXCO_TANGENT) material->mapping[i].mapping |= USETANG; else material->mapping[i].mapping |= DISABLE; @@ -740,15 +740,15 @@ bool ConvertMaterial( int valid = 0; // check for tface tex to fallback on - if( validface ){ + if ( validface ){ material->img[0] = (Image*)(tface->tpage); // ------------------------ - if(material->img[0]) { + if (material->img[0]) { material->texname[0] = material->img[0]->id.name; material->mapping[0].mapping |= ( (material->img[0]->flag & IMA_REFLECT)!=0 )?USEREFL:0; /* see if depth of the image is 32bits */ - if(BKE_image_has_alpha(material->img[0])) { + if (BKE_image_has_alpha(material->img[0])) { material->flag[0] |= USEALPHA; material->alphablend = GEMAT_ALPHA; } @@ -786,7 +786,7 @@ bool ConvertMaterial( /* No material, what to do? let's see what is in the UV and set the material accordingly * light and visible is always on */ - if( validface ) { + if ( validface ) { material->tile = tface->tile; uv[0].setValue(tface->uv[0]); @@ -811,17 +811,17 @@ bool ConvertMaterial( } // with ztransp enabled, enforce alpha blending mode - if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) + if (validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) material->alphablend = GEMAT_ALPHA; // always zsort alpha + add - if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { + if ((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { material->ras_mode |= ALPHA; material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0; } // get uv sets - if(validmat) + if (validmat) { bool isFirstSet = true; @@ -860,7 +860,7 @@ bool ConvertMaterial( isFirstSet = false; uvName = layer.name; } - else if(strcmp(layer.name, uvName) != 0) + else if (strcmp(layer.name, uvName) != 0) { uv2[0] = uvSet[0]; uv2[1] = uvSet[1]; uv2[2] = uvSet[2]; uv2[3] = uvSet[3]; @@ -889,7 +889,7 @@ bool ConvertMaterial( material->SetConversionUV(uvName, uv); material->SetConversionUV2(uv2Name, uv2); - if(validmat) + if (validmat) material->matname =(mat->id.name); material->tface = tface; @@ -919,7 +919,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, int totface = dm->getNumTessFaces(dm); const char *tfaceName = ""; - if(tface) { + if (tface) { DM_add_tangent_layer(dm); tangent = (float(*)[4])dm->getTessFaceDataArray(dm, CD_TANGENT); } @@ -942,7 +942,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, layers[validLayers].face = (MTFace*)(dm->faceData.layers[i].data); layers[validLayers].name = dm->faceData.layers[i].name; - if(tface == layers[validLayers].face) + if (tface == layers[validLayers].face) tfaceName = layers[validLayers].name; validLayers++; } @@ -976,7 +976,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, pt2.setValue(mvert[mface->v3].co); if (mface->v4) pt3.setValue(mvert[mface->v4].co); - if(mface->flag & ME_SMOOTH) { + if (mface->flag & ME_SMOOTH) { float n0[3], n1[3], n2[3], n3[3]; normal_short_to_float_v3(n0, mvert[mface->v1].no); @@ -986,7 +986,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, no1 = n1; no2 = n2; - if(mface->v4) { + if (mface->v4) { normal_short_to_float_v3(n3, mvert[mface->v4].no); no3 = n3; } @@ -994,7 +994,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, else { float fno[3]; - if(mface->v4) + if (mface->v4) normal_quad_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co); else normal_tri_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co); @@ -1002,7 +1002,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, no0 = no1 = no2 = no3 = MT_Vector3(fno); } - if(tangent) { + if (tangent) { tan0 = tangent[f*4 + 0]; tan1 = tangent[f*4 + 1]; tan2 = tangent[f*4 + 2]; @@ -1010,13 +1010,13 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (mface->v4) tan3 = tangent[f*4 + 3]; } - if(blenderobj) + if (blenderobj) ma = give_current_material(blenderobj, mface->mat_nr+1); else ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; /* ckeck for texface since texface _only_ is used as a fallback */ - if(ma == NULL && tface == NULL) { + if (ma == NULL && tface == NULL) { ma= &defmaterial; } @@ -1024,7 +1024,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, bool visible = true; bool twoside = false; - if(converter->GetMaterials()) { + if (converter->GetMaterials()) { /* do Blender Multitexture and Blender GLSL materials */ unsigned int rgb[4]; MT_Point2 uv[4]; @@ -1102,7 +1102,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, } /* set UV properties */ - if(tface) { + if (tface) { uv0.setValue(tface->uv[0]); uv1.setValue(tface->uv[1]); uv2.setValue(tface->uv[2]); @@ -1204,7 +1204,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (bucketCreated) { // this is needed to free up memory afterwards converter->RegisterPolyMaterial(polymat); - if(converter->GetMaterials()) { + if (converter->GetMaterials()) { converter->RegisterBlenderMaterial(bl_mat); // the poly material has been stored in the bucket, next time we must create a new one bl_mat = NULL; @@ -1254,7 +1254,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, meshobj->EndConversion(); // pre calculate texture generation - for(list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial(); + for (list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial(); mit != meshobj->GetLastMaterial(); ++ mit) { mit->m_bucket->GetPolyMaterial()->OnConstruction(lightlayer); } @@ -1361,7 +1361,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) float radius=0.0f, vert_radius, *co; int a; - if(me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox"); + if (me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; INIT_MINMAX(min, max); @@ -1370,7 +1370,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) if (!size) size= msize; mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++) { + for (a=0; a<me->totvert; a++, mvert++) { co= mvert->co; /* bounds */ @@ -1382,7 +1382,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) radius= vert_radius; } - if(me->totvert) { + if (me->totvert) { loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f; @@ -1419,18 +1419,18 @@ static void my_tex_space_mesh(Mesh *me) my_boundbox_mesh(me, loc, size); - if(me->texflag & ME_AUTOSPACE) { - if(me->key) { + if (me->texflag & ME_AUTOSPACE) { + if (me->key) { kb= me->key->refkey; if (kb) { INIT_MINMAX(min, max); fp= (float *)kb->data; - for(a=0; a<kb->totelem; a++, fp+=3) { + for (a=0; a<kb->totelem; a++, fp+=3) { DO_MINMAX(fp, min, max); } - if(kb->totelem) { + if (kb->totelem) { loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f; size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f; } @@ -1446,17 +1446,17 @@ static void my_tex_space_mesh(Mesh *me) copy_v3_v3(me->size, size); me->rot[0]= me->rot[1]= me->rot[2]= 0.0f; - if(me->size[0]==0.0) me->size[0]= 1.0f; - else if(me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f; - else if(me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f; + if (me->size[0]==0.0) me->size[0]= 1.0f; + else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f; + else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f; - if(me->size[1]==0.0) me->size[1]= 1.0f; - else if(me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f; - else if(me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f; + if (me->size[1]==0.0) me->size[1]= 1.0f; + else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f; + else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f; - if(me->size[2]==0.0) me->size[2]= 1.0f; - else if(me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f; - else if(me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f; + if (me->size[2]==0.0) me->size[2]= 1.0f; + else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f; + else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f; } } @@ -1484,7 +1484,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa } else { bb= ( (Mesh *)ob->data )->bb; - if(bb==0) + if (bb==0) { my_tex_space_mesh((struct Mesh *)ob->data); bb= ( (Mesh *)ob->data )->bb; @@ -1505,7 +1505,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa break; } - if(bb==NULL) + if (bb==NULL) { center[0]= center[1]= center[2]= 0.0; size[0] = size[1]=size[2]=1.0; @@ -1876,7 +1876,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l bool glslmat = converter->GetGLSLMaterials(); // in GLSL NEGATIVE LAMP is handled inside the lamp update function - if(glslmat==0) { + if (glslmat==0) { if (la->mode & LA_NEG) { lightobj.m_red = -lightobj.m_red; @@ -2049,7 +2049,7 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob); /* add to the list only the visible fonts */ - if((ob->lay & kxscene->GetBlenderScene()->lay) != 0) + if ((ob->lay & kxscene->GetBlenderScene()->lay) != 0) kxscene->AddFont(static_cast<KX_FontObject*>(gameobj)); break; } @@ -2060,7 +2060,7 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj->SetLayer(ob->lay); gameobj->SetBlenderObject(ob); /* set the visibility state based on the objects render option in the outliner */ - if(ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); + if (ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); } return gameobj; } @@ -2079,8 +2079,8 @@ bPoseChannel *get_active_posechannel2 (Object *ob) bPoseChannel *pchan; /* find active */ - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { - if(pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if (pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) return pchan; } @@ -2470,7 +2470,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, { Group* group = *git; GroupObject* go; - for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) { Object* blenderobject = go->ob; if (converter->FindGameObject(blenderobject) == NULL) @@ -2521,13 +2521,13 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) { KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera); - if(gamecamera) + if (gamecamera) kxscene->SetActiveCamera(gamecamera); } // Set up armatures set<Object*>::iterator oit; - for(oit=allblobj.begin(); oit!=allblobj.end(); oit++) + for (oit=allblobj.begin(); oit!=allblobj.end(); oit++) { Object* blenderobj = *oit; if (blenderobj->type==OB_MESH) { @@ -2610,7 +2610,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, // parent this to a bone Bone *parent_bone = get_named_bone( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr); - if(parent_bone) { + if (parent_bone) { KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone); pcit->m_gamechildnode->SetParentRelation(bone_parent_relation); } @@ -2739,7 +2739,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, bConstraint *curcon; conlist = get_active_constraints2(blenderobject); - if((gameobj->GetLayer()&activeLayerBitInfo)==0) + if ((gameobj->GetLayer()&activeLayerBitInfo)==0) continue; if (conlist) { @@ -2795,14 +2795,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie, dofbit<<=1; } } - else if(dat->type == PHY_CONE_TWIST_CONSTRAINT) + else if (dat->type == PHY_CONE_TWIST_CONSTRAINT) { int dof; int dofbit = 1<<3; // bitflag use_angular_limit_x for (dof=3;dof<6;dof++) { - if(dat->flag & dofbit) + if (dat->flag & dofbit) { kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]); } diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 9d514e99661..f6d9b4a5065 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -108,7 +108,7 @@ void BL_DeformableGameObject::SetDeformer(class RAS_Deformer* deformer) m_pDeformer = deformer; SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); - for(mit.begin(); !mit.end(); ++mit) + for (mit.begin(); !mit.end(); ++mit) { (*mit)->SetDeformer(deformer); } diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp index 4e5852a21c1..f2c30193613 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.cpp +++ b/source/gameengine/Converter/BL_MeshDeformer.cpp @@ -53,21 +53,21 @@ bool BL_MeshDeformer::Apply(RAS_IPolyMaterial*) size_t i; // only apply once per frame if the mesh is actually modified - if(m_pMeshObject->MeshModified() && + if (m_pMeshObject->MeshModified() && m_lastDeformUpdate != m_gameobj->GetLastFrame()) { // For each material - for(list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial(); + for (list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; RAS_MeshSlot::iterator it; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { // For each vertex - for(i=it.startvertex; i<it.endvertex; i++) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; v.SetXYZ(m_bmesh->mvert[v.getOrigIndex()].co); } @@ -126,17 +126,17 @@ void BL_MeshDeformer::RecalcNormals() memset(m_transnors, 0, sizeof(float)*3*m_bmesh->totvert); /* add face normals to vertices. */ - for(mit = m_pMeshObject->GetFirstMaterial(); + for (mit = m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { int nvert = (int)it.array->m_type; - for(i=0; i<it.totindex; i+=nvert) { + for (i=0; i<it.totindex; i+=nvert) { RAS_TexVert& v1 = it.vertex[it.index[i]]; RAS_TexVert& v2 = it.vertex[it.index[i+1]]; RAS_TexVert& v3 = it.vertex[it.index[i+2]]; @@ -150,7 +150,7 @@ void BL_MeshDeformer::RecalcNormals() /* compute face normal */ float fnor[3], n1[3], n2[3]; - if(nvert == 4) { + if (nvert == 4) { v4 = &it.vertex[it.index[i+3]]; co4 = m_transverts[v4->getOrigIndex()]; @@ -186,17 +186,17 @@ void BL_MeshDeformer::RecalcNormals() vn2[0] += fnor[0]; vn2[1] += fnor[1]; vn2[2] += fnor[2]; vn3[0] += fnor[0]; vn3[1] += fnor[1]; vn3[2] += fnor[2]; - if(v4) { + if (v4) { float *vn4 = m_transnors[v4->getOrigIndex()]; vn4[0] += fnor[0]; vn4[1] += fnor[1]; vn4[2] += fnor[2]; } /* in case of flat - just assign, the vertices are split */ - if(v1.getFlag() & RAS_TexVert::FLAT) { + if (v1.getFlag() & RAS_TexVert::FLAT) { v1.SetNormal(fnor); v2.SetNormal(fnor); v3.SetNormal(fnor); - if(v4) + if (v4) v4->SetNormal(fnor); } } @@ -204,18 +204,18 @@ void BL_MeshDeformer::RecalcNormals() } /* assign smooth vertex normals */ - for(mit = m_pMeshObject->GetFirstMaterial(); + for (mit = m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - for(slot->begin(it); !slot->end(it); slot->next(it)) { - for(i=it.startvertex; i<it.endvertex; i++) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; - if(!(v.getFlag() & RAS_TexVert::FLAT)) + if (!(v.getFlag() & RAS_TexVert::FLAT)) v.SetNormal(m_transnors[v.getOrigIndex()]); //.safe_normalized() } } diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index 500968462c3..c1c94c25108 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -132,7 +132,7 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob) return false; ModifierData* md = (ModifierData*)ob->modifiers.first; - if(md->type == eModifierType_Armature ) + if (md->type == eModifierType_Armature ) return true; return false; @@ -218,7 +218,7 @@ bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat) for (int imat=0; imat<nmat; imat++) { RAS_MeshMaterial *mmat = m_pMeshObject->GetMeshMaterial(imat); RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj]; - if(!slot || !*slot) + if (!slot || !*slot) continue; (*slot)->m_pDerivedMesh = m_dm; } diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index f320df12078..85010ce1bbf 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -111,9 +111,9 @@ BL_SkinDeformer::BL_SkinDeformer( BL_SkinDeformer::~BL_SkinDeformer() { - if(m_releaseobject && m_armobj) + if (m_releaseobject && m_armobj) m_armobj->Release(); - if(m_dfnrToPC) + if (m_dfnrToPC) delete [] m_dfnrToPC; } @@ -149,16 +149,16 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat) nmat = m_pMeshObject->NumMaterials(); for (imat=0; imat<nmat; imat++) { mmat = m_pMeshObject->GetMeshMaterial(imat); - if(!mmat->m_slots[(void*)m_gameobj]) + if (!mmat->m_slots[(void*)m_gameobj]) continue; slot = *mmat->m_slots[(void*)m_gameobj]; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { // for each vertex // copy the untransformed data from the original mvert - for(i=it.startvertex; i<it.endvertex; i++) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; v.SetXYZ(m_transverts[v.getOrigIndex()]); if (m_copyNormals) @@ -307,7 +307,7 @@ bool BL_SkinDeformer::UpdateInternal(bool shape_applied) /* See if the armature has been updated for this frame */ if (PoseUpdated()){ - if(!shape_applied) { + if (!shape_applied) { /* store verts locally */ VerifyStorage(); diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index 2225c7895d8..fc3b75c49ad 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -90,7 +90,7 @@ BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* ble copy_v3_v3(m_backgroundcolor, &blenderworld->horr); copy_v3_v3(m_ambientcolor, &blenderworld->ambr); - if(blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + if (blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor); linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor); linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor); diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp index 37960e5c2f7..f020aab4d50 100644 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp +++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp @@ -49,11 +49,11 @@ float BL_ScalarInterpolator::GetValue(float currentTime) const BL_InterpolatorList::BL_InterpolatorList(bAction *action) { - if(action==NULL) + if (action==NULL) return; - for(FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) { - if(fcu->rna_path) { + for (FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) { + if (fcu->rna_path) { BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); //assert(new_ipo); push_back(new_ipo); @@ -71,10 +71,10 @@ BL_InterpolatorList::~BL_InterpolatorList() KX_IScalarInterpolator *BL_InterpolatorList::GetScalarInterpolator(const char *rna_path, int array_index) { - for(BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ ) + for (BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ ) { FCurve *fcu= (static_cast<BL_ScalarInterpolator *>(*i))->GetFCurve(); - if(array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0) + if (array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0) return *i; } return NULL; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index ee60d2c5bc5..d82a911b4ab 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -214,13 +214,13 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name) * Find the specified scene by name, or the first * scene if nothing matches (shouldn't happen). */ - if((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) + if ((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) return sce; for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { Main *main= *it; - if((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2))) + if ((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2))) return sce; } @@ -537,7 +537,7 @@ void KX_BlenderSceneConverter::RegisterGameMesh( RAS_MeshObject *gamemesh, struct Mesh *for_blendermesh) { - if(for_blendermesh) { /* dynamically loaded meshes we don't want to keep lookups for */ + if (for_blendermesh) { /* dynamically loaded meshes we don't want to keep lookups for */ m_map_mesh_to_gamemesh.insert(CHashedPtr(for_blendermesh),gamemesh); } m_meshobjects.push_back(pair<KX_Scene*,RAS_MeshObject*>(m_currentScene,gamemesh)); @@ -665,13 +665,13 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) IpoCurve *icu1; int numCurves = 0; - for( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) { + for ( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) { IpoCurve* tmpicu = icu1; /*int i; BezTriple *bezt; - for( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++){ + for ( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++){ printf("(%f,%f,%f),(%f,%f,%f),(%f,%f,%f)\n",bezt->vec[0][0],bezt->vec[0][1],bezt->vec[0][2],bezt->vec[1][0],bezt->vec[1][1],bezt->vec[1][2],bezt->vec[2][0],bezt->vec[2][1],bezt->vec[2][2]); }*/ @@ -679,7 +679,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) numCurves++; BLI_remlink( &( blenderObject->ipo->curve ), tmpicu ); - if( tmpicu->bezt ) + if ( tmpicu->bezt ) MEM_freeN( tmpicu->bezt ); MEM_freeN( tmpicu ); localDel_ipoCurve( tmpicu ); @@ -769,7 +769,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) { //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController(); - if(blenderObject->adt==NULL) + if (blenderObject->adt==NULL) BKE_id_add_animdata(&blenderObject->id); if (blenderObject->adt) @@ -807,37 +807,37 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) IpoCurve *icu_lx = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"); if (!icu_lx) { icu_lx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1); - if(icu_lx) icu_lx->ipo = IPO_LIN; + if (icu_lx) icu_lx->ipo = IPO_LIN; } IpoCurve *icu_ly = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"); if (!icu_ly) { icu_ly = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1); - if(icu_ly) icu_ly->ipo = IPO_LIN; + if (icu_ly) icu_ly->ipo = IPO_LIN; } IpoCurve *icu_lz = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"); if (!icu_lz) { icu_lz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1); - if(icu_lz) icu_lz->ipo = IPO_LIN; + if (icu_lz) icu_lz->ipo = IPO_LIN; } IpoCurve *icu_rx = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"); if (!icu_rx) { icu_rx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1); - if(icu_rx) icu_rx->ipo = IPO_LIN; + if (icu_rx) icu_rx->ipo = IPO_LIN; } IpoCurve *icu_ry = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"); if (!icu_ry) { icu_ry = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1); - if(icu_ry) icu_ry->ipo = IPO_LIN; + if (icu_ry) icu_ry->ipo = IPO_LIN; } IpoCurve *icu_rz = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"); if (!icu_rz) { icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); - if(icu_rz) icu_rz->ipo = IPO_LIN; + if (icu_rz) icu_rz->ipo = IPO_LIN; } - if(icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); // orn.getValue((float *)tmat); // uses the wrong ordering, cant use this for (int r=0;r<3;r++) @@ -848,7 +848,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat); //eval_icu - for(int x = 0; x < 3; x++) + for (int x = 0; x < 3; x++) eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0); //fill the curves with data @@ -925,7 +925,7 @@ vector<Main*> &KX_BlenderSceneConverter::GetMainDynamic() Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) { for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) - if(BLI_path_cmp((*it)->name, path) == 0) + if (BLI_path_cmp((*it)->name, path) == 0) return *it; return NULL; @@ -958,21 +958,21 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha static char err_local[255]; /* only scene and mesh supported right now */ - if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) { + if (idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) { snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group); *err_str= err_local; BLO_blendhandle_close(bpy_openlib); return false; } - if(GetMainDynamicPath(path)) { + if (GetMainDynamicPath(path)) { snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path); *err_str= err_local; BLO_blendhandle_close(bpy_openlib); return false; } - if(bpy_openlib==NULL) { + if (bpy_openlib==NULL) { snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); *err_str= err_local; return false; @@ -1027,31 +1027,31 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha strncpy(main_newlib->name, path, sizeof(main_newlib->name)); - if(idcode==ID_ME) { + if (idcode==ID_ME) { /* Convert all new meshes into BGE meshes */ ID* mesh; - for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { + for (mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { if (options & LIB_LOAD_VERBOSE) printf("MeshName: %s\n", mesh->name+2); RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this); scene_merge->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); } } - else if(idcode==ID_AC) { + else if (idcode==ID_AC) { /* Convert all actions */ ID *action; - for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { + for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { if (options & LIB_LOAD_VERBOSE) printf("ActionName: %s\n", action->name+2); scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action); } } - else if(idcode==ID_SCE) { + else if (idcode==ID_SCE) { /* Merge all new linked in scene into the existing one */ ID *scene; - for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { + for (scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { if (options & LIB_LOAD_VERBOSE) printf("SceneName: %s\n", scene->name+2); @@ -1067,7 +1067,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha if (options & LIB_LOAD_LOAD_ACTIONS) { ID *action; - for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { + for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { if (options & LIB_LOAD_VERBOSE) printf("ActionName: %s\n", action->name+2); scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action); @@ -1085,13 +1085,13 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) int maggie_index= -1; int i=0; - if(maggie==NULL) + if (maggie==NULL) return false; /* tag all false except the one we remove */ for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { Main *main= *it; - if(main != maggie) { + if (main != maggie) { tag_main(main, 0); } else { @@ -1101,7 +1101,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) } /* should never happen but just to be safe */ - if(maggie_index == -1) + if (maggie_index == -1) return false; m_DynamicMaggie.erase(m_DynamicMaggie.begin() + maggie_index); @@ -1116,7 +1116,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int scene_idx=0;scene_idx<numScenes;scene_idx++) { KX_Scene* scene = scenes->at(scene_idx); - if(IS_TAGGED(scene->GetBlenderScene())) { + if (IS_TAGGED(scene->GetBlenderScene())) { RemoveScene(scene); // XXX - not tested yet scene_idx--; numScenes--; @@ -1127,10 +1127,10 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) { CTR_Map<STR_HashedString,void*> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap(); - for(int i=0; i<mapStringToMeshes.size(); i++) + for (int i=0; i<mapStringToMeshes.size(); i++) { RAS_MeshObject *meshobj= (RAS_MeshObject *) *mapStringToMeshes.at(i); - if(meshobj && IS_TAGGED(meshobj->GetMesh())) + if (meshobj && IS_TAGGED(meshobj->GetMesh())) { STR_HashedString mn = meshobj->GetName(); mapStringToMeshes.remove(mn); @@ -1144,11 +1144,11 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) { CTR_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap(); - for(int i=0; i<mapStringToActions.size(); i++) + for (int i=0; i<mapStringToActions.size(); i++) { ID *action= (ID*) *mapStringToActions.at(i); - if(IS_TAGGED(action)) + if (IS_TAGGED(action)) { STR_HashedString an = action->name+2; mapStringToActions.remove(an); @@ -1160,7 +1160,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) //scene->FreeTagged(); /* removed tagged objects and meshes*/ CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL}; - for(int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++) + for (int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++) { CListValue *obs= obj_lists[ob_ls_idx]; RAS_MeshObject* mesh; @@ -1168,7 +1168,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++) { KX_GameObject* gameobj = (KX_GameObject*)obs->GetValue(ob_idx); - if(IS_TAGGED(gameobj->GetBlenderObject())) { + if (IS_TAGGED(gameobj->GetBlenderObject())) { int size_before = obs->GetCount(); @@ -1176,7 +1176,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) * frees m_map_gameobject_to_blender from UnregisterGameObject */ scene->RemoveObject(gameobj); - if(size_before != obs->GetCount()) + if (size_before != obs->GetCount()) ob_idx--; else { printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr()); @@ -1187,7 +1187,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) int mesh_index= gameobj->GetMeshCount(); while(mesh_index--) { mesh= gameobj->GetMesh(mesh_index); - if(IS_TAGGED(mesh->GetMesh())) { + if (IS_TAGGED(mesh->GetMesh())) { gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */ break; } @@ -1199,7 +1199,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION)) { BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx]; - if(IS_TAGGED(act->GetAction())) + if (IS_TAGGED(act->GetAction())) act->SetAction(NULL); } } @@ -1237,7 +1237,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int scene_idx=0;scene_idx<numScenes;scene_idx++) { KX_Scene* scene = scenes->at(scene_idx); - if(scene->GetWorldInfo()) + if (scene->GetWorldInfo()) worldset.insert( scene->GetWorldInfo() ); } @@ -1270,7 +1270,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) Material *bmat= NULL; /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(mat->GetFlag() & RAS_BLENDERMAT) { + if (mat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat); bmat= bl_mat->GetBlenderMaterial(); @@ -1295,7 +1295,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) Material *bmat= NULL; /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(mat->GetFlag() & RAS_BLENDERMAT) { + if (mat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat); bmat= bl_mat->GetBlenderMaterial(); @@ -1304,7 +1304,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) bmat= kx_mat->GetBlenderMaterial(); } - if(bmat) { + if (bmat) { //printf("FOUND MAT '%s' !!! ", ((ID*)bmat)->name+2); } else { @@ -1419,13 +1419,13 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, /* Find a mesh in the current main */ ID *me= static_cast<ID *>(BLI_findstring(&m_maggie->mesh, name, offsetof(ID, name) + 2)); - if(me==NULL) { + if (me==NULL) { printf("Could not be found \"%s\"\n", name); return NULL; } /* Watch this!, if its used in the original scene can cause big troubles */ - if(me->us > 0) { + if (me->us > 0) { printf("Mesh has a user \"%s\"\n", name); me = (ID*)copy_mesh((Mesh*)me); me->us--; @@ -1439,16 +1439,16 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, Mesh *mesh= (Mesh *)me; /* ensure all materials are tagged */ - for(int i=0; i<mesh->totcol; i++) - if(mesh->mat[i]) + for (int i=0; i<mesh->totcol; i++) + if (mesh->mat[i]) mesh->mat[i]->id.flag &= ~LIB_DOIT; - for(int i=0; i<mesh->totcol; i++) + for (int i=0; i<mesh->totcol; i++) { Material *mat_old= mesh->mat[i]; /* if its tagged its a replaced material */ - if(mat_old && (mat_old->id.flag & LIB_DOIT)==0) + if (mat_old && (mat_old->id.flag & LIB_DOIT)==0) { Material *mat_old= mesh->mat[i]; Material *mat_new= copy_material( mat_old ); @@ -1462,9 +1462,9 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, mesh->mat[i]= mat_new; /* the same material may be used twice */ - for(int j=i+1; j<mesh->totcol; j++) + for (int j=i+1; j<mesh->totcol; j++) { - if(mesh->mat[j]==mat_old) + if (mesh->mat[j]==mat_old) { mesh->mat[j]= mat_new; mat_new->id.us++; diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 04342717555..af7875e0b4f 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -396,7 +396,7 @@ void BL_ConvertActuators(const char* maggiename, settings.reference_distance = soundact->sound3D.reference_distance; settings.rolloff_factor = soundact->sound3D.rolloff_factor; - if(!sound) + if (!sound) { std::cout << "WARNING: Sound actuator \"" << bact->name << "\" from object \"" << blenderobject->id.name+2 << @@ -407,12 +407,12 @@ void BL_ConvertActuators(const char* maggiename, snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle); // if sound shall be 3D but isn't mono, we have to make it mono! - if(is3d) + if (is3d) { try { AUD_Reference<AUD_IReader> reader = snd_sound->createReader(); - if(reader->getSpecs().channels != AUD_CHANNELS_MONO) + if (reader->getSpecs().channels != AUD_CHANNELS_MONO) { AUD_DeviceSpecs specs; specs.channels = AUD_CHANNELS_MONO; diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp index 503876b13c7..81778928c2e 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ b/source/gameengine/Converter/KX_ConvertControllers.cpp @@ -161,7 +161,7 @@ void BL_ConvertControllers( pyctrl->SetNamespace(converter->GetPyNamespace()); - if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { + if (pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { if (pycont->text) { char *buf; @@ -181,7 +181,7 @@ void BL_ConvertControllers( pyctrl->SetScriptText(STR_String(pycont->module)); pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */ - if(pycont->flag & CONT_PY_DEBUG) { + if (pycont->flag & CONT_PY_DEBUG) { printf("\nDebuging \"%s\", module for object %s\n\texpect worse performance.\n", pycont->module, blenderobject->id.name+2); pyctrl->SetDebug(true); } @@ -223,7 +223,7 @@ void BL_ConvertControllers( SCA_PythonController *pyctrl= static_cast<SCA_PythonController*>(gamecontroller); /* not strictly needed but gives syntax errors early on and * gives more predictable performance for larger scripts */ - if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) + if (pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) pyctrl->Compile(); else { /* We cant do this because importing runs the script which could end up accessing diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index 791f99b53c0..81a5f13b8f0 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -142,14 +142,14 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan #ifdef WITH_PYTHON /* Warn if we double up on attributes, this isn't quite right since it wont find inherited attributes however there arnt many */ - for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { - if(strcmp(prop->name, attrdef->m_name)==0) { + for (PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { + if (strcmp(prop->name, attrdef->m_name)==0) { printf("Warning! user defined property name \"%s\" is also a python attribute for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); break; } } - for(PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) { - if(strcmp(prop->name, methdef->ml_name)==0) { + for (PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) { + if (strcmp(prop->name, methdef->ml_name)==0) { printf("Warning! user defined property name \"%s\" is also a python method for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); break; } @@ -176,9 +176,9 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) { CValue* tprop = fontobj->GetProperty("Text"); - if(!tprop) return; + if (!tprop) return; bProperty* prop = get_ob_property(object, "Text"); - if(!prop) return; + if (!prop) return; Curve *curve = static_cast<Curve *>(object->data); STR_String str = curve->str; diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index d0002f3b3e7..309959b4324 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -120,42 +120,42 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("location", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_LOC_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("delta_location", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator(rotmode, i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_ROT_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator(drotmode, i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_DROT_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("scale", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp); ipocontr->AddInterpolator(interpolator); @@ -166,7 +166,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B { KX_ObColorIpoSGController* ipocontr_obcol=NULL; - for(int i=0; i<4; i++) { + for (int i=0; i<4; i++) { if ((interp = adtList->GetScalarInterpolator("color", i))) { if (!ipocontr_obcol) { ipocontr_obcol = new KX_ObColorIpoSGController(); @@ -223,7 +223,7 @@ SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj ipocontr->SetModifyDist(true); } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("color", i))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); ipocontr->AddInterpolator(interpolator); @@ -323,7 +323,7 @@ void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *co KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp); ipocontr->AddInterpolator(interpolator); @@ -379,7 +379,7 @@ static void ConvertMaterialIpos( KX_IScalarInterpolator *sinterp; // -- - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) { if (!ipocontr) { ipocontr = new KX_MaterialIpoController(matname_hash); @@ -401,7 +401,7 @@ static void ConvertMaterialIpos( ipocontr->AddInterpolator(interpolator); } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) { if (!ipocontr) { ipocontr = new KX_MaterialIpoController(matname_hash); @@ -467,7 +467,7 @@ void BL_ConvertMaterialIpos( // if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL // --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor // because this yields a better performance as not all the vertex colors need to be edited - if(mat) ConvertMaterialIpos(mat, 0, gameobj, converter); + if (mat) ConvertMaterialIpos(mat, 0, gameobj, converter); } else { @@ -475,7 +475,7 @@ void BL_ConvertMaterialIpos( { Material *mat = give_current_material(blenderobject, material_index); STR_HashedString matname; - if(mat) { + if (mat) { matname= mat->id.name; // who is using this name? can we remove the MA here? ConvertMaterialIpos(mat, matname.hash(), gameobj, converter); } diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp index 6fe662ac7ed..e3c12c2b966 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp @@ -88,18 +88,18 @@ bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat) // share the same mesh (=the same cache). As the rendering is done per polymaterial // cycling through the objects, the entire mesh cache cannot be updated in one shot. mmat = m_pMeshObject->GetMeshMaterial(polymat); - if(!mmat->m_slots[(void*)m_gameobj]) + if (!mmat->m_slots[(void*)m_gameobj]) return true; slot = *mmat->m_slots[(void*)m_gameobj]; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) { btSoftBody::tNodeArray& nodes(softBody->m_nodes); int index = 0; - for(i=it.startvertex; i<it.endvertex; i++,index++) { + for (i=it.startvertex; i<it.endvertex; i++,index++) { RAS_TexVert& v = it.vertex[i]; btAssert(v.getSoftBodyIndex() >= 0); diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp index e13cb8200b1..c8f757f263c 100644 --- a/source/gameengine/Expressions/InputParser.cpp +++ b/source/gameengine/Expressions/InputParser.cpp @@ -108,7 +108,7 @@ void CParser::TermChar(char c) { // generates an error if the next char isn't the specified char c, // otherwise, skip the char - if(ch == c) + if (ch == c) { NextCh(); } @@ -379,7 +379,7 @@ void CParser::Term(int s) { // generates an error if the next symbol isn't the specified symbol s // otherwise, skip the symbol - if(s == sym) NextSym(); + if (s == sym) NextSym(); else { STR_String msg; msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it"); diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index 20a4bbc0405..2d427440620 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -328,7 +328,7 @@ void CIntValue::SetValue(CValue* newval) #ifdef WITH_PYTHON PyObject* CIntValue::ConvertValueToPython() { - if((m_int > INT_MIN) && (m_int < INT_MAX)) + if ((m_int > INT_MIN) && (m_int < INT_MAX)) return PyLong_FromSsize_t(m_int); else return PyLong_FromLongLong(m_int); diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 2c8cffbef82..f43625a7821 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -329,7 +329,7 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex) CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex)); if (item) { PyObject* pyobj = item->ConvertValueToPython(); - if(pyobj) + if (pyobj) return pyobj; else return item->GetProxy(); @@ -437,7 +437,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other) else if (PyObject_TypeCheck(other, &CListValue::Type)) { // add items from otherlist to this list CListValue* otherval = static_cast<CListValue *>(BGE_PROXY_REF(other)); - if(otherval==NULL) { + if (otherval==NULL) { listval_new->Release(); PyErr_SetString(PyExc_SystemError, "CList+other, "BGE_PROXY_ERROR_MSG); return NULL; diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 65aa3e23dfa..38d622a7d45 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -55,7 +55,7 @@ PyObjectPlus::~PyObjectPlus() { #ifdef WITH_PYTHON - if(m_proxy) { + if (m_proxy) { BGE_PROXY_REF(m_proxy)= NULL; Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */ } @@ -90,7 +90,7 @@ void PyObjectPlus::ProcessReplica() void PyObjectPlus::InvalidateProxy() // check typename of each parent { #ifdef WITH_PYTHON - if(m_proxy) { + if (m_proxy) { BGE_PROXY_REF(m_proxy)=NULL; Py_DECREF(m_proxy); m_proxy= NULL; @@ -137,7 +137,7 @@ PyTypeObject PyObjectPlus::Type = { PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the entry in Type. { PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); return NULL; } @@ -173,13 +173,13 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec while(base_type && !BGE_PROXY_CHECK_TYPE(base_type)) base_type= base_type->tp_base; - if(base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) { + if (base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) { PyErr_SetString(PyExc_TypeError, "can't subclass from a blender game type because the argument given is not a game class or subclass"); return NULL; } /* use base_type rather than Py_TYPE(base) because we could already be subtyped */ - if(!PyType_IsSubtype(type, base_type)) { + if (!PyType_IsSubtype(type, base_type)) { PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name); return NULL; } @@ -228,8 +228,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper if (BGE_PROXY_PYREF(self)) { PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ + if (self_plus) { + if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ self_plus->m_proxy = NULL; /* Need this to stop ~PyObjectPlus from decrefing m_proxy otherwise its decref'd twice and py-debug crashes */ delete self_plus; } @@ -239,8 +239,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper BGE_PROXY_PTR(self)= NULL; // not really needed } else { void *ptr= BGE_PROXY_PTR(self); - if(ptr) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ + if (ptr) { + if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ // generic structure owned by python MUST be created though MEM_alloc MEM_freeN(ptr); } @@ -280,8 +280,8 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * { PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { - if(attrdef == attr_invalid) + if (ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { + if (attrdef == attr_invalid) Py_RETURN_TRUE; // don't bother running the function PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); @@ -512,7 +512,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ref==NULL || !ref->py_is_valid() || ptr==NULL) { + if (ref==NULL || !ref->py_is_valid() || ptr==NULL) { PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); return PY_SET_ATTR_FAIL; } @@ -1150,7 +1150,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v } if (self->m_proxy) { - if(py_owns) + if (py_owns) { /* Free */ BGE_PROXY_REF(self->m_proxy) = NULL; Py_DECREF(self->m_proxy); @@ -1164,7 +1164,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v } GetProxyPlus_Ext(self, tp, ptr); - if(py_owns) { + if (py_owns) { BGE_PROXY_PYOWNS(self->m_proxy) = py_owns; Py_DECREF(self->m_proxy); /* could avoid thrashing here but for now its ok */ } diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index c0952f29d8f..30bc33adddd 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -325,7 +325,7 @@ bool CValue::RemoveProperty(const char *inName) vector<STR_String> CValue::GetPropertyNames() { vector<STR_String> result; - if(!m_pNamedPropertyArray) return result; + if (!m_pNamedPropertyArray) return result; result.reserve(m_pNamedPropertyArray->size()); std::map<STR_String,CValue*>::iterator it; @@ -366,7 +366,7 @@ void CValue::ClearProperties() // void CValue::SetPropertiesModified(bool inModified) { - if(!m_pNamedPropertyArray) return; + if (!m_pNamedPropertyArray) return; std::map<STR_String,CValue*>::iterator it; for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) @@ -380,7 +380,7 @@ void CValue::SetPropertiesModified(bool inModified) // bool CValue::IsAnyPropertyModified() { - if(!m_pNamedPropertyArray) return false; + if (!m_pNamedPropertyArray) return false; std::map<STR_String,CValue*>::iterator it; for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index b22246014bf..38416a340c7 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -51,10 +51,10 @@ SCA_Joystick::SCA_Joystick(short int index) m_istrig_button(0), m_istrig_hat(0) { - for(int i=0; i<JOYAXIS_MAX; i++) + for (int i=0; i<JOYAXIS_MAX; i++) m_axis_array[i]= 0; - for(int i=0; i<JOYHAT_MAX; i++) + for (int i=0; i<JOYHAT_MAX; i++) m_hat_array[i]= 0; #ifdef WITH_SDL @@ -92,9 +92,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) // when GHOST is running under SDL, video is initialized elsewhere. // Do this once only. # ifdef WITH_GHOST_SDL - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){ + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){ # else - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ # endif echo("Error-Initializing-SDL: " << SDL_GetError()); return NULL; @@ -239,7 +239,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) m_axismax = m_buttonmax = m_hatmax = 0; return false; #else /* WITH_SDL */ - if(m_isinit == false){ + if (m_isinit == false){ if (m_joyindex>=m_joynum) { // don't print a message, because this is done anyway //echo("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); @@ -264,9 +264,9 @@ bool SCA_Joystick::CreateJoystickDevice(void) else if (m_axismax < 0) m_axismax = 0; if (m_hatmax > JOYHAT_MAX) m_hatmax= JOYHAT_MAX; /* very unlikely */ - else if(m_hatmax<0) m_hatmax= 0; + else if (m_hatmax<0) m_hatmax= 0; - if(m_buttonmax<0) m_buttonmax= 0; + if (m_buttonmax<0) m_buttonmax= 0; } return true; @@ -278,7 +278,7 @@ void SCA_Joystick::DestroyJoystickDevice(void) { #ifdef WITH_SDL if (m_isinit){ - if(SDL_JoystickOpened(m_joyindex)){ + if (SDL_JoystickOpened(m_joyindex)){ echo("Closing-joystick " << m_joyindex); SDL_JoystickClose(m_private->m_joystick); } diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp index e1ab364ae67..44b6cfd7d35 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp @@ -40,7 +40,7 @@ #ifdef WITH_SDL void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { - if(sdl_event->jaxis.axis >= JOYAXIS_MAX) + if (sdl_event->jaxis.axis >= JOYAXIS_MAX) return; m_axis_array[sdl_event->jaxis.axis]= sdl_event->jaxis.value; @@ -50,7 +50,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) /* See notes below in the event loop */ void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event) { - if(sdl_event->jhat.hat >= JOYHAT_MAX) + if (sdl_event->jhat.hat >= JOYHAT_MAX) return; m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value; @@ -85,7 +85,7 @@ void SCA_Joystick::HandleEvents(void) int i; for (i=0; i<m_joynum; i++) { /* could use JOYINDEX_MAX but no reason to */ - if(SCA_Joystick::m_instance[i]) + if (SCA_Joystick::m_instance[i]) SCA_Joystick::m_instance[i]->OnNothing(&sdl_event); } diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp index 05422edb62c..df585c946eb 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp @@ -55,7 +55,7 @@ SCA_2DFilterActuator::SCA_2DFilterActuator( m_scene(scene) { m_gameobj = NULL; - if(gameobj){ + if (gameobj){ m_propNames = gameobj->GetPropertyNames(); m_gameobj = gameobj; } @@ -79,16 +79,16 @@ bool SCA_2DFilterActuator::Update() if (bNegativeEvent) return false; // do nothing on negative events - if( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR ) + if ( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR ) { - if(!m_disableMotionBlur) + if (!m_disableMotionBlur) m_rasterizer->EnableMotionBlur(m_float_arg); else m_rasterizer->DisableMotionBlur(); return false; } - else if(m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS) + else if (m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS) { m_scene->Update2DFilter(m_propNames, m_gameobj, m_type, m_int_arg, m_shaderText); } diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index 09d81c7f14b..4728729acb0 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -174,7 +174,7 @@ void SCA_ISensor::RegisterToManager() void SCA_ISensor::Replace_EventManager(class SCA_LogicManager* logicmgr) { - if(m_links) { /* true if we're used currently */ + if (m_links) { /* true if we're used currently */ m_eventmgr->RemoveSensor(this); m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType()); @@ -225,7 +225,7 @@ void SCA_ISensor::UnregisterToManager() void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr) { - for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin(); + for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin(); c!=m_linkedcontrollers.end();++c) { SCA_IController* contr = *c; @@ -305,7 +305,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) { // This level sensor is connected to at least one controller that was just made // active but it did not generate an event yet, do it now to those controllers only - for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin(); + for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin(); c!=m_linkedcontrollers.end();++c) { SCA_IController* contr = *c; diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index 2942384055b..c21db794e42 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -52,7 +52,7 @@ SCA_JoystickManager::~SCA_JoystickManager() { int i; for (i=0; i<JOYINDEX_MAX; i++) { - if(m_joystick[i]) + if (m_joystick[i]) m_joystick[i]->ReleaseInstance(); } } @@ -72,7 +72,7 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) for (it.begin();!it.end();++it) { SCA_JoystickSensor* joysensor = *it; - if(!joysensor->IsSuspended()) + if (!joysensor->IsSuspended()) { joysensor->Activate(m_logicmgr); } diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 3f74b4cd807..2b47b6fb3c2 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -109,7 +109,7 @@ bool SCA_JoystickSensor::Evaluate() bool result = false; bool reset = m_reset && m_level; - if(js==NULL) /* no joystick - don't do anything */ + if (js==NULL) /* no joystick - don't do anything */ return false; m_reset = false; @@ -134,22 +134,22 @@ bool SCA_JoystickSensor::Evaluate() js->cSetPrecision(m_precision); if (m_bAllEvents) { - if(js->aAxisPairIsPositive(m_axis-1)){ /* use zero based axis index internally */ + if (js->aAxisPairIsPositive(m_axis-1)){ /* use zero based axis index internally */ m_istrig = 1; result = true; }else{ - if(m_istrig){ + if (m_istrig){ m_istrig = 0; result = true; } } } else { - if(js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)){ /* use zero based axis index internally */ + if (js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)){ /* use zero based axis index internally */ m_istrig = 1; result = true; }else{ - if(m_istrig){ + if (m_istrig){ m_istrig = 0; result = true; } @@ -165,11 +165,11 @@ bool SCA_JoystickSensor::Evaluate() /* No need for 'm_bAllEvents' check here since were only checking 1 axis */ js->cSetPrecision(m_precision); - if(js->aAxisIsPositive(m_axis-1)){ /* use zero based axis index internally */ + if (js->aAxisIsPositive(m_axis-1)){ /* use zero based axis index internally */ m_istrig = 1; result = true; }else{ - if(m_istrig){ + if (m_istrig){ m_istrig = 0; result = true; } @@ -185,11 +185,11 @@ bool SCA_JoystickSensor::Evaluate() if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */ return false; - if(( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) { + if (( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) { m_istrig = 1; result = true; }else { - if(m_istrig){ + if (m_istrig){ m_istrig = 0; result = true; } @@ -206,11 +206,11 @@ bool SCA_JoystickSensor::Evaluate() if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */ return false; - if((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) { + if ((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) { m_istrig = 1; result = true; }else{ - if(m_istrig){ + if (m_istrig){ m_istrig = 0; result = true; } @@ -310,7 +310,7 @@ PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) PyObject *value; int i; - if(joy) { + if (joy) { for (i=0; i < joy->GetNumberOfButtons(); i++) { if (joy->aButtonPressIsPositive(i)) { value = PyLong_FromSsize_t(i); @@ -331,10 +331,10 @@ PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); int index; - if(!PyArg_ParseTuple(args, "i:getButtonStatus", &index)){ + if (!PyArg_ParseTuple(args, "i:getButtonStatus", &index)){ return NULL; } - if(joy && index >= 0 && index < joy->GetNumberOfButtons()) { + if (joy && index >= 0 && index < joy->GetNumberOfButtons()) { return PyBool_FromLong(joy->aButtonPressIsPositive(index) ? 1 : 0); } return PyBool_FromLong(0); @@ -360,7 +360,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v); SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - if(self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { + if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); return NULL; } diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp index c5346c16fc9..6543d16d469 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.cpp +++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp @@ -189,11 +189,11 @@ void SCA_LogicManager::BeginFrame(double curtime, double fixedtime) for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++) (*ie)->NextFrame(curtime, fixedtime); - for(SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove(); + for (SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove(); obj != NULL; obj = (SG_QList*)m_triggeredControllerSet.Remove()) { - for(SCA_IController* contr = (SCA_IController*)obj->QRemove(); + for (SCA_IController* contr = (SCA_IController*)obj->QRemove(); contr != NULL; contr = (SCA_IController*)obj->QRemove()) { diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index 8e324bbb0d7..d0d940a2e42 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -198,10 +198,10 @@ bool SCA_PropertySensor::CheckPropertyCondition() /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000" * this could be made into a generic Value class function for comparing values with a string. */ - if(result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) { + if (result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) { float f; - if(EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f)) + if (EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f)) { //error } diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 67c813acdc0..6f1e6e31507 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -182,7 +182,7 @@ int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor) /* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self) { - if(m_sCurrentController==NULL) + if (m_sCurrentController==NULL) { PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt."); return NULL; @@ -200,16 +200,16 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) if (PyUnicode_Check(value)) { /* get the actuator from the name */ const char *name= _PyUnicode_AsString(value); - for(it = lacts.begin(); it!= lacts.end(); ++it) { - if( name == (*it)->GetName() ) { + for (it = lacts.begin(); it!= lacts.end(); ++it) { + if ( name == (*it)->GetName() ) { return *it; } } } else if (PyObject_TypeCheck(value, &SCA_IActuator::Type)) { PyObjectPlus *value_plus= BGE_PROXY_REF(value); - for(it = lacts.begin(); it!= lacts.end(); ++it) { - if( static_cast<SCA_IActuator*>(value_plus) == (*it) ) { + for (it = lacts.begin(); it!= lacts.end(); ++it) { + if ( static_cast<SCA_IActuator*>(value_plus) == (*it) ) { return *it; } } @@ -308,7 +308,7 @@ bool SCA_PythonController::Import() function_string= strrchr(mod_path, '.'); - if(function_string == NULL) { + if (function_string == NULL) { printf("Python module name formatting error in object '%s', controller '%s':\n\texpected 'SomeModule.Func', got '%s'\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr()); return false; } @@ -324,7 +324,7 @@ bool SCA_PythonController::Import() return false; } - if(m_debug) + if (m_debug) mod = PyImport_ReloadModule(mod); if (mod == NULL) { @@ -338,15 +338,15 @@ bool SCA_PythonController::Import() // DECREF the module as we don't need it anymore Py_DECREF(mod); - if(m_function==NULL) { - if(PyErr_Occurred()) + if (m_function==NULL) { + if (PyErr_Occurred()) ErrorPrint("Python controller found the module but could not access the function"); else printf("Python module error in object '%s', controller '%s':\n '%s' module found but function missing\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr()); return false; } - if(!PyCallable_Check(m_function)) { + if (!PyCallable_Check(m_function)) { Py_DECREF(m_function); m_function = NULL; printf("Python module function error in object '%s', controller '%s':\n '%s' not callable\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr()); @@ -358,7 +358,7 @@ bool SCA_PythonController::Import() m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount; } - if(m_function_argc > 1) { + if (m_function_argc > 1) { Py_DECREF(m_function); m_function = NULL; printf("Python module function in object '%s', controller '%s':\n '%s' takes %d args, should be zero or 1 controller arg\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr(), m_function_argc); @@ -421,7 +421,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) PyObject *args= NULL; - if(m_function_argc==1) { + if (m_function_argc==1) { args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, GetProxy()); } @@ -441,7 +441,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) else ErrorPrint("Python script error"); - if(excdict) /* Only for SCA_PYEXEC_SCRIPT types */ + if (excdict) /* Only for SCA_PYEXEC_SCRIPT types */ { /* clear after PyErrPrint - seems it can be using * something in this dictionary and crash? */ @@ -456,13 +456,13 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) PyObject* SCA_PythonController::PyActivate(PyObject *value) { - if(m_sCurrentController != this) { + if (m_sCurrentController != this) { PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller"); return NULL; } SCA_IActuator* actu = LinkedActuatorFromPy(value); - if(actu==NULL) + if (actu==NULL) return NULL; m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, true); @@ -471,13 +471,13 @@ PyObject* SCA_PythonController::PyActivate(PyObject *value) PyObject* SCA_PythonController::PyDeActivate(PyObject *value) { - if(m_sCurrentController != this) { + if (m_sCurrentController != this) { PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller"); return NULL; } SCA_IActuator* actu = LinkedActuatorFromPy(value); - if(actu==NULL) + if (actu==NULL) return NULL; m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, false); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 0034b5b3f54..40dba3bf03a 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -392,7 +392,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst, "\tSet this generator to produce a constant boolean value.\n") { int paraArg; - if(!PyArg_ParseTuple(args, "i:setBoolConst", ¶Arg)) { + if (!PyArg_ParseTuple(args, "i:setBoolConst", ¶Arg)) { return NULL; } @@ -418,7 +418,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli, "\tReturn false value * 100%% of the time.\n") { float paraArg; - if(!PyArg_ParseTuple(args, "f:setBoolBernouilli", ¶Arg)) { + if (!PyArg_ParseTuple(args, "f:setBoolBernouilli", ¶Arg)) { return NULL; } @@ -434,7 +434,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntConst, "\tAlways return value\n") { int paraArg; - if(!PyArg_ParseTuple(args, "i:setIntConst", ¶Arg)) { + if (!PyArg_ParseTuple(args, "i:setIntConst", ¶Arg)) { return NULL; } @@ -452,7 +452,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntUniform, "\tupper_bound. The boundaries are included.\n") { int paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ii:setIntUniform", ¶Arg1, ¶Arg2)) { + if (!PyArg_ParseTuple(args, "ii:setIntUniform", ¶Arg1, ¶Arg2)) { return NULL; } @@ -471,7 +471,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntPoisson, "\tnumber of tries needed to achieve succes.\n") { float paraArg; - if(!PyArg_ParseTuple(args, "f:setIntPoisson", ¶Arg)) { + if (!PyArg_ParseTuple(args, "f:setIntPoisson", ¶Arg)) { return NULL; } @@ -487,7 +487,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatConst, "\tAlways return value\n") { float paraArg; - if(!PyArg_ParseTuple(args, "f:setFloatConst", ¶Arg)) { + if (!PyArg_ParseTuple(args, "f:setFloatConst", ¶Arg)) { return NULL; } @@ -505,7 +505,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatUniform, "\tupper_bound.\n") { float paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ff:setFloatUniform", ¶Arg1, ¶Arg2)) { + if (!PyArg_ParseTuple(args, "ff:setFloatUniform", ¶Arg1, ¶Arg2)) { return NULL; } @@ -524,7 +524,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal, "\tdeviation from the mean is characterized by standard_deviation.\n") { float paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ff:setFloatNormal", ¶Arg1, ¶Arg2)) { + if (!PyArg_ParseTuple(args, "ff:setFloatNormal", ¶Arg1, ¶Arg2)) { return NULL; } @@ -542,7 +542,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential, "\tis characterized by half_life.\n") { float paraArg; - if(!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", ¶Arg)) { + if (!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", ¶Arg)) { return NULL; } diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp index 0915326c8eb..db40f35f888 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp @@ -205,7 +205,7 @@ void GPC_Canvas::DisposeBanner(TBannerData& banner) void GPC_Canvas::DrawAllBanners(void) { - if(!m_bannersEnabled || (m_banners.size() < 1)) + if (!m_bannersEnabled || (m_banners.size() < 1)) return; // Save the old rendering parameters. @@ -239,7 +239,7 @@ void GPC_Canvas::DrawAllBanners(void) void GPC_Canvas::DrawBanner(TBannerData& banner) { - if(!banner.enabled) + if (!banner.enabled) return; // Set up coordinates diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp index 6eb52413a4e..11d648762c8 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Engine.cpp @@ -78,7 +78,7 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL, m_frameRate(frameRate), m_BlenderLogo(0), m_Blender3DLogo(0)/*, m_NaNLogo(0)*/ { - if(customLoadingAnimationURL[0] != '\0') + if (customLoadingAnimationURL[0] != '\0') { m_customLoadingAnimationURL = new char[sizeof(customLoadingAnimationURL)]; // not yet, need to be implemented first... m_customLoadingAnimation = true; @@ -87,13 +87,13 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL, // load the Blender logo into memory m_BlenderLogo = new GPC_RawImage(); // blender3d size is 115 x 32 so make resulting texture 128 x 128 - if(!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8)) + if (!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8)) m_BlenderLogo = 0; // load the Blender3D logo into memory m_Blender3DLogo = new GPC_RawImage(); // blender3d size is 136 x 11 so make resulting texture 256 x 256 - if(!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8)) + if (!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8)) m_Blender3DLogo = 0; #if 0 @@ -101,7 +101,7 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL, // load the NaN logo into memory m_NaNLogo = new GPC_RawImage(); // blender3d size is 32 x 31 so make resulting texture 64 x 64 - if(!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8)) + if (!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8)) m_NaNLogo = 0; #endif } @@ -148,7 +148,7 @@ bool GPC_Engine::Start(const char *filename) StartKetsji(); - if(bfd->type == BLENFILETYPE_PUB) + if (bfd->type == BLENFILETYPE_PUB) m_canvas->SetBannerDisplayEnabled(false); return true; @@ -173,7 +173,7 @@ bool GPC_Engine::Start(unsigned char *blenderDataBuffer, StartKetsji(); - if(bfd->type == BLENFILETYPE_PUB) + if (bfd->type == BLENFILETYPE_PUB) m_canvas->SetBannerDisplayEnabled(false); return true; @@ -210,7 +210,7 @@ bool GPC_Engine::StartKetsji(void) void GPC_Engine::StartLoadingAnimation() { - if(m_customLoadingAnimation) + if (m_customLoadingAnimation) { } else @@ -218,7 +218,7 @@ void GPC_Engine::StartLoadingAnimation() unsigned char *blenderDataBuffer; int blenderDataBufferSize; GetRawLoadingAnimation(&blenderDataBuffer, &blenderDataBufferSize); - if(!Start(blenderDataBuffer, blenderDataBufferSize)) + if (!Start(blenderDataBuffer, blenderDataBufferSize)) cout << "something went wrong when starting the engine" << endl; delete blenderDataBuffer; // created with 'new' in GetRawLoadingAnimation() } @@ -251,11 +251,11 @@ void GPC_Engine::UpdateLoadingAnimation(void) float progress = DetermineProgress(); - if(progress > m_previousProgress) + if (progress > m_previousProgress) { // delta = progress - m_previousProgress; m_previousProgress = progress; - if(m_previousProgress > 1.0) + if (m_previousProgress > 1.0) m_previousProgress = 1.0; // limit to 1.0 (has to change !) // m_engine->m_previousProgress = 0.0; } @@ -266,7 +266,7 @@ void GPC_Engine::UpdateLoadingAnimation(void) STR_String body; body.Format("%f", progress); // a number between 0.0 and 1.0 - if(m_networkdev) + if (m_networkdev) { // Store a progress message in the network device. NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, body); @@ -279,19 +279,19 @@ void GPC_Engine::UpdateLoadingAnimation(void) void GPC_Engine::Stop() { // only delete things that are created in StartKetsji() -/* if(m_portal) +/* if (m_portal) { m_portal->Leave(); delete m_portal; // also gets rid of KX_KetsjiEngine (says Maarten) m_portal = 0; } -*/ if(m_sceneconverter) +*/ if (m_sceneconverter) { delete m_sceneconverter; m_sceneconverter = 0; } #if 0 - if(m_frameTimerID) + if (m_frameTimerID) { ::KillTimer(0, m_frameTimerID); m_frameTimerID = 0; @@ -305,7 +305,7 @@ void GPC_Engine::Stop() void GPC_Engine::Exit() { - if(m_running) + if (m_running) Stop(); if (m_system) { diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp index 5bd3a1957e6..9f129c1cdfb 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp @@ -50,26 +50,26 @@ bool GPC_RawImage::Load( { int srcWidth, srcHeight; bool success = true; - if(strcmp(srcName, "BlenderLogo") == 0) + if (strcmp(srcName, "BlenderLogo") == 0) GetRawBlenderLogo(&m_data, &srcWidth, &srcHeight); else - if(strcmp(srcName, "Blender3DLogo") == 0) + if (strcmp(srcName, "Blender3DLogo") == 0) GetRawBlender3DLogo(&m_data, &srcWidth, &srcHeight); #if 0 else - if(strcmp(srcName, "NaNLogo") == 0) + if (strcmp(srcName, "NaNLogo") == 0) GetRawNaNLogo(&m_data, &srcWidth, &srcHeight); #endif else // unknown image success = false; - if(success) + if (success) { unsigned char *tempData = m_data; int numBytes = destWidth * destHeight * 4; m_data = new unsigned char[numBytes]; // re-use m_data ('unsigned char' was 'char') - if(m_data) + if (m_data) { ::memset(m_data, 0x00000000, numBytes); m_width = destWidth; @@ -80,11 +80,11 @@ bool GPC_RawImage::Load( int numRows = (srcHeight + offsetY) < m_height ? srcHeight : m_height - offsetY; numBytes = (srcWidth + offsetX) < m_width ? srcBytesWidth : (m_width - offsetX) * 4; - if((offsetX < m_width) && (offsetY < m_height)) + if ((offsetX < m_width) && (offsetY < m_height)) { unsigned char* src = (unsigned char*)tempData; unsigned char* dst = (unsigned char*)m_data; - if(alignment == alignTopLeft) + if (alignment == alignTopLeft) { // Put original in upper left corner diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp index 16f984cbe3c..adf0bcd8e57 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp @@ -9299,7 +9299,7 @@ void GetRawLoadingAnimation(unsigned char **data, int *dataSize) *data = new unsigned char[138801]; // and copy it. Now we are certain that the calling function // can control the memory location - for(int i = 0; i < 138801 /* tmp array size */; i++) + for (int i = 0; i < 138801 /* tmp array size */; i++) { (*data)[i] = load_blend[i]; } diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp index 52a033ce538..2471b528eac 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp @@ -1029,7 +1029,7 @@ void GetRawBlenderLogo(unsigned char **data, int *width, int *height) *data = new unsigned char[14720]; // and copy it. Now we are certain that the calling function // can control the memory location - for(int i = 0; i < 14720 /* tmp array size */; i++) + for (int i = 0; i < 14720 /* tmp array size */; i++) { (*data)[i] = logo_blender_raw[i]; } @@ -1449,7 +1449,7 @@ void GetRawBlender3DLogo(unsigned char **data, int *width, int *height) *data = new unsigned char[5984]; // and copy it. Now we are certain that the calling function // can control the memory location - for(int i = 0; i < 5984 /* tmp array size */; i++) + for (int i = 0; i < 5984 /* tmp array size */; i++) { (*data)[i] = logo_blender3d_raw[i]; } diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 54e2efd8776..ed2fa8a7dc6 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -101,23 +101,23 @@ void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, co int layer= -1; /* find the layer */ - if(uselights) { - if(m_clientobject) + if (uselights) { + if (m_clientobject) layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer(); } /* avoid state switching */ - if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) + if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) return; m_lastlightlayer = layer; m_lastauxinfo = m_auxilaryClientInfo; /* enable/disable lights as needed */ - if(layer >= 0) + if (layer >= 0) enable = applyLights(layer, viewmat); - if(enable) + if (enable) EnableOpenGLLights(rasty); else DisableOpenGLLights(); @@ -125,7 +125,7 @@ void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, co void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) { - if(m_lastlighting == true) + if (m_lastlighting == true) return; glEnable(GL_LIGHTING); @@ -142,7 +142,7 @@ void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) void GPC_RenderTools::DisableOpenGLLights() { - if(m_lastlighting == false) + if (m_lastlighting == false) return; glDisable(GL_LIGHTING); @@ -291,26 +291,26 @@ void GPC_RenderTools::RenderText3D( int fontid, double* mat, float aspect) { - if(GLEW_ARB_multitexture) { - for(int i=0; i<MAXTEX; i++) { + if (GLEW_ARB_multitexture) { + for (int i=0; i<MAXTEX; i++) { glActiveTextureARB(GL_TEXTURE0_ARB+i); - if(GLEW_ARB_texture_cube_map) - if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + if (GLEW_ARB_texture_cube_map) + if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) glDisable(GL_TEXTURE_CUBE_MAP_ARB); - if(glIsEnabled(GL_TEXTURE_2D)) + if (glIsEnabled(GL_TEXTURE_2D)) glDisable(GL_TEXTURE_2D); } glActiveTextureARB(GL_TEXTURE0_ARB); } else { - if(GLEW_ARB_texture_cube_map) - if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + if (GLEW_ARB_texture_cube_map) + if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) glDisable(GL_TEXTURE_CUBE_MAP_ARB); - if(glIsEnabled(GL_TEXTURE_2D)) + if (glIsEnabled(GL_TEXTURE_2D)) glDisable(GL_TEXTURE_2D); } @@ -415,7 +415,7 @@ void GPC_RenderTools::RenderText( struct MTFace* tface = 0; unsigned int *col = 0; - if(flag & RAS_BLENDERMAT) { + if (flag & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat); tface = bl_mat->GetMTFace(); col = bl_mat->GetMCol(); @@ -448,7 +448,7 @@ int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat) unsigned int count; std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin(); - for(count=0; count<m_numgllights; count++) + for (count=0; count<m_numgllights; count++) glDisable((GLenum)(GL_LIGHT0+count)); viewmat.getValue(glviewmat); @@ -460,7 +460,7 @@ int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat) RAS_LightObject* lightdata = (*lit); KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light; - if(kxlight->ApplyLight(kxscene, objectlayer, count)) + if (kxlight->ApplyLight(kxscene, objectlayer, count)) count++; } glPopMatrix(); @@ -472,16 +472,16 @@ void GPC_RenderTools::MotionBlur(RAS_IRasterizer* rasterizer) { int state = rasterizer->GetMotionBlurState(); float motionblurvalue; - if(state) + if (state) { motionblurvalue = rasterizer->GetMotionBlurValue(); - if(state==1) + if (state==1) { //bugfix:load color buffer into accum buffer for the first time(state=1) glAccum(GL_LOAD, 1.0); rasterizer->SetMotionBlurState(2); } - else if(motionblurvalue>=0.0 && motionblurvalue<=1.0) + else if (motionblurvalue>=0.0 && motionblurvalue<=1.0) { glAccum(GL_MULT, motionblurvalue); glAccum(GL_ACCUM, 1-motionblurvalue); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f7c366599ef..eccb83fe80c 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -138,7 +138,7 @@ GPG_Application::GPG_Application(GHOST_ISystem* system) GPG_Application::~GPG_Application(void) { - if(m_pyGlobalDictString) { + if (m_pyGlobalDictString) { delete [] m_pyGlobalDictString; m_pyGlobalDictString = 0; m_pyGlobalDictString_Length = 0; @@ -558,12 +558,12 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); bool restrictAnimFPS = gm->flag & GAME_RESTRICT_ANIM_UPDATES; - if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) + if (GLEW_ARB_multitexture && GLEW_VERSION_1_1) m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0); - if(GPU_glsl_support()) + if (GPU_glsl_support()) m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0); - else if(m_globalSettings->matmode == GAME_MAT_GLSL) + else if (m_globalSettings->matmode == GAME_MAT_GLSL) m_blendermat = false; // create the canvas, rasterizer and rendertools @@ -579,8 +579,8 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if (!m_rendertools) goto initFailed; - if(useLists) { - if(GLEW_VERSION_1_1) + if (useLists) { + if (GLEW_VERSION_1_1) m_rasterizer = new RAS_ListRasterizer(m_canvas, true); else m_rasterizer = new RAS_ListRasterizer(m_canvas); @@ -701,9 +701,9 @@ bool GPG_Application::startEngine(void) // if (always_use_expand_framing) // sceneconverter->SetAlwaysUseExpandFraming(true); - if(m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE)) + if (m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE)) m_sceneconverter->SetMaterials(true); - if(m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL)) + if (m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL)) m_sceneconverter->SetGLSLMaterials(true); KX_Scene* startscene = new KX_Scene(m_keyboard, @@ -720,7 +720,7 @@ bool GPG_Application::startEngine(void) #endif // WITH_PYTHON //initialize Dome Settings - if(m_startScene->gm.stereoflag == STEREO_DOME) + if (m_startScene->gm.stereoflag == STEREO_DOME) m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext); #ifdef WITH_PYTHON @@ -764,7 +764,7 @@ void GPG_Application::stopEngine() // GameLogic.globalDict gets converted into a buffer, and sorted in // m_pyGlobalDictString so we can restore after python has stopped // and started between .blend file loads. - if(m_pyGlobalDictString) { + if (m_pyGlobalDictString) { delete [] m_pyGlobalDictString; m_pyGlobalDictString = 0; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 36c38682244..d477c87936f 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -297,7 +297,7 @@ static void get_filename(int argc, char **argv, char *filename) #else filename[0] = '\0'; - if(argc > 1) + if (argc > 1) BLI_strncpy(filename, argv[argc-1], FILE_MAX); #endif // !_APPLE } @@ -606,29 +606,29 @@ int main(int argc, char** argv) if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO) stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - if(!strcmp(argv[i], "nostereo")) // ok, redundant but clear + if (!strcmp(argv[i], "nostereo")) // ok, redundant but clear stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; // only the hardware pageflip method needs a stereo window - else if(!strcmp(argv[i], "hwpageflip")) { + else if (!strcmp(argv[i], "hwpageflip")) { stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED; stereoWindow = true; } - else if(!strcmp(argv[i], "syncdoubling")) + else if (!strcmp(argv[i], "syncdoubling")) stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; - else if(!strcmp(argv[i], "anaglyph")) + else if (!strcmp(argv[i], "anaglyph")) stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; - else if(!strcmp(argv[i], "sidebyside")) + else if (!strcmp(argv[i], "sidebyside")) stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; - else if(!strcmp(argv[i], "vinterlace")) + else if (!strcmp(argv[i], "vinterlace")) stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE; #if 0 // future stuff - else if(!strcmp(argv[i], "stencil") + else if (!strcmp(argv[i], "stencil") stereomode = RAS_STEREO_STENCIL; #endif @@ -648,33 +648,33 @@ int main(int argc, char** argv) i++; if ((i + 1) <= validArguments) { - if(!strcmp(argv[i], "angle")){ + if (!strcmp(argv[i], "angle")){ i++; domeFov = atoi(argv[i++]); } - if(!strcmp(argv[i], "tilt")){ + if (!strcmp(argv[i], "tilt")){ i++; domeTilt = atoi(argv[i++]); } - if(!strcmp(argv[i], "warpdata")){ + if (!strcmp(argv[i], "warpdata")){ i++; domeWarp = argv[i++]; } - if(!strcmp(argv[i], "mode")){ + if (!strcmp(argv[i], "mode")){ i++; - if(!strcmp(argv[i], "fisheye")) + if (!strcmp(argv[i], "fisheye")) domeMode = DOME_FISHEYE; - else if(!strcmp(argv[i], "truncatedfront")) + else if (!strcmp(argv[i], "truncatedfront")) domeMode = DOME_TRUNCATED_FRONT; - else if(!strcmp(argv[i], "truncatedrear")) + else if (!strcmp(argv[i], "truncatedrear")) domeMode = DOME_TRUNCATED_REAR; - else if(!strcmp(argv[i], "cubemap")) + else if (!strcmp(argv[i], "cubemap")) domeMode = DOME_ENVMAP; - else if(!strcmp(argv[i], "sphericalpanoramic")) + else if (!strcmp(argv[i], "sphericalpanoramic")) domeMode = DOME_PANORAM_SPH; else @@ -749,7 +749,7 @@ int main(int argc, char** argv) char *titlename; get_filename(argc_py_clamped, argv, filename); - if(filename[0]) + if (filename[0]) BLI_path_cwd(filename); @@ -846,7 +846,7 @@ int main(int argc, char** argv) // Check whether the game should be displayed in stereo if (!stereoParFound) { - if(scene->gm.stereoflag == STEREO_ENABLED){ + if (scene->gm.stereoflag == STEREO_ENABLED){ stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode; if (stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) stereoWindow = true; @@ -871,7 +871,7 @@ int main(int argc, char** argv) { //XXX to do: convert relative to absolute path domeText= add_text(domeWarp, ""); - if(!domeText) + if (!domeText) printf("error: invalid warpdata text file - %s\n", domeWarp); else scene->gm.dome.warptext = domeText; @@ -881,7 +881,7 @@ int main(int argc, char** argv) // GPG_Application app (system, maggie, startscenename); app.SetGameEngineData(maggie, scene, &gs, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - if(G.main != maggie) { + if (G.main != maggie) { BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); } #ifdef WITH_PYTHON @@ -1014,7 +1014,7 @@ int main(int argc, char** argv) SYS_DeleteSystem(syshandle); int totblock= MEM_get_memory_blocks_in_use(); - if(totblock!=0) { + if (totblock!=0) { printf("Error Totblock: %d\n",totblock); MEM_set_error_callback(mem_error_cb); MEM_printmemlist(); diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp index 0f97898c73f..122d692b599 100644 --- a/source/gameengine/Ketsji/BL_BlenderShader.cpp +++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp @@ -35,7 +35,7 @@ BL_BlenderShader::BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lig BL_BlenderShader::~BL_BlenderShader() { - if(mGPUMat) + if (mGPUMat) GPU_material_unbind(mGPUMat); } @@ -46,8 +46,8 @@ void BL_BlenderShader::ReloadMaterial() void BL_BlenderShader::SetProg(bool enable, double time) { - if(VerifyShader()) { - if(enable) + if (VerifyShader()) { + if (enable) GPU_material_bind(mGPUMat, mLightLayer, mBlenderScene->lay, time, 1); else GPU_material_unbind(mGPUMat); @@ -59,16 +59,16 @@ int BL_BlenderShader::GetAttribNum() GPUVertexAttribs attribs; int i, enabled = 0; - if(!VerifyShader()) + if (!VerifyShader()) return enabled; GPU_material_vertex_attributes(mGPUMat, &attribs); - for(i = 0; i < attribs.totlayer; i++) - if(attribs.layer[i].glindex+1 > enabled) + for (i = 0; i < attribs.totlayer; i++) + if (attribs.layer[i].glindex+1 > enabled) enabled= attribs.layer[i].glindex+1; - if(enabled > BL_MAX_ATTRIB) + if (enabled > BL_MAX_ATTRIB) enabled = BL_MAX_ATTRIB; return enabled; @@ -82,39 +82,39 @@ void BL_BlenderShader::SetAttribs(RAS_IRasterizer* ras, const BL_Material *mat) ras->SetAttribNum(0); - if(!VerifyShader()) + if (!VerifyShader()) return; gpumat = mGPUMat; - if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { + if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { GPU_material_vertex_attributes(gpumat, &attribs); attrib_num = GetAttribNum(); ras->SetTexCoordNum(0); ras->SetAttribNum(attrib_num); - for(i=0; i<attrib_num; i++) + for (i=0; i<attrib_num; i++) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, i); - for(i = 0; i < attribs.totlayer; i++) { - if(attribs.layer[i].glindex > attrib_num) + for (i = 0; i < attribs.totlayer; i++) { + if (attribs.layer[i].glindex > attrib_num) continue; - if(attribs.layer[i].type == CD_MTFACE) { - if(!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0) + if (attribs.layer[i].type == CD_MTFACE) { + if (!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex); - else if(!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0) + else if (!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV2, attribs.layer[i].glindex); else ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex); } - else if(attribs.layer[i].type == CD_TANGENT) + else if (attribs.layer[i].type == CD_TANGENT) ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_ORCO) + else if (attribs.layer[i].type == CD_ORCO) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_ORCO, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_NORMAL) + else if (attribs.layer[i].type == CD_NORMAL) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_NORM, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_MCOL) + else if (attribs.layer[i].type == CD_MCOL) ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_VCOL, attribs.layer[i].glindex); else ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, attribs.layer[i].glindex); @@ -129,7 +129,7 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) gpumat = mGPUMat; - if(!gpumat || !GPU_material_bound(gpumat)) + if (!gpumat || !GPU_material_bound(gpumat)) return; MT_Matrix4x4 model; @@ -142,7 +142,7 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) view.getValue((float*)viewmat); viewinv.getValue((float*)viewinvmat); - if(ms.m_bObjectColor) + if (ms.m_bObjectColor) ms.m_RGBAcolor.getValue((float*)obcol); else obcol[0]= obcol[1]= obcol[2]= obcol[3]= 1.0f; diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp index 092f9273a6b..2061a763331 100644 --- a/source/gameengine/Ketsji/BL_Material.cpp +++ b/source/gameengine/Ketsji/BL_Material.cpp @@ -12,9 +12,9 @@ MTex* getImageFromMaterial(Material *mat, int index) { - if(!mat) return 0; + if (!mat) return 0; - if(!(index >=0 && index < MAX_MTEX) ) return 0; + if (!(index >=0 && index < MAX_MTEX) ) return 0; MTex *m = mat->mtex[index]; return m?m:0; @@ -23,9 +23,9 @@ MTex* getImageFromMaterial(Material *mat, int index) int getNumTexChannels( Material *mat ) { int count = -1; - if(!mat) return -1; + if (!mat) return -1; - for(count =0; (count < 10) && mat->mtex[count] != 0; count++) {} + for (count =0; (count < 10) && mat->mtex[count] != 0; count++) {} return count; } @@ -66,13 +66,13 @@ void BL_Material::Initialize() share = false; int i; - for(i=0; i<4; i++) + for (i=0; i<4; i++) { uv[i] = MT_Point2(0.f,1.f); uv2[i] = MT_Point2(0.f, 1.f); } - for(i=0; i<MAXTEX; i++) // :( + for (i=0; i<MAXTEX; i++) // :( { mapping[i].mapping = 0; mapping[i].offsets[0] = 0.f; @@ -150,7 +150,7 @@ void BL_Material::GetConversionUV2(MT_Point2 *nuv) void BL_Material::SetSharedMaterial(bool v) { - if((v && num_users == -1) || num_users > 1 ) + if ((v && num_users == -1) || num_users > 1 ) share = true; else share = false; diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index b1e3737af07..55045f9f169 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -40,7 +40,7 @@ BL_Uniform::BL_Uniform(int data_size) BL_Uniform::~BL_Uniform() { #ifdef SORT_UNIFORMS - if(mData) { + if (mData) { MEM_freeN(mData); mData=0; } @@ -52,7 +52,7 @@ void BL_Uniform::Apply(class BL_Shader *shader) #ifdef SORT_UNIFORMS MT_assert(mType > UNI_NONE && mType < UNI_MAX && mData); - if(!mDirty) + if (!mDirty) return; switch(mType) @@ -137,14 +137,14 @@ BL_Shader::BL_Shader() BL_Shader::~BL_Shader() { //for (int i=0; i<MAXTEX; i++){ - // if(mSampler[i].mOwn) { - // if(mSampler[i].mTexture) + // if (mSampler[i].mOwn) { + // if (mSampler[i].mTexture) // mSampler[i].mTexture->DeleteTex(); // } //} ClearUniforms(); - if( mShader ) { + if ( mShader ) { glDeleteObjectARB(mShader); mShader = 0; } @@ -179,7 +179,7 @@ BL_Uniform *BL_Shader::FindUniform(const int location) #ifdef SORT_UNIFORMS BL_UniformVec::iterator it = mUniforms.begin(); while(it != mUniforms.end()) { - if((*it)->GetLocation() == location) + if ((*it)->GetLocation() == location) return (*it); it++; } @@ -191,7 +191,7 @@ void BL_Shader::SetUniformfv(int location, int type, float *param,int size, bool { #ifdef SORT_UNIFORMS BL_Uniform *uni= FindUniform(location); - if(uni) { + if (uni) { memcpy(uni->getData(), param, size); uni->SetData(location, type, transpose); } @@ -210,7 +210,7 @@ void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool t { #ifdef SORT_UNIFORMS BL_Uniform *uni= FindUniform(location); - if(uni) { + if (uni) { memcpy(uni->getData(), param, size); uni->SetData(location, type, transpose); } @@ -228,10 +228,10 @@ void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool t void BL_Shader::ApplyShader() { #ifdef SORT_UNIFORMS - if(!mDirty) + if (!mDirty) return; - for(unsigned int i=0; i<mUniforms.size(); i++) + for (unsigned int i=0; i<mUniforms.size(); i++) mUniforms[i]->Apply(this); mDirty = false; @@ -252,18 +252,18 @@ bool BL_Shader::LinkProgram() int char_len=0; char *logInf =0; - if(mError) + if (mError) goto programError; - if(!vertProg || !fragProg){ + if (!vertProg || !fragProg){ spit("Invalid GLSL sources"); return false; } - if( !GLEW_ARB_fragment_shader) { + if ( !GLEW_ARB_fragment_shader) { spit("Fragment shaders not supported"); return false; } - if( !GLEW_ARB_vertex_shader) { + if ( !GLEW_ARB_vertex_shader) { spit("Vertex shaders not supported"); return false; } @@ -275,10 +275,10 @@ bool BL_Shader::LinkProgram() glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB,(GLint*) &vertlen); // print info if any - if( vertlen > 0 && vertlen < MAX_LOG_LEN){ + if ( vertlen > 0 && vertlen < MAX_LOG_LEN){ logInf = (char*)MEM_mallocN(vertlen, "vert-log"); glGetInfoLogARB(tmpVert, vertlen, (GLsizei*)&char_len, logInf); - if(char_len >0) { + if (char_len >0) { spit("---- Vertex Shader Error ----"); spit(logInf); } @@ -287,7 +287,7 @@ bool BL_Shader::LinkProgram() } // check for compile errors glGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB,(GLint*)&vertstatus); - if(!vertstatus) { + if (!vertstatus) { spit("---- Vertex shader failed to compile ----"); goto programError; } @@ -297,10 +297,10 @@ bool BL_Shader::LinkProgram() glShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0); glCompileShaderARB(tmpFrag); glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*) &fraglen); - if(fraglen >0 && fraglen < MAX_LOG_LEN){ + if (fraglen >0 && fraglen < MAX_LOG_LEN){ logInf = (char*)MEM_mallocN(fraglen, "frag-log"); glGetInfoLogARB(tmpFrag, fraglen,(GLsizei*) &char_len, logInf); - if(char_len >0) { + if (char_len >0) { spit("---- Fragment Shader Error ----"); spit(logInf); } @@ -309,7 +309,7 @@ bool BL_Shader::LinkProgram() } glGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, (GLint*) &fragstatus); - if(!fragstatus){ + if (!fragstatus){ spit("---- Fragment shader failed to compile ----"); goto programError; } @@ -325,10 +325,10 @@ bool BL_Shader::LinkProgram() glGetObjectParameterivARB(tmpProg, GL_OBJECT_LINK_STATUS_ARB, (GLint*) &progstatus); - if(proglen > 0 && proglen < MAX_LOG_LEN) { + if (proglen > 0 && proglen < MAX_LOG_LEN) { logInf = (char*)MEM_mallocN(proglen, "prog-log"); glGetInfoLogARB(tmpProg, proglen, (GLsizei*)&char_len, logInf); - if(char_len >0) { + if (char_len >0) { spit("---- GLSL Program ----"); spit(logInf); } @@ -336,7 +336,7 @@ bool BL_Shader::LinkProgram() logInf=0; } - if(!progstatus){ + if (!progstatus){ spit("---- GLSL program failed to link ----"); goto programError; } @@ -350,16 +350,16 @@ bool BL_Shader::LinkProgram() return true; programError: - if(tmpVert) { + if (tmpVert) { glDeleteObjectARB(tmpVert); tmpVert=0; } - if(tmpFrag) { + if (tmpFrag) { glDeleteObjectARB(tmpFrag); tmpFrag=0; } - if(tmpProg) { + if (tmpProg) { glDeleteObjectARB(tmpProg); tmpProg=0; } @@ -403,7 +403,7 @@ unsigned int BL_Shader::GetProg() void BL_Shader::SetSampler(int loc, int unit) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -422,12 +422,12 @@ void BL_Shader::SetSampler(int loc, int unit) void BL_Shader::SetProg(bool enable) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { - if( mShader != 0 && mOk && enable) { + if ( mShader != 0 && mOk && enable) { glUseProgramObjectARB(mShader); } else { @@ -438,10 +438,10 @@ void BL_Shader::SetProg(bool enable) void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) { - if(!Ok() || !mPreDef.size()) + if (!Ok() || !mPreDef.size()) return; - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -450,14 +450,14 @@ void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) model.setValue(ms.m_OpenGLMatrix); const MT_Matrix4x4& view = rasty->GetViewMatrix(); - if(mAttr==SHD_TANGENT) + if (mAttr==SHD_TANGENT) ms.m_mesh->SetMeshModified(true); BL_UniformVecDef::iterator it; - for(it = mPreDef.begin(); it!= mPreDef.end(); it++) + for (it = mPreDef.begin(); it!= mPreDef.end(); it++) { BL_DefUniform *uni = (*it); - if(uni->mLoc == -1) continue; + if (uni->mLoc == -1) continue; switch (uni->mType) { @@ -554,7 +554,7 @@ void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) int BL_Shader::GetAttribLocation(const STR_String& name) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -567,7 +567,7 @@ int BL_Shader::GetAttribLocation(const STR_String& name) void BL_Shader::BindAttribute(const STR_String& attr, int loc) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -578,14 +578,14 @@ void BL_Shader::BindAttribute(const STR_String& attr, int loc) int BL_Shader::GetUniformLocation(const STR_String& name) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { MT_assert(mShader!=0); int location = glGetUniformLocationARB(mShader, name.ReadPtr()); - if(location == -1) + if (location == -1) spit("Invalid uniform value: " << name.ReadPtr() << "."); return location; } @@ -595,7 +595,7 @@ int BL_Shader::GetUniformLocation(const STR_String& name) void BL_Shader::SetUniform(int uniform, const MT_Tuple2& vec) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -609,7 +609,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple2& vec) void BL_Shader::SetUniform(int uniform, const MT_Tuple3& vec) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -622,7 +622,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple3& vec) void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -635,7 +635,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec) void BL_Shader::SetUniform(int uniform, const unsigned int& val) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -646,7 +646,7 @@ void BL_Shader::SetUniform(int uniform, const unsigned int& val) void BL_Shader::SetUniform(int uniform, const int val) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -657,7 +657,7 @@ void BL_Shader::SetUniform(int uniform, const int val) void BL_Shader::SetUniform(int uniform, const float& val) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -668,7 +668,7 @@ void BL_Shader::SetUniform(int uniform, const float& val) void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -682,7 +682,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose) void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) @@ -697,12 +697,12 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose) void BL_Shader::SetUniform(int uniform, const float* val, int len) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { - if(len == 2) + if (len == 2) glUniform2fvARB(uniform, 1,(GLfloat*)val); else if (len == 3) glUniform3fvARB(uniform, 1,(GLfloat*)val); @@ -715,12 +715,12 @@ void BL_Shader::SetUniform(int uniform, const float* val, int len) void BL_Shader::SetUniform(int uniform, const int* val, int len) { - if( GLEW_ARB_fragment_shader && + if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { - if(len == 2) + if (len == 2) glUniform2ivARB(uniform, 1, (GLint*)val); else if (len == 3) glUniform3ivARB(uniform, 1, (GLint*)val); @@ -793,18 +793,18 @@ PyTypeObject BL_Shader::Type = { KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProgram)" ) { - if(mShader !=0 && mOk ) + if (mShader !=0 && mOk ) { // already set... Py_RETURN_NONE; } char *v,*f; int apply=0; - if( PyArg_ParseTuple(args, "ssi:setSource", &v, &f, &apply) ) + if ( PyArg_ParseTuple(args, "ssi:setSource", &v, &f, &apply) ) { vertProg = v; fragProg = f; - if( LinkProgram() ) { + if ( LinkProgram() ) { glUseProgramObjectARB( mShader ); mUse = apply!=0; Py_RETURN_NONE; @@ -847,10 +847,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" ) KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()") { - if(mError) { + if (mError) { Py_RETURN_NONE; } - if(mShader==0) { + if (mShader==0) { PyErr_SetString(PyExc_TypeError, "shader.validate(): BL_Shader, invalid shader object"); return NULL; } @@ -859,12 +859,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()") glGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB,(GLint*) &stat); - if(stat > 0 && stat < MAX_LOG_LEN) { + if (stat > 0 && stat < MAX_LOG_LEN) { int char_len=0; char *logInf = (char*)MEM_mallocN(stat, "validate-log"); glGetInfoLogARB(mShader, stat,(GLsizei*) &char_len, logInf); - if(char_len >0) { + if (char_len >0) { spit("---- GLSL Validation ----"); spit(logInf); } @@ -877,17 +877,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()") KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int index=-1; - if(PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) + if (PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) { int loc = GetUniformLocation(uniform); - if(loc != -1) { - if(index >= MAXTEX || index < 0) + if (loc != -1) { + if (index >= MAXTEX || index < 0) spit("Invalid texture sample index: " << index); #ifdef SORT_UNIFORMS @@ -908,7 +908,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )" ) { int pass = 1; - if(!PyArg_ParseTuple(args, "i:setNumberOfPasses", &pass)) + if (!PyArg_ParseTuple(args, "i:setNumberOfPasses", &pass)) return NULL; mPass = 1; @@ -918,16 +918,16 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass ) /// access functions KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; float value=0; - if(PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value )) + if (PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value )) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformfv(loc, BL_Uniform::UNI_FLOAT, &value, sizeof(float)); @@ -943,15 +943,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; float array[2]={ 0,0 }; - if(PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] )) + if (PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] )) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformfv(loc, BL_Uniform::UNI_FLOAT2, array, (sizeof(float)*2) ); @@ -967,15 +967,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; float array[3]={0,0,0}; - if(PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2])) + if (PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2])) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformfv(loc, BL_Uniform::UNI_FLOAT3, array, (sizeof(float)*3) ); @@ -992,15 +992,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ") KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; float array[4]={0,0,0,0}; - if(PyArg_ParseTuple(args, "sffff:setUniform4f", &uniform, &array[0],&array[1],&array[2], &array[3])) + if (PyArg_ParseTuple(args, "sffff:setUniform4f", &uniform, &array[0],&array[1],&array[2], &array[3])) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformfv(loc, BL_Uniform::UNI_FLOAT4, array, (sizeof(float)*4) ); @@ -1016,15 +1016,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) " KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int value=0; - if(PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value )) + if (PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value )) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformiv(loc, BL_Uniform::UNI_INT, &value, sizeof(int)); @@ -1040,15 +1040,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int array[2]={ 0,0 }; - if(PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] )) + if (PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] )) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformiv(loc, BL_Uniform::UNI_INT2, array, sizeof(int)*2); @@ -1064,16 +1064,16 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int array[3]={0,0,0}; - if(PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2])) + if (PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2])) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformiv(loc, BL_Uniform::UNI_INT3, array, sizeof(int)*3); @@ -1088,15 +1088,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ") KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) ") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int array[4]={0,0,0, 0}; - if(PyArg_ParseTuple(args, "siiii:setUniform4i", &uniform, &array[0],&array[1],&array[2], &array[3] )) + if (PyArg_ParseTuple(args, "siiii:setUniform4i", &uniform, &array[0],&array[1],&array[2], &array[3] )) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { #ifdef SORT_UNIFORMS SetUniformiv(loc, BL_Uniform::UNI_INT4, array, sizeof(int)*4); @@ -1111,23 +1111,23 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) " KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform = ""; PyObject *listPtr =0; float array_data[4] = {0.f,0.f,0.f,0.f}; - if(PyArg_ParseTuple(args, "sO:setUniformfv", &uniform, &listPtr)) + if (PyArg_ParseTuple(args, "sO:setUniformfv", &uniform, &listPtr)) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { - if(PySequence_Check(listPtr)) + if (PySequence_Check(listPtr)) { unsigned int list_size = PySequence_Size(listPtr); - for(unsigned int i=0; (i<list_size && i<4); i++) + for (unsigned int i=0; (i<list_size && i<4); i++) { PyObject *item = PySequence_GetItem(listPtr, i); array_data[i] = (float)PyFloat_AsDouble(item); @@ -1180,38 +1180,38 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2 or list3 or list4) )") { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform = ""; PyObject *listPtr =0; int array_data[4] = {0,0,0,0}; - if(!PyArg_ParseTuple(args, "sO:setUniformiv", &uniform, &listPtr)) + if (!PyArg_ParseTuple(args, "sO:setUniformiv", &uniform, &listPtr)) return NULL; int loc = GetUniformLocation(uniform); - if(loc == -1) { + if (loc == -1) { PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, first string argument is not a valid uniform value"); return NULL; } - if(!PySequence_Check(listPtr)) { + if (!PySequence_Check(listPtr)) { PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, second argument is not a sequence"); return NULL; } unsigned int list_size = PySequence_Size(listPtr); - for(unsigned int i=0; (i<list_size && i<4); i++) + for (unsigned int i=0; (i<list_size && i<4); i++) { PyObject *item = PySequence_GetItem(listPtr, i); array_data[i] = PyLong_AsSsize_t(item); Py_DECREF(item); } - if(PyErr_Occurred()) { + if (PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, one or more values in the list is not an int"); return NULL; } @@ -1266,7 +1266,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2 KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, "setUniformMatrix4(uniform_name, mat-4x4, transpose(row-major=true, col-major=false)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } @@ -1281,12 +1281,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, PyObject *matrix=0; int transp=0; // python use column major by default, so no transpose.... - if(!PyArg_ParseTuple(args, "sO|i:setUniformMatrix4",&uniform, &matrix,&transp)) + if (!PyArg_ParseTuple(args, "sO|i:setUniformMatrix4",&uniform, &matrix,&transp)) return NULL; int loc = GetUniformLocation(uniform); - if(loc == -1) { + if (loc == -1) { PyErr_SetString(PyExc_TypeError, "shader.setUniformMatrix4(...): BL_Shader, first string argument is not a valid uniform value"); return NULL; } @@ -1313,7 +1313,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, "setUniformMatrix3(uniform_name, list[3x3], transpose(row-major=true, col-major=false)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } @@ -1326,12 +1326,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, const char *uniform=""; PyObject *matrix=0; int transp=0; // python use column major by default, so no transpose.... - if(!PyArg_ParseTuple(args, "sO|i:setUniformMatrix3",&uniform, &matrix,&transp)) + if (!PyArg_ParseTuple(args, "sO|i:setUniformMatrix3",&uniform, &matrix,&transp)) return NULL; int loc = GetUniformLocation(uniform); - if(loc == -1) { + if (loc == -1) { PyErr_SetString(PyExc_TypeError, "shader.setUniformMatrix3(...): BL_Shader, first string argument is not a valid uniform value"); return NULL; } @@ -1356,18 +1356,18 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } int attr=0; - if(!PyArg_ParseTuple(args, "i:setAttrib", &attr)) + if (!PyArg_ParseTuple(args, "i:setAttrib", &attr)) return NULL; attr= SHD_TANGENT; /* user input is ignored for now, there is only 1 attr */ - if(mShader==0) { + if (mShader==0) { PyErr_SetString(PyExc_ValueError, "shader.setAttrib() BL_Shader, invalid shader object"); return NULL; } @@ -1381,27 +1381,27 @@ KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" ) KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" ) { - if(mError) { + if (mError) { Py_RETURN_NONE; } const char *uniform=""; int nloc=0; - if(PyArg_ParseTuple(args, "si:setUniformDef",&uniform, &nloc)) + if (PyArg_ParseTuple(args, "si:setUniformDef",&uniform, &nloc)) { int loc = GetUniformLocation(uniform); - if(loc != -1) + if (loc != -1) { bool defined = false; BL_UniformVecDef::iterator it = mPreDef.begin(); while(it != mPreDef.end()) { - if((*it)->mLoc == loc) { + if ((*it)->mLoc == loc) { defined = true; break; } it++; } - if(defined) + if (defined) { Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index 2c57004e6c4..4aab091c6a1 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -79,18 +79,18 @@ BL_Texture::~BL_Texture() void BL_Texture::DeleteTex() { - if( mNeedsDeleted ) { + if ( mNeedsDeleted ) { glDeleteTextures(1, (GLuint*)&mTexture); mNeedsDeleted = 0; mOk = 0; } - if(mEnvState) { + if (mEnvState) { glDeleteLists((GLuint)mEnvState, 1); mEnvState =0; } - if(mDisableState) { + if (mDisableState) { glDeleteLists((GLuint)mDisableState, 1); mDisableState =0; } @@ -167,7 +167,7 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) } glBindTexture(GL_TEXTURE_2D, mTexture ); - if( mipmap ) { + if ( mipmap ) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, x, y, GL_RGBA, GL_UNSIGNED_BYTE, pix ); @@ -194,7 +194,7 @@ void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap) gluScaleImage(GL_RGBA, x, y, GL_UNSIGNED_BYTE, pix, nx,ny, GL_UNSIGNED_BYTE, newPixels); glBindTexture(GL_TEXTURE_2D, mTexture ); - if( mipmap ) { + if ( mipmap ) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, nx, ny, GL_RGBA, GL_UNSIGNED_BYTE, newPixels ); @@ -304,7 +304,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - if(GLEW_VERSION_1_2) + if (GLEW_VERSION_1_2) glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE ); if (needs_split) @@ -346,7 +346,7 @@ int BL_Texture::GetMaxUnits() { GLint unit=0; - if(GLEW_ARB_multitexture) { + if (GLEW_ARB_multitexture) { glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &unit); return (MAXTEX>=unit?unit:MAXTEX); } @@ -356,28 +356,28 @@ int BL_Texture::GetMaxUnits() void BL_Texture::ActivateFirst() { - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) glActiveTextureARB(GL_TEXTURE0_ARB); } void BL_Texture::ActivateUnit(int unit) { - if(GLEW_ARB_multitexture) - if(unit <= MAXTEX) + if (GLEW_ARB_multitexture) + if (unit <= MAXTEX) glActiveTextureARB(GL_TEXTURE0_ARB+unit); } void BL_Texture::DisableUnit() { - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) glActiveTextureARB(GL_TEXTURE0_ARB+mUnit); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - if(GLEW_ARB_texture_cube_map && glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + if (GLEW_ARB_texture_cube_map && glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) glDisable(GL_TEXTURE_CUBE_MAP_ARB); else { @@ -395,8 +395,8 @@ void BL_Texture::DisableUnit() void BL_Texture::DisableAllTextures() { - for(int i=0; i<MAXTEX; i++) { - if(GLEW_ARB_multitexture) + for (int i=0; i<MAXTEX; i++) { + if (GLEW_ARB_multitexture) glActiveTextureARB(GL_TEXTURE0_ARB+i); glMatrixMode(GL_TEXTURE); @@ -410,14 +410,14 @@ void BL_Texture::DisableAllTextures() glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); } - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) glActiveTextureARB(GL_TEXTURE0_ARB); } void BL_Texture::ActivateTexture() { - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) glActiveTextureARB(GL_TEXTURE0_ARB+mUnit); if (mType == GL_TEXTURE_CUBE_MAP_ARB && GLEW_ARB_texture_cube_map) @@ -426,7 +426,7 @@ void BL_Texture::ActivateTexture() glEnable(GL_TEXTURE_CUBE_MAP_ARB); } else { - if(GLEW_ARB_texture_cube_map ) + if (GLEW_ARB_texture_cube_map ) glDisable(GL_TEXTURE_CUBE_MAP_ARB); glBindTexture( GL_TEXTURE_2D, mTexture ); @@ -437,7 +437,7 @@ void BL_Texture::ActivateTexture() void BL_Texture::SetMapping(int mode) { - if(!(mode &USEREFL)) { + if (!(mode &USEREFL)) { glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_R); @@ -445,7 +445,7 @@ void BL_Texture::SetMapping(int mode) return; } - if( mType == GL_TEXTURE_CUBE_MAP_ARB && + if ( mType == GL_TEXTURE_CUBE_MAP_ARB && GLEW_ARB_texture_cube_map && mode &USEREFL) { @@ -474,17 +474,17 @@ void BL_Texture::SetMapping(int mode) void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) { - if(modulate || !GLEW_ARB_texture_env_combine){ + if (modulate || !GLEW_ARB_texture_env_combine){ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); return; } - if(glIsList(mEnvState)) + if (glIsList(mEnvState)) { glCallList(mEnvState); return; } - if(!mEnvState) + if (!mEnvState) mEnvState = glGenLists(1); glNewList(mEnvState, GL_COMPILE_AND_EXECUTE); @@ -504,7 +504,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) GLenum op2 = GL_OPERAND2_RGB_ARB; // switch to alpha combiners - if( mat->flag[mUnit] &TEXALPHA ) { + if ( mat->flag[mUnit] &TEXALPHA ) { combiner = GL_COMBINE_ALPHA_ARB; source0 = GL_SOURCE0_ALPHA_ARB; source1 = GL_SOURCE1_ALPHA_ARB; @@ -515,24 +515,24 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) blend_operand = GL_SRC_ALPHA; blend_operand_prev = GL_SRC_ALPHA; // invert - if(mat->flag[mUnit] &TEXNEG) { + if (mat->flag[mUnit] &TEXNEG) { blend_operand_prev = GL_ONE_MINUS_SRC_ALPHA; blend_operand = GL_ONE_MINUS_SRC_ALPHA; } } else { - if(mat->flag[mUnit] &TEXNEG) { + if (mat->flag[mUnit] &TEXNEG) { blend_operand_prev=GL_ONE_MINUS_SRC_COLOR; blend_operand = GL_ONE_MINUS_SRC_COLOR; } } bool using_alpha = false; - if(mat->flag[mUnit] &USEALPHA){ + if (mat->flag[mUnit] &USEALPHA){ alphaOp = GL_ONE_MINUS_SRC_ALPHA; using_alpha=true; } - else if(mat->flag[mUnit] &USENEGALPHA){ + else if (mat->flag[mUnit] &USENEGALPHA){ alphaOp = GL_SRC_ALPHA; using_alpha = true; } @@ -541,7 +541,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) case BLEND_MIX: { // ------------------------------ - if(!using_alpha) { + if (!using_alpha) { GLfloat base_col[4]; base_col[0] = base_col[1] = base_col[2] = 0.f; base_col[3] = 1.f-mat->color_blend[mUnit]; @@ -552,7 +552,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - if(!using_alpha) + if (!using_alpha) glTexEnvf( GL_TEXTURE_ENV, source2, GL_CONSTANT_ARB ); else glTexEnvf( GL_TEXTURE_ENV, source2, GL_TEXTURE ); @@ -566,7 +566,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB); glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev); glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) + if (using_alpha) glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); @@ -578,7 +578,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB ); glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) + if (using_alpha) glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); @@ -599,7 +599,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB ); glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) + if (using_alpha) glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); @@ -612,7 +612,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) int BL_Texture::GetPow2(int n) { - if(!is_power_of_2_i(n)) + if (!is_power_of_2_i(n)) n = power_of_2_min_i(n); return n; @@ -638,13 +638,13 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) dx= ibuf->y; dx/= 2; - if(3*dx != ibuf->x) { + if (3*dx != ibuf->x) { printf("Incorrect envmap size\n"); env->ok= 0; env->ima->ok= 0; } else { - for(part=0; part<6; part++) { + for (part=0; part<6; part++) { env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect); } IMB_rectcpy(env->cube[0], ibuf, @@ -669,9 +669,9 @@ void my_free_envmapdata(EnvMap *env) { unsigned int part; - for(part=0; part<6; part++) { + for (part=0; part<6; part++) { ImBuf *ibuf= env->cube[part]; - if(ibuf) { + if (ibuf) { IMB_freeImBuf(ibuf); env->cube[part]= NULL; } diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 66cbcdb914c..13727be8b98 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -101,7 +101,7 @@ void KX_BlenderMaterial::Initialize( // so we can ether accept or reject this material // as being equal, this is rather important to // prevent material bleeding - for(int i=0; i<mMaterial->num_enabled; i++) { + for (int i=0; i<mMaterial->num_enabled; i++) { m_multimode += (mMaterial->flag[i] + mMaterial->blend_mode[i]); } m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(USE_LIGHT)); @@ -161,25 +161,25 @@ void KX_BlenderMaterial::OnConstruction(int layer) // when material are reused between objects return; - if(mMaterial->glslmat) + if (mMaterial->glslmat) SetBlenderGLSLShader(layer); // for each unique material... int i; - for(i=0; i<mMaterial->num_enabled; i++) { - if( mMaterial->mapping[i].mapping & USEENV ) { - if(!GLEW_ARB_texture_cube_map) { + for (i=0; i<mMaterial->num_enabled; i++) { + if ( mMaterial->mapping[i].mapping & USEENV ) { + if (!GLEW_ARB_texture_cube_map) { spit("CubeMap textures not supported"); continue; } - if(!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) ) + if (!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) ) spit("unable to initialize image("<<i<<") in "<< mMaterial->matname<< ", image will not be available"); } else { - if( mMaterial->img[i] ) { - if( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) + if ( mMaterial->img[i] ) { + if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) spit("unable to initialize image("<<i<<") in "<< mMaterial->matname<< ", image will not be available"); } @@ -193,12 +193,12 @@ void KX_BlenderMaterial::OnConstruction(int layer) void KX_BlenderMaterial::EndFrame() { - if(mLastBlenderShader) { + if (mLastBlenderShader) { mLastBlenderShader->SetProg(false); mLastBlenderShader = NULL; } - if(mLastShader) { + if (mLastShader) { mLastShader->SetProg(false); mLastShader = NULL; } @@ -206,10 +206,10 @@ void KX_BlenderMaterial::EndFrame() void KX_BlenderMaterial::OnExit() { - if( mShader ) { + if ( mShader ) { //note, the shader here is allocated, per unique material //and this function is called per face - if(mShader == mLastShader) { + if (mShader == mLastShader) { mShader->SetProg(false); mLastShader = NULL; } @@ -218,8 +218,8 @@ void KX_BlenderMaterial::OnExit() mShader = 0; } - if( mBlenderShader ) { - if(mBlenderShader == mLastBlenderShader) { + if ( mBlenderShader ) { + if (mBlenderShader == mLastBlenderShader) { mBlenderShader->SetProg(false); mLastBlenderShader = NULL; } @@ -229,7 +229,7 @@ void KX_BlenderMaterial::OnExit() } BL_Texture::ActivateFirst(); - for(int i=0; i<mMaterial->num_enabled; i++) { + for (int i=0; i<mMaterial->num_enabled; i++) { BL_Texture::ActivateUnit(i); mTextures[i].DeleteTex(); mTextures[i].DisableUnit(); @@ -249,9 +249,9 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) MT_assert(GLEW_ARB_shader_objects && mShader); int i; - if( !enable || !mShader->Ok() ) { + if ( !enable || !mShader->Ok() ) { // frame cleanup. - if(mShader == mLastShader) { + if (mShader == mLastShader) { mShader->SetProg(false); mLastShader = NULL; } @@ -270,13 +270,13 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) mShader->ApplyShader(); // for each enabled unit - for(i=0; i<mMaterial->num_enabled; i++) { - if(!mTextures[i].Ok()) continue; + for (i=0; i<mMaterial->num_enabled; i++) { + if (!mTextures[i].Ok()) continue; mTextures[i].ActivateTexture(); mTextures[0].SetMapping(mMaterial->mapping[i].mapping); } - if(!mUserDefBlend) { + if (!mUserDefBlend) { ras->SetAlphaBlend(mMaterial->alphablend); } else { @@ -291,11 +291,11 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras) { - if( !enable || !mBlenderShader->Ok() ) { + if ( !enable || !mBlenderShader->Ok() ) { ras->SetAlphaBlend(TF_SOLID); // frame cleanup. - if(mLastBlenderShader) { + if (mLastBlenderShader) { mLastBlenderShader->SetProg(false); mLastBlenderShader= NULL; } @@ -305,10 +305,10 @@ void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras return; } - if(!mBlenderShader->Equals(mLastBlenderShader)) { + if (!mBlenderShader->Equals(mLastBlenderShader)) { ras->SetAlphaBlend(mMaterial->alphablend); - if(mLastBlenderShader) + if (mLastBlenderShader) mLastBlenderShader->SetProg(false); else BL_Texture::DisableAllTextures(); @@ -322,21 +322,21 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) { BL_Texture::DisableAllTextures(); - if( !enable ) { + if ( !enable ) { ras->SetAlphaBlend(TF_SOLID); return; } BL_Texture::ActivateFirst(); - if( mMaterial->IdMode == DEFAULT_BLENDER ) { + if ( mMaterial->IdMode == DEFAULT_BLENDER ) { ras->SetAlphaBlend(mMaterial->alphablend); return; } - if( mMaterial->IdMode == TEXFACE ) { + if ( mMaterial->IdMode == TEXFACE ) { // no material connected to the object - if( mTextures[0].Ok() ) { + if ( mTextures[0].Ok() ) { mTextures[0].ActivateTexture(); mTextures[0].setTexEnv(0, true); mTextures[0].SetMapping(mMaterial->mapping[0].mapping); @@ -346,23 +346,23 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) } int mode = 0,i=0; - for(i=0; (i<mMaterial->num_enabled && i<MAXTEX); i++) { - if( !mTextures[i].Ok() ) continue; + for (i=0; (i<mMaterial->num_enabled && i<MAXTEX); i++) { + if ( !mTextures[i].Ok() ) continue; mTextures[i].ActivateTexture(); mTextures[i].setTexEnv(mMaterial); mode = mMaterial->mapping[i].mapping; - if(mode &USEOBJ) + if (mode &USEOBJ) setObjectMatrixData(i, ras); else mTextures[i].SetMapping(mode); - if(!(mode &USEOBJ)) + if (!(mode &USEOBJ)) setTexMatrixData( i ); } - if(!mUserDefBlend) { + if (!mUserDefBlend) { ras->SetAlphaBlend(mMaterial->alphablend); } else { @@ -382,10 +382,10 @@ KX_BlenderMaterial::ActivatShaders( KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this); // reset... - if(tmp->mMaterial->IsShared()) + if (tmp->mMaterial->IsShared()) cachingInfo =0; - if(mLastBlenderShader) { + if (mLastBlenderShader) { mLastBlenderShader->SetProg(false); mLastBlenderShader= NULL; } @@ -397,7 +397,7 @@ KX_BlenderMaterial::ActivatShaders( cachingInfo = GetCachingInfo(); - if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) tmp->setShaderData(true, rasty); else tmp->setShaderData(false, rasty); @@ -431,7 +431,7 @@ KX_BlenderMaterial::ActivateBlenderShaders( { KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this); - if(mLastShader) { + if (mLastShader) { mLastShader->SetProg(false); mLastShader= NULL; } @@ -442,7 +442,7 @@ KX_BlenderMaterial::ActivateBlenderShaders( cachingInfo = GetCachingInfo(); - if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) tmp->setBlenderShaderData(true, rasty); else tmp->setBlenderShaderData(false, rasty); @@ -475,12 +475,12 @@ KX_BlenderMaterial::ActivateMat( { KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this); - if(mLastShader) { + if (mLastShader) { mLastShader->SetProg(false); mLastShader= NULL; } - if(mLastBlenderShader) { + if (mLastBlenderShader) { mLastBlenderShader->SetProg(false); mLastBlenderShader= NULL; } @@ -524,13 +524,13 @@ KX_BlenderMaterial::Activate( TCachingInfo& cachingInfo )const { - if(GLEW_ARB_shader_objects && (mShader && mShader->Ok())) { - if((mPass++) < mShader->getNumPass() ) { + if (GLEW_ARB_shader_objects && (mShader && mShader->Ok())) { + if ((mPass++) < mShader->getNumPass() ) { ActivatShaders(rasty, cachingInfo); return true; } else { - if(mShader == mLastShader) { + if (mShader == mLastShader) { mShader->SetProg(false); mLastShader = NULL; } @@ -538,8 +538,8 @@ KX_BlenderMaterial::Activate( return false; } } - else if( GLEW_ARB_shader_objects && (mBlenderShader && mBlenderShader->Ok() ) ) { - if(mPass++ == 0) { + else if ( GLEW_ARB_shader_objects && (mBlenderShader && mBlenderShader->Ok() ) ) { + if (mPass++ == 0) { ActivateBlenderShaders(rasty, cachingInfo); return true; } @@ -549,7 +549,7 @@ KX_BlenderMaterial::Activate( } } else { - if(mPass++ == 0) { + if (mPass++ == 0) { ActivateMat(rasty, cachingInfo); return true; } @@ -562,12 +562,12 @@ KX_BlenderMaterial::Activate( bool KX_BlenderMaterial::UsesLighting(RAS_IRasterizer *rasty) const { - if(!RAS_IPolyMaterial::UsesLighting(rasty)) + if (!RAS_IPolyMaterial::UsesLighting(rasty)) return false; - if(mShader && mShader->Ok()) + if (mShader && mShader->Ok()) return true; - else if(mBlenderShader && mBlenderShader->Ok()) + else if (mBlenderShader && mBlenderShader->Ok()) return false; else return true; @@ -575,10 +575,10 @@ bool KX_BlenderMaterial::UsesLighting(RAS_IRasterizer *rasty) const void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty) const { - if(mShader && GLEW_ARB_shader_objects) { + if (mShader && GLEW_ARB_shader_objects) { mShader->Update(ms, rasty); } - else if(mBlenderShader && GLEW_ARB_shader_objects) { + else if (mBlenderShader && GLEW_ARB_shader_objects) { int alphablend; mBlenderShader->Update(ms, rasty); @@ -586,7 +586,7 @@ void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasteriz /* we do blend modes here, because they can change per object * with the same material due to obcolor/obalpha */ alphablend = mBlenderShader->GetAlphaBlend(); - if(ELEM3(alphablend, GEMAT_SOLID, GEMAT_ALPHA, GEMAT_ALPHA_SORT) && mMaterial->alphablend != GEMAT_SOLID) + if (ELEM3(alphablend, GEMAT_SOLID, GEMAT_ALPHA, GEMAT_ALPHA_SORT) && mMaterial->alphablend != GEMAT_SOLID) alphablend = mMaterial->alphablend; rasty->SetAlphaBlend(alphablend); @@ -595,7 +595,7 @@ void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasteriz void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const { - if(mShader || !mBlenderShader) { + if (mShader || !mBlenderShader) { rasty->SetSpecularity( mMaterial->speccolor[0]*mMaterial->spec_f, mMaterial->speccolor[1]*mMaterial->spec_f, @@ -627,10 +627,10 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const { - if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { + if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { ras->SetAttribNum(0); - if(mShader && GLEW_ARB_shader_objects) { - if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT) { + if (mShader && GLEW_ARB_shader_objects) { + if (mShader->GetAttribute() == BL_Shader::SHD_TANGENT) { ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, 0); ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, 1); ras->SetAttribNum(2); @@ -639,7 +639,7 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const ras->SetTexCoordNum(mMaterial->num_enabled); - for(int i=0; i<mMaterial->num_enabled; i++) { + for (int i=0; i<mMaterial->num_enabled; i++) { int mode = mMaterial->mapping[i].mapping; if (mode &USECUSTOMUV) @@ -649,15 +649,15 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const continue; } - if( mode &(USEREFL|USEOBJ)) + if ( mode &(USEREFL|USEOBJ)) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_GEN, i); - else if(mode &USEORCO) + else if (mode &USEORCO) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_ORCO, i); - else if(mode &USENORM) + else if (mode &USENORM) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_NORM, i); - else if(mode &USEUV) + else if (mode &USEUV) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV1, i); - else if(mode &USETANG) + else if (mode &USETANG) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXTANGENT, i); else ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_DISABLE, i); @@ -670,7 +670,7 @@ void KX_BlenderMaterial::setTexMatrixData(int i) glMatrixMode(GL_TEXTURE); glLoadIdentity(); - if( GLEW_ARB_texture_cube_map && + if ( GLEW_ARB_texture_cube_map && mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && mMaterial->mapping[i].mapping & USEREFL) { glScalef( @@ -700,11 +700,11 @@ void KX_BlenderMaterial::setTexMatrixData(int i) static void GetProjPlane(BL_Material *mat, int index,int num, float*param) { param[0]=param[1]=param[2]=param[3]=0.f; - if( mat->mapping[index].projplane[num] == PROJX ) + if ( mat->mapping[index].projplane[num] == PROJX ) param[0] = 1.f; - else if( mat->mapping[index].projplane[num] == PROJY ) + else if ( mat->mapping[index].projplane[num] == PROJY ) param[1] = 1.f; - else if( mat->mapping[index].projplane[num] == PROJZ) + else if ( mat->mapping[index].projplane[num] == PROJZ) param[2] = 1.f; } @@ -714,7 +714,7 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) (KX_GameObject*) mScene->GetObjectList()->FindValue(mMaterial->mapping[i].objconame); - if(!obj) return; + if (!obj) return; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); @@ -784,10 +784,10 @@ void KX_BlenderMaterial::UpdateIPO( void KX_BlenderMaterial::SetBlenderGLSLShader(int layer) { - if(!mBlenderShader) + if (!mBlenderShader) mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer); - if(!mBlenderShader->Ok()) { + if (!mBlenderShader->Ok()) { delete mBlenderShader; mBlenderShader = 0; } @@ -855,7 +855,7 @@ int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_D { KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v); PyObject* obj = self->PysetBlending(value, NULL); - if(obj) + if (obj) { Py_DECREF(obj); return 0; @@ -865,24 +865,24 @@ int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_D KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") { - if( !GLEW_ARB_fragment_shader) { - if(!mModified) + if ( !GLEW_ARB_fragment_shader) { + if (!mModified) spit("Fragment shaders not supported"); mModified = true; Py_RETURN_NONE; } - if( !GLEW_ARB_vertex_shader) { - if(!mModified) + if ( !GLEW_ARB_vertex_shader) { + if (!mModified) spit("Vertex shaders not supported"); mModified = true; Py_RETURN_NONE; } - if(!GLEW_ARB_shader_objects) { - if(!mModified) + if (!GLEW_ARB_shader_objects) { + if (!mModified) spit("GLSL not supported"); mModified = true; Py_RETURN_NONE; @@ -891,12 +891,12 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") // returns Py_None on error // the calling script will need to check - if(!mShader && !mModified) { + if (!mShader && !mModified) { mShader = new BL_Shader(); mModified = true; } - if(mShader && !mShader->GetError()) { + if (mShader && !mShader->GetError()) { m_flag &= ~RAS_BLENDERGLSL; mMaterial->SetSharedMaterial(true); mScene->GetBucketManager()->ReleaseDisplayLists(this); @@ -907,7 +907,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") // then delete it! // We will then go back to fixed functionality // for this material - if(mShader) { + if (mShader) { delete mShader; /* will handle python de-referencing */ mShader=0; } @@ -952,22 +952,22 @@ static unsigned int GL_array[11] = { KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)") { unsigned int b[2]; - if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1])) + if (PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1])) { bool value_found[2] = {false, false}; - for(int i=0; i<11; i++) + for (int i=0; i<11; i++) { - if(b[0] == GL_array[i]) { + if (b[0] == GL_array[i]) { value_found[0] = true; mBlendFunc[0] = b[0]; } - if(b[1] == GL_array[i]) { + if (b[1] == GL_array[i]) { value_found[1] = true; mBlendFunc[1] = b[1]; } - if(value_found[0] && value_found[1]) break; + if (value_found[0] && value_found[1]) break; } - if(!value_found[0] || !value_found[1]) { + if (!value_found[0] || !value_found[1]) { PyErr_SetString(PyExc_ValueError, "material.setBlending(int, int): KX_BlenderMaterial, invalid enum."); return NULL; } diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 7a2d71f56ff..6806698dab2 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -387,7 +387,7 @@ bool KX_Camera::PointInsideFrustum(const MT_Point3& x) { ExtractClipPlanes(); - for( unsigned int i = 0; i < 6 ; i++ ) + for ( unsigned int i = 0; i < 6 ; i++ ) { if (m_planes[i][0]*x[0] + m_planes[i][1]*x[1] + m_planes[i][2]*x[2] + m_planes[i][3] < 0.) return false; @@ -401,7 +401,7 @@ int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) unsigned int insideCount = 0; // 6 view frustum planes - for( unsigned int p = 0; p < 6 ; p++ ) + for ( unsigned int p = 0; p < 6 ; p++ ) { unsigned int behindCount = 0; // 8 box vertices. @@ -944,7 +944,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, { PyErr_Clear(); - if(ConvertPythonToGameObject(value, &obj, true, "")) + if (ConvertPythonToGameObject(value, &obj, true, "")) { PyErr_Clear(); vect = MT_Vector3(obj->NodeGetWorldPosition()); @@ -977,7 +977,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, vect[1] = 1.0 - vect[1]; //to follow Blender window coordinate system (Top-Down) PyObject* ret = PyTuple_New(2); - if(ret){ + if (ret){ PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(vect[0])); PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(vect[1])); return ret; @@ -1044,7 +1044,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y)); - if(!PyVecTo(PygetScreenVect(argValue), vect)) + if (!PyVecTo(PygetScreenVect(argValue), vect)) { Py_DECREF(argValue); PyErr_SetString(PyExc_TypeError, diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index b683fcb8036..dfe45b8cfcd 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -121,7 +121,7 @@ static float Kx_Normalize(float *n) d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2]; /* FLT_EPSILON is too large! A larger value causes normalize errors in a scaled down utah teapot */ - if(d>0.0000000000001) { + if (d>0.0000000000001) { d= sqrt(d); n[0]/=d; @@ -159,25 +159,25 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis) * see: VecUpMat3old */ - if(axis==0) { + if (axis==0) { cox= 0; coy= 1; coz= 2; /* Y up Z tr */ } - if(axis==1) { + if (axis==1) { cox= 1; coy= 2; coz= 0; /* Z up X tr */ } - if(axis==2) { + if (axis==2) { cox= 2; coy= 0; coz= 1; /* X up Y tr */ } - if(axis==3) { + if (axis==3) { cox= 0; coy= 1; coz= 2; /* Y op -Z tr */ vec[0]= -vec[0]; vec[1]= -vec[1]; vec[2]= -vec[2]; } - if(axis==4) { + if (axis==4) { cox= 1; coy= 0; coz= 2; /* */ } - if(axis==5) { + if (axis==5) { cox= 2; coy= 1; coz= 0; /* Y up X tr */ } @@ -318,8 +318,8 @@ bool KX_CameraActuator::Update(double curtime, bool frame) from[2]+= fac*fp1[2]; /* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */ - if(inp<0.0) { - if(fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) { + if (inp<0.0) { + if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) { from[0]-= fac*fp1[1]; from[1]+= fac*fp1[0]; } @@ -336,14 +336,14 @@ bool KX_CameraActuator::Update(double curtime, bool frame) rc[2]= (lookat[2]-from[2]); distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2]; - if(distsq > maxdistsq) { + if (distsq > maxdistsq) { distsq = 0.15*(distsq-maxdistsq)/distsq; from[0] += distsq*rc[0]; from[1] += distsq*rc[1]; from[2] += distsq*rc[2]; } - else if(distsq < mindistsq) { + else if (distsq < mindistsq) { distsq = 0.15*(mindistsq-distsq)/mindistsq; from[0] -= distsq*rc[0]; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 46753dcaffe..e26c5b6a7bf 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -544,17 +544,17 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro /* if this is the child of a compound shape this can happen * don't support compound shapes for now */ - if(spc==NULL) + if (spc==NULL) return false; shapeInfo = spc->GetShapeInfo(); - if(shapeInfo->m_shapeType != PHY_SHAPE_MESH/* || spc->GetSoftBody()*/) + if (shapeInfo->m_shapeType != PHY_SHAPE_MESH/* || spc->GetSoftBody()*/) return false; spc->DeleteControllerShape(); - if(from_gameobj==NULL && from_meshobj==NULL) + if (from_gameobj==NULL && from_meshobj==NULL) from_gameobj= gameobj; /* updates the arrays used for making the new bullet mesh */ diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 0f0e4b8c10d..0be5a5609aa 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -158,7 +158,7 @@ KX_Dome::KX_Dome ( CreateGLImages(); - if(warp.usemesh) + if (warp.usemesh) fboSupported = CreateFBO(); dlistSupported = CreateDL(); @@ -169,16 +169,16 @@ KX_Dome::~KX_Dome (void) { ClearGLImages(); - if(fboSupported) + if (fboSupported) glDeleteFramebuffersEXT(1, &warp.fboId); - if(dlistSupported) + if (dlistSupported) glDeleteLists(dlistId, (GLsizei) m_numimages); } void KX_Dome::SetViewPort(GLuint viewport[4]) { - if(canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight()) + if (canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight()) { m_viewport.SetLeft(viewport[0]); m_viewport.SetBottom(viewport[1]); @@ -203,7 +203,7 @@ void KX_Dome::CreateGLImages(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - if(warp.usemesh){ + if (warp.usemesh){ glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, warp.imagesize, warp.imagesize, 0, GL_RGB8, GL_UNSIGNED_BYTE, 0); @@ -220,7 +220,7 @@ void KX_Dome::ClearGLImages(void) glDeleteTextures(m_numimages, (GLuint*)&domefacesId); #if 0 for (int i=0;i<m_numimages;i++) - if(glIsTexture(domefacesId[i])) + if (glIsTexture(domefacesId[i])) glDeleteTextures(1, (GLuint*)&domefacesId[i]); #endif } @@ -259,7 +259,7 @@ bool KX_Dome::CreateDL() { dlistId = glGenLists((GLsizei) m_numimages); if (dlistId != 0) { - if(m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR){ + if (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR){ glNewList(dlistId, GL_COMPILE); GLDrawTriangles(cubetop, nfacestop); glEndList(); @@ -309,7 +309,7 @@ bool KX_Dome::CreateDL() glEndList(); } - if(warp.usemesh){ + if (warp.usemesh){ glNewList((dlistId + m_numfaces), GL_COMPILE); GLDrawWarpQuads(); glEndList(); @@ -340,7 +340,7 @@ bool KX_Dome::CreateFBO(void) } glGenFramebuffersEXT(1, &warp.fboId); - if(warp.fboId==0) + if (warp.fboId==0) { printf("Dome Error: Invalid frame buffer object. Using low resolution warp image."); return false; @@ -353,12 +353,12 @@ bool KX_Dome::CreateFBO(void) GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if(status == GL_FRAMEBUFFER_UNSUPPORTED_EXT) + if (status == GL_FRAMEBUFFER_UNSUPPORTED_EXT) { printf("Dome Error: FrameBuffer settings unsupported. Using low resolution warp image."); return false; } - else if(status != GL_FRAMEBUFFER_COMPLETE_EXT) + else if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { glDeleteFramebuffersEXT(1, &warp.fboId); return false; @@ -391,11 +391,11 @@ void KX_Dome::GLDrawWarpQuads(void) float uv_width = (float)(warp.bufferwidth) / warp.imagesize; float uv_height = (float)(warp.bufferheight) / warp.imagesize; - if(warp.mode ==2 ){ + if (warp.mode ==2 ){ glBegin(GL_QUADS); for (i=0;i<warp.n_height-1;i++) { for (j=0;j<warp.n_width-1;j++) { - if(warp.nodes[i][j].i < 0 || warp.nodes[i+1][j].i < 0 || warp.nodes[i+1][j+1].i < 0 || warp.nodes[i][j+1].i < 0) + if (warp.nodes[i][j].i < 0 || warp.nodes[i+1][j].i < 0 || warp.nodes[i+1][j+1].i < 0 || warp.nodes[i][j+1].i < 0) continue; glColor3f(warp.nodes[i][j].i, warp.nodes[i][j].i, warp.nodes[i][j].i); @@ -481,15 +481,15 @@ bool KX_Dome::ParseWarpMesh(STR_String text) vector<STR_String> columns, lines; lines = text.Explode('\n'); - if(lines.size() < 6){ + if (lines.size() < 6){ printf("Dome Error: Warp Mesh File with insufficient data!\n"); return false; } columns = lines[1].Explode(' '); - if(columns.size() == 1) + if (columns.size() == 1) columns = lines[1].Explode('\t'); - if(columns.size() !=2){ + if (columns.size() !=2){ printf("Dome Error: Warp Mesh File incorrect. The second line should contain: width height.\n"); return false; } @@ -505,9 +505,9 @@ bool KX_Dome::ParseWarpMesh(STR_String text) }else{ warp.nodes = vector<vector<WarpMeshNode> > (warp.n_height, vector<WarpMeshNode>(warp.n_width)); - for(i=2; i-2 < (warp.n_width*warp.n_height); i++){ + for (i=2; i-2 < (warp.n_width*warp.n_height); i++){ columns = lines[i].Explode(' '); - if(columns.size() == 1) + if (columns.size() == 1) columns = lines[i].Explode('\t'); if (columns.size() == 5){ @@ -674,7 +674,7 @@ void KX_Dome::CreateMeshDome180(void) //Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration //Could be made more efficient for drawing if the triangles were ordered in a fan. Not that important since we are using DisplayLists - for(i=0;i<m_resolution;i++){ + for (i=0;i<m_resolution;i++){ cubetop.resize(4*nfacestop); SplitFace(cubetop,&nfacestop); cubebottom.resize(4*nfacesbottom); @@ -686,25 +686,25 @@ void KX_Dome::CreateMeshDome180(void) } // Turn into a hemisphere - for(j=0;j<3;j++){ - for(i=0;i<nfacestop;i++) + for (j=0;j<3;j++){ + for (i=0;i<nfacestop;i++) cubetop[i].verts[j].normalize(); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) cubebottom[i].verts[j].normalize(); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) cubeleft[i].verts[j].normalize(); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) cuberight[i].verts[j].normalize(); } //flatten onto xz plane - for(i=0;i<nfacestop;i++) + for (i=0;i<nfacestop;i++) FlattenDome(cubetop[i].verts); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) FlattenDome(cubebottom[i].verts); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) FlattenDome(cubeleft[i].verts); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) FlattenDome(cuberight[i].verts); } @@ -953,7 +953,7 @@ void KX_Dome::CreateMeshDome250(void) //Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration //It could be made more efficient for drawing if the triangles were ordered in a strip! - for(i=0;i<m_resolution;i++){ + for (i=0;i<m_resolution;i++){ cubefront.resize(4*nfacesfront); SplitFace(cubefront,&nfacesfront); cubetop.resize(4*nfacestop); @@ -967,29 +967,29 @@ void KX_Dome::CreateMeshDome250(void) } // Turn into a hemisphere/sphere - for(j=0;j<3;j++){ - for(i=0;i<nfacesfront;i++) + for (j=0;j<3;j++){ + for (i=0;i<nfacesfront;i++) cubefront[i].verts[j].normalize(); - for(i=0;i<nfacestop;i++) + for (i=0;i<nfacestop;i++) cubetop[i].verts[j].normalize(); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) cubebottom[i].verts[j].normalize(); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) cubeleft[i].verts[j].normalize(); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) cuberight[i].verts[j].normalize(); } //flatten onto xz plane - for(i=0;i<nfacesfront;i++) + for (i=0;i<nfacesfront;i++) FlattenDome(cubefront[i].verts); - for(i=0;i<nfacestop;i++) + for (i=0;i<nfacestop;i++) FlattenDome(cubetop[i].verts); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) FlattenDome(cubebottom[i].verts); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) FlattenDome(cubeleft[i].verts); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) FlattenDome(cuberight[i].verts); } @@ -1252,7 +1252,7 @@ void KX_Dome::CreateMeshPanorama(void) nfacesrightback = 2; // Subdivide the faces - for(i=0;i<m_resolution;i++) + for (i=0;i<m_resolution;i++) { cubetop.resize(4*nfacestop); SplitFace(cubetop,&nfacestop); @@ -1274,44 +1274,44 @@ void KX_Dome::CreateMeshPanorama(void) } // Spherize the cube - for(j=0;j<3;j++) + for (j=0;j<3;j++) { - for(i=0;i<nfacestop;i++) + for (i=0;i<nfacestop;i++) cubetop[i].verts[j].normalize(); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) cubebottom[i].verts[j].normalize(); - for(i=0;i<nfacesleftback;i++) + for (i=0;i<nfacesleftback;i++) cubeleftback[i].verts[j].normalize(); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) cubeleft[i].verts[j].normalize(); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) cuberight[i].verts[j].normalize(); - for(i=0;i<nfacesrightback;i++) + for (i=0;i<nfacesrightback;i++) cuberightback[i].verts[j].normalize(); } //Flatten onto xz plane - for(i=0;i<nfacesleftback;i++) + for (i=0;i<nfacesleftback;i++) FlattenPanorama(cubeleftback[i].verts); - for(i=0;i<nfacesleft;i++) + for (i=0;i<nfacesleft;i++) FlattenPanorama(cubeleft[i].verts); - for(i=0;i<nfacesright;i++) + for (i=0;i<nfacesright;i++) FlattenPanorama(cuberight[i].verts); - for(i=0;i<nfacesrightback;i++) + for (i=0;i<nfacesrightback;i++) FlattenPanorama(cuberightback[i].verts); - for(i=0;i<nfacestop;i++) + for (i=0;i<nfacestop;i++) FlattenPanorama(cubetop[i].verts); - for(i=0;i<nfacesbottom;i++) + for (i=0;i<nfacesbottom;i++) FlattenPanorama(cubebottom[i].verts); } @@ -1358,18 +1358,18 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) verts[i][2] = atan2(verts[i][2], 1.0); verts[i][2] /= MT_PI / 2; } - if(edge){ + if (edge){ bool right=false; for (i=0;i<3;i++){ - if(fmod(verts[i][0],1.0) > 0.0){ + if (fmod(verts[i][0],1.0) > 0.0){ right=true; break; } } - if(right){ + if (right){ for (i=0;i<3;i++){ - if(verts[i][0] < 0.0) + if (verts[i][0] < 0.0) verts[i][0] *= -1.0; } } @@ -1383,7 +1383,7 @@ void KX_Dome::SplitFace(vector <DomeFace>& face, int *nfaces) n1 = n2 = *nfaces; - for(i=0;i<n1;i++){ + for (i=0;i<n1;i++){ face[n2].verts[0] = (face[i].verts[0] + face[i].verts[1]) /2; face[n2].verts[1] = face[i].verts[1]; @@ -1635,9 +1635,9 @@ void KX_Dome::Draw(void) break; } - if(warp.usemesh) + if (warp.usemesh) { - if(fboSupported) + if (fboSupported) { m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); @@ -1793,7 +1793,7 @@ void KX_Dome::DrawDomeFisheye(void) float ortho_width, ortho_height; - if(m_mode == DOME_FISHEYE) { + if (m_mode == DOME_FISHEYE) { if (warp.usemesh) glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost @@ -1809,7 +1809,7 @@ void KX_Dome::DrawDomeFisheye(void) glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); } } - else if(m_mode == DOME_TRUNCATED_FRONT) + else if (m_mode == DOME_TRUNCATED_FRONT) { ortho_width = 1.0; ortho_height = 2 * ((float)can_height / can_width) - 1.0; @@ -1829,7 +1829,7 @@ void KX_Dome::DrawDomeFisheye(void) glLoadIdentity(); gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0); - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) + if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL); @@ -1842,7 +1842,7 @@ void KX_Dome::DrawDomeFisheye(void) glColor3f(1.0,1.0,1.0); if (dlistSupported){ - for(i=0;i<m_numfaces;i++){ + for (i=0;i<m_numfaces;i++){ glBindTexture(GL_TEXTURE_2D, domefacesId[i]); glCallList(dlistId+i); } @@ -1911,7 +1911,7 @@ void KX_Dome::DrawPanorama(void) glLoadIdentity(); gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0); - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) + if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL); @@ -1924,7 +1924,7 @@ void KX_Dome::DrawPanorama(void) glColor3f(1.0,1.0,1.0); if (dlistSupported){ - for(i=0;i<m_numfaces;i++){ + for (i=0;i<m_numfaces;i++){ glBindTexture(GL_TEXTURE_2D, domefacesId[i]); glCallList(dlistId+i); } @@ -1979,7 +1979,7 @@ void KX_Dome::DrawDomeWarped(void) glLoadIdentity(); gluLookAt(0.0, 0.0, 1.0, 0.0,0.0,0.0, 0.0,1.0,0.0); - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) + if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL); diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 5a67b052a2b..308154d8ebc 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -60,7 +60,7 @@ std::vector<STR_String> split_string(STR_String str) int begin=0, end=0; while (end < str.Length()) { - if(str.GetAt(end) == '\n') + if (str.GetAt(end) == '\n') { text.push_back(str.Mid(begin, end-begin)); begin = end+1; @@ -165,11 +165,11 @@ int GetFontId (VFont *font) void KX_FontObject::DrawText() { /* Allow for some logic brick control */ - if(this->GetProperty("Text")) + if (this->GetProperty("Text")) m_text = split_string(this->GetProperty("Text")->GetText()); /* only draws the text if visible */ - if(this->GetVisible() == 0) return; + if (this->GetVisible() == 0) return; /* update the animated color */ this->GetObjectColor().getValue(m_color); @@ -193,7 +193,7 @@ void KX_FontObject::DrawText() spacing = this->NodeGetWorldOrientation() * spacing * this->NodeGetWorldScaling()[1]; /* Draw each line, taking spacing into consideration */ - for(int i=0; i<m_text.size(); ++i) + for (int i=0; i<m_text.size(); ++i) { if (i!=0) { @@ -256,9 +256,9 @@ PyObject* KX_FontObject::pyattr_get_text(void *self_v, const KX_PYATTRIBUTE_DEF { KX_FontObject* self= static_cast<KX_FontObject*>(self_v); STR_String str = STR_String(); - for(int i=0; i<self->m_text.size(); ++i) + for (int i=0; i<self->m_text.size(); ++i) { - if(i!=0) + if (i!=0) str += '\n'; str += self->m_text[i]; } @@ -268,13 +268,13 @@ PyObject* KX_FontObject::pyattr_get_text(void *self_v, const KX_PYATTRIBUTE_DEF int KX_FontObject::pyattr_set_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_FontObject* self= static_cast<KX_FontObject*>(self_v); - if(!PyUnicode_Check(value)) + if (!PyUnicode_Check(value)) return PY_SET_ATTR_FAIL; char* chars = _PyUnicode_AsString(value); /* Allow for some logic brick control */ CValue* tprop = self->GetProperty("Text"); - if(tprop) { + if (tprop) { CValue *newstringprop = new CStringValue(STR_String(chars), "Text"); self->SetProperty("Text", newstringprop); newstringprop->Release(); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 1bc60ebd337..c77d40e8f8c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -445,7 +445,7 @@ void KX_GameObject::ProcessReplica() } #ifdef WITH_PYTHON - if(m_attr_dict) + if (m_attr_dict) m_attr_dict= PyDict_Copy(m_attr_dict); #endif @@ -588,7 +588,7 @@ void KX_GameObject::AddMeshUser() SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); // RAS_MeshSlot* ms; - for(mit.begin(); !mit.end(); ++mit) + for (mit.begin(); !mit.end(); ++mit) { (*mit)->m_OpenGLMatrix = fl; } @@ -621,7 +621,7 @@ void KX_GameObject::UpdateBuckets( bool recursive ) GetOpenGLMatrix(); SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); - for(mit.begin(); !mit.end(); ++mit) + for (mit.begin(); !mit.end(); ++mit) { ms = *mit; ms->m_bObjectColor = m_bUseObjectColor; @@ -742,11 +742,11 @@ KX_GameObject::UpdateMaterialData( if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0) { list<RAS_MeshMaterial>::iterator mit = m_meshes[mesh]->GetFirstMaterial(); - for(; mit != m_meshes[mesh]->GetLastMaterial(); ++mit) + for (; mit != m_meshes[mesh]->GetLastMaterial(); ++mit) { RAS_IPolyMaterial* poly = mit->m_bucket->GetPolyMaterial(); - if(poly->GetFlag() & RAS_BLENDERMAT ) + if (poly->GetFlag() & RAS_BLENDERMAT ) { KX_BlenderMaterial *m = static_cast<KX_BlenderMaterial*>(poly); @@ -1282,7 +1282,7 @@ void KX_GameObject::Resume(void) { if (m_suspended) { SCA_IObject::Resume(); - if(GetPhysicsController()) + if (GetPhysicsController()) GetPhysicsController()->RestoreDynamics(); m_suspended = false; @@ -1294,7 +1294,7 @@ void KX_GameObject::Suspend() if ((!m_ignore_activity_culling) && (!m_suspended)) { SCA_IObject::Suspend(); - if(GetPhysicsController()) + if (GetPhysicsController()) GetPhysicsController()->SuspendDynamics(); m_suspended = true; } @@ -1379,7 +1379,7 @@ static unsigned char mathutils_kxgameob_vector_cb_index= -1; /* index for our ca static int mathutils_kxgameob_generic_check(BaseMathObject *bmo) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; return 0; @@ -1388,7 +1388,7 @@ static int mathutils_kxgameob_generic_check(BaseMathObject *bmo) static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; #define PHYS_ERR(attr) PyErr_SetString(PyExc_AttributeError, "KX_GameObject." attr ", is missing a physics controller") @@ -1407,26 +1407,26 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) self->NodeGetWorldScaling().getValue(bmo->data); break; case MATHUTILS_VEC_CB_INERTIA_LOCAL: - if(!self->GetPhysicsController()) return PHYS_ERR("localInertia"), -1; + if (!self->GetPhysicsController()) return PHYS_ERR("localInertia"), -1; self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data); break; case MATHUTILS_VEC_CB_OBJECT_COLOR: self->GetObjectColor().getValue(bmo->data); break; case MATHUTILS_VEC_CB_LINVEL_LOCAL: - if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1; + if (!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1; self->GetLinearVelocity(true).getValue(bmo->data); break; case MATHUTILS_VEC_CB_LINVEL_GLOBAL: - if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1; + if (!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1; self->GetLinearVelocity(false).getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGVEL_LOCAL: - if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1; + if (!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1; self->GetAngularVelocity(true).getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: - if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1; + if (!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1; self->GetAngularVelocity(false).getValue(bmo->data); break; @@ -1440,7 +1440,7 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; switch(subtype) { @@ -1485,7 +1485,7 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index) { /* lazy, avoid repeteing the case statement */ - if(mathutils_kxgameob_vector_get(bmo, subtype) == -1) + if (mathutils_kxgameob_vector_get(bmo, subtype) == -1) return -1; return 0; } @@ -1495,7 +1495,7 @@ static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, float f= bmo->data[index]; /* lazy, avoid repeteing the case statement */ - if(mathutils_kxgameob_vector_get(bmo, subtype) == -1) + if (mathutils_kxgameob_vector_get(bmo, subtype) == -1) return -1; bmo->data[index]= f; @@ -1519,7 +1519,7 @@ static unsigned char mathutils_kxgameob_matrix_cb_index= -1; /* index for our ca static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; switch(subtype) { @@ -1538,7 +1538,7 @@ static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype) static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; MT_Matrix3x3 mat3x3; @@ -1713,7 +1713,7 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args) } #ifdef USE_BULLET /* gameobj and mesh can be NULL */ - if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) + if (KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) Py_RETURN_TRUE; #endif Py_RETURN_FALSE; @@ -1732,7 +1732,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) } /* first see if the attributes a string and try get the cvalue attribute */ - if(attr_str && (resultattr=self->GetProperty(attr_str))) { + if (attr_str && (resultattr=self->GetProperty(attr_str))) { pyconvert = resultattr->ConvertValueToPython(); return pyconvert ? pyconvert:resultattr->GetProxy(); } @@ -1745,7 +1745,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) return pyconvert; } else { - if(attr_str) PyErr_Format(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key \"%s\" does not exist", attr_str); + if (attr_str) PyErr_Format(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key \"%s\" does not exist", attr_str); else PyErr_SetString(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key does not exist"); return NULL; } @@ -1757,7 +1757,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) { KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v); const char *attr_str= _PyUnicode_AsString(key); - if(attr_str==NULL) + if (attr_str==NULL) PyErr_Clear(); if (self==NULL) { @@ -1769,14 +1769,14 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) int del= 0; /* try remove both just in case */ - if(attr_str) + if (attr_str) del |= (self->RemoveProperty(attr_str)==true) ? 1:0; - if(self->m_attr_dict) + if (self->m_attr_dict) del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; if (del==0) { - if(attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str); + if (attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str); else PyErr_SetString(PyExc_KeyError, "del gameOb[key]: KX_GameObject, key could not be deleted"); return -1; } @@ -1788,11 +1788,11 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) int set= 0; /* as CValue */ - if(attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* don't allow GameObjects for eg to be assigned to CValue props */ + if (attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* don't allow GameObjects for eg to be assigned to CValue props */ { CValue* vallie = self->ConvertPythonToValue(val, ""); /* error unused */ - if(vallie) + if (vallie) { CValue* oldprop = self->GetProperty(attr_str); @@ -1815,25 +1815,25 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) } } - if(set==0) + if (set==0) { if (self->m_attr_dict==NULL) /* lazy init */ self->m_attr_dict= PyDict_New(); - if(PyDict_SetItem(self->m_attr_dict, key, val)==0) + if (PyDict_SetItem(self->m_attr_dict, key, val)==0) { - if(attr_str) + if (attr_str) self->RemoveProperty(attr_str); /* overwrite the CValue if it exists */ set= 1; } else { - if(attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" not be added to internal dictionary", attr_str); + if (attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" not be added to internal dictionary", attr_str); else PyErr_SetString(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key not be added to internal dictionary"); } } - if(set==0) + if (set==0) return -1; /* pythons error value */ } @@ -1850,7 +1850,7 @@ static int Seq_Contains(PyObject *self_v, PyObject *value) return -1; } - if(PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value))) + if (PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value))) return 1; if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value)) @@ -2406,7 +2406,7 @@ PyObject* KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DE PyObject *meshes= PyList_New(self->m_meshes.size()); int i; - for(i=0; i < (int)self->m_meshes.size(); i++) + for (i=0; i < (int)self->m_meshes.size(); i++) { KX_MeshProxy* meshproxy = new KX_MeshProxy(self->m_meshes[i]); PyList_SET_ITEM(meshes, i, meshproxy->NewProxy(true)); @@ -2469,7 +2469,7 @@ PyObject* KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_ { KX_GameObject* self= static_cast<KX_GameObject*>(self_v); - if(self->m_attr_dict==NULL) + if (self->m_attr_dict==NULL) self->m_attr_dict= PyDict_New(); Py_INCREF(self->m_attr_dict); @@ -2653,7 +2653,7 @@ PyObject* KX_GameObject::PyGetReactionForce() PyObject* KX_GameObject::PyEnableRigidBody() { - if(GetPhysicsController()) + if (GetPhysicsController()) GetPhysicsController()->setRigidBody(true); Py_RETURN_NONE; @@ -2663,7 +2663,7 @@ PyObject* KX_GameObject::PyEnableRigidBody() PyObject* KX_GameObject::PyDisableRigidBody() { - if(GetPhysicsController()) + if (GetPhysicsController()) GetPhysicsController()->setRigidBody(false); Py_RETURN_NONE; @@ -2806,7 +2806,7 @@ PyObject* KX_GameObject::PyGetPropertyNames() { PyObject *list= ConvertKeysToPython(); - if(m_attr_dict) { + if (m_attr_dict) { PyObject *key, *value; Py_ssize_t pos = 0; @@ -3311,11 +3311,11 @@ PyObject* KX_GameObject::Pyget(PyObject *args) return NULL; - if(PyUnicode_Check(key)) { + if (PyUnicode_Check(key)) { CValue *item = GetProperty(_PyUnicode_AsString(key)); if (item) { ret = item->ConvertValueToPython(); - if(ret) + if (ret) return ret; else return item->GetProxy(); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index facac230e05..f088d548089 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -194,7 +194,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) KX_KetsjiEngine::~KX_KetsjiEngine() { delete m_logger; - if(m_usedome) + if (m_usedome) delete m_dome; } @@ -317,7 +317,7 @@ void KX_KetsjiEngine::RenderDome() RenderShadowBuffers(scene); } // Avoid drawing the scene with the active camera twice when it's viewport is enabled - if(cam && !cam->GetViewport()) + if (cam && !cam->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -336,7 +336,7 @@ void KX_KetsjiEngine::RenderDome() list<KX_Camera*>::iterator it = cameras->begin(); while(it != cameras->end()) { - if((*it)->GetViewport()) + if ((*it)->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -431,7 +431,7 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo) void KX_KetsjiEngine::ClearFrame() { // clear unless we're drawing overlapping stereo - if(m_rasterizer->InterlacedStereo() && + if (m_rasterizer->InterlacedStereo() && m_rasterizer->GetEye() == RAS_IRasterizer::RAS_STEREO_RIGHTEYE) return; @@ -447,29 +447,29 @@ void KX_KetsjiEngine::ClearFrame() list<class KX_Camera*>* cameras = scene->GetCameras(); list<KX_Camera*>::iterator it; - for(it = cameras->begin(); it != cameras->end(); it++) + for (it = cameras->begin(); it != cameras->end(); it++) { GetSceneViewport(scene, (*it), area, viewport); - if(!doclear) { + if (!doclear) { clearvp = viewport; doclear = true; } else { - if(viewport.GetLeft() < clearvp.GetLeft()) + if (viewport.GetLeft() < clearvp.GetLeft()) clearvp.SetLeft(viewport.GetLeft()); - if(viewport.GetBottom() < clearvp.GetBottom()) + if (viewport.GetBottom() < clearvp.GetBottom()) clearvp.SetBottom(viewport.GetBottom()); - if(viewport.GetRight() > clearvp.GetRight()) + if (viewport.GetRight() > clearvp.GetRight()) clearvp.SetRight(viewport.GetRight()); - if(viewport.GetTop() > clearvp.GetTop()) + if (viewport.GetTop() > clearvp.GetTop()) clearvp.SetTop(viewport.GetTop()); } } } - if(doclear) { + if (doclear) { KX_Scene* firstscene = *m_scenes.begin(); SetBackGround(firstscene->GetWorldInfo()); @@ -694,7 +694,7 @@ else scene->setSuspendedTime(0.0); } // suspended else - if(scene->getSuspendedTime()==0.0) + if (scene->getSuspendedTime()==0.0) scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); @@ -768,7 +768,7 @@ else scene->setSuspendedTime(0.0); } // suspended else - if(scene->getSuspendedTime()==0.0) + if (scene->getSuspendedTime()==0.0) scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); @@ -806,7 +806,7 @@ else void KX_KetsjiEngine::Render() { - if(m_usedome){ + if (m_usedome){ RenderDome(); return; } @@ -872,7 +872,7 @@ void KX_KetsjiEngine::Render() RenderShadowBuffers(scene); // Avoid drawing the scene with the active camera twice when it's viewport is enabled - if(cam && !cam->GetViewport()) + if (cam && !cam->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -889,7 +889,7 @@ void KX_KetsjiEngine::Render() list<KX_Camera*>::iterator it = cameras->begin(); while(it != cameras->end()) { - if((*it)->GetViewport()) + if ((*it)->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -906,7 +906,7 @@ void KX_KetsjiEngine::Render() } // only one place that checks for stereo - if(m_rasterizer->Stereo()) + if (m_rasterizer->Stereo()) { m_rasterizer->SetEye(RAS_IRasterizer::RAS_STEREO_RIGHTEYE); @@ -939,7 +939,7 @@ void KX_KetsjiEngine::Render() list<KX_Camera*>::iterator it = cameras->begin(); while(it != cameras->end()) { - if((*it)->GetViewport()) + if ((*it)->GetViewport()) { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -954,7 +954,7 @@ void KX_KetsjiEngine::Render() } PostRenderScene(scene); } - } // if(m_rasterizer->Stereo()) + } // if (m_rasterizer->Stereo()) EndFrame(); } @@ -985,7 +985,7 @@ int KX_KetsjiEngine::GetExitCode() } // check if the window has been closed. - if(!m_exitcode) + if (!m_exitcode) { //if(!m_canvas->Check()) { // m_exitcode = KX_EXIT_REQUEST_OUTSIDE; @@ -1119,7 +1119,7 @@ void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect // Don't do bars on user specified viewport RAS_FrameSettings settings = scene->GetFramingType(); - if(settings.FrameType() == RAS_FrameSettings::e_frame_bars) + if (settings.FrameType() == RAS_FrameSettings::e_frame_bars) settings.SetFrameType(RAS_FrameSettings::e_frame_extend); RAS_FramingManager::ComputeViewport( @@ -1155,14 +1155,14 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene) m_rendertools->SetAuxilaryClientInfo(scene); - for(i=0; i<lightlist->GetCount(); i++) { + for (i=0; i<lightlist->GetCount(); i++) { KX_GameObject *gameobj = (KX_GameObject*)lightlist->GetValue(i); KX_LightObject *light = (KX_LightObject*)gameobj; light->Update(); - if(m_drawingmode == RAS_IRasterizer::KX_TEXTURED && light->HasShadowBuffer()) { + if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED && light->HasShadowBuffer()) { /* make temporary camera */ RAS_CameraData camdata = RAS_CameraData(); KX_Camera *cam = new KX_Camera(scene, scene->m_callbacks, camdata, true, true); @@ -1238,7 +1238,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) focallength = cam->GetFocalLength(); MT_Matrix4x4 projmat; - if(override_camera) { + if (override_camera) { nearfrust = m_overrideCamNear; farfrust = m_overrideCamFar; } diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index b174b4f701e..7e9d95b37a2 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -67,7 +67,7 @@ KX_LightObject::~KX_LightObject() { GPULamp *lamp; - if((lamp = GetGPULamp())) { + if ((lamp = GetGPULamp())) { float obmat[4][4] = {{0}}; GPU_lamp_update(lamp, 0, 0, obmat); } @@ -95,18 +95,18 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) float vec[4]; int scenelayer = ~0; - if(kxscene && kxscene->GetBlenderScene()) + if (kxscene && kxscene->GetBlenderScene()) scenelayer = kxscene->GetBlenderScene()->lay; /* only use lights in the same layer as the object */ - if(!(m_lightobj.m_layer & oblayer)) + if (!(m_lightobj.m_layer & oblayer)) return false; /* only use lights in the same scene, and in a visible layer */ - if(kxscene != lightscene || !(m_lightobj.m_layer & scenelayer)) + if (kxscene != lightscene || !(m_lightobj.m_layer & scenelayer)) return false; // lights don't get their openGL matrix updated, do it now - if(GetSGNode()->IsDirty()) + if (GetSGNode()->IsDirty()) GetOpenGLMatrix(); MT_CmMatrix4x4& worldmatrix= *GetOpenGLMatrixPtr(); @@ -116,7 +116,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) vec[2] = worldmatrix(2,3); vec[3] = 1.0f; - if(m_lightobj.m_type==RAS_LightObject::LIGHT_SUN) { + if (m_lightobj.m_type==RAS_LightObject::LIGHT_SUN) { vec[0] = worldmatrix(0,2); vec[1] = worldmatrix(1,2); @@ -136,7 +136,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) //attennuation still is acceptable glLightf((GLenum)(GL_LIGHT0+slot), GL_QUADRATIC_ATTENUATION, m_lightobj.m_att2/(m_lightobj.m_distance*m_lightobj.m_distance)); - if(m_lightobj.m_type==RAS_LightObject::LIGHT_SPOT) { + if (m_lightobj.m_type==RAS_LightObject::LIGHT_SPOT) { vec[0] = -worldmatrix(0,2); vec[1] = -worldmatrix(1,2); vec[2] = -worldmatrix(2,2); @@ -162,7 +162,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) } glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec); - if(m_lightobj.m_nospecular) + if (m_lightobj.m_nospecular) { vec[0] = vec[1] = vec[2] = vec[3] = 0.0; } @@ -181,7 +181,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) GPULamp *KX_LightObject::GetGPULamp() { - if(m_glsl) + if (m_glsl) return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject()); else return NULL; @@ -191,15 +191,15 @@ void KX_LightObject::Update() { GPULamp *lamp; - if((lamp = GetGPULamp()) != NULL && GetSGNode()) { + if ((lamp = GetGPULamp()) != NULL && GetSGNode()) { float obmat[4][4]; // lights don't get their openGL matrix updated, do it now if (GetSGNode()->IsDirty()) GetOpenGLMatrix(); double *dobmat = GetOpenGLMatrixPtr()->getPointer(); - for(int i=0; i<4; i++) - for(int j=0; j<4; j++, dobmat++) + for (int i=0; i<4; i++) + for (int j=0; j<4; j++, dobmat++) obmat[i][j] = (float)*dobmat; GPU_lamp_update(lamp, m_lightobj.m_layer, 0, obmat); @@ -212,7 +212,7 @@ bool KX_LightObject::HasShadowBuffer() { GPULamp *lamp; - if((lamp = GetGPULamp())) + if ((lamp = GetGPULamp())) return GPU_lamp_has_shadow_buffer(lamp); else return false; @@ -222,7 +222,7 @@ int KX_LightObject::GetShadowLayer() { GPULamp *lamp; - if((lamp = GetGPULamp())) + if ((lamp = GetGPULamp())) return GPU_lamp_shadow_layer(lamp); else return 0; @@ -347,7 +347,7 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT const char* type = attrdef->m_name; - if(!strcmp(type, "SPOT")) { + if (!strcmp(type, "SPOT")) { retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT); } else if (!strcmp(type, "SUN")) { retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN); @@ -373,7 +373,7 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr { KX_LightObject* self = static_cast<KX_LightObject*>(self_v); int val = PyLong_AsSsize_t(value); - if((val==-1 && PyErr_Occurred()) || val<0 || val>2) { + if ((val==-1 && PyErr_Occurred()) || val<0 || val>2) { PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2"); return PY_SET_ATTR_FAIL; } diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index fa1366874a3..f1a9a93c2db 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -184,7 +184,7 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds) RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex); - if(vertex==NULL) { + if (vertex==NULL) { PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indices"); return NULL; } @@ -230,11 +230,11 @@ PyObject* KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_ list<RAS_MeshMaterial>::iterator mit= self->m_meshobj->GetFirstMaterial(); - for(i=0; i<tot; mit++, i++) { + for (i=0; i<tot; mit++, i++) { RAS_IPolyMaterial *polymat = mit->m_bucket->GetPolyMaterial(); /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(polymat->GetFlag() & RAS_BLENDERMAT) + if (polymat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial *mat = static_cast<KX_BlenderMaterial*>(polymat); PyList_SET_ITEM(materials, i, mat->GetProxy()); diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 0d81883104b..bfee124d443 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -114,7 +114,7 @@ bool KX_MouseFocusSensor::Evaluate() if (!m_mouse_over_in_previous_frame) { result = true; } - else if(m_bTouchPulse && (m_hitObject != m_hitObject_Last)) { + else if (m_bTouchPulse && (m_hitObject != m_hitObject_Last)) { result = true; } } @@ -303,7 +303,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus() KX_Camera *cam= m_kxscene->GetActiveCamera(); - if(ParentObjectHasFocusCamera(cam)) + if (ParentObjectHasFocusCamera(cam)) return true; list<class KX_Camera*>* cameras = m_kxscene->GetCameras(); @@ -311,7 +311,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus() while(it != cameras->end()) { - if(((*it) != cam) && (*it)->GetViewport()) + if (((*it) != cam) && (*it)->GetViewport()) if (ParentObjectHasFocusCamera(*it)) return true; @@ -408,7 +408,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_P { KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v); MT_Vector3 dir = self->RayTarget() - self->RaySource(); - if(MT_fuzzyZero(dir)) dir.setValue(0,0,0); + if (MT_fuzzyZero(dir)) dir.setValue(0,0,0); else dir.normalize(); return PyObjectFrom(dir); } @@ -417,7 +417,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYAT { KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v); - if(self->m_hitObject) + if (self->m_hitObject) return self->m_hitObject->GetProxy(); Py_RETURN_NONE; diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 79e9c28a81c..2368ff97a14 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -420,7 +420,7 @@ bool KX_NavMeshObject::BuildNavMesh() } // setup triangles. unsigned char* tri = navDTris; - for(size_t i=0; i<ndtris; i++) + for (size_t i=0; i<ndtris; i++) { for (size_t j=0; j<3; j++) tri[4*i+j] = j; @@ -432,7 +432,7 @@ bool KX_NavMeshObject::BuildNavMesh() memcpy(navDVerts, dvertices, ndvertsuniq*3*sizeof(float)); //tris unsigned char* tri = navDTris; - for(size_t i=0; i<ndtris; i++) + for (size_t i=0; i<ndtris; i++) { for (size_t j=0; j<3; j++) tri[4*i+j] = dtris[6*i+j]; diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index acd9cc53428..a3f098c3b1f 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -390,7 +390,7 @@ static unsigned char mathutils_kxobactu_vector_cb_index = -1; /* index for our c static int mathutils_obactu_generic_check(BaseMathObject *bmo) { KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; return 0; @@ -399,7 +399,7 @@ static int mathutils_obactu_generic_check(BaseMathObject *bmo) static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype) { KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; switch(subtype) { @@ -417,7 +417,7 @@ static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype) static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) { KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user); - if(self==NULL) + if (self==NULL) return -1; switch(subtype) { @@ -435,7 +435,7 @@ static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index) { /* lazy, avoid repeteing the case statement */ - if(mathutils_obactu_vector_get(bmo, subtype) == -1) + if (mathutils_obactu_vector_get(bmo, subtype) == -1) return -1; return 0; } @@ -445,7 +445,7 @@ static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, i float f= bmo->data[index]; /* lazy, avoid repeteing the case statement */ - if(mathutils_obactu_vector_get(bmo, subtype) == -1) + if (mathutils_obactu_vector_get(bmo, subtype) == -1) return -1; bmo->data[index]= f; @@ -629,7 +629,7 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB if (actuator->m_reference) actuator->m_reference->UnregisterActuator(actuator); - if(refOb==NULL) { + if (refOb==NULL) { actuator->m_reference= NULL; } else { diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp index caef8ba5e2e..85c88337d60 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.cpp +++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp @@ -259,7 +259,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial, "getMaterial() : returns a material\n") { RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial(); - if(polymat->GetFlag() & RAS_BLENDERMAT) + if (polymat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat); return mat->GetProxy(); diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 29127ec11a0..a85ba488fbc 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -182,7 +182,7 @@ void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& c else GPU_set_tpage(NULL, 0, 0); - if(m_drawingmode & RAS_IRasterizer::KX_BACKCULL) + if (m_drawingmode & RAS_IRasterizer::KX_BACKCULL) rasty->SetCullFace(true); else rasty->SetCullFace(false); diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index deb69fe494b..556d451cf66 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -666,7 +666,7 @@ PyObject* initPythonConstraintBinding() /* Use existing module where possible * be careful not to init any runtime vars after this */ m = PyImport_ImportModule( "PhysicsConstraints" ); - if(m) { + if (m) { Py_DECREF(m); return m; } diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp index dd32284a807..9c5e043477c 100644 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ b/source/gameengine/Ketsji/KX_PyMath.cpp @@ -82,7 +82,7 @@ bool PyOrientationTo(PyObject* pyval, MT_Matrix3x3 &rot, const char *error_prefi bool PyQuatTo(PyObject* pyval, MT_Quaternion &qrot) { - if(!PyVecTo(pyval, qrot)) + if (!PyVecTo(pyval, qrot)) return false; /* annoying!, Blender/Mathutils have the W axis first! */ @@ -106,7 +106,7 @@ PyObject* PyObjectFrom(const MT_Matrix4x4 &mat) PyObject *col; int i; - for(i=0; i < 4; i++) { + for (i=0; i < 4; i++) { col = PyList_New(4); PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i])); @@ -130,7 +130,7 @@ PyObject* PyObjectFrom(const MT_Matrix3x3 &mat) PyObject *col; int i; - for(i=0; i < 3; i++) { + for (i=0; i < 3; i++) { col = PyList_New(3); PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i])); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index b804bacf79e..0ca84870944 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -523,7 +523,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args) BLI_split_dir_part(gp_GamePythonPath, cpath, sizeof(cpath)); } - if((dp = opendir(cpath)) == NULL) { + if ((dp = opendir(cpath)) == NULL) { /* todo, show the errno, this shouldnt happen anyway if the blendfile is readable */ fprintf(stderr, "Could not read directoty (%s) failed, code %d (%s)\n", cpath, errno, strerror(errno)); return list; @@ -607,7 +607,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) support= GLEW_ARB_vertex_shader; pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no.")); count = 1; - if(support){ + if (support){ pprint(" ----------Details----------"); int max=0; glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max); @@ -627,7 +627,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) support=GLEW_ARB_fragment_shader; pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no.")); count = 1; - if(support){ + if (support){ pprint(" ----------Details----------"); int max=0; glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max); @@ -638,7 +638,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) support = GLEW_ARB_texture_cube_map; pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no.")); count = 1; - if(support){ + if (support){ pprint(" ----------Details----------"); int size=0; glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size); @@ -649,7 +649,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) support = GLEW_ARB_multitexture; count = 1; pprint(" GL_ARB_multitexture supported? "<< (support?"yes.":"no.")); - if(support){ + if (support){ pprint(" ----------Details----------"); int units=0; glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units); @@ -660,7 +660,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) pprint(" GL_ARB_texture_env_combine supported? "<< (GLEW_ARB_texture_env_combine?"yes.":"no.")); count = 1; - if(!count) + if (!count) pprint("No extenstions are used in this build"); Py_RETURN_NONE; @@ -697,14 +697,14 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds) BLI_strncpy(abs_path, path, sizeof(abs_path)); BLI_path_abs(abs_path, gp_GamePythonPath); - if(kx_scene->GetSceneConverter()->LinkBlendFilePath(abs_path, group, kx_scene, &err_str, options)) { + if (kx_scene->GetSceneConverter()->LinkBlendFilePath(abs_path, group, kx_scene, &err_str, options)) { Py_RETURN_TRUE; } } else { - if(kx_scene->GetSceneConverter()->LinkBlendFileMemory(py_buffer.buf, py_buffer.len, path, group, kx_scene, &err_str, options)) { + if (kx_scene->GetSceneConverter()->LinkBlendFileMemory(py_buffer.buf, py_buffer.len, path, group, kx_scene, &err_str, options)) { PyBuffer_Release(&py_buffer); Py_RETURN_TRUE; } @@ -712,7 +712,7 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds) PyBuffer_Release(&py_buffer); } - if(err_str) { + if (err_str) { PyErr_SetString(PyExc_ValueError, err_str); return NULL; } @@ -732,14 +732,14 @@ static PyObject *gLibNew(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args,"ssO!:LibNew",&path, &group, &PyList_Type, &names)) return NULL; - if(kx_scene->GetSceneConverter()->GetMainDynamicPath(path)) + if (kx_scene->GetSceneConverter()->GetMainDynamicPath(path)) { PyErr_SetString(PyExc_KeyError, "the name of the path given exists"); return NULL; } idcode= BKE_idcode_from_name(group); - if(idcode==0) { + if (idcode==0) { PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group); return NULL; } @@ -749,14 +749,14 @@ static PyObject *gLibNew(PyObject*, PyObject* args) strncpy(maggie->name, path, sizeof(maggie->name)-1); /* Copy the object into main */ - if(idcode==ID_ME) { + if (idcode==ID_ME) { PyObject *ret= PyList_New(0); PyObject *item; - for(Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) { + for (Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) { name= _PyUnicode_AsString(PyList_GET_ITEM(names, i)); - if(name) { + if (name) { RAS_MeshObject *meshobj= kx_scene->GetSceneConverter()->ConvertMeshSpecial(kx_scene, maggie, name); - if(meshobj) { + if (meshobj) { KX_MeshProxy* meshproxy = new KX_MeshProxy(meshobj); item= meshproxy->NewProxy(true); PyList_Append(ret, item); @@ -1113,17 +1113,17 @@ static PyObject* gPyDisableMotionBlur(PyObject*) static int getGLSLSettingFlag(const char *setting) { - if(strcmp(setting, "lights") == 0) + if (strcmp(setting, "lights") == 0) return GAME_GLSL_NO_LIGHTS; - else if(strcmp(setting, "shaders") == 0) + else if (strcmp(setting, "shaders") == 0) return GAME_GLSL_NO_SHADERS; - else if(strcmp(setting, "shadows") == 0) + else if (strcmp(setting, "shadows") == 0) return GAME_GLSL_NO_SHADOWS; - else if(strcmp(setting, "ramps") == 0) + else if (strcmp(setting, "ramps") == 0) return GAME_GLSL_NO_RAMPS; - else if(strcmp(setting, "nodes") == 0) + else if (strcmp(setting, "nodes") == 0) return GAME_GLSL_NO_NODES; - else if(strcmp(setting, "extra_textures") == 0) + else if (strcmp(setting, "extra_textures") == 0) return GAME_GLSL_NO_EXTRA_TEX; else return -1; @@ -1155,14 +1155,14 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*, gs->glslflag |= flag; /* display lists and GLSL materials need to be remade */ - if(sceneflag != gs->glslflag) { + if (sceneflag != gs->glslflag) { GPU_materials_free(); - if(gp_KetsjiEngine) { + if (gp_KetsjiEngine) { KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes(); KX_SceneList::iterator it; - for(it=scenes->begin(); it!=scenes->end(); it++) - if((*it)->GetBucketManager()) { + for (it=scenes->begin(); it!=scenes->end(); it++) + if ((*it)->GetBucketManager()) { (*it)->GetBucketManager()->ReleaseDisplayLists(); (*it)->GetBucketManager()->ReleaseMaterials(); } @@ -1208,11 +1208,11 @@ static PyObject* gPySetMaterialType(PyObject*, if (!PyArg_ParseTuple(args,"i:setMaterialType",&type)) return NULL; - if(type == KX_BLENDER_GLSL_MATERIAL) + if (type == KX_BLENDER_GLSL_MATERIAL) gs->matmode= GAME_MAT_GLSL; - else if(type == KX_BLENDER_MULTITEX_MATERIAL) + else if (type == KX_BLENDER_MULTITEX_MATERIAL) gs->matmode= GAME_MAT_MULTITEX; - else if(type == KX_TEXFACE_MATERIAL) + else if (type == KX_TEXFACE_MATERIAL) gs->matmode= GAME_MAT_TEXFACE; else { PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known"); @@ -1227,9 +1227,9 @@ static PyObject* gPyGetMaterialType(PyObject*) GlobalSettings *gs= gp_KetsjiEngine->GetGlobalSettings(); int flag; - if(gs->matmode == GAME_MAT_GLSL) + if (gs->matmode == GAME_MAT_GLSL) flag = KX_BLENDER_GLSL_MATERIAL; - else if(gs->matmode == GAME_MAT_MULTITEX) + else if (gs->matmode == GAME_MAT_MULTITEX) flag = KX_BLENDER_MULTITEX_MATERIAL; else flag = KX_TEXFACE_MATERIAL; @@ -1381,7 +1381,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack /* Use existing module where possible * be careful not to init any runtime vars after this */ m = PyImport_ImportModule( "GameLogic" ); - if(m) { + if (m) { Py_DECREF(m); return m; } @@ -1762,7 +1762,7 @@ static void initPySysObjects__append(PyObject *sys_path, const char *filename) // printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath); - if(PySequence_Index(sys_path, item) == -1) { + if (PySequence_Index(sys_path, item) == -1) { PyErr_Clear(); /* PySequence_Index sets a ValueError */ PyList_Insert(sys_path, 0, item); } @@ -1859,7 +1859,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur Py_Initialize(); - if(argv && first_time) { /* browser plugins don't currently set this */ + if (argv && first_time) { /* browser plugins don't currently set this */ // Until python support ascii again, we use our own. // PySys_SetArgv(argc, argv); int i; @@ -1971,7 +1971,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * { PyObject* dictionaryobject; - if(argv) /* player only */ + if (argv) /* player only */ dictionaryobject= initGamePlayerPythonScripting("Ketsji", psl_Lowest, blenderdata, argc, argv); else dictionaryobject= initGamePythonScripting("Ketsji", psl_Lowest, blenderdata); @@ -1981,7 +1981,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * *gameLogic = initGameLogic(ketsjiengine, startscene); /* is set in initGameLogic so only set here if we want it to persist between scenes */ - if(pyGlobalDict) + if (pyGlobalDict) PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module. *gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic)); @@ -2027,7 +2027,7 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas) /* Use existing module where possible * be careful not to init any runtime vars after this */ m = PyImport_ImportModule( "Rasterizer" ); - if(m) { + if (m) { Py_DECREF(m); return m; } @@ -2111,7 +2111,7 @@ static PyObject* gPyEventToCharacter(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args,"ii:EventToCharacter", &event, &shift)) return NULL; - if(IsPrintable(event)) { + if (IsPrintable(event)) { char ch[2] = {'\0', '\0'}; ch[0] = ToCharacter(event, (bool)shift); return PyUnicode_FromString(ch); @@ -2148,7 +2148,7 @@ PyObject* initGameKeys() /* Use existing module where possible */ m = PyImport_ImportModule( "GameKeys" ); - if(m) { + if (m) { Py_DECREF(m); return m; } diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index 6a60fc08244..84c5e019e47 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -107,7 +107,7 @@ static void PyType_Attr_Set(PyGetSetDef *attr_getset, PyAttributeDef *attr) attr_getset->get= reinterpret_cast<getter>(PyObjectPlus::py_get_attrdef); - if(attr->m_access==KX_PYATTRIBUTE_RO) + if (attr->m_access==KX_PYATTRIBUTE_RO) attr_getset->set= NULL; else attr_getset->set= reinterpret_cast<setter>(PyObjectPlus::py_set_attrdef); @@ -119,35 +119,35 @@ static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *a { PyAttributeDef *attr; - if(init_getset) { + if (init_getset) { /* we need to do this for all types before calling PyType_Ready * since they will call the parents PyType_Ready and those might not have initialized vars yet */ //if(tp->tp_base==NULL) // printf("Debug: No Parents - '%s'\n" , tp->tp_name); - if(tp->tp_getset==NULL && ((attributes && attributes->m_name) || (attributesPtr && attributesPtr->m_name))) { + if (tp->tp_getset==NULL && ((attributes && attributes->m_name) || (attributesPtr && attributesPtr->m_name))) { PyGetSetDef *attr_getset; int attr_tot= 0; if (attributes) { - for(attr= attributes; attr->m_name; attr++, attr_tot++) + for (attr= attributes; attr->m_name; attr++, attr_tot++) attr->m_usePtr = false; } if (attributesPtr) { - for(attr= attributesPtr; attr->m_name; attr++, attr_tot++) + for (attr= attributesPtr; attr->m_name; attr++, attr_tot++) attr->m_usePtr = true; } tp->tp_getset = attr_getset = reinterpret_cast<PyGetSetDef *>(PyMem_Malloc((attr_tot+1) * sizeof(PyGetSetDef))); // XXX - Todo, free if (attributes) { - for(attr= attributes; attr->m_name; attr++, attr_getset++) { + for (attr= attributes; attr->m_name; attr++, attr_getset++) { PyType_Attr_Set(attr_getset, attr); } } if (attributesPtr) { - for(attr= attributesPtr; attr->m_name; attr++, attr_getset++) { + for (attr= attributesPtr; attr->m_name; attr++, attr_getset++) { PyType_Attr_Set(attr_getset, attr); } } @@ -179,7 +179,7 @@ void initPyTypes(void) Py_DECREF(mod); - for(int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */ + for (int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */ PyType_Ready_Attr(dict, BL_ActionActuator, init_getset); PyType_Ready_Attr(dict, BL_Shader, init_getset); PyType_Ready_Attr(dict, BL_ShapeActionActuator, init_getset); diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 959127def5c..6eadc0cbef3 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -73,7 +73,7 @@ static Py_ssize_t KX_PythonSeq_len( PyObject * self ) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, "len(seq): "BGE_PROXY_ERROR_MSG); return -1; } @@ -104,7 +104,7 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, "val = seq[i]: "BGE_PROXY_ERROR_MSG); return NULL; } @@ -113,8 +113,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_CONT_TYPE_SENSORS: { vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors(); - if(index<0) index += linkedsensors.size(); - if(index<0 || index>= linkedsensors.size()) { + if (index<0) index += linkedsensors.size(); + if (index<0 || index>= linkedsensors.size()) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -123,8 +123,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_CONT_TYPE_ACTUATORS: { vector<SCA_IActuator*>& linkedactuators = ((SCA_IController *)self_plus)->GetLinkedActuators(); - if(index<0) index += linkedactuators.size(); - if(index<0 || index>= linkedactuators.size()) { + if (index<0) index += linkedactuators.size(); + if (index<0 || index>= linkedactuators.size()) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -133,8 +133,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_OB_TYPE_SENSORS: { SCA_SensorList& linkedsensors= ((KX_GameObject *)self_plus)->GetSensors(); - if(index<0) index += linkedsensors.size(); - if(index<0 || index>= linkedsensors.size()) { + if (index<0) index += linkedsensors.size(); + if (index<0 || index>= linkedsensors.size()) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -143,8 +143,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_OB_TYPE_CONTROLLERS: { SCA_ControllerList& linkedcontrollers= ((KX_GameObject *)self_plus)->GetControllers(); - if(index<0) index += linkedcontrollers.size(); - if(index<0 || index>= linkedcontrollers.size()) { + if (index<0) index += linkedcontrollers.size(); + if (index<0 || index>= linkedcontrollers.size()) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -153,8 +153,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_OB_TYPE_ACTUATORS: { SCA_ActuatorList& linkedactuators= ((KX_GameObject *)self_plus)->GetActuators(); - if(index<0) index += linkedactuators.size(); - if(index<0 || index>= linkedactuators.size()) { + if (index<0) index += linkedactuators.size(); + if (index<0 || index>= linkedactuators.size()) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -163,9 +163,9 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: { int nb_constraint = ((BL_ArmatureObject *)self_plus)->GetConstraintNumber(); - if(index<0) + if (index<0) index += nb_constraint; - if(index<0 || index>= nb_constraint) { + if (index<0 || index>= nb_constraint) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -174,9 +174,9 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) case KX_PYGENSEQ_OB_TYPE_CHANNELS: { int nb_channel = ((BL_ArmatureObject *)self_plus)->GetChannelNumber(); - if(index<0) + if (index<0) index += nb_channel; - if(index<0 || index>= nb_channel) { + if (index<0 || index>= nb_channel) { PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); return NULL; } @@ -268,7 +268,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, "val = seq[key], KX_PythonSeq: "BGE_PROXY_ERROR_MSG); return NULL; } @@ -280,7 +280,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key) const char *name = _PyUnicode_AsString(key); PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name); - if(ret) { + if (ret) { return ret->GetProxy(); } else { PyErr_Format( PyExc_KeyError, "requested item \"%s\" does not exist", name); @@ -298,16 +298,16 @@ static int KX_PythonSeq_contains(PyObject *self, PyObject *key) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG); return -1; } - if(!PyUnicode_Check(key)) { + if (!PyUnicode_Check(key)) { PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string"); return -1; } - if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key))) + if (KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key))) return 1; return 0; @@ -323,7 +323,7 @@ PyObject* KX_PythonSeq_get(PyObject * self, PyObject *args) if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) return NULL; - if((ret_plus = KX_PythonSeq_subscript__internal(self, key))) + if ((ret_plus = KX_PythonSeq_subscript__internal(self, key))) return ret_plus->GetProxy(); Py_INCREF(def); @@ -361,7 +361,7 @@ PyMethodDef KX_PythonSeq_methods[] = { static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self) { - if(BGE_PROXY_REF(self->base)==NULL) { + if (BGE_PROXY_REF(self->base)==NULL) { PyErr_SetString(PyExc_SystemError, "for i in seq: "BGE_PROXY_ERROR_MSG); return NULL; } @@ -386,7 +386,7 @@ static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self) PyObject *object = KX_PythonSeq_getIndex((PyObject *)self, self->iter); self->iter++; - if( object==NULL ) { + if ( object==NULL ) { self->iter= -1; /* for reuse */ PyErr_SetString(PyExc_StopIteration, "iterator at end"); } @@ -404,7 +404,7 @@ static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op) PyObject *res; int ok= -1; /* zero is true */ - if(BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b)) + if (BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b)) ok= KX_PythonSeq_compare((KX_PythonSeq *)a, (KX_PythonSeq *)b); switch (op) { diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 6e8a2cb7671..29e9fb5bca0 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -61,7 +61,7 @@ void KX_RayCast::reportHit(PHY_RayCastResult* result) bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_Point3& _frompoint, const MT_Point3& topoint, KX_RayCast& callback) { - if(physics_environment==NULL) return false; /* prevents crashing in some cases */ + if (physics_environment==NULL) return false; /* prevents crashing in some cases */ // Loops over all physics objects between frompoint and topoint, // calling callback.RayHit for each one. diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 17ef358a4e5..2038e7e93b2 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -102,7 +102,7 @@ void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) { KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj); - if(replica) + if (replica) replica->Release(); return (void*)replica; @@ -251,7 +251,7 @@ KX_Scene::~KX_Scene() if (m_obstacleSimulation) delete m_obstacleSimulation; - if(m_objectlist) + if (m_objectlist) m_objectlist->Release(); if (m_parentlist) @@ -688,7 +688,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) m_groupGameObjects.clear(); group = blgroupobj->dup_group; - for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) { Object* blenderobj = go->ob; if (blgroupobj == blenderobj) @@ -1066,12 +1066,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u KX_GameObject* gameobj = static_cast<KX_GameObject*>(obj); RAS_MeshObject* mesh = static_cast<RAS_MeshObject*>(meshobj); - if(!gameobj) { + if (!gameobj) { std::cout << "KX_Scene::ReplaceMesh Warning: invalid object, doing nothing" << std::endl; return; } - if(use_gfx && mesh != NULL) + if (use_gfx && mesh != NULL) { gameobj->RemoveMeshes(); gameobj->AddMesh(mesh); @@ -1207,7 +1207,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u #endif // release parent reference if its not being used - if( releaseParent && parentobj) + if ( releaseParent && parentobj) parentobj->Release(); } } @@ -1216,7 +1216,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u } #ifdef USE_BULLET - if(use_phys) { /* update the new assigned mesh with the physics mesh */ + if (use_phys) { /* update the new assigned mesh with the physics mesh */ KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh); } #endif @@ -1393,7 +1393,7 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam return; // Shadow lamp layers - if(layer && !(gameobj->GetLayer() & layer)) { + if (layer && !(gameobj->GetLayer() & layer)) { gameobj->SetCulled(true); gameobj->UpdateBuckets(false); return; @@ -1455,7 +1455,7 @@ void KX_Scene::PhysicsCullingCallback(KX_ClientObjectInfo* objectInfo, void* cul if (!gameobj->GetVisible()) // ideally, invisible objects should be removed from the culling tree temporarily return; - if(((CullingInfo*)cullingInfo)->m_layer && !(gameobj->GetLayer() & ((CullingInfo*)cullingInfo)->m_layer)) + if (((CullingInfo*)cullingInfo)->m_layer && !(gameobj->GetLayer() & ((CullingInfo*)cullingInfo)->m_layer)) // used for shadow: object is not in shadow layer return; @@ -1688,7 +1688,7 @@ void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter) void KX_Scene::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv) { m_physicsEnvironment = physEnv; - if(m_physicsEnvironment) { + if (m_physicsEnvironment) { KX_TouchEventManager* touchmgr = new KX_TouchEventManager(m_logicmgr, physEnv); m_logicmgr->RegisterEventManager(touchmgr); } @@ -1728,14 +1728,14 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) brick->Replace_NetworkScene(to->GetNetworkScene()); SCA_ISensor *sensor= dynamic_cast<class SCA_ISensor *>(brick); - if(sensor) { + if (sensor) { sensor->Replace_EventManager(logicmgr); } /* near sensors have physics controllers */ #ifdef USE_BULLET KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick); - if(touch_sensor) { + if (touch_sensor) { touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } #endif @@ -1794,15 +1794,15 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene /* graphics controller */ PHY_IGraphicController *ctrl = gameobj->GetGraphicController(); - if(ctrl) { + if (ctrl) { /* SHOULD update the m_cullingTree */ ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } /* SG_Node can hold a scene reference */ SG_Node *sg= gameobj->GetSGNode(); - if(sg) { - if(sg->GetSGClientInfo() == from) { + if (sg) { + if (sg->GetSGClientInfo() == from) { sg->SetSGClientInfo(to); /* Make sure to grab the children too since they might not be tied to a game object */ @@ -1839,7 +1839,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) CcdPhysicsEnvironment *env= dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment()); CcdPhysicsEnvironment *env_other= dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment()); - if((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes have NONE physics, the other is loaded with bullet enabled, ??? */ + if ((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes have NONE physics, the other is loaded with bullet enabled, ??? */ { printf("KX_Scene::MergeScene: physics scenes type differ, aborting\n"); printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL)); @@ -1847,7 +1847,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) } #endif // USE_BULLET - if(GetSceneConverter() != other->GetSceneConverter()) { + if (GetSceneConverter() != other->GetSceneConverter()) { printf("KX_Scene::MergeScene: converters differ, aborting\n"); return false; } @@ -1889,7 +1889,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) other->GetLightList()->ReleaseAndRemoveAll(); #ifdef USE_BULLET - if(env) /* bullet scene? - dummy scenes don't need touching */ + if (env) /* bullet scene? - dummy scenes don't need touching */ env->MergeEnvironment(env_other); #endif @@ -1904,10 +1904,10 @@ bool KX_Scene::MergeScene(KX_Scene *other) //SCA_EventManager *evtmgr; SCA_EventManager *evtmgr_other; - for(unsigned int i= 0; i < evtmgrs.size(); i++) { + for (unsigned int i= 0; i < evtmgrs.size(); i++) { evtmgr_other= logicmgr_other->FindEventManager(evtmgrs[i]->GetType()); - if(evtmgr_other) /* unlikely but possible one scene has a joystick and not the other */ + if (evtmgr_other) /* unlikely but possible one scene has a joystick and not the other */ evtmgr_other->Replace_LogicManager(logicmgr); /* when merging objects sensors are moved across into the new manager, don't need to do this here */ @@ -1918,7 +1918,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) SCA_TimeEventManager *timemgr_other= other->GetTimeEventManager(); vector<CValue*> times = timemgr_other->GetTimeValues(); - for(unsigned int i= 0; i < times.size(); i++) { + for (unsigned int i= 0; i < times.size(); i++) { timemgr->AddTimeProperty(times[i]); } @@ -2028,7 +2028,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) return pyconvert; } else { - if(attr_str) PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str); + if (attr_str) PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str); else PyErr_SetString(PyExc_KeyError, "value = scene[key]: KX_Scene, key does not exist"); return NULL; } @@ -2039,7 +2039,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) { KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v); const char *attr_str= _PyUnicode_AsString(key); - if(attr_str==NULL) + if (attr_str==NULL) PyErr_Clear(); if (self==NULL) { @@ -2050,11 +2050,11 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) if (val==NULL) { /* del ob["key"] */ int del= 0; - if(self->m_attr_dict) + if (self->m_attr_dict) del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; if (del==0) { - if(attr_str) PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str); + if (attr_str) PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str); else PyErr_SetString(PyExc_KeyError, "del scene[key]: KX_Scene, key could not be deleted"); return -1; } @@ -2069,12 +2069,12 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) self->m_attr_dict= PyDict_New(); - if(PyDict_SetItem(self->m_attr_dict, key, val)==0) + if (PyDict_SetItem(self->m_attr_dict, key, val)==0) set= 1; else PyErr_SetString(PyExc_KeyError, "scene[key] = value: KX_Scene, key not be added to internal dictionary"); - if(set==0) + if (set==0) return -1; /* pythons error value */ } @@ -2184,7 +2184,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_pre(void *self_v, const KX_PYATT { KX_Scene* self = static_cast<KX_Scene*>(self_v); - if(self->m_draw_call_pre==NULL) + if (self->m_draw_call_pre==NULL) self->m_draw_call_pre= PyList_New(0); Py_INCREF(self->m_draw_call_pre); return self->m_draw_call_pre; @@ -2194,7 +2194,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_post(void *self_v, const KX_PYAT { KX_Scene* self = static_cast<KX_Scene*>(self_v); - if(self->m_draw_call_post==NULL) + if (self->m_draw_call_post==NULL) self->m_draw_call_post= PyList_New(0); Py_INCREF(self->m_draw_call_post); return self->m_draw_call_post; diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index 33708059784..781c1fdab87 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -276,7 +276,7 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_ if (actuator->m_camera) actuator->m_camera->UnregisterActuator(actuator); - if(camOb==NULL) { + if (camOb==NULL) { actuator->m_camera= NULL; } else { diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 5c4cb7216dd..91f6224e197 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -74,16 +74,16 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, KX_SoundActuator::~KX_SoundActuator() { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); } void KX_SoundActuator::play() { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); - if(m_sound.isNull()) + if (m_sound.isNull()) return; // this is the sound that will be played and not deleted afterwards @@ -119,7 +119,7 @@ void KX_SoundActuator::play() AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle); - if(m_is3d && !handle3d.isNull()) + if (m_is3d && !handle3d.isNull()) { handle3d->setRelative(true); handle3d->setVolumeMaximum(m_3d.max_gain); @@ -132,7 +132,7 @@ void KX_SoundActuator::play() handle3d->setConeVolumeOuter(m_3d.cone_outer_gain); } - if(loop) + if (loop) m_handle->setLoopCount(-1); m_handle->setPitch(m_pitch); m_handle->setVolume(m_volume); @@ -164,7 +164,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) RemoveAllEvents(); - if(m_sound.isNull()) + if (m_sound.isNull()) return false; // actual audio device playing state @@ -182,7 +182,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: { // stop immediately - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); m_handle = AUD_Reference<AUD_IHandle>(); break; @@ -196,7 +196,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL: { // stop the looping so that the sound stops when it finished - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->setLoopCount(0); break; } @@ -214,7 +214,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false // and assumes this is a positive event. // check that we actually have a positive event so as not to play sounds when being disabled. - else if(bPositiveEvent) { // <- added since 2.49 + else if (bPositiveEvent) { // <- added since 2.49 #else else { // <- works in most cases except a loop-end sound will never stop unless // the negative pulse is done continuesly @@ -229,7 +229,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) { AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle); - if(m_is3d && !handle3d.isNull()) + if (m_is3d && !handle3d.isNull()) { KX_Camera* cam = KX_GetActiveScene()->GetActiveCamera(); if (cam) @@ -342,7 +342,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound, "pauseSound()\n" "\tPauses the sound.\n") { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->pause(); Py_RETURN_NONE; } @@ -351,7 +351,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound, "stopSound()\n" "\tStops the sound.\n") { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); m_handle = AUD_Reference<AUD_IHandle>(); Py_RETURN_NONE; @@ -364,7 +364,7 @@ PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P const char* prop = attrdef->m_name; float result_value = 0.0; - if(!strcmp(prop, "volume_maximum")) { + if (!strcmp(prop, "volume_maximum")) { result_value = actuator->m_3d.max_gain; } else if (!strcmp(prop, "volume_minimum")) { @@ -401,7 +401,7 @@ PyObject* KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_P KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); float position = 0.0; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) position = actuator->m_handle->getPosition(); PyObject* result = PyFloat_FromDouble(position); @@ -432,7 +432,7 @@ PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI PyObject* KX_SoundActuator::pyattr_get_sound(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) { KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); - if(!actuator->m_sound.isNull()) + if (!actuator->m_sound.isNull()) return AUD_getPythonFactory(&actuator->m_sound); else Py_RETURN_NONE; @@ -449,47 +449,47 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(actuator->m_handle); // if sound is working and 3D, set the new setting - if(!actuator->m_is3d) + if (!actuator->m_is3d) return PY_SET_ATTR_FAIL; - if(!strcmp(prop, "volume_maximum")) { + if (!strcmp(prop, "volume_maximum")) { actuator->m_3d.max_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setVolumeMaximum(prop_value); } else if (!strcmp(prop, "volume_minimum")) { actuator->m_3d.min_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setVolumeMinimum(prop_value); } else if (!strcmp(prop, "distance_reference")) { actuator->m_3d.reference_distance = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setDistanceReference(prop_value); } else if (!strcmp(prop, "distance_maximum")) { actuator->m_3d.max_distance = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setDistanceMaximum(prop_value); } else if (!strcmp(prop, "attenuation")) { actuator->m_3d.rolloff_factor = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setAttenuation(prop_value); } else if (!!strcmp(prop, "cone_angle_inner")) { actuator->m_3d.cone_inner_angle = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeAngleInner(prop_value); } else if (!strcmp(prop, "cone_angle_outer")) { actuator->m_3d.cone_outer_angle = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeAngleOuter(prop_value); } else if (!strcmp(prop, "cone_volume_outer")) { actuator->m_3d.cone_outer_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeVolumeOuter(prop_value); } else { @@ -507,7 +507,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI if (!PyArg_Parse(value, "f", &position)) return PY_SET_ATTR_FAIL; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->seek(position); return PY_SET_ATTR_SUCCESS; } @@ -520,7 +520,7 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE return PY_SET_ATTR_FAIL; actuator->m_volume = gain; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->setVolume(gain); return PY_SET_ATTR_SUCCESS; @@ -534,7 +534,7 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_FAIL; actuator->m_pitch = pitch; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->setPitch(pitch); return PY_SET_ATTR_SUCCESS; @@ -548,7 +548,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_FAIL; AUD_Reference<AUD_IFactory>* snd = reinterpret_cast<AUD_Reference<AUD_IFactory>*>(AUD_getPythonSound(sound)); - if(snd) + if (snd) { actuator->m_sound = *snd; delete snd; diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index c4688af687b..f3aecd9e0ba 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -484,7 +484,7 @@ void KX_SteeringActuator::HandleActorFace(MT_Vector3& velocity) KX_GameObject* parentObject = curobj->GetParent(); - if(parentObject) + if (parentObject) { MT_Point3 localpos; localpos = curobj->GetSGNode()->GetLocalPosition(); diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp index 939aa5d20d4..d2a5ce58641 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp @@ -101,7 +101,7 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, case KX_ClientObjectInfo::OBACTORSENSOR: // this object may have multiple collision sensors, // check is any of them is interested in this object - for(std::list<SCA_ISensor*>::iterator it = info->m_sensors.begin(); + for (std::list<SCA_ISensor*>::iterator it = info->m_sensors.begin(); it != info->m_sensors.end(); ++it) { diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index a08e57c8d76..d1e0a74c8be 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -153,14 +153,14 @@ void compatible_eulFast(float *eul, float *oldrot) dy= eul[1] - oldrot[1]; dz= eul[2] - oldrot[2]; - if( fabs(dx) > MT_PI) { - if(dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI; + if ( fabs(dx) > MT_PI) { + if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI; } - if( fabs(dy) > MT_PI) { - if(dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI; + if ( fabs(dy) > MT_PI) { + if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI; } - if( fabs(dz) > MT_PI ) { - if(dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI; + if ( fabs(dz) > MT_PI ) { + if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI; } } @@ -391,7 +391,7 @@ bool KX_TrackToActuator::Update(double curtime, bool frame) mat= matrix3x3_interpol(oldmat, mat, m_time); - if(m_parentobj){ // check if the model is parented and calculate the child transform + if (m_parentobj){ // check if the model is parented and calculate the child transform MT_Point3 localpos; localpos = curobj->GetSGNode()->GetLocalPosition(); diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index a07e32850a5..1739f26ab6f 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -548,7 +548,7 @@ PyObject* KX_VertexProxy::PySetUV2(PyObject* args) unsigned int unit= RAS_TexVert::SECOND_UV; PyObject* list= NULL; - if(!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit)) + if (!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit)) return NULL; if (!PyVecTo(list, vec)) diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp index a5577d5e7d2..92cba6e9afc 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp @@ -131,7 +131,7 @@ void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* { CcdPhysicsEnvironment* phyEnv = static_cast<CcdPhysicsEnvironment*>(env); /* Updates the m_phyEnv's m_cullingTree & m_cullingCache */ - if(getBroadphaseHandle()) { + if (getBroadphaseHandle()) { /* insert into the new physics scene */ Activate(false); m_phyEnv= phyEnv; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0ece33a7f06..73ba187d732 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -207,14 +207,14 @@ bool CcdPhysicsController::CreateSoftbody() psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices, &hres.m_OutputVertices[0],0); - for(int i=0;i<(int)hres.mNumFaces;++i) + for (int i=0;i<(int)hres.mNumFaces;++i) { const int idx[]={ hres.m_Indices[i*3+0], hres.m_Indices[i*3+1], hres.m_Indices[i*3+2]}; - if(idx[0]<idx[1]) psb->appendLink( idx[0],idx[1]); - if(idx[1]<idx[2]) psb->appendLink( idx[1],idx[2]); - if(idx[2]<idx[0]) psb->appendLink( idx[2],idx[0]); + if (idx[0]<idx[1]) psb->appendLink( idx[0],idx[1]); + if (idx[1]<idx[2]) psb->appendLink( idx[1],idx[2]); + if (idx[2]<idx[0]) psb->appendLink( idx[2],idx[0]); psb->appendFace(idx[0],idx[1],idx[2]); } hlib.ReleaseResult(hres); @@ -379,10 +379,10 @@ bool CcdPhysicsController::CreateSoftbody() mmat = rasMesh->GetMeshMaterial(m); slot = mmat->m_baseslot; - for(slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) { int index = 0; - for(i=it.startvertex; i<it.endvertex; i++,index++) + for (i=it.startvertex; i<it.endvertex; i++,index++) { RAS_TexVert* vertex = &it.vertex[i]; //search closest index, and store it in vertex @@ -492,7 +492,7 @@ static void DeleteBulletShape(btCollisionShape* shape, bool free) if (meshInterface) delete meshInterface; } - if(free) { + if (free) { delete shape; } } @@ -555,12 +555,12 @@ bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape) btCollisionObject *ob; btBroadphaseProxy* proxy; - for(int i= 0; i < obarr.size(); i++) { + for (int i= 0; i < obarr.size(); i++) { ob= obarr[i]; if (ob->getCollisionShape() == newShape) { proxy = ob->getBroadphaseHandle(); - if(proxy) + if (proxy) dw->getPairCache()->cleanProxyFromPairs(proxy,dw->getDispatcher()); } } @@ -629,7 +629,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) const btVector3& linvel = body->getLinearVelocity(); float len= linvel.length(); - if((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max)) + if ((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max)) body->setLinearVelocity(linvel * (m_cci.m_clamp_vel_max / len)); else if ((m_cci.m_clamp_vel_min>0.0) && btFuzzyZero(len)==0 && (len < m_cci.m_clamp_vel_min)) @@ -1644,12 +1644,12 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, /* If this ever gets confusing, print out an OBJ file for debugging */ #if 0 printf("# vert count %d\n", m_vertexArray.size()); - for(i=0; i<m_vertexArray.size(); i+=1) { + for (i=0; i<m_vertexArray.size(); i+=1) { printf("v %.6f %.6f %.6f\n", m_vertexArray[i].x(), m_vertexArray[i].y(), m_vertexArray[i].z()); } printf("# face count %d\n", m_triFaceArray.size()); - for(i=0; i<m_triFaceArray.size(); i+=3) { + for (i=0; i<m_triFaceArray.size(); i+=3) { printf("f %d %d %d\n", m_triFaceArray[i]+1, m_triFaceArray[i+1]+1, m_triFaceArray[i+2]+1); } #endif @@ -1701,10 +1701,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA const int tri_verts[4]= {0,1,2, -1}; const int *fv_pt; - if(gameobj==NULL && meshobj==NULL) + if (gameobj==NULL && meshobj==NULL) return false; - if(m_shapeType != PHY_SHAPE_MESH) + if (m_shapeType != PHY_SHAPE_MESH) return false; RAS_Deformer *deformer= gameobj ? gameobj->GetDeformer():NULL; @@ -1714,21 +1714,21 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA dm = deformer->GetPhysicsMesh(); /* get the mesh from the object if not defined */ - if(meshobj==NULL) { + if (meshobj==NULL) { /* modifier mesh */ - if(dm) + if (dm) meshobj= deformer->GetRasMesh(); /* game object first mesh */ - if(meshobj==NULL) { - if(gameobj->GetMeshCount() > 0) { + if (meshobj==NULL) { + if (gameobj->GetMeshCount() > 0) { meshobj= gameobj->GetMesh(0); } } } - if(dm && deformer->GetRasMesh() == meshobj) + if (dm && deformer->GetRasMesh() == meshobj) { /* * Derived Mesh Update * @@ -1745,7 +1745,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA int flen; - if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) + if (CustomData_has_layer(&dm->faceData, CD_MTFACE)) { MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE); MTFace *tf; @@ -1753,10 +1753,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA vector<bool> vert_tag_array(numverts, false); vector<int> vert_remap_array(numverts, 0); - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { - if(tf->mode & TF_DYNAMIC) + for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { + if (tf->mode & TF_DYNAMIC) { - if(mf->v4) { + if (mf->v4) { tot_bt_tris+= 2; flen= 4; } else { @@ -1764,11 +1764,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA flen= 3; } - for(j=0; j<flen; j++) + for (j=0; j<flen; j++) { v_orig = (*(&mf->v1 + j)); - if(vert_tag_array[v_orig]==false) + if (vert_tag_array[v_orig]==false) { vert_tag_array[v_orig]= true; vert_remap_array[v_orig]= tot_bt_verts; @@ -1790,13 +1790,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_polygonIndexArray.resize(tot_bt_tris); int *poly_index_pt= &m_polygonIndexArray[0]; - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) + for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { - if(tf->mode & TF_DYNAMIC) + if (tf->mode & TF_DYNAMIC) { int origi = (index)? index[i]: i; - if(mf->v4) { + if (mf->v4) { fv_pt= quad_verts; *poly_index_pt++ = origi; *poly_index_pt++ = origi; @@ -1807,11 +1807,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA flen= 3; } - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) { v_orig = (*(&mf->v1 + (*fv_pt))); - if(vert_tag_array[v_orig]) + if (vert_tag_array[v_orig]) { mv= mvert + v_orig; *bt++ = mv->co[0]; @@ -1833,7 +1833,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA tot_bt_verts= numverts; - for(mf= mface, i=0; i < numpolys; mf++, i++) { + for (mf= mface, i=0; i < numpolys; mf++, i++) { tot_bt_tris += (mf->v4 ? 2:1); } @@ -1848,14 +1848,14 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_triFaceUVcoArray.clear(); - for(mv= mvert, i=0; i < numverts; mv++, i++) { + for (mv= mvert, i=0; i < numverts; mv++, i++) { *bt++ = mv->co[0]; *bt++ = mv->co[1]; *bt++ = mv->co[2]; } - for(mf= mface, i=0; i < numpolys; mf++, i++) { + for (mf= mface, i=0; i < numpolys; mf++, i++) { int origi = (index)? index[i]: i; - if(mf->v4) { + if (mf->v4) { fv_pt= quad_verts; *poly_index_pt++ = origi; *poly_index_pt++ = origi; @@ -1865,7 +1865,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA *poly_index_pt++ = origi; } - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) *tri_pt++ = (*(&mf->v1 + (*fv_pt))); } } @@ -1882,7 +1882,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA float (*transverts)[3]= NULL; int transverts_tot= 0; /* with deformed meshes - should always be greater then the max orginal index, or we get crashes */ - if(deformer) { + if (deformer) { /* map locations from the deformed array * * Could call deformer->Update(); but rely on redraw updating. @@ -1899,15 +1899,15 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA vector<bool> vert_tag_array(numverts, false); vector<int> vert_remap_array(numverts, 0); - for(int p=0; p<numpolys; p++) + for (int p=0; p<numpolys; p++) { RAS_Polygon* poly= meshobj->GetPolygon(p); if (poly->IsCollider()) { - for(i=0; i < poly->VertexCount(); i++) + for (i=0; i < poly->VertexCount(); i++) { v_orig= poly->GetVertex(i)->getOrigIndex(); - if(vert_tag_array[v_orig]==false) + if (vert_tag_array[v_orig]==false) { vert_tag_array[v_orig]= true; vert_remap_array[v_orig]= tot_bt_verts; @@ -1929,7 +1929,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_polygonIndexArray.resize(tot_bt_tris); - for(int p=0; p<numpolys; p++) + for (int p=0; p<numpolys; p++) { RAS_Polygon* poly= meshobj->GetPolygon(p); @@ -1938,13 +1938,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA /* quad or tri loop */ fv_pt= (poly->VertexCount()==3 ? tri_verts:quad_verts); - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) { v_orig= poly->GetVertex(*fv_pt)->getOrigIndex(); - if(vert_tag_array[v_orig]) + if (vert_tag_array[v_orig]) { - if(transverts) { + if (transverts) { /* deformed mesh, using RAS_TexVert locations would be too troublesome * because they are use the gameob as a hash in the material slot */ *bt++ = transverts[v_orig][0]; @@ -1973,19 +1973,19 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA #if 0 /* needs #include <cstdio> */ printf("# vert count %d\n", m_vertexArray.size()); - for(int i=0; i<m_vertexArray.size(); i+=3) { + for (int i=0; i<m_vertexArray.size(); i+=3) { printf("v %.6f %.6f %.6f\n", m_vertexArray[i], m_vertexArray[i+1], m_vertexArray[i+2]); } printf("# face count %d\n", m_triFaceArray.size()); - for(int i=0; i<m_triFaceArray.size(); i+=3) { + for (int i=0; i<m_triFaceArray.size(); i+=3) { printf("f %d %d %d\n", m_triFaceArray[i]+1, m_triFaceArray[i+1]+1, m_triFaceArray[i+2]+1); } #endif /* force recreation of the m_unscaledShape. * If this has multiple users we cant delete */ - if(m_unscaledShape) { + if (m_unscaledShape) { // don't free now so it can re-allocate under the same location and not break pointers. // DeleteBulletShape(m_unscaledShape); m_forceReInstance= true; @@ -2094,7 +2094,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b collisionMeshData->m_weldingThreshold = m_weldingThreshold1; bool removeDuplicateVertices=true; // m_vertexArray not in multiple of 3 anymore, use m_triFaceArray - for(unsigned int i=0; i<m_triFaceArray.size(); i+=3) { + for (unsigned int i=0; i<m_triFaceArray.size(); i+=3) { btScalar *bt = &m_vertexArray[3*m_triFaceArray[i]]; btVector3 v1(bt[0], bt[1], bt[2]); bt = &m_vertexArray[3*m_triFaceArray[i+1]]; @@ -2119,7 +2119,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b // this shape will be shared and not deleted until shapeInfo is deleted // for UpdateMesh, reuse the last memory location so instancing wont crash. - if(m_unscaledShape) { + if (m_unscaledShape) { DeleteBulletShape(m_unscaledShape, false); m_unscaledShape->~btBvhTriangleMeshShape(); m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index ba9724f34ab..337e8019aa7 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1247,7 +1247,7 @@ struct OcclusionBuffer { struct WriteOCL { - static inline bool Process(btScalar& q,btScalar v) { if(q<v) q=v;return(false); } + static inline bool Process(btScalar& q,btScalar v) { if (q<v) q=v;return(false); } static inline void Occlusion(bool& flag) { flag = true; } }; struct QueryOCL @@ -1377,7 +1377,7 @@ struct OcclusionBuffer // convert polygon to device coordinates static bool project(btVector4* p,int n) { - for(int i=0;i<n;++i) + for (int i=0;i<n;++i) { p[i][2]=1/p[i][3]; p[i][0]*=p[i][2]; @@ -1394,21 +1394,21 @@ struct OcclusionBuffer btVector4 pn[2*NP]; int i, j, m, n, ni; // deal with near clipping - for(i=0, m=0;i<NP;++i) + for (i=0, m=0;i<NP;++i) { s[i]=pi[i][2]+pi[i][3]; - if(s[i]<0) m+=1<<i; + if (s[i]<0) m+=1<<i; } - if(m==((1<<NP)-1)) + if (m==((1<<NP)-1)) return(0); - if(m!=0) + if (m!=0) { - for(i=NP-1,j=0,n=0;j<NP;i=j++) + for (i=NP-1,j=0,n=0;j<NP;i=j++) { const btVector4& a=pi[i]; const btVector4& b=pi[j]; const btScalar t=s[i]/(a[3]+a[2]-b[3]-b[2]); - if((t>0)&&(t<1)) + if ((t>0)&&(t<1)) { pn[n][0] = a[0]+(b[0]-a[0])*t; pn[n][1] = a[1]+(b[1]-a[1])*t; @@ -1416,7 +1416,7 @@ struct OcclusionBuffer pn[n][3] = a[3]+(b[3]-a[3])*t; ++n; } - if(s[j]>0) pn[n++]=b; + if (s[j]>0) pn[n++]=b; } // ready to test far clipping, start from the modified polygon pi = pn; @@ -1427,21 +1427,21 @@ struct OcclusionBuffer ni = NP; } // now deal with far clipping - for(i=0, m=0;i<ni;++i) + for (i=0, m=0;i<ni;++i) { s[i]=pi[i][2]-pi[i][3]; - if(s[i]>0) m+=1<<i; + if (s[i]>0) m+=1<<i; } - if(m==((1<<ni)-1)) + if (m==((1<<ni)-1)) return(0); - if(m!=0) + if (m!=0) { - for(i=ni-1,j=0,n=0;j<ni;i=j++) + for (i=ni-1,j=0,n=0;j<ni;i=j++) { const btVector4& a=pi[i]; const btVector4& b=pi[j]; const btScalar t=s[i]/(a[2]-a[3]-b[2]+b[3]); - if((t>0)&&(t<1)) + if ((t>0)&&(t<1)) { po[n][0] = a[0]+(b[0]-a[0])*t; po[n][1] = a[1]+(b[1]-a[1])*t; @@ -1449,11 +1449,11 @@ struct OcclusionBuffer po[n][3] = a[3]+(b[3]-a[3])*t; ++n; } - if(s[j]<0) po[n++]=b; + if (s[j]<0) po[n++]=b; } return(n); } - for(int i=0;i<ni;++i) po[i]=pi[i]; + for (int i=0;i<ni;++i) po[i]=pi[i]; return(ni); } // write or check a triangle to buffer. a,b,c in device coordinates (-1,+1) @@ -1465,7 +1465,7 @@ struct OcclusionBuffer const btScalar minarea) { const btScalar a2=btCross(b-a,c-a)[2]; - if((face*a2)<0.f || btFabs(a2)<minarea) + if ((face*a2)<0.f || btFabs(a2)<minarea) return false; // further down we are normally going to write to the Zbuffer, mark it so POLICY::Occlusion(m_occlusion); @@ -1499,15 +1499,15 @@ struct OcclusionBuffer // degenerated in at most one single pixel btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; // use for loop to detect the case where width or height == 0 - for(int iy=miy;iy<mxy;++iy) + for (int iy=miy;iy<mxy;++iy) { - for(int ix=mix;ix<mxx;++ix) + for (int ix=mix;ix<mxx;++ix) { - if(POLICY::Process(*scan,z[0])) + if (POLICY::Process(*scan,z[0])) return(true); - if(POLICY::Process(*scan,z[1])) + if (POLICY::Process(*scan,z[1])) return(true); - if(POLICY::Process(*scan,z[2])) + if (POLICY::Process(*scan,z[2])) return(true); } } @@ -1537,13 +1537,13 @@ struct OcclusionBuffer dy[1] = y[0]-y[1]; dy[2] = y[2]-y[0]; btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - for(int iy=miy;iy<mxy;++iy) + for (int iy=miy;iy<mxy;++iy) { - if(dy[0] >= 0 && POLICY::Process(*scan,v[0])) + if (dy[0] >= 0 && POLICY::Process(*scan,v[0])) return(true); - if(dy[1] >= 0 && POLICY::Process(*scan,v[1])) + if (dy[1] >= 0 && POLICY::Process(*scan,v[1])) return(true); - if(dy[2] >= 0 && POLICY::Process(*scan,v[2])) + if (dy[2] >= 0 && POLICY::Process(*scan,v[2])) return(true); scan+=m_sizes[0]; v[0] += dzy[0]; v[1] += dzy[1]; v[2] += dzy[2]; @@ -1574,13 +1574,13 @@ struct OcclusionBuffer dx[1] = x[0]-x[1]; dx[2] = x[2]-x[0]; btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - for(int ix=mix;ix<mxx;++ix) + for (int ix=mix;ix<mxx;++ix) { - if(dx[0] >= 0 && POLICY::Process(*scan,v[0])) + if (dx[0] >= 0 && POLICY::Process(*scan,v[0])) return(true); - if(dx[1] >= 0 && POLICY::Process(*scan,v[1])) + if (dx[1] >= 0 && POLICY::Process(*scan,v[1])) return(true); - if(dx[2] >= 0 && POLICY::Process(*scan,v[2])) + if (dx[2] >= 0 && POLICY::Process(*scan,v[2])) return(true); scan++; v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2]; @@ -1604,13 +1604,13 @@ struct OcclusionBuffer miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]}; btScalar v=ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2])); btScalar* scan=&m_buffer[miy*m_sizes[0]]; - for(int iy=miy;iy<mxy;++iy) + for (int iy=miy;iy<mxy;++iy) { - for(int ix=mix;ix<mxx;++ix) + for (int ix=mix;ix<mxx;++ix) { - if((c[0]>=0)&&(c[1]>=0)&&(c[2]>=0)) + if ((c[0]>=0)&&(c[1]>=0)&&(c[2]>=0)) { - if(POLICY::Process(scan[ix],v)) + if (POLICY::Process(scan[ix],v)) return(true); } c[0]+=dx[0];c[1]+=dx[1];c[2]+=dx[2];v+=dzx; @@ -1633,7 +1633,7 @@ struct OcclusionBuffer if (n) { project(o,n); - for(int i=2;i<n && !earlyexit;++i) + for (int i=2;i<n && !earlyexit;++i) { earlyexit|=draw<POLICY>(o[0],o[i-1],o[i],face,minarea); } @@ -1685,10 +1685,10 @@ struct OcclusionBuffer transformW(btVector3(c[0]+e[0],c[1]-e[1],c[2]+e[2]),x[5]); transformW(btVector3(c[0]+e[0],c[1]+e[1],c[2]+e[2]),x[6]); transformW(btVector3(c[0]-e[0],c[1]+e[1],c[2]+e[2]),x[7]); - for(int i=0;i<8;++i) + for (int i=0;i<8;++i) { // the box is clipped, it's probably a large box, don't waste our time to check - if((x[i][2]+x[i][3])<=0) return(true); + if ((x[i][2]+x[i][3])<=0) return(true); } static const int d[]={ 1,0,3,2, 4,5,6,7, @@ -1696,13 +1696,13 @@ struct OcclusionBuffer 6,5,1,2, 7,6,2,3, 5,4,0,1}; - for(unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) + for (unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) { const btVector4 p[]={ x[d[i++]], x[d[i++]], x[d[i++]], x[d[i++]]}; - if(clipDraw<4,QueryOCL>(p,1.f,0.f)) + if (clipDraw<4,QueryOCL>(p,1.f,0.f)) return(true); } return(false); @@ -2008,7 +2008,7 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float { //param = 3,4,5 are constraint limits, high limit values btConeTwistConstraint* coneTwist = (btConeTwistConstraint*)typedConstraint; - if(value1<0.0f) + if (value1<0.0f) coneTwist->setLimit(param,btScalar(BT_LARGE_FLOAT)); else coneTwist->setLimit(param,value1); diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index 99346c0a6c6..aa3a8efe540 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -59,11 +59,11 @@ numberoffilters(0), need_tex_update(true) GLEW_ARB_fragment_shader && GLEW_ARB_multitexture; /* used to return before 2.49 but need to initialize values so don't */ - if(!isshadersupported) + if (!isshadersupported) std::cout<<"shaders not supported!" << std::endl; int passindex; - for(passindex =0; passindex<MAX_RENDER_PASS; passindex++) + for (passindex =0; passindex<MAX_RENDER_PASS; passindex++) { m_filters[passindex] = 0; m_enabled[passindex] = 0; @@ -86,7 +86,7 @@ void RAS_2DFilterManager::PrintShaderErrors(unsigned int shader, const char *tas const char *c, *pos, *end; int line = 1; - if(errorprinted) + if (errorprinted) return; errorprinted= true; @@ -121,7 +121,7 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) glGetObjectParameterivARB(fShader, GL_COMPILE_STATUS, &success); - if(!success) + if (!success) { /*Shader Comile Error*/ PrintShaderErrors(fShader, "compile", shadersource); @@ -183,22 +183,22 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(int filtermode) void RAS_2DFilterManager::AnalyseShader(int passindex, vector<STR_String>& propNames) { texflag[passindex] = 0; - if(glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture") != -1) + if (glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture") != -1) { - if(GLEW_ARB_depth_texture) + if (GLEW_ARB_depth_texture) texflag[passindex] |= 0x1; } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture") != -1) + if (glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture") != -1) { texflag[passindex] |= 0x2; } - if(m_gameObjects[passindex]) + if (m_gameObjects[passindex]) { int objProperties = propNames.size(); int i; - for(i=0; i<objProperties; i++) - if(glGetUniformLocationARB(m_filters[passindex], propNames[i]) != -1) + for (i=0; i<objProperties; i++) + if (glGetUniformLocationARB(m_filters[passindex], propNames[i]) != -1) m_properties[passindex].push_back(propNames[i]); } } @@ -217,7 +217,7 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) } /* send depth texture to glsl program if it needs */ - if(texflag[passindex] & 0x1){ + if (texflag[passindex] & 0x1){ uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture"); glActiveTextureARB(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texname[1]); @@ -229,7 +229,7 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) } /* send luminance texture to glsl program if it needs */ - if(texflag[passindex] & 0x2){ + if (texflag[passindex] & 0x2){ uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture"); glActiveTextureARB(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, texname[2]); @@ -257,10 +257,10 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) } int i, objProperties = m_properties[passindex].size(); - for(i=0; i<objProperties; i++) + for (i=0; i<objProperties; i++) { uniformLoc = glGetUniformLocationARB(m_filters[passindex], m_properties[passindex][i]); - if(uniformLoc != -1) + if (uniformLoc != -1) { float value = ((CValue*)m_gameObjects[passindex])->GetPropertyNumber(m_properties[passindex][i], 0.0); glUniform1fARB(uniformLoc,value); @@ -275,11 +275,11 @@ void RAS_2DFilterManager::EndShaderProgram() void RAS_2DFilterManager::FreeTextures() { - if(texname[0]!=(unsigned int)-1) + if (texname[0]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[0]); - if(texname[1]!=(unsigned int)-1) + if (texname[1]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[1]); - if(texname[2]!=(unsigned int)-1) + if (texname[2]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[2]); } @@ -296,7 +296,7 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - if(depth){ + if (depth){ glGenTextures(1, (GLuint*)&texname[1]); glBindTexture(GL_TEXTURE_2D, texname[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, texturewidth,textureheight, @@ -309,7 +309,7 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } - if(luminance){ + if (luminance){ glGenTextures(1, (GLuint*)&texname[2]); glBindTexture(GL_TEXTURE_2D, texname[2]); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, texturewidth, textureheight, @@ -379,48 +379,48 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) int passindex; - if(!isshadersupported) + if (!isshadersupported) return; - for(passindex =0; passindex<MAX_RENDER_PASS; passindex++) + for (passindex =0; passindex<MAX_RENDER_PASS; passindex++) { - if(m_filters[passindex] && m_enabled[passindex]){ + if (m_filters[passindex] && m_enabled[passindex]){ num_filters ++; - if(texflag[passindex] & 0x1) + if (texflag[passindex] & 0x1) need_depth = true; - if(texflag[passindex] & 0x2) + if (texflag[passindex] & 0x2) need_luminance = true; - if(need_depth && need_luminance) + if (need_depth && need_luminance) break; } } - if(num_filters <= 0) + if (num_filters <= 0) return; GLuint viewport[4]={0}; glGetIntegerv(GL_VIEWPORT,(GLint *)viewport); - if(canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight()) + if (canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight()) { UpdateOffsetMatrix(canvas); UpdateCanvasTextureCoord((unsigned int*)viewport); need_tex_update = true; } - if(need_tex_update) + if (need_tex_update) { SetupTextures(need_depth, need_luminance); need_tex_update = false; } - if(need_depth){ + if (need_depth){ glActiveTextureARB(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texname[1]); glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0, 0, texturewidth,textureheight, 0); } - if(need_luminance){ + if (need_luminance){ glActiveTextureARB(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, texname[2]); glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); @@ -444,9 +444,9 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glPushMatrix(); glLoadIdentity(); - for(passindex =0; passindex<MAX_RENDER_PASS; passindex++) + for (passindex =0; passindex<MAX_RENDER_PASS; passindex++) { - if(m_filters[passindex] && m_enabled[passindex]) + if (m_filters[passindex] && m_enabled[passindex]) { StartShaderProgram(passindex); @@ -475,26 +475,26 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text) { - if(!isshadersupported) + if (!isshadersupported) return; - if(pass<0 || pass>=MAX_RENDER_PASS) + if (pass<0 || pass>=MAX_RENDER_PASS) return; need_tex_update = true; - if(mode == RAS_2DFILTER_DISABLED) + if (mode == RAS_2DFILTER_DISABLED) { m_enabled[pass] = 0; return; } - if(mode == RAS_2DFILTER_ENABLED) + if (mode == RAS_2DFILTER_ENABLED) { m_enabled[pass] = 1; return; } - if(mode == RAS_2DFILTER_NOFILTER) + if (mode == RAS_2DFILTER_NOFILTER) { - if(m_filters[pass]) + if (m_filters[pass]) glDeleteObjectARB(m_filters[pass]); m_enabled[pass] = 0; m_filters[pass] = 0; @@ -504,9 +504,9 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game return; } - if(mode == RAS_2DFILTER_CUSTOMFILTER) + if (mode == RAS_2DFILTER_CUSTOMFILTER) { - if(m_filters[pass]) + if (m_filters[pass]) glDeleteObjectARB(m_filters[pass]); m_filters[pass] = CreateShaderProgram(text.Ptr()); m_gameObjects[pass] = gameObj; @@ -516,7 +516,7 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game } // We've checked all other cases, which means we must be dealing with a builtin filter - if(m_filters[pass]) + if (m_filters[pass]) glDeleteObjectARB(m_filters[pass]); m_filters[pass] = CreateShaderProgram(mode); m_gameObjects[pass] = NULL; diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index f7cc47da61f..90587bb9739 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -119,7 +119,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList for (bit = buckets.begin(); bit != buckets.end(); ++bit) { SG_DList::iterator<RAS_MeshSlot> mit((*bit)->GetActiveMeshSlots()); - for(mit.begin(); !mit.end(); ++mit) + for (mit.begin(); !mit.end(); ++mit) size++; } @@ -135,7 +135,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList } } - if(alpha) + if (alpha) sort(slots.begin(), slots.end(), backtofront()); else sort(slots.begin(), slots.end(), fronttoback()); @@ -154,7 +154,7 @@ void RAS_BucketManager::RenderAlphaBuckets( OrderBuckets(cameratrans, m_AlphaBuckets, slots, true); - for(sit=slots.begin(); sit!=slots.end(); ++sit) { + for (sit=slots.begin(); sit!=slots.end(); ++sit) { rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj); while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools)) @@ -217,7 +217,7 @@ void RAS_BucketManager::RenderSolidBuckets( OrderBuckets(cameratrans, m_SolidBuckets, slots, false); - for(sit=slots.begin(); sit!=slots.end(); ++sit) { + for (sit=slots.begin(); sit!=slots.end(); ++sit) { rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj); while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools)) @@ -283,7 +283,7 @@ void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat) for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) { if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { - if(mit->m_DisplayList) { + if (mit->m_DisplayList) { mit->m_DisplayList->Release(); mit->m_DisplayList = NULL; } @@ -294,7 +294,7 @@ void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat) for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) { if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { - if(mit->m_DisplayList) { + if (mit->m_DisplayList) { mit->m_DisplayList->Release(); mit->m_DisplayList = NULL; } @@ -329,7 +329,7 @@ void RAS_BucketManager::RemoveMaterial(RAS_IPolyMaterial * mat) int i; - for(i=0; i<m_SolidBuckets.size(); i++) { + for (i=0; i<m_SolidBuckets.size(); i++) { RAS_MaterialBucket *bucket = m_SolidBuckets[i]; if (mat == bucket->GetPolyMaterial()) { m_SolidBuckets.erase(m_SolidBuckets.begin()+i); @@ -338,7 +338,7 @@ void RAS_BucketManager::RemoveMaterial(RAS_IPolyMaterial * mat) } } - for(int i=0; i<m_AlphaBuckets.size(); i++) { + for (int i=0; i<m_AlphaBuckets.size(); i++) { RAS_MaterialBucket *bucket = m_AlphaBuckets[i]; if (mat == bucket->GetPolyMaterial()) { m_AlphaBuckets.erase(m_AlphaBuckets.begin()+i); diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index 8a5c10b3a3b..5f47a4bd53e 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -48,7 +48,7 @@ ComputeDefaultFrustum( float sizeX; float sizeY; - if(sensor_fit==RAS_SENSORFIT_AUTO) { + if (sensor_fit==RAS_SENSORFIT_AUTO) { halfSize = (sensor_x / 2.f) * camnear / lens; if (design_aspect_ratio > 1.f) { @@ -61,7 +61,7 @@ ComputeDefaultFrustum( sizeY = halfSize; } } - else if(sensor_fit==RAS_SENSORFIT_HOR) { + else if (sensor_fit==RAS_SENSORFIT_HOR) { halfSize = (sensor_x / 2.f) * camnear / lens; sizeX = halfSize; sizeY = halfSize/design_aspect_ratio; @@ -95,7 +95,7 @@ ComputeDefaultOrtho( float sizeX; float sizeY; - if(sensor_fit==RAS_SENSORFIT_AUTO) { + if (sensor_fit==RAS_SENSORFIT_AUTO) { if (design_aspect_ratio > 1.f) { // halfsize defines the width sizeX = halfSize; @@ -106,7 +106,7 @@ ComputeDefaultOrtho( sizeY = halfSize; } } - else if(sensor_fit==RAS_SENSORFIT_HOR) { + else if (sensor_fit==RAS_SENSORFIT_HOR) { sizeX = halfSize; sizeY = halfSize/design_aspect_ratio; } diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index 48251b2d7ee..4af1753c2da 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -124,7 +124,7 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const { - if(m_flag &RAS_BLENDERMAT) + if (m_flag &RAS_BLENDERMAT) { bool test = ( this->m_multimode == lhs.m_multimode && @@ -254,10 +254,10 @@ bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const { bool dolights = false; - if(m_flag & RAS_BLENDERMAT) + if (m_flag & RAS_BLENDERMAT) dolights = (m_flag &RAS_MULTILIGHT)!=0; - else if(rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID); - else if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW); + else if (rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID); + else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW); else dolights = m_light; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index ad26ed52ed7..a18adfd8986 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -77,9 +77,9 @@ RAS_MeshSlot::~RAS_MeshSlot() m_joinedSlots.front()->Split(true); #endif - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { (*it)->m_users--; - if((*it)->m_users == 0) + if ((*it)->m_users == 0) delete *it; } @@ -117,7 +117,7 @@ RAS_MeshSlot::RAS_MeshSlot(const RAS_MeshSlot& slot) : SG_QList() m_endvertex = slot.m_endvertex; m_endindex = slot.m_endindex; - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { // don't copy display arrays for now because it breaks python // access to vertices, but we'll need a solution if we want to // join display arrays for reducing draw calls. @@ -149,7 +149,7 @@ void RAS_MeshSlot::begin(RAS_MeshSlot::iterator& it) it.array = (m_displayArrays.size() > 0)? m_displayArrays[m_startarray]: NULL; - if(it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) { + if (it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) { it.array = NULL; it.vertex = NULL; it.index = NULL; @@ -177,7 +177,7 @@ void RAS_MeshSlot::next(RAS_MeshSlot::iterator& it) int startvertex, endvertex; int startindex, endindex; - if(it.arraynum == (size_t)m_endarray) { + if (it.arraynum == (size_t)m_endarray) { it.array = NULL; it.vertex = NULL; it.index = NULL; @@ -217,13 +217,13 @@ void RAS_MeshSlot::SetDisplayArray(int numverts) RAS_DisplayArrayList::iterator it; RAS_DisplayArray *darray = NULL; - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { darray = *it; - if(darray->m_type == numverts) { - if(darray->m_index.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_INDEX) + if (darray->m_type == numverts) { + if (darray->m_index.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_INDEX) darray = NULL; - else if(darray->m_vertex.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_VERTEX) + else if (darray->m_vertex.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_VERTEX) darray = NULL; else break; @@ -232,21 +232,21 @@ void RAS_MeshSlot::SetDisplayArray(int numverts) darray = NULL; } - if(!darray) { + if (!darray) { darray = new RAS_DisplayArray(); darray->m_users = 1; - if(numverts == 2) darray->m_type = RAS_DisplayArray::LINE; - else if(numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE; + if (numverts == 2) darray->m_type = RAS_DisplayArray::LINE; + else if (numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE; else darray->m_type = RAS_DisplayArray::QUAD; m_displayArrays.push_back(darray); - if(numverts == 2) + if (numverts == 2) darray->m_type = RAS_DisplayArray::LINE; - else if(numverts == 3) + else if (numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE; - else if(numverts == 4) + else if (numverts == 4) darray->m_type = RAS_DisplayArray::QUAD; m_endarray = m_displayArrays.size()-1; @@ -271,7 +271,7 @@ int RAS_MeshSlot::AddVertex(const RAS_TexVert& tv) darray->m_vertex.push_back(tv); offset = darray->m_vertex.size()-1; - if(darray == m_displayArrays[m_endarray]) + if (darray == m_displayArrays[m_endarray]) m_endvertex++; return offset; @@ -284,7 +284,7 @@ void RAS_MeshSlot::AddPolygonVertex(int offset) darray = m_currentArray; darray->m_index.push_back(offset); - if(darray == m_displayArrays[m_endarray]) + if (darray == m_displayArrays[m_endarray]) m_endindex++; } @@ -294,9 +294,9 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) RAS_DisplayArrayList::iterator it; if (deformer->ShareVertexArray()) { // this deformer uses the base vertex array, first release the current ones - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { (*it)->m_users--; - if((*it)->m_users == 0) + if ((*it)->m_users == 0) delete *it; } m_displayArrays.clear(); @@ -304,7 +304,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) RAS_MeshMaterial *mmat = m_mesh->GetMeshMaterial(m_bucket->GetPolyMaterial()); if (mmat && mmat->m_baseslot) { m_displayArrays = mmat->m_baseslot->m_displayArrays; - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { (*it)->m_users++; } } @@ -313,7 +313,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) // no sharing // we create local copy of RAS_DisplayArray when we have a deformer: // this way we can avoid conflict between the vertex cache of duplicates - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { if (deformer->UseVertexArray()) { // the deformer makes use of vertex array, make sure we have our local copy if ((*it)->m_users > 1) { @@ -327,7 +327,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) } else { // the deformer is not using vertex array (Modifier), release them (*it)->m_users--; - if((*it)->m_users == 0) + if ((*it)->m_users == 0) delete *it; } } @@ -347,15 +347,15 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) bool RAS_MeshSlot::Equals(RAS_MeshSlot *target) { - if(!m_OpenGLMatrix || !target->m_OpenGLMatrix) + if (!m_OpenGLMatrix || !target->m_OpenGLMatrix) return false; - if(m_pDeformer || target->m_pDeformer) + if (m_pDeformer || target->m_pDeformer) return false; - if(m_bVisible != target->m_bVisible) + if (m_bVisible != target->m_bVisible) return false; - if(m_bObjectColor != target->m_bObjectColor) + if (m_bObjectColor != target->m_bObjectColor) return false; - if(m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor)) + if (m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor)) return false; return true; @@ -368,16 +368,16 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) size_t i; // verify if we can join - if(m_joinSlot || m_joinedSlots.size() || target->m_joinSlot) + if (m_joinSlot || m_joinedSlots.size() || target->m_joinSlot) return false; - if(!Equals(target)) + if (!Equals(target)) return false; MT_Vector3 co(&m_OpenGLMatrix[12]); MT_Vector3 targetco(&target->m_OpenGLMatrix[12]); - if((co - targetco).length() > distance) + if ((co - targetco).length() > distance) return false; MT_Matrix4x4 mat(m_OpenGLMatrix); @@ -395,14 +395,14 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) MT_Matrix4x4 ntransform = m_joinInvTransform.transposed(); ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f; - for(begin(mit); !end(mit); next(mit)) - for(i=mit.startvertex; i<mit.endvertex; i++) + for (begin(mit); !end(mit); next(mit)) + for (i=mit.startvertex; i<mit.endvertex; i++) mit.vertex[i].Transform(transform, ntransform); /* We know we'll need a list at least this big, reserve in advance */ target->m_displayArrays.reserve(target->m_displayArrays.size() + m_displayArrays.size()); - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { target->m_displayArrays.push_back(*it); target->m_endarray++; target->m_endvertex = target->m_displayArrays.back()->m_vertex.size(); @@ -432,24 +432,24 @@ bool RAS_MeshSlot::Split(bool force) iterator mit; size_t i, found0 = 0, found1 = 0; - if(target && (force || !Equals(target))) { + if (target && (force || !Equals(target))) { m_joinSlot = NULL; - for(jit=target->m_joinedSlots.begin(); jit!=target->m_joinedSlots.end(); jit++) { - if(*jit == this) { + for (jit=target->m_joinedSlots.begin(); jit!=target->m_joinedSlots.end(); jit++) { + if (*jit == this) { target->m_joinedSlots.erase(jit); found0 = 1; break; } } - if(!found0) + if (!found0) abort(); - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { found1 = 0; - for(jt=target->m_displayArrays.begin(); jt!=target->m_displayArrays.end(); jt++) { - if(*jt == *it) { + for (jt=target->m_displayArrays.begin(); jt!=target->m_displayArrays.end(); jt++) { + if (*jt == *it) { target->m_displayArrays.erase(jt); target->m_endarray--; found1 = 1; @@ -457,11 +457,11 @@ bool RAS_MeshSlot::Split(bool force) } } - if(!found1) + if (!found1) abort(); } - if(target->m_displayArrays.size()) { + if (target->m_displayArrays.size()) { target->m_endvertex = target->m_displayArrays.back()->m_vertex.size(); target->m_endindex = target->m_displayArrays.back()->m_index.size(); } @@ -473,8 +473,8 @@ bool RAS_MeshSlot::Split(bool force) MT_Matrix4x4 ntransform = m_joinInvTransform.inverse().transposed(); ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f; - for(begin(mit); !end(mit); next(mit)) - for(i=mit.startvertex; i<mit.endvertex; i++) + for (begin(mit); !end(mit); next(mit)) + for (i=mit.startvertex; i<mit.endvertex; i++) mit.vertex[i].Transform(m_joinInvTransform, ntransform); if (target->m_DisplayList) { @@ -492,13 +492,13 @@ bool RAS_MeshSlot::Split(bool force) #ifdef USE_SPLIT bool RAS_MeshSlot::IsCulled() { - if(m_joinSlot) + if (m_joinSlot) return true; - if(!m_bCulled) + if (!m_bCulled) return false; list<RAS_MeshSlot*>::iterator it; - for(it=m_joinedSlots.begin(); it!=m_joinedSlots.end(); it++) - if(!(*it)->m_bCulled) + for (it=m_joinedSlots.begin(); it!=m_joinedSlots.end(); it++) + if (!(*it)->m_bCulled) return false; return true; } @@ -563,8 +563,8 @@ void RAS_MaterialBucket::RemoveMesh(RAS_MeshSlot* ms) { list<RAS_MeshSlot>::iterator it; - for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) { - if(&*it == ms) { + for (it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) { + if (&*it == ms) { m_meshSlots.erase(it); return; } @@ -586,10 +586,10 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I { bool uselights; - if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows()) + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows()) return false; - if(!rasty->SetMaterial(*m_material)) + if (!rasty->SetMaterial(*m_material)) return false; uselights= m_material->UsesLighting(rasty); @@ -609,7 +609,7 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa // KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics mesh. (Can't call KX_* from RAS_) } - if(IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) + if (IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGLMatrix)); rendertools->PushMatrix(); @@ -618,8 +618,8 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->GetDrawingMode()); } - if(rasty->QueryLists()) - if(ms.m_DisplayList) + if (rasty->QueryLists()) + if (ms.m_DisplayList) ms.m_DisplayList->SetModified(ms.m_mesh->MeshModified()); // verify if we can use display list, not for deformed object, and @@ -627,13 +627,13 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa // then it won't have texture coordinates for actual drawing. also // for zsort we can't make a display list, since the polygon order // changes all the time. - if(ms.m_pDeformer && ms.m_pDeformer->IsDynamic()) + if (ms.m_pDeformer && ms.m_pDeformer->IsDynamic()) ms.m_bDisplayList = false; - else if(!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW) + else if (!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW) ms.m_bDisplayList = false; else if (IsZSort()) ms.m_bDisplayList = false; - else if(m_material->UsesObjectColor() && ms.m_bObjectColor) + else if (m_material->UsesObjectColor() && ms.m_bObjectColor) ms.m_bDisplayList = false; else ms.m_bDisplayList = true; @@ -642,14 +642,14 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT) rasty->IndexPrimitives_3DText(ms, m_material, rendertools); // for multitexturing - else if((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL))) + else if ((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL))) rasty->IndexPrimitivesMulti(ms); // use normal IndexPrimitives else rasty->IndexPrimitives(ms); - if(rasty->QueryLists()) - if(ms.m_DisplayList) + if (rasty->QueryLists()) + if (ms.m_DisplayList) ms.m_mesh->SetMeshModified(false); rendertools->PopMatrix(); @@ -666,8 +666,8 @@ void RAS_MaterialBucket::Optimize(MT_Scalar distance) list<RAS_MeshSlot>::iterator jt; // greed joining on all following buckets - for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) - for(jt=it, jt++; jt!=m_meshSlots.end(); jt++) + for (it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) + for (jt=it, jt++; jt!=m_meshSlots.end(); jt++) jt->Join(&*it, distance); #endif } diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp index afa62a9a8c6..7da0be3a506 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp @@ -64,7 +64,7 @@ struct RAS_MeshObject::polygonSlot MT_Vector3 center(0, 0, 0); int i; - for(i=0; i<nvert; i++) { + for (i=0; i<nvert; i++) { m_index[i] = indexarray[offset+i]; center += vertexarray[m_index[i]].getXYZ(); } @@ -79,7 +79,7 @@ struct RAS_MeshObject::polygonSlot { int i; - for(i=0; i<nvert; i++) + for (i=0; i<nvert; i++) indexarray[offset+i] = m_index[i]; } }; @@ -115,7 +115,7 @@ RAS_MeshObject::RAS_MeshObject(Mesh* mesh) int count=0; // initialize weight cache for shape objects // count how many keys in this mesh - for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) + for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) count++; m_cacheWeightIndex.resize(count,-1); } @@ -129,14 +129,14 @@ RAS_MeshObject::~RAS_MeshObject() { KeyBlock *kb; // remove the weight cache to avoid memory leak - for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) { - if(kb->weights) + for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) { + if (kb->weights) MEM_freeN(kb->weights); kb->weights= NULL; } } - for(it=m_Polygons.begin(); it!=m_Polygons.end(); it++) + for (it=m_Polygons.begin(); it!=m_Polygons.end(); it++) delete (*it); m_sharedvertex_map.clear(); @@ -165,7 +165,7 @@ const STR_String& RAS_MeshObject::GetMaterialName(unsigned int matid) { RAS_MeshMaterial* mmat = GetMeshMaterial(matid); - if(mmat) + if (mmat) return mmat->m_bucket->GetPolyMaterial()->GetMaterialName(); return s_emptyname; @@ -234,7 +234,7 @@ const STR_String& RAS_MeshObject::GetTextureName(unsigned int matid) { RAS_MeshMaterial* mmat = GetMeshMaterial(matid); - if(mmat) + if (mmat) return mmat->m_bucket->GetPolyMaterial()->GetTextureName(); return s_emptyname; @@ -245,8 +245,8 @@ RAS_MeshMaterial *RAS_MeshObject::GetMeshMaterial(RAS_IPolyMaterial *mat) list<RAS_MeshMaterial>::iterator mit; /* find a mesh material */ - for(mit = m_materials.begin(); mit != m_materials.end(); mit++) - if(mit->m_bucket->GetPolyMaterial() == mat) + for (mit = m_materials.begin(); mit != m_materials.end(); mit++) + if (mit->m_bucket->GetPolyMaterial() == mat) return &*mit; return NULL; @@ -258,8 +258,8 @@ int RAS_MeshObject::GetMaterialId(RAS_IPolyMaterial *mat) int imat; /* find a mesh material */ - for(imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++) - if(mit->m_bucket->GetPolyMaterial() == mat) + for (imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++) + if (mit->m_bucket->GetPolyMaterial() == mat) return imat; return -1; @@ -275,7 +275,7 @@ RAS_Polygon* RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts mmat = GetMeshMaterial(bucket->GetPolyMaterial()); /* none found, create a new one */ - if(!mmat) { + if (!mmat) { RAS_MeshMaterial meshmat; meshmat.m_bucket = bucket; meshmat.m_baseslot = meshmat.m_bucket->AddMesh(numverts); @@ -317,8 +317,8 @@ void RAS_MeshObject::SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba) RAS_MeshSlot::iterator it; size_t i; - for(slot->begin(it); !slot->end(it); slot->next(it)) - for(i=it.startvertex; i<it.endvertex; i++) + for (slot->begin(it); !slot->end(it); slot->next(it)) + for (i=it.startvertex; i<it.endvertex; i++) it.vertex[i].SetRGBA(rgba); } @@ -349,15 +349,15 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i, vector<SharedVertex>& sharedmap = m_sharedvertex_map[origindex]; vector<SharedVertex>::iterator it; - for(it = sharedmap.begin(); it != sharedmap.end(); it++) + for (it = sharedmap.begin(); it != sharedmap.end(); it++) { - if(it->m_darray != darray) + if (it->m_darray != darray) continue; - if(!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert)) + if (!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert)) continue; /* found one, add it and we're done */ - if(poly->IsVisible()) + if (poly->IsVisible()) slot->AddPolygonVertex(it->m_offset); poly->SetVertexOffset(i, it->m_offset); return; @@ -366,7 +366,7 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i, /* no shared vertex found, add a new one */ offset = slot->AddVertex(texvert); - if(poly->IsVisible()) + if (poly->IsVisible()) slot->AddPolygonVertex(offset); poly->SetVertexOffset(i, offset); @@ -387,7 +387,7 @@ int RAS_MeshObject::NumVertices(RAS_IPolyMaterial* mat) mmat = GetMeshMaterial(mat); slot = mmat->m_baseslot; - for(slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) len += it.endvertex - it.startvertex; return len; @@ -404,13 +404,13 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid, mmat = GetMeshMaterial(matid); - if(!mmat) + if (!mmat) return NULL; slot = mmat->m_baseslot; len = 0; - for(slot->begin(it); !slot->end(it); slot->next(it)) { - if(index >= len + it.endvertex - it.startvertex) + for (slot->begin(it); !slot->end(it); slot->next(it)) { + if (index >= len + it.endvertex - it.startvertex) len += it.endvertex - it.startvertex; else return &it.vertex[index - len]; @@ -431,7 +431,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* list<RAS_MeshMaterial>::iterator it; list<RAS_MeshMaterial>::iterator mit; - for(it = m_materials.begin();it!=m_materials.end();++it) { + for (it = m_materials.begin();it!=m_materials.end();++it) { /* always copy from the base slot, which is never removed * since new objects can be created with the same mesh data */ if (deformer && !deformer->UseVertexArray()) @@ -444,7 +444,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial(); if (curmat->GetFlag() & RAS_BLENDERGLSL) { - for(mit = m_materials.begin(); mit != it; ++mit) + for (mit = m_materials.begin(); mit != it; ++mit) { RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial(); if ((mat->GetFlag() & RAS_BLENDERGLSL) && @@ -468,10 +468,10 @@ void RAS_MeshObject::RemoveFromBuckets(void *clientobj) { list<RAS_MeshMaterial>::iterator it; - for(it = m_materials.begin();it!=m_materials.end();++it) { + for (it = m_materials.begin();it!=m_materials.end();++it) { RAS_MeshSlot **msp = it->m_slots[clientobj]; - if(!msp) + if (!msp) continue; RAS_MeshSlot *ms = *msp; @@ -523,13 +523,13 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor RAS_MeshSlot::iterator it; size_t j; - for(ms.begin(it); !ms.end(it); ms.next(it)) { + for (ms.begin(it); !ms.end(it); ms.next(it)) { unsigned int nvert = (int)it.array->m_type; unsigned int totpoly = it.totindex/nvert; - if(totpoly <= 1) + if (totpoly <= 1) continue; - if(it.array->m_type == RAS_DisplayArray::LINE) + if (it.array->m_type == RAS_DisplayArray::LINE) continue; // Extract camera Z plane... @@ -539,14 +539,14 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor vector<polygonSlot> slots(totpoly); /* get indices and z into temporary array */ - for(j=0; j<totpoly; j++) + for (j=0; j<totpoly; j++) slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm); /* sort (stable_sort might be better, if flickering happens?) */ std::sort(slots.begin(), slots.end(), backtofront()); /* get indices from temporary array again */ - for(j=0; j<totpoly; j++) + for (j=0; j<totpoly; j++) slots[j].set(it.index, j*nvert, nvert); } } @@ -584,7 +584,7 @@ void RAS_MeshObject::CheckWeightCache(Object* obj) if (!m_mesh->key) return; - for(kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++) + for (kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++) { // first check the cases where the weight must be cleared if (kb->vgroup[0] == 0 || diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp index e1fff5fe077..665053984e6 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp @@ -40,29 +40,29 @@ namespace bgl { static bool firsttime = true; - if(firsttime) { + if (firsttime) { firsttime = false; - if(debug) { - if(GLEW_ATI_pn_triangles) + if (debug) { + if (GLEW_ATI_pn_triangles) std::cout << "Enabled GL_ATI_pn_triangles" << std::endl; - if(GLEW_ARB_texture_env_combine) + if (GLEW_ARB_texture_env_combine) std::cout << "Detected GL_ARB_texture_env_combine" << std::endl; - if(GLEW_ARB_texture_cube_map) + if (GLEW_ARB_texture_cube_map) std::cout << "Detected GL_ARB_texture_cube_map" << std::endl; - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) std::cout << "Detected GL_ARB_multitexture" << std::endl; - if(GLEW_ARB_shader_objects) + if (GLEW_ARB_shader_objects) std::cout << "Detected GL_ARB_shader_objects" << std::endl; - if(GLEW_ARB_vertex_shader) + if (GLEW_ARB_vertex_shader) std::cout << "Detected GL_ARB_vertex_shader" << std::endl; - if(GLEW_ARB_fragment_shader) + if (GLEW_ARB_fragment_shader) std::cout << "Detected GL_ARB_fragment_shader" << std::endl; - if(GLEW_ARB_vertex_program) + if (GLEW_ARB_vertex_program) std::cout << "Detected GL_ARB_vertex_program" << std::endl; - if(GLEW_ARB_depth_texture) + if (GLEW_ARB_depth_texture) std::cout << "Detected GL_ARB_depth_texture" << std::endl; - if(GLEW_EXT_separate_specular_color) + if (GLEW_EXT_separate_specular_color) std::cout << "Detected GL_EXT_separate_specular_color" << std::endl; } } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp index 4e4d70fac31..1f411a09586 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -50,7 +50,7 @@ RAS_ListSlot::~RAS_ListSlot() void RAS_ListSlot::RemoveList() { - if(m_list != 0) { + if (m_list != 0) { spit("Releasing display list (" << m_list << ")"); glDeleteLists((GLuint)m_list, 1); m_list =0; @@ -59,19 +59,19 @@ void RAS_ListSlot::RemoveList() void RAS_ListSlot::DrawList() { - if(m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) { + if (m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) { RemoveList(); return; } - if(m_flag &LIST_MODIFY) { - if(m_flag &LIST_CREATE) { - if(m_list == 0) { + if (m_flag &LIST_MODIFY) { + if (m_flag &LIST_CREATE) { + if (m_list == 0) { m_list = (unsigned int)glGenLists(1); m_flag = m_flag &~ LIST_CREATE; spit("Created display list (" << m_list << ")"); } } - if(m_list != 0) + if (m_list != 0) glNewList((GLuint)m_list, GL_COMPILE); m_flag |= LIST_BEGIN; @@ -82,7 +82,7 @@ void RAS_ListSlot::DrawList() void RAS_ListSlot::EndList() { - if(m_flag & LIST_BEGIN) { + if (m_flag & LIST_BEGIN) { glEndList(); m_flag = m_flag &~(LIST_BEGIN|LIST_MODIFY); m_flag |= LIST_END; @@ -92,7 +92,7 @@ void RAS_ListSlot::EndList() void RAS_ListSlot::SetModified(bool mod) { - if(mod && !(m_flag & LIST_MODIFY)) { + if (mod && !(m_flag & LIST_MODIFY)) { spit("Modifying list (" << m_list << ")"); m_flag = m_flag &~ LIST_END; m_flag |= LIST_STREAM; @@ -164,7 +164,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms) * :: sorted by mesh slot */ RAS_ListSlot* localSlot = (RAS_ListSlot*)ms.m_DisplayList; - if(!localSlot) { + if (!localSlot) { if (ms.m_pDerivedMesh) { // that means that we draw based on derived mesh, a display list is possible // Note that we come here only for static derived mesh @@ -172,7 +172,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms) RAS_ListSlot* nullSlot = NULL; RAS_ListSlots *listVector; RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.find(ms.m_pDerivedMesh); - if(it == mDerivedMeshLists.end()) { + if (it == mDerivedMeshLists.end()) { listVector = new RAS_ListSlots(matnr+4, nullSlot); localSlot = new RAS_ListSlot(this); localSlot->m_flag |= LIST_DERIVEDMESH; @@ -194,7 +194,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms) } } else { RAS_ArrayLists::iterator it = mArrayLists.find(ms.m_displayArrays); - if(it == mArrayLists.end()) { + if (it == mArrayLists.end()) { localSlot = new RAS_ListSlot(this); mArrayLists.insert(std::pair<RAS_DisplayArrayList, RAS_ListSlot*>(ms.m_displayArrays, localSlot)); } else { @@ -208,7 +208,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms) void RAS_ListRasterizer::ReleaseAlloc() { - for(RAS_ArrayLists::iterator it = mArrayLists.begin();it != mArrayLists.end();++it) + for (RAS_ArrayLists::iterator it = mArrayLists.begin();it != mArrayLists.end();++it) delete it->second; mArrayLists.clear(); for (RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.begin();it != mDerivedMeshLists.end();++it) { @@ -228,10 +228,10 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms) { RAS_ListSlot* localSlot =0; - if(ms.m_bDisplayList) { + if (ms.m_bDisplayList) { localSlot = FindOrAdd(ms); localSlot->DrawList(); - if(localSlot->End()) { + if (localSlot->End()) { // save slot here too, needed for replicas and object using same mesh // => they have the same vertexarray but different mesh slot ms.m_DisplayList = localSlot; @@ -244,7 +244,7 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms) else RAS_OpenGLRasterizer::IndexPrimitives(ms); - if(ms.m_bDisplayList) { + if (ms.m_bDisplayList) { localSlot->EndList(); ms.m_DisplayList = localSlot; } @@ -255,11 +255,11 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) { RAS_ListSlot* localSlot =0; - if(ms.m_bDisplayList) { + if (ms.m_bDisplayList) { localSlot = FindOrAdd(ms); localSlot->DrawList(); - if(localSlot->End()) { + if (localSlot->End()) { // save slot here too, needed for replicas and object using same mesh // => they have the same vertexarray but different mesh slot ms.m_DisplayList = localSlot; @@ -275,7 +275,7 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) else RAS_OpenGLRasterizer::IndexPrimitivesMulti(ms); - if(ms.m_bDisplayList) { + if (ms.m_bDisplayList) { localSlot->EndList(); ms.m_DisplayList = localSlot; } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 7e9e3d9156c..b0c7b643f47 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -323,7 +323,7 @@ void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode) { m_drawingmode = drawingmode; - if(m_drawingmode == KX_WIREFRAME) + if (m_drawingmode == KX_WIREFRAME) glDisable(GL_CULL_FACE); } @@ -359,7 +359,7 @@ void RAS_OpenGLRasterizer::ClearCachingInfo(void) void RAS_OpenGLRasterizer::FlushDebugShapes() { - if(!m_debugShapes.size()) + if (!m_debugShapes.size()) return; // DrawDebugLines @@ -368,8 +368,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes() light= glIsEnabled(GL_LIGHTING); tex= glIsEnabled(GL_TEXTURE_2D); - if(light) glDisable(GL_LIGHTING); - if(tex) glDisable(GL_TEXTURE_2D); + if (light) glDisable(GL_LIGHTING); + if (tex) glDisable(GL_TEXTURE_2D); //draw lines glBegin(GL_LINES); @@ -423,8 +423,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes() glEnd(); } - if(light) glEnable(GL_LIGHTING); - if(tex) glEnable(GL_TEXTURE_2D); + if (light) glEnable(GL_LIGHTING); + if (tex) glEnable(GL_TEXTURE_2D); m_debugShapes.clear(); } @@ -513,7 +513,7 @@ RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode() bool RAS_OpenGLRasterizer::Stereo() { - if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0 + if (m_stereomode > RAS_STEREO_NOSTEREO) // > 0 return true; else return false; @@ -624,17 +624,17 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, else glEnableClientState(GL_COLOR_ARRAY); - for(ms.begin(it); !ms.end(it); ms.next(it)) { + for (ms.begin(it); !ms.end(it); ms.next(it)) { RAS_TexVert *vertex; size_t i, j, numvert; numvert = it.array->m_type; - if(it.array->m_type == RAS_DisplayArray::LINE) { + if (it.array->m_type == RAS_DisplayArray::LINE) { // line drawing, no text glBegin(GL_LINES); - for(i=0; i<it.totindex; i+=2) + for (i=0; i<it.totindex; i+=2) { vertex = &it.vertex[it.index[i]]; glVertex3fv(vertex->getXYZ()); @@ -647,12 +647,12 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, } else { // triangle and quad text drawing - for(i=0; i<it.totindex; i+=numvert) + for (i=0; i<it.totindex; i+=numvert) { float v[4][3]; int glattrib, unit; - for(j=0; j<numvert; j++) { + for (j=0; j<numvert; j++) { vertex = &it.vertex[it.index[i+j]]; v[j][0] = vertex->getXYZ()[0]; @@ -662,9 +662,9 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, // find the right opengl attribute glattrib = -1; - if(GLEW_ARB_vertex_program) - for(unit=0; unit<m_attrib_num; unit++) - if(m_attrib[unit] == RAS_TEXCO_UV1) + if (GLEW_ARB_vertex_program) + for (unit=0; unit<m_attrib_num; unit++) + if (m_attrib[unit] == RAS_TEXCO_UV1) glattrib = unit; rendertools->RenderText(polymat->GetDrawingMode(), polymat, @@ -681,28 +681,28 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, void RAS_OpenGLRasterizer::SetTexCoordNum(int num) { m_texco_num = num; - if(m_texco_num > RAS_MAX_TEXCO) + if (m_texco_num > RAS_MAX_TEXCO) m_texco_num = RAS_MAX_TEXCO; } void RAS_OpenGLRasterizer::SetAttribNum(int num) { m_attrib_num = num; - if(m_attrib_num > RAS_MAX_ATTRIB) + if (m_attrib_num > RAS_MAX_ATTRIB) m_attrib_num = RAS_MAX_ATTRIB; } void RAS_OpenGLRasterizer::SetTexCoord(TexCoGen coords, int unit) { // this changes from material to material - if(unit < RAS_MAX_TEXCO) + if (unit < RAS_MAX_TEXCO) m_texco[unit] = coords; } void RAS_OpenGLRasterizer::SetAttrib(TexCoGen coords, int unit) { // this changes from material to material - if(unit < RAS_MAX_ATTRIB) + if (unit < RAS_MAX_ATTRIB) m_attrib[unit] = coords; } @@ -710,9 +710,9 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv) { int unit; - if(GLEW_ARB_multitexture) { - for(unit=0; unit<m_texco_num; unit++) { - if(tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) { + if (GLEW_ARB_multitexture) { + for (unit=0; unit<m_texco_num; unit++) { + if (tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) { glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2()); continue; } @@ -739,8 +739,8 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv) } } - if(GLEW_ARB_vertex_program) { - for(unit=0; unit<m_attrib_num; unit++) { + if (GLEW_ARB_vertex_program) { + for (unit=0; unit<m_attrib_num; unit++) { switch(m_attrib[unit]) { case RAS_TEXCO_ORCO: case RAS_TEXCO_GLOB: @@ -901,17 +901,17 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) return; } // iterate over display arrays, each containing an index + vertex array - for(ms.begin(it); !ms.end(it); ms.next(it)) { + for (ms.begin(it); !ms.end(it); ms.next(it)) { RAS_TexVert *vertex; size_t i, j, numvert; numvert = it.array->m_type; - if(it.array->m_type == RAS_DisplayArray::LINE) { + if (it.array->m_type == RAS_DisplayArray::LINE) { // line drawing glBegin(GL_LINES); - for(i=0; i<it.totindex; i+=2) + for (i=0; i<it.totindex; i+=2) { vertex = &it.vertex[it.index[i]]; glVertex3fv(vertex->getXYZ()); @@ -924,26 +924,26 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) } else { // triangle and quad drawing - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) + if (it.array->m_type == RAS_DisplayArray::TRIANGLE) glBegin(GL_TRIANGLES); else glBegin(GL_QUADS); - for(i=0; i<it.totindex; i+=numvert) + for (i=0; i<it.totindex; i+=numvert) { - if(obcolor) + if (obcolor) glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - for(j=0; j<numvert; j++) { + for (j=0; j<numvert; j++) { vertex = &it.vertex[it.index[i+j]]; - if(!wireframe) { - if(!obcolor) + if (!wireframe) { + if (!obcolor) glColor4ubv((const GLubyte *)(vertex->getRGBA())); glNormal3fv(vertex->getNormal()); - if(multi) + if (multi) TexCoord(*vertex); else glTexCoord2fv(vertex->getUV1()); @@ -993,7 +993,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( double mat[16]; // correction for stereo - if(Stereo()) + if (Stereo()) { float near_div_focallength; float offset; @@ -1062,7 +1062,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, m_viewmatrix = mat; // correction for stereo - if(Stereo() && perspective) + if (Stereo() && perspective) { MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention MT_Vector3 unitViewupVec(0.0, 0.0, 1.0); @@ -1192,7 +1192,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue) { /* don't just set m_motionblur to 1, but check if it is 0 so * we don't reset a motion blur that is already enabled */ - if(m_motionblur == 0) + if (m_motionblur == 0) m_motionblur = 1; m_motionblurvalue = motionblurvalue; } @@ -1207,26 +1207,26 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) { GPU_set_material_alpha_blend(alphablend); /* - if(alphablend == m_last_alphablend) + if (alphablend == m_last_alphablend) return; - if(alphablend == GPU_BLEND_SOLID) { + if (alphablend == GPU_BLEND_SOLID) { glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - else if(alphablend == GPU_BLEND_ADD) { + else if (alphablend == GPU_BLEND_ADD) { glBlendFunc(GL_ONE, GL_ONE); glEnable(GL_BLEND); glDisable(GL_ALPHA_TEST); } - else if(alphablend == GPU_BLEND_ALPHA) { + else if (alphablend == GPU_BLEND_ALPHA) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.0f); } - else if(alphablend == GPU_BLEND_CLIP) { + else if (alphablend == GPU_BLEND_CLIP) { glDisable(GL_BLEND); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.5f); @@ -1238,10 +1238,10 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) void RAS_OpenGLRasterizer::SetFrontFace(bool ccw) { - if(m_last_frontface == ccw) + if (m_last_frontface == ccw) return; - if(ccw) + if (ccw) glFrontFace(GL_CCW); else glFrontFace(GL_CW); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp index 06f3d129e7a..ff24bd639ba 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp @@ -116,18 +116,18 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms) return; } - if(!wireframe) + if (!wireframe) glEnableClientState(GL_TEXTURE_COORD_ARRAY); // use glDrawElements to draw each vertexarray - for(ms.begin(it); !ms.end(it); ms.next(it)) { - if(it.totindex == 0) + for (ms.begin(it); !ms.end(it); ms.next(it)) { + if (it.totindex == 0) continue; // drawing mode - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) + if (it.array->m_type == RAS_DisplayArray::TRIANGLE) drawmode = GL_TRIANGLES; - else if(it.array->m_type == RAS_DisplayArray::QUAD) + else if (it.array->m_type == RAS_DisplayArray::QUAD) drawmode = GL_QUADS; else drawmode = GL_LINES; @@ -150,9 +150,9 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms) glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ()); glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal()); - if(!wireframe) { + if (!wireframe) { glTexCoordPointer(2, GL_FLOAT, stride, it.vertex->getUV1()); - if(glIsEnabled(GL_COLOR_ARRAY)) + if (glIsEnabled(GL_COLOR_ARRAY)) glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA()); } @@ -160,7 +160,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms) glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index); } - if(!wireframe) { + if (!wireframe) { glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); } @@ -179,18 +179,18 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) return; } - if(!wireframe) + if (!wireframe) EnableTextures(true); // use glDrawElements to draw each vertexarray - for(ms.begin(it); !ms.end(it); ms.next(it)) { - if(it.totindex == 0) + for (ms.begin(it); !ms.end(it); ms.next(it)) { + if (it.totindex == 0) continue; // drawing mode - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) + if (it.array->m_type == RAS_DisplayArray::TRIANGLE) drawmode = GL_TRIANGLES; - else if(it.array->m_type == RAS_DisplayArray::QUAD) + else if (it.array->m_type == RAS_DisplayArray::QUAD) drawmode = GL_QUADS; else drawmode = GL_LINES; @@ -213,9 +213,9 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ()); glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal()); - if(!wireframe) { + if (!wireframe) { TexCoordPtr(it.vertex); - if(glIsEnabled(GL_COLOR_ARRAY)) + if (glIsEnabled(GL_COLOR_ARRAY)) glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA()); } @@ -223,7 +223,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index); } - if(!wireframe) { + if (!wireframe) { glDisableClientState(GL_COLOR_ARRAY); EnableTextures(false); } @@ -236,12 +236,12 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv) * materials can still be used and cause crashes */ int unit; - if(GLEW_ARB_multitexture) + if (GLEW_ARB_multitexture) { - for(unit=0; unit<m_texco_num; unit++) + for (unit=0; unit<m_texco_num; unit++) { glClientActiveTextureARB(GL_TEXTURE0_ARB+unit); - if(tv->getFlag() & RAS_TexVert::SECOND_UV && (int)tv->getUnit() == unit) { + if (tv->getFlag() & RAS_TexVert::SECOND_UV && (int)tv->getUnit() == unit) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert), tv->getUV2()); continue; @@ -272,8 +272,8 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv) glClientActiveTextureARB(GL_TEXTURE0_ARB); } - if(GLEW_ARB_vertex_program) { - for(unit=0; unit<m_attrib_num; unit++) { + if (GLEW_ARB_vertex_program) { + for (unit=0; unit<m_attrib_num; unit++) { switch(m_attrib[unit]) { case RAS_TEXCO_ORCO: case RAS_TEXCO_GLOB: @@ -308,7 +308,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) /* we cache last texcoords and attribs to ensure we disable the ones that * were actually last set */ - if(enable) { + if (enable) { texco = m_texco; texco_num = m_texco_num; attrib = m_attrib; @@ -326,8 +326,8 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) attrib_num = m_last_attrib_num; } - if(GLEW_ARB_multitexture) { - for(unit=0; unit<texco_num; unit++) { + if (GLEW_ARB_multitexture) { + for (unit=0; unit<texco_num; unit++) { glClientActiveTextureARB(GL_TEXTURE0_ARB+unit); switch(texco[unit]) @@ -338,7 +338,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) case RAS_TEXCO_NORM: case RAS_TEXTANGENT: case RAS_TEXCO_UV2: - if(enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if (enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY); else glDisableClientState(GL_TEXTURE_COORD_ARRAY); break; default: @@ -350,14 +350,14 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) glClientActiveTextureARB(GL_TEXTURE0_ARB); } else { - if(texco_num) { - if(enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if (texco_num) { + if (enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY); else glDisableClientState(GL_TEXTURE_COORD_ARRAY); } } - if(GLEW_ARB_vertex_program) { - for(unit=0; unit<attrib_num; unit++) { + if (GLEW_ARB_vertex_program) { + for (unit=0; unit<attrib_num; unit++) { switch(attrib[unit]) { case RAS_TEXCO_ORCO: case RAS_TEXCO_GLOB: @@ -366,7 +366,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) case RAS_TEXTANGENT: case RAS_TEXCO_UV2: case RAS_TEXCO_VCOL: - if(enable) glEnableVertexAttribArrayARB(unit); + if (enable) glEnableVertexAttribArrayARB(unit); else glDisableVertexAttribArrayARB(unit); break; default: @@ -376,7 +376,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) } } - if(!enable) { + if (!enable) { m_last_texco_num = 0; m_last_attrib_num = 0; } diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp index ebf34c3f58c..a6912c0997d 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.cpp +++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp @@ -76,7 +76,7 @@ int RAS_Polygon::GetVertexOffsetAbs(RAS_MeshObject *mesh, int i) * if support for edges is added back this would need to be changed. */ RAS_DisplayArray* darray= mesh->GetPolygon(0)->GetDisplayArray(); - if(m_darray != darray) + if (m_darray != darray) return m_offset[i] + darray->m_vertex.size(); return m_offset[i]; @@ -101,7 +101,7 @@ bool RAS_Polygon::IsVisible() void RAS_Polygon::SetVisible(bool visible) { - if(visible) m_polyflags |= VISIBLE; + if (visible) m_polyflags |= VISIBLE; else m_polyflags &= ~VISIBLE; } @@ -112,7 +112,7 @@ bool RAS_Polygon::IsCollider() void RAS_Polygon::SetCollider(bool visible) { - if(visible) m_polyflags |= COLLIDER; + if (visible) m_polyflags |= COLLIDER; else m_polyflags &= ~COLLIDER; } @@ -123,7 +123,7 @@ bool RAS_Polygon::IsTwoside() void RAS_Polygon::SetTwoside(bool twoside) { - if(twoside) m_polyflags |= TWOSIDE; + if (twoside) m_polyflags |= TWOSIDE; else m_polyflags &= ~TWOSIDE; } diff --git a/source/gameengine/SceneGraph/SG_Tree.cpp b/source/gameengine/SceneGraph/SG_Tree.cpp index 87c618fd214..738c0fdef22 100644 --- a/source/gameengine/SceneGraph/SG_Tree.cpp +++ b/source/gameengine/SceneGraph/SG_Tree.cpp @@ -182,7 +182,7 @@ public: void resize(unsigned int size) { m_array.resize(size); - for( unsigned int i = 0; i < size; i++) + for ( unsigned int i = 0; i < size; i++) { m_array[i].resize(size - i); } @@ -353,11 +353,11 @@ SG_Tree* SG_TreeFactory::MakeTreeUp() unsigned int x, y; TreeSet::iterator xit, yit; - for( y = 0, yit = m_objects.begin(); y < num_objects; y++, ++yit) + for ( y = 0, yit = m_objects.begin(); y < num_objects; y++, ++yit) { sizes(y, y) = *yit; xit = yit; - for( x = y+1, ++xit; x < num_objects; x++, ++xit) + for ( x = y+1, ++xit; x < num_objects; x++, ++xit) { sizes(x, y) = new SG_Tree(*xit, *yit); @@ -370,9 +370,9 @@ SG_Tree* SG_TreeFactory::MakeTreeUp() MT_Scalar min_volume = FLT_MAX; SG_Tree *min = NULL; //char temp[16]; - for( y = 0; y < num_objects; y++) + for ( y = 0; y < num_objects; y++) { - for( x = y+1; x < num_objects; x++) + for ( x = y+1; x < num_objects; x++) { if (sizes(x, y)->volume() < min_volume) { @@ -387,7 +387,7 @@ SG_Tree* SG_TreeFactory::MakeTreeUp() /* Remove other bboxes that contain the two bboxes */ sizes.delete_column(miny); - for( x = miny + 1; x < num_objects; x++) + for ( x = miny + 1; x < num_objects; x++) { if (x == minx) continue; @@ -398,12 +398,12 @@ SG_Tree* SG_TreeFactory::MakeTreeUp() num_objects--; minx--; sizes(minx, minx) = min; - for( x = minx + 1; x < num_objects; x++) + for ( x = minx + 1; x < num_objects; x++) { delete sizes(x, minx); sizes(x, minx) = new SG_Tree(min, sizes(x, x)); } - for( y = 0; y < minx; y++) + for ( y = 0; y < minx; y++) { delete sizes(minx, y); sizes(minx, y) = new SG_Tree(sizes(y, y), min); diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 3718a7b3094..9f7d42dcf56 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -459,7 +459,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds else THRWEXCP(SceneInvalid, S_OK); - if(scenePtr==NULL) /* in case the python proxy reference is invalid */ + if (scenePtr==NULL) /* in case the python proxy reference is invalid */ THRWEXCP(SceneInvalid, S_OK); // get observer pointer @@ -471,7 +471,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds else THRWEXCP(ObserverInvalid, S_OK); - if(observerPtr==NULL) /* in case the python proxy reference is invalid */ + if (observerPtr==NULL) /* in case the python proxy reference is invalid */ THRWEXCP(ObserverInvalid, S_OK); // get mirror pointer @@ -481,7 +481,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds else THRWEXCP(MirrorInvalid, S_OK); - if(mirrorPtr==NULL) /* in case the python proxy reference is invalid */ + if (mirrorPtr==NULL) /* in case the python proxy reference is invalid */ THRWEXCP(MirrorInvalid, S_OK); // locate the material in the mirror diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 9db85a0029a..427be39ef22 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -169,10 +169,10 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV AVCodec *codec; AVCodecContext *codecCtx; - if(av_open_input_file(&formatCtx, filename, inputFormat, 0, formatParams)!=0) + if (av_open_input_file(&formatCtx, filename, inputFormat, 0, formatParams)!=0) return -1; - if(av_find_stream_info(formatCtx)<0) + if (av_find_stream_info(formatCtx)<0) { av_close_input_file(formatCtx); return -1; @@ -180,9 +180,9 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV /* Find the first video stream */ videoStream=-1; - for(i=0; i<formatCtx->nb_streams; i++) + for (i=0; i<formatCtx->nb_streams; i++) { - if(formatCtx->streams[i] && + if (formatCtx->streams[i] && get_codec_from_stream(formatCtx->streams[i]) && (get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO)) { @@ -191,7 +191,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV } } - if(videoStream==-1) + if (videoStream==-1) { av_close_input_file(formatCtx); return -1; @@ -201,20 +201,20 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV /* Find the decoder for the video stream */ codec=avcodec_find_decoder(codecCtx->codec_id); - if(codec==NULL) + if (codec==NULL) { av_close_input_file(formatCtx); return -1; } codecCtx->workaround_bugs = 1; - if(avcodec_open(codecCtx, codec)<0) + if (avcodec_open(codecCtx, codec)<0) { av_close_input_file(formatCtx); return -1; } #ifdef FFMPEG_OLD_FRAME_RATE - if(codecCtx->frame_rate>1000 && codecCtx->frame_rate_base==1) + if (codecCtx->frame_rate>1000 && codecCtx->frame_rate_base==1) codecCtx->frame_rate_base=1000; m_baseFrameRate = (double)codecCtx->frame_rate / (double)codecCtx->frame_rate_base; #else @@ -373,7 +373,7 @@ void *VideoFFmpeg::cacheThread(void *data) avcodec_decode_video2(video->m_codecCtx, video->m_frame, &frameFinished, &cachePacket->packet); - if(frameFinished) + if (frameFinished) { AVFrame * input = video->m_frame; @@ -793,7 +793,7 @@ void VideoFFmpeg::calcImage (unsigned int texId, double ts) { AVFrame* frame; // get image - if((frame = grabFrame(actFrame)) != NULL) + if ((frame = grabFrame(actFrame)) != NULL) { if (!m_isFile && !m_cacheStarted) { @@ -999,7 +999,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position) // return the next frame. This is not quite correct, may need more work while(av_read_frame(m_formatCtx, &packet)>=0) { - if(packet.stream_index == m_videoStream) + if (packet.stream_index == m_videoStream) { avcodec_decode_video2(m_codecCtx, m_frame, &frameFinished, diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index 8410e9350d0..a82935c30bf 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -189,7 +189,7 @@ PyObject* initVideoTexture(void) /* Use existing module where possible * be careful not to init any runtime vars after this */ m = PyImport_ImportModule( "VideoTexture" ); - if(m) { + if (m) { Py_DECREF(m); return m; } |