diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_buttons.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 66 |
1 files changed, 47 insertions, 19 deletions
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index eea084b4750..dc6f3a0274c 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -482,7 +482,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - add_v3_v3(eve->co, &median[LOC_X]); + if (tot == 1) { + /* In case we only have one element selected, copy directly the value instead of applying + * the diff. Avoids some glitches when going e.g. from 3 to 0.0001 (see [#37327]). + */ + copy_v3_v3(eve->co, &ve_median[LOC_X]); + } + else { + add_v3_v3(eve->co, &median[LOC_X]); + } } } @@ -623,10 +631,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float nu = nurbs->first; while (nu) { if (nu->type == CU_BEZIER) { - bezt = nu->bezt; - a = nu->pntsu; - while (a--) { + for (a = nu->pntsu, bezt = nu->bezt; a--; bezt++) { if (bezt->f2 & SELECT) { + /* Here we always have to use the diff... :/ + * Cannot avoid some glitches when going e.g. from 3 to 0.0001 (see [#37327]), + * unless we use doubles. + */ add_v3_v3(bezt->vec[0], &median[LOC_X]); add_v3_v3(bezt->vec[1], &median[LOC_X]); add_v3_v3(bezt->vec[2], &median[LOC_X]); @@ -647,22 +657,39 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } else { if (bezt->f1 & SELECT) { - add_v3_v3(bezt->vec[0], &median[LOC_X]); + if (tot == 1) { + copy_v3_v3(bezt->vec[0], &ve_median[LOC_X]); + } + else { + add_v3_v3(bezt->vec[0], &median[LOC_X]); + } } if (bezt->f3 & SELECT) { - add_v3_v3(bezt->vec[2], &median[LOC_X]); + if (tot == 1) { + copy_v3_v3(bezt->vec[2], &ve_median[LOC_X]); + } + else { + add_v3_v3(bezt->vec[2], &median[LOC_X]); + } } } - bezt++; } } else { - bp = nu->bp; - a = nu->pntsu * nu->pntsv; - while (a--) { + for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) { if (bp->f1 & SELECT) { - add_v3_v3(bp->vec, &median[LOC_X]); - bp->vec[3] += median[C_BWEIGHT]; + if (tot == 1) { + copy_v3_v3(bp->vec, &ve_median[LOC_X]); + bp->vec[3] = ve_median[C_BWEIGHT]; + bp->radius = ve_median[C_RADIUS]; + bp->alfa = ve_median[C_TILT]; + } + else { + add_v3_v3(bp->vec, &median[LOC_X]); + bp->vec[3] += median[C_BWEIGHT]; + bp->radius += median[C_RADIUS]; + bp->alfa += median[C_TILT]; + } if (median[C_WEIGHT] != 0.0f) { if (ELEM(scale_w, 0.0f, 1.0f)) { @@ -674,11 +701,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float CLAMP(bp->weight, 0.0f, 1.0f); } } - - bp->radius += median[C_RADIUS]; - bp->alfa += median[C_TILT]; } - bp++; } } BKE_nurb_test2D(nu); @@ -697,7 +720,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float bp = lt->editlatt->latt->def; while (a--) { if (bp->f1 & SELECT) { - add_v3_v3(bp->vec, &median[LOC_X]); + if (tot == 1) { + copy_v3_v3(bp->vec, &ve_median[LOC_X]); + } + else { + add_v3_v3(bp->vec, &median[LOC_X]); + } if (median[L_WEIGHT] != 0.0f) { if (ELEM(scale_w, 0.0f, 1.0f)) { @@ -831,7 +859,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) xco, yco, (x = UI_UNIT_X * 5), UI_UNIT_Y, ""); but_ptr = uiButGetOperatorPtrRNA(but); RNA_int_set(but_ptr, "weight_group", i); - uiButSetFlag(but, UI_TEXT_RIGHT); + uiButSetDrawFlag(but, UI_BUT_TEXT_RIGHT); if (ob->actdef != i + 1) { uiButSetFlag(but, UI_BUT_INACTIVE); } @@ -845,7 +873,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) but = uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + i, "", xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y, &dw->weight, 0.0, 1.0, 1, 3, ""); - uiButSetFlag(but, UI_TEXT_LEFT); + uiButSetDrawFlag(but, UI_BUT_TEXT_LEFT); if (locked) { lock_count++; } |