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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-11-09 14:35:32 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-11-09 14:35:32 +0400
commit396fb315c5f0267a0511eda87221c8a2836c6f21 (patch)
tree2f56c68a8a529954ec38b03fa821b4033823dfdd /source
parentac6d91b9396c15d8bf1aa550adb4ca8c7125dd81 (diff)
More fix for [#37327] Inconsistent numeric input conversion.
When a single element is involved, apply directly the values instead of using the diff from init values. This avoids glitches when going from huge values to very small ones (due to float precision). Note we should probably switch to doubles here, ultimately, but would leave that for later. Manys thanks to Armin Zingler, who did all the investigation work on this point!
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c62
1 files changed, 45 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index eea084b4750..c4fdacaa915 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)) {