-> Small bug fix for modifiers and info header stats
Small but very annoying issue with modifiers meant that G.totvert/totedge/totface were updated to reflect the effects of a subsurf modifier in object mode but all other modifier types were ignored. This was not only inconsistent, but also made it very difficult to keep track of poly budgets. Now in order to obtain accurate counts object_handle_update is called immediatly after adding a modifier and precedes a call to countall() which has been modified to query the final derived mesh directly using dm->getNumVerts/Edges/Faces callbacks. Editmode behaviour is unchanged.
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
#include "BKE_anim.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_ipo.h"
|
||||
@@ -509,34 +510,29 @@ static void count_object(Object *ob, int sel, int totob)
|
||||
{
|
||||
Mesh *me;
|
||||
Curve *cu;
|
||||
DerivedMesh *dm;
|
||||
int tot=0, totf=0, subsurf;
|
||||
|
||||
|
||||
switch(ob->type) {
|
||||
case OB_MESH:
|
||||
G.totmesh+=totob;
|
||||
me= get_mesh(ob);
|
||||
if(me) {
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
|
||||
int totvert, totface;
|
||||
|
||||
subsurf= 1;
|
||||
if (md) {
|
||||
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
||||
if(smd->modifier.mode & eModifierMode_Realtime)
|
||||
subsurf= 1<<(2*smd->levels);
|
||||
G.totmesh+=totob;
|
||||
me= get_mesh(ob);
|
||||
if(me) {
|
||||
int totvert, totedge, totface;
|
||||
dm = mesh_get_derived_final(ob, get_viewedit_datamask());
|
||||
totvert = dm->getNumVerts(dm);
|
||||
totedge = dm->getNumEdges(dm);
|
||||
totface = dm->getNumFaces(dm);
|
||||
|
||||
G.totvert+= totvert*totob;
|
||||
G.totedge+= totedge*totob;
|
||||
G.totface+= totface*totob;
|
||||
if(sel) {
|
||||
G.totvertsel+= totvert;
|
||||
G.totfacesel+= totface;
|
||||
}
|
||||
}
|
||||
|
||||
totvert= subsurf*me->totvert*totob;
|
||||
totface= subsurf*me->totface*totob;
|
||||
|
||||
G.totvert+= totvert;
|
||||
G.totface+= totface;
|
||||
if(sel) {
|
||||
G.totvertsel+= totvert;
|
||||
G.totfacesel+= totface;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OB_LAMP:
|
||||
G.totlamp+=totob;
|
||||
|
||||
Reference in New Issue
Block a user