mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Use InputMap actions consistently across all LineEdit's that filter an underlying Tree or ItemList.
- Instead of checking for Key::UP, Key::DOWN, Key::PAGEUP, Key::PAGEDOWN etc., we rather check for the action like 'ui_up' or 'ui_down'. - Also use AcceptDialog's 'register_text_enter' functionality to consistently close a dialog when ENTER is pressed while the LineEdit has focus (instead of redirecting ENTER keys to e.g. the underlying Tree). - Unify the LineEdit filter behavior for the SceneTreeDialog and corresponding usages - Improve OK Button disablement (something should be selected)
This commit is contained in:
@@ -7178,24 +7178,6 @@ void AnimationTrackEditor::_pick_track_select_recursive(TreeItem *p_item, const
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_pick_track_filter_input(const Ref<InputEvent> &p_ie) {
|
||||
Ref<InputEventKey> k = p_ie;
|
||||
|
||||
if (k.is_valid()) {
|
||||
switch (k->get_keycode()) {
|
||||
case Key::UP:
|
||||
case Key::DOWN:
|
||||
case Key::PAGEUP:
|
||||
case Key::PAGEDOWN: {
|
||||
pick_track->get_scene_tree()->get_scene_tree()->gui_input(k);
|
||||
pick_track->get_filter_line_edit()->accept_event();
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnimationTrackEditor::AnimationTrackEditor() {
|
||||
main_panel = memnew(PanelContainer);
|
||||
main_panel->set_focus_mode(FOCUS_ALL); // Allow panel to have focus so that shortcuts work as expected.
|
||||
@@ -7413,11 +7395,9 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
||||
|
||||
pick_track = memnew(SceneTreeDialog);
|
||||
add_child(pick_track);
|
||||
pick_track->register_text_enter(pick_track->get_filter_line_edit());
|
||||
pick_track->set_title(TTR("Pick a node to animate:"));
|
||||
pick_track->connect("selected", callable_mp(this, &AnimationTrackEditor::_new_track_node_selected));
|
||||
pick_track->get_filter_line_edit()->connect(SceneStringName(text_changed), callable_mp(this, &AnimationTrackEditor::_pick_track_filter_text_changed));
|
||||
pick_track->get_filter_line_edit()->connect(SceneStringName(gui_input), callable_mp(this, &AnimationTrackEditor::_pick_track_filter_input));
|
||||
|
||||
prop_selector = memnew(PropertySelector);
|
||||
add_child(prop_selector);
|
||||
|
||||
Reference in New Issue
Block a user