[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51240] trunk/blender/source/blender/ editors: refactor foreachScreen functions for clipping, now the projection clipping flag is passed down directly rather then converting the enum into a flag , also fix own recent crash lasso seleting in object mode with pose objects .

Campbell Barton ideasman42 at gmail.com
Wed Oct 10 06:03:23 CEST 2012


Revision: 51240
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51240
Author:   campbellbarton
Date:     2012-10-10 04:03:22 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
refactor foreachScreen functions for clipping, now the projection clipping flag is passed down directly rather then converting the enum into a flag, also fix own recent crash lasso seleting in object mode with pose objects.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/include/ED_object.h
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/object/object_iterators.c
    trunk/blender/source/blender/editors/object/object_lattice.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c	2012-10-10 03:13:02 UTC (rev 51239)
+++ trunk/blender/source/blender/editors/curve/editcurve.c	2012-10-10 04:03:22 UTC (rev 51240)
@@ -3276,7 +3276,7 @@
 	data.mval_fl[1] = mval[1];
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-	nurbs_foreachScreenVert(vc, findnearestNurbvert__doClosest, &data);
+	nurbs_foreachScreenVert(vc, findnearestNurbvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	*nurb = data.nurb;
 	*bezt = data.bezt;

Modified: trunk/blender/source/blender/editors/include/ED_object.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_object.h	2012-10-10 03:13:02 UTC (rev 51239)
+++ trunk/blender/source/blender/editors/include/ED_object.h	2012-10-10 04:03:22 UTC (rev 51240)
@@ -200,51 +200,46 @@
 
 /* object_iterators.c */
 
-/* enum for passing to foreach functions to test RV3D_CLIPPING */
-typedef enum eV3DClipTest {
-	V3D_CLIP_TEST_OFF =            0, /* clipping is off */
-	V3D_CLIP_TEST_RV3D_CLIPPING =  1, /* clip single points */
-	V3D_CLIP_TEST_REGION =         2  /* use for edges to check if both verts are in the view, but not RV3D_CLIPPING */
-} eV3DClipTest;
+#include "ED_view3d.h"  /* XXX, needed for eV3DProjTest */
 
 /* foreach iterators */
 void mesh_foreachScreenVert(
         struct ViewContext *vc,
         void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index),
-        void *userData, eV3DClipTest clipVerts);
+        void *userData, const eV3DProjTest clip_flag);
 void mesh_foreachScreenEdge(
         struct ViewContext *vc,
         void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2],
                      int index),
-        void *userData, eV3DClipTest clipVerts);
+        void *userData, const eV3DProjTest clip_flag);
 void mesh_foreachScreenFace(
         struct ViewContext *vc,
         void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 void nurbs_foreachScreenVert(
         struct ViewContext *vc,
         void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt,
                      int beztindex, const float screen_co[2]),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 void mball_foreachScreenElem(
         struct ViewContext *vc,
         void (*func)(void *userData, struct MetaElem *ml, const float screen_co[2]),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 void lattice_foreachScreenVert(
         struct ViewContext *vc,
         void (*func)(void *userData, struct BPoint *bp,
                      const float screen_co[2]),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 void armature_foreachScreenBone(
         struct ViewContext *vc,
         void (*func)(void *userData, struct EditBone *ebone,
                      const float screen_co_a[2], const float screen_co_b[2]),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 void pose_foreachScreenBone(
         struct ViewContext *vc,
         void (*func)(void *userData, struct bPoseChannel *pchan,
                      const float screen_co_a[2], const float screen_co_b[2]),
-        void *userData);
+        void *userData, const eV3DProjTest clip_flag);
 
 #ifdef __cplusplus
 }

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2012-10-10 03:13:02 UTC (rev 51239)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2012-10-10 04:03:22 UTC (rev 51240)
@@ -50,6 +50,8 @@
 struct Object;
 struct RegionView3D;
 struct Scene;
+struct bScreen;
+struct ScrArea;
 struct View3D;
 struct ViewContext;
 struct bContext;
@@ -126,24 +128,27 @@
 	V3D_PROJ_TEST_CLIP_WIN   = (1 << 1),
 } eV3DProjTest;
 
+#define V3D_PROJ_TEST_CLIP_DEFAULT (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN)
+#define V3D_PROJ_TEST_ALL          (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN)
 
+
 /* *** short *** */
 eV3DProjStatus ED_view3d_project_short_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                          const float co[3], short r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_global(struct ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_object(struct ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag);
+                                          const float co[3], short r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_short_global(struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_short_object(struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
 
 /* *** int *** */
 eV3DProjStatus ED_view3d_project_int_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], int r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_global(struct ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_object(struct ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag);
+                                        const float co[3], int r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_int_global(struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_int_object(struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
 
 /* *** float *** */
 eV3DProjStatus ED_view3d_project_float_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], float r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_global(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_object(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
+                                        const float co[3], float r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_float_global(struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_float_object(struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
 
 void ED_view3d_project_float_v2_m4(const struct ARegion *a, const float co[3], float r_co[2], float mat[4][4]);
 void ED_view3d_project_float_v3_m4(struct ARegion *a, const float co[3], float r_co[3], float mat[4][4]);

Modified: trunk/blender/source/blender/editors/mesh/editmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_select.c	2012-10-10 03:13:02 UTC (rev 51239)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c	2012-10-10 04:03:22 UTC (rev 51240)
@@ -433,11 +433,11 @@
 
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 		if (data.dist > 3) {
 			data.pass = 1;
-			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 
 		*r_dist = data.dist;
@@ -525,7 +525,7 @@
 		data.closest = NULL;
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, V3D_CLIP_TEST_REGION);
+		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, V3D_PROJ_TEST_CLIP_WIN);
 
 		*r_dist = data.dist;
 		return data.closest;
@@ -588,7 +588,7 @@
 			data.dist = 0x7FFF;     /* largest short */
 			data.toFace = efa;
 
-			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data);
+			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 			if ((vc->em->selectmode == SCE_SELECT_FACE) || (data.dist < *r_dist)) {  /* only faces, no dist check */
 				*r_dist = data.dist;
@@ -617,12 +617,12 @@
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
 		data.pass = 0;
-		mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
+		mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 		if (data.dist > 3.0f) {
 			data.pass = 1;
 			ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
+			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 
 		*r_dist = data.dist;

Modified: trunk/blender/source/blender/editors/object/object_iterators.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_iterators.c	2012-10-10 03:13:02 UTC (rev 51239)
+++ trunk/blender/source/blender/editors/object/object_iterators.c	2012-10-10 04:03:22 UTC (rev 51240)
@@ -31,7 +31,8 @@
 #include "DNA_object_types.h"
 
 #include "BLI_utildefines.h"
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_rect.h"
 
 #include "BKE_armature.h"
 #include "BKE_curve.h"
@@ -51,7 +52,7 @@
 	void (*func)(void *userData, BMVert *eve, const float screen_co_b[2], int index);
 	void *userData;
 	ViewContext vc;
-	eV3DClipTest clipVerts;
+	eV3DProjTest clip_flag;
 } foreachScreenVert_userData;
 
 /* user data structures for derived mesh callbacks */
@@ -60,13 +61,14 @@
 	void *userData;
 	ViewContext vc;
 	rctf win_rect; /* copy of: vc.ar->winx/winy, use for faster tests, minx/y will always be 0 */
-	eV3DClipTest clipVerts;
+	eV3DProjTest clip_flag;
 } foreachScreenEdge_userData;
 
 typedef struct foreachScreenFace_userData {
 	void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index);
 	void *userData;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list