summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/SCsub4
-rw-r--r--editor/code_editor.cpp18
-rw-r--r--editor/editor_export.h2
-rw-r--r--editor/editor_help.cpp9
-rw-r--r--editor/editor_help.h6
-rw-r--r--editor/editor_inspector.cpp5
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_properties.cpp38
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_themes.cpp4
-rw-r--r--editor/filesystem_dock.cpp266
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/find_in_files.cpp34
-rw-r--r--editor/find_in_files.h7
-rw-r--r--editor/icons/icon_GUI_viewport_hdiagsplitter.svg64
-rw-r--r--editor/icons/icon_GUI_viewport_vdiagsplitter.svg68
-rw-r--r--editor/icons/icon_GUI_viewport_vhsplitter.svg63
-rw-r--r--editor/inspector_dock.cpp2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp7
-rw-r--r--editor/plugins/curve_editor_plugin.h6
-rw-r--r--editor/plugins/script_editor_plugin.cpp31
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp162
-rw-r--r--editor/plugins/spatial_editor_plugin.h5
-rw-r--r--editor/project_manager.cpp4
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/quick_open.h2
-rw-r--r--editor/scene_tree_dock.cpp118
-rw-r--r--editor/scene_tree_dock.h3
-rw-r--r--editor/script_editor_debugger.cpp8
-rw-r--r--editor/settings_config_dialog.cpp2
32 files changed, 646 insertions, 312 deletions
diff --git a/editor/SCsub b/editor/SCsub
index d5ac8c7008..82a4ecb6c0 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -79,7 +79,9 @@ if env['tools']:
env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header))
env.add_source_files(env.editor_sources, "*.cpp")
- env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
+ env_thirdparty = env.Clone()
+ env_thirdparty.disable_warnings()
+ env_thirdparty.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
SConscript('collada/SCsub')
SConscript('doc/SCsub')
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 33d36e5e9c..79c22f667a 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -44,7 +44,7 @@ void GotoLineDialog::popup_find_line(TextEdit *p_edit) {
line->set_text(itos(text_editor->cursor_get_line()));
line->select_all();
- popup_centered(Size2(180, 80));
+ popup_centered(Size2(180, 80) * EDSCALE);
line->grab_focus();
}
@@ -65,16 +65,20 @@ void GotoLineDialog::ok_pressed() {
GotoLineDialog::GotoLineDialog() {
set_title(TTR("Go to Line"));
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
+ add_child(vbc);
+
Label *l = memnew(Label);
l->set_text(TTR("Line Number:"));
- l->set_position(Point2(5, 5));
- add_child(l);
+ vbc->add_child(l);
line = memnew(LineEdit);
- line->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- line->set_begin(Point2(15, 22));
- line->set_end(Point2(-15, 35));
- add_child(line);
+ vbc->add_child(line);
register_text_enter(line);
text_editor = NULL;
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 420f383f95..b4ee5b89e7 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -37,10 +37,10 @@
#include "scene/main/timer.h"
#include "scene/resources/texture.h"
-class EditorProgress;
class FileAccess;
class EditorExportPlatform;
class EditorFileSystemDirectory;
+struct EditorProgress;
class EditorExportPreset : public Reference {
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 60040f641b..80dd5aa114 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -40,7 +40,7 @@
#define CONTRIBUTE2_URL "https://github.com/godotengine/godot-docs"
#define REQUEST_URL "https://github.com/godotengine/godot-docs/issues/new"
-void EditorHelpSearch::popup() {
+void EditorHelpSearch::popup_dialog() {
popup_centered(Size2(700, 600) * EDSCALE);
if (search_box->get_text() != "") {
@@ -50,15 +50,16 @@ void EditorHelpSearch::popup() {
search_box->grab_focus();
}
-void EditorHelpSearch::popup(const String &p_term) {
+void EditorHelpSearch::popup_dialog(const String &p_term) {
popup_centered(Size2(700, 600) * EDSCALE);
if (p_term != "") {
search_box->set_text(p_term);
search_box->select_all();
_update_search();
- } else
+ } else {
search_box->clear();
+ }
search_box->grab_focus();
}
@@ -362,7 +363,7 @@ void EditorHelpIndex::select_class(const String &p_class) {
class_list->ensure_cursor_is_visible();
}
-void EditorHelpIndex::popup() {
+void EditorHelpIndex::popup_dialog() {
popup_centered(Size2(500, 600) * EDSCALE);
diff --git a/editor/editor_help.h b/editor/editor_help.h
index ad81a39945..25db68b42d 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -92,8 +92,8 @@ protected:
static void _bind_methods();
public:
- void popup();
- void popup(const String &p_term);
+ void popup_dialog();
+ void popup_dialog(const String &p_term);
EditorHelpSearch();
};
@@ -120,7 +120,7 @@ protected:
public:
void select_class(const String &p_class);
- void popup();
+ void popup_dialog();
EditorHelpIndex();
};
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 10fc15e468..2c4168f1a0 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -36,9 +36,6 @@
#include "multi_node_edit.h"
#include "scene/resources/packed_scene.h"
-// TODO:
-// arrays and dictionary
-
Size2 EditorProperty::get_minimum_size() const {
Size2 ms;
@@ -1984,7 +1981,7 @@ void EditorInspector::_property_keyed(const String &p_path) {
if (!object)
return;
- emit_signal("property_keyed", p_path, object->get(p_path), false); //second param is deprecated
+ emit_signal("property_keyed", p_path, object->get(p_path), true); //second param is deprecated
}
void EditorInspector::_property_keyed_with_value(const String &p_path, const Variant &p_value) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index c9871bf27d..790e38afca 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1738,13 +1738,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_QUICK_OPEN_SCENE: {
- quick_open->popup("PackedScene", true);
+ quick_open->popup_dialog("PackedScene", true);
quick_open->set_title(TTR("Quick Open Scene..."));
} break;
case FILE_QUICK_OPEN_SCRIPT: {
- quick_open->popup("Script", true);
+ quick_open->popup_dialog("Script", true);
quick_open->set_title(TTR("Quick Open Script..."));
} break;
@@ -2002,7 +2002,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PLAY_CUSTOM_SCENE: {
if (run_custom_filename.empty() || editor_run.get_status() == EditorRun::STATUS_STOP) {
_menu_option_confirm(RUN_STOP, true);
- quick_run->popup("PackedScene", true);
+ quick_run->popup_dialog("PackedScene", true);
quick_run->set_title(TTR("Quick Run Scene..."));
play_custom_scene_button->set_pressed(false);
} else {
@@ -3201,7 +3201,7 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
}
}
- if (p_fallback.length())
+ if (p_fallback.length() && gui_base->has_icon(p_fallback, "EditorIcons"))
return gui_base->get_icon(p_fallback, "EditorIcons");
return NULL;
@@ -4849,7 +4849,7 @@ EditorNode::EditorNode() {
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
- EDITOR_DEF("interface/inspector/horizontal_vector3_editing", true);
+ EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial,Script");
EDITOR_DEF("run/auto_save/save_before_running", true);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f6937386c9..c5c78b2590 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1185,21 +1185,39 @@ void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool
}
EditorPropertyRect2::EditorPropertyRect2() {
- VBoxContainer *vb = memnew(VBoxContainer);
- add_child(vb);
+
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
+
+ BoxContainer *bc;
+
+ if (horizontal) {
+ bc = memnew(HBoxContainer);
+ add_child(bc);
+ set_bottom_editor(bc);
+ } else {
+ bc = memnew(VBoxContainer);
+ add_child(bc);
+ }
+
static const char *desc[4] = { "x", "y", "w", "h" };
for (int i = 0; i < 4; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
spin[i]->set_flat(true);
-
- vb->add_child(spin[i]);
+ bc->add_child(spin[i]);
add_focusable(spin[i]);
spin[i]->connect("value_changed", this, "_value_changed");
+ if (horizontal) {
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ }
+ }
+
+ if (!horizontal) {
+ set_label_reference(spin[0]); //show text and buttons around this
}
- set_label_reference(spin[0]); //show text and buttons around this
setting = false;
}
+
///////////////////// VECTOR3 /////////////////////////
void EditorPropertyVector3::_value_changed(double val) {
@@ -1247,7 +1265,7 @@ void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, boo
}
EditorPropertyVector3::EditorPropertyVector3() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1328,7 +1346,7 @@ void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool
EditorPropertyPlane::EditorPropertyPlane() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1409,7 +1427,7 @@ void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p
}
EditorPropertyQuat::EditorPropertyQuat() {
- bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
+ bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1761,7 +1779,7 @@ void EditorPropertyColor::_color_changed(const Color &p_color) {
void EditorPropertyColor::_popup_closed() {
- emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), false);
+ emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), true);
}
void EditorPropertyColor::_bind_methods() {
@@ -2638,7 +2656,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} else if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_2D_RENDER || p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
- EditorPropertyLayers::LayerType lt;
+ EditorPropertyLayers::LayerType lt = EditorPropertyLayers::LAYER_RENDER_2D;
switch (p_hint) {
case PROPERTY_HINT_LAYERS_2D_RENDER:
lt = EditorPropertyLayers::LAYER_RENDER_2D;
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 4e638cb4ac..24360813a2 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -969,7 +969,7 @@ void EditorPropertyDictionary::update_property() {
pc->add_child(add_vbox);
}
prop->set_object_and_property(object.ptr(), prop_name);
- int change_index;
+ int change_index = 0;
if (i < amount) {
String cs = key.get_construct_string();
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 39d2f685b6..9e81051dc2 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -478,8 +478,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tab_selected->set_bg_color(tab_color);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate();
- style_tab_unselected->set_draw_center(false);
- style_tab_unselected->set_border_width_all(0);
+ style_tab_unselected->set_bg_color(dark_color_1);
+ style_tab_unselected->set_border_color_all(dark_color_2);
// Editor background
theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size));
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 42fd38b654..2c69909f23 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -73,14 +73,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
if ((path.begins_with(lpath) && path != lpath)) {
subdirectory_item->set_collapsed(false);
} else {
- bool is_collapsed = true;
- for (int i = 0; i < uncollapsed_paths.size(); i++) {
- if (lpath == uncollapsed_paths[i]) {
- is_collapsed = false;
- break;
- }
- }
- subdirectory_item->set_collapsed(is_collapsed);
+ subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0);
}
if (searched_string.length() > 0 && dname.to_lower().find(searched_string) >= 0) {
parent_should_expand = true;
@@ -137,6 +130,11 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() {
Vector<String> uncollapsed_paths;
TreeItem *root = tree->get_root();
if (root) {
+ TreeItem *favorites_item = root->get_children();
+ if (!favorites_item->is_collapsed()) {
+ uncollapsed_paths.push_back(favorites_item->get_metadata(0));
+ }
+
TreeItem *resTree = root->get_children()->get_next();
if (resTree) {
Vector<TreeItem *> needs_check;
@@ -170,15 +168,14 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool
TreeItem *favorites = tree->create_item(root);
favorites->set_icon(0, get_icon("Favorites", "EditorIcons"));
favorites->set_text(0, TTR("Favorites:"));
- favorites->set_selectable(0, false);
+ favorites->set_metadata(0, "Favorites");
+ favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < favorite_paths.size(); i++) {
String fave = favorite_paths[i];
if (!fave.begins_with("res://"))
continue;
- if (display_mode_setting == DISPLAY_MODE_SETTING_SPLIT && !fave.ends_with("/"))
- continue;
Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
@@ -208,6 +205,12 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool
ti->set_tooltip(0, fave);
ti->set_selectable(0, true);
ti->set_metadata(0, fave);
+ if (!fave.ends_with("/")) {
+ Array udata;
+ udata.push_back(tree_update_id);
+ udata.push_back(ti);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(fave, this, "_tree_thumbnail_done", udata);
+ }
}
}
@@ -404,13 +407,21 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s
return;
// Tree item selected
- TreeItem *sel = tree->get_selected();
- if (!sel)
+ TreeItem *selected = tree->get_selected();
+ if (!selected)
return;
- path = sel->get_metadata(0);
+
+ TreeItem *favorites_item = tree->get_root()->get_children();
+ if (selected->get_parent() == favorites_item) {
+ // Go to the favorites if we click in the favorites and the path has changed
+ path = "Favorites";
+ } else {
+ path = selected->get_metadata(0);
+ // Note: the "Favorites" item also leads to this path
+ }
// Set the current path
- current_path->set_text(path);
+ _set_current_path_text(path);
_push_to_history();
// Update the file list
@@ -431,31 +442,46 @@ String FileSystemDock::get_current_path() const {
return path;
}
+void FileSystemDock::_set_current_path_text(const String &p_path) {
+ if (p_path == "Favorites") {
+ current_path->set_text(TTR("Favorites"));
+ } else {
+ current_path->set_text(path);
+ }
+}
+
void FileSystemDock::navigate_to_path(const String &p_path) {
- String target_path = p_path;
- // If the path is a file, do not only go to the directory in the tree, also select the file in the file list.
- if (target_path.ends_with("/")) {
- target_path = target_path.substr(0, target_path.length() - 1);
- }
- DirAccess *dirAccess = DirAccess::open("res://");
- if (dirAccess->file_exists(p_path)) {
- path = target_path;
- } else if (dirAccess->dir_exists(p_path)) {
- path = target_path + "/";
+ if (p_path == "Favorites") {
+ path = p_path;
} else {
- ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
- ERR_FAIL();
+ String target_path = p_path;
+ // If the path is a file, do not only go to the directory in the tree, also select the file in the file list.
+ if (target_path.ends_with("/")) {
+ target_path = target_path.substr(0, target_path.length() - 1);
+ }
+ DirAccess *dirAccess = DirAccess::open("res://");
+ if (dirAccess->file_exists(p_path)) {
+ path = target_path;
+ } else if (dirAccess->dir_exists(p_path)) {
+ path = target_path + "/";
+ } else {
+ ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
+ ERR_FAIL();
+ }
}
- current_path->set_text(path);
+ _set_current_path_text(path);
_push_to_history();
if (display_mode == DISPLAY_MODE_SPLIT) {
+ if (path.ends_with("/") || path == "Favorites") {
+ _go_to_file_list();
+ }
_update_tree(_compute_uncollapsed_paths());
_update_file_list(false);
} else if (display_mode == DISPLAY_MODE_TREE_ONLY) {
- if (path.ends_with("/")) {
+ if (path.ends_with("/") || path == "Favorites") {
_go_to_file_list();
} else {
_update_tree(_compute_uncollapsed_paths());
@@ -500,15 +526,6 @@ void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Textur
TreeItem *file_item = Object::cast_to<TreeItem>(uarr[1]);
if (file_item) {
file_item->set_icon(0, p_small_preview);
-
- // Update the favorite icon if needed
- TreeItem *favorite = tree->get_root()->get_children()->get_children();
- while (favorite) {
- if (favorite->get_metadata(0) == file_item->get_metadata(0)) {
- favorite->set_icon(0, p_small_preview);
- }
- favorite = favorite->get_next();
- }
}
}
}
@@ -577,21 +594,10 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
files->clear();
- current_path->set_text(path);
+ _set_current_path_text(path);
String directory = path;
- if (directory.ends_with("/") && directory != "res://") {
- directory = directory.substr(0, directory.length() - 1);
- }
String file = "";
- EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
- if (!efd) {
- directory = path.get_base_dir();
- file = path.get_file();
- efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
- }
- if (!efd)
- return;
String ei = "EditorIcons";
int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size");
@@ -601,7 +607,6 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
Ref<Texture> file_thumbnail_broken;
bool use_thumbnails = (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS);
- bool use_folders = searched_string.length() == 0 && ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders);
if (use_thumbnails) {
// Thumbnails mode
@@ -630,56 +635,116 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
files->set_fixed_icon_size(Size2());
}
- if (use_folders) {
- // Display folders in the list
- Ref<Texture> folderIcon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
+ Ref<Texture> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
- if (directory != "res://") {
- files->add_item("..", folderIcon, true);
+ // Build the FileInfo list
+ List<FileInfo> filelist;
+ if (path == "Favorites") {
+ // Display the favorites
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ for (int i = 0; i < favorites.size(); i++) {
+ String favorite = favorites[i];
+ String text;
+ Ref<Texture> icon;
+ if (favorite == "res://") {
+ text = "/";
+ icon = folder_icon;
+ if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
+ files->add_item(text, icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, favorite);
+ }
+ } else if (favorite.ends_with("/")) {
+ text = favorite.substr(0, favorite.length() - 1).get_file();
+ icon = folder_icon;
+ if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
+ files->add_item(text, icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, favorite);
+ }
+ } else {
+ int index;
+ EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->find_file(favorite, &index);
+
+ FileInfo fi;
+ fi.name = favorite.get_file();
+ fi.path = favorite;
+ if (efd) {
+ fi.type = efd->get_file_type(index);
+ fi.import_broken = !efd->get_file_import_is_valid(index);
+ } else {
+ fi.type = "";
+ fi.import_broken = true;
+ }
+ fi.import_status = 0;
- String bd = directory.get_base_dir();
- if (bd != "res://" && !bd.ends_with("/"))
- bd += "/";
+ if (searched_string.length() == 0 || fi.name.to_lower().find(searched_string) >= 0) {
+ filelist.push_back(fi);
+ }
+ }
+ }
+ } else {
- files->set_item_metadata(files->get_item_count() - 1, bd);
- files->set_item_selectable(files->get_item_count() - 1, false);
+ // Get infos on the directory + file
+ if (directory.ends_with("/") && directory != "res://") {
+ directory = directory.substr(0, directory.length() - 1);
+ }
+ EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
+ if (!efd) {
+ directory = path.get_base_dir();
+ file = path.get_file();
+ efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
}
+ if (!efd)
+ return;
- for (int i = 0; i < efd->get_subdir_count(); i++) {
+ if (searched_string.length() > 0) {
+ // Display the search results
+ _search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
+ } else {
- String dname = efd->get_subdir(i)->get_name();
+ if ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders) {
+ // Display folders in the list
- files->add_item(dname, folderIcon, true);
- files->set_item_metadata(files->get_item_count() - 1, directory.plus_file(dname) + "/");
+ if (directory != "res://") {
+ files->add_item("..", folder_icon, true);
- if (cselection.has(dname)) {
- files->select(files->get_item_count() - 1, false);
- }
- }
- }
+ String bd = directory.get_base_dir();
+ if (bd != "res://" && !bd.ends_with("/"))
+ bd += "/";
- List<FileInfo> filelist;
- if (searched_string.length() > 0) {
- // Display the search results
- _search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
- filelist.sort();
- } else {
+ files->set_item_metadata(files->get_item_count() - 1, bd);
+ files->set_item_selectable(files->get_item_count() - 1, false);
+ }
- // Display the folder content
- for (int i = 0; i < efd->get_file_count(); i++) {
+ for (int i = 0; i < efd->get_subdir_count(); i++) {
- FileInfo fi;
- fi.name = efd->get_file(i);
- fi.path = directory.plus_file(fi.name);
- fi.type = efd->get_file_type(i);
- fi.import_broken = !efd->get_file_import_is_valid(i);
- fi.import_status = 0;
+ String dname = efd->get_subdir(i)->get_name();
+
+ files->add_item(dname, folder_icon, true);
+ files->set_item_metadata(files->get_item_count() - 1, directory.plus_file(dname) + "/");
+
+ if (cselection.has(dname)) {
+ files->select(files->get_item_count() - 1, false);
+ }
+ }
+ }
+
+ // Display the folder content
+ for (int i = 0; i < efd->get_file_count(); i++) {
- filelist.push_back(fi);
+ FileInfo fi;
+ fi.name = efd->get_file(i);
+ fi.path = directory.plus_file(fi.name);
+ fi.type = efd->get_file_type(i);
+ fi.import_broken = !efd->get_file_import_is_valid(i);
+ fi.import_status = 0;
+
+ filelist.push_back(fi);
+ }
}
filelist.sort();
}
+ // Fills the ItemList control node from the FileInfos
String oi = "Object";
for (List<FileInfo>::Element *E = filelist.front(); E; E = E->next()) {
FileInfo *finfo = &(E->get());
@@ -750,14 +815,14 @@ void FileSystemDock::_select_file(const String p_path) {
if (fpath != "res://") {
fpath = fpath.substr(0, fpath.length() - 1);
}
- navigate_to_path(fpath);
- } else {
+ } else if (fpath != "Favorites") {
if (ResourceLoader::get_resource_type(fpath) == "PackedScene") {
editor->open_request(fpath);
} else {
editor->load_resource(fpath);
}
}
+ navigate_to_path(fpath);
}
void FileSystemDock::_tree_activate_file() {
@@ -778,8 +843,11 @@ void FileSystemDock::_go_to_file_list() {
file_list_view = true;
_update_display_mode();
} else {
- bool collapsed = tree->get_selected()->is_collapsed();
- tree->get_selected()->set_collapsed(!collapsed);
+ TreeItem *selected = tree->get_selected();
+ if (selected) {
+ bool collapsed = selected->is_collapsed();
+ selected->set_collapsed(!collapsed);
+ }
_update_file_list(false);
}
}
@@ -860,7 +928,7 @@ void FileSystemDock::_bw_history() {
void FileSystemDock::_update_history() {
path = history[history_pos];
- current_path->set_text(path);
+ _set_current_path_text(path);
if (tree->is_visible()) {
_update_tree(_compute_uncollapsed_paths());
@@ -1298,15 +1366,16 @@ Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) {
// Build a list of selected items with the active one at the first position
Vector<String> selected_strings;
+ TreeItem *favorites_item = tree->get_root()->get_children();
TreeItem *active_selected = tree->get_selected();
- if (active_selected) {
+ if (active_selected && active_selected != favorites_item) {
selected_strings.push_back(active_selected->get_metadata(0));
}
TreeItem *selected = tree->get_root();
selected = tree->get_next_selected(selected);
while (selected) {
- if (selected != active_selected) {
+ if (selected != active_selected && selected != favorites_item) {
selected_strings.push_back(selected->get_metadata(0));
}
selected = tree->get_next_selected(selected);
@@ -1427,6 +1496,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected)
}
EditorSettings::get_singleton()->set_favorites(favorites);
_update_tree(_compute_uncollapsed_paths());
+ if (path == "Favorites")
+ _update_file_list(true);
} break;
case FILE_DEPENDENCIES: {
@@ -1664,6 +1735,12 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from)
// Check if the first selected is in favorite
TreeItem *selected = tree->get_next_selected(tree->get_root());
while (selected) {
+ TreeItem *favorites_item = tree->get_root()->get_children();
+ if (selected == favorites_item) {
+ // The "Favorites" item is not draggable
+ return Variant();
+ }
+
bool is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent();
all_favorites &= is_favorite;
all_not_favorites &= !is_favorite;
@@ -1819,6 +1896,9 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
EditorSettings::get_singleton()->set_favorites(dirs);
_update_tree(_compute_uncollapsed_paths());
+
+ if (display_mode == DISPLAY_MODE_SPLIT && path == "Favorites")
+ _update_file_list(true);
return;
}
@@ -2282,7 +2362,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
current_path = memnew(LineEdit);
current_path->set_h_size_flags(SIZE_EXPAND_FILL);
- current_path->set_text(path);
+ _set_current_path_text(path);
toolbar_hbc->add_child(current_path);
button_reload = memnew(Button);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 5208b2c667..d964515572 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -257,6 +257,8 @@ private:
void _search(EditorFileSystemDirectory *p_path, List<FileInfo> *matches, int p_max_items);
+ void _set_current_path_text(const String &p_path);
+
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 2fdf1c82c0..2af81b8ac7 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -406,11 +406,8 @@ FindInFilesDialog::FindInFilesDialog() {
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_alignment(HBoxContainer::ALIGN_CENTER);
- _find_button = memnew(Button);
- _find_button->set_text(TTR("Find..."));
- _find_button->connect("pressed", this, "_on_find_button_pressed");
+ _find_button = add_button(TTR("Find..."), false, "find");
_find_button->set_disabled(true);
- hbc->add_child(_find_button);
{
Control *placeholder = memnew(Control);
@@ -418,11 +415,8 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(placeholder);
}
- _replace_button = memnew(Button);
- _replace_button->set_text(TTR("Replace..."));
- _replace_button->connect("pressed", this, "_on_replace_button_pressed");
+ _replace_button = add_button(TTR("Replace..."), false, "replace");
_replace_button->set_disabled(true);
- hbc->add_child(_replace_button);
{
Control *placeholder = memnew(Control);
@@ -430,10 +424,8 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(placeholder);
}
- Button *cancel_button = memnew(Button);
+ Button *cancel_button = get_ok();
cancel_button->set_text(TTR("Cancel"));
- cancel_button->connect("pressed", this, "hide");
- hbc->add_child(cancel_button);
vbc->add_child(hbc);
}
@@ -487,14 +479,14 @@ void FindInFilesDialog::_on_folder_button_pressed() {
_folder_dialog->popup_centered_ratio();
}
-void FindInFilesDialog::_on_find_button_pressed() {
- emit_signal(SIGNAL_FIND_REQUESTED);
- hide();
-}
-
-void FindInFilesDialog::_on_replace_button_pressed() {
- emit_signal(SIGNAL_REPLACE_REQUESTED);
- hide();
+void FindInFilesDialog::custom_action(const String &p_action) {
+ if (p_action == "find") {
+ emit_signal(SIGNAL_FIND_REQUESTED);
+ hide();
+ } else if (p_action == "replace") {
+ emit_signal(SIGNAL_REPLACE_REQUESTED);
+ hide();
+ }
}
void FindInFilesDialog::_on_search_text_modified(String text) {
@@ -509,7 +501,7 @@ void FindInFilesDialog::_on_search_text_modified(String text) {
void FindInFilesDialog::_on_search_text_entered(String text) {
// This allows to trigger a global search without leaving the keyboard
if (!_find_button->is_disabled())
- _on_find_button_pressed();
+ custom_action("find");
}
void FindInFilesDialog::_on_folder_selected(String path) {
@@ -522,8 +514,6 @@ void FindInFilesDialog::_on_folder_selected(String path) {
void FindInFilesDialog::_bind_methods() {
ClassDB::bind_method("_on_folder_button_pressed", &FindInFilesDialog::_on_folder_button_pressed);
- ClassDB::bind_method("_on_find_button_pressed", &FindInFilesDialog::_on_find_button_pressed);
- ClassDB::bind_method("_on_replace_button_pressed", &FindInFilesDialog::_on_replace_button_pressed);
ClassDB::bind_method("_on_folder_selected", &FindInFilesDialog::_on_folder_selected);
ClassDB::bind_method("_on_search_text_modified", &FindInFilesDialog::_on_search_text_modified);
ClassDB::bind_method("_on_search_text_entered", &FindInFilesDialog::_on_search_text_entered);
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 75ea1c3161..7f37123430 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -91,8 +91,8 @@ class CheckBox;
class FileDialog;
// Prompts search parameters
-class FindInFilesDialog : public WindowDialog {
- GDCLASS(FindInFilesDialog, WindowDialog)
+class FindInFilesDialog : public AcceptDialog {
+ GDCLASS(FindInFilesDialog, AcceptDialog)
public:
static const char *SIGNAL_FIND_REQUESTED;
static const char *SIGNAL_REPLACE_REQUESTED;
@@ -111,11 +111,10 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+ void custom_action(const String &p_action);
private:
void _on_folder_button_pressed();
- void _on_find_button_pressed();
- void _on_replace_button_pressed();
void _on_folder_selected(String path);
void _on_search_text_modified(String text);
void _on_search_text_entered(String text);
diff --git a/editor/icons/icon_GUI_viewport_hdiagsplitter.svg b/editor/icons/icon_GUI_viewport_hdiagsplitter.svg
new file mode 100644
index 0000000000..36769768fd
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_hdiagsplitter.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="34"
+ version="1.1"
+ viewBox="0 0 64 34"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter1.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="5.6568543"
+ inkscape:cx="37.006499"
+ inkscape:cy="15.680715"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-1018.4)"
+ id="g4" />
+ <g
+ transform="rotate(90,541.2,539.2)"
+ id="g4-3">
+ <path
+ id="path2-6"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ d="M 4.0306826,1048.4 H 34 m -30,30 v -60"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_GUI_viewport_vdiagsplitter.svg b/editor/icons/icon_GUI_viewport_vdiagsplitter.svg
new file mode 100644
index 0000000000..f23b4a0a74
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_vdiagsplitter.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="34"
+ height="64"
+ version="1.1"
+ viewBox="0 0 34 64"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter2.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="4"
+ inkscape:cx="32.245723"
+ inkscape:cy="44.255214"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-988.4)"
+ id="g4" />
+ <g
+ id="g839"
+ transform="rotate(90,32.003536,32.003535)">
+ <g
+ id="g4-3"
+ transform="rotate(90,526.2,554.2)">
+ <path
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0"
+ d="M 4.0306826,1048.4 H 34 m -30,30 v -60"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ id="path2-6" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_GUI_viewport_vhsplitter.svg b/editor/icons/icon_GUI_viewport_vhsplitter.svg
new file mode 100644
index 0000000000..429cf909ae
--- /dev/null
+++ b/editor/icons/icon_GUI_viewport_vhsplitter.svg
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ version="1.1"
+ viewBox="0 0 64 64"
+ id="svg6"
+ sodipodi:docname="icon_GUI_vsplitter.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="4.65625"
+ inkscape:cx="9.8488117"
+ inkscape:cy="20.04653"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0,-988.4)"
+ id="g4" />
+ <g
+ transform="rotate(90,526.2,554.2)"
+ id="g4-3">
+ <path
+ id="path2-6"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-opacity:0.39216003"
+ d="m -26,1048.4 h 60 m -30,30 v -60"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 81a798f0b6..4f4980d83c 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -259,6 +259,8 @@ void InspectorDock::_prepare_history() {
}
history_menu->get_popup()->add_icon_item(icon, text, i);
}
+
+ editor_path->update_path();
}
void InspectorDock::_select_history(int p_idx) const {
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 79169d3183..ace3012c10 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -205,13 +205,13 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
curve.set_point_left_tangent(_selected_point, tangent);
// Note: if a tangent is set to linear, it shouldn't be linked to the other
- if (link && _selected_point != curve.get_point_count() - 1 && !curve.get_point_right_mode(_selected_point) != Curve::TANGENT_FREE)
+ if (link && _selected_point != (curve.get_point_count() - 1) && curve.get_point_right_mode(_selected_point) != Curve::TANGENT_LINEAR)
curve.set_point_right_tangent(_selected_point, tangent);
} else {
curve.set_point_right_tangent(_selected_point, tangent);
- if (link && _selected_point != 0 && !curve.get_point_left_mode(_selected_point) != Curve::TANGENT_FREE)
+ if (link && _selected_point != 0 && curve.get_point_left_mode(_selected_point) != Curve::TANGENT_LINEAR)
curve.set_point_left_tangent(_selected_point, tangent);
}
}
@@ -782,12 +782,13 @@ bool CurvePreviewGenerator::handles(const String &p_type) const {
return p_type == "Curve";
}
-Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from) {
+Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, const Size2 p_size) const {
Ref<Curve> curve_ref = p_from;
ERR_FAIL_COND_V(curve_ref.is_null(), Ref<Texture>());
Curve &curve = **curve_ref;
+ // FIXME: Should be ported to use p_size as done in b2633a97
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
thumbnail_size *= EDSCALE;
Ref<Image> img_ref;
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index 255f359ed2..fa0b92e353 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -131,14 +131,14 @@ class CurveEditorPlugin : public EditorPlugin {
public:
CurveEditorPlugin(EditorNode *p_node);
- String get_name() const { return "Curve"; }
+ virtual String get_name() const { return "Curve"; }
};
class CurvePreviewGenerator : public EditorResourcePreviewGenerator {
GDCLASS(CurvePreviewGenerator, EditorResourcePreviewGenerator)
public:
- bool handles(const String &p_type) const;
- Ref<Texture> generate(const Ref<Resource> &p_from);
+ virtual bool handles(const String &p_type) const;
+ virtual Ref<Texture> generate(const Ref<Resource> &p_from, const Size2 p_size) const;
};
#endif // CURVE_EDITOR_PLUGIN_H
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 5e000ca6ef..7cda15bdc6 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -96,7 +96,7 @@ public:
}
}
- RES get_cached_resource(const String &p_path) {
+ virtual RES get_cached_resource(const String &p_path) {
Map<String, Cache>::Element *E = cached.find(p_path);
if (!E) {
@@ -134,9 +134,11 @@ public:
max_cache_size = 128;
max_time_cache = 5 * 60 * 1000; //minutes, five
}
+
+ virtual ~EditorScriptCodeCompletionCache() {}
};
-void ScriptEditorQuickOpen::popup(const Vector<String> &p_functions, bool p_dontclear) {
+void ScriptEditorQuickOpen::popup_dialog(const Vector<String> &p_functions, bool p_dontclear) {
popup_centered_ratio(0.6);
if (p_dontclear)
@@ -968,11 +970,11 @@ void ScriptEditor::_menu_option(int p_option) {
} break;
case SEARCH_HELP: {
- help_search_dialog->popup();
+ help_search_dialog->popup_dialog();
} break;
case SEARCH_CLASSES: {
- help_index->popup();
+ help_index->popup_dialog();
} break;
case SEARCH_WEBSITE: {
@@ -1204,7 +1206,7 @@ void ScriptEditor::_menu_option(int p_option) {
case SEARCH_CLASSES: {
- help_index->popup();
+ help_index->popup_dialog();
help_index->call_deferred("select_class", help->get_class());
} break;
case HELP_SEARCH_FIND: {
@@ -1414,21 +1416,6 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
emit_signal("editor_script_changed", p_script);
}
-static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
-
- if (p_node->get_script() == p_script)
- return p_node;
-
- for (int i = 0; i < p_node->get_child_count(); i++) {
-
- const Node *result = _find_node_with_script(p_node->get_child(i), p_script);
- if (result)
- return result;
- }
-
- return NULL;
-}
-
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
for (int i = 0; i < tab_container->get_child_count(); i++) {
@@ -2742,11 +2729,11 @@ void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
}
void ScriptEditor::_help_index(String p_text) {
- help_index->popup();
+ help_index->popup_dialog();
}
void ScriptEditor::_help_search(String p_text) {
- help_search_dialog->popup(p_text);
+ help_search_dialog->popup_dialog(p_text);
}
void ScriptEditor::_open_script_request(const String &p_path) {
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 120755b5af..28c07393f7 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -67,7 +67,7 @@ protected:
static void _bind_methods();
public:
- void popup(const Vector<String> &p_functions, bool p_dontclear = false);
+ void popup_dialog(const Vector<String> &p_functions, bool p_dontclear = false);
ScriptEditorQuickOpen();
};
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 23babdf07b..9b968c3523 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -940,7 +940,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case SEARCH_LOCATE_FUNCTION: {
- quick_open->popup(get_functions());
+ quick_open->popup_dialog(get_functions());
quick_open->set_title(TTR("Go to Function"));
} break;
case SEARCH_GOTO_LINE: {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 271f753003..114610c562 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -531,12 +531,12 @@ void SpatialEditorViewport::_select_region() {
void SpatialEditorViewport::_update_name() {
- String ortho = orthogonal ? TTR("Orthogonal") : TTR("Perspective");
+ String view_mode = orthogonal ? TTR("Orthogonal") : TTR("Perspective");
if (name != "")
- view_menu->set_text("[ " + name + " " + ortho + " ]");
+ view_menu->set_text("[ " + name + " " + view_mode + " ]");
else
- view_menu->set_text("[ " + ortho + " ]");
+ view_menu->set_text("[ " + view_mode + " ]");
view_menu->set_size(Vector2(0, 0)); // resets the button size
}
@@ -1912,7 +1912,7 @@ void SpatialEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, con
void SpatialEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative) {
// Freelook only works properly in perspective.
- // It technically works too in ortho, but it's awful for a user due to fov being near zero
+ // It could technically work in ortho, but it's terrible for a user due to FOV being a fixed width.
if (!orthogonal) {
real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
@@ -3543,69 +3543,77 @@ void SpatialEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event)
Ref<InputEventMouseButton> mb = p_event;
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
- Vector2 size = get_size();
+ if (mb->is_pressed()) {
+ Vector2 size = get_size();
- int h_sep = get_constant("separation", "HSplitContainer");
- int v_sep = get_constant("separation", "VSplitContainer");
+ int h_sep = get_constant("separation", "HSplitContainer");
+ int v_sep = get_constant("separation", "VSplitContainer");
- int mid_w = size.width * ratio_h;
- int mid_h = size.height * ratio_v;
+ int mid_w = size.width * ratio_h;
+ int mid_h = size.height * ratio_v;
- dragging_h = mb->get_position().x > (mid_w - h_sep / 2) && mb->get_position().x < (mid_w + h_sep / 2);
- dragging_v = mb->get_position().y > (mid_h - v_sep / 2) && mb->get_position().y < (mid_h + v_sep / 2);
+ dragging_h = mb->get_position().x > (mid_w - h_sep / 2) && mb->get_position().x < (mid_w + h_sep / 2);
+ dragging_v = mb->get_position().y > (mid_h - v_sep / 2) && mb->get_position().y < (mid_h + v_sep / 2);
- drag_begin_pos = mb->get_position();
- drag_begin_ratio.x = ratio_h;
- drag_begin_ratio.y = ratio_v;
+ drag_begin_pos = mb->get_position();
+ drag_begin_ratio.x = ratio_h;
+ drag_begin_ratio.y = ratio_v;
- switch (view) {
- case VIEW_USE_1_VIEWPORT: {
+ switch (view) {
+ case VIEW_USE_1_VIEWPORT: {
- dragging_h = false;
- dragging_v = false;
-
- } break;
- case VIEW_USE_2_VIEWPORTS: {
-
- dragging_h = false;
+ dragging_h = false;
+ dragging_v = false;
- } break;
- case VIEW_USE_2_VIEWPORTS_ALT: {
+ } break;
+ case VIEW_USE_2_VIEWPORTS: {
- dragging_v = false;
+ dragging_h = false;
- } break;
- case VIEW_USE_3_VIEWPORTS: {
+ } break;
+ case VIEW_USE_2_VIEWPORTS_ALT: {
- if (dragging_v)
- dragging_h = false;
- else
dragging_v = false;
- } break;
- case VIEW_USE_3_VIEWPORTS_ALT: {
+ } break;
+ case VIEW_USE_3_VIEWPORTS:
+ case VIEW_USE_3_VIEWPORTS_ALT:
+ case VIEW_USE_4_VIEWPORTS: {
- if (dragging_h)
- dragging_v = false;
- else
- dragging_h = false;
- } break;
- case VIEW_USE_4_VIEWPORTS: {
+ // Do nothing.
- } break;
+ } break;
+ }
+ } else {
+ dragging_h = false;
+ dragging_v = false;
}
}
- if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
- dragging_h = false;
- dragging_v = false;
- }
-
Ref<InputEventMouseMotion> mm = p_event;
- if (mm.is_valid() && (dragging_h || dragging_v)) {
+ if (mm.is_valid()) {
+
+ if (view == VIEW_USE_3_VIEWPORTS || view == VIEW_USE_3_VIEWPORTS_ALT || view == VIEW_USE_4_VIEWPORTS) {
+ Vector2 size = get_size();
+
+ int h_sep = get_constant("separation", "HSplitContainer");
+ int v_sep = get_constant("separation", "VSplitContainer");
+
+ int mid_w = size.width * ratio_h;
+ int mid_h = size.height * ratio_v;
+
+ bool was_hovering_h = hovering_h;
+ bool was_hovering_v = hovering_v;
+ hovering_h = mm->get_position().x > (mid_w - h_sep / 2) && mm->get_position().x < (mid_w + h_sep / 2);
+ hovering_v = mm->get_position().y > (mid_h - v_sep / 2) && mm->get_position().y < (mid_h + v_sep / 2);
+
+ if (was_hovering_h != hovering_h || was_hovering_v != hovering_v) {
+ update();
+ }
+ }
if (dragging_h) {
float new_ratio = drag_begin_ratio.x + (mm->get_position().x - drag_begin_pos.x) / get_size().width;
@@ -3635,9 +3643,12 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW && mouseover) {
Ref<Texture> h_grabber = get_icon("grabber", "HSplitContainer");
-
Ref<Texture> v_grabber = get_icon("grabber", "VSplitContainer");
+ Ref<Texture> hdiag_grabber = get_icon("GuiViewportHdiagsplitter", "EditorIcons");
+ Ref<Texture> vdiag_grabber = get_icon("GuiViewportVdiagsplitter", "EditorIcons");
+ Ref<Texture> vh_grabber = get_icon("GuiViewportVhsplitter", "EditorIcons");
+
Vector2 size = get_size();
int h_sep = get_constant("separation", "HSplitContainer");
@@ -3654,35 +3665,62 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
case VIEW_USE_1_VIEWPORT: {
- //nothing to show
+ // Nothing to show.
} break;
case VIEW_USE_2_VIEWPORTS: {
draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
} break;
case VIEW_USE_2_VIEWPORTS_ALT: {
draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
} break;
case VIEW_USE_3_VIEWPORTS: {
- draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
- draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2));
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(hdiag_grabber, Vector2(mid_w - hdiag_grabber->get_width() / 2, mid_h - v_grabber->get_height() / 4));
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
} break;
case VIEW_USE_3_VIEWPORTS_ALT: {
- draw_texture(v_grabber, Vector2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
- draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(vdiag_grabber, Vector2(mid_w - vdiag_grabber->get_width() + v_grabber->get_height() / 4, mid_h - vdiag_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, Vector2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2));
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2));
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
+
} break;
case VIEW_USE_4_VIEWPORTS: {
Vector2 half(mid_w, mid_h);
- draw_texture(v_grabber, half - v_grabber->get_size() / 2.0);
- draw_texture(h_grabber, half - h_grabber->get_size() / 2.0);
+ if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) {
+ draw_texture(vh_grabber, half - vh_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_DRAG);
+ } else if ((hovering_v && !dragging_h) || dragging_v) {
+ draw_texture(v_grabber, half - v_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_VSPLIT);
+ } else if (hovering_h || dragging_h) {
+ draw_texture(h_grabber, half - h_grabber->get_size() / 2.0);
+ set_default_cursor_shape(CURSOR_HSPLIT);
+ }
} break;
}
@@ -3726,6 +3764,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
case VIEW_USE_1_VIEWPORT: {
+ viewports[0]->show();
for (int i = 1; i < 4; i++) {
viewports[i]->hide();
@@ -3736,7 +3775,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_2_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1 || i == 3)
viewports[i]->hide();
@@ -3750,7 +3789,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_2_VIEWPORTS_ALT: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1 || i == 3)
viewports[i]->hide();
@@ -3763,7 +3802,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_3_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1)
viewports[i]->hide();
@@ -3778,7 +3817,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_3_VIEWPORTS_ALT: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (i == 1)
viewports[i]->hide();
@@ -3793,7 +3832,7 @@ void SpatialEditorViewportContainer::_notification(int p_what) {
} break;
case VIEW_USE_4_VIEWPORTS: {
- for (int i = 1; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
viewports[i]->show();
}
@@ -3826,10 +3865,13 @@ void SpatialEditorViewportContainer::_bind_methods() {
SpatialEditorViewportContainer::SpatialEditorViewportContainer() {
+ set_clip_contents(true);
view = VIEW_USE_1_VIEWPORT;
mouseover = false;
ratio_h = 0.5;
ratio_v = 0.5;
+ hovering_v = false;
+ hovering_h = false;
dragging_v = false;
dragging_h = false;
}
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 773739d6e0..c552f21e39 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -404,6 +404,7 @@ public:
AcceptDialog *p_accept);
Viewport *get_viewport_node() { return viewport; }
+ Camera *get_camera() { return camera; } // return the default camera object.
SpatialEditorViewport(SpatialEditor *p_spatial_editor, EditorNode *p_editor, int p_index);
};
@@ -443,6 +444,9 @@ private:
float ratio_h;
float ratio_v;
+ bool hovering_v;
+ bool hovering_h;
+
bool dragging_v;
bool dragging_h;
Vector2 drag_begin_pos;
@@ -707,7 +711,6 @@ public:
void register_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> ref);
- Camera *get_camera() { return NULL; }
void edit(Spatial *p_spatial);
void clear();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 91ab5b4dff..83de5a646a 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -999,6 +999,10 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
_open_project();
} break;
+ case KEY_DELETE: {
+
+ _erase_project();
+ } break;
case KEY_HOME: {
for (int i = 0; i < scroll_children->get_child_count(); i++) {
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index 497596a508..e48a0022e8 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -32,7 +32,7 @@
#include "core/os/keyboard.h"
-void EditorQuickOpen::popup(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {
+void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {
add_directories = p_add_dirs;
popup_centered_ratio(0.6);
diff --git a/editor/quick_open.h b/editor/quick_open.h
index ffea6b52bd..5451d5a08c 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -66,7 +66,7 @@ public:
String get_selected() const;
Vector<String> get_selected_files() const;
- void popup(const StringName &p_base, bool p_enable_multi = false, bool p_add_dirs = false, bool p_dontclear = false);
+ void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_add_dirs = false, bool p_dontclear = false);
EditorQuickOpen();
};
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index ff6832177e..11a0a42b9e 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -568,15 +568,21 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
return;
editor_data->get_undo_redo().create_action("Make node as Root");
- _node_replace_owner(root, node, node, MODE_DO);
editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node);
+ editor_data->get_undo_redo().add_do_method(root->get_parent(), "remove_child", root);
+ editor_data->get_undo_redo().add_do_method(node, "add_child", root);
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node);
editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename());
+ editor_data->get_undo_redo().add_do_method(root, "set_filename", String());
+ _node_replace_owner(root, root, node, MODE_DO);
+ editor_data->get_undo_redo().add_undo_method(root, "set_filename", root->get_filename());
editor_data->get_undo_redo().add_undo_method(node, "set_filename", String());
+ editor_data->get_undo_redo().add_undo_method(node, "remove_child", root);
editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root);
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node);
- _node_replace_owner(root, node, root, MODE_UNDO);
+ _node_replace_owner(root, root, root, MODE_UNDO);
+
editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_reference(root);
@@ -690,21 +696,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *node = e->get();
if (node) {
bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node);
- int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
- int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder"));
- editable = !editable;
- EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node, editable);
-
- menu->set_item_checked(editable_item_idx, editable);
if (editable) {
- node->set_scene_instance_load_placeholder(false);
- menu->set_item_checked(placeholder_item_idx, false);
+ editable_instance_remove_dialog->set_text(TTR("Disabling \"editable_instance\" will cause all properties of the node to be reverted to their default."));
+ editable_instance_remove_dialog->popup_centered_minsize();
+ break;
}
-
- SpatialEditor::get_singleton()->update_all_gizmos(node);
-
- scene_tree->update_tree();
+ _toggle_editable_children();
}
}
} break;
@@ -975,24 +973,22 @@ void SceneTreeDock::_notification(int p_what) {
void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root, ReplaceOwnerMode p_mode) {
- if (p_base != p_node) {
- if (p_node->get_owner() == p_base) {
- UndoRedo *undo_redo = &editor_data->get_undo_redo();
- switch (p_mode) {
- case MODE_BIDI: {
- undo_redo->add_do_method(p_node, "set_owner", p_root);
- undo_redo->add_undo_method(p_node, "set_owner", p_base);
+ if (p_node->get_owner() == p_base || !p_node->get_owner()) {
+ UndoRedo *undo_redo = &editor_data->get_undo_redo();
+ switch (p_mode) {
+ case MODE_BIDI: {
+ undo_redo->add_do_method(p_node, "set_owner", p_root);
+ undo_redo->add_undo_method(p_node, "set_owner", p_base);
- } break;
- case MODE_DO: {
- undo_redo->add_do_method(p_node, "set_owner", p_root);
+ } break;
+ case MODE_DO: {
+ undo_redo->add_do_method(p_node, "set_owner", p_root);
- } break;
- case MODE_UNDO: {
- undo_redo->add_undo_method(p_node, "set_owner", p_root);
+ } break;
+ case MODE_UNDO: {
+ undo_redo->add_undo_method(p_node, "set_owner", p_root);
- } break;
- }
+ } break;
}
}
@@ -1489,6 +1485,33 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
editor->push_item(p_script.operator->());
}
+void SceneTreeDock::_toggle_editable_children() {
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
+ bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node);
+
+ int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
+ int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder"));
+ editable = !editable;
+
+ EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node, editable);
+
+ menu->set_item_checked(editable_item_idx, editable);
+ if (editable) {
+ node->set_scene_instance_load_placeholder(false);
+ menu->set_item_checked(placeholder_item_idx, false);
+ }
+
+ SpatialEditor::get_singleton()->update_all_gizmos(node);
+
+ scene_tree->update_tree();
+ }
+ }
+}
+
void SceneTreeDock::_delete_confirm() {
List<Node *> remove_list = editor_selection->get_selected_node_list();
@@ -1570,7 +1593,7 @@ void SceneTreeDock::_delete_confirm() {
// Fixes the EditorHistory from still offering deleted notes
EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
editor_history->cleanup_history();
- EditorNode::get_singleton()->call("_prepare_history");
+ EditorNode::get_singleton()->get_inspector_dock()->call("_prepare_history");
}
void SceneTreeDock::_update_script_button() {
@@ -1587,6 +1610,10 @@ void SceneTreeDock::_selection_changed() {
if (selection_size > 1) {
//automatically turn on multi-edit
_tool_selected(TOOL_MULTI_EDIT);
+ } else if (selection_size == 1) {
+ editor->push_item(EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]);
+ } else {
+ editor->push_item(NULL);
}
_update_script_button();
}
@@ -1852,32 +1879,6 @@ static bool _has_visible_children(Node *p_node) {
return false;
}
-static Node *_find_last_visible(Node *p_node) {
-
- Node *last = NULL;
-
- bool collapsed = p_node->is_displayed_folded();
-
- if (!collapsed) {
- for (int i = 0; i < p_node->get_child_count(); i++) {
- if (_is_node_visible(p_node->get_child(i))) {
- last = p_node->get_child(i);
- }
- }
- }
-
- if (last) {
- Node *lastc = _find_last_visible(last);
- if (lastc)
- last = lastc;
-
- } else {
- last = p_node;
- }
-
- return last;
-}
-
void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
to_pos = -1;
@@ -2262,6 +2263,7 @@ void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_input"), &SceneTreeDock::_input);
ClassDB::bind_method(D_METHOD("_nodes_drag_begin"), &SceneTreeDock::_nodes_drag_begin);
ClassDB::bind_method(D_METHOD("_delete_confirm"), &SceneTreeDock::_delete_confirm);
+ ClassDB::bind_method(D_METHOD("_toggle_editable_children"), &SceneTreeDock::_toggle_editable_children);
ClassDB::bind_method(D_METHOD("_node_prerenamed"), &SceneTreeDock::_node_prerenamed);
ClassDB::bind_method(D_METHOD("_import_subscene"), &SceneTreeDock::_import_subscene);
ClassDB::bind_method(D_METHOD("_selection_changed"), &SceneTreeDock::_selection_changed);
@@ -2427,6 +2429,10 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
add_child(delete_dialog);
delete_dialog->connect("confirmed", this, "_delete_confirm");
+ editable_instance_remove_dialog = memnew(ConfirmationDialog);
+ add_child(editable_instance_remove_dialog);
+ editable_instance_remove_dialog->connect("confirmed", this, "_toggle_editable_children");
+
import_subscene_dialog = memnew(EditorSubScene);
add_child(import_subscene_dialog);
import_subscene_dialog->connect("subscene_selected", this, "_import_subscene");
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 34a7c98d11..269b0b69db 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -121,6 +121,7 @@ class SceneTreeDock : public VBoxContainer {
ScriptCreateDialog *script_create_dialog;
AcceptDialog *accept;
ConfirmationDialog *delete_dialog;
+ ConfirmationDialog *editable_instance_remove_dialog;
ReparentDialog *reparent_dialog;
EditorFileDialog *file;
@@ -169,6 +170,8 @@ class SceneTreeDock : public VBoxContainer {
void _delete_confirm();
+ void _toggle_editable_children();
+
void _node_prerenamed(Node *p_node, const String &p_new_name);
void _nodes_drag_begin();
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index f18c43b0d0..eb72d0aa6e 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -726,9 +726,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String source(err[5]);
bool source_is_project_file = source.begins_with("res://");
if (source_is_project_file)
- source = source.get_file();
+ txt = source.get_file() + ":" + String(err[6]);
+ else
+ txt = source + ":" + String(err[6]);
- txt = source + ":" + String(err[6]);
String method = err[4];
if (method.length() > 0)
txt += " @ " + method + "()";
@@ -1293,9 +1294,6 @@ void ScriptEditorDebugger::stop() {
EditorNode::get_singleton()->get_scene_tree_dock()->hide_remote_tree();
EditorNode::get_singleton()->get_scene_tree_dock()->hide_tab_buttons();
- Node *node = editor->get_scene_tree_dock()->get_tree_editor()->get_selected();
- editor->push_item(node);
-
if (hide_on_stop) {
if (is_visible_in_tree())
EditorNode::get_singleton()->hide_bottom_panel();
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index fe384da75b..537c9ac6b8 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -361,7 +361,7 @@ void EditorSettingsDialog::_tabs_tab_changed(int p_tab) {
void EditorSettingsDialog::_focus_current_search_box() {
Control *tab = tabs->get_current_tab_control();
- LineEdit *current_search_box;
+ LineEdit *current_search_box = NULL;
if (tab == tab_general)
current_search_box = search_box;
else if (tab == tab_shortcuts)