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-09 22:10:56 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-09 22:11:18 +0300
commit18e3615a68191c9f35303139d109972744499565 (patch)
tree1120a51ab295715c8a2711b45335ceda18909654 /source/blender/gpu/intern/gpu_buffers.c
parent0dfb4ac1ff9a81864d44f91e259a829d80863a80 (diff)
Face Sets: Use white color for a default Face Set to enable the overlay
This introduces a variable to store a face set ID which is going to be rendered white. When initializing a mesh or randomizing the colors, this variable gets updated to always render a white face set. This way the face set overlay can be enabled without adding colors to the mesh if face sets are not in use. After creating the first face set, new colors are generated randomly like usual. The face set stored as default does not have any special meaning for tools or brushes, it just affects the rendering color. Reviewed By: brecht Differential Revision: https://developer.blender.org/D7035
Diffstat (limited to 'source/blender/gpu/intern/gpu_buffers.c')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 6671296db2a..5eae86e50f0 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -213,6 +213,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
const MLoopCol *vcol,
const int *sculpt_face_sets,
const int face_sets_color_seed,
+ const int face_sets_color_default,
const int (*face_vert_indices)[3],
const int update_flags)
{
@@ -267,8 +268,12 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
for (uint i = 0; i < buffers->face_indices_len; i++) {
if (show_face_sets) {
const MLoopTri *lt = &buffers->looptri[buffers->face_indices[i]];
- face_set_overlay_color_get(
- sculpt_face_sets[lt->poly], face_sets_color_seed, face_set_color);
+ const int fset = abs(sculpt_face_sets[lt->poly]);
+
+ /* Skip for the default color Face Set to render it white. */
+ if (fset != face_sets_color_default) {
+ face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color);
+ }
}
for (int j = 0; j < 3; j++) {
const int vidx = face_vert_indices[i][j];
@@ -325,8 +330,11 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
uchar face_set_color[4] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX, UCHAR_MAX};
if (show_face_sets) {
- face_set_overlay_color_get(
- sculpt_face_sets[lt->poly], face_sets_color_seed, face_set_color);
+ const int fset = abs(sculpt_face_sets[lt->poly]);
+ /* Skip for the default color Face Set to render it white. */
+ if (fset != face_sets_color_default) {
+ face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color);
+ }
}
float fmask = 0.0f;