diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 38 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 31 |
3 files changed, 41 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index aa90b093c26..ff368a682e9 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -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,17 +848,17 @@ 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: - col = layout.column() - col.separator() - - col.prop(brush, "use_smooth_stroke") + if brush.sculpt_capabilities.has_smooth_stroke: + col = layout.column() + col.separator() - 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) + 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) + 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" 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"); |