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
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-03-02 14:21:53 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-03-04 19:11:58 +0300
commit67b16c6170b0ef79ab7ab9d7f2dc1e48679bffff (patch)
tree7fed379aa04ce45f919820f601bdaf4080ccae40
parent3382ba0238e1d234ffa21df5ac1d801d57ef3f9e (diff)
Fix T47564: Unwrapping the same mesh results in different UVs.
Pointers of faces were passed as face keys during parametrizer's face creation. Since those addresses were different for every run, the layout of the faces ended up being different in the internal hash, leading to inconsistent order of their evaluation during LSCM solving, and slightly different UV maps. Solved by simply using faces' indices as key instead, which ensures we always get same results with exact same input data now. Many thanks to Roman Nagornov (RomanN) for raising the issue, investigating it and finding the solution! And thanks to Brecht for quick review too.
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 3f218136751..9f2b0f1af14 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -217,7 +217,7 @@ void ED_uvedit_get_aspect(Scene *scene, Object *ob, BMesh *bm, float *aspx, floa
}
static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene,
- BMFace *efa, const int cd_loop_uv_offset)
+ BMFace *efa, int face_index, const int cd_loop_uv_offset)
{
ParamKey key;
ParamKey *vkeys = BLI_array_alloca(vkeys, efa->len);
@@ -230,7 +230,7 @@ static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene,
BMIter liter;
BMLoop *l;
- key = (ParamKey)efa;
+ key = (ParamKey)face_index;
/* let parametrizer split the ngon, it can make better decisions
* about which split is best for unwrapping than scanfill */
@@ -256,6 +256,7 @@ static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMesh *bm,
BMLoop *l;
BMEdge *eed;
BMIter iter, liter;
+ int i;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
@@ -273,7 +274,7 @@ static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMesh *bm,
/* we need the vert indices */
BM_mesh_elem_index_ensure(bm, BM_VERT);
- BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0)) {
continue;
@@ -293,7 +294,7 @@ static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMesh *bm,
}
}
- construct_param_handle_face_add(handle, scene, efa, cd_loop_uv_offset);
+ construct_param_handle_face_add(handle, scene, efa, i, cd_loop_uv_offset);
}
if (!implicit) {
@@ -449,7 +450,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
/* We will not check for v4 here. Subsurfed mfaces always have 4 vertices. */
BLI_assert(mpoly->totloop == 4);
- key = (ParamKey)mpoly;
+ key = (ParamKey)i;
vkeys[0] = (ParamKey)mloop[0].v;
vkeys[1] = (ParamKey)mloop[1].v;
vkeys[2] = (ParamKey)mloop[2].v;