[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46527] trunk/blender/source/blender/ editors/sculpt_paint: Update the keymap for the mask brush.

Nicholas Bishop nicholasbishop at gmail.com
Thu May 10 22:35:41 CEST 2012


Revision: 46527
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46527
Author:   nicholasbishop
Date:     2012-05-10 20:35:41 +0000 (Thu, 10 May 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-05-10 20:35:32 UTC (rev 46526)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-05-10 20:35:41 UTC (rev 46527)
@@ -653,6 +653,9 @@
 	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);

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-05-10 20:35:32 UTC (rev 46526)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-05-10 20:35:41 UTC (rev 46527)
@@ -258,6 +258,7 @@
 	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 @@
 
 	/* 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,11 +3691,16 @@
 
 		/* 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);
+				}
+			}
 		}
 
 		/* update last stroke position */




More information about the Bf-blender-cvs mailing list