forked from bartvdbraak/blender
Changes to Stencil control:
* Add a poll function that only activates the operator when a stencil brush is active * Change shortcuts to RMouse - translate, Shift - RMouse Scale, Ctrl - RMouse, rotate. MUCH faster and simpler workflow. * Change shortcut of colour sampling to S. Sampling is important but not as important as warranting the Right Mouse button. * Add a notifier so that toolbar gets updated texture rotation when rotating the stencil Also, * Slight rearrangement of options so that jittering is more accessible (easily more often used than smooth stroke)
This commit is contained in:
parent
c33d5c7133
commit
8d036a21d7
@ -837,17 +837,6 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
row.prop(brush, "use_pressure_spacing", toggle=True, text="")
|
||||
|
||||
if context.sculpt_object:
|
||||
if brush.sculpt_capabilities.has_smooth_stroke:
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
|
||||
col.prop(brush, "use_smooth_stroke")
|
||||
|
||||
sub = col.column()
|
||||
sub.active = brush.use_smooth_stroke
|
||||
sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
|
||||
sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
|
||||
|
||||
if brush.sculpt_capabilities.has_jitter:
|
||||
col.separator()
|
||||
|
||||
@ -859,7 +848,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
|
||||
row.prop(brush, "jitter_absolute")
|
||||
row.prop(brush, "use_pressure_jitter", toggle=True, text="")
|
||||
else:
|
||||
if brush.sculpt_capabilities.has_smooth_stroke:
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
|
||||
@ -869,7 +858,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
sub.active = brush.use_smooth_stroke
|
||||
sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
|
||||
sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
|
||||
|
||||
else:
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
@ -881,6 +870,15 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
row.prop(brush, "jitter_absolute")
|
||||
row.prop(brush, "use_pressure_jitter", toggle=True, text="")
|
||||
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
|
||||
col.prop(brush, "use_smooth_stroke")
|
||||
|
||||
sub = col.column()
|
||||
sub.active = brush.use_smooth_stroke
|
||||
sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
|
||||
sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
|
||||
|
||||
class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
|
||||
bl_label = "Curve"
|
||||
|
@ -877,8 +877,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
|
||||
static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
switch (event->type) {
|
||||
case LEFTMOUSE:
|
||||
case RIGHTMOUSE: // XXX hardcoded
|
||||
case SKEY: // XXX hardcoded
|
||||
return OPERATOR_FINISHED;
|
||||
case MOUSEMOVE:
|
||||
RNA_int_set_array(op->ptr, "location", event->mval);
|
||||
|
@ -542,14 +542,18 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LEFTMOUSE:
|
||||
if (event->val == KM_PRESS) {
|
||||
/* XXX hardcoded! */
|
||||
case RIGHTMOUSE:
|
||||
if (event->val == KM_RELEASE) {
|
||||
MEM_freeN(op->customdata);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
case RIGHTMOUSE:
|
||||
case ESCKEY:
|
||||
if (event->val == KM_PRESS) {
|
||||
return stencil_control_cancel(C, op);
|
||||
stencil_control_cancel(C, op);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@ -560,6 +564,14 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
static int stencil_control_poll(bContext *C)
|
||||
{
|
||||
Paint *paint = paint_get_active_from_context(C);
|
||||
Brush *br = paint->brush;
|
||||
|
||||
return br->mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL;
|
||||
}
|
||||
|
||||
static void BRUSH_OT_stencil_control(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem stencil_control_items[] = {
|
||||
@ -577,6 +589,7 @@ static void BRUSH_OT_stencil_control(wmOperatorType *ot)
|
||||
ot->invoke = stencil_control_invoke;
|
||||
ot->modal = stencil_control_modal;
|
||||
ot->cancel = stencil_control_cancel;
|
||||
ot->poll = stencil_control_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = 0;
|
||||
@ -588,11 +601,11 @@ static void ed_keymap_stencil(wmKeyMap *keymap)
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", QKEY, KM_PRESS, 0, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", RIGHTMOUSE, KM_PRESS, 0, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", STENCIL_TRANSLATE);
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", QKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", RIGHTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", STENCIL_SCALE);
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", QKEY, KM_PRESS, KM_CTRL, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "BRUSH_OT_stencil_control", RIGHTMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", STENCIL_ROTATE);
|
||||
|
||||
}
|
||||
@ -852,7 +865,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
|
||||
keymap->poll = vertex_paint_mode_poll;
|
||||
|
||||
WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap,
|
||||
"PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
@ -932,7 +945,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
|
||||
WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SKEY, KM_PRESS, 0, 0);
|
||||
|
||||
ed_keymap_paint_brush_switch(keymap, "image_paint");
|
||||
ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
|
||||
|
Loading…
Reference in New Issue
Block a user