mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
Merge pull request #69079 from adamscott/fix-singleton-scene-cyclic-load
Fix singleton scene cyclic loading
This commit is contained in:
commit
c7ceb94e37
6 changed files with 91 additions and 79 deletions
|
@ -3131,14 +3131,19 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
|||
}
|
||||
}
|
||||
} else if (ResourceLoader::get_resource_type(autoload.path) == "PackedScene") {
|
||||
Error err = OK;
|
||||
Ref<GDScript> scr = GDScriptCache::get_packed_scene_script(autoload.path, err);
|
||||
if (err == OK && scr.is_valid()) {
|
||||
Ref<GDScriptParserRef> singl_parser = get_parser_for(scr->get_path());
|
||||
if (singl_parser.is_valid()) {
|
||||
err = singl_parser->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
|
||||
if (err == OK) {
|
||||
result = type_from_metatype(singl_parser->get_parser()->head->get_datatype());
|
||||
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name];
|
||||
Node *node = Object::cast_to<Node>(constant);
|
||||
if (node != nullptr) {
|
||||
Ref<Script> scr = node->get_script();
|
||||
if (scr.is_valid()) {
|
||||
Ref<GDScriptParserRef> singl_parser = get_parser_for(scr->get_path());
|
||||
if (singl_parser.is_valid()) {
|
||||
Error err = singl_parser->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
|
||||
if (err == OK) {
|
||||
result = type_from_metatype(singl_parser->get_parser()->head->get_datatype());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue