summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc/doc_data.cpp9
-rw-r--r--editor/editor_audio_buses.cpp5
-rw-r--r--editor/editor_dir_dialog.cpp120
-rw-r--r--editor/editor_dir_dialog.h7
-rw-r--r--editor/editor_node.cpp1
-rw-r--r--editor/filesystem_dock.cpp14
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp22
-rw-r--r--editor/plugins/cube_grid_theme_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/texture_region_editor_plugin.cpp7
-rw-r--r--editor/project_settings_editor.cpp9
-rw-r--r--editor/project_settings_editor.h2
15 files changed, 103 insertions, 109 deletions
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_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_node.cpp b/editor/editor_node.cpp
index e39895e4d8..6b5db7572a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4889,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");
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 5fa46fac2c..21cf08f524 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -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_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/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 601842799a..3b74601e78 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -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/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/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 a529f152dc..10a72ca5be 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/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 9817ab176e..9fd31f818e 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -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 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);