Fix T47818: GPencil Sculpt Brush settings update when adjusted using scrollwheel while sculpting

This commit is contained in:
Joshua Leung 2016-03-17 01:12:30 +13:00 committed by Sergey Sharybin
parent 4e53ca9ed2
commit 6f49d970e0
1 changed files with 14 additions and 4 deletions

View File

@ -1537,6 +1537,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
tGP_BrushEditData *gso = op->customdata;
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
bool redraw_region = false;
bool redraw_toolsettings = false;
/* The operator can be in 2 states: Painting and Idling */
if (gso->is_painting) {
@ -1575,8 +1576,9 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
gso->brush->size += 3;
CLAMP_MAX(gso->brush->size, 300);
}
redraw_region = true;
redraw_toolsettings = true;
break;
case WHEELDOWNMOUSE:
@ -1591,8 +1593,9 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
gso->brush->size -= 3;
CLAMP_MIN(gso->brush->size, 1);
}
redraw_region = true;
redraw_toolsettings = true;
break;
/* Painting mbut release = Stop painting (back to idle) */
@ -1664,8 +1667,9 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
gso->brush->size += 3;
CLAMP_MAX(gso->brush->size, 300);
}
redraw_region = true;
redraw_toolsettings = true;
break;
case WHEELDOWNMOUSE:
@ -1680,8 +1684,9 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
gso->brush->size -= 3;
CLAMP_MIN(gso->brush->size, 1);
}
redraw_region = true;
redraw_toolsettings = true;
break;
/* Change Frame - Allowed */
@ -1703,6 +1708,11 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
ED_region_tag_redraw(ar);
}
/* Redraw toolsettings (brush settings)? */
if (redraw_toolsettings) {
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
return OPERATOR_RUNNING_MODAL;
}