[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51067] trunk/blender/source/blender/ editors: fix for bug in loop select, picking the active vert/edge/ face was using global space checks on object space coordinates.
Campbell Barton
ideasman42 at gmail.com
Fri Oct 5 06:18:55 CEST 2012
Revision: 51067
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51067
Author: campbellbarton
Date: 2012-10-05 04:18:52 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
fix for bug in loop select, picking the active vert/edge/face was using global space checks on object space coordinates. this removes last use of ED_view3d_project_float_noclip().
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_view3d.h
trunk/blender/source/blender/editors/mesh/editmesh_select.c
trunk/blender/source/blender/editors/space_view3d/view3d_view.c
Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h 2012-10-05 03:57:56 UTC (rev 51066)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h 2012-10-05 04:18:52 UTC (rev 51067)
@@ -150,7 +150,6 @@
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);
-void ED_view3d_project_float_noclip(struct ARegion *ar, const float co[3], float r_co[2]);
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-05 03:57:56 UTC (rev 51066)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c 2012-10-05 04:18:52 UTC (rev 51067)
@@ -1050,21 +1050,27 @@
/* sets as active, useful for other tools */
if (select) {
if (em->selectmode & SCE_SELECT_VERTEX) {
- /* Find nearest vert from mouse. */
+ /* Find nearest vert from mouse
+ * (initialize to large values incase only one vertex can be projected) */
float v1_co[2], v2_co[2];
+ float length_1 = FLT_MAX;
+ float length_2 = FLT_MAX;
/* We can't be sure this has already been set... */
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
- ED_view3d_project_float_noclip(vc.ar, eed->v1->co, v1_co);
- ED_view3d_project_float_noclip(vc.ar, eed->v2->co, v2_co);
+
+ if (ED_view3d_project_float_object(vc.ar, eed->v1->co, v1_co, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ length_1 = len_squared_v2v2(mvalf, v1_co);
+ }
+
+ if (ED_view3d_project_float_object(vc.ar, eed->v2->co, v2_co, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ length_2 = len_squared_v2v2(mvalf, v2_co);
+ }
#if 0
printf("mouse to v1: %f\nmouse to v2: %f\n", len_squared_v2v2(mvalf, v1_co),
len_squared_v2v2(mvalf, v2_co));
#endif
- if (len_squared_v2v2(mvalf, v1_co) < len_squared_v2v2(mvalf, v2_co))
- BM_select_history_store(em->bm, eed->v1);
- else
- BM_select_history_store(em->bm, eed->v2);
+ BM_select_history_store(em->bm, (length_1 < length_2) ? eed->v1 : eed->v2);
}
else if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, eed);
@@ -1084,12 +1090,13 @@
float co[2], tdist;
BM_face_calc_center_mean(f, cent);
- ED_view3d_project_float_noclip(vc.ar, cent, co);
- tdist = len_squared_v2v2(mvalf, co);
- if (tdist < best_dist) {
-/* printf("Best face: %p (%f)\n", f, tdist);*/
- best_dist = tdist;
- efa = f;
+ if (ED_view3d_project_float_object(vc.ar, cent, co, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ tdist = len_squared_v2v2(mvalf, co);
+ if (tdist < best_dist) {
+/* printf("Best face: %p (%f)\n", f, tdist);*/
+ best_dist = tdist;
+ efa = f;
+ }
}
}
}
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2012-10-05 03:57:56 UTC (rev 51066)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2012-10-05 04:18:52 UTC (rev 51067)
@@ -1047,26 +1047,6 @@
return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
}
-void ED_view3d_project_float_noclip(ARegion *ar, const float co[3], float r_co[2])
-{
- RegionView3D *rv3d = ar->regiondata;
- float vec4[4];
-
- copy_v3_v3(vec4, co);
- vec4[3] = 1.0;
-
- mul_m4_v4(rv3d->persmat, vec4);
-
- if (fabs(vec4[3]) > BL_NEAR_CLIP) {
- r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
- r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
- }
- else {
- r_co[0] = ar->winx / 2.0f;
- r_co[1] = ar->winy / 2.0f;
- }
-}
-
/* copies logic of get_view3d_viewplane(), keep in sync */
int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
{
More information about the Bf-blender-cvs
mailing list