diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 0b2b59dc87f4..6863c3817f0d 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -39,6 +39,7 @@ #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/project_settings.h" +#include "core/script_language.h" /** * Time constants borrowed from loc_time.h @@ -2989,6 +2990,89 @@ _ClassDB::~_ClassDB() { } /////////////////////////////// +bool _ScriptServer::_set(const StringName &p_name, const Variant &p_value) { + return false; +} + +bool _ScriptServer::_get(const StringName &p_name, Variant &r_ret) const { + if (ScriptServer::is_global_class(p_name)) { + r_ret = ResourceLoader::load(ScriptServer::get_global_class_path(p_name), "Script"); + return true; + } + return false; +} + +void _ScriptServer::_get_property_list(List *p_list) const { + ERR_FAIL_COND(!p_list); + List names; + ScriptServer::get_global_class_list(&names); + for (List::Element *E = names.front(); E; E = E->next()) { + StringName n = E->get(); + String class_name = String(n).get_file().get_extension(); + p_list->push_back(PropertyInfo(Variant::OBJECT, class_name, PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_NETWORK, ResourceLoader::get_resource_type(ScriptServer::get_global_class_path(n)))); + } +} + +bool _ScriptServer::is_global_class(const StringName &p_class) const { + return ScriptServer::is_global_class(p_class); +} + +String _ScriptServer::get_global_class_path(const String &p_class) const { + return ScriptServer::get_global_class_path(p_class); +} + +StringName _ScriptServer::get_global_class_base(const String &p_class) const { + return ScriptServer::get_global_class_base(p_class); +} + +StringName _ScriptServer::get_global_class_native_base(const String &p_class) const { + return ScriptServer::get_global_class_native_base(p_class); +} + +StringName _ScriptServer::get_global_class_name(const String &p_path) const { + return ScriptServer::get_global_class_name(p_path); +} + +Ref