diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:18:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:18:31 +0400 |
commit | 69e6894b15271884623ea6f56ead06db83acbe99 (patch) | |
tree | b68200606afaca06cf7552f6b12fc20ebd30d487 /source/blender/blenkernel/intern/screen.c | |
parent | 7b99ae0ad3017e373be2a344e30d190b70ca66b4 (diff) |
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index fe4316bf8d6..158fc91c03c 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -59,15 +59,15 @@ static void spacetype_free(SpaceType *st) PanelType *pt; HeaderType *ht; - for(art= st->regiontypes.first; art; art= art->next) { + for (art= st->regiontypes.first; art; art= art->next) { BLI_freelistN(&art->drawcalls); - for(pt= art->paneltypes.first; pt; pt= pt->next) - if(pt->ext.free) + for (pt= art->paneltypes.first; pt; pt= pt->next) + if (pt->ext.free) pt->ext.free(pt->ext.data); - for(ht= art->headertypes.first; ht; ht= ht->next) - if(ht->ext.free) + for (ht= art->headertypes.first; ht; ht= ht->next) + if (ht->ext.free) ht->ext.free(ht->ext.data); BLI_freelistN(&art->paneltypes); @@ -83,7 +83,7 @@ void BKE_spacetypes_free(void) { SpaceType *st; - for(st= spacetypes.first; st; st= st->next) { + for (st= spacetypes.first; st; st= st->next) { spacetype_free(st); } @@ -94,8 +94,8 @@ SpaceType *BKE_spacetype_from_id(int spaceid) { SpaceType *st; - for(st= spacetypes.first; st; st= st->next) { - if(st->spaceid==spaceid) + for (st= spacetypes.first; st; st= st->next) { + if (st->spaceid==spaceid) return st; } return NULL; @@ -105,8 +105,8 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) { ARegionType *art; - for(art= st->regiontypes.first; art; art= art->next) - if(art->regionid==regionid) + for (art= st->regiontypes.first; art; art= art->next) + if (art->regionid==regionid) return art; printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid); @@ -125,7 +125,7 @@ void BKE_spacetype_register(SpaceType *st) /* sanity check */ stype= BKE_spacetype_from_id(st->spaceid); - if(stype) { + if (stype) { printf("error: redefinition of spacetype %s\n", stype->name); spacetype_free(stype); MEM_freeN(stype); @@ -145,12 +145,12 @@ void BKE_spacedata_freelist(ListBase *lb) SpaceType *st= BKE_spacetype_from_id(sl->spacetype); /* free regions for pushed spaces */ - for(ar=sl->regionbase.first; ar; ar=ar->next) + for (ar=sl->regionbase.first; ar; ar=ar->next) BKE_area_region_free(st, ar); BLI_freelistN(&sl->regionbase); - if(st && st->free) + if (st && st->free) st->free(sl); } @@ -168,27 +168,27 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) newar->swinid= 0; /* use optional regiondata callback */ - if(ar->regiondata) { + if (ar->regiondata) { ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype); - if(art && art->duplicate) + if (art && art->duplicate) newar->regiondata= art->duplicate(ar->regiondata); else newar->regiondata= MEM_dupallocN(ar->regiondata); } - if(ar->v2d.tab_offset) + if (ar->v2d.tab_offset) newar->v2d.tab_offset= MEM_dupallocN(ar->v2d.tab_offset); newar->panels.first= newar->panels.last= NULL; BLI_duplicatelist(&newar->panels, &ar->panels); /* copy panel pointers */ - for(newpa= newar->panels.first; newpa; newpa= newpa->next) { + for (newpa= newar->panels.first; newpa; newpa= newpa->next) { patab= newar->panels.first; pa= ar->panels.first; - while(patab) { - if(newpa->paneltab == pa) { + while (patab) { + if (newpa->paneltab == pa) { newpa->paneltab = patab; break; } @@ -209,7 +209,7 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) /* to be sure */ lb1->first= lb1->last= NULL; - for(ar= lb2->first; ar; ar= ar->next) { + for (ar= lb2->first; ar; ar= ar->next) { ARegion *arnew= BKE_area_region_copy(st, ar); BLI_addtail(lb1, arnew); } @@ -226,7 +226,7 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2) for (sl= lb2->first; sl; sl= sl->next) { SpaceType *st= BKE_spacetype_from_id(sl->spacetype); - if(st && st->duplicate) { + if (st && st->duplicate) { SpaceLink *slnew= st->duplicate(sl); BLI_addtail(lb1, slnew); @@ -243,11 +243,11 @@ void BKE_spacedata_draw_locks(int set) { SpaceType *st; - for(st= spacetypes.first; st; st= st->next) { + for (st= spacetypes.first; st; st= st->next) { ARegionType *art; - for(art= st->regiontypes.first; art; art= art->next) { - if(set) + for (art= st->regiontypes.first; art; art= art->next) { + if (set) art->do_lock= art->lock; else art->do_lock= 0; @@ -259,19 +259,19 @@ void BKE_spacedata_draw_locks(int set) /* not region itself */ void BKE_area_region_free(SpaceType *st, ARegion *ar) { - if(st) { + if (st) { ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype); - if(art && art->free) + if (art && art->free) art->free(ar); - if(ar->regiondata) + if (ar->regiondata) printf("regiondata free error\n"); } - else if(ar->type && ar->type->free) + else if (ar->type && ar->type->free) ar->type->free(ar); - if(ar->v2d.tab_offset) { + if (ar->v2d.tab_offset) { MEM_freeN(ar->v2d.tab_offset); ar->v2d.tab_offset= NULL; } @@ -285,7 +285,7 @@ void BKE_screen_area_free(ScrArea *sa) SpaceType *st= BKE_spacetype_from_id(sa->spacetype); ARegion *ar; - for(ar=sa->regionbase.first; ar; ar=ar->next) + for (ar=sa->regionbase.first; ar; ar=ar->next) BKE_area_region_free(st, ar); BLI_freelistN(&sa->regionbase); @@ -301,12 +301,12 @@ void free_screen(bScreen *sc) ScrArea *sa, *san; ARegion *ar; - for(ar=sc->regionbase.first; ar; ar=ar->next) + for (ar=sc->regionbase.first; ar; ar=ar->next) BKE_area_region_free(NULL, ar); BLI_freelistN(&sc->regionbase); - for(sa= sc->areabase.first; sa; sa= san) { + for (sa= sc->areabase.first; sa; sa= san) { san= sa->next; BKE_screen_area_free(sa); } @@ -322,14 +322,14 @@ unsigned int BKE_screen_visible_layers(bScreen *screen, Scene *scene) ScrArea *sa; unsigned int layer= 0; - if(screen) { + if (screen) { /* get all used view3d layers */ - for(sa= screen->areabase.first; sa; sa= sa->next) - if(sa->spacetype==SPACE_VIEW3D) + for (sa= screen->areabase.first; sa; sa= sa->next) + if (sa->spacetype==SPACE_VIEW3D) layer |= ((View3D *)sa->spacedata.first)->lay; } - if(!layer) + if (!layer) return scene->lay; return layer; @@ -359,7 +359,7 @@ struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype ScrArea *sa, *big= NULL; int size, maxsize= 0; - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { if ((spacetype == -1) || sa->spacetype == spacetype) { if (min <= sa->winx && min <= sa->winy) { size= sa->winx*sa->winy; @@ -378,25 +378,25 @@ void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene) { int bit; - if(v3d->scenelock && v3d->localvd==NULL) { + if (v3d->scenelock && v3d->localvd==NULL) { v3d->lay= scene->lay; v3d->camera= scene->camera; - if(v3d->camera==NULL) { + if (v3d->camera==NULL) { ARegion *ar; - for(ar=v3d->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { + for (ar=v3d->regionbase.first; ar; ar= ar->next) { + if (ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d= ar->regiondata; - if(rv3d->persp==RV3D_CAMOB) + if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; } } } - if((v3d->lay & v3d->layact) == 0) { - for(bit= 0; bit<32; bit++) { - if(v3d->lay & (1<<bit)) { + if ((v3d->lay & v3d->layact) == 0) { + for (bit= 0; bit<32; bit++) { + if (v3d->lay & (1<<bit)) { v3d->layact= 1<<bit; break; } @@ -409,10 +409,10 @@ void BKE_screen_view3d_scene_sync(bScreen *sc) { /* are there cameras in the views that are not in the scene? */ ScrArea *sa; - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; BKE_screen_view3d_sync(v3d, sc->scene); } @@ -427,13 +427,13 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene) SpaceLink *sl; /* from scene copy to the other views */ - for(sc=screen_lb->first; sc; sc=sc->id.next) { - if(sc->scene!=scene) + for (sc=screen_lb->first; sc; sc=sc->id.next) { + if (sc->scene!=scene) continue; - for(sa=sc->areabase.first; sa; sa=sa->next) - for(sl=sa->spacedata.first; sl; sl=sl->next) - if(sl->spacetype==SPACE_VIEW3D) + for (sa=sc->areabase.first; sa; sa=sa->next) + for (sl=sa->spacedata.first; sl; sl=sl->next) + if (sl->spacetype==SPACE_VIEW3D) BKE_screen_view3d_sync((View3D*)sl, scene); } } |