[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21450] branches/blender2.5/blender/source /blender/editors: Hooking transform operators with manipulator.

Martin Poirier theeth at yahoo.com
Thu Jul 9 04:45:49 CEST 2009


Revision: 21450
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21450
Author:   theeth
Date:     2009-07-09 04:45:48 +0200 (Thu, 09 Jul 2009)

Log Message:
-----------
Hooking transform operators with manipulator.

It's just a straight application of the normal operator for now, none of the normal manipulator goodies yet (no draw code and you have to click to confirm).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_transform.h
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_manipulator.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_transform.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_transform.h	2009-07-09 01:52:54 UTC (rev 21449)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_transform.h	2009-07-09 02:45:48 UTC (rev 21450)
@@ -87,7 +87,7 @@
 
 /* Standalone call to get the transformation center corresponding to the current situation
  * returns 1 if successful, 0 otherwise (usually means there's no selection)
- * (if 0 is returns, *vec is unmodified) 
+ * (if 0 is returns, *vec is unmodified)
  * */
 int calculateTransformCenter(struct bContext *C, struct wmEvent *event, int centerMode, float *vec);
 
@@ -128,7 +128,7 @@
 void initManipulator(int mode);
 void ManipulatorTransform();
 
-int BIF_do_manipulator(struct bContext *C, short mval[2]);
+int BIF_do_manipulator(struct bContext *C, struct wmEvent *event, struct wmOperator *op);
 void BIF_draw_manipulator(const struct bContext *C);
 
 /* Snapping */
@@ -137,7 +137,7 @@
 typedef struct DepthPeel
 {
 	struct DepthPeel *next, *prev;
-	
+
 	float depth;
 	float p[3];
 	float no[3];

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	2009-07-09 01:52:54 UTC (rev 21449)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	2009-07-09 02:45:48 UTC (rev 21450)
@@ -1812,7 +1812,7 @@
 						if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) {
 							glPushMatrix();
 							glMultMatrixf(pchan->pose_mat);
-							glTranslatef(0.0f, pchan->bone->length, 0.0f);
+							//glTranslatef(0.0f, pchan->bone->length, 0.0f);
 							drawaxes(0.25f*pchan->bone->length, 0, OB_ARROWS);
 							glPopMatrix();
 						}
@@ -1996,7 +1996,7 @@
 						if (arm->flag & ARM_DRAWAXES) {
 							glPushMatrix();
 							set_matrix_editbone(eBone);
-							glTranslatef(0.0f, eBone->length, 0.0f);
+							//glTranslatef(0.0f, eBone->length, 0.0f);
 							drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
 							glPopMatrix();
 						}

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-07-09 01:52:54 UTC (rev 21449)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-07-09 02:45:48 UTC (rev 21450)
@@ -95,50 +95,50 @@
 	float clip[6][4];
 	float x1= 0.0f, y1= 0.0f, z1= 0.0f, ofs[3];
 	int val;
-	
+
 	/* create bounding box */
 	for(ar= sa->regionbase.first; ar; ar= ar->next) {
 		if(ar->regiontype==RGN_TYPE_WINDOW) {
 			RegionView3D *rv3d= ar->regiondata;
-			
+
 			if(rv3d->viewlock & RV3D_BOXCLIP) {
 				if(ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM)) {
 					if(ar->winx>ar->winy) x1= rv3d->dist;
 					else x1= ar->winx*rv3d->dist/ar->winy;
-					
+
 					if(ar->winx>ar->winy) y1= ar->winy*rv3d->dist/ar->winx;
 					else y1= rv3d->dist;
-					
+
 					ofs[0]= rv3d->ofs[0];
 					ofs[1]= rv3d->ofs[1];
 				}
 				else if(ELEM(rv3d->view, V3D_VIEW_FRONT, V3D_VIEW_BACK)) {
 					ofs[2]= rv3d->ofs[2];
-					
+
 					if(ar->winx>ar->winy) z1= ar->winy*rv3d->dist/ar->winx;
 					else z1= rv3d->dist;
 				}
 			}
 		}
 	}
-	
+
 	for(val=0; val<8; val++) {
 		if(ELEM4(val, 0, 3, 4, 7))
 			bb->vec[val][0]= -x1 - ofs[0];
 		else
 			bb->vec[val][0]=  x1 - ofs[0];
-		
+
 		if(ELEM4(val, 0, 1, 4, 5))
 			bb->vec[val][1]= -y1 - ofs[1];
 		else
 			bb->vec[val][1]=  y1 - ofs[1];
-		
+
 		if(val > 3)
 			bb->vec[val][2]= -z1 - ofs[2];
 		else
 			bb->vec[val][2]=  z1 - ofs[2];
-	}	
-	
+	}
+
 	/* normals for plane equations */
 	CalcNormFloat(bb->vec[0], bb->vec[1], bb->vec[4], clip[0]);
 	CalcNormFloat(bb->vec[1], bb->vec[2], bb->vec[5], clip[1]);
@@ -146,18 +146,18 @@
 	CalcNormFloat(bb->vec[3], bb->vec[0], bb->vec[7], clip[3]);
 	CalcNormFloat(bb->vec[4], bb->vec[5], bb->vec[6], clip[4]);
 	CalcNormFloat(bb->vec[0], bb->vec[2], bb->vec[1], clip[5]);
-	
+
 	/* then plane equations */
 	for(val=0; val<5; val++) {
 		clip[val][3]= - clip[val][0]*bb->vec[val][0] - clip[val][1]*bb->vec[val][1] - clip[val][2]*bb->vec[val][2];
 	}
 	clip[5][3]= - clip[5][0]*bb->vec[0][0] - clip[5][1]*bb->vec[0][1] - clip[5][2]*bb->vec[0][2];
-	
+
 	/* create bounding box */
 	for(ar= sa->regionbase.first; ar; ar= ar->next) {
 		if(ar->regiontype==RGN_TYPE_WINDOW) {
 			RegionView3D *rv3d= ar->regiondata;
-			
+
 			if(rv3d->viewlock & RV3D_BOXCLIP) {
 				rv3d->rflag |= RV3D_CLIPPING;
 				memcpy(rv3d->clip, clip, sizeof(clip));
@@ -172,11 +172,11 @@
 {
 	ARegion *artest;
 	RegionView3D *rv3d= ar->regiondata;
-	
+
 	for(artest= sa->regionbase.first; artest; artest= artest->next) {
 		if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
 			RegionView3D *rv3dtest= artest->regiondata;
-			
+
 			if(rv3dtest->viewlock) {
 				rv3dtest->dist= rv3d->dist;
 
@@ -198,7 +198,7 @@
 					if( ELEM(rv3dtest->view, V3D_VIEW_FRONT, V3D_VIEW_BACK))
 						rv3dtest->ofs[2]= rv3d->ofs[2];
 				}
-				
+
 				ED_region_tag_redraw(artest);
 			}
 		}
@@ -211,11 +211,11 @@
 {
 	ARegion *artest;
 	RegionView3D *rv3d= ar->regiondata;
-	
+
 	for(artest= sa->regionbase.first; artest; artest= artest->next) {
 		if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
 			RegionView3D *rv3dtest= artest->regiondata;
-			
+
 			if(rv3dtest->viewlock) {
 				rv3dtest->dist= rv3d->dist;
 				VECCOPY(rv3dtest->ofs, rv3d->ofs);
@@ -238,7 +238,7 @@
 	float ofs[3], obofs[3];
 	float reverse, dist0;
 	float grid, far;
-	
+
 	int origx, origy, oldx, oldy;
 	int origkey;
 
@@ -289,11 +289,11 @@
 	vod->origx= vod->oldx= event->x;
 	vod->origy= vod->oldy= event->y;
 	vod->origkey= event->type;
-	
+
 	/* lookup, we dont pass on v3d to prevent confusement */
 	vod->grid= v3d->grid;
 	vod->far= v3d->far;
-	
+
 	calctrackballvec(&vod->ar->winrct, event->x, event->y, vod->trackvec);
 
 	initgrabz(rv3d, -rv3d->ofs[0], -rv3d->ofs[1], -rv3d->ofs[2]);
@@ -523,7 +523,7 @@
 
 	if(rv3d->viewlock)
 		return OPERATOR_CANCELLED;
-	
+
 	/* makes op->customdata */
 	viewops_data(C, op, event);
 	vod= op->customdata;
@@ -557,7 +557,7 @@
 	ot->invoke= viewrotate_invoke;
 	ot->modal= viewrotate_modal;
 	ot->poll= ED_operator_view3d_active;
-	
+
 	/* flags */
 	ot->flag= OPTYPE_REGISTER;
 }
@@ -580,7 +580,7 @@
 
 		window_to_3d_delta(vod->ar, dvec, x-vod->oldx, y-vod->oldy);
 		VecAddf(vod->rv3d->ofs, vod->rv3d->ofs, dvec);
-		
+
 		if(vod->rv3d->viewlock & RV3D_BOXVIEW)
 			view3d_boxview_sync(vod->sa, vod->ar);
 	}
@@ -640,7 +640,7 @@
 	ot->invoke= viewmove_invoke;
 	ot->modal= viewmove_modal;
 	ot->poll= ED_operator_view3d_active;
-	
+
 	/* flags */
 	ot->flag= OPTYPE_REGISTER;
 }
@@ -650,7 +650,7 @@
 static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
 {
 	RegionView3D *rv3d= ar->regiondata;
-	
+
 	if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
 		float dvec[3];
 		float tvec[3];
@@ -800,7 +800,7 @@
 
 	if(rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(CTX_wm_area(C), CTX_wm_region(C));
-	
+
 	request_depth_update(CTX_wm_region_view3d(C));
 	ED_region_tag_redraw(CTX_wm_region(C));
 
@@ -839,10 +839,10 @@
 	ot->exec= viewzoom_exec;
 	ot->modal= viewzoom_modal;
 	ot->poll= ED_operator_view3d_active;
-	
+
 	/* flags */
 	ot->flag= OPTYPE_REGISTER;
-	
+
 	RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
 }
 
@@ -899,11 +899,11 @@
 
 		if (rv3d->persp==V3D_CAMOB) {
 			rv3d->persp= V3D_PERSP;
-			smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL); 
+			smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL);
 		}
 	}
 // XXX	BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
-	
+
 	if(rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_copy(CTX_wm_area(C), ar);
 
@@ -920,10 +920,10 @@
 	/* api callbacks */
 	ot->exec= viewhome_exec;
 	ot->poll= ED_operator_view3d_active;
-	
+
 	/* flags */
 	ot->flag= OPTYPE_REGISTER;
-	
+
 	RNA_def_boolean(ot->srna, "center", 0, "Center", "");
 }
 
@@ -1013,7 +1013,7 @@
 	/* perspective should be a bit farther away to look nice */
 	if(rv3d->persp==V3D_ORTHO)
 		size*= 0.7;
-	
+
 	if(size <= v3d->near*1.5f) size= v3d->near*1.5f;
 
 	new_ofs[0]= -(min[0]+max[0])/2.0f;
@@ -1036,7 +1036,7 @@
 	if (rv3d->persp==V3D_CAMOB) {
 		rv3d->persp= V3D_PERSP;
 		smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
-	} 
+	}
 	else {
 		smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
 	}
@@ -1059,7 +1059,7 @@
 	/* api callbacks */
 	ot->exec= viewcenter_exec;
 	ot->poll= ED_operator_view3d_active;
-	
+
 	/* flags */
 	ot->flag= OPTYPE_REGISTER;
 }
@@ -1071,16 +1071,16 @@
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar= CTX_wm_region(C);
 	Scene *scene= CTX_data_scene(C);
-	
+
 	rcti rect;
 	rctf vb;
-	
+
 	/* get border select values using rna */
 	rect.xmin= RNA_int_get(op->ptr, "xmin");
 	rect.ymin= RNA_int_get(op->ptr, "ymin");
 	rect.xmax= RNA_int_get(op->ptr, "xmax");
 	rect.ymax= RNA_int_get(op->ptr, "ymax");
-	
+
 	/* calculate range */
 	calc_viewborder(scene, ar, v3d, &vb);
 
@@ -1088,13 +1088,13 @@
 	scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
 	scene->r.border.xmax= ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
 	scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
-	
-	/* actually set border */	
+
+	/* actually set border */
 	CLAMP(scene->r.border.xmin, 0.0, 1.0);
 	CLAMP(scene->r.border.ymin, 0.0, 1.0);
 	CLAMP(scene->r.border.xmax, 0.0, 1.0);
 	CLAMP(scene->r.border.ymax, 0.0, 1.0);
-		
+
 	/* drawing a border surrounding the entire camera view switches off border rendering
 	 * or the border covers no pixels */
 	if ((scene->r.border.xmin <= 0.0 && scene->r.border.xmax >= 1.0 &&
@@ -1106,7 +1106,7 @@
 	} else {
 		scene->r.mode |= R_BORDER;
 	}
-	
+
 	return OPERATOR_FINISHED;
 
 }
@@ -1114,9 +1114,9 @@
 static int view3d_render_border_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	
+
 	/* if not in camera view do not exec the operator*/
-	if (rv3d->persp == V3D_CAMOB) return WM_border_select_invoke(C, op, event);	
+	if (rv3d->persp == V3D_CAMOB) return WM_border_select_invoke(C, op, event);
 	else return OPERATOR_PASS_THROUGH;
 }
 
@@ -1131,12 +1131,12 @@
 	ot->invoke= view3d_render_border_invoke;
 	ot->exec= render_border_exec;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list