diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_spin_slider.cpp | 55 | ||||
-rw-r--r-- | editor/editor_spin_slider.h | 1 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_data_editors.cpp | 2 |
4 files changed, 58 insertions, 2 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index afeba4f6fb..1890814da9 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -191,6 +191,59 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) { } } +void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) { + Ref<InputEventKey> k = p_event; + if (k.is_valid() && k->is_pressed()) { + double step = get_step(); + double real_step = step; + if (step < 1) { + double divisor = 1.0 / get_step(); + + if (trunc(divisor) == divisor) { + step = 1.0; + } + } + + if (k->is_ctrl_pressed()) { + step *= 100.0; + } else if (k->is_shift_pressed()) { + step *= 10.0; + } else if (k->is_alt_pressed()) { + step *= 0.1; + } + + uint32_t code = k->get_keycode(); + switch (code) { + case KEY_UP: { + _evaluate_input_text(); + + double last_value = get_value(); + set_value(last_value + step); + double new_value = get_value(); + + if (new_value < CLAMP(last_value + step, get_min(), get_max())) { + set_value(last_value + real_step); + } + + value_input->set_text(get_text_value()); + } break; + case KEY_DOWN: { + _evaluate_input_text(); + + double last_value = get_value(); + set_value(last_value - step); + double new_value = get_value(); + + if (new_value > CLAMP(last_value - step, get_min(), get_max())) { + set_value(last_value - real_step); + } + + value_input->set_text(get_text_value()); + } break; + } + } +} + void EditorSpinSlider::_update_value_input_stylebox() { if (!value_input) { return; @@ -585,11 +638,13 @@ void EditorSpinSlider::_ensure_input_popup() { value_input_popup->connect("popup_hide", callable_mp(this, &EditorSpinSlider::_value_input_closed)); value_input->connect("text_submitted", callable_mp(this, &EditorSpinSlider::_value_input_submitted)); value_input->connect("focus_exited", callable_mp(this, &EditorSpinSlider::_value_focus_exited)); + value_input->connect("gui_input", callable_mp(this, &EditorSpinSlider::_value_input_gui_input)); if (is_inside_tree()) { _update_value_input_stylebox(); } } + EditorSpinSlider::EditorSpinSlider() { flat = false; grabbing_spinner_attempt = false; diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h index 1bf8e8eef9..7e10764491 100644 --- a/editor/editor_spin_slider.h +++ b/editor/editor_spin_slider.h @@ -71,6 +71,7 @@ class EditorSpinSlider : public Range { void _value_input_closed(); void _value_input_submitted(const String &); void _value_focus_exited(); + void _value_input_gui_input(const Ref<InputEvent> &p_event); bool hide_slider; bool flat; diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index b646b3361d..cb88e9d75e 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -743,7 +743,7 @@ void ExportTemplateManager::_notification(int p_what) { current_missing_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); current_installed_label->add_theme_color_override("font_color", get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))); - mirror_options_button->set_icon(get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons"))); + mirror_options_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); } break; case NOTIFICATION_VISIBILITY_CHANGED: { diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index ea7ca787c8..216c5f7c7d 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -622,7 +622,7 @@ void GenericTilePolygonEditor::_notification(int p_what) { button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons"))); button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons"))); button_pixel_snap->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); - button_advanced_menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons"))); + button_advanced_menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); break; } } |