From 69e6894b15271884623ea6f56ead06db83acbe99 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 06:18:31 +0000 Subject: style cleanup: follow style guide for formatting of if/for/while loops, and else if's --- source/blender/blenkernel/intern/sca.c | 164 ++++++++++++++++----------------- 1 file changed, 82 insertions(+), 82 deletions(-) (limited to 'source/blender/blenkernel/intern/sca.c') diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 30a7449be1b..8123cbf3f0b 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -54,8 +54,8 @@ void free_sensor(bSensor *sens) { - if(sens->links) MEM_freeN(sens->links); - if(sens->data) MEM_freeN(sens->data); + if (sens->links) MEM_freeN(sens->links); + if (sens->data) MEM_freeN(sens->data); MEM_freeN(sens); } @@ -64,7 +64,7 @@ void free_sensors(ListBase *lb) { bSensor *sens; - while((sens= lb->first)) { + while ((sens= lb->first)) { BLI_remlink(lb, sens); free_sensor(sens); } @@ -76,11 +76,11 @@ bSensor *copy_sensor(bSensor *sens) sensn= MEM_dupallocN(sens); sensn->flag |= SENS_NEW; - if(sens->data) { + if (sens->data) { sensn->data= MEM_dupallocN(sens->data); } - if(sens->links) sensn->links= MEM_dupallocN(sens->links); + if (sens->links) sensn->links= MEM_dupallocN(sens->links); return sensn; } @@ -91,7 +91,7 @@ void copy_sensors(ListBase *lbn, ListBase *lbo) lbn->first= lbn->last= NULL; sens= lbo->first; - while(sens) { + while (sens) { sensn= copy_sensor(sens); BLI_addtail(lbn, sensn); sens= sens->next; @@ -106,7 +106,7 @@ void init_sensor(bSensor *sens) bJoystickSensor *js; bRaySensor *rs; - if(sens->data) MEM_freeN(sens->data); + if (sens->data) MEM_freeN(sens->data); sens->data= NULL; sens->pulse = 0; @@ -196,9 +196,9 @@ void unlink_controller(bController *cont) /* check for controller pointers in sensors */ ob= G.main->object.first; - while(ob) { + while (ob) { sens= ob->sensors.first; - while(sens) { + while (sens) { unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks); sens= sens->next; } @@ -216,10 +216,10 @@ void unlink_controllers(ListBase *lb) void free_controller(bController *cont) { - if(cont->links) MEM_freeN(cont->links); + if (cont->links) MEM_freeN(cont->links); /* the controller itself */ - if(cont->data) MEM_freeN(cont->data); + if (cont->data) MEM_freeN(cont->data); MEM_freeN(cont); } @@ -228,9 +228,9 @@ void free_controllers(ListBase *lb) { bController *cont; - while((cont= lb->first)) { + while ((cont= lb->first)) { BLI_remlink(lb, cont); - if(cont->slinks) MEM_freeN(cont->slinks); + if (cont->slinks) MEM_freeN(cont->slinks); free_controller(cont); } } @@ -241,11 +241,11 @@ bController *copy_controller(bController *cont) cont->mynew=contn= MEM_dupallocN(cont); contn->flag |= CONT_NEW; - if(cont->data) { + if (cont->data) { contn->data= MEM_dupallocN(cont->data); } - if(cont->links) contn->links= MEM_dupallocN(cont->links); + if (cont->links) contn->links= MEM_dupallocN(cont->links); contn->slinks= NULL; contn->totslinks= 0; @@ -258,7 +258,7 @@ void copy_controllers(ListBase *lbn, ListBase *lbo) lbn->first= lbn->last= NULL; cont= lbo->first; - while(cont) { + while (cont) { contn= copy_controller(cont); BLI_addtail(lbn, contn); cont= cont->next; @@ -269,7 +269,7 @@ void init_controller(bController *cont) { /* also use when controller changes type, leave actuators... */ - if(cont->data) MEM_freeN(cont->data); + if (cont->data) MEM_freeN(cont->data); cont->data= NULL; switch(cont->type) { @@ -307,9 +307,9 @@ void unlink_actuator(bActuator *act) /* check for actuator pointers in controllers */ ob= G.main->object.first; - while(ob) { + while (ob) { cont= ob->controllers.first; - while(cont) { + while (cont) { unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks); cont= cont->next; } @@ -329,11 +329,11 @@ void free_actuator(bActuator *act) { bSoundActuator *sa; - if(act->data) { + if (act->data) { switch (act->type) { case ACT_SOUND: sa = (bSoundActuator *) act->data; - if(sa->sound) + if (sa->sound) id_us_min((ID *) sa->sound); break; } @@ -347,7 +347,7 @@ void free_actuators(ListBase *lb) { bActuator *act; - while((act= lb->first)) { + while ((act= lb->first)) { BLI_remlink(lb, act); free_actuator(act); } @@ -360,14 +360,14 @@ bActuator *copy_actuator(bActuator *act) act->mynew=actn= MEM_dupallocN(act); actn->flag |= ACT_NEW; - if(act->data) { + if (act->data) { actn->data= MEM_dupallocN(act->data); } switch (act->type) { case ACT_SOUND: sa= (bSoundActuator *)act->data; - if(sa->sound) + if (sa->sound) id_us_plus((ID *) sa->sound); break; } @@ -380,7 +380,7 @@ void copy_actuators(ListBase *lbn, ListBase *lbo) lbn->first= lbn->last= NULL; act= lbo->first; - while(act) { + while (act) { actn= copy_actuator(act); BLI_addtail(lbn, actn); act= act->next; @@ -397,7 +397,7 @@ void init_actuator(bActuator *act) bSteeringActuator *sta; bArmatureActuator *arma; - if(act->data) MEM_freeN(act->data); + if (act->data) MEM_freeN(act->data); act->data= NULL; switch(act->type) { @@ -512,18 +512,18 @@ void clear_sca_new_poins_ob(Object *ob) bActuator *act; sens= ob->sensors.first; - while(sens) { + while (sens) { sens->flag &= ~SENS_NEW; sens= sens->next; } cont= ob->controllers.first; - while(cont) { + while (cont) { cont->mynew= NULL; cont->flag &= ~CONT_NEW; cont= cont->next; } act= ob->actuators.first; - while(act) { + while (act) { act->mynew= NULL; act->flag &= ~ACT_NEW; act= act->next; @@ -535,7 +535,7 @@ void clear_sca_new_poins(void) Object *ob; ob= G.main->object.first; - while(ob) { + while (ob) { clear_sca_new_poins_ob(ob); ob= ob->id.next; } @@ -549,10 +549,10 @@ void set_sca_new_poins_ob(Object *ob) int a; sens= ob->sensors.first; - while(sens) { - if(sens->flag & SENS_NEW) { - for(a=0; atotlinks; a++) { - if(sens->links[a] && sens->links[a]->mynew) + while (sens) { + if (sens->flag & SENS_NEW) { + for (a=0; atotlinks; a++) { + if (sens->links[a] && sens->links[a]->mynew) sens->links[a]= sens->links[a]->mynew; } } @@ -560,10 +560,10 @@ void set_sca_new_poins_ob(Object *ob) } cont= ob->controllers.first; - while(cont) { - if(cont->flag & CONT_NEW) { - for(a=0; atotlinks; a++) { - if( cont->links[a] && cont->links[a]->mynew) + while (cont) { + if (cont->flag & CONT_NEW) { + for (a=0; atotlinks; a++) { + if ( cont->links[a] && cont->links[a]->mynew) cont->links[a]= cont->links[a]->mynew; } } @@ -572,42 +572,42 @@ void set_sca_new_poins_ob(Object *ob) act= ob->actuators.first; - while(act) { - if(act->flag & ACT_NEW) { - if(act->type==ACT_EDIT_OBJECT) { + while (act) { + if (act->flag & ACT_NEW) { + if (act->type==ACT_EDIT_OBJECT) { bEditObjectActuator *eoa= act->data; ID_NEW(eoa->ob); } - else if(act->type==ACT_SCENE) { + else if (act->type==ACT_SCENE) { bSceneActuator *sca= act->data; ID_NEW(sca->camera); } - else if(act->type==ACT_CAMERA) { + else if (act->type==ACT_CAMERA) { bCameraActuator *ca= act->data; ID_NEW(ca->ob); } - else if(act->type==ACT_OBJECT) { + else if (act->type==ACT_OBJECT) { bObjectActuator *oa= act->data; ID_NEW(oa->reference); } - else if(act->type==ACT_MESSAGE) { + else if (act->type==ACT_MESSAGE) { bMessageActuator *ma= act->data; ID_NEW(ma->toObject); } - else if(act->type==ACT_PARENT) { + else if (act->type==ACT_PARENT) { bParentActuator *para = act->data; ID_NEW(para->ob); } - else if(act->type==ACT_ARMATURE) { + else if (act->type==ACT_ARMATURE) { bArmatureActuator *aa = act->data; ID_NEW(aa->target); ID_NEW(aa->subtarget); } - else if(act->type==ACT_PROPERTY) { + else if (act->type==ACT_PROPERTY) { bPropertyActuator *pa= act->data; ID_NEW(pa->ob); } - else if(act->type==ACT_STEERING) { + else if (act->type==ACT_STEERING) { bSteeringActuator *sta = act->data; ID_NEW(sta->navmesh); ID_NEW(sta->target); @@ -623,7 +623,7 @@ void set_sca_new_poins(void) Object *ob; ob= G.main->object.first; - while(ob) { + while (ob) { set_sca_new_poins_ob(ob); ob= ob->id.next; } @@ -646,41 +646,41 @@ void sca_remove_ob_poin(Object *obt, Object *ob) sens= obt->sensors.first; - while(sens) { + while (sens) { switch(sens->type) { case SENS_MESSAGE: ms= sens->data; - if(ms->fromObject==ob) ms->fromObject= NULL; + if (ms->fromObject==ob) ms->fromObject= NULL; } sens= sens->next; } act= obt->actuators.first; - while(act) { + while (act) { switch(act->type) { case ACT_CAMERA: ca= act->data; - if(ca->ob==ob) ca->ob= NULL; + if (ca->ob==ob) ca->ob= NULL; break; case ACT_OBJECT: oa= act->data; - if(oa->reference==ob) oa->reference= NULL; + if (oa->reference==ob) oa->reference= NULL; break; case ACT_PROPERTY: pa= act->data; - if(pa->ob==ob) pa->ob= NULL; + if (pa->ob==ob) pa->ob= NULL; break; case ACT_SCENE: sa= act->data; - if(sa->camera==ob) sa->camera= NULL; + if (sa->camera==ob) sa->camera= NULL; break; case ACT_EDIT_OBJECT: eoa= act->data; - if(eoa->ob==ob) eoa->ob= NULL; + if (eoa->ob==ob) eoa->ob= NULL; break; case ACT_MESSAGE: ma= act->data; - if(ma->toObject==ob) ma->toObject= NULL; + if (ma->toObject==ob) ma->toObject= NULL; break; case ACT_PARENT: para = act->data; @@ -710,14 +710,14 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up) /* make sure this sensor belongs to this object */ sens= ob->sensors.first; - while(sens) { - if(sens == sens_to_move) break; + while (sens) { + if (sens == sens_to_move) break; sens= sens->next; } - if(!sens) return; + if (!sens) return; /* move up */ - if( val==1 && sens->prev) { + if ( val==1 && sens->prev) { for (tmp=sens->prev; tmp; tmp=tmp->prev) { if (tmp->flag & SENS_VISIBLE) break; @@ -728,7 +728,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up) } } /* move down */ - else if( val==2 && sens->next) { + else if ( val==2 && sens->next) { for (tmp=sens->next; tmp; tmp=tmp->next) { if (tmp->flag & SENS_VISIBLE) break; @@ -749,18 +749,18 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) /* make sure this controller belongs to this object */ cont= ob->controllers.first; - while(cont) { - if(cont == cont_to_move) break; + while (cont) { + if (cont == cont_to_move) break; cont= cont->next; } - if(!cont) return; + if (!cont) return; /* move up */ - if( val==1 && cont->prev) { + 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) { - if(tmp->state_mask & cont->state_mask) + while (tmp) { + if (tmp->state_mask & cont->state_mask) break; tmp = tmp->prev; } @@ -771,10 +771,10 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) } /* move down */ - else if( val==2 && cont->next) { + else if ( val==2 && cont->next) { tmp = cont->next; - while(tmp) { - if(tmp->state_mask & cont->state_mask) + while (tmp) { + if (tmp->state_mask & cont->state_mask) break; tmp = tmp->next; } @@ -792,14 +792,14 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) /* make sure this actuator belongs to this object */ act= ob->actuators.first; - while(act) { - if(act == act_to_move) break; + while (act) { + if (act == act_to_move) break; act= act->next; } - if(!act) return; + if (!act) return; /* move up */ - if( val==1 && act->prev) { + if ( val==1 && act->prev) { /* locate the first visible actuators before this one */ for (tmp = act->prev; tmp; tmp=tmp->prev) { if (tmp->flag & ACT_VISIBLE) @@ -811,7 +811,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) } } /* move down */ - else if( val==2 && act->next) { + else if ( val==2 && act->next) { /* locate the first visible actuators after this one */ for (tmp=act->next; tmp; tmp=tmp->next) { if (tmp->flag & ACT_VISIBLE) @@ -847,7 +847,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size) } (*ppoin)[ibrick] = *poin; - if(old_links) MEM_freeN(old_links); + if (old_links) MEM_freeN(old_links); } else { (*tot) = 1; @@ -862,14 +862,14 @@ void unlink_logicbricks(void **poin, void ***ppoin, short *tot) removed= 0; for (ibrick=0; ibrick < *tot; ibrick++) { - if(removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick]; - else if((*ppoin)[ibrick] == *poin) removed = 1; + if (removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick]; + else if ((*ppoin)[ibrick] == *poin) removed = 1; } if (removed) { (*tot) --; - if(*tot == 0) { + if (*tot == 0) { MEM_freeN(*ppoin); (*ppoin)= NULL; } -- cgit v1.2.3