[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50501] trunk/blender/source/blender/ editors/interface: change to auto-opening menus so the first menu item in popup menu wont auto open .
Campbell Barton
ideasman42 at gmail.com
Mon Sep 10 12:50:09 CEST 2012
Revision: 50501
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50501
Author: campbellbarton
Date: 2012-09-10 10:50:08 +0000 (Mon, 10 Sep 2012)
Log Message:
-----------
change to auto-opening menus so the first menu item in popup menu wont auto open.
This way we can do predictable key-shortcut-chaining. Eg.
Shift+A, M, O --- adds a metaball cone.
In editmode
Ctrl+V, X, A --- Assign new vertex group.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/editors/interface/interface_intern.h
trunk/blender/source/blender/editors/interface/interface_regions.c
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2012-09-10 08:38:51 UTC (rev 50500)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2012-09-10 10:50:08 UTC (rev 50501)
@@ -5227,7 +5227,12 @@
/* automatic open pulldown block timer */
if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
- if (data->used_mouse && !data->autoopentimer) {
+ if ((data->used_mouse == TRUE) &&
+ (data->autoopentimer == FALSE) &&
+ /* don't popup the first time,
+ * see description on this member for info */
+ (but->block->auto_is_first_event == FALSE))
+ {
int time;
if (but->block->auto_open == TRUE) { /* test for toolbox */
@@ -5247,6 +5252,8 @@
data->autoopentimer = WM_event_add_timer(data->wm, data->window, TIMER, 0.02 * (double)time);
}
}
+
+ but->block->auto_is_first_event = FALSE;
}
}
else {
Modified: trunk/blender/source/blender/editors/interface/interface_intern.h
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_intern.h 2012-09-10 08:38:51 UTC (rev 50500)
+++ trunk/blender/source/blender/editors/interface/interface_intern.h 2012-09-10 10:50:08 UTC (rev 50501)
@@ -305,7 +305,17 @@
char direction;
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */
char auto_open;
- char _pad[7];
+
+ /* this setting is used so newly opened menu's dont popout the first item under the mouse,
+ * the reasoning behind this is because of muscle memory for opening menus.
+ *
+ * Without this, the first time opening a Submenu and activating an item in it will be 2 steps,
+ * but the second time the same item is accessed the menu memory would auto activate the
+ * last used menu and the key intended to select that submenu ends up being passed into the submenu.
+ * - Campbell
+ */
+ char auto_is_first_event;
+ char _pad[6];
double auto_open_last;
const char *lockstr;
Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c 2012-09-10 08:38:51 UTC (rev 50500)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c 2012-09-10 10:50:08 UTC (rev 50501)
@@ -2502,6 +2502,7 @@
pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
pup->block->puphash = ui_popup_menu_hash(title);
+ pup->block->auto_is_first_event = TRUE;
pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
More information about the Bf-blender-cvs
mailing list