[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46530] trunk/blender: Add keymap and menu entries for masking.

Nicholas Bishop nicholasbishop at gmail.com
Thu May 10 22:36:13 CEST 2012


Revision: 46530
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46530
Author:   nicholasbishop
Date:     2012-05-10 20:36:13 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Add keymap and menu entries for masking.

* Add CTRL+IKEY to invert the mask.

* Add ALT+MKEY to clear the mask.

* Change the 'Hide' menu in sculpt mode to 'Hide/Mask', adds entires
  for clearing, filling, and inverting the mask, as well as hiding
  masked regions.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2012-05-10 20:36:01 UTC (rev 46529)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2012-05-10 20:36:13 UTC (rev 46530)
@@ -55,7 +55,7 @@
                 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
                     sub.menu("VIEW3D_MT_brush")
                 if mode_string == 'SCULPT':
-                    sub.menu("VIEW3D_MT_hide")
+                    sub.menu("VIEW3D_MT_hide_mask")
             else:
                 sub.menu("VIEW3D_MT_object")
 
@@ -1269,8 +1269,8 @@
         layout.prop(sculpt, "use_deform_only")
 
 
-class VIEW3D_MT_hide(Menu):
-    bl_label = "Hide"
+class VIEW3D_MT_hide_mask(Menu):
+    bl_label = "Hide/Mask"
 
     def draw(self, context):
         layout = self.layout
@@ -1286,8 +1286,25 @@
         op = layout.operator("paint.hide_show", text="Show Bounding Box")
         op.action = 'SHOW'
         op.area = 'INSIDE'
+    
+        op = layout.operator("paint.hide_show", text="Hide Masked")
+        op.area = 'MASKED'
+        op.action = 'HIDE'
 
+        layout.separator()
 
+        op = layout.operator("paint.mask_flood_fill", text="Invert Mask")
+        op.mode = 'INVERT'
+
+        op = layout.operator("paint.mask_flood_fill", text="Fill Mask")
+        op.mode = 'VALUE'
+        op.value = 1
+
+        op = layout.operator("paint.mask_flood_fill", text="Clear Mask")
+        op.mode = 'VALUE'
+        op.value = 0
+
+
 # ********** Particle menu **********
 
 

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:36:01 UTC (rev 46529)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-05-10 20:36:13 UTC (rev 46530)
@@ -634,6 +634,15 @@
 	for (i = 0; i <= 5; i++)
 		RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
 
+	/* Clear mask */
+	kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0);
+	RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_FLOOD_VALUE);
+	RNA_float_set(kmi->ptr, "value", 0);
+
+	/* Invert mask */
+	kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_INVERT);
+
 	/* multires switch */
 	kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
 	RNA_int_set(kmi->ptr, "level", 1);




More information about the Bf-blender-cvs mailing list