diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:38:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:38:07 +0400 |
commit | ab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 (patch) | |
tree | 81af4c18519181490074508dbe9a8d515eab634f /source/blender/editors/space_info/info_stats.c | |
parent | 5a90ea77bc1333efe4e1e54984a080550ed3f707 (diff) |
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/editors/space_info/info_stats.c')
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index ea28057968a..59e4a1aaf04 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -76,7 +76,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totmesh +=totob; - if(dm) { + if (dm) { totvert = dm->getNumVerts(dm); totedge = dm->getNumEdges(dm); totface = dm->getNumPolys(dm); @@ -85,7 +85,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totedge += totedge*totob; stats->totface += totface*totob; - if(sel) { + if (sel) { stats->totvertsel += totvert; stats->totfacesel += totface; } @@ -102,7 +102,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totcurve += totob; - if(ob->disp.first) + if (ob->disp.first) count_displist(&ob->disp, &tot, &totf); tot *= totob; @@ -111,7 +111,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totvert+= tot; stats->totface+= totf; - if(sel) { + if (sel) { stats->totvertsel += tot; stats->totfacesel += totf; } @@ -128,7 +128,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totvert += tot; stats->totface += totf; - if(sel) { + if (sel) { stats->totvertsel += tot; stats->totfacesel += totf; } @@ -139,7 +139,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) static void stats_object_edit(Object *obedit, SceneStats *stats) { - if(obedit->type==OB_MESH) { + if (obedit->type==OB_MESH) { BMEditMesh *em = BMEdit_FromObject(obedit); stats->totvert = em->bm->totvert; @@ -151,26 +151,26 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) stats->totface = em->bm->totface; stats->totfacesel = em->bm->totfacesel; } - else if(obedit->type==OB_ARMATURE){ + else if (obedit->type==OB_ARMATURE) { /* Armature Edit */ bArmature *arm= obedit->data; EditBone *ebo; - for(ebo=arm->edbo->first; ebo; ebo=ebo->next){ + for (ebo=arm->edbo->first; ebo; ebo=ebo->next) { stats->totbone++; - if((ebo->flag & BONE_CONNECTED) && ebo->parent) + if ((ebo->flag & BONE_CONNECTED) && ebo->parent) stats->totvert--; - if(ebo->flag & BONE_TIPSEL) + if (ebo->flag & BONE_TIPSEL) stats->totvertsel++; - if(ebo->flag & BONE_ROOTSEL) + if (ebo->flag & BONE_ROOTSEL) stats->totvertsel++; - if(ebo->flag & BONE_SELECTED) stats->totbonesel++; + if (ebo->flag & BONE_SELECTED) stats->totbonesel++; /* if this is a connected child and it's parent is being moved, remove our root */ - if((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL)) + if ((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL)) stats->totvertsel--; stats->totvert+=2; @@ -185,40 +185,40 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) int a; ListBase *nurbs= curve_editnurbs(cu); - for(nu=nurbs->first; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) { + for (nu=nurbs->first; nu; nu=nu->next) { + if (nu->type == CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; - while(a--) { + while (a--) { stats->totvert+=3; - if(bezt->f1) stats->totvertsel++; - if(bezt->f2) stats->totvertsel++; - if(bezt->f3) stats->totvertsel++; + if (bezt->f1) stats->totvertsel++; + if (bezt->f2) stats->totvertsel++; + if (bezt->f3) stats->totvertsel++; bezt++; } } else { bp= nu->bp; a= nu->pntsu*nu->pntsv; - while(a--) { + while (a--) { stats->totvert++; - if(bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) stats->totvertsel++; bp++; } } } } - else if(obedit->type==OB_MBALL) { + else if (obedit->type==OB_MBALL) { /* MetaBall Edit */ MetaBall *mball= obedit->data; MetaElem *ml; - for(ml= mball->editelems->first; ml; ml=ml->next) { + for (ml= mball->editelems->first; ml; ml=ml->next) { stats->totvert++; - if(ml->flag & SELECT) stats->totvertsel++; + if (ml->flag & SELECT) stats->totvertsel++; } } - else if(obedit->type==OB_LATTICE) { + else if (obedit->type==OB_LATTICE) { /* Lattice Edit */ Lattice *lt= obedit->data; Lattice *editlatt= lt->editlatt->latt; @@ -228,9 +228,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) bp= editlatt->def; a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; - while(a--) { + while (a--) { stats->totvert++; - if(bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) stats->totvertsel++; bp++; } } @@ -238,14 +238,14 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) static void stats_object_pose(Object *ob, SceneStats *stats) { - if(ob->pose) { + if (ob->pose) { bArmature *arm= ob->data; bPoseChannel *pchan; - for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { stats->totbone++; - if(pchan->bone && (pchan->bone->flag & BONE_SELECTED)) - if(pchan->bone->layer & arm->layer) + if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) + if (pchan->bone->layer & arm->layer) stats->totbonesel++; } } @@ -253,28 +253,28 @@ static void stats_object_pose(Object *ob, SceneStats *stats) static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) { - if(base->flag & SELECT) stats->totobjsel++; + if (base->flag & SELECT) stats->totobjsel++; - if(ob->transflag & OB_DUPLIPARTS) { + if (ob->transflag & OB_DUPLIPARTS) { /* Dupli Particles */ ParticleSystem *psys; ParticleSettings *part; - for(psys=ob->particlesystem.first; psys; psys=psys->next){ + for (psys=ob->particlesystem.first; psys; psys=psys->next) { part=psys->part; - if(part->draw_as==PART_DRAW_OB && part->dup_ob){ + if (part->draw_as==PART_DRAW_OB && part->dup_ob) { int tot=count_particles(psys); stats_object(part->dup_ob, 0, tot, stats); } - else if(part->draw_as==PART_DRAW_GR && part->dup_group){ + else if (part->draw_as==PART_DRAW_GR && part->dup_group) { GroupObject *go; int tot, totgroup=0, cur=0; - for(go= part->dup_group->gobject.first; go; go=go->next) + for (go= part->dup_group->gobject.first; go; go=go->next) totgroup++; - for(go= part->dup_group->gobject.first; go; go=go->next) { + for (go= part->dup_group->gobject.first; go; go=go->next) { tot=count_particles_mod(psys,totgroup,cur); stats_object(go->ob, 0, tot, stats); cur++; @@ -285,19 +285,19 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) stats_object(ob, base->flag & SELECT, 1, stats); stats->totobj++; } - else if(ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) { + else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) { /* Dupli Verts/Faces */ int tot= count_duplilist(ob->parent); stats->totobj+=tot; stats_object(ob, base->flag & SELECT, tot, stats); } - else if(ob->transflag & OB_DUPLIFRAMES) { + else if (ob->transflag & OB_DUPLIFRAMES) { /* Dupli Frames */ int tot= count_duplilist(ob); stats->totobj+=tot; stats_object(ob, base->flag & SELECT, tot, stats); } - else if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { + else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { /* Dupli Group */ int tot= count_duplilist(ob); stats->totobj+=tot; @@ -317,22 +317,22 @@ static void stats_update(Scene *scene) Object *ob= (scene->basact)? scene->basact->object: NULL; Base *base; - if(scene->obedit) { + if (scene->obedit) { /* Edit Mode */ stats_object_edit(scene->obedit, &stats); } - else if(ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { /* Pose Mode */ stats_object_pose(ob, &stats); } else { /* Objects */ - for(base= scene->base.first; base; base=base->next) - if(scene->lay & base->lay) + for (base= scene->base.first; base; base=base->next) + if (scene->lay & base->lay) stats_dupli_object(base, base->object, &stats); } - if(!scene->stats) + if (!scene->stats) scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats"); *(scene->stats)= stats; @@ -351,28 +351,28 @@ static void stats_string(Scene *scene) /* get memory statistics */ s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0); - if(mmap_in_use) + if (mmap_in_use) sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0); s= stats->infostr; s+= sprintf(s, "%s | ", versionstr); - if(scene->obedit) { - if(ob_get_keyblock(scene->obedit)) + if (scene->obedit) { + if (ob_get_keyblock(scene->obedit)) s+= sprintf(s, "(Key) "); - if(scene->obedit->type==OB_MESH) { - if(scene->toolsettings->selectmode & SCE_SELECT_VERTEX) + if (scene->obedit->type==OB_MESH) { + if (scene->toolsettings->selectmode & SCE_SELECT_VERTEX) s+= sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d", stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); - else if(scene->toolsettings->selectmode & SCE_SELECT_EDGE) + else if (scene->toolsettings->selectmode & SCE_SELECT_EDGE) s+= sprintf(s, "Ed:%d-%d | Fa:%d-%d", stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); else s+= sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface); } - else if(scene->obedit->type==OB_ARMATURE) { + else if (scene->obedit->type==OB_ARMATURE) { s+= sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone); } else { @@ -381,7 +381,7 @@ static void stats_string(Scene *scene) strcat(s, memstr); } - else if(ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { s += sprintf(s, "Bo:%d-%d %s", stats->totbonesel, stats->totbone, memstr); } @@ -390,13 +390,13 @@ static void stats_string(Scene *scene) stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr); } - if(ob) + if (ob) sprintf(s, " | %s", ob->id.name+2); } void ED_info_stats_clear(Scene *scene) { - if(scene->stats) { + if (scene->stats) { MEM_freeN(scene->stats); scene->stats= NULL; } @@ -404,7 +404,7 @@ void ED_info_stats_clear(Scene *scene) const char *ED_info_stats_string(Scene *scene) { - if(!scene->stats) + if (!scene->stats) stats_update(scene); stats_string(scene); |