[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54883] trunk/blender: Add missing select menu for weight, vertex, texture paint modes.

Campbell Barton ideasman42 at gmail.com
Tue Feb 26 16:42:33 CET 2013


Revision: 54883
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54883
Author:   campbellbarton
Date:     2013-02-26 15:42:33 +0000 (Tue, 26 Feb 2013)
Log Message:
-----------
Add missing select menu for weight, vertex, texture paint modes.

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

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2013-02-26 14:32:53 UTC (rev 54882)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2013-02-26 15:42:33 UTC (rev 54883)
@@ -44,7 +44,13 @@
             sub.menu("VIEW3D_MT_view")
 
             # Select Menu
-            if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
+            if mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
+                mesh = obj.data
+                if mesh.use_paint_mask:
+                    sub.menu("VIEW3D_MT_select_paint_mask")
+                elif mesh.use_paint_mask_vertex and mode_string == 'PAINT_WEIGHT':
+                    sub.menu("VIEW3D_MT_select_paint_mask_vertex")
+            elif mode_string not in {'EDIT_TEXT', 'SCULPT'}:
                 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
 
             if edit_object:
@@ -673,6 +679,7 @@
         layout = self.layout
 
         layout.operator("view3d.select_border")
+        layout.operator("view3d.select_circle")
 
         layout.separator()
 
@@ -730,16 +737,40 @@
         layout.operator("object.select_pattern", text="Select Pattern...")
 
 
-class VIEW3D_MT_select_face(Menu):  # XXX no matching enum
+class VIEW3D_MT_select_paint_mask(Menu):
     bl_label = "Select"
 
     def draw(self, context):
-        # layout = self.layout
+        layout = self.layout
 
-        # TODO
-        # see view3d_select_faceselmenu
-        pass
+        layout.operator("view3d.select_border")
+        layout.operator("view3d.select_circle")
 
+        layout.separator()
+
+        layout.operator("paint.face_select_all").action = 'TOGGLE'
+        layout.operator("paint.face_select_all", text="Inverse").action = 'INVERT'
+
+        layout.separator()
+
+        layout.operator("paint.face_select_linked", text="Linked")
+
+
+class VIEW3D_MT_select_paint_mask_vertex(Menu):
+    bl_label = "Select"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("view3d.select_border")
+        layout.operator("view3d.select_circle")
+
+        layout.separator()
+
+        layout.operator("paint.vert_select_all").action = 'TOGGLE'
+        layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
+
+
 # ********** Object menu **********
 
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-02-26 14:32:53 UTC (rev 54882)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-02-26 15:42:33 UTC (rev 54883)
@@ -151,12 +151,10 @@
 void PAINT_OT_face_select_linked(struct wmOperatorType *ot);
 void PAINT_OT_face_select_linked_pick(struct wmOperatorType *ot);
 void PAINT_OT_face_select_all(struct wmOperatorType *ot);
-void PAINT_OT_face_select_inverse(struct wmOperatorType *ot);
 void PAINT_OT_face_select_hide(struct wmOperatorType *ot);
 void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
 
 void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
-void PAINT_OT_vert_select_inverse(struct wmOperatorType *ot);
 int vert_paint_poll(struct bContext *C);
 int mask_paint_poll(struct bContext *C);
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-02-26 14:32:53 UTC (rev 54882)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-02-26 15:42:33 UTC (rev 54883)
@@ -485,7 +485,6 @@
 
 	/* vertex selection */
 	WM_operatortype_append(PAINT_OT_vert_select_all);
-	WM_operatortype_append(PAINT_OT_vert_select_inverse);
 
 	/* vertex */
 	WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
@@ -496,7 +495,6 @@
 	WM_operatortype_append(PAINT_OT_face_select_linked);
 	WM_operatortype_append(PAINT_OT_face_select_linked_pick);
 	WM_operatortype_append(PAINT_OT_face_select_all);
-	WM_operatortype_append(PAINT_OT_face_select_inverse);
 	WM_operatortype_append(PAINT_OT_face_select_hide);
 	WM_operatortype_append(PAINT_OT_face_select_reveal);
 
@@ -748,7 +746,8 @@
 	keymap = WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
 	keymap->poll = vert_paint_poll;
 	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
@@ -777,7 +776,8 @@
 	keymap->poll = facemask_paint_poll;
 
 	WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "PAINT_OT_face_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
 	kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "unselected", FALSE);
 	kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, KM_SHIFT, 0);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2013-02-26 14:32:53 UTC (rev 54882)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2013-02-26 15:42:33 UTC (rev 54883)
@@ -448,7 +448,7 @@
 
 void PAINT_OT_face_select_all(wmOperatorType *ot)
 {
-	ot->name = "Face Selection";
+	ot->name = "(De)select All";
 	ot->description = "Change selection for all faces";
 	ot->idname = "PAINT_OT_face_select_all";
 
@@ -472,7 +472,7 @@
 
 void PAINT_OT_vert_select_all(wmOperatorType *ot)
 {
-	ot->name = "Vertex Selection";
+	ot->name = "(De)select All";
 	ot->description = "Change selection for all vertices";
 	ot->idname = "PAINT_OT_vert_select_all";
 
@@ -484,46 +484,6 @@
 	WM_operator_properties_select_all(ot);
 }
 
-static int vert_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *ob = CTX_data_active_object(C);
-	paintvert_deselect_all_visible(ob, SEL_INVERT, TRUE);
-	ED_region_tag_redraw(CTX_wm_region(C));
-	return OPERATOR_FINISHED;
-}
-
-void PAINT_OT_vert_select_inverse(wmOperatorType *ot)
-{
-	ot->name = "Vertex Select Invert";
-	ot->description = "Invert selection of vertices";
-	ot->idname = "PAINT_OT_vert_select_inverse";
-
-	ot->exec = vert_select_inverse_exec;
-	ot->poll = vert_paint_poll;
-
-	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *ob = CTX_data_active_object(C);
-	paintface_deselect_all_visible(ob, SEL_INVERT, TRUE);
-	ED_region_tag_redraw(CTX_wm_region(C));
-	return OPERATOR_FINISHED;
-}
-
-
-void PAINT_OT_face_select_inverse(wmOperatorType *ot)
-{
-	ot->name = "Face Select Invert";
-	ot->description = "Invert selection of faces";
-	ot->idname = "PAINT_OT_face_select_inverse";
-
-	ot->exec = face_select_inverse_exec;
-	ot->poll = facemask_paint_poll;
-
-	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
 static int face_select_hide_exec(bContext *C, wmOperator *op)
 {
 	const int unselected = RNA_boolean_get(op->ptr, "unselected");




More information about the Bf-blender-cvs mailing list