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:
authorJoseph Eagar <joeedh@gmail.com>2022-04-21 08:03:45 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-04-21 08:14:03 +0300
commit575ade22d4de472ccf9e7d2dc1ffca37416c58f6 (patch)
treea3f3432ea1c1ad6c4792ec3cfeea55e97b9280b8 /source/blender/draw
parentc6ed879f9aa7cd863f146cc7104f16cfe8a73e8a (diff)
Commit D14179: Revamp Vertex Paint With C++
- Verrtex paint mode has been refactored into C++ templates. It now works with both byte and float colors and point & corner attribute domains. - There is a new API for mixing colors (also based on C++ templates). Unlike the existing APIs byte and float colors are interpolated identically. Interpolation does happen in a squared rgb space, this may be changed in the future. - Vertex paint now uses the sculpt undo system. Reviewed By: Brecht Van Lommel. Differential Revision: https://developer.blender.org/D14179 Ref D14179
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index 60919d0d028..23543e6bfec 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -271,6 +271,14 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
BKE_pbvh_is_drawing_set(ob->sculpt->pbvh, is_sculpt_pbvh);
}
+ const CustomData *cd_vdata = workbench_mesh_get_vert_custom_data(me);
+ const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me);
+
+ bool has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) ||
+ CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) ||
+ CustomData_has_layer(cd_ldata, CD_PROP_COLOR) ||
+ CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR));
+
if (color_type == V3D_SHADING_TEXTURE_COLOR) {
if (ob->dt < OB_TEXTURE) {
color_type = V3D_SHADING_MATERIAL_COLOR;
@@ -285,14 +293,6 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
color_type = V3D_SHADING_OBJECT_COLOR;
}
else {
- const CustomData *cd_vdata = workbench_mesh_get_vert_custom_data(me);
- const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me);
-
- bool has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) ||
- CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) ||
- CustomData_has_layer(cd_ldata, CD_PROP_COLOR) ||
- CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR));
-
if (!has_color) {
color_type = V3D_SHADING_OBJECT_COLOR;
}
@@ -314,7 +314,7 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
*r_texpaint_mode = true;
}
}
- else if (is_vertpaint_mode && me && CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) {
+ else if (is_vertpaint_mode && me && has_color) {
color_type = V3D_SHADING_VERTEX_COLOR;
}
}