summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_help.cpp18
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/editor_themes.cpp18
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp11
-rw-r--r--editor/plugins/script_text_editor.cpp9
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp14
-rw-r--r--editor/project_settings_editor.cpp7
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/quick_open.cpp52
-rw-r--r--editor/quick_open.h1
11 files changed, 80 insertions, 55 deletions
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_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..bef9f78854 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);
@@ -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/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index 08b38c2ca2..decf8b2bb4 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -88,7 +88,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
if (mesh.is_null())
continue;
- int id = p_library->find_item_name(mi->get_name());
+ int id = p_library->find_item_by_name(mi->get_name());
if (id < 0) {
id = p_library->get_last_unused_item_id();
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index a529f152dc..dbc3bff873 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -972,6 +972,14 @@ void ScriptEditor::_menu_option(int p_option) {
EditorNode::get_singleton()->show_warning("Can't obtain the script for running");
break;
}
+
+ current->apply_code();
+ Error err = scr->reload(false); //hard reload script before running always
+
+ if (err != OK) {
+ EditorNode::get_singleton()->show_warning("Script failed reloading, check console for errors.");
+ return;
+ }
if (!scr->is_tool()) {
EditorNode::get_singleton()->show_warning("Script is not in tool mode, will not be able to run");
@@ -1149,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"));
@@ -2210,7 +2216,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/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/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 2cd0221ab6..9fd31f818e 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1321,6 +1321,11 @@ void ProjectSettingsEditor::set_plugins_page() {
tab_container->set_current_tab(plugin_settings->get_index());
}
+TabContainer *ProjectSettingsEditor::get_tabs() {
+
+ return tab_container;
+}
+
void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettingsEditor::_item_selected);
@@ -1361,6 +1366,8 @@ void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_toggle_search_bar"), &ProjectSettingsEditor::_toggle_search_bar);
ClassDB::bind_method(D_METHOD("_copy_to_platform_about_to_show"), &ProjectSettingsEditor::_copy_to_platform_about_to_show);
+
+ ClassDB::bind_method(D_METHOD("get_tabs"), &ProjectSettingsEditor::get_tabs);
}
ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index ceec089953..e58ba9b1c0 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -159,6 +159,8 @@ public:
void popup_project_settings();
void set_plugins_page();
+ TabContainer *get_tabs();
+
void queue_save();
ProjectSettingsEditor(EditorData *p_data);
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();