diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2013-03-31 20:17:18 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2013-03-31 20:17:18 +0400 |
commit | 8d036a21d7dca6691c0846df2162f50015407ed0 (patch) | |
tree | e54a546d7adc5f3dafec60f738e41bfd42886cdc /source/blender/editors | |
parent | c33d5c7133f5d5383e8687c3c5be8858601f1280 (diff) |
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)
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 31 |
2 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 47fab8f3b06..a47f364ac67 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index a63d147e459..cd9523f8ff6 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -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"); |