[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32263] trunk/blender/source/blender: make fly mode border draw into a area drawing callback rather then using a flag (no functional change).

Campbell Barton ideasman42 at gmail.com
Sat Oct 2 21:31:23 CEST 2010


Revision: 32263
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32263
Author:   campbellbarton
Date:     2010-10-02 21:31:23 +0200 (Sat, 02 Oct 2010)

Log Message:
-----------
make fly mode border draw into a area drawing callback rather then using a flag (no functional change).

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_geom.c
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/makesdna/DNA_view3d_types.h

Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c	2010-10-02 19:06:20 UTC (rev 32262)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c	2010-10-02 19:31:23 UTC (rev 32263)
@@ -1647,8 +1647,7 @@
 
 }
 
-/* translate a matrix created by orthographic_m4 or perspective_m4 in viewspace XY coords (used to jitter the view)
- * transforms in worldspace coords. */
+/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */
 void window_translate_m4(float winmat[][4], float perspmat[][4], float x, float y)
 {
 	if(winmat[2][3] == -1.0f) {

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2010-10-02 19:06:20 UTC (rev 32262)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2010-10-02 19:31:23 UTC (rev 32263)
@@ -1886,7 +1886,6 @@
 static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	bAnimContext ac;
-	Scene *scene;
 	ARegion *ar;
 	View2D *v2d;
 	int mval[2], channel_index;

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2010-10-02 19:06:20 UTC (rev 32262)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2010-10-02 19:31:23 UTC (rev 32263)
@@ -926,52 +926,6 @@
 	rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
 }
 
-
-static void drawviewborder_flymode(ARegion *ar)	
-{
-	/* draws 4 edge brackets that frame the safe area where the
-	mouse can move during fly mode without spinning the view */
-	float x1, x2, y1, y2;
-	
-	x1= 0.45*(float)ar->winx;
-	y1= 0.45*(float)ar->winy;
-	x2= 0.55*(float)ar->winx;
-	y2= 0.55*(float)ar->winy;
-	cpack(0);
-	
-	
-	glBegin(GL_LINES);
-	/* bottom left */
-	glVertex2f(x1,y1); 
-	glVertex2f(x1,y1+5);
-	
-	glVertex2f(x1,y1); 
-	glVertex2f(x1+5,y1);
-	
-	/* top right */
-	glVertex2f(x2,y2); 
-	glVertex2f(x2,y2-5);
-	
-	glVertex2f(x2,y2); 
-	glVertex2f(x2-5,y2);
-	
-	/* top left */
-	glVertex2f(x1,y2); 
-	glVertex2f(x1,y2-5);
-	
-	glVertex2f(x1,y2); 
-	glVertex2f(x1+5,y2);
-	
-	/* bottom right */
-	glVertex2f(x2,y1); 
-	glVertex2f(x2,y1+5);
-	
-	glVertex2f(x2,y1); 
-	glVertex2f(x2-5,y1);
-	glEnd();	
-}
-
-
 static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 {
 	float fac, a;
@@ -2456,8 +2410,8 @@
 	/* Draw particle edit brush XXX (removed) */
 	
 
-	if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d);
-	if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar);
+	if(rv3d->persp==RV3D_CAMOB)
+		drawviewborder(scene, ar, v3d);
 
 	if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
 		/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-10-02 19:06:20 UTC (rev 32262)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-10-02 19:31:23 UTC (rev 32263)
@@ -64,6 +64,7 @@
 #include "ED_keyframing.h"
 #include "ED_screen.h"
 #include "ED_armature.h"
+#include "ED_space_api.h"
 
 #include "GPU_draw.h"
 
@@ -1973,11 +1974,59 @@
 	double time_lastwheel; /* used to accelerate when using the mousewheel a lot */
 	double time_lastdraw; /* time between draws */
 
+	void *draw_handle_pixel;
+
 	/* use for some lag */
 	float dvec_prev[3]; /* old for some lag */
 
 } FlyInfo;
 
+static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg)
+{
+	FlyInfo *fly = arg;
+
+	/* draws 4 edge brackets that frame the safe area where the
+	mouse can move during fly mode without spinning the view */
+	float x1, x2, y1, y2;
+	
+	x1= 0.45*(float)fly->ar->winx;
+	y1= 0.45*(float)fly->ar->winy;
+	x2= 0.55*(float)fly->ar->winx;
+	y2= 0.55*(float)fly->ar->winy;
+	cpack(0);
+	
+	
+	glBegin(GL_LINES);
+	/* bottom left */
+	glVertex2f(x1,y1); 
+	glVertex2f(x1,y1+5);
+	
+	glVertex2f(x1,y1); 
+	glVertex2f(x1+5,y1);
+	
+	/* top right */
+	glVertex2f(x2,y2); 
+	glVertex2f(x2,y2-5);
+	
+	glVertex2f(x2,y2); 
+	glVertex2f(x2-5,y2);
+	
+	/* top left */
+	glVertex2f(x1,y2); 
+	glVertex2f(x1,y2-5);
+	
+	glVertex2f(x1,y2); 
+	glVertex2f(x1+5,y2);
+	
+	/* bottom right */
+	glVertex2f(x2,y1); 
+	glVertex2f(x2,y1+5);
+	
+	glVertex2f(x2,y1); 
+	glVertex2f(x2-5,y1);
+	glEnd();
+}
+
 /* FlyInfo->state */
 #define FLY_RUNNING		0
 #define FLY_CANCEL		1
@@ -2029,8 +2078,10 @@
 
 	fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
 
-	fly->rv3d->rflag |= RV3D_FLYMODE|RV3D_NAVIGATING; /* so we draw the corner margins */
+	fly->draw_handle_pixel = ED_region_draw_cb_activate(fly->ar->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL);
 
+	fly->rv3d->rflag |= RV3D_NAVIGATING; /* so we draw the corner margins */
+
 	/* detect weather to start with Z locking */
 	upvec[0]=1.0f; upvec[1]=0.0f; upvec[2]=0.0f;
 	copy_m3_m4(mat, fly->rv3d->viewinv);
@@ -2094,6 +2145,8 @@
 
 	WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), fly->timer);
 
+	ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel);
+
 	rv3d->dist= fly->dist_backup;
 
 	if (fly->state == FLY_CANCEL) {
@@ -2146,7 +2199,7 @@
 		/*Done with correcting for the dist */
 	}
 
-	rv3d->rflag &= ~(RV3D_FLYMODE|RV3D_NAVIGATING);
+	rv3d->rflag &= ~RV3D_NAVIGATING;
 //XXX2.5	BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
 
 	if(fly->obtfm)

Modified: trunk/blender/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_view3d_types.h	2010-10-02 19:06:20 UTC (rev 32262)
+++ trunk/blender/source/blender/makesdna/DNA_view3d_types.h	2010-10-02 19:31:23 UTC (rev 32263)
@@ -228,7 +228,6 @@
 #define RV3D_CAMOB				2
 
 /* RegionView3d->rflag */
-#define RV3D_FLYMODE				2
 #define RV3D_CLIPPING				4
 #define RV3D_NAVIGATING				8
 #define RV3D_GPULIGHT_UPDATE		16





More information about the Bf-blender-cvs mailing list