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:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-12 22:43:01 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-12 22:43:38 +0300
commitb0271c6e408f66a7265dccc6e12ca21a9332a9dc (patch)
treeb5d0dbfa38da95fac08ad0b96fb756cd9a9a0e58 /source/blender/editors/sculpt_paint
parent53c03d4679f6ed94cac341af0d11a3a8495083a7 (diff)
Use golden ratio conjugate for Face Sets hue generation
The face set ID is sequential, so implementing this was straightforward. Suggested by Jeroen Bakker Reviewed By: jbakker Differential Revision: https://developer.blender.org/D7123
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 65cfcd1f8db..c14b9565c1b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -11105,14 +11105,13 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C,
int totnode;
Mesh *mesh = ob->data;
- int new_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX);
- mesh->face_sets_color_seed = new_seed;
+ mesh->face_sets_color_seed += 1;
if (ss->face_sets) {
const int random_index = clamp_i(
- ss->totpoly * BLI_hash_int_01(new_seed), 0, max_ii(0, ss->totpoly - 1));
+ ss->totpoly * BLI_hash_int_01(mesh->face_sets_color_seed), 0, max_ii(0, ss->totpoly - 1));
mesh->face_sets_color_default = ss->face_sets[random_index];
}
- BKE_pbvh_face_sets_color_set(pbvh, new_seed, mesh->face_sets_color_default);
+ BKE_pbvh_face_sets_color_set(pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default);
BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
for (int i = 0; i < totnode; i++) {