[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12842] trunk/blender/source/blender: display real fps in 3d view option

Campbell Barton ideasman42 at gmail.com
Tue Dec 11 15:19:06 CET 2007


Revision: 12842
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12842
Author:   campbellbarton
Date:     2007-12-11 15:19:05 +0100 (Tue, 11 Dec 2007)

Log Message:
-----------
display real fps in 3d view option
replace 1 with SELECT
edited DVar texture tooltip

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/displist.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/buttons_shading.c
    trunk/blender/source/blender/src/drawobject.c
    trunk/blender/source/blender/src/drawview.c
    trunk/blender/source/blender/src/edit.c
    trunk/blender/source/blender/src/editcurve.c
    trunk/blender/source/blender/src/editlattice.c
    trunk/blender/source/blender/src/editview.c
    trunk/blender/source/blender/src/retopo.c
    trunk/blender/source/blender/src/space.c
    trunk/blender/source/blender/src/transform_conversions.c
    trunk/blender/source/blender/src/transform_manipulator.c

Modified: trunk/blender/source/blender/blenkernel/intern/displist.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/displist.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/blenkernel/intern/displist.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -152,12 +152,9 @@
 int displist_has_faces(ListBase *lb)
 {
 	DispList *dl;
-	
-	dl= lb->first;
-	while(dl) {
+	for(dl= lb->first; dl; dl= dl->next) {
 		if ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)
 			return 1;
-		dl= dl->next;
 	}
 	return 0;
 }

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2007-12-11 14:19:05 UTC (rev 12842)
@@ -227,6 +227,7 @@
 #define USER_CUSTOM_RANGE		(1 << 17)
 #define USER_ADD_EDITMODE		(1 << 18)
 #define USER_ADD_VIEWALIGNED	(1 << 19)
+#define USER_ADD_VIEWALIGNED	(1 << 19)
 
 
 /* viewzom */
@@ -257,6 +258,7 @@
 #define USER_SHOW_VIEWPORTNAME	(1 << 18)
 #define USER_KEYINSERTNEED		(1 << 19)
 #define USER_ZOOM_TO_MOUSEPOS	(1 << 20)
+#define USER_SHOW_FPS	(1 << 21)
 
 /* transopts */
 

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/src/buttons_editing.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -539,8 +539,8 @@
 							bp= nu->bp;
 							while(a--) {
 								if(bp->hide==0) {
-									if(event==B_MATSEL) bp->f1 |= 1;
-									else bp->f1 &= ~1;
+									if(event==B_MATSEL) bp->f1 |= SELECT;
+									else bp->f1 &= ~SELECT;
 								}
 								bp++;
 							}

Modified: trunk/blender/source/blender/src/buttons_shading.c
===================================================================
--- trunk/blender/source/blender/src/buttons_shading.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/src/buttons_shading.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -1974,7 +1974,7 @@
 	uiDefButF(block, NUMSLI, B_WORLDPRV, "G ",			10,60,135,19, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
 	uiDefButF(block, NUMSLI, B_WORLDPRV, "B ",			10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
 	uiBlockEndAlign(block);
-	uiDefButF(block, NUMSLI, B_WORLDPRV, "DVar ",		10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Texture influence for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+	uiDefButF(block, NUMSLI, B_WORLDPRV, "DVar ",		10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
 	
 	/* MAP TO */
 	uiBlockBeginAlign(block);
@@ -2405,7 +2405,7 @@
 	uiDefButF(block, NUMSLI, B_LAMPPRV, "G ",			10,60,135,19, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
 	uiDefButF(block, NUMSLI, B_LAMPPRV, "B ",			10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
 	uiBlockEndAlign(block);
-	uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ",			10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Texture influence for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+	uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ",			10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
 	
 	/* MAP TO */
 	uiDefButBitS(block, TOG, MAP_COL, B_LAMPPRV, "Col",		10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp");
@@ -3146,7 +3146,7 @@
 	}
 	uiBlockEndAlign(block);
 	
-	uiDefButF(block, NUMSLI, B_MATPRV, "DVar ",			10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Texture influence for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+	uiDefButF(block, NUMSLI, B_MATPRV, "DVar ",			10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
 	
 	/* MAP TO */
 	uiBlockBeginAlign(block);

Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/src/drawobject.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -1132,7 +1132,7 @@
 				int uxt = (u==0 || u==lt->pntsu-1);
 				if(!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
 					if(bp->hide==0) {
-						if((bp->f1 & 1)==sel) {
+						if((bp->f1 & SELECT)==sel) {
 							bglVertex3fv(dl?co:bp->vec);
 						}
 					}
@@ -3799,7 +3799,7 @@
 		a= nu->pntsu*nu->pntsv;
 		while(a--) {
 			if(bp->hide==0) {
-				if((bp->f1 & 1)==sel) bglVertex3fv(bp->vec);
+				if((bp->f1 & SELECT)==sel) bglVertex3fv(bp->vec);
 			}
 			bp++;
 		}
@@ -3842,7 +3842,7 @@
 					for(a=nu->pntsu-1; a>0; a--, bp++) {
 						if(bp->hide==0 && bp1->hide==0) {
 							if(sel) {
-								if( (bp->f1 & 1) && ( bp1->f1 & 1) ) {
+								if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
 									cpack(nurbcol[5]);
 		
 									glBegin(GL_LINE_STRIP);
@@ -3852,7 +3852,7 @@
 								}
 							}
 							else {
-								if( (bp->f1 & 1) && ( bp1->f1 & 1) );
+								if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
 								else {
 									cpack(nurbcol[1]);
 		
@@ -3875,7 +3875,7 @@
 						for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
 							if(bp->hide==0 && bp1->hide==0) {
 								if(sel) {
-									if( (bp->f1 & 1) && ( bp1->f1 & 1) ) {
+									if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
 										cpack(nurbcol[7]);
 			
 										glBegin(GL_LINE_STRIP);
@@ -3885,7 +3885,7 @@
 									}
 								}
 								else {
-									if( (bp->f1 & 1) && ( bp1->f1 & 1) );
+									if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
 									else {
 										cpack(nurbcol[3]);
 			
@@ -3939,8 +3939,9 @@
 	
 	if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
 
-	/* direction vectors for 3d curve paths */
-	if(cu->flag & CU_3D) {
+	/*	direction vectors for 3d curve paths
+		when at its lowest, dont render normals */
+	if(cu->flag & CU_3D && G.scene->editbutsize > 0.0015) {
 		BIF_ThemeColor(TH_WIRE);
 		for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
 			BevPoint *bevp= (BevPoint *)(bl+1);		

Modified: trunk/blender/source/blender/src/drawview.c
===================================================================
--- trunk/blender/source/blender/src/drawview.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/src/drawview.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -1660,7 +1660,7 @@
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
 				while(a--) {
-					if(bp->f1 & 1) {
+					if(bp->f1 & SELECT) {
 						VecAddf(median, median, bp->vec);
 						median[3]+= bp->vec[3];
 						totw++;
@@ -1832,7 +1832,7 @@
 					bp= nu->bp;
 					a= nu->pntsu*nu->pntsv;
 					while(a--) {
-						if(bp->f1 & 1) {
+						if(bp->f1 & SELECT) {
 							VecAddf(bp->vec, bp->vec, median);
 							bp->vec[3]+= median[3];
 							bp->weight+= median[4];
@@ -2805,6 +2805,8 @@
 	}
 }
 
+static void draw_viewport_fps(ScrArea *sa);
+
 void drawview3dspace(ScrArea *sa, void *spacedata)
 {
 	View3D *v3d= spacedata;
@@ -3082,8 +3084,12 @@
 		draw_view_axis();
 	else	
 		draw_view_icon();
-	if(U.uiflag & USER_SHOW_VIEWPORTNAME)
+	
+	if(U.uiflag & USER_SHOW_FPS && G.f & G_PLAYANIM) {
+		draw_viewport_fps(sa);
+	} else if(U.uiflag & USER_SHOW_VIEWPORTNAME) {
 		draw_viewport_name(sa);
+	}
 
 	ob= OBACT;
 	if(ob && (U.uiflag & USER_DRAWVIEWINFO)) 
@@ -3256,6 +3262,10 @@
 static double swaptime;
 static int curmode;
 
+/* used for fps display */
+static double redrawtime;
+static double lredrawtime;
+
 int update_time(void)
 {
 	static double ltime;
@@ -3274,6 +3284,29 @@
 	return (tottime < 0.0);
 }
 
+static void draw_viewport_fps(ScrArea *sa)
+{
+	char printable[16];
+	printable[0] = '\0';
+	float fps;
+	if (lredrawtime == redrawtime)
+		return;
+	
+	fps = (float)(1.0/(lredrawtime-redrawtime));
+	
+	/* is this more then half a frame behind? */
+	if (fps+0.5 < FPS) {
+		BIF_ThemeColor(TH_REDALERT);
+		sprintf(printable, "fps: %.2f", (float)fps);
+	} else {
+		BIF_ThemeColor(TH_TEXT_HI);
+		sprintf(printable, "fps: %i", (int)(fps+0.5));
+	}
+	
+	glRasterPos2i(10,  sa->winy-20);
+	BMF_DrawString(G.fonts, printable);
+}
+
 static void inner_play_prefetch_frame(int mode, int cfra)
 {
 	ScrArea *sa;
@@ -3388,6 +3421,9 @@
 		curmode= mode;
 		last_cfra = -1;
 		cached = cached_dynamics(PSFRA,PEFRA);
+		
+		redrawtime = 1.0/FPS;
+		lredrawtime = 0.0;
 		return;
 	}
 
@@ -3523,7 +3559,10 @@
 	screen_swapbuffers();
 	
 	while(TRUE) {
-
+		
+		if  (U.uiflag & USER_SHOW_FPS)
+			lredrawtime = PIL_check_seconds_timer();
+		
 		while(qtest()) {
 			
 			/* we test events first because of MKEY event */
@@ -3549,8 +3588,13 @@
 		if(ELEM3(event, ESCKEY, SPACEKEY, RIGHTMOUSE)) break;
 		
 		inner_play_anim_loop(0, 0);
+		 
+		
 		screen_swapbuffers();
-				
+		
+		if (U.uiflag & USER_SHOW_FPS)
+			redrawtime = lredrawtime;
+		
 		if((mode & 2) && CFRA==PEFRA) break; /* no replay */	
 	}
 

Modified: trunk/blender/source/blender/src/edit.c
===================================================================
--- trunk/blender/source/blender/src/edit.c	2007-12-11 10:46:07 UTC (rev 12841)
+++ trunk/blender/source/blender/src/edit.c	2007-12-11 14:19:05 UTC (rev 12842)
@@ -728,7 +728,7 @@
 					a= nu->pntsu*nu->pntsv;
 					while(a--) {
 						G.totvert++;
-						if(bp->f1 & 1) G.totvertsel++;
+						if(bp->f1 & SELECT) G.totvertsel++;
 						bp++;
 					}
 				}
@@ -752,7 +752,7 @@
 			a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
 			while(a--) {
 				G.totvert++;
-				if(bp->f1 & 1) G.totvertsel++;
+				if(bp->f1 & SELECT) G.totvertsel++;
 				bp++;
 			}
 		}
@@ -1109,12 +1109,12 @@
 				bp= nu->bp;
 				while(a--) {
 					if(bp->hide==0) {
-						if((mode & 1) || (bp->f1 & 1)) {
+						if((mode & 1) || (bp->f1 & SELECT)) {
 							VECCOPY(tv->oldloc, bp->vec);
 							tv->loc= bp->vec;
 							tv->val= &(bp->alfa);
 							tv->oldval= bp->alfa;
-							tv->flag= bp->f1 & 1;
+							tv->flag= bp->f1 & SELECT;
 							tv++;
 							tottrans++;
 						}
@@ -1147,11 +1147,11 @@
 		a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
 		
 		while(a--) {
-			if((mode & 1) || (bp->f1 & 1)) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list