mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Enable autoload in editor
- Tool scripts will be executed and can be accessed by plugins. - Other script languages can implement add/remove_named_global_constant to make use of this functionality.
This commit is contained in:
parent
613a8bee41
commit
decf178033
10 changed files with 330 additions and 101 deletions
|
@ -108,6 +108,21 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
#endif
|
||||
return &GDScriptLanguage::get_singleton()->get_global_array()[address];
|
||||
} break;
|
||||
#ifdef TOOLS_ENABLED
|
||||
case ADDR_TYPE_NAMED_GLOBAL: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, _named_globals_count, NULL);
|
||||
#endif
|
||||
StringName id = _named_globals_ptr[address];
|
||||
|
||||
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(id)) {
|
||||
return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id];
|
||||
} else {
|
||||
r_error = "Autoload singleton '" + String(id) + "' has been removed.";
|
||||
return NULL;
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
case ADDR_TYPE_NIL: {
|
||||
return &nil;
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue