diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 11 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 36 |
2 files changed, 8 insertions, 39 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d819176e542..6e65d7fa59a 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -140,9 +140,11 @@ static int screen_active_editable(bContext *C) /* when mouse is over area-edge */ int ED_operator_screen_mainwinactive(bContext *C) { + bScreen *screen; if (CTX_wm_window(C) == NULL) return 0; - if (CTX_wm_screen(C) == NULL) return 0; - if (CTX_wm_screen(C)->subwinactive != CTX_wm_screen(C)->mainwin) return 0; + screen = CTX_wm_screen(C); + if (screen == NULL) return 0; + if (screen->subwinactive != screen->mainwin) return 0; return 1; } @@ -3412,6 +3414,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { + wmWindow *win = CTX_wm_window(C); rcti rect; int sizex, sizey; @@ -3420,8 +3423,8 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev /* some magic to calculate postition */ /* pixelsize: mouse coords are in U.pixelsize units :/ */ - rect.xmin = (event->x / U.pixelsize) + CTX_wm_window(C)->posx - sizex / 2; - rect.ymin = (event->y / U.pixelsize) + CTX_wm_window(C)->posy - sizey / 2; + rect.xmin = (event->x / U.pixelsize) + win->posx - sizex / 2; + rect.ymin = (event->y / U.pixelsize) + win->posy - sizey / 2; rect.xmax = rect.xmin + sizex; rect.ymax = rect.ymin + sizey; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index ea852fdb098..c7499d3717f 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1880,40 +1880,6 @@ static void get_edge_center(float cent_r[3], BMVert *eve) } } -/* local version of #BM_vert_calc_shell_factor which only - * uses selected faces */ -static float bm_vert_calc_shell_factor_selected(BMVert *v) -{ - BMIter iter; - BMLoop *l; - float accum_shell = 0.0f; - float accum_angle = 0.0f; - int tot_sel = 0, tot = 0; - - BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { - if (BM_elem_flag_test(l->f, BM_ELEM_SELECT)) { /* <-- only difference to BM_vert_calc_shell_factor! */ - const float face_angle = BM_loop_calc_face_angle(l); - accum_shell += shell_angle_to_dist(angle_normalized_v3v3(v->no, l->f->no)) * face_angle; - accum_angle += face_angle; - tot_sel++; - } - tot++; - } - - if (accum_angle != 0.0f) { - return accum_shell / accum_angle; - } - else { - if (tot != 0 && tot_sel == 0) { - /* none selected, so use all */ - return BM_vert_calc_shell_factor(v); - } - else { - return 1.0f; - } - } -} - /* way to overwrite what data is edited with transform */ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx, BMEditMesh *em, BMVert *eve, float *bweight) @@ -1962,7 +1928,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx } else if (t->mode == TFM_SHRINKFATTEN) { td->ext = tx; - tx->isize[0] = bm_vert_calc_shell_factor_selected(eve); + tx->isize[0] = BM_vert_calc_shell_factor_ex(eve, BM_ELEM_SELECT); } } |