mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
EditorNode: Add function to load file as scene or resource
This commit is contained in:
parent
c2ba0a8646
commit
d2d02d0ea8
16 changed files with 57 additions and 142 deletions
|
|
@ -975,19 +975,7 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
if (ScriptServer::is_global_class(p_symbol)) {
|
||||
EditorNode::get_singleton()->load_resource(ScriptServer::get_global_class_path(p_symbol));
|
||||
} else if (p_symbol.is_resource_file() || p_symbol.begins_with("uid://")) {
|
||||
String symbol = p_symbol;
|
||||
if (symbol.begins_with("uid://")) {
|
||||
symbol = ResourceUID::uid_to_path(symbol);
|
||||
}
|
||||
|
||||
List<String> scene_extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
|
||||
|
||||
if (scene_extensions.find(symbol.get_extension())) {
|
||||
EditorNode::get_singleton()->load_scene(symbol);
|
||||
} else {
|
||||
EditorNode::get_singleton()->load_resource(symbol);
|
||||
}
|
||||
EditorNode::get_singleton()->load_scene_or_resource(p_symbol);
|
||||
} else if (lc_error == OK) {
|
||||
_goto_line(p_row);
|
||||
|
||||
|
|
@ -1082,14 +1070,7 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
|
|||
// Every symbol other than absolute path is relative path so keep this condition at last.
|
||||
String path = _get_absolute_path(p_symbol);
|
||||
if (FileAccess::exists(path)) {
|
||||
List<String> scene_extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
|
||||
|
||||
if (scene_extensions.find(path.get_extension())) {
|
||||
EditorNode::get_singleton()->load_scene(path);
|
||||
} else {
|
||||
EditorNode::get_singleton()->load_resource(path);
|
||||
}
|
||||
EditorNode::get_singleton()->load_scene_or_resource(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue