You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user