Handle built-in resources in "Jump to owner" tab action

This commit is contained in:
Serhii Snitsaruk 2024-05-29 18:25:17 +02:00
parent 2b299c0007
commit 990438db55
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 9 additions and 2 deletions

View File

@ -27,10 +27,16 @@
Vector<String> OwnerPicker::_find_owners(const String &p_path) const { Vector<String> OwnerPicker::_find_owners(const String &p_path) const {
Vector<String> owners; Vector<String> owners;
if (RESOURCE_PATH_IS_BUILT_IN(p_path)) {
// For built-in resources we use the path to the containing resource.
String owner_path = p_path.substr(0, p_path.rfind("::"));
owners.append(owner_path);
return owners;
}
List<EditorFileSystemDirectory *> dirs; List<EditorFileSystemDirectory *> dirs;
dirs.push_back(EDITOR_FILE_SYSTEM()->get_filesystem()); dirs.push_back(EDITOR_FILE_SYSTEM()->get_filesystem());
while (dirs.size() > 0) { while (dirs.size() > 0) {
EditorFileSystemDirectory *efd = dirs.front()->get(); EditorFileSystemDirectory *efd = dirs.front()->get();
dirs.pop_front(); dirs.pop_front();

View File

@ -237,6 +237,7 @@ Variant VARIANT_DEFAULT(Variant::Type p_type);
#define IS_RESOURCE_FILE(m_path) (m_path.begins_with("res://") && m_path.find("::") == -1) #define IS_RESOURCE_FILE(m_path) (m_path.begins_with("res://") && m_path.find("::") == -1)
#define RESOURCE_TYPE_HINT(m_type) vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, m_type) #define RESOURCE_TYPE_HINT(m_type) vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, m_type)
#define RESOURCE_IS_BUILT_IN(m_res) (m_res->get_path().is_empty() || m_res->get_path().contains("::")) #define RESOURCE_IS_BUILT_IN(m_res) (m_res->get_path().is_empty() || m_res->get_path().contains("::"))
#define RESOURCE_PATH_IS_BUILT_IN(m_path) (m_path.is_empty() || m_path.contains("::"))
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED