Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use get_file_uid() where applicable #103472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
@@ -3033,7 +3033,7 @@ Error EditorFileSystem::_copy_file(const String &p_from, const String &p_to) {
if (err != OK) {
return err;
}
} else if (ResourceLoader::get_resource_uid(p_from) == ResourceUID::INVALID_ID) {
} else if (get_file_uid(p_from) == ResourceUID::INVALID_ID) {
// Files which do not use an uid can just be copied.
Error err = da->copy(p_from, p_to);
if (err != OK) {
3 changes: 2 additions & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@

#include "core/config/project_settings.h"
#include "editor/create_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_properties_array_dict.h"
#include "editor/editor_properties_vector.h"
@@ -477,7 +478,7 @@ void EditorPropertyPath::_path_selected(const String &p_path) {
String full_path = p_path;

if (!global) {
const ResourceUID::ID id = ResourceLoader::get_resource_uid(full_path);
const ResourceUID::ID id = EditorFileSystem::get_singleton()->get_file_uid(full_path);
if (id != ResourceUID::INVALID_ID) {
full_path = ResourceUID::get_singleton()->id_to_text(id);
}
8 changes: 4 additions & 4 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
@@ -2006,7 +2006,7 @@ void FileSystemDock::_before_move(HashMap<String, ResourceUID::ID> &r_uids, Hash
for (int i = 0; i < to_move.size(); i++) {
if (to_move[i].is_file) {
renamed_files.insert(to_move[i].path);
ResourceUID::ID uid = ResourceLoader::get_resource_uid(to_move[i].path);
ResourceUID::ID uid = EditorFileSystem::get_singleton()->get_file_uid(to_move[i].path);
if (uid != ResourceUID::INVALID_ID) {
r_uids[to_move[i].path] = uid;
}
@@ -2019,7 +2019,7 @@ void FileSystemDock::_before_move(HashMap<String, ResourceUID::ID> &r_uids, Hash
for (int j = 0; j < current_folder->get_file_count(); j++) {
const String file_path = current_folder->get_file_path(j);
renamed_files.insert(file_path);
ResourceUID::ID uid = ResourceLoader::get_resource_uid(file_path);
ResourceUID::ID uid = EditorFileSystem::get_singleton()->get_file_uid(file_path);
if (uid != ResourceUID::INVALID_ID) {
r_uids[file_path] = uid;
}
@@ -2549,7 +2549,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected

case FILE_COPY_UID: {
if (!p_selected.is_empty()) {
ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_selected[0]);
ResourceUID::ID uid = EditorFileSystem::get_singleton()->get_file_uid(p_selected[0]);
if (uid != ResourceUID::INVALID_ID) {
String uid_string = ResourceUID::get_singleton()->id_to_text(uid);
DisplayServer::get_singleton()->clipboard_set(uid_string);
@@ -3273,7 +3273,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
if (p_paths.size() == 1) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionCopy")), ED_GET_SHORTCUT("filesystem_dock/copy_path"), FILE_COPY_PATH);
p_popup->add_shortcut(ED_GET_SHORTCUT("filesystem_dock/copy_absolute_path"), FILE_COPY_ABSOLUTE_PATH);
if (ResourceLoader::get_resource_uid(p_paths[0]) != ResourceUID::INVALID_ID) {
if (EditorFileSystem::get_singleton()->get_file_uid(p_paths[0]) != ResourceUID::INVALID_ID) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("filesystem_dock/copy_uid"), FILE_COPY_UID);
}
if (root_path_not_selected) {
6 changes: 3 additions & 3 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
@@ -1008,7 +1008,7 @@ void ScriptEditor::_copy_script_uid() {
ScriptEditorBase *se = _get_current_editor();
if (se) {
Ref<Resource> scr = se->get_edited_resource();
ResourceUID::ID uid = ResourceLoader::get_resource_uid(scr->get_path());
ResourceUID::ID uid = EditorFileSystem::get_singleton()->get_file_uid(scr->get_path());
DisplayServer::get_singleton()->clipboard_set(ResourceUID::get_singleton()->id_to_text(uid));
}
}
@@ -1746,7 +1746,7 @@ void ScriptEditor::_prepare_file_menu() {

menu->set_item_disabled(menu->get_item_index(FILE_TOOL_RELOAD_SOFT), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_COPY_PATH), res.is_null() || res->get_path().is_empty());
menu->set_item_disabled(menu->get_item_index(FILE_COPY_UID), res.is_null() || ResourceLoader::get_resource_uid(res->get_path()) == ResourceUID::INVALID_ID);
menu->set_item_disabled(menu->get_item_index(FILE_COPY_UID), res.is_null() || EditorFileSystem::get_singleton()->get_file_uid(res->get_path()) == ResourceUID::INVALID_ID);
menu->set_item_disabled(menu->get_item_index(SHOW_IN_FILE_SYSTEM), res.is_null());

menu->set_item_disabled(menu->get_item_index(WINDOW_PREV), history_pos <= 0);
@@ -3447,7 +3447,7 @@ void ScriptEditor::_make_script_list_context_menu() {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_path"), FILE_COPY_PATH);
context_menu->set_item_disabled(-1, se->get_edited_resource()->get_path().is_empty());
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_uid"), FILE_COPY_UID);
context_menu->set_item_disabled(-1, ResourceLoader::get_resource_uid(se->get_edited_resource()->get_path()) == ResourceUID::INVALID_ID);
context_menu->set_item_disabled(-1, EditorFileSystem::get_singleton()->get_file_uid(se->get_edited_resource()->get_path()) == ResourceUID::INVALID_ID);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/show_in_file_system"), SHOW_IN_FILE_SYSTEM);
context_menu->add_separator();
}