diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index cb8806e2ef2..0f415f013de 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -53,23 +53,7 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) { code|=KEY_MASK_SHIFT; - int item = popup->find_item_by_accelerator(code); - - - if (item>=0 && ! popup->is_item_disabled(item)) - popup->activate_item(item); - /* - for(int i=0;iactivate_item_by_accelerator(code); } } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 3329d248903..819885809bc 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -740,15 +740,33 @@ int PopupMenu::get_item_count() const { return items.size(); } -int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const { +bool PopupMenu::activate_item_by_accelerator(uint32_t p_accel) { int il=items.size(); for(int i=0;icast_to(); + if(!pm) + continue; + + if(pm->activate_item_by_accelerator(p_accel)) { + return true; + } + } } - return -1; + return false; } void PopupMenu::activate_item(int p_item) { diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 72f87950677..0e98765dc44 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -117,7 +117,7 @@ public: int get_item_count() const; - int find_item_by_accelerator(uint32_t p_accel) const; + bool activate_item_by_accelerator(uint32_t p_accel); void activate_item(int p_item); void remove_item(int p_idx); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index b5059e52998..7a3f563734b 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3345,7 +3345,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { PopupMenu *p2 = memnew(PopupMenu); p->add_child(p2); p2->set_name("skeleton"); - p2->add_item("Make Bones",SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_SHIFT|KEY_B); + p2->add_item("Make Bones",SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_B); p2->add_item("Clear Bones",SKELETON_CLEAR_BONES); p2->add_separator(); p2->add_item("Make IK Chain",SKELETON_SET_IK_CHAIN);