summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/script_language.h1
-rw-r--r--editor/SCsub60
-rw-r--r--editor/editor_about.cpp88
-rw-r--r--editor/editor_about.h1
-rw-r--r--editor/editor_fonts.cpp13
-rw-r--r--editor/editor_help.cpp18
-rw-r--r--editor/editor_node.cpp13
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/editor_themes.cpp22
-rw-r--r--editor/filesystem_dock.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp11
-rw-r--r--editor/plugins/script_text_editor.cpp9
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp14
-rw-r--r--editor/quick_open.cpp52
-rw-r--r--editor/quick_open.h1
-rw-r--r--editor/settings_config_dialog.cpp2
-rw-r--r--modules/gdscript/gd_script.h1
-rw-r--r--modules/visual_script/visual_script.h1
-rw-r--r--modules/visual_script/visual_script_editor.cpp2
-rw-r--r--scene/gui/graph_node.cpp20
-rw-r--r--scene/gui/graph_node.h6
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp27
-rw-r--r--scene/gui/rich_text_label.h2
-rw-r--r--scene/gui/text_edit.cpp21
-rw-r--r--scene/resources/default_theme/default_theme.cpp1
27 files changed, 261 insertions, 132 deletions
diff --git a/core/script_language.h b/core/script_language.h
index 342d8c8072..2261737f9a 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -206,6 +206,7 @@ public:
virtual int find_function(const String &p_function, const String &p_code) const = 0;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0;
virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; }
+ virtual bool overrides_external_editor() { return false; }
virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_force, String &r_call_hint) { return ERR_UNAVAILABLE; }
diff --git a/editor/SCsub b/editor/SCsub
index 172447147c..0e690cf465 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -155,31 +155,71 @@ def make_authors_header(target, source, env):
g.write("#define _EDITOR_AUTHORS_H\n")
current_section = ""
- name_count = -1
+ reading = False
def close_section():
g.write("\t0\n")
g.write("};\n")
- g.write("#define " + current_section.upper() + "_COUNT " + str(name_count) + "\n")
for line in f:
- if name_count >= 0:
+ if reading:
if line.startswith(" "):
g.write("\t\"" + line.strip() + "\",\n")
- name_count += 1
continue
if line.startswith("## "):
- if name_count >= 0:
+ if reading:
close_section()
- name_count = -1
+ reading = False
for i in range(len(sections)):
if line.strip().endswith(sections[i]):
current_section = sections_id[i]
- name_count = 0
+ reading = True
g.write("static const char *" + current_section + "[] = {\n")
break
- if name_count >= 0:
+ if reading:
+ close_section()
+
+ g.write("#endif\n")
+
+def make_donors_header(target, source, env):
+
+ sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", "Gold donors", "Silver donors", "Bronze donors"]
+ sections_id = ["donor_s_plat", "donor_s_gold", "donor_s_mini", "donor_gold", "donor_silver", "donor_bronze"]
+
+ src = source[0].srcnode().abspath
+ dst = target[0].srcnode().abspath
+ f = open_utf8(src, "r")
+ g = open_utf8(dst, "w")
+
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef _EDITOR_DONORS_H\n")
+ g.write("#define _EDITOR_DONORS_H\n")
+
+ current_section = ""
+ reading = False
+
+ def close_section():
+ g.write("\t0\n")
+ g.write("};\n")
+
+ for line in f:
+ if reading >= 0:
+ if line.startswith(" "):
+ g.write("\t\"" + line.strip() + "\",\n")
+ continue
+ if line.startswith("## "):
+ if reading:
+ close_section()
+ reading = False
+ for i in range(len(sections)):
+ if line.strip().endswith(sections[i]):
+ current_section = sections_id[i]
+ reading = True
+ g.write("static const char *" + current_section + "[] = {\n")
+ break
+
+ if reading:
close_section()
g.write("#endif\n")
@@ -393,6 +433,10 @@ if (env["tools"] == "yes"):
env.Depends('#editor/authors.gen.h', "../AUTHORS.md")
env.Command('#editor/authors.gen.h', "../AUTHORS.md", make_authors_header)
+ # Donors
+ env.Depends('#editor/donors.gen.h', "../DONORS.md")
+ env.Command('#editor/donors.gen.h', "../DONORS.md", make_donors_header)
+
# License
env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"])
env.Command('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], make_license_header)
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 8bd7bfb4bd..6d2bf10a7d 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -30,6 +30,7 @@
#include "editor_about.h"
#include "authors.gen.h"
+#include "donors.gen.h"
#include "license.gen.h"
#include "version.h"
#include "version_hash.gen.h"
@@ -51,6 +52,47 @@ TextureRect *EditorAbout::get_logo() const {
return _logo;
}
+ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[]) {
+
+ ScrollContainer *sc = memnew(ScrollContainer);
+ sc->set_name(p_name);
+ sc->set_v_size_flags(Control::SIZE_EXPAND);
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ sc->add_child(vbc);
+
+ for (int i = 0; i < p_sections.size(); i++) {
+
+ const char **names_ptr = p_src[i];
+ if (*names_ptr) {
+
+ Label *lbl = memnew(Label);
+ lbl->set_text(p_sections[i]);
+ vbc->add_child(lbl);
+
+ ItemList *il = memnew(ItemList);
+ il->set_max_columns(16);
+ il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ il->set_same_column_width(true);
+ il->set_auto_height(true);
+ while (*names_ptr) {
+ il->add_item(String::utf8(*names_ptr++));
+ }
+ vbc->add_child(il);
+ if (il->get_item_count() == 2) {
+ il->set_fixed_column_width(200 * EDSCALE);
+ }
+
+ HSeparator *hs = memnew(HSeparator);
+ hs->set_modulate(Color(0, 0, 0, 0));
+ vbc->add_child(hs);
+ }
+ }
+
+ return sc;
+}
+
EditorAbout::EditorAbout() {
set_title(TTR("Thanks from the Godot community!"));
@@ -84,43 +126,29 @@ EditorAbout::EditorAbout() {
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(tc);
- ScrollContainer *dev_base = memnew(ScrollContainer);
- dev_base->set_name(TTR("Authors"));
- dev_base->set_v_size_flags(Control::SIZE_EXPAND);
- tc->add_child(dev_base);
-
- VBoxContainer *dev_vbc = memnew(VBoxContainer);
- dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- dev_base->add_child(dev_vbc);
+ // Authors
List<String> dev_sections;
dev_sections.push_back(TTR("Project Founders"));
dev_sections.push_back(TTR("Lead Developer"));
dev_sections.push_back(TTR("Project Manager"));
dev_sections.push_back(TTR("Developers"));
-
const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
+ tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src));
- for (int i = 0; i < dev_sections.size(); i++) {
-
- Label *lbl = memnew(Label);
- lbl->set_text(dev_sections[i]);
- dev_vbc->add_child(lbl);
-
- ItemList *il = memnew(ItemList);
- il->set_max_columns(16);
- il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- il->set_fixed_column_width(230 * EDSCALE);
- il->set_auto_height(true);
- const char **dev_names_ptr = dev_src[i];
- while (*dev_names_ptr)
- il->add_item(String::utf8(*dev_names_ptr++), NULL, false);
- dev_vbc->add_child(il);
-
- HSeparator *hs = memnew(HSeparator);
- hs->set_modulate(Color(0, 0, 0, 0));
- dev_vbc->add_child(hs);
- }
+ // Donors
+
+ List<String> donor_sections;
+ donor_sections.push_back(TTR("Platinum Sponsors"));
+ donor_sections.push_back(TTR("Gold Sponsors"));
+ donor_sections.push_back(TTR("Mini Sponsors"));
+ donor_sections.push_back(TTR("Gold Donors"));
+ donor_sections.push_back(TTR("Silver Donors"));
+ donor_sections.push_back(TTR("Bronze Donors"));
+ const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze };
+ tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src));
+
+ // License
TextEdit *license = memnew(TextEdit);
license->set_name(TTR("License"));
@@ -131,6 +159,8 @@ EditorAbout::EditorAbout() {
license->set_text(String::utf8(about_license));
tc->add_child(license);
+ // Thirdparty License
+
VBoxContainer *license_thirdparty = memnew(VBoxContainer);
license_thirdparty->set_name(TTR("Thirdparty License"));
license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_about.h b/editor/editor_about.h
index d7047c03a3..d455b1f074 100644
--- a/editor/editor_about.h
+++ b/editor/editor_about.h
@@ -52,6 +52,7 @@ class EditorAbout : public AcceptDialog {
private:
void _license_tree_selected();
+ ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[]);
Tree *_tpl_tree;
TextEdit *_tpl_text;
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 22a9c84d21..3ab3f05906 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -72,11 +72,14 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
m_name->add_fallback(FontJapanese); \
m_name->add_fallback(FontFallback);
-#define MAKE_DEFAULT_FONT(m_name, m_size) \
- Ref<DynamicFont> m_name; \
- m_name.instance(); \
- m_name->set_size(m_size); \
- m_name->set_font_data(DefaultFont); \
+// the custom spacings might only work with Noto Sans
+#define MAKE_DEFAULT_FONT(m_name, m_size) \
+ Ref<DynamicFont> m_name; \
+ m_name.instance(); \
+ m_name->set_size(m_size); \
+ m_name->set_font_data(DefaultFont); \
+ m_name->set_spacing(DynamicFont::SPACING_TOP, -1); \
+ m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -1); \
MAKE_FALLBACKS(m_name);
void editor_register_fonts(Ref<Theme> p_theme) {
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 0e22f0d386..c9d1548bfb 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1711,12 +1711,6 @@ void EditorHelp::_notification(int p_what) {
_update_doc();
} break;
- case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
- Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
- style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"));
- background_panel->add_style_override("panel", style);
- } break;
-
default: break;
}
}
@@ -1786,14 +1780,11 @@ EditorHelp::EditorHelp() {
{
background_panel = memnew(Panel);
- Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
- style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"));
background_panel->set_v_size_flags(SIZE_EXPAND_FILL);
- background_panel->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
vbc->add_child(background_panel);
class_desc = memnew(RichTextLabel);
background_panel->add_child(class_desc);
- class_desc->set_area_as_parent_rect(8);
+ class_desc->set_area_as_parent_rect();
class_desc->connect("meta_clicked", this, "_class_desc_select");
class_desc->connect("gui_input", this, "_class_desc_input");
}
@@ -1881,10 +1872,6 @@ void EditorHelpBit::_bind_methods() {
}
void EditorHelpBit::_notification(int p_what) {
-
- if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles"));
- }
}
void EditorHelpBit::set_text(const String &p_text) {
@@ -1897,8 +1884,7 @@ EditorHelpBit::EditorHelpBit() {
rich_text = memnew(RichTextLabel);
add_child(rich_text);
- rich_text->set_area_as_parent_rect(8 * EDSCALE);
+ rich_text->set_area_as_parent_rect();
rich_text->connect("meta_clicked", this, "_meta_clicked");
set_custom_minimum_size(Size2(0, 70 * EDSCALE));
- add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6b5db7572a..d4e0aacb0f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1368,6 +1368,16 @@ void EditorNode::_set_editing_top_editors(Object *p_current_object) {
editor_plugins_over->edit(p_current_object);
}
+static bool overrides_external_editor(Object *p_object) {
+
+ Script *script = Object::cast_to<Script>(p_object);
+
+ if (!script)
+ return false;
+
+ return script->get_language()->overrides_external_editor();
+}
+
void EditorNode::_edit_current() {
uint32_t current = editor_history.get_current();
@@ -1434,7 +1444,7 @@ void EditorNode::_edit_current() {
if (main_plugin) {
// special case if use of external editor is true
- if (main_plugin->get_name() == "Script" && bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
+ if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
main_plugin->edit(current_obj);
}
@@ -1442,6 +1452,7 @@ void EditorNode::_edit_current() {
// update screen main_plugin
if (!changing_scene) {
+
if (editor_plugin_screen)
editor_plugin_screen->make_visible(false);
editor_plugin_screen = main_plugin;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 9c9eef848a..db76a27f5f 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -603,7 +603,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Default");
set("text_editor/theme/line_spacing", 4);
- set("text_editor/theme/adapted_code_editor_background_color", true);
_load_default_text_editor_theme();
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 8943d5f0dc..728801d90b 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -198,6 +198,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
bool highlight_tabs = EDITOR_DEF("interface/theme/highlight_tabs", false);
int border_size = EDITOR_DEF("interface/theme/border_size", 1);
+ Color script_bg_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
+
switch (preset) {
case 0: { // Default
highlight_color = Color::html("#699ce8");
@@ -279,8 +281,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
editor_register_fonts(theme);
// Editor background
- Ref<StyleBoxFlat> style_panel = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
- theme->set_stylebox("Background", "EditorStyles", style_panel);
+ theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(dark_color_2, 4, 4, 4, 4));
// Focus
Ref<StyleBoxFlat> focus_sbt = make_flat_stylebox(contrast_color_1, 4, 4, 4, 4);
@@ -333,10 +334,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border);
// Content of each tab
- Ref<StyleBoxFlat> style_content_panel = make_flat_stylebox(base_color, 4, 5, 4, 4);
+ Ref<StyleBoxFlat> style_content_panel = make_flat_stylebox(base_color, 4, 4, 4, 4);
style_content_panel->set_border_color_all(base_color);
style_content_panel->set_border_width_all(border_width);
- Ref<StyleBoxFlat> style_content_panel_vp = make_flat_stylebox(base_color, border_width, 5, border_width, border_width);
+ Ref<StyleBoxFlat> style_content_panel_vp = make_flat_stylebox(base_color, border_width, 4, border_width, border_width);
style_content_panel_vp->set_border_color_all(base_color);
style_content_panel_vp->set_border_width_all(border_width);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
@@ -424,12 +425,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tree_bg->set_border_color_all(dark_color_3);
theme->set_stylebox("bg", "Tree", style_tree_bg);
- // Script background
- Ref<StyleBoxFlat> style_script_bg = make_flat_stylebox(dark_color_1, 0, 0, 0, 0);
- style_script_bg->set_border_width_all(border_width);
- style_script_bg->set_border_color_all(dark_color_3);
- theme->set_stylebox("ScriptPanel", "EditorStyles", style_script_bg);
-
// Tree
theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons"));
@@ -614,11 +609,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons"));
//RichTextLabel
- theme->set_color("font_color", "RichTextLabel", font_color);
+ Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a);
+ Color rtl_font_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 0.5 * 3) ? Color(0, 0, 0) : Color(1, 1, 1);
+ theme->set_color("default_color", "RichTextLabel", rtl_font_color);
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
+ theme->set_stylebox("normal", "RichTextLabel", make_flat_stylebox(script_bg_color, 6, 6, 6, 6));
// Panel
- theme->set_stylebox("panel", "Panel", style_panel);
+ theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
// Label
theme->set_color("font_color", "Label", font_color);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 04036f410a..a66d1724a1 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1839,7 +1839,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
path = "res://";
- add_constant_override("separation", 3);
+ add_constant_override("separation", 4);
}
FileSystemDock::~FileSystemDock() {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 10a72ca5be..b8a4ff9bf3 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1157,8 +1157,6 @@ void ScriptEditor::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
- tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
-
help_search->set_icon(get_icon("HelpSearch", "EditorIcons"));
site_search->set_icon(get_icon("Instance", "EditorIcons"));
class_search->set_icon(get_icon("ClassList", "EditorIcons"));
@@ -1547,8 +1545,14 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
+ if (p_script->get_language()->overrides_external_editor()) {
+ Error err = p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col);
+ if (err != OK)
+ ERR_PRINT("Couldn't open script in the overridden external text editor");
+ return false;
+ }
+
if ((debugger->get_dump_stack_script() != p_script || debugger->get_debug_with_external_editor()) &&
- p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col) == OK &&
p_script->get_path().is_resource_file() &&
bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
@@ -2218,7 +2222,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
tab_container = memnew(TabContainer);
- tab_container->add_style_override("panel", p_editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
tab_container->set_tabs_visible(false);
script_split->add_child(tab_container);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 33890d890d..fae57eb5d2 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -75,14 +75,9 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->clear_colors();
- /* color from color_theme or from editor color */
-
- Color background_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
- if (EDITOR_DEF("text_editor/theme/adapted_code_editor_background_color", false))
- background_color = get_color("dark_color_1", "Editor");
-
/* keyword color */
- text_edit->add_color_override("background_color", background_color);
+
+ text_edit->add_color_override("background_color", EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0)));
text_edit->add_color_override("completion_background_color", EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0)));
text_edit->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244")));
text_edit->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")));
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 13b0391a87..b02016c273 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -289,6 +289,8 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing"));
shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
+ shader_editor->get_text_edit()->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling"));
+ shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed"));
}
void ShaderEditor::_bind_methods() {
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index c2c26bfe6c..7b40f69082 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -244,8 +244,22 @@ void SpriteFramesEditor::_down_pressed() {
void SpriteFramesEditor::_delete_pressed() {
+ ERR_FAIL_COND(!frames->has_animation(edited_anim));
+
if (tree->get_current() < 0)
return;
+
+ int to_delete = tree->get_current();
+ if (to_delete < 0 || to_delete >= frames->get_frame_count(edited_anim)) {
+ return;
+ }
+
+ undo_redo->create_action(TTR("Delete Resource"));
+ undo_redo->add_do_method(frames, "remove_frame", edited_anim, to_delete);
+ undo_redo->add_undo_method(frames, "add_frame", edited_anim, frames->get_frame(edited_anim, to_delete), to_delete);
+ undo_redo->add_do_method(this, "_update_library");
+ undo_redo->add_undo_method(this, "_update_library");
+ undo_redo->commit_action();
}
void SpriteFramesEditor::_animation_select() {
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index c71cc5af3f..b92ebed167 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -171,33 +171,50 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str
Pair<String, Ref<Texture> > pair;
pair.first = file;
pair.second = get_icon((has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei);
+ list.push_back(pair);
+ }
+ }
+
+ if (add_directories) {
+ for (int i = 0; i < efsd->get_subdir_count(); i++) {
- if (search_text != String() && list.size() > 0) {
+ _parse_fs(efsd->get_subdir(i), list);
+ }
+ }
+}
- float this_sim = _path_cmp(search_text, file);
- float other_sim = _path_cmp(list[0].first, file);
- int pos = 1;
+Vector<Pair<String, Ref<Texture> > > EditorQuickOpen::_sort_fs(Vector<Pair<String, Ref<Texture> > > &list) {
- while (pos < list.size() && this_sim <= other_sim) {
- other_sim = _path_cmp(list[pos++].first, file);
- }
+ String search_text = search_box->get_text();
+ Vector<Pair<String, Ref<Texture> > > sorted_list;
- pos = this_sim >= other_sim ? pos - 1 : pos;
- list.insert(pos, pair);
+ if (search_text == String() || list.size() == 0)
+ return sorted_list;
- } else {
+ Vector<float> scores;
+ scores.resize(list.size());
+ for (int i = 0; i < list.size(); i++)
+ scores[i] = _path_cmp(search_text, list[i].first);
- list.push_back(pair);
- }
- }
- }
+ while (list.size() > 0) {
- if (add_directories) {
- for (int i = 0; i < efsd->get_subdir_count(); i++) {
+ float best_score = 0.0f;
+ int best_idx = 0;
- _parse_fs(efsd->get_subdir(i), list);
+ for (int i = 0; i < list.size(); i++) {
+ float current_score = scores[i];
+ if (current_score > best_score) {
+ best_score = current_score;
+ best_idx = i;
+ }
}
+
+ sorted_list.push_back(list[best_idx]);
+ list.remove(best_idx);
+ scores.remove(best_idx);
}
+
+ return sorted_list;
}
void EditorQuickOpen::_update_search() {
@@ -208,6 +225,7 @@ void EditorQuickOpen::_update_search() {
Vector<Pair<String, Ref<Texture> > > list;
_parse_fs(efsd, list);
+ list = _sort_fs(list);
for (int i = 0; i < list.size(); i++) {
TreeItem *ti = search_options->create_item(root);
diff --git a/editor/quick_open.h b/editor/quick_open.h
index 3f64dd8cf0..5b91965920 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -49,6 +49,7 @@ class EditorQuickOpen : public ConfirmationDialog {
void _sbox_input(const Ref<InputEvent> &p_ie);
void _parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture> > > &list);
+ Vector<Pair<String, Ref<Texture> > > _sort_fs(Vector<Pair<String, Ref<Texture> > > &list);
float _path_cmp(String search, String path) const;
void _confirmed();
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 623e458aca..05e3feedb5 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -165,7 +165,7 @@ void EditorSettingsDialog::_update_shortcuts() {
section->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
}
- if (shortcut_filter.is_subsequence_ofi(sc->get_name())) {
+ if (shortcut_filter.is_subsequence_ofi(sc->get_name()) || shortcut_filter.is_subsequence_ofi(sc->get_as_text())) {
TreeItem *item = shortcuts->create_item(section);
item->set_text(0, sc->get_name());
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 6f05a4770b..5e1a8b19ac 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -389,7 +389,6 @@ public:
virtual bool can_inherit_from_file() { return true; }
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
- virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return OK; }
virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_forced, String &r_call_hint);
#ifdef TOOLS_ENABLED
virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result);
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index b2e7a6aa27..297e9e510f 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -571,7 +571,6 @@ public:
virtual bool has_named_classes() const;
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
- virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; }
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 8386687c9f..37bd730d08 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -523,7 +523,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
if (Object::cast_to<VisualScriptExpression>(*node)) {
Ref<VisualScriptComment> vsc = node;
gnode->set_comment(true);
- gnode->set_resizeable(true);
+ gnode->set_resizable(true);
gnode->set_custom_minimum_size(vsc->get_size() * EDSCALE);
gnode->connect("resize_request", this, "_comment_node_resized", varray(E->get()));
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 8730be0c06..bef0808fd0 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -270,7 +270,7 @@ void GraphNode::_notification(int p_what) {
}
}
- if (resizeable) {
+ if (resizable) {
draw_texture(resizer, get_size() - resizer->get_size());
}
}
@@ -594,7 +594,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Ref<Texture> resizer = get_icon("resizer");
- if (resizeable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
+ if (resizable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
resizing = true;
resizing_from = mpos;
@@ -645,15 +645,15 @@ bool GraphNode::is_comment() const {
return comment;
}
-void GraphNode::set_resizeable(bool p_enable) {
+void GraphNode::set_resizable(bool p_enable) {
- resizeable = p_enable;
+ resizable = p_enable;
update();
}
-bool GraphNode::is_resizeable() const {
+bool GraphNode::is_resizable() const {
- return resizeable;
+ return resizable;
}
void GraphNode::_bind_methods() {
@@ -678,8 +678,8 @@ void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_comment", "comment"), &GraphNode::set_comment);
ClassDB::bind_method(D_METHOD("is_comment"), &GraphNode::is_comment);
- ClassDB::bind_method(D_METHOD("set_resizeable", "resizeable"), &GraphNode::set_resizeable);
- ClassDB::bind_method(D_METHOD("is_resizeable"), &GraphNode::is_resizeable);
+ ClassDB::bind_method(D_METHOD("set_resizable", "resizable"), &GraphNode::set_resizable);
+ ClassDB::bind_method(D_METHOD("is_resizable"), &GraphNode::is_resizable);
ClassDB::bind_method(D_METHOD("set_selected", "selected"), &GraphNode::set_selected);
ClassDB::bind_method(D_METHOD("is_selected"), &GraphNode::is_selected);
@@ -702,7 +702,7 @@ void GraphNode::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_close"), "set_show_close_button", "is_close_button_visible");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizeable"), "set_resizeable", "is_resizeable");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable"), "set_resizable", "is_resizable");
ADD_SIGNAL(MethodInfo("offset_changed"));
ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
@@ -722,7 +722,7 @@ GraphNode::GraphNode() {
connpos_dirty = true;
set_mouse_filter(MOUSE_FILTER_STOP);
comment = false;
- resizeable = false;
+ resizable = false;
resizing = false;
selected = false;
}
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 416d711aab..a606e47acd 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -68,7 +68,7 @@ private:
bool show_close;
Vector2 offset;
bool comment;
- bool resizeable;
+ bool resizable;
bool resizing;
Vector2 resizing_from;
@@ -151,8 +151,8 @@ public:
void set_comment(bool p_enable);
bool is_comment() const;
- void set_resizeable(bool p_enable);
- bool is_resizeable() const;
+ void set_resizable(bool p_enable);
+ bool is_resizable() const;
virtual Size2 get_minimum_size() const;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 66b4e6cec1..6a5f56c78c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -631,7 +631,7 @@ void LineEdit::_notification(int p_what) {
if (has_icon("right_icon")) {
Ref<Texture> r_icon = Control::get_icon("right_icon");
ofs_max -= r_icon->get_width();
- r_icon->draw(ci, Point2(width - r_icon->get_width() - x_ofs, y_ofs), Color(1, 1, 1, disabled_alpha * .9));
+ r_icon->draw(ci, Point2(width - r_icon->get_width() - x_ofs, height / 2 - r_icon->get_height() / 2), Color(1, 1, 1, disabled_alpha * .9));
}
int caret_height = font->get_height() > y_area ? y_area : font->get_height();
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index a3f116c883..e51955ed66 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -80,6 +80,10 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
return NULL;
}
+Rect2 RichTextLabel::_get_text_rect() {
+ Ref<StyleBox> style = get_stylebox("normal");
+ return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
+}
void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos, Item **r_click_item, int *r_click_char, bool *r_outside, int p_char_count) {
RID ci;
@@ -583,7 +587,7 @@ void RichTextLabel::_update_scroll() {
int total_height = 0;
if (main->lines.size())
- total_height = main->lines[main->lines.size() - 1].height_accum_cache;
+ total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
bool exceeds = total_height > get_size().height && scroll_active;
@@ -641,7 +645,11 @@ void RichTextLabel::_notification(int p_what) {
_update_scroll();
RID ci = get_canvas_item();
+
Size2 size = get_size();
+ Rect2 text_rect = _get_text_rect();
+
+ draw_style_box(get_stylebox("normal"), Rect2(Point2(), size));
if (has_focus()) {
VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
@@ -657,10 +665,10 @@ void RichTextLabel::_notification(int p_what) {
int total_chars = 0;
while (from_line < main->lines.size()) {
- if (main->lines[from_line].height_accum_cache >= ofs)
+ if (main->lines[from_line].height_accum_cache + _get_text_rect().get_position().y >= ofs)
break;
- from_line++;
total_chars += main->lines[from_line].char_count;
+ from_line++;
}
if (from_line >= main->lines.size())
@@ -672,7 +680,7 @@ void RichTextLabel::_notification(int p_what) {
while (y < size.height && from_line < main->lines.size()) {
- _process_line(main, Point2(), y, size.width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, Point2i(), NULL, NULL, NULL, total_chars);
+ _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, Point2i(), NULL, NULL, NULL, total_chars);
total_chars += main->lines[from_line].char_count;
from_line++;
}
@@ -686,7 +694,7 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
*r_click_item = NULL;
Size2 size = get_size();
-
+ Rect2 text_rect = _get_text_rect();
int ofs = vscroll->get_value();
//todo, change to binary search
@@ -706,9 +714,9 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
Ref<Font> base_font = get_font("normal_font");
Color base_color = get_color("default_color");
- while (y < size.height && from_line < p_frame->lines.size()) {
+ while (y < text_rect.get_size().height && from_line < p_frame->lines.size()) {
- _process_line(p_frame, Point2(), y, size.width - scroll_w, from_line, PROCESS_POINTER, base_font, base_color, p_click, r_click_item, r_click_char, r_outside);
+ _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_POINTER, base_font, base_color, p_click, r_click_item, r_click_char, r_outside);
if (r_click_item && *r_click_item)
return;
from_line++;
@@ -1015,13 +1023,14 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
//validate invalid lines!s
Size2 size = get_size();
+ Rect2 text_rect = _get_text_rect();
Ref<Font> base_font = get_font("normal_font");
for (int i = p_frame->first_invalid_line; i < p_frame->lines.size(); i++) {
int y = 0;
- _process_line(p_frame, Point2(), y, size.width - scroll_w, i, PROCESS_CACHE, base_font, Color());
+ _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, i, PROCESS_CACHE, base_font, Color());
p_frame->lines[i].height_cache = y;
p_frame->lines[i].height_accum_cache = y;
@@ -1031,7 +1040,7 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
int total_height = 0;
if (p_frame->lines.size())
- total_height = p_frame->lines[p_frame->lines.size() - 1].height_accum_cache;
+ total_height = p_frame->lines[p_frame->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
main->first_invalid_line = p_frame->lines.size();
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 74bf180b5d..4db2c3a8e9 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -276,6 +276,8 @@ private:
void _gui_input(Ref<InputEvent> p_event);
Item *_get_next_item(Item *p_item, bool p_free = false);
+ Rect2 _get_text_rect();
+
bool use_bbcode;
String bbcode;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index ade665b418..1738e303aa 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2136,15 +2136,25 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
}
}
- if (auto_indent) {
- // indent once again if previous line will end with ':'
- // (i.e. colon precedes current cursor position)
- if (cursor.column > 0 && text[cursor.line][cursor.column - 1] == ':') {
+
+ bool brace_indent = false;
+
+ // no need to indent if we are going upwards.
+ if (auto_indent && !(k->get_command() && k->get_shift())) {
+ // indent once again if previous line will end with ':' or '{'
+ // (i.e. colon/brace precedes current cursor position)
+ if (cursor.column > 0 && (text[cursor.line][cursor.column - 1] == ':' || text[cursor.line][cursor.column - 1] == '{')) {
if (indent_using_spaces) {
ins += space_indent;
} else {
ins += "\t";
}
+
+ // no need to move the brace below if we are not taking the text with us.
+ if (text[cursor.line][cursor.column] == '}' && !k->get_command()) {
+ brace_indent = true;
+ ins += "\n" + ins.substr(1, ins.length() - 2);
+ }
}
}
@@ -2168,6 +2178,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (first_line) {
cursor_set_line(0);
+ } else if (brace_indent) {
+ cursor_set_line(cursor.line - 1);
+ cursor_set_column(text[cursor.line].length());
}
} break;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 4ff635edeb..fdea5960e5 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -794,6 +794,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// RichTextLabel
theme->set_stylebox("focus", "RichTextLabel", focus);
+ theme->set_stylebox("normal", "RichTextLabel", make_stylebox(tree_bg_png, 3, 3, 3, 3));
theme->set_font("normal_font", "RichTextLabel", default_font);
theme->set_font("bold_font", "RichTextLabel", default_font);