diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-28 13:21:56 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-28 13:21:56 +0300 |
commit | 9c8d31520db6c675d05bdf41d21c89701088d99e (patch) | |
tree | 28cc8970818b08216fc47670b218c4669b60fa63 /source | |
parent | 6d2e2e30d50c40f302b62d3601b5742d7c7056c6 (diff) |
Fix curve stats when using modifiers.
Curve/surface/text final data may be an evaluated mesh instead of a
displist, when some modifiers (constructive ones in particular) are
applied to it.
Note that this is just getting feet wet, whole draw code suffers from
the same issue! :P
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 2169040578a..2000618a4ad 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -95,6 +95,30 @@ typedef struct SceneStatsFmt { char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN]; } SceneStatsFmt; +static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats) +{ + int totvert, totedge, totface, totloop; + + if (me_eval) { + totvert = me_eval->totvert; + totedge = me_eval->totedge; + totface = me_eval->totpoly; + totloop = me_eval->totloop; + + 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; + stats->totfacesel += totface; + } + return true; + } + return false; +} + static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) { switch (ob->type) { @@ -102,24 +126,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) { /* we assume evaluated mesh is already built, this strictly does stats now. */ Mesh *me_eval = ob->runtime.mesh_eval; - int totvert, totedge, totface, totloop; - - if (me_eval) { - totvert = me_eval->totvert; - totedge = me_eval->totedge; - totface = me_eval->totpoly; - totloop = me_eval->totloop; - - 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; - stats->totfacesel += totface; - } - } + stats_mesheval(me_eval, sel, totob, stats); break; } case OB_LAMP: @@ -131,6 +138,13 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) case OB_SURF: case OB_CURVE: case OB_FONT: + { + Mesh *me_eval = ob->runtime.mesh_eval; + if (stats_mesheval(me_eval, sel, totob, stats)) { + break; + } + ATTR_FALLTHROUGH; /* Falltrough to displist. */ + } case OB_MBALL: { int totv = 0, totf = 0, tottri = 0; |