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:
authorAntony Riakiotakis <kalast@gmail.com>2014-03-04 16:36:46 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-03-04 16:37:06 +0400
commit6ebbcbd5df45c9a5953a3f6d3c068310fea58d7a (patch)
tree4aae29e726cc53879f2ba0fa7b3955f0615e13d1
parenta31571481be6ea74c93cf91bb330a5f511bccfc0 (diff)
Fix F62828. UV stitch code did not handle non manifold edges very well.
This made loops in linked lists of uvedges from duplicate members causing a hang. Now check all previous links before adding a new one. It is not much slower in practice because non-manifolds are not that frequent.
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index a3fee693ad7..6bf931583b6 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -669,26 +669,30 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
if (iter2) {
int index1 = map[iter1 - first_element];
int index2 = map[iter2 - first_element];
+ UvEdge edgetmp;
+ UvEdge *edge2, *eiter;
+ bool valid = true;
- /* make certain we do not have the same edge! */
- if (state->uvs[index2] != element2 && state->uvs[index1] != element1) {
- UvEdge edgetmp;
- UvEdge *edge2;
+ /* make sure the indices are well behaved */
+ if (index1 > index2) {
+ SWAP(int, index1, index2);
+ }
+ edgetmp.uv1 = index1;
+ edgetmp.uv2 = index2;
- /* make sure the indices are well behaved */
- if (index1 < index2) {
- edgetmp.uv1 = index1;
- edgetmp.uv2 = index2;
- }
- else {
- edgetmp.uv1 = index2;
- edgetmp.uv2 = index1;
- }
+ /* get the edge from the hash */
+ edge2 = BLI_ghash_lookup(edge_hash, &edgetmp);
- /* get the edge from the hash */
- edge2 = BLI_ghash_lookup(edge_hash, &edgetmp);
+ /* more iteration to make sure non-manifold case is handled nicely */
+ for (eiter = edge; eiter; eiter = eiter->next){
+ if (edge2 == eiter) {
+ valid = false;
+ break;
+ }
+ }
+ if (valid) {
/* here I am taking care of non manifold case, assuming more than two matching edges.
* I am not too sure we want this though */
last_set->next = edge2;
@@ -1889,7 +1893,7 @@ static int stitch_init(bContext *C, wmOperator *op)
if (!(ts->uv_flag & UV_SYNC_SELECTION) && ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || !BM_elem_flag_test(efa, BM_ELEM_SELECT)))
continue;
- BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+ BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_edge_select_test(scene, l, cd_loop_uv_offset)) {
UvEdge *edge = uv_edge_get(l, state);
if (edge) {