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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-01-19 18:57:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-01-20 23:11:56 +0300
commitb88b73816a7b9070ae614f37a5538f7b7a9cddec (patch)
treed89c2995dfc14bf3ed065810434af01453174243 /source/blender/blenkernel/intern/DerivedMesh.c
parent754096e670a87a18cdcbdfeea7abd27bee4592a1 (diff)
Weight Paint: 'Sample' now supports multi-paint
Since the coloring uses sum or average of the weights of all selected groups, the weight pick tool should also use that instead of reading the weight of the single active group that you can't see.
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.c')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 1577a818180..dc7ef3055ee 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1373,30 +1373,13 @@ static void calc_weightpaint_vert_color(
if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
/* Multi-Paint feature */
- bool was_a_nonzero = false;
- unsigned int i;
-
- const MDeformWeight *dw = dv->dw;
- for (i = dv->totweight; i != 0; i--, dw++) {
- /* in multipaint, get the average if auto normalize is inactive
- * get the sum if it is active */
- if (dw->def_nr < defbase_tot) {
- if (defbase_sel[dw->def_nr]) {
- if (dw->weight) {
- input += dw->weight;
- was_a_nonzero = true;
- }
- }
- }
- }
+ input = BKE_defvert_multipaint_collective_weight(
+ dv, defbase_tot, defbase_sel, defbase_sel_tot, (draw_flag & CALC_WP_AUTO_NORMALIZE) != 0);
/* make it black if the selected groups have no weight on a vertex */
- if (was_a_nonzero == false) {
+ if (input == 0.0f) {
show_alert_color = true;
}
- else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == false) {
- input /= defbase_sel_tot; /* get the average */
- }
}
else {
/* default, non tricky behavior */