Page MenuHome

Sculpt Vertex Colors
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Oct 2 2019, 10:28 PM.
Tokens
"Like" token, awarded by TheCharacterhero."Love" token, awarded by hitrpr."Love" token, awarded by HEYPictures."Love" token, awarded by cfnjrey."Like" token, awarded by VertexSupa."Burninate" token, awarded by DiogoX2."Like" token, awarded by craig_jones."Love" token, awarded by Dardranight."Love" token, awarded by kynu."Love" token, awarded by otsoa."Like" token, awarded by Fracture128."Love" token, awarded by Schamph."Love" token, awarded by Stig."Party Time" token, awarded by Zino."Love" token, awarded by Anubis."Love" token, awarded by reanimate."Burninate" token, awarded by shader."Love" token, awarded by Debuk."Mountain of Wealth" token, awarded by franMarz."Love" token, awarded by 0o00o0oo."100" token, awarded by mywa880."Love" token, awarded by andruxa696."Like" token, awarded by Constantina32."Yellow Medal" token, awarded by ThomasJohann."Love" token, awarded by YianniP."Love" token, awarded by icappiello."Love" token, awarded by lopoIsaac."Like" token, awarded by knightknight."Love" token, awarded by marcoalvares."Love" token, awarded by ghfujianbin."Like" token, awarded by Regnas."Love" token, awarded by Brandon777."Love" token, awarded by johnsyed."Love" token, awarded by jb0815."Love" token, awarded by brilliant_ape."Love" token, awarded by MetinSeven."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by amonpaike."Love" token, awarded by xrg."Love" token, awarded by Draise."Love" token, awarded by n-pigeon.

Details

Summary

This patch contains the Vertex Colors painting mode available in the sculpt branch. It provides:

  • Much better performance and more advanced tools
  • Reuse all optimizations and tools from sculpt mode
  • Sculpting and painting at the same time
  • Remesh reprojection

This patch includes the most basic features to get the Sculpt Vertex Colors working:

  • CD_MVERTCOL data layer
  • SCULPT_UNDO_COLOR for undo support in sculpt mode
  • SCULPT_UPDATE_COLOR and PBVH flags and rendering
  • Sculpt Color API functions
  • Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
  • Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
  • Conversion operator between MVertCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
  • Remesher reprojection in the Voxel Remehser
  • Paint Brush and Smear Brush with color smoothing in alt-smooth mode
  • Color Filter
  • Color selector in the top bar

All the remaining features that are in the current vertex paint mode are implemented in the sculpt branch and I will add them in future patches. Sculpting and painting at the same time can also be easily enabled in a future patch.

I added the CD_MVERTCOL layer without doing anything to CD_MLOOPCOL. MLoopCol is still available in Vertex Paint as usual.

Diff Detail

Repository
rB Blender

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@Jeroen Bakker (jbakker) I think I now fixed all issues mentioned in T72866 (and more crashes and bugs not listed there) except for the naming, so this may be ready for another review. The naming needs to be decided, but I would like to avoid the same situation as the initial Face Sets patch (patch waiting months mainly just for renaming it from Face Map -> Face Groups -> Face Masks -> Face Sets). If we are not sure about the naming but the rest is fine, the sooner this can be moved to master for people to test the more polished the final implementation will be. I think functions naming and UI can be changed at any time in BCon1 in master without major consequences.

Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)
  • Rebase, use CD_PROP_COLOR
  • Remove Unused Preset
  • Remove changes in math_vector.c
  • Use LISTBASE_FOREACH
  • Fix comment
  • Remove duplicated function
  • Remove duplicated comment
  • Simplify needs_colors
Brecht Van Lommel (brecht) requested changes to this revision.Wed, Jun 17, 5:02 PM

Just selecting a paint tool and starting to paint has (unlike other paint modes) has no visible effect, for two reasons:

  • Both the default vertex color and brush color is white
  • Vertex colors need to be enabled in viewport shading

The default brush color could be changed to black. How to solve the shading is less obvious. Perhaps the sculpt overlay settings could have an option to show vertex colors, that under the hood does the same thing as enabling Vertex color, but for just the objects in sculpt mode. This might also be useful, you don't necessarily want to scene all objects in the scene with vertex colors. I can see how this is potentially confusing too, maybe there is a better solution.

release/scripts/presets/keyconfig/keymap_data/blender_default.py
4346

#Color -> # Color

4370

This change is not mentioned in the description. It may be fine, though I'm guessing it might be controversial to change this shortcut.

release/scripts/startup/bl_ui/properties_data_mesh.py
484–488

Style: use exactly two empty lines before and after class definition.

release/scripts/startup/bl_ui/properties_paint_common.py
611–612

Indent 4 instead of 2 spaces.

670–671

Style: use single empty line.

release/scripts/startup/bl_ui/space_view3d.py
7342–7345

Indent 4 instead of 2 spaces.

source/blender/blenkernel/intern/brush.c
1652–1658

Reorder lines so indexes are in 0-1-2 order.

source/blender/blenkernel/intern/mesh.c
575 ↗(On Diff #25995)

Remove mpropcol and replace with CustomData_has_layer() and similar functions. These pointers are not that helpful, they are at risk of going out of sync with the customdata contents.

source/blender/blenkernel/intern/paint.c
1685

need_colors is unused here.

I guess the intent was to move the code that adds the layer into this function, which makes sense to me.

1695

tools -> tool

1701

0 -> ID_RECALC_GEOMETRY, not specifying specifics flags is only for legacy code that needs to be updated still.

source/blender/blenloader/intern/versioning_280.c
5107–5114

I guess this code is for versioning existing .blend files created with the branch? OtherwiseI don't see how a paint brush could exist.

source/blender/draw/intern/draw_cache_extract.h
56

Rename to sculpt_vcol, less obscure.

source/blender/draw/intern/draw_cache_extract_mesh.c
2202

Change this to:

/* We only do vcols that are not overridden by uvs and sculpt vertex colors */
if (CustomData_get_named_layer_index(cd_ldata, CD_MLOOPUV, layer_name) == -1 &&
    CustomData_get_named_layer_index(cd_vdata, CD_PROP_COLOR, layer_name) == -1) {

This is for the case where an attribute is selected by name, and we need to resolve conflicts when different types used the same name.

source/blender/editors/sculpt_paint/sculpt.c
8123

Sample color -> Sample Color

source/blender/makesrna/intern/rna_brush.c
102–103

Don't use full caps for the name, only the identifier.

source/blender/makesrna/intern/rna_mesh.c
496–514

These should be removed. There is no need to multiply with 255 since we are storing as float in 0..1 and that's also what the Python API needs.

2520–2523

VertColors -> VertexColors, we don't abbreviate MeshVertex either.

This revision now requires changes to proceed.Wed, Jun 17, 5:02 PM
Pablo Dobarro (pablodp606) marked 15 inline comments as done.
  • Review update
release/scripts/presets/keyconfig/keymap_data/blender_default.py
4370

Smooth is almost always used with this Shift Key. We can change the shortcut for smooth in a later patch if it causes problems, but I think that a better way of assigning shortcuts to brushes should be part of the brush management project.

source/blender/blenloader/intern/versioning_280.c
5107–5114

Yes, this was added during the review process when I implemented and fixes some features in the main paint brush. Should I remove this?

Brecht Van Lommel (brecht) requested changes to this revision.Fri, Jun 19, 5:59 PM

Only minor comment now.

I think it's still a problem to users that vertex colors need to be enabled in viewport shading for them to show up. We don't need to solve that in the initial commit, but definitely for 2.90.

release/scripts/presets/keyconfig/keymap_data/blender_default.py
4370

That's mainly my concern, if we change shortcuts we better do it in one go when brush management arrives rather than a little bit every release.

But well, there is no ideal solution here since we also want consistency with other paint modes. So I'll leave the decision to you, it should just be communicated in the release notes.

source/blender/blenloader/intern/versioning_280.c
5107–5114

It's ok to keep, but add a comment to explain the reason.

source/blender/makesrna/intern/rna_mesh.c
496–514

round_fl_to_uchar_clamp will convert to uchar which is wrong.

The rna_MeshVertColor_color_get and rna_MeshVertColor_color_set functions should be removed entirely, they serve no purpose. The data can just be directly wrapped by RNA, since there is no conversion needed, it's all floats.

This revision now requires changes to proceed.Fri, Jun 19, 5:59 PM

I've created T78041: Sculpt vertex color improvements for 2.90 to follow up on this commit, so we have a clear overview of what needs to be done for 2.90 still.

Pablo Dobarro (pablodp606) marked 2 inline comments as done.
  • Review update

Removing @Jeroen Bakker (jbakker) as reviewer, since I took over the last part of the review and I don't think he needs to look at it further.

This revision is now accepted and ready to land.Fri, Jun 19, 6:56 PM

@Brecht Van Lommel (brecht) Two things before committing:

  • After removing the rna_MeshVertColor_color_get functions from RNA_def_property_float_funcs I can't do a clean build with this patch. (ERROR (makesrna): makesrna.c:639 rna_def_property_get_func: MeshVertColor.color has no valid dna info.) Is there something else I need to remove?
  • Right now, there is a crash when entering edit mode with a Sculpt Vertex Color layer enabled and using the Vertex color mode in workbench in extract_vcol_init. I guess I need to use MR_EXTRACT_BMESH (which was introduced in the last rebase), but that does not work either (cd_vdata is NULL). Is there something that I need to enable in the datalayer to make this work?
  • After removing the rna_MeshVertColor_color_get functions from RNA_def_property_float_funcs I can't do a clean build with this patch. (ERROR (makesrna): makesrna.c:639 rna_def_property_get_func: MeshVertColor.color has no valid dna info.) Is there something else I need to remove?

Add RNA_def_property_float_sdna(prop, NULL, "col") since the name does not match DNA.

Or alternatively, rename the member in DNA, since the "col" abbreviation is not necessary.

  • Right now, there is a crash when entering edit mode with a Sculpt Vertex Color layer enabled and using the Vertex color mode in workbench in extract_vcol_init. I guess I need to use MR_EXTRACT_BMESH (which was introduced in the last rebase), but that does not work either (cd_vdata is NULL). Is there something that I need to enable in the datalayer to make this work?

What did you try exactly, how is cd_vdata NULL?

I would think it's a matter of using CustomData *cd_vdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->vdata : &mr->me->vdata;

  • Rename col to color in DNA
  • Use bm->vdata in extract_vcol_init

I would think it's a matter of using CustomData *cd_vdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->vdata : &mr->me->vdata;

@Brecht Van Lommel (brecht) That is what I tried, and cd_vdata is NULL when in edit mode. Someone reported in blender.chat that this crash also happens in master with the loop colors datalayer (I can't reproduce it), so I just wanted to make sure that the problem is not related to how the sculpt vertex colors are implemented

Brecht Van Lommel (brecht) requested changes to this revision.Mon, Jun 22, 5:31 PM

Regarding the crash, it's CustomData_get_layer_n(cd_vdata, CD_PROP_COLOR, i); that is NULL, not cd_vdata. I think this happens because you need to update more code in extract_vcol_init. Note how for loop colors there is:

if (vcol_layers & (1 << i)) {
  if (mr->extract_type == MR_EXTRACT_BMESH) {
    int cd_ofs = CustomData_get_n_offset(cd_ldata, CD_MLOOPCOL, i);
    BMIter f_iter, l_iter;
    BMFace *efa;
    BMLoop *loop;
    BM_ITER_MESH (efa, &f_iter, mr->bm, BM_FACES_OF_MESH) {
      BM_ITER_ELEM (loop, &l_iter, efa, BM_LOOPS_OF_FACE) {
        ...

Similar logic will be needed for vertex colors, but iterating over vertices instead of loops.

Also add this to preserve colors through modifiers.

diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index c5ef5ac..d8c3e0b 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -183,7 +183,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
 #endif
         /* Always compute UVs, vertex colors as orcos for render. */
         cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
-        cddata_masks.vmask |= CD_MASK_ORCO;
+        cddata_masks.vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR;
       }
       if (em) {
         makeDerivedMesh(depsgraph, scene, ob, em, &cddata_masks); /* was CD_MASK_BAREMESH */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index fac378a..5e0a8b6 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2376,7 +2376,7 @@ void ED_view3d_datamask(const bContext *C,
 {
   if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) {
     r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
-    r_cddata_masks->vmask |= CD_MASK_ORCO;
+    r_cddata_masks->vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR;
   }
   else if (v3d->shading.type == OB_SOLID) {
     if (v3d->shading.color_type == V3D_SHADING_TEXTURE_COLOR) {
@@ -2384,6 +2384,7 @@ void ED_view3d_datamask(const bContext *C,
     }
     if (v3d->shading.color_type == V3D_SHADING_VERTEX_COLOR) {
       r_cddata_masks->lmask |= CD_MASK_MLOOPCOL;
+      r_cddata_masks->vmask |= CD_MASK_PROP_COLOR;
     }
   }

This patch also has a bunch of warnings:

[173/1608] Building C object source/blender/editors/mesh/CMakeFiles/bf_editor_mesh.dir/mesh_data.c.o
In file included from /home/brecht/dev/worktree/source/blender/makesdna/DNA_mesh_types.h:28,
                 from /home/brecht/dev/worktree/source/blender/editors/mesh/mesh_data.c:26:
/home/brecht/dev/worktree/source/blender/editors/mesh/mesh_data.c: In function ‘ED_mesh_sculpt_color_add’:
/home/brecht/dev/worktree/source/blender/makesdna/DNA_customdata_types.h:207:28: warning: overflow in conversion from ‘long long int’ to ‘int’ changes value from ‘140737488355328’ to ‘0’ [-Woverflow]
  207 | #define CD_MASK_PROP_COLOR (1LL << CD_PROP_COLOR)
      |                            ^~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/mesh/mesh_data.c:509:60: note: in expansion of macro ‘CD_MASK_PROP_COLOR’
  509 |     layernum = CustomData_number_of_layers(&em->bm->vdata, CD_MASK_PROP_COLOR);
      |                                                            ^~~~~~~~~~~~~~~~~~

This should be CD_PROP_COLOR.

[243/1608] Building C object source/blender/editors/sculpt_paint/CMakeFiles/bf_editor_sculpt_paint.dir/sculpt_filter_color.c.o
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c: In function ‘color_filter_task_cb’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c:163:18: warning: declaration of ‘i’ shadows a parameter [-Wshadow]
  163 |         for (int i = 0; i < 3; i++) {
      |                  ^
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c:97:44: note: shadowed declaration is here
   97 |                                  const int i,
      |                                  ~~~~~~~~~~^
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c:182:18: warning: declaration of ‘i’ shadows a parameter [-Wshadow]
  182 |         for (int i = 0; i < 3; i++) {
      |                  ^
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c:97:44: note: shadowed declaration is here
   97 |                                  const int i,
      |                                  ~~~~~~~~~~^
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_filter_color.c:112:56: warning: unused variable ‘rgb_color’ [-Wunused-variable]
  112 |     float orig_color[3], final_color[3], hsv_color[3], rgb_color[3];
      |                                                        ^~~~~~~~~
[280/1608] Building C object source/blender/editors/sculpt_paint/CMakeFiles/bf_editor_sculpt_paint.dir/sculpt.c.o
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: In function ‘vertex_to_loop_colors_exec’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:7970:8: warning: variable ‘linked_data’ set but not used [-Wunused-but-set-variable]
 7970 |   bool linked_data = false;
      |        ^~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:7968:64: warning: unused parameter ‘op’ [-Wunused-parameter]
 7968 | static int vertex_to_loop_colors_exec(bContext *C, wmOperator *op)
      |                                                    ~~~~~~~~~~~~^~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: At top level:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8020:6: warning: no previous prototype for ‘SCULPT_OT_vertex_to_loop_colors’ [-Wmissing-prototypes]
 8020 | void SCULPT_OT_vertex_to_loop_colors(wmOperatorType *ot)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: In function ‘loop_to_vertex_colors_exec’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8036:8: warning: variable ‘linked_data’ set but not used [-Wunused-but-set-variable]
 8036 |   bool linked_data = false;
      |        ^~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8034:64: warning: unused parameter ‘op’ [-Wunused-parameter]
 8034 | static int loop_to_vertex_colors_exec(bContext *C, wmOperator *op)
      |                                                    ~~~~~~~~~~~~^~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: At top level:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8086:6: warning: no previous prototype for ‘SCULPT_OT_loop_to_vertex_colors’ [-Wmissing-prototypes]
 8086 | void SCULPT_OT_loop_to_vertex_colors(wmOperatorType *ot)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[281/1608] Building C object source/blender/editors/sculpt_paint/CMakeFiles/bf_editor_sculpt_paint.dir/sculpt_undo.c.o
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_undo.c: In function ‘sculpt_undo_bmesh_push’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_undo.c:1219:5: warning: enumeration value ‘SCULPT_UNDO_COLOR’ not handled in switch [-Wswitch]
 1219 |     switch (type) {
      |     ^~~~~~
[646/1608] Building C object source/blender/draw/CMakeFiles/bf_draw.dir/intern/draw_cache_impl_mesh.c.o
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c: In function ‘mesh_cd_calc_used_gpu_layers’:
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c:265:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
  265 |             if (layer != -1) {
      |                ^
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c:269:11: note: here
  269 |           case CD_MCOL: {
      |           ^~~~
[792/1608] Building C object source/blender/gpu/CMakeFiles/bf_gpu.dir/intern/gpu_buffers.c.o
/home/brecht/dev/worktree/source/blender/gpu/intern/gpu_buffers.c: In function ‘GPU_pbvh_mesh_buffers_update’:
/home/brecht/dev/worktree/source/blender/gpu/intern/gpu_buffers.c:232:47: warning: unused parameter ‘face_vert_indices’ [-Wunused-parameter]
  232 |                                   const int (*face_vert_indices)[3],
      |                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[1553/1608] Building C object source/blender/makesrna/intern/CMakeFiles/bf_rna.dir/rna_mesh_gen.c.o
In file included from /home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:82,
                 from source/blender/makesrna/intern/rna_mesh_gen.c:33:
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:117:15: warning: ‘rna_Mesh_sculpt_vertex_color_render_index_set’ defined but not used [-Wunused-function]
  117 |   static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
      |               ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:106:14: warning: ‘rna_Mesh_sculpt_vertex_color_render_index_get’ defined but not used [-Wunused-function]
  106 |   static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \
      |              ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:86:15: warning: ‘rna_Mesh_sculpt_vertex_color_render_set’ defined but not used [-Wunused-function]
   86 |   static void rna_Mesh_##collection_name##_##active_type##_set( \
      |               ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:72:21: warning: ‘rna_Mesh_sculpt_vertex_color_render_get’ defined but not used [-Wunused-function]
   72 |   static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \
      |                     ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This revision now requires changes to proceed.Mon, Jun 22, 5:31 PM
  • Review Update
  • Fix crash when rendering colors in edit mode
  • Fix colors visibility with modifiers

Most of the warnings remain:

/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_undo.c: In function ‘sculpt_undo_bmesh_push’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt_undo.c:1219:5: warning: enumeration value ‘SCULPT_UNDO_COLOR’ not handled in switch [-Wswitch]
 1219 |     switch (type) {
      |     ^~~~~~
[540/1609] Building C object source/blender/editors/sculpt_paint/CMakeFiles/bf_editor_sculpt_paint.dir/sculpt.c.o
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: In function ‘vertex_to_loop_colors_exec’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:7970:8: warning: variable ‘linked_data’ set but not used [-Wunused-but-set-variable]
 7970 |   bool linked_data = false;
      |        ^~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:7968:64: warning: unused parameter ‘op’ [-Wunused-parameter]
 7968 | static int vertex_to_loop_colors_exec(bContext *C, wmOperator *op)
      |                                                    ~~~~~~~~~~~~^~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: At top level:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8020:6: warning: no previous prototype for ‘SCULPT_OT_vertex_to_loop_colors’ [-Wmissing-prototypes]
 8020 | void SCULPT_OT_vertex_to_loop_colors(wmOperatorType *ot)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: In function ‘loop_to_vertex_colors_exec’:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8036:8: warning: variable ‘linked_data’ set but not used [-Wunused-but-set-variable]
 8036 |   bool linked_data = false;
      |        ^~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8034:64: warning: unused parameter ‘op’ [-Wunused-parameter]
 8034 | static int loop_to_vertex_colors_exec(bContext *C, wmOperator *op)
      |                                                    ~~~~~~~~~~~~^~
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c: At top level:
/home/brecht/dev/worktree/source/blender/editors/sculpt_paint/sculpt.c:8086:6: warning: no previous prototype for ‘SCULPT_OT_loop_to_vertex_colors’ [-Wmissing-prototypes]
 8086 | void SCULPT_OT_loop_to_vertex_colors(wmOperatorType *ot)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[680/1609] Building C object source/blender/draw/CMakeFiles/bf_draw.dir/intern/draw_cache_impl_mesh.c.o
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c: In function ‘mesh_cd_calc_used_gpu_layers’:
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c:265:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
  265 |             if (layer != -1) {
      |                ^
/home/brecht/dev/worktree/source/blender/draw/intern/draw_cache_impl_mesh.c:269:11: note: here
  269 |           case CD_MCOL: {
      |           ^~~~
[772/1609] Building C object source/blender/gpu/CMakeFiles/bf_gpu.dir/intern/gpu_buffers.c.o
/home/brecht/dev/worktree/source/blender/gpu/intern/gpu_buffers.c: In function ‘GPU_pbvh_mesh_buffers_update’:
/home/brecht/dev/worktree/source/blender/gpu/intern/gpu_buffers.c:232:47: warning: unused parameter ‘face_vert_indices’ [-Wunused-parameter]
  232 |                                   const int (*face_vert_indices)[3],
      |                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[1561/1609] Building C object source/blender/makesrna/intern/CMakeFiles/bf_rna.dir/rna_mesh_gen.c.o
In file included from /home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:82,
                 from source/blender/makesrna/intern/rna_mesh_gen.c:33:
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:117:15: warning: ‘rna_Mesh_sculpt_vertex_color_render_index_set’ defined but not used [-Wunused-function]
  117 |   static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
      |               ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:106:14: warning: ‘rna_Mesh_sculpt_vertex_color_render_index_get’ defined but not used [-Wunused-function]
  106 |   static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \
      |              ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:86:15: warning: ‘rna_Mesh_sculpt_vertex_color_render_set’ defined but not used [-Wunused-function]
   86 |   static void rna_Mesh_##collection_name##_##active_type##_set( \
      |               ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh_utils.h:72:21: warning: ‘rna_Mesh_sculpt_vertex_color_render_get’ defined but not used [-Wunused-function]
   72 |   static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \
      |                     ^~~~~~~~~
/home/brecht/dev/worktree/source/blender/makesrna/intern/rna_mesh.c:766:1: note: in expansion of macro ‘DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM’
  766 | DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Fix warnings
  • Fix RNA warnings
This revision is now accepted and ready to land.Tue, Jun 23, 11:48 AM