Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-12-27 07:51:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-27 07:51:45 +0400
commit1d6c3ccf092c9c692db454f477435a814b81d30a (patch)
tree948dbbfbf7d9b55195dbde36bfffda037abd284e /source/blender/editors/space_info
parent6586fd9c62784af5496c48e5eeebc9b128d1addd (diff)
display the number of tri's in object mode status, often requested feature from users who model for realtime/game-engine output,
the total number of faces wasn't so useful and could be especially misleading with ngons.
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r--source/blender/editors/space_info/info_stats.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 5e5e0c87feb..73a43ee35ed 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -39,6 +39,7 @@
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
+#include "BLI_math.h"
#include "BKE_anim.h"
#include "BKE_blender.h"
@@ -62,7 +63,7 @@ typedef struct SceneStats {
int totbone, totbonesel;
int totobj, totobjsel;
int totlamp, totlampsel;
- int tottri, totmesh, totcurve;
+ int tottri, totmesh;
char infostr[512];
} SceneStats;
@@ -74,7 +75,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
{
/* we assume derivedmesh is already built, this strictly does stats now. */
DerivedMesh *dm = ob->derivedFinal;
- int totvert, totedge, totface;
+ int totvert, totedge, totface, totloop;
stats->totmesh += totob;
@@ -82,10 +83,12 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
totvert = dm->getNumVerts(dm);
totedge = dm->getNumEdges(dm);
totface = dm->getNumPolys(dm);
+ totloop = dm->getNumLoops(dm);
stats->totvert += totvert * totob;
stats->totedge += totedge * totob;
stats->totface += totface * totob;
+ stats->tottri += poly_to_tri_count(totface, totloop) * totob;
if (sel) {
stats->totvertsel += totvert;
@@ -103,40 +106,23 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
case OB_SURF:
case OB_CURVE:
case OB_FONT:
- {
- int tot = 0, totf = 0;
-
- stats->totcurve += totob;
-
- if (ob->disp.first)
- BKE_displist_count(&ob->disp, &tot, &totf);
-
- tot *= totob;
- totf *= totob;
-
- stats->totvert += tot;
- stats->totface += totf;
-
- if (sel) {
- stats->totvertsel += tot;
- stats->totfacesel += totf;
- }
- break;
- }
case OB_MBALL:
{
- int tot = 0, totf = 0;
+ int totv = 0, totf = 0, tottri = 0;
- BKE_displist_count(&ob->disp, &tot, &totf);
+ if (ob->disp.first)
+ BKE_displist_count(&ob->disp, &totv, &totf, &tottri);
- tot *= totob;
- totf *= totob;
+ totv *= totob;
+ totf *= totob;
+ tottri *= totob;
- stats->totvert += tot;
+ stats->totvert += totv;
stats->totface += totf;
+ stats->tottri += tottri;
if (sel) {
- stats->totvertsel += tot;
+ stats->totvertsel += totv;
stats->totfacesel += totf;
}
break;
@@ -389,8 +375,8 @@ static void stats_string(Scene *scene)
stats->totbonesel, stats->totbone, memstr);
}
else {
- s += sprintf(s, "Verts:%d | Faces:%d | Objects:%d/%d | Lamps:%d/%d%s",
- stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlampsel, stats->totlamp, memstr);
+ s += sprintf(s, "Verts:%d | Faces:%d| Tris:%d | Objects:%d/%d | Lamps:%d/%d%s",
+ stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel, stats->totlamp, memstr);
}
if (ob)