diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_about.cpp | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 58 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 25 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 23 | ||||
-rw-r--r-- | editor/project_settings_editor.h | 1 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 50 |
7 files changed, 109 insertions, 51 deletions
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index b2567249d8..8a03292708 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -141,7 +141,7 @@ EditorAbout::EditorAbout() { hbc->add_child(about_text); TabContainer *tc = memnew(TabContainer); - tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE); + tc->set_custom_minimum_size(Size2(950, 400) * EDSCALE); tc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tc); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 2b58d105de..83434a6d9f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1107,37 +1107,47 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); class_desc->add_newline(); - for (int i = 0; i < methods.size(); i++) { + for (int pass = 0; pass < 2; pass++) { + Vector<DocData::MethodDoc> methods_filtered; - class_desc->push_font(doc_code_font); - _add_method(methods[i], false); - class_desc->pop(); + for (int i = 0; i < methods.size(); i++) { + const String &q = methods[i].qualifiers; + if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { + methods_filtered.push_back(methods[i]); + } + } - class_desc->add_newline(); - class_desc->add_newline(); + for (int i = 0; i < methods_filtered.size(); i++) { - class_desc->push_color(text_color); - class_desc->push_font(doc_font); - class_desc->push_indent(1); - if (methods[i].description.strip_edges() != String()) { - _add_text(methods[i].description); - } else { - class_desc->add_image(get_icon("Error", "EditorIcons")); - class_desc->add_text(" "); - class_desc->push_color(comment_color); - class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); + class_desc->push_font(doc_code_font); + _add_method(methods_filtered[i], false); class_desc->pop(); - } - class_desc->pop(); - class_desc->pop(); - class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); - class_desc->add_newline(); + class_desc->add_newline(); + class_desc->add_newline(); + + class_desc->push_color(text_color); + class_desc->push_font(doc_font); + class_desc->push_indent(1); + if (methods_filtered[i].description.strip_edges() != String()) { + _add_text(methods_filtered[i].description); + } else { + class_desc->add_image(get_icon("Error", "EditorIcons")); + class_desc->add_text(" "); + class_desc->push_color(comment_color); + class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); + class_desc->pop(); + } + + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); + class_desc->add_newline(); + } } } - scroll_locked = false; } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 690b7a8ec4..460f75eef0 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2649,6 +2649,7 @@ void EditorPropertyResource::update_property() { if (res == RES()) { assign->set_icon(Ref<Texture>()); assign->set_text(TTR("[empty]")); + assign->set_tooltip(""); } else { assign->set_icon(EditorNode::get_singleton()->get_object_icon(res.operator->(), "Node")); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index b7d36ce75a..7055abd643 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2708,6 +2708,7 @@ void CanvasItemEditor::_draw_ruler_tool() { font_secondary_color.a = 0.5; float text_height = font->get_height(); const float text_width = 76; + const float angle_text_width = 54; Point2 text_pos = (begin + end) / 2 - Vector2(text_width / 2, text_height / 2); text_pos.x = CLAMP(text_pos.x, text_width / 2, viewport->get_rect().size.x - text_width * 1.5); @@ -2715,14 +2716,38 @@ void CanvasItemEditor::_draw_ruler_tool() { viewport->draw_string(font, text_pos, vformat("%.2f px", length_vector.length()), font_color); if (draw_secondary_lines) { + int horizontal_axis_angle = round(180 * atan2(length_vector.y, length_vector.x) / Math_PI); + int vertictal_axis_angle = 90 - horizontal_axis_angle; Point2 text_pos2 = text_pos; text_pos2.x = begin.x < text_pos.x ? MIN(text_pos.x - text_width, begin.x - text_width / 2) : MAX(text_pos.x + text_width, begin.x - text_width / 2); viewport->draw_string(font, text_pos2, vformat("%.2f px", length_vector.y), font_secondary_color); + Point2 v_angle_text_pos = Point2(); + v_angle_text_pos.x = CLAMP(begin.x - angle_text_width / 2, angle_text_width / 2, viewport->get_rect().size.x - angle_text_width); + v_angle_text_pos.y = begin.y < end.y ? MIN(text_pos2.y - 2 * text_height, begin.y - text_height * 0.5) : MAX(text_pos2.y + text_height * 3, begin.y + text_height * 1.5); + viewport->draw_string(font, v_angle_text_pos, vformat("%d deg", vertictal_axis_angle), font_secondary_color); + text_pos2 = text_pos; text_pos2.y = end.y < text_pos.y ? MIN(text_pos.y - text_height * 2, end.y - text_height / 2) : MAX(text_pos.y + text_height * 2, end.y - text_height / 2); viewport->draw_string(font, text_pos2, vformat("%.2f px", length_vector.x), font_secondary_color); + + Point2 h_angle_text_pos = Point2(); + h_angle_text_pos.x = CLAMP(end.x - angle_text_width / 2, angle_text_width / 2, viewport->get_rect().size.x - angle_text_width); + if (begin.y < end.y) { + h_angle_text_pos.y = end.y + text_height * 1.5; + if (ABS(text_pos2.x - h_angle_text_pos.x) < text_width) { + int height_multiplier = 1.5 + (int)is_snap_active; + h_angle_text_pos.y = MAX(text_pos.y + height_multiplier * text_height, MAX(end.y + text_height * 1.5, text_pos2.y + height_multiplier * text_height)); + } + } else { + h_angle_text_pos.y = end.y - text_height * 0.5; + if (ABS(text_pos2.x - h_angle_text_pos.x) < text_width) { + int height_multiplier = 1 + (int)is_snap_active; + h_angle_text_pos.y = MIN(text_pos.y - height_multiplier * text_height, MIN(end.y - text_height * 0.5, text_pos2.y - height_multiplier * text_height)); + } + } + viewport->draw_string(font, h_angle_text_pos, vformat("%d deg", horizontal_axis_angle), font_secondary_color); } if (is_snap_active) { diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index a56cfede34..f177e634a6 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -74,6 +74,26 @@ static const char *_axis_names[JOY_AXIS_MAX * 2] = { "", " (R2)" }; +void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) { + + const Ref<InputEventKey> k = p_event; + + if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) { + + if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) { + if (search_button->is_pressed()) { + search_box->grab_focus(); + search_box->select_all(); + } else { + // This toggles the search bar display while giving the button its "pressed" appearance + search_button->set_pressed(true); + } + + accept_event(); + } + } +} + void ProjectSettingsEditor::_notification(int p_what) { switch (p_what) { @@ -116,6 +136,7 @@ void ProjectSettingsEditor::_notification(int p_what) { } break; case NOTIFICATION_POPUP_HIDE: { EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", get_rect()); + set_process_unhandled_input(false); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { search_button->set_icon(get_icon("Search", "EditorIcons")); @@ -800,6 +821,7 @@ void ProjectSettingsEditor::popup_project_settings() { _update_translations(); autoload_settings->update_autoload(); plugin_settings->update_plugins(); + set_process_unhandled_input(true); } void ProjectSettingsEditor::update_plugins() { @@ -1697,6 +1719,7 @@ void ProjectSettingsEditor::_editor_restart_close() { void ProjectSettingsEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_unhandled_input"), &ProjectSettingsEditor::_unhandled_input); ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettingsEditor::_item_selected); ClassDB::bind_method(D_METHOD("_item_add"), &ProjectSettingsEditor::_item_add); ClassDB::bind_method(D_METHOD("_item_adds"), &ProjectSettingsEditor::_item_adds); diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h index 4dfd8ba602..c164b49d0e 100644 --- a/editor/project_settings_editor.h +++ b/editor/project_settings_editor.h @@ -178,6 +178,7 @@ class ProjectSettingsEditor : public AcceptDialog { void _editor_restart_close(); protected: + void _unhandled_input(const Ref<InputEvent> &p_event); void _notification(int p_what); static void _bind_methods(); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index c9c1f9c3e0..f8425ebe22 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -140,32 +140,35 @@ void EditorSettingsDialog::_notification(int p_what) { void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { - Ref<InputEventKey> k = p_event; + const Ref<InputEventKey> k = p_event; - if (k.is_valid() && is_window_modal_on_top()) { + if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) { - if (k->is_pressed()) { + bool handled = false; - bool handled = false; + if (ED_IS_SHORTCUT("editor/undo", p_event)) { + String action = undo_redo->get_current_action_name(); + if (action != "") + EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR); + undo_redo->undo(); + handled = true; + } - if (ED_IS_SHORTCUT("editor/undo", p_event)) { - String action = undo_redo->get_current_action_name(); - if (action != "") - EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR); - undo_redo->undo(); - handled = true; - } - if (ED_IS_SHORTCUT("editor/redo", p_event)) { - undo_redo->redo(); - String action = undo_redo->get_current_action_name(); - if (action != "") - EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR); - handled = true; - } + if (ED_IS_SHORTCUT("editor/redo", p_event)) { + undo_redo->redo(); + String action = undo_redo->get_current_action_name(); + if (action != "") + EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR); + handled = true; + } - if (handled) { - accept_event(); - } + if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) { + _focus_current_search_box(); + handled = true; + } + + if (handled) { + accept_event(); } } } @@ -408,7 +411,6 @@ EditorSettingsDialog::EditorSettingsDialog() { tabs->set_tab_align(TabContainer::ALIGN_LEFT); tabs->connect("tab_changed", this, "_tabs_tab_changed"); add_child(tabs); - //set_child_rect(tabs); // General Tab @@ -425,7 +427,6 @@ EditorSettingsDialog::EditorSettingsDialog() { hbc->add_child(search_box); inspector = memnew(SectionedInspector); - //inspector->hide_top_label(); inspector->get_inspector()->set_use_filter(true); inspector->register_search_box(search_box); inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL); @@ -474,7 +475,6 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcuts->set_v_size_flags(SIZE_EXPAND_FILL); shortcuts->set_columns(2); shortcuts->set_hide_root(true); - //shortcuts->set_hide_folding(true); shortcuts->set_column_titles_visible(true); shortcuts->set_column_title(0, TTR("Name")); shortcuts->set_column_title(1, TTR("Binding")); @@ -495,9 +495,7 @@ EditorSettingsDialog::EditorSettingsDialog() { press_a_key->connect("gui_input", this, "_wait_for_key"); press_a_key->connect("confirmed", this, "_press_a_key_confirm"); - //get_ok()->set_text("Apply"); set_hide_on_ok(true); - //get_cancel()->set_text("Close"); timer = memnew(Timer); timer->set_wait_time(1.5); |