GSoC 2017 Vertex Paint
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on Sep 28 2017, 9:13 AM.

Details

Summary

This diff is T52910 / soc-2017-vertex_paint branch, rebased on master.

Removed Python IO (handled in D2855), otherwise this is close to the original.

Diff Detail

Repository
rB Blender
Branch
soc-2017-vertex_paint-patch
Build Status
Buildable 862
Build 862: arc lint + arc unit

Only a real quick skim over code, nothing checked in depth for now, so mostly picky styling comments. Did not see anything bad in code though.

A bit unrelated to that patch, but would be nice if we could make all the color mixing code in paint_vertex use BLI_math_color_blend (adding the lock option (preferably as flags xD ) to BLI_math_color could make sense too I think?). Really better to deduplicate that kind of code as much as possible. Currently they look quite similar code, yet not exactly the same. :/

release/scripts/startup/bl_ui/space_view3d.py
173

Rather this I’d say? ;)

elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
release/scripts/startup/bl_ui/space_view3d_toolbar.py
1172–1178

Styling (spaces)

source/blender/blenkernel/intern/CCGSubSurf.c
1199 ↗(On Diff #9324)

grrr, white line :P

source/blender/editors/sculpt_paint/paint_vertex.c
1032

luminocity -> typo? or intended?

source/blender/editors/sculpt_paint/sculpt_intern.h
307–315 ↗(On Diff #9324)

Hrmmm… Am wondering why use a struct for that??? To me looks like a set of (short even) flags would have been more than enough? I think we rather use bitflags than bools in Blender code in such cases usually…

Also, space on last line

source/blender/makesrna/intern/rna_mesh.c
589

Would have always kept alpha as last line here and below, mixing it top and bottom adds to the confusion imho (we already have to inverse RGB order due to stupid historical reasons… ;) ).

Overall seems OK.

One thing I rather see redone is color locking.
It complicates color blending and limits the kinds of locking possible (why not lock H/S/V channels?).
We already have the previous color - so the lock can be applied as a step afterwards with mush less hassles.

source/blender/editors/sculpt_paint/paint_vertex.c
3974

This happens to work because SELECT is 1. but isn't correct. - Other places too.

source/blender/render/extern/include/RE_shader_ext.h
145 ↗(On Diff #9324)

Assume this is a mistake.

  • Add use_occlude_geometry in vertex paint mode
source/blender/editors/sculpt_paint/paint_vertex.c
2808–2820

Note that this is using a cylinder falloff which will not pick up all BVH nodes in the line of sight since it's using nodes in a sphere from the brush center.

  • Cleanup: negate flag avoid do-versions

Remove alpha option, use option from project paint instead

Use blending mode to adjust alpha
note - we probably want a set-alpha mode which should
be added for image and vertex modes.

Remove occlude (it's too buggy)

  • Only alloc previous-accum when needed

Committed rB288b2d0aa6bc8097f92e85f8d16fd2125d6eb2e9 rB823bcf1689a3dbd44dd77b2c8ea46b9b54073c46 rB9cba119051e7ce3365939943a5c1e47f3c2a5e69

Left out occlusion - this was using screenspace projection which wont work with symmetry.
It was also integrated in an over complicated way that broke regular painting. This should be implemented with an equivalent to sculpt_brush_test_sq that measures the distance to the sculpt ray.
Stepping over BVH nodes needs to use a cylinder instead of a sphere radius.