summaryrefslogtreecommitdiff
path: root/editor/filesystem_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r--editor/filesystem_dock.cpp51
1 files changed, 43 insertions, 8 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 5a1383be6d..b7e9d36d88 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -90,7 +90,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
String file_type = p_dir->get_file_type(i);
if (_is_file_type_disabled_by_feature_profile(file_type)) {
- //if type is disabled, file wont be displayed.
+ //if type is disabled, file won't be displayed.
continue;
}
String file_name = p_dir->get_file(i);
@@ -462,6 +462,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
_update_tree(_compute_uncollapsed_paths(), false, p_select_in_favorites);
if (display_mode == DISPLAY_MODE_SPLIT) {
_update_file_list(false);
+ files->get_v_scroll()->set_value(0);
}
String file_name = p_path.get_file();
@@ -1021,6 +1022,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
for (int j = 0; j < ed->get_edited_scene_count(); j++) {
if (ed->get_scene_path(j) == file_changed_paths[i]) {
ed->get_edited_scene_root(j)->set_filename(new_item_path);
+ editor->save_layout();
break;
}
}
@@ -1207,7 +1209,7 @@ void FileSystemDock::_make_dir_confirm() {
return;
} else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.find("*") != -1 ||
dir_name.find("|") != -1 || dir_name.find(">") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) {
- EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters"));
+ EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters."));
return;
}
@@ -1256,6 +1258,10 @@ void FileSystemDock::_rename_operation_confirm() {
return;
}
+ if (EditorFileSystem::get_singleton()->is_group_file(old_path)) {
+ EditorFileSystem::get_singleton()->move_group_file(old_path, new_path);
+ }
+
//Present a more user friendly warning for name conflict
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
#if defined(WINDOWS_ENABLED) || defined(UWP_ENABLED)
@@ -1353,6 +1359,16 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
}
}
+ //check groups
+ for (int i = 0; i < to_move.size(); i++) {
+
+ print_line("is group: " + to_move[i].path + ": " + itos(EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)));
+ if (to_move[i].is_file && EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)) {
+ print_line("move to: " + p_to_path.plus_file(to_move[i].path.get_file()));
+ EditorFileSystem::get_singleton()->move_group_file(to_move[i].path, p_to_path.plus_file(to_move[i].path.get_file()));
+ }
+ }
+
Map<String, String> file_renames;
Map<String, String> folder_renames;
bool is_moved = false;
@@ -1474,12 +1490,28 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected)
} break;
case FILE_OPEN: {
+ // Open folders
+ TreeItem *selected = tree->get_root();
+ selected = tree->get_next_selected(selected);
+ while (selected) {
+ if (p_selected.find(selected->get_metadata(0)) >= 0) {
+ selected->set_collapsed(false);
+ }
+ selected = tree->get_next_selected(selected);
+ }
// Open the file
for (int i = 0; i < p_selected.size(); i++) {
_select_file(p_selected[i]);
}
} break;
+ case FILE_INHERIT: {
+ // Create a new scene inherited from the selected one
+ if (p_selected.size() == 1) {
+ emit_signal("inherit", p_selected[0]);
+ }
+ } break;
+
case FILE_INSTANCE: {
// Instance all selected scenes
Vector<String> paths;
@@ -2046,13 +2078,16 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (all_files) {
- if (all_files_scenes && filenames.size() >= 1) {
- p_popup->add_item(TTR("Open Scene(s)"), FILE_OPEN);
+ if (all_files_scenes) {
+ if (filenames.size() == 1) {
+ p_popup->add_item(TTR("Open Scene"), FILE_OPEN);
+ p_popup->add_item(TTR("New Inherited Scene"), FILE_INHERIT);
+ } else {
+ p_popup->add_item(TTR("Open Scenes"), FILE_OPEN);
+ }
p_popup->add_item(TTR("Instance"), FILE_INSTANCE);
p_popup->add_separator();
- }
-
- if (!all_files_scenes && filenames.size() == 1) {
+ } else if (filenames.size() == 1) {
p_popup->add_item(TTR("Open"), FILE_OPEN);
p_popup->add_separator();
}
@@ -2353,8 +2388,8 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed);
+ ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
- ADD_SIGNAL(MethodInfo("open"));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));