diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-12-18 22:33:04 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-12-18 22:33:04 +0300 |
commit | 6e5b573dc8288826f05fd3a0b0b6de2a9753ba8b (patch) | |
tree | 8c2272bcef3cc6fac01537996deef15fb0a0c973 /source/blender/editors/transform/transform_conversions.c | |
parent | 5638db749529a77ef4bf8421e1a90eeee6994d5c (diff) | |
parent | 1875f9e7d7bcd157fb1c359be6a41984bd84d4dc (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/editors/transform/transform_conversions.c
Diffstat (limited to 'source/blender/editors/transform/transform_conversions.c')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1702fd8fcd3..0184e754305 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2565,7 +2565,7 @@ static struct TransIslandData *editmesh_islands_info_calc( /* way to overwrite what data is edited with transform */ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx, BMEditMesh *em, BMVert *eve, float *bweight, - struct TransIslandData *v_island) + struct TransIslandData *v_island, const bool no_island_center) { float *no, _no[3]; BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0); @@ -2589,7 +2589,12 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx } if (v_island) { - copy_v3_v3(td->center, v_island->co); + if (no_island_center) { + copy_v3_v3(td->center, td->loc); + } + else { + copy_v3_v3(td->center, v_island->co); + } copy_m3_m3(td->axismtx, v_island->axismtx); } else if (t->around == V3D_AROUND_LOCAL_ORIGINS) { @@ -2636,7 +2641,6 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx static void createTransEditVerts(TransInfo *t) { FOREACH_TRANS_DATA_CONTAINER (t, tc) { - TransData *tob = NULL; TransDataExtension *tx = NULL; BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); @@ -2657,8 +2661,14 @@ static void createTransEditVerts(TransInfo *t) int island_info_tot; int *island_vert_map = NULL; + /* Snap rotation along normal needs a common axis for whole islands, otherwise one get random crazy results, + * see T59104. However, we do not want to use the island center for the pivot/translation reference... */ + const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) && + /* There is not guarantee that snapping is initialized yet at this point... */ + (usingSnappingNormal(t) || (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) && + (t->around != V3D_AROUND_LOCAL_ORIGINS)); /* Even for translation this is needed because of island-orientation, see: T51651. */ - const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS); + const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS) || is_snap_rotate; /* Original index of our connected vertex when connected distances are calculated. * Optional, allocate if needed. */ int *dists_index = NULL; @@ -2799,7 +2809,9 @@ static void createTransEditVerts(TransInfo *t) } - VertsToTransData(t, tob, tx, em, eve, bweight, v_island); + /* Do not use the island center in case we are using islands + * only to get axis for snap/rotate to normal... */ + VertsToTransData(t, tob, tx, em, eve, bweight, v_island, is_snap_rotate); if (tx) tx++; |