diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-17 16:06:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-17 16:25:30 +0300 |
commit | 9296ba867462f7ff3c55bc0c9129af4121243bed (patch) | |
tree | 0c192a421dfb19ac2370b988978314bac8e4f6f7 /source/blender/editors/uvedit/uvedit_unwrap_ops.c | |
parent | a993600323867211f45f636058f20b66f144c34b (diff) |
Fix T82637: pack UV islands fails with some non-manifold meshes
Edges with 3 or more connected UV's caused UV pack to fail.
Instead of using functions from uvedit_parametrizer.c which are intended
specifically for ABF/LSCM unwrapping, use a simpler method for packing
which stores arrays of BMesh faces.
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_unwrap_ops.c')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a50386a64e2..6989f0afbe8 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -965,6 +965,12 @@ static void uvedit_pack_islands(const Scene *scene, Object *ob, BMesh *bm) param_delete(handle); } +/** + * \warning Since this uses #ParamHandle it doesn't work with non-manifold meshes (see T82637). + * Use #ED_uvedit_pack_islands_multi for a more general solution. + * + * TODO: remove this function, in favor of #ED_uvedit_pack_islands_multi. + */ static void uvedit_pack_islands_multi(const Scene *scene, Object **objects, const uint objects_len, @@ -999,7 +1005,6 @@ static int pack_islands_exec(bContext *C, wmOperator *op) }; bool rotate = RNA_boolean_get(op->ptr, "rotate"); - bool ignore_pinned = false; uint objects_len = 0; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( @@ -1017,7 +1022,16 @@ static int pack_islands_exec(bContext *C, wmOperator *op) RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin); } - uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned); + ED_uvedit_pack_islands_multi(scene, + objects, + objects_len, + &(struct UVPackIsland_Params){ + .rotate = rotate, + .rotate_align_axis = -1, + .only_selected_uvs = true, + .only_selected_faces = true, + .correct_aspect = true, + }); MEM_freeN(objects); @@ -2149,20 +2163,19 @@ static int smart_project_exec(bContext *C, wmOperator *op) if (object_changed_len > 0) { scene->toolsettings->uvcalc_margin = island_margin; - const UnwrapOptions options = { - .topology_from_uvs = true, - /* Even though the islands are defined by UV's, - * split them by seams so users have control over the islands. */ - .topology_from_uvs_use_seams = true, - - .only_selected_faces = true, - .only_selected_uvs = false, - .fill_holes = true, - .correct_aspect = false, - }; /* Depsgraph refresh functions are called here. */ - uvedit_pack_islands_multi(scene, objects_changed, object_changed_len, &options, true, false); + ED_uvedit_pack_islands_multi(scene, + objects_changed, + object_changed_len, + &(struct UVPackIsland_Params){ + .rotate = true, + /* We could make this optional. */ + .rotate_align_axis = 1, + .only_selected_faces = true, + .correct_aspect = true, + }); + uv_map_clip_correct_multi(objects_changed, object_changed_len, op); } |