[Bf-blender-cvs] [b7532023812] soc-2017-vertex_paint: added accumulate option
Darshan Kadu
noreply at git.blender.org
Sun Jun 11 15:03:48 CEST 2017
Commit: b7532023812b9f3855f74a9da6f3b8986605f3a3
Author: Darshan Kadu
Date: Sun Jun 11 18:32:04 2017 +0530
Branches: soc-2017-vertex_paint
https://developer.blender.org/rBb7532023812b9f3855f74a9da6f3b8986605f3a3
added accumulate option
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/BKE_paint.h
M source/blender/editors/sculpt_paint/paint_vertex.c
A vpaint.txt
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 06249c807b7..fa7ab428b08 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1166,6 +1166,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.separator()
col.prop(brush, "vertex_tool", text="Blend")
+ col.prop(brush,"use_accumulate")
col.separator()
col.template_ID(settings, "palette", new="palette.new")
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 9f472d3b9d1..1cc5ba3a928 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -214,6 +214,7 @@ typedef struct SculptSession {
unsigned int *tot_loops_hit;
float *max_weight;
unsigned int *previous_color;
+ float *previous_accum;
bool building_vp_handle;
} vwpaint;
//struct {
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 261cd1aeb7d..53d67dd1c0c 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2049,6 +2049,8 @@ static void vertex_paint_init_session_average_arrays(Object *ob)
MEM_callocN(me->totvert * sizeof(float), "max_weight");
ob->sculpt->modes.vwpaint.previous_color =
MEM_callocN(me->totloop * sizeof(unsigned int), "previous_color");
+ ob->sculpt->modes.vwpaint.previous_accum =
+ MEM_callocN(me->totloop * sizeof(float), "previous_accum");
}
}
@@ -3536,6 +3538,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
for (int i = 0; i < me->totloop; i++) {
ob->sculpt->modes.vwpaint.previous_color[i] = 0;
+ ob->sculpt->modes.vwpaint.previous_accum[i] = 0.0f;
}
return 1;
@@ -3667,9 +3670,18 @@ static void do_vpaint_brush_draw_task_cb_ex(
if (ss->modes.vwpaint.previous_color[l_index] == 0) {
ss->modes.vwpaint.previous_color[l_index] = lcol[l_index];
}
- const float final_alpha =
+ float final_alpha =
255 * brush_fade * brush_strength * view_dot *
tex_alpha * brush_alpha_pressure * grid_alpha;
+ float mask_accum;
+ mask_accum = ss->modes.vwpaint.previous_accum[l_index];
+
+ if (brush->flag&BRUSH_ACCUMULATE) {
+ final_alpha = final_alpha + mask_accum;
+ }
+
+ final_alpha = min_ff(final_alpha, 255.0f);
+ ss->modes.vwpaint.previous_accum[l_index] = final_alpha;
/* Mix the new color with the original based on final_alpha. */
lcol[l_index] = vpaint_blend(
data->vp, lcol[l_index],
diff --git a/vpaint.txt b/vpaint.txt
new file mode 100644
index 00000000000..4e1aab5b0d4
--- /dev/null
+++ b/vpaint.txt
@@ -0,0 +1,50 @@
+diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
+index 9f472d3b9d1..1cc5ba3a928 100644
+--- a/source/blender/blenkernel/BKE_paint.h
++++ b/source/blender/blenkernel/BKE_paint.h
+@@ -214,6 +214,7 @@ typedef struct SculptSession {
+ unsigned int *tot_loops_hit;
+ float *max_weight;
+ unsigned int *previous_color;
++ float *previous_accum;
+ bool building_vp_handle;
+ } vwpaint;
+ //struct {
+diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
+index 261cd1aeb7d..fb2838a37ba 100644
+--- a/source/blender/editors/sculpt_paint/paint_vertex.c
++++ b/source/blender/editors/sculpt_paint/paint_vertex.c
+@@ -2049,6 +2049,8 @@ static void vertex_paint_init_session_average_arrays(Object *ob)
+ MEM_callocN(me->totvert * sizeof(float), "max_weight");
+ ob->sculpt->modes.vwpaint.previous_color =
+ MEM_callocN(me->totloop * sizeof(unsigned int), "previous_color");
++ ob->sculpt->modes.vwpaint.previous_accum =
++ MEM_callocN(me->totloop * sizeof(float), "previous_accum");
+ }
+ }
+
+@@ -3536,6 +3538,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
+
+ for (int i = 0; i < me->totloop; i++) {
+ ob->sculpt->modes.vwpaint.previous_color[i] = 0;
++ ob->sculpt->modes.vwpaint.previous_accum[i] = 0.0f;
+ }
+
+ return 1;
+@@ -3667,9 +3670,15 @@ static void do_vpaint_brush_draw_task_cb_ex(
+ if (ss->modes.vwpaint.previous_color[l_index] == 0) {
+ ss->modes.vwpaint.previous_color[l_index] = lcol[l_index];
+ }
+- const float final_alpha =
++ float final_alpha =
+ 255 * brush_fade * brush_strength * view_dot *
+ tex_alpha * brush_alpha_pressure * grid_alpha;
++ float mask_accum;
++ //mask_accum = ss->modes.vwpaint.previous_accum[l_index];
++
++ // final_alpha = final_alpha + mask_accum;
++ // final_alpha = min_ff(final_alpha, 255.0f);
++ // ss->modes.vwpaint.previous_accum[l_index] = final_alpha;
+ /* Mix the new color with the original based on final_alpha. */
+ lcol[l_index] = vpaint_blend(
+ data->vp, lcol[l_index],
More information about the Bf-blender-cvs
mailing list