diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-06 20:15:35 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-06 20:15:35 +0300 |
commit | 8719ac990f7b1a3098d7bab845cab55b5a9736c6 (patch) | |
tree | 8d525eb62cf0edf78330091615cc5dde8728bf57 /source/blender/editors/sculpt_paint/sculpt_pose.c | |
parent | d693d77fed968c126dbde62c73bbaffc5b14b43c (diff) | |
parent | cc3cb52b23d8adcd2d0b7f6bc6bb3041dc1794cc (diff) |
Merge branch 'blender-v2.90-release'
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_pose.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_pose.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c index f099dc0a6c1..8a288877d43 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@ -830,17 +830,21 @@ static bool pose_face_sets_fk_find_masked_floodfill_cb( } const int to_face_set = SCULPT_vertex_face_set_get(ss, to_v); - if (SCULPT_vertex_has_unique_face_set(ss, to_v) && - !SCULPT_vertex_has_unique_face_set(ss, from_v) && - SCULPT_vertex_has_face_set(ss, from_v, to_face_set)) { + if (!BLI_gset_haskey(data->visited_face_sets, POINTER_FROM_INT(to_face_set))) { + if (SCULPT_vertex_has_unique_face_set(ss, to_v) && + !SCULPT_vertex_has_unique_face_set(ss, from_v) && + SCULPT_vertex_has_face_set(ss, from_v, to_face_set)) { - if (data->floodfill_it[to_v] > data->masked_face_set_it) { - data->masked_face_set = to_face_set; - data->masked_face_set_it = data->floodfill_it[to_v]; - } + BLI_gset_add(data->visited_face_sets, POINTER_FROM_INT(to_face_set)); + + if (data->floodfill_it[to_v] >= data->masked_face_set_it) { + data->masked_face_set = to_face_set; + data->masked_face_set_it = data->floodfill_it[to_v]; + } - if (data->target_face_set == SCULPT_FACE_SET_NONE) { - data->target_face_set = to_face_set; + if (data->target_face_set == SCULPT_FACE_SET_NONE) { + data->target_face_set = to_face_set; + } } } @@ -875,8 +879,10 @@ static SculptPoseIKChain *pose_ik_chain_init_face_sets_fk( fdata.masked_face_set = SCULPT_FACE_SET_NONE; fdata.target_face_set = SCULPT_FACE_SET_NONE; fdata.masked_face_set_it = 0; + fdata.visited_face_sets = BLI_gset_int_new_ex("visited_face_sets", 3); SCULPT_floodfill_execute(ss, &flood, pose_face_sets_fk_find_masked_floodfill_cb, &fdata); SCULPT_floodfill_free(&flood); + BLI_gset_free(fdata.visited_face_sets, NULL); int origin_count = 0; float origin_acc[3] = {0.0f}; |