[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50769] trunk/blender/source/blender: code cleanup:

Campbell Barton ideasman42 at gmail.com
Thu Sep 20 06:56:25 CEST 2012


Revision: 50769
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50769
Author:   campbellbarton
Date:     2012-09-20 04:56:24 +0000 (Thu, 20 Sep 2012)
Log Message:
-----------
code cleanup:
- make view3d project names more consistent.
- remove apply_project_float() its not needed.
- update comments referencing an old function name.
- move doxygen docs into the C file, prefer they are kept here to avoid getting out of sync with code.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/uvproject.c
    trunk/blender/source/blender/editors/armature/editarmature_sketch.c
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c
    trunk/blender/source/blender/editors/mesh/editmesh_rip.c
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/mesh/editmesh_slide.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/mesh/meshtools.c
    trunk/blender/source/blender/editors/physics/particle_edit.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform_snap.c

Modified: trunk/blender/source/blender/blenlib/intern/uvproject.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/uvproject.c	2012-09-20 03:45:18 UTC (rev 50768)
+++ trunk/blender/source/blender/blenlib/intern/uvproject.c	2012-09-20 04:56:24 UTC (rev 50769)
@@ -105,7 +105,7 @@
 	/* rotmat is the object matrix in this case */
 	mul_m4_v4(rotmat, pv4);
 
-	/* almost project_short */
+	/* almost ED_view3d_project_short */
 	mul_m4_v4(persmat, pv4);
 	if (fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
 		target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0] / pv4[3];

Modified: trunk/blender/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2012-09-20 03:45:18 UTC (rev 50768)
+++ trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2012-09-20 04:56:24 UTC (rev 50769)
@@ -644,7 +644,7 @@
 			short pval[2];
 			int pdist;
 
-			project_short_noclip(ar, stk->points[i].p, pval);
+			ED_view3d_project_short_noclip(ar, stk->points[i].p, pval);
 
 			pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
 
@@ -679,7 +679,7 @@
 		{
 			copy_v3_v3(vec, bone->head);
 			mul_m4_v3(ob->obmat, vec);
-			project_short_noclip(ar, vec, pval);
+			ED_view3d_project_short_noclip(ar, vec, pval);
 
 			pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
 
@@ -695,7 +695,7 @@
 
 		copy_v3_v3(vec, bone->tail);
 		mul_m4_v3(ob->obmat, vec);
-		project_short_noclip(ar, vec, pval);
+		ED_view3d_project_short_noclip(ar, vec, pval);
 
 		pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
 
@@ -907,7 +907,7 @@
 		float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p);
 		float pval[2];
 
-		project_float(ar, stk->points[i].p, pval);
+		ED_view3d_project_float(ar, stk->points[i].p, pval);
 		ED_view3d_win_to_ray(ar, v3d, pval, ray_start, ray_normal);
 
 		mul_v3_fl(ray_normal, distance * progress / length);
@@ -934,7 +934,7 @@
 	initgrabz(ar->regiondata, fp[0], fp[1], fp[2]);
 
 	/* method taken from editview.c - mouse_cursor() */
-	project_short_noclip(ar, fp, cval);
+	ED_view3d_project_short_noclip(ar, fp, cval);
 	VECSUB2D(mval_f, cval, dd->mval);
 	ED_view3d_win_to_delta(ar, mval_f, dvec);
 	sub_v3_v3v3(vec, fp, dvec);
@@ -1453,8 +1453,8 @@
 		float s_p2[3] = {0, 0, 0};
 		int g_i;
 
-		project_float(ar, gesture->points[s_i].p, s_p1);
-		project_float(ar, gesture->points[s_i + 1].p, s_p2);
+		ED_view3d_project_float(ar, gesture->points[s_i].p, s_p1);
+		ED_view3d_project_float(ar, gesture->points[s_i + 1].p, s_p2);
 
 		/* start checking from second next, because two consecutive cannot intersect */
 		for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++) {
@@ -1463,8 +1463,8 @@
 			float vi[3];
 			float lambda;
 
-			project_float(ar, gesture->points[g_i].p, g_p1);
-			project_float(ar, gesture->points[g_i + 1].p, g_p2);
+			ED_view3d_project_float(ar, gesture->points[g_i].p, g_p1);
+			ED_view3d_project_float(ar, gesture->points[g_i + 1].p, g_p2);
 
 			if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
 				SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
@@ -1531,8 +1531,8 @@
 			float s_p2[3] = {0, 0, 0};
 			int g_i;
 
-			project_float(ar, stk->points[s_i].p, s_p1);
-			project_float(ar, stk->points[s_i + 1].p, s_p2);
+			ED_view3d_project_float(ar, stk->points[s_i].p, s_p1);
+			ED_view3d_project_float(ar, stk->points[s_i + 1].p, s_p2);
 
 			for (g_i = 0; g_i < gesture->nb_points - 1; g_i++) {
 				float g_p1[3] = {0, 0, 0};
@@ -1540,8 +1540,8 @@
 				float vi[3];
 				float lambda;
 
-				project_float(ar, gesture->points[g_i].p, g_p1);
-				project_float(ar, gesture->points[g_i + 1].p, g_p2);
+				ED_view3d_project_float(ar, gesture->points[g_i].p, g_p1);
+				ED_view3d_project_float(ar, gesture->points[g_i + 1].p, g_p2);
 
 				if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
 					SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
@@ -1784,8 +1784,8 @@
 		short start_val[2], end_val[2];
 		short dist;
 
-		project_short_noclip(ar, gest->stk->points[0].p, start_val);
-		project_short_noclip(ar, sk_lastStrokePoint(gest->stk)->p, end_val);
+		ED_view3d_project_short_noclip(ar, gest->stk->points[0].p, start_val);
+		ED_view3d_project_short_noclip(ar, sk_lastStrokePoint(gest->stk)->p, end_val);
 
 		dist = MAX2(ABS(start_val[0] - end_val[0]), ABS(start_val[1] - end_val[1]));
 

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2012-09-20 03:45:18 UTC (rev 50768)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2012-09-20 04:56:24 UTC (rev 50769)
@@ -278,7 +278,7 @@
 			gp_get_3d_reference(p, rvec);
 			
 			/* method taken from editview.c - mouse_cursor() */
-			project_int_noclip(p->ar, rvec, mval_prj);
+			ED_view3d_project_int_noclip(p->ar, rvec, mval_prj);
 			
 			VECSUB2D(mval_f, mval_prj, mval);
 			ED_view3d_win_to_delta(p->ar, mval_f, dvec);
@@ -808,7 +808,7 @@
 	else if (gps->totpoints == 1) {
 		/* get coordinates */
 		if (gps->flag & GP_STROKE_3DSPACE) {
-			project_int(p->ar, &gps->points->x, xyval);
+			ED_view3d_project_int(p->ar, &gps->points->x, xyval);
 			x0 = xyval[0];
 			y0 = xyval[1];
 		}
@@ -847,11 +847,11 @@
 			
 			/* get coordinates */
 			if (gps->flag & GP_STROKE_3DSPACE) {
-				project_int(p->ar, &pt1->x, xyval);
+				ED_view3d_project_int(p->ar, &pt1->x, xyval);
 				x0 = xyval[0];
 				y0 = xyval[1];
 				
-				project_int(p->ar, &pt2->x, xyval);
+				ED_view3d_project_int(p->ar, &pt2->x, xyval);
 				x1 = xyval[0];
 				y1 = xyval[1];
 			}

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2012-09-20 03:45:18 UTC (rev 50768)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2012-09-20 04:56:24 UTC (rev 50769)
@@ -89,139 +89,45 @@
 
 int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
 
-/**
- * Calculate a 3d location from 2d window coordinates.
- * \param ar The region (used for the window width and height).
- * \param depth_pt The reference location used to calculate the Z depth.
- * \param mval The area relative location (such as event->mval converted to floats).
- * \param out The resulting world-space location.
- */
 void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
-
-/**
- * Calculate a 3d difference vector from 2d window offset.
- * note that initgrabz() must be called first to determine
- * the depth used to calculate the delta.
- * \param ar The region (used for the window width and height).
- * \param mval The area relative 2d difference (such as event->mval[0] - other_x).
- * \param out The resulting world-space delta.
- */
 void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
-
-/**
- * Calculate a 3d direction vector from 2d window coordinates.
- * This direction vector starts and the view in the direction of the 2d window coordinates.
- * In orthographic view all window coordinates yield the same vector.
- * \param ar The region (used for the window width and height).
- * \param mval The area relative 2d location (such as event->mval converted to floats).
- * \param out The resulting normalized world-space direction vector.
- */
 void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
-
-/**
- * Calculate a 3d segment from 2d window coordinates.
- * This ray_start is located at the viewpoint, ray_end is a far point.
- * ray_start and ray_end are clipped by the view near and far limits
- * so points along this line are always in view.
- * In orthographic view all resulting segments will be parallel.
- * \param ar The region (used for the window width and height).
- * \param v3d The 3d viewport (used for near and far clipping range).
- * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
- * \param ray_start The world-space starting point of the segment.
- * \param ray_end The world-space end point of the segment.
- */
 void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
-
-/**
- * Calculate a 3d viewpoint and direction vector from 2d window coordinates.
- * This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
- * ray_start is clipped by the view near limit so points in front of it are always in view.
- * In orthographic view the resulting ray_normal will match the view vector.
- * \param ar The region (used for the window width and height).
- * \param v3d The 3d viewport (used for near clipping value).
- * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
- * \param ray_start The world-space starting point of the segment.
- * \param ray_normal The normalized world-space direction of towards mval.
- */
 void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
 
-/**
- * Calculate a normalized 3d direction vector from the viewpoint towards a global location.
- * In orthographic view the resulting vector will match the view vector.
- * \param rv3d The region (used for the window width and height).
- * \param coord The world-space location.
- * \param vec The resulting normalized vector.
- */
 void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
-
-/**
- * Calculate the view transformation matrix from RegionView3D input.
- * The resulting matrix is equivalent to RegionView3D.viewinv
- * \param mat The view 4x4 transformation matrix to calculate.
- * \param ofs The view offset, normally from RegionView3D.ofs.
- * \param quat The view rotation, quaternion normally from RegionView3D.viewquat.
- * \param dist The view distance from ofs, normally from RegionView3D.dist.
- */
 void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist);
-
-/**
- * Set the view transformation from a 4x4 matrix.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list