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-09-18 20:30:02 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-09-18 20:30:51 +0300
commit6c9ec1c893f98c2349edd3aaae4b606b55b393c9 (patch)
tree1a3747a77a7eacd59304143ef717896fb5991371 /source/blender/blenkernel/intern/paint.c
parentea6cd1c8f05b27a81e835251e779f047a3488203 (diff)
Sculpt: Render Mask and Face Sets with modifiers active
This removes the limitation of the sculpt overlays not being visible with modifiers active. Reviewed By: fclem Maniphest Tasks: T68900 Differential Revision: https://developer.blender.org/D8673
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index c9b3b3cc516..3ac9db0eb78 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -38,6 +38,7 @@
#include "DNA_workspace_types.h"
#include "BLI_bitmap.h"
+#include "BLI_hash.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
@@ -2101,3 +2102,21 @@ bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
/* Multires and dyntopo always draw directly from the PBVH. */
return true;
}
+
+/* Returns the Face Set random color for rendering in the overlay given its ID and a color seed. */
+#define GOLDEN_RATIO_CONJUGATE 0.618033988749895f
+void BKE_paint_face_set_overlay_color_get(const int face_set, const int seed, uchar r_color[4])
+{
+ float rgba[4];
+ float random_mod_hue = GOLDEN_RATIO_CONJUGATE * (abs(face_set) + (seed % 10));
+ random_mod_hue = random_mod_hue - floorf(random_mod_hue);
+ const float random_mod_sat = BLI_hash_int_01(abs(face_set) + seed + 1);
+ const float random_mod_val = BLI_hash_int_01(abs(face_set) + seed + 2);
+ hsv_to_rgb(random_mod_hue,
+ 0.6f + (random_mod_sat * 0.25f),
+ 1.0f - (random_mod_val * 0.35f),
+ &rgba[0],
+ &rgba[1],
+ &rgba[2]);
+ rgba_float_to_uchar(r_color, rgba);
+}