[Bf-blender-cvs] [db36eff9f7d] master: UI: make pie menus stick only when tapping key.

Justin Jones noreply at git.blender.org
Thu Jan 10 15:55:42 CET 2019


Commit: db36eff9f7d1eea8ed93434bdb679c37e31681db
Author: Justin Jones
Date:   Thu Jan 10 15:46:44 2019 +0100
Branches: master
https://developer.blender.org/rBdb36eff9f7d1eea8ed93434bdb679c37e31681db

UI: make pie menus stick only when tapping key.

When holding down the key for a while, the pie menu will disappear when
releasing the key. This is under the assumption that in this case the user
decided to cancel the action.

Differential Revision: https://developer.blender.org/D4180

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 489ec261ded..b198c6ea261 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -344,6 +344,7 @@ class USERPREF_PT_interface_menus_mouse_over(PreferencePanel):
 class USERPREF_PT_interface_menus_pie(PreferencePanel):
     bl_label = "Pie Menus"
     bl_parent_id = "USERPREF_PT_interface_menus"
+    bl_options = {'DEFAULT_CLOSED'}
 
     def draw_props(self, context, layout):
         prefs = context.preferences
@@ -352,6 +353,7 @@ class USERPREF_PT_interface_menus_pie(PreferencePanel):
         flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
 
         flow.prop(view, "pie_animation_timeout")
+        flow.prop(view, "pie_tap_timeout")
         flow.prop(view, "pie_initial_timeout")
         flow.prop(view, "pie_menu_radius")
         flow.prop(view, "pie_menu_threshold")
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 59745f7bbf3..4fed46170a9 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -470,6 +470,10 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
 	 */
 	{
 		/* (keep this block even if it becomes empty). */
+
+		if (userdef->pie_tap_timeout == 0) {
+			userdef->pie_tap_timeout = 20;
+		}
 	}
 
 	if (userdef->pixelsize == 0.0f)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 32cd22b0368..f649cfb04e2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9320,6 +9320,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
 
 	ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]);
 
+	/* Distance from initial point. */
 	dist = ui_block_calc_pie_segment(block, event_xy);
 
 	if (but && button_modal_state(but->active->state)) {
@@ -9404,8 +9405,9 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
 				ED_region_tag_redraw(ar);
 			}
 			else {
-				/* distance from initial point */
-				if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
+				if ((duration < 0.01 * U.pie_tap_timeout) &&
+				    !(block->pie_data.flags & UI_PIE_DRAG_STYLE))
+				{
 					block->pie_data.flags |= UI_PIE_CLICK_STYLE;
 				}
 				else {
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index f629e1c787a..85fdc87d762 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -760,7 +760,7 @@ typedef struct UserDef {
 	 * If keeping a pie menu spawn button pressed after this time,
 	 * it turns into a drag/release pie menu.
 	 */
-	short pie_interaction_type;
+	short pie_tap_timeout;
 	/**
 	 * Direction in the pie menu will always be calculated from the
 	 * initial position within this time limit.
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index d8d11af6bd5..157bbf16a24 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3809,6 +3809,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 	                         "Pie menus will use the initial mouse position as center for this amount of time "
 	                         "(in 1/100ths of sec)");
 
+	prop = RNA_def_property(srna, "pie_tap_timeout", PROP_INT, PROP_NONE);
+	RNA_def_property_range(prop, 0, 1000);
+	RNA_def_property_ui_text(prop, "Tap Key Timeout",
+	                         "Pie menu button held longer than this will dismiss menu on release."
+	                         "(in 1/100ths of sec)");
+
 	prop = RNA_def_property(srna, "pie_animation_timeout", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "Animation Timeout",



More information about the Bf-blender-cvs mailing list