diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-27 23:00:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-27 23:00:26 +0400 |
commit | 7c27cfc0208f319438b33570ad53fcf9618315cf (patch) | |
tree | 726df742719a1aaf0126d447372ab531bc7d1669 /source/blender/editors/sculpt_paint/paint_ops.c | |
parent | f5e022a0a0528e8d674afbbe000762a7b817e516 (diff) |
add vertex color smooth operator.
Since the bug was fixed that made blur brush _not_ blur all verts, there is no way to blur vertex colors after baking.
While this was hidden it was useful especially for baking vertex colors.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index ce403b56c77..85d70c9342f 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -154,10 +154,14 @@ static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); unsigned int paintcol = vpaint_get_current_col(scene->toolsettings->vpaint); - vpaint_fill(obact, paintcol); - - ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views - return OPERATOR_FINISHED; + + if (ED_vpaint_fill(obact, paintcol)) { + ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } static void PAINT_OT_vertex_color_set(wmOperatorType *ot) @@ -175,6 +179,33 @@ static void PAINT_OT_vertex_color_set(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int vertex_color_smooth_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obact = CTX_data_active_object(C); + if (ED_vpaint_smooth(obact)) { + ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } +} + +static void PAINT_OT_vertex_color_smooth(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Smooth Vertex Colors"; + ot->idname = "PAINT_OT_vertex_color_smooth"; + ot->description = "Smooth colors across vertices"; + + /* api callbacks */ + ot->exec = vertex_color_smooth_exec; + ot->poll = vertex_paint_mode_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Paint *paint = BKE_paint_get_active_from_context(C); @@ -858,6 +889,7 @@ void ED_operatortypes_paint(void) WM_operatortype_append(PAINT_OT_vertex_paint_toggle); WM_operatortype_append(PAINT_OT_vertex_paint); WM_operatortype_append(PAINT_OT_vertex_color_set); + WM_operatortype_append(PAINT_OT_vertex_color_smooth); /* face-select */ WM_operatortype_append(PAINT_OT_face_select_linked); |