Merge pull request #42109 from EricEzaM/PR/input-and-shortcuts-rework
Shortcuts rework - fixed issues with input propagation and triggering of unwanted shortcuts.
This commit is contained in:
commit
a09846e015
29 changed files with 180 additions and 89 deletions
|
@ -5574,6 +5574,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
||||||
undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||||
|
|
||||||
main_panel = memnew(PanelContainer);
|
main_panel = memnew(PanelContainer);
|
||||||
|
main_panel->set_focus_mode(FOCUS_ALL); // allow panel to have focus so that shortcuts work as expected.
|
||||||
add_child(main_panel);
|
add_child(main_panel);
|
||||||
main_panel->set_v_size_flags(SIZE_EXPAND_FILL);
|
main_panel->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
HBoxContainer *timeline_scroll = memnew(HBoxContainer);
|
HBoxContainer *timeline_scroll = memnew(HBoxContainer);
|
||||||
|
@ -5707,6 +5708,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
||||||
timeline->set_zoom(zoom);
|
timeline->set_zoom(zoom);
|
||||||
|
|
||||||
edit = memnew(MenuButton);
|
edit = memnew(MenuButton);
|
||||||
|
edit->set_shortcut_context(this);
|
||||||
edit->set_text(TTR("Edit"));
|
edit->set_text(TTR("Edit"));
|
||||||
edit->set_flat(false);
|
edit->set_flat(false);
|
||||||
edit->set_disabled(true);
|
edit->set_disabled(true);
|
||||||
|
@ -5719,12 +5721,8 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
||||||
edit->get_popup()->add_separator();
|
edit->get_popup()->add_separator();
|
||||||
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_SELECTION);
|
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_SELECTION);
|
||||||
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_TRANSPOSED);
|
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_TRANSPOSED);
|
||||||
edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DUPLICATE_SELECTION), true);
|
|
||||||
edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DUPLICATE_TRANSPOSED), true);
|
|
||||||
edit->get_popup()->add_separator();
|
edit->get_popup()->add_separator();
|
||||||
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), KEY_DELETE), EDIT_DELETE_SELECTION);
|
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), KEY_DELETE), EDIT_DELETE_SELECTION);
|
||||||
edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DELETE_SELECTION), true);
|
|
||||||
//this shortcut will be checked from the track itself. so no need to enable it here (will conflict with scenetree dock)
|
|
||||||
|
|
||||||
edit->get_popup()->add_separator();
|
edit->get_popup()->add_separator();
|
||||||
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Go to Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
|
edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Go to Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
|
||||||
|
|
|
@ -531,21 +531,15 @@ void EditorAudioBus::_effect_add(int p_which) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
|
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventKey> k = p_event;
|
|
||||||
if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
|
|
||||||
accept_event();
|
|
||||||
emit_signal("delete_request");
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
|
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
|
||||||
bus_popup->set_position(get_global_position() + pos);
|
bus_popup->set_position(get_global_position() + pos);
|
||||||
bus_popup->popup();
|
bus_popup->popup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorAudioBus::_unhandled_key_input(Ref<InputEvent> p_event) {
|
void EditorAudioBus::_effects_gui_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventKey> k = p_event;
|
Ref<InputEventKey> k = p_event;
|
||||||
if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_DELETE) {
|
if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_DELETE) {
|
||||||
TreeItem *current_effect = effects->get_selected();
|
TreeItem *current_effect = effects->get_selected();
|
||||||
|
@ -749,7 +743,6 @@ void EditorAudioBus::_bind_methods() {
|
||||||
ClassDB::bind_method("update_bus", &EditorAudioBus::update_bus);
|
ClassDB::bind_method("update_bus", &EditorAudioBus::update_bus);
|
||||||
ClassDB::bind_method("update_send", &EditorAudioBus::update_send);
|
ClassDB::bind_method("update_send", &EditorAudioBus::update_send);
|
||||||
ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input);
|
ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input);
|
||||||
ClassDB::bind_method("_unhandled_key_input", &EditorAudioBus::_unhandled_key_input);
|
|
||||||
ClassDB::bind_method("get_drag_data_fw", &EditorAudioBus::get_drag_data_fw);
|
ClassDB::bind_method("get_drag_data_fw", &EditorAudioBus::get_drag_data_fw);
|
||||||
ClassDB::bind_method("can_drop_data_fw", &EditorAudioBus::can_drop_data_fw);
|
ClassDB::bind_method("can_drop_data_fw", &EditorAudioBus::can_drop_data_fw);
|
||||||
ClassDB::bind_method("drop_data_fw", &EditorAudioBus::drop_data_fw);
|
ClassDB::bind_method("drop_data_fw", &EditorAudioBus::drop_data_fw);
|
||||||
|
@ -773,7 +766,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
||||||
add_child(vb);
|
add_child(vb);
|
||||||
|
|
||||||
set_v_size_flags(SIZE_EXPAND_FILL);
|
set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
set_process_unhandled_key_input(true);
|
|
||||||
|
|
||||||
track_name = memnew(LineEdit);
|
track_name = memnew(LineEdit);
|
||||||
track_name->connect("text_entered", callable_mp(this, &EditorAudioBus::_name_changed));
|
track_name->connect("text_entered", callable_mp(this, &EditorAudioBus::_name_changed));
|
||||||
|
@ -805,12 +797,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
||||||
hbc->add_child(bypass);
|
hbc->add_child(bypass);
|
||||||
hbc->add_spacer();
|
hbc->add_spacer();
|
||||||
|
|
||||||
bus_options = memnew(MenuButton);
|
|
||||||
bus_options->set_h_size_flags(SIZE_SHRINK_END);
|
|
||||||
bus_options->set_anchor(MARGIN_RIGHT, 0.0);
|
|
||||||
bus_options->set_tooltip(TTR("Bus options"));
|
|
||||||
hbc->add_child(bus_options);
|
|
||||||
|
|
||||||
Ref<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty);
|
Ref<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty);
|
||||||
for (int i = 0; i < hbc->get_child_count(); i++) {
|
for (int i = 0; i < hbc->get_child_count(); i++) {
|
||||||
Control *child = Object::cast_to<Control>(hbc->get_child(i));
|
Control *child = Object::cast_to<Control>(hbc->get_child(i));
|
||||||
|
@ -906,6 +892,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
||||||
effects->set_allow_rmb_select(true);
|
effects->set_allow_rmb_select(true);
|
||||||
effects->set_focus_mode(FOCUS_CLICK);
|
effects->set_focus_mode(FOCUS_CLICK);
|
||||||
effects->set_allow_reselect(true);
|
effects->set_allow_reselect(true);
|
||||||
|
effects->connect("gui_input", callable_mp(this, &EditorAudioBus::_effects_gui_input));
|
||||||
|
|
||||||
send = memnew(OptionButton);
|
send = memnew(OptionButton);
|
||||||
send->set_clip_text(true);
|
send->set_clip_text(true);
|
||||||
|
@ -932,9 +919,16 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
||||||
effect_options->set_item_icon(effect_options->get_item_count() - 1, icon);
|
effect_options->set_item_icon(effect_options->get_item_count() - 1, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bus_options = memnew(MenuButton);
|
||||||
|
bus_options->set_shortcut_context(this);
|
||||||
|
bus_options->set_h_size_flags(SIZE_SHRINK_END);
|
||||||
|
bus_options->set_anchor(MARGIN_RIGHT, 0.0);
|
||||||
|
bus_options->set_tooltip(TTR("Bus options"));
|
||||||
|
hbc->add_child(bus_options);
|
||||||
|
|
||||||
bus_popup = bus_options->get_popup();
|
bus_popup = bus_options->get_popup();
|
||||||
bus_popup->add_item(TTR("Duplicate"));
|
bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/duplicate_selected_bus", TTR("Duplicate Bus"), KEY_MASK_CMD | KEY_D));
|
||||||
bus_popup->add_item(TTR("Delete"));
|
bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/delete_selected_bus", TTR("Delete Bus"), KEY_DELETE));
|
||||||
bus_popup->set_item_disabled(1, is_master);
|
bus_popup->set_item_disabled(1, is_master);
|
||||||
bus_popup->add_item(TTR("Reset Volume"));
|
bus_popup->add_item(TTR("Reset Volume"));
|
||||||
bus_popup->connect("index_pressed", callable_mp(this, &EditorAudioBus::_bus_popup_pressed));
|
bus_popup->connect("index_pressed", callable_mp(this, &EditorAudioBus::_bus_popup_pressed));
|
||||||
|
|
|
@ -91,7 +91,7 @@ class EditorAudioBus : public PanelContainer {
|
||||||
mutable bool hovering_drop;
|
mutable bool hovering_drop;
|
||||||
|
|
||||||
void _gui_input(const Ref<InputEvent> &p_event);
|
void _gui_input(const Ref<InputEvent> &p_event);
|
||||||
void _unhandled_key_input(Ref<InputEvent> p_event);
|
void _effects_gui_input(Ref<InputEvent> p_event);
|
||||||
void _bus_popup_pressed(int p_option);
|
void _bus_popup_pressed(int p_option);
|
||||||
|
|
||||||
void _name_changed(const String &p_new_name);
|
void _name_changed(const String &p_new_name);
|
||||||
|
|
|
@ -56,19 +56,6 @@ void EditorHelp::_init_colors() {
|
||||||
class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE));
|
class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
|
||||||
if (!is_visible_in_tree()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<InputEventKey> k = p_ev;
|
|
||||||
|
|
||||||
if (k.is_valid() && k->get_control() && k->get_keycode() == KEY_F) {
|
|
||||||
search->grab_focus();
|
|
||||||
search->select_all();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorHelp::_search(bool p_search_previous) {
|
void EditorHelp::_search(bool p_search_previous) {
|
||||||
if (p_search_previous) {
|
if (p_search_previous) {
|
||||||
find_bar->search_prev();
|
find_bar->search_prev();
|
||||||
|
@ -1599,7 +1586,6 @@ void EditorHelp::set_scroll(int p_scroll) {
|
||||||
void EditorHelp::_bind_methods() {
|
void EditorHelp::_bind_methods() {
|
||||||
ClassDB::bind_method("_class_list_select", &EditorHelp::_class_list_select);
|
ClassDB::bind_method("_class_list_select", &EditorHelp::_class_list_select);
|
||||||
ClassDB::bind_method("_request_help", &EditorHelp::_request_help);
|
ClassDB::bind_method("_request_help", &EditorHelp::_request_help);
|
||||||
ClassDB::bind_method("_unhandled_key_input", &EditorHelp::_unhandled_key_input);
|
|
||||||
ClassDB::bind_method("_search", &EditorHelp::_search);
|
ClassDB::bind_method("_search", &EditorHelp::_search);
|
||||||
ClassDB::bind_method("_help_callback", &EditorHelp::_help_callback);
|
ClassDB::bind_method("_help_callback", &EditorHelp::_help_callback);
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,6 @@ class EditorHelp : public VBoxContainer {
|
||||||
void _request_help(const String &p_string);
|
void _request_help(const String &p_string);
|
||||||
void _search(bool p_search_previous = false);
|
void _search(bool p_search_previous = false);
|
||||||
|
|
||||||
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
|
|
||||||
|
|
||||||
String _fix_constant(const String &p_constant) const;
|
String _fix_constant(const String &p_constant) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -162,12 +162,14 @@ EditorLog::EditorLog() {
|
||||||
hb->add_child(copybutton);
|
hb->add_child(copybutton);
|
||||||
copybutton->set_text(TTR("Copy"));
|
copybutton->set_text(TTR("Copy"));
|
||||||
copybutton->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C));
|
copybutton->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C));
|
||||||
|
copybutton->set_shortcut_context(this);
|
||||||
copybutton->connect("pressed", callable_mp(this, &EditorLog::_copy_request));
|
copybutton->connect("pressed", callable_mp(this, &EditorLog::_copy_request));
|
||||||
|
|
||||||
clearbutton = memnew(Button);
|
clearbutton = memnew(Button);
|
||||||
hb->add_child(clearbutton);
|
hb->add_child(clearbutton);
|
||||||
clearbutton->set_text(TTR("Clear"));
|
clearbutton->set_text(TTR("Clear"));
|
||||||
clearbutton->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K));
|
clearbutton->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K));
|
||||||
|
clearbutton->set_shortcut_context(this);
|
||||||
clearbutton->connect("pressed", callable_mp(this, &EditorLog::_clear_request));
|
clearbutton->connect("pressed", callable_mp(this, &EditorLog::_clear_request));
|
||||||
|
|
||||||
log = memnew(RichTextLabel);
|
log = memnew(RichTextLabel);
|
||||||
|
|
|
@ -569,6 +569,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
||||||
node_info_hb->add_child(editor_path);
|
node_info_hb->add_child(editor_path);
|
||||||
|
|
||||||
object_menu = memnew(MenuButton);
|
object_menu = memnew(MenuButton);
|
||||||
|
object_menu->set_shortcut_context(this);
|
||||||
object_menu->set_icon(get_theme_icon("Tools", "EditorIcons"));
|
object_menu->set_icon(get_theme_icon("Tools", "EditorIcons"));
|
||||||
node_info_hb->add_child(object_menu);
|
node_info_hb->add_child(object_menu);
|
||||||
object_menu->set_tooltip(TTR("Object properties."));
|
object_menu->set_tooltip(TTR("Object properties."));
|
||||||
|
|
|
@ -1212,9 +1212,11 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||||
} else {
|
} else {
|
||||||
_play_bw_pressed();
|
_play_bw_pressed();
|
||||||
}
|
}
|
||||||
|
accept_event();
|
||||||
} break;
|
} break;
|
||||||
case KEY_S: {
|
case KEY_S: {
|
||||||
_stop_pressed();
|
_stop_pressed();
|
||||||
|
accept_event();
|
||||||
} break;
|
} break;
|
||||||
case KEY_D: {
|
case KEY_D: {
|
||||||
if (!k->get_shift()) {
|
if (!k->get_shift()) {
|
||||||
|
@ -1222,6 +1224,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||||
} else {
|
} else {
|
||||||
_play_pressed();
|
_play_pressed();
|
||||||
}
|
}
|
||||||
|
accept_event();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1547,6 +1550,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
|
||||||
delete_dialog->connect("confirmed", callable_mp(this, &AnimationPlayerEditor::_animation_remove_confirmed));
|
delete_dialog->connect("confirmed", callable_mp(this, &AnimationPlayerEditor::_animation_remove_confirmed));
|
||||||
|
|
||||||
tool_anim = memnew(MenuButton);
|
tool_anim = memnew(MenuButton);
|
||||||
|
tool_anim->set_shortcut_context(this);
|
||||||
tool_anim->set_flat(false);
|
tool_anim->set_flat(false);
|
||||||
tool_anim->set_tooltip(TTR("Animation Tools"));
|
tool_anim->set_tooltip(TTR("Animation Tools"));
|
||||||
tool_anim->set_text(TTR("Animation"));
|
tool_anim->set_text(TTR("Animation"));
|
||||||
|
|
|
@ -580,7 +580,7 @@ void EditorAssetLibrary::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorAssetLibrary::_unhandled_input(const Ref<InputEvent> &p_event) {
|
void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) {
|
||||||
const Ref<InputEventKey> key = p_event;
|
const Ref<InputEventKey> key = p_event;
|
||||||
|
|
||||||
if (key.is_valid() && key->is_pressed()) {
|
if (key.is_valid() && key->is_pressed()) {
|
||||||
|
@ -1281,7 +1281,7 @@ void EditorAssetLibrary::disable_community_support() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorAssetLibrary::_bind_methods() {
|
void EditorAssetLibrary::_bind_methods() {
|
||||||
ClassDB::bind_method("_unhandled_input", &EditorAssetLibrary::_unhandled_input);
|
ClassDB::bind_method("_unhandled_key_input", &EditorAssetLibrary::_unhandled_key_input);
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name")));
|
ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name")));
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
||||||
description = nullptr;
|
description = nullptr;
|
||||||
|
|
||||||
set_process(true);
|
set_process(true);
|
||||||
set_process_unhandled_input(true);
|
set_process_unhandled_key_input(true); // Global shortcuts since there is no main element to be focused.
|
||||||
|
|
||||||
downloads_scroll = memnew(ScrollContainer);
|
downloads_scroll = memnew(ScrollContainer);
|
||||||
downloads_scroll->set_enable_h_scroll(true);
|
downloads_scroll->set_enable_h_scroll(true);
|
||||||
|
|
|
@ -298,7 +298,7 @@ class EditorAssetLibrary : public PanelContainer {
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
void _unhandled_input(const Ref<InputEvent> &p_event);
|
void _unhandled_key_input(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void disable_community_support();
|
void disable_community_support();
|
||||||
|
|
|
@ -478,22 +478,24 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
|
if (k.is_valid()) {
|
||||||
viewport->update();
|
if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
|
||||||
}
|
viewport->update();
|
||||||
|
}
|
||||||
|
|
||||||
if (k->is_pressed() && !k->get_control() && !k->is_echo()) {
|
if (k->is_pressed() && !k->get_control() && !k->is_echo()) {
|
||||||
if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
|
if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||||
// Multiply the grid size
|
// Multiply the grid size
|
||||||
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
|
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
|
||||||
viewport->update();
|
viewport->update();
|
||||||
} else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
|
} else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||||
// Divide the grid size
|
// Divide the grid size
|
||||||
Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
|
Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
|
||||||
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) {
|
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) {
|
||||||
grid_step_multiplier--;
|
grid_step_multiplier--;
|
||||||
|
}
|
||||||
|
viewport->update();
|
||||||
}
|
}
|
||||||
viewport->update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5752,6 +5754,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
zoom_hb->add_child(zoom_minus);
|
zoom_hb->add_child(zoom_minus);
|
||||||
zoom_minus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_minus));
|
zoom_minus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_minus));
|
||||||
zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS));
|
zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS));
|
||||||
|
zoom_minus->set_shortcut_context(this);
|
||||||
zoom_minus->set_focus_mode(FOCUS_NONE);
|
zoom_minus->set_focus_mode(FOCUS_NONE);
|
||||||
|
|
||||||
zoom_reset = memnew(Button);
|
zoom_reset = memnew(Button);
|
||||||
|
@ -5762,6 +5765,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
|
zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
|
||||||
zoom_reset->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_reset));
|
zoom_reset->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_reset));
|
||||||
zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0));
|
zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0));
|
||||||
|
zoom_reset->set_shortcut_context(this);
|
||||||
zoom_reset->set_focus_mode(FOCUS_NONE);
|
zoom_reset->set_focus_mode(FOCUS_NONE);
|
||||||
zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER);
|
zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER);
|
||||||
// Prevent the button's size from changing when the text size changes
|
// Prevent the button's size from changing when the text size changes
|
||||||
|
@ -5772,6 +5776,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
zoom_hb->add_child(zoom_plus);
|
zoom_hb->add_child(zoom_plus);
|
||||||
zoom_plus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_plus));
|
zoom_plus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_plus));
|
||||||
zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS
|
zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS
|
||||||
|
zoom_plus->set_shortcut_context(this);
|
||||||
zoom_plus->set_focus_mode(FOCUS_NONE);
|
zoom_plus->set_focus_mode(FOCUS_NONE);
|
||||||
|
|
||||||
updating_scroll = false;
|
updating_scroll = false;
|
||||||
|
@ -5783,6 +5788,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SELECT));
|
select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SELECT));
|
||||||
select_button->set_pressed(true);
|
select_button->set_pressed(true);
|
||||||
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
|
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
|
||||||
|
select_button->set_shortcut_context(this);
|
||||||
select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection"));
|
select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection"));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
@ -5793,6 +5799,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
move_button->set_toggle_mode(true);
|
move_button->set_toggle_mode(true);
|
||||||
move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_MOVE));
|
move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_MOVE));
|
||||||
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
|
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
|
||||||
|
move_button->set_shortcut_context(this);
|
||||||
move_button->set_tooltip(TTR("Move Mode"));
|
move_button->set_tooltip(TTR("Move Mode"));
|
||||||
|
|
||||||
rotate_button = memnew(Button);
|
rotate_button = memnew(Button);
|
||||||
|
@ -5801,6 +5808,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
rotate_button->set_toggle_mode(true);
|
rotate_button->set_toggle_mode(true);
|
||||||
rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_ROTATE));
|
rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_ROTATE));
|
||||||
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
|
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
|
||||||
|
rotate_button->set_shortcut_context(this);
|
||||||
rotate_button->set_tooltip(TTR("Rotate Mode"));
|
rotate_button->set_tooltip(TTR("Rotate Mode"));
|
||||||
|
|
||||||
scale_button = memnew(Button);
|
scale_button = memnew(Button);
|
||||||
|
@ -5809,6 +5817,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
scale_button->set_toggle_mode(true);
|
scale_button->set_toggle_mode(true);
|
||||||
scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SCALE));
|
scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SCALE));
|
||||||
scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
|
scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
|
||||||
|
scale_button->set_shortcut_context(this);
|
||||||
scale_button->set_tooltip(TTR("Scale Mode"));
|
scale_button->set_tooltip(TTR("Scale Mode"));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
@ -5833,6 +5842,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
pan_button->set_toggle_mode(true);
|
pan_button->set_toggle_mode(true);
|
||||||
pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_PAN));
|
pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_PAN));
|
||||||
pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G));
|
pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G));
|
||||||
|
pan_button->set_shortcut_context(this);
|
||||||
pan_button->set_tooltip(TTR("Pan Mode"));
|
pan_button->set_tooltip(TTR("Pan Mode"));
|
||||||
|
|
||||||
ruler_button = memnew(Button);
|
ruler_button = memnew(Button);
|
||||||
|
@ -5841,6 +5851,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
ruler_button->set_toggle_mode(true);
|
ruler_button->set_toggle_mode(true);
|
||||||
ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_RULER));
|
ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_RULER));
|
||||||
ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R));
|
ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R));
|
||||||
|
ruler_button->set_shortcut_context(this);
|
||||||
ruler_button->set_tooltip(TTR("Ruler Mode"));
|
ruler_button->set_tooltip(TTR("Ruler Mode"));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
@ -5852,6 +5863,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap));
|
smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap));
|
||||||
smart_snap_button->set_tooltip(TTR("Toggle smart snapping."));
|
smart_snap_button->set_tooltip(TTR("Toggle smart snapping."));
|
||||||
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S));
|
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S));
|
||||||
|
smart_snap_button->set_shortcut_context(this);
|
||||||
|
|
||||||
grid_snap_button = memnew(Button);
|
grid_snap_button = memnew(Button);
|
||||||
grid_snap_button->set_flat(true);
|
grid_snap_button->set_flat(true);
|
||||||
|
@ -5860,8 +5872,10 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap));
|
grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap));
|
||||||
grid_snap_button->set_tooltip(TTR("Toggle grid snapping."));
|
grid_snap_button->set_tooltip(TTR("Toggle grid snapping."));
|
||||||
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G));
|
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G));
|
||||||
|
grid_snap_button->set_shortcut_context(this);
|
||||||
|
|
||||||
snap_config_menu = memnew(MenuButton);
|
snap_config_menu = memnew(MenuButton);
|
||||||
|
snap_config_menu->set_shortcut_context(this);
|
||||||
hb->add_child(snap_config_menu);
|
hb->add_child(snap_config_menu);
|
||||||
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
|
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
|
||||||
snap_config_menu->set_tooltip(TTR("Snapping Options"));
|
snap_config_menu->set_tooltip(TTR("Snapping Options"));
|
||||||
|
@ -5921,6 +5935,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
skeleton_menu = memnew(MenuButton);
|
skeleton_menu = memnew(MenuButton);
|
||||||
|
skeleton_menu->set_shortcut_context(this);
|
||||||
hb->add_child(skeleton_menu);
|
hb->add_child(skeleton_menu);
|
||||||
skeleton_menu->set_tooltip(TTR("Skeleton Options"));
|
skeleton_menu->set_tooltip(TTR("Skeleton Options"));
|
||||||
skeleton_menu->set_switch_on_hover(true);
|
skeleton_menu->set_switch_on_hover(true);
|
||||||
|
@ -5949,6 +5964,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
view_menu = memnew(MenuButton);
|
view_menu = memnew(MenuButton);
|
||||||
|
view_menu->set_shortcut_context(this);
|
||||||
view_menu->set_text(TTR("View"));
|
view_menu->set_text(TTR("View"));
|
||||||
hb->add_child(view_menu);
|
hb->add_child(view_menu);
|
||||||
view_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
|
view_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
|
||||||
|
@ -5973,6 +5989,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE);
|
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE);
|
||||||
|
|
||||||
presets_menu = memnew(MenuButton);
|
presets_menu = memnew(MenuButton);
|
||||||
|
presets_menu->set_shortcut_context(this);
|
||||||
presets_menu->set_text(TTR("Layout"));
|
presets_menu->set_text(TTR("Layout"));
|
||||||
hb->add_child(presets_menu);
|
hb->add_child(presets_menu);
|
||||||
presets_menu->hide();
|
presets_menu->hide();
|
||||||
|
@ -6006,6 +6023,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
key_loc_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_POS));
|
key_loc_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_POS));
|
||||||
key_loc_button->set_tooltip(TTR("Translation mask for inserting keys."));
|
key_loc_button->set_tooltip(TTR("Translation mask for inserting keys."));
|
||||||
animation_hb->add_child(key_loc_button);
|
animation_hb->add_child(key_loc_button);
|
||||||
|
|
||||||
key_rot_button = memnew(Button);
|
key_rot_button = memnew(Button);
|
||||||
key_rot_button->set_toggle_mode(true);
|
key_rot_button->set_toggle_mode(true);
|
||||||
key_rot_button->set_flat(true);
|
key_rot_button->set_flat(true);
|
||||||
|
@ -6014,6 +6032,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
key_rot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_ROT));
|
key_rot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_ROT));
|
||||||
key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys."));
|
key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys."));
|
||||||
animation_hb->add_child(key_rot_button);
|
animation_hb->add_child(key_rot_button);
|
||||||
|
|
||||||
key_scale_button = memnew(Button);
|
key_scale_button = memnew(Button);
|
||||||
key_scale_button->set_toggle_mode(true);
|
key_scale_button->set_toggle_mode(true);
|
||||||
key_scale_button->set_flat(true);
|
key_scale_button->set_flat(true);
|
||||||
|
@ -6021,23 +6040,27 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_SCALE));
|
key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_SCALE));
|
||||||
key_scale_button->set_tooltip(TTR("Scale mask for inserting keys."));
|
key_scale_button->set_tooltip(TTR("Scale mask for inserting keys."));
|
||||||
animation_hb->add_child(key_scale_button);
|
animation_hb->add_child(key_scale_button);
|
||||||
|
|
||||||
key_insert_button = memnew(Button);
|
key_insert_button = memnew(Button);
|
||||||
key_insert_button->set_flat(true);
|
key_insert_button->set_flat(true);
|
||||||
key_insert_button->set_focus_mode(FOCUS_NONE);
|
key_insert_button->set_focus_mode(FOCUS_NONE);
|
||||||
key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_KEY));
|
key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_KEY));
|
||||||
key_insert_button->set_tooltip(TTR("Insert keys (based on mask)."));
|
key_insert_button->set_tooltip(TTR("Insert keys (based on mask)."));
|
||||||
key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT));
|
key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT));
|
||||||
|
key_insert_button->set_shortcut_context(this);
|
||||||
animation_hb->add_child(key_insert_button);
|
animation_hb->add_child(key_insert_button);
|
||||||
|
|
||||||
key_auto_insert_button = memnew(Button);
|
key_auto_insert_button = memnew(Button);
|
||||||
key_auto_insert_button->set_flat(true);
|
key_auto_insert_button->set_flat(true);
|
||||||
key_auto_insert_button->set_toggle_mode(true);
|
key_auto_insert_button->set_toggle_mode(true);
|
||||||
key_auto_insert_button->set_focus_mode(FOCUS_NONE);
|
key_auto_insert_button->set_focus_mode(FOCUS_NONE);
|
||||||
//key_auto_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY));
|
|
||||||
key_auto_insert_button->set_tooltip(TTR("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time."));
|
key_auto_insert_button->set_tooltip(TTR("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time."));
|
||||||
key_auto_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_auto_insert_key", TTR("Auto Insert Key")));
|
key_auto_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_auto_insert_key", TTR("Auto Insert Key")));
|
||||||
|
key_auto_insert_button->set_shortcut_context(this);
|
||||||
animation_hb->add_child(key_auto_insert_button);
|
animation_hb->add_child(key_auto_insert_button);
|
||||||
|
|
||||||
animation_menu = memnew(MenuButton);
|
animation_menu = memnew(MenuButton);
|
||||||
|
animation_menu->set_shortcut_context(this);
|
||||||
animation_menu->set_tooltip(TTR("Animation Key and Pose Options"));
|
animation_menu->set_tooltip(TTR("Animation Key and Pose Options"));
|
||||||
animation_hb->add_child(animation_menu);
|
animation_hb->add_child(animation_menu);
|
||||||
animation_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
|
animation_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
|
||||||
|
|
|
@ -3906,8 +3906,9 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
|
||||||
|
|
||||||
view_menu = memnew(MenuButton);
|
view_menu = memnew(MenuButton);
|
||||||
view_menu->set_flat(false);
|
view_menu->set_flat(false);
|
||||||
vbox->add_child(view_menu);
|
|
||||||
view_menu->set_h_size_flags(0);
|
view_menu->set_h_size_flags(0);
|
||||||
|
view_menu->set_shortcut_context(this);
|
||||||
|
vbox->add_child(view_menu);
|
||||||
|
|
||||||
display_submenu = memnew(PopupMenu);
|
display_submenu = memnew(PopupMenu);
|
||||||
view_menu->get_popup()->add_child(display_submenu);
|
view_menu->get_popup()->add_child(display_submenu);
|
||||||
|
@ -6220,6 +6221,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_SELECT;
|
button_binds.write[0] = MENU_TOOL_SELECT;
|
||||||
tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q));
|
tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q));
|
||||||
|
tool_button[TOOL_MODE_SELECT]->set_shortcut_context(this);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection"));
|
tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection"));
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
hbc_menu->add_child(memnew(VSeparator));
|
||||||
|
@ -6231,6 +6233,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_MOVE;
|
button_binds.write[0] = MENU_TOOL_MOVE;
|
||||||
tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
||||||
tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W));
|
tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W));
|
||||||
|
tool_button[TOOL_MODE_MOVE]->set_shortcut_context(this);
|
||||||
|
|
||||||
tool_button[TOOL_MODE_ROTATE] = memnew(Button);
|
tool_button[TOOL_MODE_ROTATE] = memnew(Button);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_ROTATE]);
|
hbc_menu->add_child(tool_button[TOOL_MODE_ROTATE]);
|
||||||
|
@ -6239,6 +6242,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_ROTATE;
|
button_binds.write[0] = MENU_TOOL_ROTATE;
|
||||||
tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
||||||
tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E));
|
tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E));
|
||||||
|
tool_button[TOOL_MODE_ROTATE]->set_shortcut_context(this);
|
||||||
|
|
||||||
tool_button[TOOL_MODE_SCALE] = memnew(Button);
|
tool_button[TOOL_MODE_SCALE] = memnew(Button);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_SCALE]);
|
hbc_menu->add_child(tool_button[TOOL_MODE_SCALE]);
|
||||||
|
@ -6247,6 +6251,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_SCALE;
|
button_binds.write[0] = MENU_TOOL_SCALE;
|
||||||
tool_button[TOOL_MODE_SCALE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
tool_button[TOOL_MODE_SCALE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
|
||||||
tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R));
|
tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R));
|
||||||
|
tool_button[TOOL_MODE_SCALE]->set_shortcut_context(this);
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
hbc_menu->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
|
@ -6295,6 +6300,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
|
button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T));
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T));
|
||||||
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this);
|
||||||
|
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);
|
tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);
|
||||||
hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
|
hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
|
||||||
|
@ -6303,6 +6309,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
button_binds.write[0] = MENU_TOOL_USE_SNAP;
|
button_binds.write[0] = MENU_TOOL_USE_SNAP;
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
|
tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y));
|
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y));
|
||||||
|
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
hbc_menu->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
|
@ -6340,6 +6347,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
transform_menu = memnew(MenuButton);
|
transform_menu = memnew(MenuButton);
|
||||||
transform_menu->set_text(TTR("Transform"));
|
transform_menu->set_text(TTR("Transform"));
|
||||||
transform_menu->set_switch_on_hover(true);
|
transform_menu->set_switch_on_hover(true);
|
||||||
|
transform_menu->set_shortcut_context(this);
|
||||||
hbc_menu->add_child(transform_menu);
|
hbc_menu->add_child(transform_menu);
|
||||||
|
|
||||||
p = transform_menu->get_popup();
|
p = transform_menu->get_popup();
|
||||||
|
@ -6354,6 +6362,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
||||||
view_menu = memnew(MenuButton);
|
view_menu = memnew(MenuButton);
|
||||||
view_menu->set_text(TTR("View"));
|
view_menu->set_text(TTR("View"));
|
||||||
view_menu->set_switch_on_hover(true);
|
view_menu->set_switch_on_hover(true);
|
||||||
|
view_menu->set_shortcut_context(this);
|
||||||
hbc_menu->add_child(view_menu);
|
hbc_menu->add_child(view_menu);
|
||||||
|
|
||||||
p = view_menu->get_popup();
|
p = view_menu->get_popup();
|
||||||
|
|
|
@ -2644,7 +2644,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
void ScriptEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) {
|
||||||
if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) {
|
if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3172,7 +3172,7 @@ void ScriptEditor::_bind_methods() {
|
||||||
ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections);
|
ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections);
|
||||||
ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open);
|
ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open);
|
||||||
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
|
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
|
||||||
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
|
ClassDB::bind_method("_unhandled_key_input", &ScriptEditor::_unhandled_key_input);
|
||||||
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
|
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
|
||||||
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
|
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
|
||||||
|
|
||||||
|
@ -3299,12 +3299,13 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||||
ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN);
|
ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN);
|
||||||
ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD); // these should be KEY_GREATER and KEY_LESS but those don't work
|
ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD); // these should be KEY_GREATER and KEY_LESS but those don't work
|
||||||
ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA);
|
ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA);
|
||||||
set_process_unhandled_input(true);
|
set_process_unhandled_key_input(true);
|
||||||
|
|
||||||
file_menu = memnew(MenuButton);
|
file_menu = memnew(MenuButton);
|
||||||
menu_hb->add_child(file_menu);
|
|
||||||
file_menu->set_text(TTR("File"));
|
file_menu->set_text(TTR("File"));
|
||||||
file_menu->set_switch_on_hover(true);
|
file_menu->set_switch_on_hover(true);
|
||||||
|
file_menu->set_shortcut_context(this);
|
||||||
|
menu_hb->add_child(file_menu);
|
||||||
|
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script...")), FILE_NEW);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script...")), FILE_NEW);
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New Text File...")), FILE_NEW_TEXTFILE);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New Text File...")), FILE_NEW_TEXTFILE);
|
||||||
|
@ -3359,10 +3360,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||||
file_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option));
|
file_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option));
|
||||||
|
|
||||||
script_search_menu = memnew(MenuButton);
|
script_search_menu = memnew(MenuButton);
|
||||||
menu_hb->add_child(script_search_menu);
|
|
||||||
script_search_menu->set_text(TTR("Search"));
|
script_search_menu->set_text(TTR("Search"));
|
||||||
script_search_menu->set_switch_on_hover(true);
|
script_search_menu->set_switch_on_hover(true);
|
||||||
|
script_search_menu->set_shortcut_context(this);
|
||||||
script_search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option));
|
script_search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option));
|
||||||
|
menu_hb->add_child(script_search_menu);
|
||||||
|
|
||||||
MenuButton *debug_menu = memnew(MenuButton);
|
MenuButton *debug_menu = memnew(MenuButton);
|
||||||
menu_hb->add_child(debug_menu);
|
menu_hb->add_child(debug_menu);
|
||||||
|
|
|
@ -402,7 +402,7 @@ class ScriptEditor : public PanelContainer {
|
||||||
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
||||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
||||||
|
|
||||||
void _unhandled_input(const Ref<InputEvent> &p_event);
|
void _unhandled_key_input(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
void _script_list_gui_input(const Ref<InputEvent> &ev);
|
void _script_list_gui_input(const Ref<InputEvent> &ev);
|
||||||
void _make_script_list_context_menu();
|
void _make_script_list_context_menu();
|
||||||
|
|
|
@ -1849,6 +1849,7 @@ ScriptTextEditor::ScriptTextEditor() {
|
||||||
edit_menu = memnew(MenuButton);
|
edit_menu = memnew(MenuButton);
|
||||||
edit_menu->set_text(TTR("Edit"));
|
edit_menu->set_text(TTR("Edit"));
|
||||||
edit_menu->set_switch_on_hover(true);
|
edit_menu->set_switch_on_hover(true);
|
||||||
|
edit_menu->set_shortcut_context(this);
|
||||||
|
|
||||||
convert_case = memnew(PopupMenu);
|
convert_case = memnew(PopupMenu);
|
||||||
convert_case->set_name("convert_case");
|
convert_case->set_name("convert_case");
|
||||||
|
@ -1868,10 +1869,12 @@ ScriptTextEditor::ScriptTextEditor() {
|
||||||
search_menu = memnew(MenuButton);
|
search_menu = memnew(MenuButton);
|
||||||
search_menu->set_text(TTR("Search"));
|
search_menu->set_text(TTR("Search"));
|
||||||
search_menu->set_switch_on_hover(true);
|
search_menu->set_switch_on_hover(true);
|
||||||
|
search_menu->set_shortcut_context(this);
|
||||||
|
|
||||||
goto_menu = memnew(MenuButton);
|
goto_menu = memnew(MenuButton);
|
||||||
goto_menu->set_text(TTR("Go To"));
|
goto_menu->set_text(TTR("Go To"));
|
||||||
goto_menu->set_switch_on_hover(true);
|
goto_menu->set_switch_on_hover(true);
|
||||||
|
goto_menu->set_shortcut_context(this);
|
||||||
|
|
||||||
bookmarks_menu = memnew(PopupMenu);
|
bookmarks_menu = memnew(PopupMenu);
|
||||||
bookmarks_menu->set_name("Bookmarks");
|
bookmarks_menu->set_name("Bookmarks");
|
||||||
|
|
|
@ -581,6 +581,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
|
||||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||||
|
|
||||||
edit_menu = memnew(MenuButton);
|
edit_menu = memnew(MenuButton);
|
||||||
|
edit_menu->set_shortcut_context(this);
|
||||||
edit_menu->set_text(TTR("Edit"));
|
edit_menu->set_text(TTR("Edit"));
|
||||||
edit_menu->set_switch_on_hover(true);
|
edit_menu->set_switch_on_hover(true);
|
||||||
|
|
||||||
|
@ -605,6 +606,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
|
||||||
edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
||||||
|
|
||||||
search_menu = memnew(MenuButton);
|
search_menu = memnew(MenuButton);
|
||||||
|
search_menu->set_shortcut_context(this);
|
||||||
search_menu->set_text(TTR("Search"));
|
search_menu->set_text(TTR("Search"));
|
||||||
search_menu->set_switch_on_hover(true);
|
search_menu->set_switch_on_hover(true);
|
||||||
|
|
||||||
|
@ -615,6 +617,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
|
||||||
search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
||||||
|
|
||||||
MenuButton *goto_menu = memnew(MenuButton);
|
MenuButton *goto_menu = memnew(MenuButton);
|
||||||
|
goto_menu->set_shortcut_context(this);
|
||||||
goto_menu->set_text(TTR("Go To"));
|
goto_menu->set_text(TTR("Go To"));
|
||||||
goto_menu->set_switch_on_hover(true);
|
goto_menu->set_switch_on_hover(true);
|
||||||
goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
|
||||||
|
|
|
@ -563,6 +563,7 @@ TextEditor::TextEditor() {
|
||||||
edit_hb = memnew(HBoxContainer);
|
edit_hb = memnew(HBoxContainer);
|
||||||
|
|
||||||
search_menu = memnew(MenuButton);
|
search_menu = memnew(MenuButton);
|
||||||
|
search_menu->set_shortcut_context(this);
|
||||||
edit_hb->add_child(search_menu);
|
edit_hb->add_child(search_menu);
|
||||||
search_menu->set_text(TTR("Search"));
|
search_menu->set_text(TTR("Search"));
|
||||||
search_menu->set_switch_on_hover(true);
|
search_menu->set_switch_on_hover(true);
|
||||||
|
@ -577,6 +578,7 @@ TextEditor::TextEditor() {
|
||||||
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
|
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
|
||||||
|
|
||||||
edit_menu = memnew(MenuButton);
|
edit_menu = memnew(MenuButton);
|
||||||
|
edit_menu->set_shortcut_context(this);
|
||||||
edit_hb->add_child(edit_menu);
|
edit_hb->add_child(edit_menu);
|
||||||
edit_menu->set_text(TTR("Edit"));
|
edit_menu->set_text(TTR("Edit"));
|
||||||
edit_menu->set_switch_on_hover(true);
|
edit_menu->set_switch_on_hover(true);
|
||||||
|
@ -631,6 +633,7 @@ TextEditor::TextEditor() {
|
||||||
set_syntax_highlighter(plain_highlighter);
|
set_syntax_highlighter(plain_highlighter);
|
||||||
|
|
||||||
MenuButton *goto_menu = memnew(MenuButton);
|
MenuButton *goto_menu = memnew(MenuButton);
|
||||||
|
goto_menu->set_shortcut_context(this);
|
||||||
edit_hb->add_child(goto_menu);
|
edit_hb->add_child(goto_menu);
|
||||||
goto_menu->set_text(TTR("Go To"));
|
goto_menu->set_text(TTR("Go To"));
|
||||||
goto_menu->set_switch_on_hover(true);
|
goto_menu->set_switch_on_hover(true);
|
||||||
|
|
|
@ -2109,6 +2109,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
paint_button = memnew(Button);
|
paint_button = memnew(Button);
|
||||||
paint_button->set_flat(true);
|
paint_button->set_flat(true);
|
||||||
paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P));
|
paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P));
|
||||||
|
paint_button->set_shortcut_context(this);
|
||||||
paint_button->set_tooltip(TTR("RMB: Erase"));
|
paint_button->set_tooltip(TTR("RMB: Erase"));
|
||||||
paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE));
|
paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE));
|
||||||
paint_button->set_toggle_mode(true);
|
paint_button->set_toggle_mode(true);
|
||||||
|
@ -2117,6 +2118,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
line_button = memnew(Button);
|
line_button = memnew(Button);
|
||||||
line_button->set_flat(true);
|
line_button->set_flat(true);
|
||||||
line_button->set_shortcut(ED_SHORTCUT("tile_map_editor/line_fill", TTR("Line Fill"), KEY_L));
|
line_button->set_shortcut(ED_SHORTCUT("tile_map_editor/line_fill", TTR("Line Fill"), KEY_L));
|
||||||
|
line_button->set_shortcut_context(this);
|
||||||
line_button->set_tooltip(TTR("RMB: Erase"));
|
line_button->set_tooltip(TTR("RMB: Erase"));
|
||||||
line_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_LINE_PAINT));
|
line_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_LINE_PAINT));
|
||||||
line_button->set_toggle_mode(true);
|
line_button->set_toggle_mode(true);
|
||||||
|
@ -2125,6 +2127,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
rectangle_button = memnew(Button);
|
rectangle_button = memnew(Button);
|
||||||
rectangle_button->set_flat(true);
|
rectangle_button->set_flat(true);
|
||||||
rectangle_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rectangle_fill", TTR("Rectangle Fill"), KEY_O));
|
rectangle_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rectangle_fill", TTR("Rectangle Fill"), KEY_O));
|
||||||
|
rectangle_button->set_shortcut_context(this);
|
||||||
rectangle_button->set_tooltip(TTR("Shift+LMB: Keep 1:1 proporsions\nRMB: Erase"));
|
rectangle_button->set_tooltip(TTR("Shift+LMB: Keep 1:1 proporsions\nRMB: Erase"));
|
||||||
rectangle_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_RECTANGLE_PAINT));
|
rectangle_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_RECTANGLE_PAINT));
|
||||||
rectangle_button->set_toggle_mode(true);
|
rectangle_button->set_toggle_mode(true);
|
||||||
|
@ -2133,6 +2136,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
bucket_fill_button = memnew(Button);
|
bucket_fill_button = memnew(Button);
|
||||||
bucket_fill_button->set_flat(true);
|
bucket_fill_button->set_flat(true);
|
||||||
bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_B));
|
bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_B));
|
||||||
|
bucket_fill_button->set_shortcut_context(this);
|
||||||
bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET));
|
bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET));
|
||||||
bucket_fill_button->set_toggle_mode(true);
|
bucket_fill_button->set_toggle_mode(true);
|
||||||
toolbar->add_child(bucket_fill_button);
|
toolbar->add_child(bucket_fill_button);
|
||||||
|
@ -2140,6 +2144,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
picker_button = memnew(Button);
|
picker_button = memnew(Button);
|
||||||
picker_button->set_flat(true);
|
picker_button->set_flat(true);
|
||||||
picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I));
|
picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I));
|
||||||
|
picker_button->set_shortcut_context(this);
|
||||||
picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING));
|
picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING));
|
||||||
picker_button->set_toggle_mode(true);
|
picker_button->set_toggle_mode(true);
|
||||||
toolbar->add_child(picker_button);
|
toolbar->add_child(picker_button);
|
||||||
|
@ -2147,6 +2152,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
select_button = memnew(Button);
|
select_button = memnew(Button);
|
||||||
select_button->set_flat(true);
|
select_button->set_flat(true);
|
||||||
select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M));
|
select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M));
|
||||||
|
select_button->set_shortcut_context(this);
|
||||||
select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING));
|
select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING));
|
||||||
select_button->set_toggle_mode(true);
|
select_button->set_toggle_mode(true);
|
||||||
toolbar->add_child(select_button);
|
toolbar->add_child(select_button);
|
||||||
|
@ -2172,9 +2178,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
|
|
||||||
// Menu.
|
// Menu.
|
||||||
options = memnew(MenuButton);
|
options = memnew(MenuButton);
|
||||||
|
options->set_shortcut_context(this);
|
||||||
options->set_text("TileMap");
|
options->set_text("TileMap");
|
||||||
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons"));
|
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons"));
|
||||||
options->set_process_unhandled_key_input(false);
|
|
||||||
toolbar_right->add_child(options);
|
toolbar_right->add_child(options);
|
||||||
|
|
||||||
PopupMenu *p = options->get_popup();
|
PopupMenu *p = options->get_popup();
|
||||||
|
@ -2191,6 +2197,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
rotate_left_button->set_focus_mode(FOCUS_NONE);
|
rotate_left_button->set_focus_mode(FOCUS_NONE);
|
||||||
rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1));
|
rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1));
|
||||||
rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A));
|
rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A));
|
||||||
|
rotate_left_button->set_shortcut_context(this);
|
||||||
tool_hb->add_child(rotate_left_button);
|
tool_hb->add_child(rotate_left_button);
|
||||||
|
|
||||||
rotate_right_button = memnew(Button);
|
rotate_right_button = memnew(Button);
|
||||||
|
@ -2199,6 +2206,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
rotate_right_button->set_focus_mode(FOCUS_NONE);
|
rotate_right_button->set_focus_mode(FOCUS_NONE);
|
||||||
rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1));
|
rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1));
|
||||||
rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S));
|
rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S));
|
||||||
|
rotate_right_button->set_shortcut_context(this);
|
||||||
tool_hb->add_child(rotate_right_button);
|
tool_hb->add_child(rotate_right_button);
|
||||||
|
|
||||||
flip_horizontal_button = memnew(Button);
|
flip_horizontal_button = memnew(Button);
|
||||||
|
@ -2207,6 +2215,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
flip_horizontal_button->set_focus_mode(FOCUS_NONE);
|
flip_horizontal_button->set_focus_mode(FOCUS_NONE);
|
||||||
flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal));
|
flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal));
|
||||||
flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X));
|
flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X));
|
||||||
|
flip_horizontal_button->set_shortcut_context(this);
|
||||||
tool_hb->add_child(flip_horizontal_button);
|
tool_hb->add_child(flip_horizontal_button);
|
||||||
|
|
||||||
flip_vertical_button = memnew(Button);
|
flip_vertical_button = memnew(Button);
|
||||||
|
@ -2215,6 +2224,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
flip_vertical_button->set_focus_mode(FOCUS_NONE);
|
flip_vertical_button->set_focus_mode(FOCUS_NONE);
|
||||||
flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical));
|
flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical));
|
||||||
flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z));
|
flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z));
|
||||||
|
flip_vertical_button->set_shortcut_context(this);
|
||||||
tool_hb->add_child(flip_vertical_button);
|
tool_hb->add_child(flip_vertical_button);
|
||||||
|
|
||||||
clear_transform_button = memnew(Button);
|
clear_transform_button = memnew(Button);
|
||||||
|
@ -2223,6 +2233,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||||
clear_transform_button->set_focus_mode(FOCUS_NONE);
|
clear_transform_button->set_focus_mode(FOCUS_NONE);
|
||||||
clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform));
|
clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform));
|
||||||
clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W));
|
clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W));
|
||||||
|
clear_transform_button->set_shortcut_context(this);
|
||||||
tool_hb->add_child(clear_transform_button);
|
tool_hb->add_child(clear_transform_button);
|
||||||
|
|
||||||
clear_transform_button->set_disabled(true);
|
clear_transform_button->set_disabled(true);
|
||||||
|
|
|
@ -414,6 +414,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
|
||||||
tool_hb->move_child(tools[SELECT_NEXT], WORKSPACE_CREATE_SINGLE);
|
tool_hb->move_child(tools[SELECT_NEXT], WORKSPACE_CREATE_SINGLE);
|
||||||
tools[SELECT_NEXT]->set_flat(true);
|
tools[SELECT_NEXT]->set_flat(true);
|
||||||
tools[SELECT_NEXT]->set_shortcut(ED_SHORTCUT("tileset_editor/next_shape", TTR("Next Coordinate"), KEY_PAGEDOWN));
|
tools[SELECT_NEXT]->set_shortcut(ED_SHORTCUT("tileset_editor/next_shape", TTR("Next Coordinate"), KEY_PAGEDOWN));
|
||||||
|
tools[SELECT_NEXT]->set_shortcut_context(this);
|
||||||
tools[SELECT_NEXT]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_NEXT));
|
tools[SELECT_NEXT]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_NEXT));
|
||||||
tools[SELECT_NEXT]->set_tooltip(TTR("Select the next shape, subtile, or Tile."));
|
tools[SELECT_NEXT]->set_tooltip(TTR("Select the next shape, subtile, or Tile."));
|
||||||
tools[SELECT_PREVIOUS] = memnew(Button);
|
tools[SELECT_PREVIOUS] = memnew(Button);
|
||||||
|
@ -421,6 +422,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
|
||||||
tool_hb->move_child(tools[SELECT_PREVIOUS], WORKSPACE_CREATE_SINGLE);
|
tool_hb->move_child(tools[SELECT_PREVIOUS], WORKSPACE_CREATE_SINGLE);
|
||||||
tools[SELECT_PREVIOUS]->set_flat(true);
|
tools[SELECT_PREVIOUS]->set_flat(true);
|
||||||
tools[SELECT_PREVIOUS]->set_shortcut(ED_SHORTCUT("tileset_editor/previous_shape", TTR("Previous Coordinate"), KEY_PAGEUP));
|
tools[SELECT_PREVIOUS]->set_shortcut(ED_SHORTCUT("tileset_editor/previous_shape", TTR("Previous Coordinate"), KEY_PAGEUP));
|
||||||
|
tools[SELECT_PREVIOUS]->set_shortcut_context(this);
|
||||||
tools[SELECT_PREVIOUS]->set_tooltip(TTR("Select the previous shape, subtile, or Tile."));
|
tools[SELECT_PREVIOUS]->set_tooltip(TTR("Select the previous shape, subtile, or Tile."));
|
||||||
tools[SELECT_PREVIOUS]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_PREVIOUS));
|
tools[SELECT_PREVIOUS]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_PREVIOUS));
|
||||||
|
|
||||||
|
@ -467,6 +469,16 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
|
||||||
tool_editmode[EDITMODE_ICON]->set_shortcut(ED_SHORTCUT("tileset_editor/editmode_icon", TTR("Icon Mode"), KEY_7));
|
tool_editmode[EDITMODE_ICON]->set_shortcut(ED_SHORTCUT("tileset_editor/editmode_icon", TTR("Icon Mode"), KEY_7));
|
||||||
tool_editmode[EDITMODE_Z_INDEX]->set_shortcut(ED_SHORTCUT("tileset_editor/editmode_z_index", TTR("Z Index Mode"), KEY_8));
|
tool_editmode[EDITMODE_Z_INDEX]->set_shortcut(ED_SHORTCUT("tileset_editor/editmode_z_index", TTR("Z Index Mode"), KEY_8));
|
||||||
|
|
||||||
|
tool_editmode[EDITMODE_REGION]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_REGION]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_COLLISION]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_OCCLUSION]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_NAVIGATION]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_BITMASK]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_PRIORITY]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_ICON]->set_shortcut_context(this);
|
||||||
|
tool_editmode[EDITMODE_Z_INDEX]->set_shortcut_context(this);
|
||||||
|
|
||||||
main_vb->add_child(tool_hb);
|
main_vb->add_child(tool_hb);
|
||||||
separator_editmode = memnew(HSeparator);
|
separator_editmode = memnew(HSeparator);
|
||||||
main_vb->add_child(separator_editmode);
|
main_vb->add_child(separator_editmode);
|
||||||
|
|
|
@ -1854,7 +1854,7 @@ void ProjectManager::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
set_process_unhandled_input(is_visible_in_tree());
|
set_process_unhandled_key_input(is_visible_in_tree());
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
||||||
_dim_window();
|
_dim_window();
|
||||||
|
@ -1893,7 +1893,7 @@ void ProjectManager::_update_project_buttons() {
|
||||||
erase_missing_btn->set_disabled(!_project_list->is_any_project_missing());
|
erase_missing_btn->set_disabled(!_project_list->is_any_project_missing());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
|
void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventKey> k = p_ev;
|
Ref<InputEventKey> k = p_ev;
|
||||||
|
|
||||||
if (k.is_valid()) {
|
if (k.is_valid()) {
|
||||||
|
@ -2357,7 +2357,7 @@ void ProjectManager::_on_search_term_changed(const String &p_term) {
|
||||||
|
|
||||||
void ProjectManager::_bind_methods() {
|
void ProjectManager::_bind_methods() {
|
||||||
ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
|
ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
|
||||||
ClassDB::bind_method("_unhandled_input", &ProjectManager::_unhandled_input);
|
ClassDB::bind_method("_unhandled_key_input", &ProjectManager::_unhandled_key_input);
|
||||||
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
|
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ class ProjectManager : public Control {
|
||||||
void _install_project(const String &p_zip_path, const String &p_title);
|
void _install_project(const String &p_zip_path, const String &p_title);
|
||||||
|
|
||||||
void _dim_window();
|
void _dim_window();
|
||||||
void _unhandled_input(const Ref<InputEvent> &p_ev);
|
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
|
||||||
void _files_dropped(PackedStringArray p_files, int p_screen);
|
void _files_dropped(PackedStringArray p_files, int p_screen);
|
||||||
|
|
||||||
void _on_order_option_changed(int p_idx);
|
void _on_order_option_changed(int p_idx);
|
||||||
|
|
|
@ -114,7 +114,12 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||||
_tool_selected(TOOL_COPY_NODE_PATH);
|
_tool_selected(TOOL_COPY_NODE_PATH);
|
||||||
} else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) {
|
} else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) {
|
||||||
_tool_selected(TOOL_ERASE);
|
_tool_selected(TOOL_ERASE);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tool selection was successful, accept the event to stop propagation.
|
||||||
|
accept_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::instance(const String &p_file) {
|
void SceneTreeDock::instance(const String &p_file) {
|
||||||
|
@ -2957,6 +2962,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||||
quick_open = memnew(EditorQuickOpen);
|
quick_open = memnew(EditorQuickOpen);
|
||||||
add_child(quick_open);
|
add_child(quick_open);
|
||||||
quick_open->connect("quick_open", callable_mp(this, &SceneTreeDock::_quick_open));
|
quick_open->connect("quick_open", callable_mp(this, &SceneTreeDock::_quick_open));
|
||||||
|
|
||||||
set_process_unhandled_key_input(true);
|
set_process_unhandled_key_input(true);
|
||||||
|
|
||||||
delete_dialog = memnew(ConfirmationDialog);
|
delete_dialog = memnew(ConfirmationDialog);
|
||||||
|
|
|
@ -4729,6 +4729,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
||||||
saved_position = Vector2(0, 0);
|
saved_position = Vector2(0, 0);
|
||||||
|
|
||||||
edit_menu = memnew(MenuButton);
|
edit_menu = memnew(MenuButton);
|
||||||
|
edit_menu->set_shortcut_context(this);
|
||||||
edit_menu->set_text(TTR("Edit"));
|
edit_menu->set_text(TTR("Edit"));
|
||||||
edit_menu->set_switch_on_hover(true);
|
edit_menu->set_switch_on_hover(true);
|
||||||
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/delete_selected"), EDIT_DELETE_NODES);
|
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/delete_selected"), EDIT_DELETE_NODES);
|
||||||
|
@ -4930,7 +4931,6 @@ VisualScriptEditor::VisualScriptEditor() {
|
||||||
updating_members = false;
|
updating_members = false;
|
||||||
|
|
||||||
set_process_input(true);
|
set_process_input(true);
|
||||||
set_process_unhandled_input(true);
|
|
||||||
|
|
||||||
default_value_edit = memnew(CustomPropertyEditor);
|
default_value_edit = memnew(CustomPropertyEditor);
|
||||||
add_child(default_value_edit);
|
add_child(default_value_edit);
|
||||||
|
|
|
@ -317,16 +317,21 @@ bool BaseButton::is_keep_pressed_outside() const {
|
||||||
|
|
||||||
void BaseButton::set_shortcut(const Ref<Shortcut> &p_shortcut) {
|
void BaseButton::set_shortcut(const Ref<Shortcut> &p_shortcut) {
|
||||||
shortcut = p_shortcut;
|
shortcut = p_shortcut;
|
||||||
set_process_unhandled_input(shortcut.is_valid());
|
set_process_unhandled_key_input(shortcut.is_valid());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Shortcut> BaseButton::get_shortcut() const {
|
Ref<Shortcut> BaseButton::get_shortcut() const {
|
||||||
return shortcut;
|
return shortcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseButton::_unhandled_input(Ref<InputEvent> p_event) {
|
void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||||
|
if (!_is_focus_owner_in_shorcut_context()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_disabled() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) {
|
if (!is_disabled() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) {
|
||||||
on_action_event(p_event);
|
on_action_event(p_event);
|
||||||
|
accept_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,9 +365,34 @@ Ref<ButtonGroup> BaseButton::get_button_group() const {
|
||||||
return button_group;
|
return button_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseButton::set_shortcut_context(Node *p_node) {
|
||||||
|
ERR_FAIL_NULL_MSG(p_node, "Shortcut context node can't be null.");
|
||||||
|
shortcut_context = p_node->get_instance_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
Node *BaseButton::get_shortcut_context() const {
|
||||||
|
Object *ctx_obj = ObjectDB::get_instance(shortcut_context);
|
||||||
|
Node *ctx_node = Object::cast_to<Node>(ctx_obj);
|
||||||
|
|
||||||
|
return ctx_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BaseButton::_is_focus_owner_in_shorcut_context() const {
|
||||||
|
if (shortcut_context == ObjectID()) {
|
||||||
|
// No context, therefore global - always "in" context.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node *ctx_node = get_shortcut_context();
|
||||||
|
Control *vp_focus = get_focus_owner();
|
||||||
|
|
||||||
|
// If the context is valid and the viewport focus is valid, check if the context is the focus or is a parent of it.
|
||||||
|
return ctx_node && vp_focus && (ctx_node == vp_focus || ctx_node->is_a_parent_of(vp_focus));
|
||||||
|
}
|
||||||
|
|
||||||
void BaseButton::_bind_methods() {
|
void BaseButton::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("_gui_input"), &BaseButton::_gui_input);
|
ClassDB::bind_method(D_METHOD("_gui_input"), &BaseButton::_gui_input);
|
||||||
ClassDB::bind_method(D_METHOD("_unhandled_input"), &BaseButton::_unhandled_input);
|
ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &BaseButton::_unhandled_key_input);
|
||||||
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed);
|
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed);
|
||||||
ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed);
|
ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed);
|
||||||
ClassDB::bind_method(D_METHOD("is_hovered"), &BaseButton::is_hovered);
|
ClassDB::bind_method(D_METHOD("is_hovered"), &BaseButton::is_hovered);
|
||||||
|
@ -386,6 +416,9 @@ void BaseButton::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group);
|
ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group);
|
||||||
ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group);
|
ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_shortcut_context", "node"), &BaseButton::set_shortcut_context);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_shortcut_context"), &BaseButton::get_shortcut_context);
|
||||||
|
|
||||||
BIND_VMETHOD(MethodInfo("_pressed"));
|
BIND_VMETHOD(MethodInfo("_pressed"));
|
||||||
BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "button_pressed")));
|
BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "button_pressed")));
|
||||||
|
|
||||||
|
@ -425,6 +458,7 @@ BaseButton::BaseButton() {
|
||||||
set_focus_mode(FOCUS_ALL);
|
set_focus_mode(FOCUS_ALL);
|
||||||
action_mode = ACTION_MODE_BUTTON_RELEASE;
|
action_mode = ACTION_MODE_BUTTON_RELEASE;
|
||||||
button_mask = BUTTON_MASK_LEFT;
|
button_mask = BUTTON_MASK_LEFT;
|
||||||
|
shortcut_context = ObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseButton::~BaseButton() {
|
BaseButton::~BaseButton() {
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
bool shortcut_in_tooltip;
|
bool shortcut_in_tooltip;
|
||||||
bool keep_pressed_outside;
|
bool keep_pressed_outside;
|
||||||
Ref<Shortcut> shortcut;
|
Ref<Shortcut> shortcut;
|
||||||
|
ObjectID shortcut_context;
|
||||||
|
|
||||||
ActionMode action_mode;
|
ActionMode action_mode;
|
||||||
struct Status {
|
struct Status {
|
||||||
|
@ -75,9 +76,11 @@ protected:
|
||||||
virtual void toggled(bool p_pressed);
|
virtual void toggled(bool p_pressed);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
virtual void _gui_input(Ref<InputEvent> p_event);
|
virtual void _gui_input(Ref<InputEvent> p_event);
|
||||||
virtual void _unhandled_input(Ref<InputEvent> p_event);
|
virtual void _unhandled_key_input(Ref<InputEvent> p_event);
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|
||||||
|
bool _is_focus_owner_in_shorcut_context() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum DrawMode {
|
enum DrawMode {
|
||||||
DRAW_NORMAL,
|
DRAW_NORMAL,
|
||||||
|
@ -122,6 +125,9 @@ public:
|
||||||
void set_button_group(const Ref<ButtonGroup> &p_group);
|
void set_button_group(const Ref<ButtonGroup> &p_group);
|
||||||
Ref<ButtonGroup> get_button_group() const;
|
Ref<ButtonGroup> get_button_group() const;
|
||||||
|
|
||||||
|
void set_shortcut_context(Node *p_node);
|
||||||
|
Node *get_shortcut_context() const;
|
||||||
|
|
||||||
BaseButton();
|
BaseButton();
|
||||||
~BaseButton();
|
~BaseButton();
|
||||||
};
|
};
|
||||||
|
|
|
@ -2983,6 +2983,7 @@ void Control::_bind_methods() {
|
||||||
BIND_VMETHOD(MethodInfo("_structured_text_parser", PropertyInfo(Variant::ARRAY, "args"), PropertyInfo(Variant::STRING, "text")));
|
BIND_VMETHOD(MethodInfo("_structured_text_parser", PropertyInfo(Variant::ARRAY, "args"), PropertyInfo(Variant::STRING, "text")));
|
||||||
|
|
||||||
BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||||
|
BIND_VMETHOD(MethodInfo("_unhandled_key_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size"));
|
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size"));
|
||||||
|
|
||||||
MethodInfo get_drag_data = MethodInfo("get_drag_data", PropertyInfo(Variant::VECTOR2, "position"));
|
MethodInfo get_drag_data = MethodInfo("get_drag_data", PropertyInfo(Variant::VECTOR2, "position"));
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
#include "scene/main/window.h"
|
#include "scene/main/window.h"
|
||||||
|
|
||||||
void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
|
void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||||
|
if (!_is_focus_owner_in_shorcut_context()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (disable_shortcuts) {
|
if (disable_shortcuts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -43,9 +47,6 @@ void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this));
|
|
||||||
//if (popup->activate_item_by_event(p_event, global_only))
|
|
||||||
// accept_event();
|
|
||||||
if (popup->activate_item_by_event(p_event, false)) {
|
if (popup->activate_item_by_event(p_event, false)) {
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,6 @@ void MenuButton::_notification(int p_what) {
|
||||||
|
|
||||||
void MenuButton::_bind_methods() {
|
void MenuButton::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);
|
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);
|
||||||
ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &MenuButton::_unhandled_key_input);
|
|
||||||
ClassDB::bind_method(D_METHOD("_set_items"), &MenuButton::_set_items);
|
ClassDB::bind_method(D_METHOD("_set_items"), &MenuButton::_set_items);
|
||||||
ClassDB::bind_method(D_METHOD("_get_items"), &MenuButton::_get_items);
|
ClassDB::bind_method(D_METHOD("_get_items"), &MenuButton::_get_items);
|
||||||
ClassDB::bind_method(D_METHOD("set_switch_on_hover", "enable"), &MenuButton::set_switch_on_hover);
|
ClassDB::bind_method(D_METHOD("set_switch_on_hover", "enable"), &MenuButton::set_switch_on_hover);
|
||||||
|
@ -123,6 +123,7 @@ MenuButton::MenuButton() {
|
||||||
set_toggle_mode(true);
|
set_toggle_mode(true);
|
||||||
set_disable_shortcuts(false);
|
set_disable_shortcuts(false);
|
||||||
set_process_unhandled_key_input(true);
|
set_process_unhandled_key_input(true);
|
||||||
|
set_focus_mode(FOCUS_NONE);
|
||||||
set_action_mode(ACTION_MODE_BUTTON_PRESS);
|
set_action_mode(ACTION_MODE_BUTTON_PRESS);
|
||||||
|
|
||||||
popup = memnew(PopupMenu);
|
popup = memnew(PopupMenu);
|
||||||
|
|
|
@ -42,7 +42,6 @@ class MenuButton : public Button {
|
||||||
bool disable_shortcuts;
|
bool disable_shortcuts;
|
||||||
PopupMenu *popup;
|
PopupMenu *popup;
|
||||||
|
|
||||||
void _unhandled_key_input(Ref<InputEvent> p_event);
|
|
||||||
Array _get_items() const;
|
Array _get_items() const;
|
||||||
void _set_items(const Array &p_items);
|
void _set_items(const Array &p_items);
|
||||||
|
|
||||||
|
@ -51,6 +50,7 @@ class MenuButton : public Button {
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
virtual void _unhandled_key_input(Ref<InputEvent> p_event) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void pressed() override;
|
virtual void pressed() override;
|
||||||
|
|
|
@ -1809,15 +1809,7 @@ bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_che
|
||||||
void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
ERR_FAIL_COND(p_event.is_null());
|
ERR_FAIL_COND(p_event.is_null());
|
||||||
|
|
||||||
//?
|
|
||||||
/*
|
|
||||||
if (!is_visible()) {
|
|
||||||
return; //simple and plain
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
gui.key_event_accepted = false;
|
gui.key_event_accepted = false;
|
||||||
|
|
||||||
|
@ -2005,7 +1997,6 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
gui.key_event_accepted = false;
|
gui.key_event_accepted = false;
|
||||||
Point2 mpos = mm->get_position();
|
Point2 mpos = mm->get_position();
|
||||||
|
@ -3048,7 +3039,10 @@ void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coor
|
||||||
ev = p_event;
|
ev = p_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unhandled Input
|
||||||
get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this);
|
get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this);
|
||||||
|
|
||||||
|
// Unhandled key Input - used for performance reasons - This is called a lot less then _unhandled_input since it ignores MouseMotion, etc
|
||||||
if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != nullptr) {
|
if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != nullptr) {
|
||||||
get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this);
|
get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue