Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-03-11 08:34:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-11 08:34:19 +0400
commit57dba739176153e052d77611ff0e554f05984686 (patch)
tree317fc95876975a9743d6da1eb44513ed8bd2237d /source/blender
parent23fbc9f22f3dfd7151c4396a17fbe586b0594d81 (diff)
View3d: take pixelsize into account for selection distance
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c2
-rw-r--r--source/blender/editors/mesh/editmesh_path.c6
-rw-r--r--source/blender/editors/mesh/editmesh_select.c4
-rw-r--r--source/blender/editors/object/object_lattice.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c7
8 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 2bd9bba365b..e50ba2c2392 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3613,7 +3613,7 @@ static short findnearestNurbvert(ViewContext *vc, short sel, const int mval[2],
/* return 0 1 2: handlepunt */
struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; float dist; int hpoint, select; float mval_fl[2]; } data = {NULL};
- data.dist = 100;
+ data.dist = ED_view3d_select_dist_px();
data.hpoint = 0;
data.select = sel;
data.mval_fl[0] = mval[0];
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 0aff3b81ec9..adeb271f7a2 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -269,6 +269,8 @@ bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], con
#define MAXPICKBUF 10000
short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
+/* view3d_select.c */
+float ED_view3d_select_dist_px(void);
void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
void view3d_operator_needs_opengl(const struct bContext *C);
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index bc4281904b8..9a02a9761b0 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -440,7 +440,7 @@ static void loopcut_update_edge(RingSelOpData *lcd, BMEdge *e, const int preview
static void loopcut_mouse_move(RingSelOpData *lcd, const int previewlines)
{
- float dist = 75.0f;
+ float dist = ED_view3d_select_dist_px();
BMEdge *e = EDBM_edge_find_nearest(&lcd->vc, &dist);
loopcut_update_edge(lcd, e, previewlines);
}
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c
index 3e64c22fa4e..a6e4f504bd9 100644
--- a/source/blender/editors/mesh/editmesh_path.c
+++ b/source/blender/editors/mesh/editmesh_path.c
@@ -88,7 +88,7 @@ static bool mouse_mesh_shortest_path_vert(ViewContext *vc)
BMEditMesh *em = vc->em;
BMesh *bm = em->bm;
BMVert *v_dst;
- float dist = 75.0f;
+ float dist = ED_view3d_select_dist_px();
const bool use_length = true;
v_dst = EDBM_vert_find_nearest(vc, &dist, false, false);
@@ -253,7 +253,7 @@ static bool mouse_mesh_shortest_path_edge(ViewContext *vc)
BMEditMesh *em = vc->em;
BMesh *bm = em->bm;
BMEdge *e_dst;
- float dist = 75.0f;
+ float dist = ED_view3d_select_dist_px();
const bool use_length = true;
e_dst = EDBM_edge_find_nearest(vc, &dist);
@@ -377,7 +377,7 @@ static bool mouse_mesh_shortest_path_face(ViewContext *vc)
BMEditMesh *em = vc->em;
BMesh *bm = em->bm;
BMFace *f_dst;
- float dist = 75.0f;
+ float dist = ED_view3d_select_dist_px();
const bool use_length = true;
f_dst = EDBM_face_find_nearest(vc, &dist);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 41546e7bf07..37267d1e54b 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -649,7 +649,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
{
BMEditMesh *em = vc->em;
- float dist = 75.0f;
+ float dist = ED_view3d_select_dist_px();
*r_eve = NULL;
*r_eed = NULL;
@@ -1191,7 +1191,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
bool select = true;
bool select_clear = false;
bool select_cycle = true;
- float dist = 50.0f;
+ float dist = ED_view3d_select_dist_px() * 0.6666f;
float mvalf[2];
em_setup_viewcontext(C, &vc);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 8d12809b0c2..196e912e74e 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -867,7 +867,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
/* return 0 1 2: handlepunt */
struct { BPoint *bp; float dist; int select; float mval_fl[2]; } data = {NULL};
- data.dist = 100;
+ data.dist = ED_view3d_select_dist_px();
data.select = sel;
data.mval_fl[0] = mval[0];
data.mval_fl[1] = mval[1];
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index f634a512aa3..2fb131db538 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -915,6 +915,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
int index;
float *vec, *nor, dvec[3], dot, dist_1st=0.0f;
float hairimat[4][4], hairmat[4][4];
+ const float dist = ED_view3d_select_dist_px();
if (edit==NULL || edit->psys==NULL || (pset->flag & PE_DEFLECT_EMITTER)==0 || (edit->psys->flag & PSYS_GLOBAL_HAIR))
return;
@@ -935,7 +936,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
LOOP_KEYS {
if (k==0) {
dist_1st = len_v3v3((key+1)->co, key->co);
- dist_1st *= 0.75f * pset->emitterdist;
+ dist_1st *= dist * pset->emitterdist;
}
else {
index= BLI_kdtree_find_nearest(edit->emitter_field, key->co, NULL, NULL);
@@ -1446,7 +1447,7 @@ int PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool deselec
PE_set_view3d_data(C, &data);
data.mval= mval;
- data.rad= 75.0f;
+ data.rad = ED_view3d_select_dist_px();
/* 1 = nearest only */
if (extend)
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 47f30e3e279..de1516222c3 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -98,6 +98,11 @@
#include "view3d_intern.h" /* own include */
+float ED_view3d_select_dist_px(void)
+{
+ return 75.0f * U.pixelsize;
+}
+
/* TODO: should return whether there is valid context to continue */
void view3d_set_viewcontext(bContext *C, ViewContext *vc)
{
@@ -1380,7 +1385,7 @@ static bool mouse_select(bContext *C, const int mval[2],
Scene *scene = CTX_data_scene(C);
Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
bool is_obedit;
- float dist = 100.0f;
+ float dist = ED_view3d_select_dist_px() * 1.3333f;
int retval = false;
short hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};