[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36365] trunk/blender/source/blender/ editors/space_view3d: smooth view now takes the v3d and region as arguments .

Campbell Barton ideasman42 at gmail.com
Thu Apr 28 09:55:30 CEST 2011


Revision: 36365
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36365
Author:   campbellbarton
Date:     2011-04-28 07:55:29 +0000 (Thu, 28 Apr 2011)
Log Message:
-----------
smooth view now takes the v3d and region as arguments. (no functional change)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_intern.h
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-04-28 07:10:13 UTC (rev 36364)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-04-28 07:55:29 UTC (rev 36365)
@@ -1635,10 +1635,10 @@
 
 		if (rv3d->persp==RV3D_CAMOB) {
 			rv3d->persp= RV3D_PERSP;
-			smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
+			smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
 		}
 		else {
-			smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
+			smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
 		}
 	}
 // XXX	BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
@@ -1778,10 +1778,10 @@
 
 	if (rv3d->persp==RV3D_CAMOB) {
 		rv3d->persp= RV3D_PERSP;
-		smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
+		smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
 	}
 	else {
-		smooth_view(C, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+		smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
 	}
 
 	/* smooth view does viewlock RV3D_BOXVIEW copy */
@@ -1814,10 +1814,12 @@
 	Scene *scene= CTX_data_scene(C);
 	
 	if (rv3d) {
+		ARegion *ar= CTX_wm_region(C);
+
 		/* non camera center */
 		float new_ofs[3];
 		negate_v3_v3(new_ofs, give_cursor(scene, v3d));
-		smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
+		smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, NULL, NULL);
 		
 		/* smooth view does viewlock RV3D_BOXVIEW copy */
 	}
@@ -2047,7 +2049,7 @@
 		new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
 	}
 
-	smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
+	smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
 
 	if(rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(CTX_wm_area(C), ar);
@@ -2149,6 +2151,7 @@
 static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
 {
 	View3D *v3d = CTX_wm_view3d(C);
+	ARegion *ar= CTX_wm_region(C);
 	RegionView3D *rv3d= CTX_wm_region_view3d(C);
 	float new_quat[4];
 
@@ -2194,7 +2197,7 @@
 	}
 
 	if(rv3d->viewlock) {
-		ED_region_tag_redraw(CTX_wm_region(C));
+		ED_region_tag_redraw(ar);
 		return;
 	}
 
@@ -2203,14 +2206,14 @@
 		if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
 		else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
-		smooth_view(C, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
+		smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
 	}
 	else {
 
 		if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
 		else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
-		smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
+		smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL);
 	}
 
 }
@@ -2218,6 +2221,7 @@
 static int viewnumpad_exec(bContext *C, wmOperator *op)
 {
 	View3D *v3d = CTX_wm_view3d(C);
+	ARegion *ar= CTX_wm_region(C);
 	RegionView3D *rv3d= CTX_wm_region_view3d(C);
 	Scene *scene= CTX_data_scene(C);
 	static int perspo=RV3D_PERSP;
@@ -2316,7 +2320,7 @@
 
 					/* finally do snazzy view zooming */
 					rv3d->persp= RV3D_CAMOB;
-					smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+					smooth_view(C, v3d, ar, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
 				}
 				else{
@@ -2398,7 +2402,7 @@
 				rv3d->view= 0;
 			}
 
-			smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
+			smooth_view(C, CTX_wm_view3d(C), CTX_wm_region(C), NULL, NULL, NULL, new_quat, NULL, NULL);
 		}
 	}
 

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_intern.h	2011-04-28 07:10:13 UTC (rev 36364)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_intern.h	2011-04-28 07:55:29 UTC (rev 36365)
@@ -158,7 +158,7 @@
 
 void centerview(struct ARegion *ar, View3D *v3d);
 
-void smooth_view(struct bContext *C, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
+void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
 
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect);	/* rect: for picking */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2011-04-28 07:10:13 UTC (rev 36364)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2011-04-28 07:55:29 UTC (rev 36365)
@@ -190,10 +190,13 @@
 
 /* will start timer if appropriate */
 /* the arguments are the desired situation */
-void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, float *quat, float *dist, float *lens)
+void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera, float *ofs, float *quat, float *dist, float *lens)
 {
-	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindow *win= CTX_wm_window(C);
+	ScrArea *sa= CTX_wm_area(C);
+
+	RegionView3D *rv3d= ar->regiondata;
 	struct SmoothViewStore sms= {0};
 	short ok= FALSE;
 	
@@ -281,9 +284,9 @@
 				rv3d->sms= MEM_mallocN(sizeof(struct SmoothViewStore), "smoothview v3d");
 			*rv3d->sms= sms;
 			if(rv3d->smooth_timer)
-				WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer);
+				WM_event_remove_timer(wm, win, rv3d->smooth_timer);
 			/* TIMER1 is hardcoded in keymap */
-			rv3d->smooth_timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0/100.0);	/* max 30 frs/sec */
+			rv3d->smooth_timer= WM_event_add_timer(wm, win, TIMER1, 1.0/100.0);	/* max 30 frs/sec */
 			
 			ok= TRUE;
 		}
@@ -291,8 +294,6 @@
 	
 	/* if we get here nothing happens */
 	if(ok == FALSE) {
-		ARegion *ar= CTX_wm_region(C);
-
 		if(sms.to_camera==0) {
 			copy_v3_v3(rv3d->ofs, sms.new_ofs);
 			copy_qt_qt(rv3d->viewquat, sms.new_quat);
@@ -301,7 +302,7 @@
 		}
 
 		if(rv3d->viewlock & RV3D_BOXVIEW)
-			view3d_boxview_copy(CTX_wm_area(C), ar);
+			view3d_boxview_copy(sa, ar);
 
 		ED_region_tag_redraw(ar);
 	}
@@ -465,7 +466,8 @@
 static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	ARegion *ar= CTX_wm_region(C);
+	RegionView3D *rv3d= ar->regiondata;
 	Scene *scene= CTX_data_scene(C);
 	Object *ob = CTX_data_active_object(C);
 
@@ -477,7 +479,7 @@
 			scene->camera= ob;
 
 		if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */
-			smooth_view(C, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+			smooth_view(C, v3d, ar, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
 		WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
 	}
@@ -1189,13 +1191,13 @@
 			rv3d->dist= 0.0;
 			
 			view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
-			smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
+			smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
 			
 			rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
 			
 		} else {
 			mat3_to_quat( new_quat,tmat);
-			smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
+			smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
 		}
 	} else {
 		mat3_to_quat( rv3d->viewquat,tmat);
@@ -1932,10 +1934,10 @@
 		rv3d->persp= RV3D_PERSP;
 		rv3d->dist= 0.0;
 		view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
-		smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
+		smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
 	} else {
 		if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */
-		smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
+		smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
 	}
 }
 




More information about the Bf-blender-cvs mailing list