summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/doc/doc_data.cpp9
-rw-r--r--editor/editor_audio_buses.cpp5
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_data.h2
-rw-r--r--editor/editor_dir_dialog.cpp120
-rw-r--r--editor/editor_dir_dialog.h7
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_export.h2
-rw-r--r--editor/editor_file_system.cpp5
-rw-r--r--editor/editor_node.cpp71
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/export_template_manager.h2
-rw-r--r--editor/filesystem_dock.cpp14
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp4
-rw-r--r--editor/import/resource_importer_scene.cpp3
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/import_dock.cpp12
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp24
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp2
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp2
-rw-r--r--editor/plugins/gradient_editor_plugin.h2
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp8
-rw-r--r--editor/plugins/script_text_editor.cpp22
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp22
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp14
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp7
-rw-r--r--editor/project_settings_editor.cpp11
-rw-r--r--editor/project_settings_editor.h4
-rw-r--r--editor/quick_open.cpp52
-rw-r--r--editor/quick_open.h1
-rw-r--r--editor/script_create_dialog.cpp9
-rw-r--r--editor/spatial_editor_gizmos.cpp12
38 files changed, 273 insertions, 191 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index e09145c05b..8c153d2745 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1079,6 +1079,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file"));
text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
+ text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded"));
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 5975e54356..6848c43b68 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -634,6 +634,9 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
method.return_type = parser->get_attribute_value("type");
+ if (parser->has_attribute("enum")) {
+ method.return_enum = parser->get_attribute_value("enum");
+ }
} else if (name == "argument") {
DocData::ArgumentDoc argument;
@@ -916,7 +919,11 @@ Error DocData::save(const String &p_path) {
if (m.return_type != "") {
- _write_string(f, 3, "<return type=\"" + m.return_type + "\">");
+ String enum_text;
+ if (m.return_enum != String()) {
+ enum_text = " enum=\"" + m.return_enum + "\"";
+ }
+ _write_string(f, 3, "<return type=\"" + m.return_type + "\"" + enum_text + ">");
_write_string(f, 3, "</return>");
}
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index b3eb3e23a9..6937f74316 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -70,11 +70,14 @@ void EditorAudioBus::_notification(int p_what) {
float real_peak[2] = { -100, -100 };
bool activity_found = false;
- int cc;
+ int cc = 0;
switch (AudioServer::get_singleton()->get_speaker_mode()) {
case AudioServer::SPEAKER_MODE_STEREO: cc = 1; break;
case AudioServer::SPEAKER_SURROUND_51: cc = 4; break;
case AudioServer::SPEAKER_SURROUND_71: cc = 5; break;
+ default:
+ ERR_PRINT("Unknown speaker_mode");
+ break;
}
for (int i = 0; i < cc; i++) {
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index cb74a7b852..2cb5340b8b 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -141,7 +141,7 @@ ObjectID EditorHistory::get_history_obj(int p_obj) const {
return history[p_obj].path[history[p_obj].level].object;
}
-bool EditorHistory::is_at_begining() const {
+bool EditorHistory::is_at_beginning() const {
return current <= 0;
}
bool EditorHistory::is_at_end() const {
diff --git a/editor/editor_data.h b/editor/editor_data.h
index cbba4d60ad..33a4091a65 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -74,7 +74,7 @@ class EditorHistory {
void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
public:
- bool is_at_begining() const;
+ bool is_at_beginning() const;
bool is_at_end() const;
void add_object(ObjectID p_object);
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 1b213501aa..cfb3abfd1d 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -31,50 +31,40 @@
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
+#include "editor_scale.h"
#include "os/keyboard.h"
#include "os/os.h"
-
-void EditorDirDialog::_update_dir(TreeItem *p_item) {
+void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
updating = true;
- p_item->clear_children();
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- String cdir = p_item->get_metadata(0);
-
- da->change_dir(cdir);
- da->list_dir_begin();
- String p = da->get_next();
- List<String> dirs;
- bool ishidden;
- bool show_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files");
+ String path = p_dir->get_path();
- while (p != "") {
+ p_item->set_metadata(0, p_dir->get_path());
+ p_item->set_icon(0, get_icon("Folder", "EditorIcons"));
- ishidden = da->current_is_hidden();
+ if (!p_item->get_parent()) {
+ p_item->set_text(0, "res://");
+ } else {
- if (show_hidden || !ishidden) {
- if (da->current_is_dir() && !p.begins_with(".")) {
- dirs.push_back(p);
- }
+ if (!opened_paths.has(path) && (p_select_path == String() || !p_select_path.begins_with(path))) {
+ p_item->set_collapsed(true);
}
- p = da->get_next();
+
+ p_item->set_text(0, p_dir->get_name());
}
- dirs.sort();
+ //this should be handled by EditorFileSystem already
+ //bool show_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files");
+ updating = false;
+ for (int i = 0; i < p_dir->get_subdir_count(); i++) {
- for (List<String>::Element *E = dirs.front(); E; E = E->next()) {
TreeItem *ti = tree->create_item(p_item);
- ti->set_text(0, E->get());
- ti->set_icon(0, get_icon("Folder", "EditorIcons"));
- ti->set_collapsed(true);
+ _update_dir(ti, p_dir->get_subdir(i));
}
-
- memdelete(da);
- updating = false;
}
-void EditorDirDialog::reload() {
+void EditorDirDialog::reload(const String &p_with_path) {
if (!is_visible_in_tree()) {
must_reload = true;
@@ -83,10 +73,7 @@ void EditorDirDialog::reload() {
tree->clear();
TreeItem *root = tree->create_item();
- root->set_metadata(0, "res://");
- root->set_icon(0, get_icon("Folder", "EditorIcons"));
- root->set_text(0, "/");
- _update_dir(root);
+ _update_dir(root, EditorFileSystem::get_singleton()->get_filesystem(), p_with_path);
_item_collapsed(root);
must_reload = false;
}
@@ -94,6 +81,7 @@ void EditorDirDialog::reload() {
void EditorDirDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
+ EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "reload");
reload();
if (!tree->is_connected("item_collapsed", this, "_item_collapsed")) {
@@ -105,6 +93,10 @@ void EditorDirDialog::_notification(int p_what) {
}
}
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+ EditorFileSystem::get_singleton()->disconnect("filesystem_changed", this, "reload");
+ }
+
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (must_reload && is_visible_in_tree()) {
reload();
@@ -116,57 +108,13 @@ void EditorDirDialog::_item_collapsed(Object *p_item) {
TreeItem *item = Object::cast_to<TreeItem>(p_item);
- if (updating || item->is_collapsed())
+ if (updating)
return;
- TreeItem *ci = item->get_children();
- while (ci) {
-
- String p = ci->get_metadata(0);
- if (p == "") {
- String pp = item->get_metadata(0);
- ci->set_metadata(0, pp.plus_file(ci->get_text(0)));
- _update_dir(ci);
- }
- ci = ci->get_next();
- }
-}
-
-void EditorDirDialog::set_current_path(const String &p_path) {
-
- reload();
- String p = p_path;
- if (p.begins_with("res://"))
- p = p.replace_first("res://", "");
-
- Vector<String> dirs = p.split("/", false);
-
- TreeItem *r = tree->get_root();
- for (int i = 0; i < dirs.size(); i++) {
-
- String d = dirs[i];
- TreeItem *p = r->get_children();
- while (p) {
-
- if (p->get_text(0) == d)
- break;
- p = p->get_next();
- }
-
- ERR_FAIL_COND(!p);
- String pp = p->get_metadata(0);
- if (pp == "") {
- p->set_metadata(0, String(r->get_metadata(0)).plus_file(d));
- _update_dir(p);
- }
- updating = true;
- p->set_collapsed(false);
- updating = false;
- _item_collapsed(p);
- r = p;
- }
-
- r->select(0);
+ if (item->is_collapsed())
+ opened_paths.erase(item->get_metadata(0));
+ else
+ opened_paths.insert(item->get_metadata(0));
}
void EditorDirDialog::ok_pressed() {
@@ -201,14 +149,16 @@ void EditorDirDialog::_make_dir_confirm() {
String dir = ti->get_metadata(0);
- DirAccess *d = DirAccess::open(dir);
+ DirAccessRef d = DirAccess::open(dir);
ERR_FAIL_COND(!d);
Error err = d->make_dir(makedirname->get_text());
if (err != OK) {
- mkdirerr->popup_centered_minsize(Size2(250, 80));
+ mkdirerr->popup_centered_minsize(Size2(250, 80) * EDSCALE);
} else {
- set_current_path(dir.plus_file(makedirname->get_text()));
+ opened_paths.insert(dir);
+ //reload(dir.plus_file(makedirname->get_text()));
+ EditorFileSystem::get_singleton()->scan_changes(); //we created a dir, so rescan changes
}
makedirname->set_text(""); // reset label
}
@@ -218,7 +168,7 @@ void EditorDirDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_item_collapsed"), &EditorDirDialog::_item_collapsed);
ClassDB::bind_method(D_METHOD("_make_dir"), &EditorDirDialog::_make_dir);
ClassDB::bind_method(D_METHOD("_make_dir_confirm"), &EditorDirDialog::_make_dir_confirm);
- ClassDB::bind_method(D_METHOD("reload"), &EditorDirDialog::reload);
+ ClassDB::bind_method(D_METHOD("reload"), &EditorDirDialog::reload, DEFVAL(""));
ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir")));
}
diff --git a/editor/editor_dir_dialog.h b/editor/editor_dir_dialog.h
index b8347f75fb..8aa685947b 100644
--- a/editor/editor_dir_dialog.h
+++ b/editor/editor_dir_dialog.h
@@ -30,6 +30,7 @@
#ifndef EDITOR_DIR_DIALOG_H
#define EDITOR_DIR_DIALOG_H
+#include "editor/editor_file_system.h"
#include "os/dir_access.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
@@ -42,12 +43,13 @@ class EditorDirDialog : public ConfirmationDialog {
AcceptDialog *mkdirerr;
Button *makedir;
+ Set<String> opened_paths;
Tree *tree;
bool updating;
void _item_collapsed(Object *p_item);
- void _update_dir(TreeItem *p_item);
+ void _update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path = String());
void _make_dir();
void _make_dir_confirm();
@@ -61,8 +63,7 @@ protected:
static void _bind_methods();
public:
- void set_current_path(const String &p_path);
- void reload();
+ void reload(const String &p_path = "");
EditorDirDialog();
};
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index e761dce8ab..915fb7e5db 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_import_export.cpp */
+/* editor_export.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/editor/editor_export.h b/editor/editor_export.h
index feff9678af..3b99c68c85 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_import_export.h */
+/* editor_export.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index c175886d14..6e12a8fd02 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1383,7 +1383,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
}
- if (load_default && ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name())) {
+ if (load_default && ProjectSettings::get_singleton()->has("importer_defaults/" + importer->get_importer_name())) {
//use defaults if exist
Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name());
List<Variant> v;
@@ -1509,6 +1509,8 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (!is_scanning()) {
emit_signal("filesystem_changed");
}
+
+ emit_signal("resources_reimported", p_files);
}
void EditorFileSystem::_bind_methods() {
@@ -1524,6 +1526,7 @@ void EditorFileSystem::_bind_methods() {
ADD_SIGNAL(MethodInfo("filesystem_changed"));
ADD_SIGNAL(MethodInfo("sources_changed", PropertyInfo(Variant::BOOL, "exist")));
+ ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::POOL_STRING_ARRAY, "resources")));
}
void EditorFileSystem::_update_extensions() {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 15de8206aa..6b5db7572a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -382,20 +382,23 @@ void EditorNode::_fs_changed() {
continue;
if (E->get()->get_import_path() != String()) {
- //imported resource
+//this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
+//imported resource
+#if 0
uint64_t mt = FileAccess::get_modified_time(E->get()->get_import_path());
if (mt != E->get()->get_import_last_modified_time()) {
print_line("success");
changed.push_back(E->get());
}
+#endif
+ continue;
+ }
- } else {
- uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
+ uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
- if (mt != E->get()->get_last_modified_time()) {
- changed.push_back(E->get());
- }
+ if (mt != E->get()->get_last_modified_time()) {
+ changed.push_back(E->get());
}
}
@@ -410,6 +413,33 @@ void EditorNode::_fs_changed() {
_mark_unsaved_scenes();
}
+void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
+ print_line("reimporting");
+ List<String> scenes; //will load later
+
+ for (int i = 0; i < p_resources.size(); i++) {
+ String file_type = ResourceLoader::get_resource_type(p_resources[i]);
+ if (file_type == "PackedScene") {
+ scenes.push_back(p_resources[i]);
+ //reload later if needed, first go with normal resources
+ continue;
+ }
+
+ if (!ResourceCache::has(p_resources[i])) {
+ continue; //not loaded, no need to reload
+ }
+ //reload normally
+ Resource *resource = ResourceCache::get(p_resources[i]);
+ if (resource) {
+ resource->reload_from_file();
+ }
+ }
+
+ for (List<String>::Element *E = scenes.front(); E; E = E->next()) {
+ reload_scene(E->get());
+ }
+}
+
void EditorNode::_sources_changed(bool p_exist) {
if (waiting_for_first_scan) {
@@ -1343,7 +1373,7 @@ void EditorNode::_edit_current() {
uint32_t current = editor_history.get_current();
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
- property_back->set_disabled(editor_history.is_at_begining());
+ property_back->set_disabled(editor_history.is_at_beginning());
property_forward->set_disabled(editor_history.is_at_end());
this->current = current_obj;
@@ -2857,6 +2887,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
dependency_errors.clear();
+ print_line("actually loading it");
Error err;
Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true, &err);
if (!sdata.is_valid()) {
@@ -4179,30 +4210,25 @@ void EditorNode::_file_access_close_error_notify(const String &p_str) {
void EditorNode::reload_scene(const String &p_path) {
- //first of all, reload textures as they might have changed on disk
+ //first of all, reload internal textures, materials, meshes, etc. as they might have changed on disk
+ print_line("reloading: " + p_path);
List<Ref<Resource> > cached;
ResourceCache::get_cached_resources(&cached);
List<Ref<Resource> > to_clear; //clear internal resources from previous scene from being used
for (List<Ref<Resource> >::Element *E = cached.front(); E; E = E->next()) {
- if (E->get()->get_path().begins_with(p_path + "::")) //subresources of existing scene
+ if (E->get()->get_path().find("::") != -1) {
+ print_line(E->get()->get_path());
+ }
+ if (E->get()->get_path().begins_with(p_path + "::")) { //subresources of existing scene
to_clear.push_back(E->get());
-
- if (!cast_to<Texture>(E->get().ptr()))
- continue;
- if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
- continue;
- if (!FileAccess::exists(E->get()->get_path()))
- continue;
- uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
- if (mt != E->get()->get_last_modified_time()) {
- E->get()->reload_from_file();
}
}
//so reload reloads everything, clear subresources of previous scene
while (to_clear.front()) {
+ print_line("bye bye: " + to_clear.front()->get()->get_path());
to_clear.front()->get()->set_path("");
to_clear.pop_front();
}
@@ -4234,7 +4260,8 @@ void EditorNode::reload_scene(const String &p_path) {
//remove scene
_remove_scene(scene_idx);
//reload scene
- load_scene(p_path);
+
+ load_scene(p_path, true, false, true, true);
//adjust index so tab is back a the previous position
editor_data.move_edited_scene_to_index(scene_idx);
get_undo_redo()->clear_history();
@@ -4426,6 +4453,8 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size);
+ ClassDB::bind_method(D_METHOD("_resources_reimported"), &EditorNode::_resources_reimported);
+
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
@@ -4860,7 +4889,6 @@ EditorNode::EditorNode() {
pm_export->set_name("Export");
p->add_child(pm_export);
p->add_submenu_item(TTR("Convert To.."), "Export");
- pm_export->add_separator();
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary..")), FILE_EXPORT_MESH_LIBRARY);
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet..")), FILE_EXPORT_TILESET);
pm_export->connect("id_pressed", this, "_menu_option");
@@ -5454,6 +5482,7 @@ EditorNode::EditorNode() {
EditorFileSystem::get_singleton()->connect("sources_changed", this, "_sources_changed");
EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
+ EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported");
{
List<StringName> tl;
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 445ef4922e..c3ceee350a 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -422,6 +422,7 @@ private:
void _prepare_history();
void _fs_changed();
+ void _resources_reimported(const Vector<String> &p_resources);
void _sources_changed(bool p_exist);
void _node_renamed();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index d7be244c25..db76a27f5f 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -615,6 +615,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces");
set("text_editor/indent/size", 4);
hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes.
+ set("text_editor/indent/auto_indent", true);
set("text_editor/indent/convert_indent_on_save", false);
set("text_editor/indent/draw_tabs", true);
diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h
index ce6d8024ae..c77f85688f 100644
--- a/editor/export_template_manager.h
+++ b/editor/export_template_manager.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* export_template_manager.cpp */
+/* export_template_manager.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 0ad7b25e4a..04036f410a 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -828,7 +828,12 @@ void FileSystemDock::_move_operation(const String &p_to_path) {
//make list of remaps
Map<String, String> renames;
String repfrom = path == "res://" ? path : String(path + "/");
- String repto = p_to_path == "res://" ? p_to_path : String(p_to_path + "/");
+ String repto = p_to_path;
+ if (!repto.ends_with("/")) {
+ repto += "/";
+ }
+
+ print_line("reprfrom: " + repfrom + " repto " + repto);
for (int i = 0; i < move_files.size(); i++) {
renames[move_files[i]] = move_files[i].replace_first(repfrom, repto);
@@ -868,6 +873,13 @@ void FileSystemDock::_move_operation(const String &p_to_path) {
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Error moving file:\n") + move_files[i] + "\n");
}
+ if (FileAccess::exists(move_files[i] + ".import")) { //move imported files too
+ //@todo should remove the files in .import folder
+ err = da->rename(move_files[i] + ".import", to + ".import");
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error moving file:\n") + move_files[i] + ".import\n");
+ }
+ }
}
for (int i = 0; i < move_dirs.size(); i++) {
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 2f03e72851..21cf08f524 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -474,7 +474,7 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe
int buffer_end = (stride * (count - 1)) + element_size;
ERR_FAIL_COND_V(buffer_end > bv.byte_length, ERR_PARSE_ERROR);
- ERR_FAIL_COND_V((offset + buffer_end) > buffer.size(), ERR_PARSE_ERROR);
+ ERR_FAIL_COND_V((int)(offset + buffer_end) > buffer.size(), ERR_PARSE_ERROR);
//fill everything as doubles
@@ -1434,6 +1434,8 @@ Error EditorSceneImporterGLTF::_parse_cameras(GLTFState &state) {
}
print_line("total cameras: " + itos(state.cameras.size()));
+
+ return OK;
}
Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 7fa76713f3..594728d2e0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1167,7 +1167,8 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
memdelete(scene);
- EditorNode::get_singleton()->reload_scene(p_source_file);
+ //this is not the time to reimport, wait until import process is done, import file is saved, etc.
+ //EditorNode::get_singleton()->reload_scene(p_source_file);
return OK;
}
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 25185149b1..e2bacd70e4 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -129,7 +129,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int format_freq = 0;
int loop_begin = 0;
int loop_end = 0;
- int frames;
+ int frames = 0;
Vector<float> data;
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index a60f5d7294..112e3abcb5 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -265,16 +265,14 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
void ImportDock::_preset_selected(int p_idx) {
- switch (p_idx) {
- case ITEM_SET_AS_DEFAULT: {
- List<ResourceImporter::ImportOption> options;
-
- params->importer->get_import_options(&options, p_idx);
+ int item_id = preset->get_popup()->get_item_id(p_idx);
+ switch (item_id) {
+ case ITEM_SET_AS_DEFAULT: {
Dictionary d;
- for (List<ResourceImporter::ImportOption>::Element *E = options.front(); E; E = E->next()) {
- d[E->get().option.name] = E->get().default_value;
+ for (const List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) {
+ d[E->get().name] = params->values[E->get().name];
}
ProjectSettings::get_singleton()->set("importer_defaults/" + params->importer->get_importer_name(), d);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 4f3472bf03..3b74601e78 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -409,7 +409,7 @@ bool CanvasItemEditor::_is_part_of_subscene(CanvasItem *p_item) {
return item_owner && item_owner != scene_node && p_item != scene_node && item_owner->get_filename() != "";
}
-void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit) {
+void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit) {
if (!p_node)
return;
if (Object::cast_to<Viewport>(p_node))
@@ -1881,7 +1881,7 @@ void CanvasItemEditor::_viewport_draw() {
if (snap_show_grid) {
//Draw the grid
Size2 s = viewport->get_size();
- int last_cell;
+ int last_cell = 0;
Transform2D xform = transform.affine_inverse();
Vector2 grid_offset;
@@ -2257,17 +2257,17 @@ void CanvasItemEditor::_notification(int p_what) {
anchors[MARGIN_RIGHT] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_RIGHT);
anchors[MARGIN_TOP] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_TOP);
anchors[MARGIN_BOTTOM] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_BOTTOM);
- }
- if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
- viewport->update();
- se->prev_rect = r;
- se->prev_xform = xform;
- se->prev_pivot = pivot;
- se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
- se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
- se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP];
- se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM];
+ if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
+ viewport->update();
+ se->prev_rect = r;
+ se->prev_xform = xform;
+ se->prev_pivot = pivot;
+ se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
+ se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
+ se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP];
+ se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM];
+ }
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 8f67d641f5..da217007ea 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -291,7 +291,7 @@ class CanvasItemEditor : public VBoxContainer {
int handle_len;
bool _is_part_of_subscene(CanvasItem *p_item);
- void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit = 0);
+ void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0);
void _find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, List<CanvasItem *> *r_items);
void _select_click_on_empty_area(Point2 p_click_pos, bool p_append, bool p_box_selection);
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/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index abd2559d1f..51f00e5751 100644
--- a/editor/plugins/gradient_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* color_ramp_editor_plugin.cpp */
+/* gradient_editor_plugin.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index c169fa0947..ff7bf858c7 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* color_ramp_editor_plugin.h */
+/* gradient_editor_plugin.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index a5f854e1b1..84620a75a5 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -211,7 +211,7 @@ void Line2DEditor::_bind_methods() {
}
void Line2DEditor::_mode_selected(int p_mode) {
- for (unsigned int i = 0; i < _MODE_COUNT; ++i) {
+ for (int i = 0; i < _MODE_COUNT; ++i) {
toolbar_buttons[i]->set_pressed(i == p_mode);
}
mode = Mode(p_mode);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index a3195c05d6..f7008298f0 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -659,7 +659,7 @@ void Polygon2DEditor::_uv_draw() {
if (snap_show_grid) {
Size2 s = uv_edit_draw->get_size();
- int last_cell;
+ int last_cell = 0;
if (snap_step.x != 0) {
for (int i = 0; i < s.width; i++) {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 5015fab5ea..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");
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index a1cfda3b1a..fae57eb5d2 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -115,17 +115,29 @@ void ScriptTextEditor::_load_theme_settings() {
//colorize core types
Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0));
+ text_edit->add_keyword_color("String", basetype_color);
text_edit->add_keyword_color("Vector2", basetype_color);
+ text_edit->add_keyword_color("Rect2", basetype_color);
+ text_edit->add_keyword_color("Transform2D", basetype_color);
text_edit->add_keyword_color("Vector3", basetype_color);
+ text_edit->add_keyword_color("Rect3", basetype_color);
+ text_edit->add_keyword_color("Basis", basetype_color);
text_edit->add_keyword_color("Plane", basetype_color);
- text_edit->add_keyword_color("Quat", basetype_color);
- text_edit->add_keyword_color("AABB", basetype_color);
- text_edit->add_keyword_color("Matrix3", basetype_color);
text_edit->add_keyword_color("Transform", basetype_color);
+ text_edit->add_keyword_color("Quat", basetype_color);
text_edit->add_keyword_color("Color", basetype_color);
- text_edit->add_keyword_color("Image", basetype_color);
- text_edit->add_keyword_color("Rect2", basetype_color);
+ text_edit->add_keyword_color("Object", basetype_color);
text_edit->add_keyword_color("NodePath", basetype_color);
+ text_edit->add_keyword_color("RID", basetype_color);
+ text_edit->add_keyword_color("Dictionary", basetype_color);
+ text_edit->add_keyword_color("Array", basetype_color);
+ text_edit->add_keyword_color("PoolByteArray", basetype_color);
+ text_edit->add_keyword_color("PoolIntArray", basetype_color);
+ text_edit->add_keyword_color("PoolRealArray", basetype_color);
+ text_edit->add_keyword_color("PoolStringArray", basetype_color);
+ text_edit->add_keyword_color("PoolVector2Array", basetype_color);
+ text_edit->add_keyword_color("PoolVector3Array", basetype_color);
+ text_edit->add_keyword_color("PoolColorArray", basetype_color);
//colorize engine types
Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4));
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 8672892b5a..13b0391a87 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -280,6 +280,7 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file"));
shader_editor->get_text_edit()->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
+ shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index bc5c700959..d9fc2f32f7 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2958,7 +2958,7 @@ void SpatialEditor::update_transform_gizmo() {
gizmo.transform.origin = pcenter;
gizmo.transform.basis = gizmo_basis;
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i]->update_transform_gizmo_view();
}
}
@@ -3108,7 +3108,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
Array vp = d["viewports"];
ERR_FAIL_COND(vp.size() > 4);
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i]->set_state(vp[i]);
}
}
@@ -3505,7 +3505,7 @@ void SpatialEditor::_init_indicators() {
gizmo_hl = Ref<SpatialMaterial>(memnew(SpatialMaterial));
gizmo_hl->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- gizmo_hl->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ gizmo_hl->set_on_top_of_alpha();
gizmo_hl->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
gizmo_hl->set_albedo(Color(1, 1, 1, gizmo_alph + 0.2f));
gizmo_hl->set_cull_mode(SpatialMaterial::CULL_DISABLED);
@@ -3518,7 +3518,7 @@ void SpatialEditor::_init_indicators() {
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- mat->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ mat->set_on_top_of_alpha();
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
Color col;
col[i] = 1.0;
@@ -3613,7 +3613,7 @@ void SpatialEditor::_init_indicators() {
Ref<SpatialMaterial> plane_mat = memnew(SpatialMaterial);
plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- plane_mat->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ plane_mat->set_on_top_of_alpha();
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
Color col;
@@ -3852,15 +3852,15 @@ void SpatialEditor::_toggle_maximize_view(Object *p_viewport) {
if (!maximized) {
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
- if (i == index)
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
+ if (i == (uint32_t)index)
viewports[i]->set_area_as_parent_rect();
else
viewports[i]->hide();
}
} else {
- for (int i = 0; i < VIEWPORTS_COUNT; i++)
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++)
viewports[i]->show();
if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT)))
@@ -3904,7 +3904,7 @@ void SpatialEditor::clear() {
settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.1));
settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500.0));
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i]->reset();
}
@@ -3917,7 +3917,7 @@ void SpatialEditor::clear() {
}
}
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i]->view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(SpatialEditorViewport::VIEW_AUDIO_LISTENER), i == 0);
viewports[i]->viewport->set_as_audio_listener(i == 0);
@@ -4074,7 +4074,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
viewport_base = memnew(SpatialEditorViewportContainer);
shader_split->add_child(viewport_base);
viewport_base->set_v_size_flags(SIZE_EXPAND_FILL);
- for (int i = 0; i < VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i] = memnew(SpatialEditorViewport(this, editor, i));
viewports[i]->connect("toggle_maximize_view", this, "_toggle_maximize_view");
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/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 82b507bd49..38d1350b07 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -67,7 +67,7 @@ void TextureRegionEditor::_region_draw() {
if (snap_mode == SNAP_GRID) {
Size2 s = edit_draw->get_size();
- int last_cell;
+ int last_cell = 0;
if (snap_step.x != 0) {
if (snap_separation.x == 0)
@@ -406,7 +406,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
} else if (drag) {
if (edited_margin >= 0) {
- float new_margin;
+ float new_margin = 0;
if (edited_margin == 0)
new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 1)
@@ -415,6 +415,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom;
else if (edited_margin == 3)
new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom;
+ else
+ ERR_PRINT("Unexpected edited_margin");
+
if (new_margin < 0)
new_margin = 0;
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 94fce45733..9fd31f818e 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* project_settings.cpp */
+/* project_settings_editor.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -929,7 +929,7 @@ void ProjectSettingsEditor::_copy_to_platform(int p_which) {
String path = globals_editor->get_property_editor()->get_selected_path();
if (path == String()) {
- EditorNode::get_singleton()->show_warning(TTR("Select an setting item first!"));
+ EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
return;
}
@@ -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 e4e2345692..e58ba9b1c0 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* project_settings.h */
+/* project_settings_editor.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -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();
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index d0e2e0c240..089c054b59 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -352,9 +352,16 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
/* Does file already exist */
DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (f->file_exists(p) && !(f->current_is_dir())) {
+ if (f->dir_exists(p)) {
+ is_new_script_created = false;
+ is_path_valid = false;
+ _msg_path_valid(false, TTR("Directory of the same name exists"));
+ } else if (f->file_exists(p)) {
is_new_script_created = false;
is_path_valid = true;
+ _msg_path_valid(true, TTR("File exists, will be reused"));
+ } else {
+ path_error_label->set_text("");
}
memdelete(f);
_update_dialog();
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index c127b9a2f1..9c7ea506aa 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -580,7 +580,7 @@ Ref<SpatialMaterial> EditorSpatialGizmo::create_material(const String &p_name, c
}
if (p_on_top && is_selected()) {
- line_material->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ line_material->set_on_top_of_alpha();
}
line_material->set_albedo(color);
@@ -624,7 +624,7 @@ Ref<SpatialMaterial> EditorSpatialGizmo::create_icon_material(const String &p_na
icon->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
if (p_on_top && is_selected()) {
- icon->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ icon->set_on_top_of_alpha();
}
SpatialEditorGizmos::singleton->material_cache[name] = icon;
@@ -3411,7 +3411,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
handle_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- handle_material->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ handle_material->set_on_top_of_alpha();
handle_material->set_albedo(Color(0.8, 0.8, 0.8));
handle_material_billboard = handle_material->duplicate();
handle_material_billboard->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
@@ -3426,11 +3426,11 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
handle2_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
handle2_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
handle2_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- handle2_material->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ handle2_material->set_on_top_of_alpha();
handle2_material_billboard = handle2_material->duplicate();
handle2_material_billboard->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
handle2_material_billboard->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
- handle2_material_billboard->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ handle2_material_billboard->set_on_top_of_alpha();
EDITOR_DEF("editors/3d_gizmos/gizmo_colors/light", Color(1, 1, 0.2));
EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1));
@@ -3490,7 +3490,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
skeleton_material = create_line_material(Color(0.6, 1.0, 0.3));
skeleton_material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
skeleton_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- skeleton_material->set_flag(SpatialMaterial::FLAG_ONTOP, true);
+ skeleton_material->set_on_top_of_alpha();
skeleton_material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_DISABLED);
//position 3D Shared mesh