forked from bartvdbraak/blender
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.
This commit is contained in:
parent
a31571481b
commit
6ebbcbd5df
@ -669,26 +669,30 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
|
|||||||
if (iter2) {
|
if (iter2) {
|
||||||
int index1 = map[iter1 - first_element];
|
int index1 = map[iter1 - first_element];
|
||||||
int index2 = map[iter2 - 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! */
|
/* make sure the indices are well behaved */
|
||||||
if (state->uvs[index2] != element2 && state->uvs[index1] != element1) {
|
if (index1 > index2) {
|
||||||
UvEdge edgetmp;
|
SWAP(int, index1, index2);
|
||||||
UvEdge *edge2;
|
}
|
||||||
|
|
||||||
|
edgetmp.uv1 = index1;
|
||||||
|
edgetmp.uv2 = index2;
|
||||||
|
|
||||||
/* make sure the indices are well behaved */
|
/* get the edge from the hash */
|
||||||
if (index1 < index2) {
|
edge2 = BLI_ghash_lookup(edge_hash, &edgetmp);
|
||||||
edgetmp.uv1 = index1;
|
|
||||||
edgetmp.uv2 = index2;
|
/* more iteration to make sure non-manifold case is handled nicely */
|
||||||
}
|
for (eiter = edge; eiter; eiter = eiter->next){
|
||||||
else {
|
if (edge2 == eiter) {
|
||||||
edgetmp.uv1 = index2;
|
valid = false;
|
||||||
edgetmp.uv2 = index1;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* get the edge from the hash */
|
if (valid) {
|
||||||
edge2 = BLI_ghash_lookup(edge_hash, &edgetmp);
|
|
||||||
|
|
||||||
/* here I am taking care of non manifold case, assuming more than two matching edges.
|
/* here I am taking care of non manifold case, assuming more than two matching edges.
|
||||||
* I am not too sure we want this though */
|
* I am not too sure we want this though */
|
||||||
last_set->next = edge2;
|
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)))
|
if (!(ts->uv_flag & UV_SYNC_SELECTION) && ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || !BM_elem_flag_test(efa, BM_ELEM_SELECT)))
|
||||||
continue;
|
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)) {
|
if (uvedit_edge_select_test(scene, l, cd_loop_uv_offset)) {
|
||||||
UvEdge *edge = uv_edge_get(l, state);
|
UvEdge *edge = uv_edge_get(l, state);
|
||||||
if (edge) {
|
if (edge) {
|
||||||
|
Loading…
Reference in New Issue
Block a user