Page MenuHome

Implement correct drawing of advanced Weight display features.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Sep 23 2018, 7:49 PM.

Details

Summary

This adds existing behavior from calc_weightpaint_vert_array
that was missing from the new rendering code:

  • No selected Vertex Group displays as a solid pink color.
  • Zero weight displays as alert color depending on Options.
  • Multipaint mode correctly displays collective weight.

In order to properly implement this variety, a data structure
holding all relevant parameters is introduced.

Diff Detail

Repository
rB Blender
Branch
temp-angavrilov-multipaint-draw (branched from blender2.8)
Build Status
Buildable 2101
Build 2101: arc lint + arc unit

Event Timeline

Since nothing seems to be happening to D3675, I decided to implement this using the current state of the branch. It should make it more clear how the alert color should work in any case.

This is a convenient test to check multipaint drawing (try selecting multiple bones at the same time):

Is this calling memcmp on entire selection on every redraw? That seems like it should be avoided.

Some other minor picky things, but they can be handled fairly easily.

source/blender/draw/intern/draw_cache_impl.h
116–118

Would call DRW_mesh_vweight_* since lattice has vweight's too.

source/blender/draw/intern/draw_cache_impl_mesh.c
1629

This seems quite an expensive function to run on every access (called indirectly via DRW_cache_mesh_surface_weights_get).

That structure represents the vertex group selection state, so if lattices support weight painting with Multipaint, they should use it too.

Regarding memcmp, it is unavoidable unless you want to replace it with a checksum comparison or something. On the other hand, there is just one bool per existing vertex group, not something like one byte per vertex; and the array is only used with Multipaint, and is NULL otherwise.

Edit: Also, if memcmp is expensive, then what do you call BKE_object_defgroup_selected_get and BKE_object_defgroup_mirror_selection? They search bones and vertex groups by name.

LGTM.

I'm not worry about the performance of the memcmp because it's a hanfull of bytes and usually only for one mesh.

source/blender/draw/intern/draw_cache_impl_mesh.c
1832

"__" in function name ? Not sure if that follows our codestyle.

Try to address concerns from D3723 since it conflicts with changes of this patch.

Alexander Gavrilov (angavrilov) marked an inline comment as done.Sep 24 2018, 9:17 PM
Alexander Gavrilov (angavrilov) added inline comments.
source/blender/draw/intern/draw_cache_impl_mesh.c
1832

I'm not sure if this is correct, but to address the general concerns of D3723, I changed it to discard just the weight batch when the selection is different. If this approach is valid, I wonder if the actual weight painting could do this too (or maybe it already does?).

This revision is now accepted and ready to land.Sep 25 2018, 4:39 PM
This revision was automatically updated to reflect the committed changes.
Alexander Gavrilov (angavrilov) marked an inline comment as done.