[Bf-blender-cvs] [838c692] pie-menus: Change user preference for drag/click style.
Antony Riakiotakis
noreply at git.blender.org
Tue Jul 8 13:32:50 CEST 2014
Commit: 838c692b93bd96563b9e8c7be5810a70a38a0066
Author: Antony Riakiotakis
Date: Tue Jul 8 14:32:18 2014 +0300
https://developer.blender.org/rB838c692b93bd96563b9e8c7be5810a70a38a0066
Change user preference for drag/click style.
Use explicit chooser instead of timeout.
===================================================================
M release/scripts/startup/bl_ui/space_userpref.py
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 22f1148..d31a1a6 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -219,7 +219,7 @@ class USERPREF_PT_interface(Panel):
col.separator()
col.label(text="Pie Menus:")
sub = col.column(align=True)
- sub.prop(view, "pie_drag_timeout")
+ sub.prop(view, "pie_interaction_type", text="")
sub.prop(view, "pie_operator_timeout")
sub.prop(view, "pie_initial_timeout")
sub.prop(view, "pie_menu_radius")
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 050a83e..120957c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8361,7 +8361,9 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
if (menu->menuretval) {
/* pie menus should not close but wait for release instead */
- if ((block->flag & UI_BLOCK_RADIAL) && !(block->pie_data.flags & UI_PIE_CLICK_STYLE)) {
+ if ((block->flag & UI_BLOCK_RADIAL) &&
+ !((block->pie_data.flags & UI_PIE_CLICK_STYLE) || U.pie_interaction_type == USER_UI_PIE_CLICK))
+ {
menu->menuretval = 0;
block->pie_data.flags |= UI_PIE_CANCELLED;
}
@@ -8504,12 +8506,9 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
ED_region_tag_redraw(ar);
}
else {
- if (duration > U.pie_drag_timeout * 0.01) {
+ if (U.pie_interaction_type == USER_UI_PIE_DRAG) {
retval = ui_pie_menu_apply(C, menu, event, true);
}
- else {
- block->pie_data.flags |= UI_PIE_CLICK_STYLE;
- }
}
}
else {
@@ -8522,7 +8521,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
case LEFTMOUSE:
if (event->val == KM_PRESS) {
- if (block->pie_data.flags & UI_PIE_CLICK_STYLE) {
+ if ((U.pie_interaction_type == USER_UI_PIE_CLICK) || (block->pie_data.flags & UI_PIE_CLICK_STYLE)) {
retval = ui_pie_menu_apply(C, menu, event, false);
}
else {
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 61552be..fb744a0 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -531,7 +531,7 @@ typedef struct UserDef {
float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */
float pixelsize; /* private, set by GHOST, to multiply DPI with */
- short pie_drag_timeout; /* if keeping a pie menu spawn button pressed after this time, it turns into
+ short pie_interaction_type; /* if keeping a pie menu spawn button pressed after this time, it turns into
* a drag/release pie menu */
short pie_initial_timeout; /* direction in the pie menu will always be calculated from the initial position
* within this time limit */
@@ -843,6 +843,11 @@ typedef enum eImageDrawMethod {
IMAGE_DRAW_METHOD_DRAWPIXELS = 3,
} eImageDrawMethod;
+typedef enum eUIInteraction {
+ USER_UI_PIE_DRAG = 0,
+ USER_UI_PIE_CLICK = 1
+} eUIInteraction;
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 121c16d..80bef09 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3132,7 +3132,13 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Direct conversion of frame numbers to seconds"},
{0, NULL, 0, NULL, NULL}
};
-
+
+ static EnumPropertyItem pie_styles[] = {
+ {USER_UI_PIE_CLICK, "CLICK", 0, "Click", "Press to spawn pie menu, click to confirm"},
+ {USER_UI_PIE_DRAG, "DRAG", 0, "Drag", "Press and hold to spawn pie menu, release to confirm"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
PropertyRNA *prop;
StructRNA *srna;
@@ -3202,9 +3208,9 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Time delay in 1/10 seconds before automatically opening sub level menus");
/* pie menus */
- prop = RNA_def_property(srna, "pie_drag_timeout", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Drag Timeout", "Pie menus change to click style if key is released before this amount of time (in 1/100ths of sec)");
+ prop = RNA_def_property(srna, "pie_interaction_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Interaction Type", "Pie menus use a drag/release or click style");
+ RNA_def_property_enum_items(prop, pie_styles);
prop = RNA_def_property(srna, "pie_initial_timeout", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 1000);
More information about the Bf-blender-cvs
mailing list