Fix random color drawing having similar colors for similar names.

This commit is contained in:
Brecht Van Lommel 2018-11-24 18:37:21 +01:00
parent 23d66c5d60
commit 5166132708
Notes: blender-bot 2023-02-14 07:17:43 +01:00
Referenced by issue #59645, The recent changes broke the pressure and tilt of the tablet pen
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include "BIF_gl.h"
#include "BLI_dynstr.h"
#include "BLI_hash.h"
#define HSV_SATURATION 0.5
#define HSV_VALUE 0.9
@ -27,9 +28,9 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Mate
if (ob->id.lib) {
hash = (hash * 13) ^ BLI_ghashutil_strhash_p_murmur(ob->id.lib->name);
}
float offset = fmodf((hash / 100000.0) * M_GOLDEN_RATION_CONJUGATE, 1.0);
float hsv[3] = {offset, HSV_SATURATION, HSV_VALUE};
float hue = BLI_hash_int_01(hash);
float hsv[3] = {hue, HSV_SATURATION, HSV_VALUE};
hsv_to_rgb_v(hsv, data->diffuse_color);
}
else {