diff options
author | Mike Erwin <significant.bit@gmail.com> | 2011-07-24 01:55:52 +0400 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2011-07-24 01:55:52 +0400 |
commit | b9f3ff5435d78b4538b417849edf60238fa54e34 (patch) | |
tree | a5acea6281e64845c3f0bb0e3f2914c68edf2292 /source/blender/windowmanager | |
parent | ff5a49b8161734424b3d8c83c67a5e26b9b16a1e (diff) |
removed ancient ndof global, removed my own attempt at a C popup menu (the Python one works)
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 98 |
2 files changed, 3 insertions, 97 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index ed28696ef69..7dd865984b3 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -182,8 +182,6 @@ void WM_init(bContext *C, int argc, const char **argv) ED_preview_init_dbase(); - G.ndofdevice = -1; /* XXX bad initializer, needs set otherwise buttons show! */ - WM_read_history(); /* allow a path of "", this is what happens when making a new file */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 32d2adffb01..44e42966c77 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1411,113 +1411,22 @@ static void WM_OT_search_menu(wmOperatorType *ot) ot->poll= wm_search_menu_poll; } -// BEGIN ndof menu -- experimental! - -#if 0 -static uiBlock* wm_block_ndof_menu_1st(bContext* C, ARegion* ar, void* UNUSED(arg_op)) -{ - uiBlock* block; - uiBut* but; - - block = uiBeginBlock(C, ar, "ndof_popup_menu", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); -// uiBlockSetDirection(block, UI_DOWN); -// uiBlockBeginAlign(block); - - // uiItemBooleanO(block->curlayout, "enable pan/zoom", ICON_NDOF_TRANS, "toggle_ndof_pan_zoom_enabled", "ndof_pan_zoom_enabled", 1); - // uiBlock is used as an opaque type in this file, so can't use members... - - int foo = 333; - uiDefButI(block, TOG, 0, "foo", 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, &foo, 0.f, 1.f, 0.1f, 0.9f, "15%"); - // uiDefBut(block, TOG, 0, "enable pan/zoom", 0, 0, 10, 10, NULL, 0.f, 1.f, 0.f, 1.f, "don't talk to strangers"); - -// uiBlockEndAlign(block); -// uiBoundsBlock(block, 6); - uiEndBlock(C, block); - - return block; -} - -static int wm_ndof_menu_poll(bContext *C) -{ - if(CTX_wm_window(C)==NULL) - return 0; - - // if menu is already pulled up, another button press should dismiss it - // not sure if that behavior should go here or elsewhere... - - puts("ndof: menu poll"); - return 1; -} - -static int wm_ndof_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) -{ - puts("ndof: menu exec"); - return OPERATOR_FINISHED; -} -#endif - static int wm_ndof_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPupMenuInvoke(C,"VIEW3D_MT_ndof_settings"); + return OPERATOR_FINISHED; // <-- correct? return OPERATOR_CANCELLED; // <-- correct? - -/* -// uiPupMenuNotice(C, "Hello!"); // <-- this works -// uiPupBlock(C, wm_block_ndof_menu, op); // <-- no luck! -// ui_popup_menu_create(C, NULL, NULL, NULL, NULL, "Hello!"); // <-- this works - - uiPopupMenu* pup = uiPupMenuBegin(C,"3D mouse settings",ICON_NDOF_TURN); - uiLayout* layout = uiPupMenuLayout(pup); - - uiItemS(layout); // separator - uiItemFloatO(layout, "sensitivity", 0, 0, "ndof_sensitivity", 1.f); - // do I have to look specifically in "UserPreferences" for ndof_sensitivity property? - - // trial & error -- ok, mostly error -// uiItemBooleanO(layout, "enable pan/zoom", ICON_NDOF_TRANS, "ndof_toggle_pan_zoom_enabled", "ndof_pan_zoom_enabled", 1); -// uiItemBooleanO(layout, "enable rotation", ICON_NDOF_TURN, "ndof_toggle_rotation_enabled", "ndof_rotation_enabled", 1); -// uiItemV(layout,"sensitivity",ICON_NDOF_TRANS, 1); - - printf("ndof: menu invoked in "); - - switch (CTX_wm_area(C)->spacetype) // diff spaces can have diff 3d mouse options - { - case SPACE_VIEW3D: - puts("3D area"); - uiItemS(layout); - uiItemL(layout, "3D navigation mode", 0); - uiItemBooleanO(layout, "helicopter", ICON_NDOF_FLY, 0, "ndof_fly_helicopter", 1); - uiItemBooleanO(layout, "lock horizon", ICON_NDOF_DOM, 0, "ndof_lock_horizon", 1); - break; - case SPACE_IMAGE: - puts("image area"); - break; - default: - puts("some iNDOFferent area"); - } - - //uiBlock* block = uiLayoutGetBlock(layout); - //int foo = 1; - //uiDefButI(block, TOG, 0, "foo", 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, &foo, 0.f, 1.f, 0.1f, 0.9f, "15%"); - - uiPupMenuEnd(C,pup); -*/ } static void WM_OT_ndof_menu(wmOperatorType *ot) { - puts("ndof: registering menu operator"); - ot->name = "NDOF Menu"; ot->idname = "WM_OT_ndof_menu"; ot->invoke = wm_ndof_menu_invoke; } -// END ndof menu - static int wm_call_menu_exec(bContext *C, wmOperator *op) { char idname[BKE_ST_MAXNAME]; @@ -3782,13 +3691,12 @@ void wm_window_keymap(wmKeyConfig *keyconf) /* debug/testing */ WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); - WM_keymap_verify_item(keymap, "WM_OT_search_menu", SPACEKEY, KM_PRESS, 0, 0); + /* menus that can be accessed anywhere in blender */ + WM_keymap_verify_item(keymap, "WM_OT_search_menu", SPACEKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "WM_OT_ndof_menu", NDOF_BUTTON_MENU, KM_PRESS, 0, 0); /* Space switching */ - - kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F2KEY, KM_PRESS, KM_SHIFT, 0); /* new in 2.5x, was DXF export */ RNA_string_set(kmi->ptr, "data_path", "area.type"); RNA_string_set(kmi->ptr, "value", "LOGIC_EDITOR"); |