[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22631] branches/blender2.5/blender: 2.5: Restored statistics in the info header.
Brecht Van Lommel
brecht at blender.org
Wed Aug 19 14:35:40 CEST 2009
Revision: 22631
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22631
Author: blendix
Date: 2009-08-19 14:35:40 +0200 (Wed, 19 Aug 2009)
Log Message:
-----------
2.5: Restored statistics in the info header.
Implementation:
* NC_SCENE or NC_OBJECT cause scene->stats to be cleared.
* NC_INFO is sent to tag info headers for redraw.
* In UI scene.statistics() creates scene->stats if it is
NULLd, and then returns the string.
Modified Paths:
--------------
branches/blender2.5/blender/release/ui/space_info.py
branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
branches/blender2.5/blender/source/blender/editors/space_info/space_info.c
branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
Added Paths:
-----------
branches/blender2.5/blender/source/blender/editors/include/ED_info.h
branches/blender2.5/blender/source/blender/editors/space_info/info_stats.c
Modified: branches/blender2.5/blender/release/ui/space_info.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_info.py 2009-08-19 11:18:52 UTC (rev 22630)
+++ branches/blender2.5/blender/release/ui/space_info.py 2009-08-19 12:35:40 UTC (rev 22631)
@@ -8,7 +8,8 @@
layout = self.layout
st = context.space_data
- rd = context.scene.render_data
+ scene = context.scene
+ rd = scene.render_data
row = layout.row(align=True)
row.template_header()
@@ -33,6 +34,8 @@
layout.template_operator_search()
layout.template_running_jobs()
+
+ layout.itemL(text=scene.statistics())
class INFO_MT_file(bpy.types.Menu):
__space_type__ = "INFO"
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c 2009-08-19 11:18:52 UTC (rev 22630)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c 2009-08-19 12:35:40 UTC (rev 22631)
@@ -155,6 +155,7 @@
scen->theDag= NULL;
scen->obedit= NULL;
scen->toolsettings= MEM_dupallocN(sce->toolsettings);
+ scen->stats= NULL;
ts= scen->toolsettings;
if(ts) {
@@ -299,6 +300,9 @@
ntreeFreeTree(sce->nodetree);
MEM_freeN(sce->nodetree);
}
+
+ if(sce->stats)
+ MEM_freeN(sce->stats);
}
Scene *add_scene(char *name)
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-08-19 11:18:52 UTC (rev 22630)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-08-19 12:35:40 UTC (rev 22631)
@@ -4134,6 +4134,7 @@
sce->theDag = NULL;
sce->dagisvalid = 0;
sce->obedit= NULL;
+ sce->stats= 0;
memset(&sce->sound_handles, 0, sizeof(sce->sound_handles));
Added: branches/blender2.5/blender/source/blender/editors/include/ED_info.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_info.h (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_info.h 2009-08-19 12:35:40 UTC (rev 22631)
@@ -0,0 +1,32 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009, Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ED_INFO_H
+#define ED_INFO_H
+
+/* info_stats.c */
+void ED_info_stats_clear(struct Scene *scene);
+char *ED_info_stats_string(struct Scene *scene);
+
+#endif /* ED_INFO_H */
Property changes on: branches/blender2.5/blender/source/blender/editors/include/ED_info.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c 2009-08-19 11:18:52 UTC (rev 22630)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c 2009-08-19 12:35:40 UTC (rev 22631)
@@ -835,9 +835,11 @@
// else transopts= ui_translate_buttons();
/* cut string in 2 parts - only for menu entries */
- if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
- cpoin= strchr(but->drawstr, '|');
- if(cpoin) *cpoin= 0;
+ if((but->block->flag & UI_BLOCK_LOOP)) {
+ if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
+ cpoin= strchr(but->drawstr, '|');
+ if(cpoin) *cpoin= 0;
+ }
}
glColor3ubv((unsigned char*)wcol->text);
Added: branches/blender2.5/blender/source/blender/editors/space_info/info_stats.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_info/info_stats.c (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_info/info_stats.c 2009-08-19 12:35:40 UTC (rev 22631)
@@ -0,0 +1,434 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_group_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_anim.h"
+#include "BKE_context.h"
+#include "BKE_displist.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_key.h"
+#include "BKE_mesh.h"
+#include "BKE_particle.h"
+#include "BKE_utildefines.h"
+
+#include "ED_armature.h"
+#include "ED_mesh.h"
+
+#include "BLI_editVert.h"
+
+typedef struct SceneStats {
+ int totvert, totvertsel;
+ int totedge, totedgesel;
+ int totface, totfacesel;
+ int totbone, totbonesel;
+ int totobj, totobjsel;
+ int totmesh, totlamp, totcurve;
+
+ char infostr[512];
+} SceneStats;
+
+static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
+{
+ switch(ob->type) {
+ case OB_MESH: {
+ /* we assume derivedmesh is already built, this strictly does stats now. */
+ DerivedMesh *dm= ob->derivedFinal;
+ int totvert, totedge, totface;
+
+ stats->totmesh +=totob;
+
+ if(dm) {
+ totvert = dm->getNumVerts(dm);
+ totedge = dm->getNumEdges(dm);
+ totface = dm->getNumFaces(dm);
+
+ stats->totvert += totvert*totob;
+ stats->totedge += totedge*totob;
+ stats->totface += totface*totob;
+
+ if(sel) {
+ stats->totvertsel += totvert;
+ stats->totfacesel += totface;
+ }
+ }
+ break;
+ }
+ case OB_LAMP:
+ stats->totlamp += totob;
+ break;
+ case OB_SURF:
+ case OB_CURVE:
+ case OB_FONT: {
+ Curve *cu= ob->data;
+ int tot= 0, totf= 0;
+
+ stats->totcurve += totob;
+
+ if(cu->disp.first)
+ count_displist(&cu->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;
+
+ count_displist(&ob->disp, &tot, &totf);
+
+ tot *= totob;
+ totf *= totob;
+
+ stats->totvert += tot;
+ stats->totface += totf;
+
+ if(sel) {
+ stats->totvertsel += tot;
+ stats->totfacesel += totf;
+ }
+ break;
+ }
+ }
+}
+
+static void stats_object_edit(Object *obedit, SceneStats *stats)
+{
+ if(obedit->type==OB_MESH) {
+ /* Mesh Edit */
+ EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
+ EditVert *eve;
+ EditEdge *eed;
+ EditFace *efa;
+
+ for(eve= em->verts.first; eve; eve=eve->next) {
+ stats->totvert++;
+ if(eve->f & SELECT) stats->totvertsel++;
+ }
+ for(eed= em->edges.first; eed; eed=eed->next) {
+ stats->totedge++;
+ if(eed->f & SELECT) stats->totedgesel++;
+ }
+ for(efa= em->faces.first; efa; efa=efa->next) {
+ stats->totface++;
+ if(efa->f & SELECT) stats->totfacesel++;
+ }
+
+ EM_validate_selections(em);
+ }
+ else if(obedit->type==OB_ARMATURE){
+ /* Armature Edit */
+ bArmature *arm= obedit->data;
+ EditBone *ebo;
+
+ for(ebo=arm->edbo->first; ebo; ebo=ebo->next){
+ stats->totbone++;
+
+ if((ebo->flag & BONE_CONNECTED) && ebo->parent)
+ stats->totvert--;
+
+ if(ebo->flag & BONE_TIPSEL)
+ stats->totvertsel++;
+ if(ebo->flag & BONE_ROOTSEL)
+ stats->totvertsel++;
+
+ 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))
+ stats->totvertsel--;
+
+ stats->totvert+=2;
+ }
+ }
+ else if ELEM3(obedit->type, OB_CURVE, OB_SURF, OB_FONT) {
+ /* Curve Edit */
+ Curve *cu= obedit->data;
+ Nurb *nu;
+ BezTriple *bezt;
+ BPoint *bp;
+ int a;
+
+ for(nu=cu->editnurb->first; nu; nu=nu->next) {
+ if((nu->type & 7)==CU_BEZIER) {
+ bezt= nu->bezt;
+ a= nu->pntsu;
+ while(a--) {
+ stats->totvert+=3;
+ 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--) {
+ stats->totvert++;
+ if(bp->f1 & SELECT) stats->totvertsel++;
+ bp++;
+ }
+ }
+ }
+ }
+ else if(obedit->type==OB_MBALL) {
+ /* MetaBall Edit */
+ MetaBall *mball= obedit->data;
+ MetaElem *ml;
+
+ for(ml= mball->editelems->first; ml; ml=ml->next) {
+ stats->totvert++;
+ if(ml->flag & SELECT) stats->totvertsel++;
+ }
+ }
+ else if(obedit->type==OB_LATTICE) {
+ /* Lattice Edit */
+ Lattice *lt= obedit->data;
+ Lattice *editlatt= lt->editlatt;
+ BPoint *bp;
+ int a;
+
+ bp= editlatt->def;
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list