[Bf-blender-cvs] [0d92435] pie-menus: Pie Menus:

Antony Riakiotakis noreply at git.blender.org
Tue Jul 29 11:45:20 CEST 2014


Commit: 0d92435a71b8dfe7896a5f28b0ac778fdf383e15
Author: Antony Riakiotakis
Date:   Tue Jul 29 11:44:27 2014 +0200
Branches: pie-menus
https://developer.blender.org/rB0d92435a71b8dfe7896a5f28b0ac778fdf383e15

Pie Menus:

* Editmesh selection pie can spawn combinations.

* Remove extraneous flag from operators.

===================================================================

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/mesh/editmesh_select.c
M	source/blender/editors/mesh/mesh_ops.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/windowmanager/WM_keymap.h
M	source/blender/windowmanager/intern/wm_keymap.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 2b337d5..ca5dc2a 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2167,10 +2167,7 @@ class VIEW3D_MT_edit_mesh_select_mode(Menu):
 
         layout.operator_context = 'INVOKE_REGION_WIN'
         pie = layout.menu_pie()
-        pie.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
-        pie.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
-        pie.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
-
+        pie.operator_enum("mesh.select_mode", "type")
 
 class VIEW3D_MT_edit_mesh_extrude(Menu):
     bl_label = "Extrude"
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 9cdfb43..8c648b1 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -44,6 +44,7 @@
 #include "BKE_report.h"
 #include "BKE_paint.h"
 #include "BKE_editmesh.h"
+#include "BKE_mesh.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -938,6 +939,27 @@ static int edbm_select_mode_exec(bContext *C, wmOperator *op)
 	const bool use_extend = RNA_boolean_get(op->ptr, "use_extend");
 	const bool use_expand = RNA_boolean_get(op->ptr, "use_expand");
 
+	if (!is_power_of_2_i(type)) {
+		Scene *scene = CTX_data_scene(C);
+		ToolSettings *ts = scene->toolsettings;
+
+		ts->selectmode = type;
+
+		if (scene->basact) {
+			Object *obact = scene->basact->object;
+			Mesh *me = BKE_mesh_from_object(obact);
+			if (me && me->edit_btmesh && me->edit_btmesh->selectmode != type) {
+				me->edit_btmesh->selectmode = type;
+				EDBM_selectmode_set(me->edit_btmesh);
+				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
+				WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
+				return OPERATOR_FINISHED;
+			}
+		}
+
+		return OPERATOR_CANCELLED;
+	}
+
 	if (EDBM_selectmode_toggle(C, type, action, use_extend, use_expand)) {
 		return OPERATOR_FINISHED;
 	}
@@ -963,10 +985,14 @@ void MESH_OT_select_mode(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem elem_items[] = {
-		{SCE_SELECT_VERTEX, "VERT", ICON_VERTEXSEL, "Vertices", ""},
-		{SCE_SELECT_EDGE,   "EDGE", ICON_EDGESEL, "Edges", ""},
-		{SCE_SELECT_FACE,   "FACE", ICON_FACESEL, "Faces", ""},
-		{0, NULL, 0, NULL, NULL},
+		{SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
+		{SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
+		{SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
+	    {SCE_SELECT_VERTEX | SCE_SELECT_FACE, "VERTEX_FACE", ICON_FACESEL, "Vertex/Face", "Vertex and Face selection mode"},
+	    {SCE_SELECT_VERTEX | SCE_SELECT_EDGE, "VERTEX_EDGE", ICON_VERTEXSEL, "Vertex/Edge", "Vertex and Edge selection mode"},
+	    {SCE_SELECT_FACE | SCE_SELECT_EDGE, "FACE_EDGE", ICON_EDGESEL, "Face/Edge", "Face and Edge selection mode"},
+	    {SCE_SELECT_VERTEX | SCE_SELECT_EDGE | SCE_SELECT_FACE, "ALL", ICON_FACESEL, "All", "All selection modes"},
+		{0, NULL, 0, NULL, NULL}
 	};
 
 	static EnumPropertyItem actions_items[] = {
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index abf4d88..657d99c 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -349,7 +349,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
 	
 	/* selection mode */
-	WM_keymap_add_pie_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0, true);
+	WM_keymap_add_pie_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* hide */
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index f4f16d9..b28a336 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -320,7 +320,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "center", true);
 
 	/* numpad view hotkeys*/
-	WM_keymap_add_pie_menu(keymap, "VIEW3D_PIE_view", QKEY, KM_PRESS, 0, 0, false);
+	WM_keymap_add_pie_menu(keymap, "VIEW3D_PIE_view", QKEY, KM_PRESS, 0, 0);
 
 	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
 	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index c609549..bf81972 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -65,7 +65,7 @@ wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, in
 wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
                                  int val, int modifier, int keymodifier);
 wmKeyMapItem *WM_keymap_add_pie_menu(struct wmKeyMap *keymap, const char *idname, int type,
-                                     int val, int modifier, int keymodifier, bool force_click);
+                                     int val, int modifier, int keymodifier);
 
 bool        WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
 int         WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 568b63f..8a54c1b 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -464,11 +464,11 @@ wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type,
 	return kmi;
 }
 
-wmKeyMapItem *WM_keymap_add_pie_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier, bool force_click)
+wmKeyMapItem *WM_keymap_add_pie_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
 {
 	wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_pie_menu", type, val, modifier, keymodifier);
 	RNA_string_set(kmi->ptr, "name", idname);
-	RNA_boolean_set(kmi->ptr, "force_click", force_click);
+	RNA_boolean_set(kmi->ptr, "force_click", false);
 	return kmi;
 }




More information about the Bf-blender-cvs mailing list