Fix T74646: Pick a random face set to be rendered white when randomizing the colors
The previous solution was also working fine as the white face set has no meaning, but now it is a little bit more random. Also, bigger face sets have more chance of getting the white color. Reviewed By: jbakker Maniphest Tasks: T74646 Differential Revision: https://developer.blender.org/D7111
This commit is contained in:
parent
88fd2b1dd5
commit
9dcd6ba3eb
Notes:
blender-bot
2023-02-14 00:44:02 +01:00
Referenced by issue #74646, Randomize Colors on Face Sets will always set one to be white
|
@ -11111,7 +11111,9 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C,
|
|||
int new_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
mesh->face_sets_color_seed = new_seed;
|
||||
if (ss->face_sets) {
|
||||
mesh->face_sets_color_default = ss->face_sets[0];
|
||||
const int random_index = clamp_i(
|
||||
ss->totpoly * BLI_hash_int_01(new_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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue