diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-11 00:35:41 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-11 00:35:41 +0400 |
commit | 919b363d133a04b114970fb06282ced6bcbab186 (patch) | |
tree | 190cbe3a76ccab8d7303b72264c6df46ae495716 | |
parent | c8465eb42c5f853c5706a06229537c31f9dea391 (diff) |
Update the keymap for the mask brush.
* Add MKEY as a toggle for the mask brush. We could use ALT similar to
SHIFT toggling the smooth brush, but it would conflict with MMB
emulation (not to mention many window managers.)
* When the mask brush is active, SHIFT toggles it into smooth mode.
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 35 |
2 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 73c6d55d521..f4dd9392ec4 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -653,6 +653,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT); keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0); keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT); + kmi= keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0); + RNA_boolean_set(kmi->ptr, "toggle", 1); + RNA_boolean_set(kmi->ptr, "create_missing", 1); /* */ kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", AKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 27b1b3f2325..b43217a9b8f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -258,6 +258,7 @@ typedef struct StrokeCache { float vertex_rotation; char saved_active_brush_name[MAX_ID_NAME]; + char saved_mask_brush_tool; int alt_smooth; float plane_trim_squared; @@ -3112,15 +3113,22 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio /* Alt-Smooth */ if (ss->cache->alt_smooth) { - Paint *p = &sd->paint; - Brush *br; + if (brush->sculpt_tool == SCULPT_TOOL_MASK) { + cache->saved_mask_brush_tool = brush->mask_tool; + brush->mask_tool = BRUSH_MASK_SMOOTH; + } + else { + Paint *p = &sd->paint; + Brush *br; - BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name)); + BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, + sizeof(cache->saved_active_brush_name)); - br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth"); - if (br) { - paint_brush_set(p, br); - brush = br; + br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth"); + if (br) { + paint_brush_set(p, br); + brush = br; + } } } @@ -3683,10 +3691,15 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str /* Alt-Smooth */ if (ss->cache->alt_smooth) { - Paint *p = &sd->paint; - brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name); - if (brush) { - paint_brush_set(p, brush); + if (brush->sculpt_tool == SCULPT_TOOL_MASK) { + brush->mask_tool = ss->cache->saved_mask_brush_tool; + } + else { + Paint *p = &sd->paint; + brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name); + if (brush) { + paint_brush_set(p, brush); + } } } |