View3d: take pixelsize into account for selection distance
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]};
|
||||
|
||||
Reference in New Issue
Block a user