diff options
Diffstat (limited to 'modules/dlscript/dl_script.h')
| -rw-r--r-- | modules/dlscript/dl_script.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/modules/dlscript/dl_script.h b/modules/dlscript/dl_script.h index 4e42fea12..360f26cb5 100644 --- a/modules/dlscript/dl_script.h +++ b/modules/dlscript/dl_script.h @@ -33,6 +33,7 @@ #include "io/resource_saver.h" #include "os/thread_safe.h" #include "resource.h" +#include "scene/main/node.h" #include "script_language.h" #include "self_list.h" @@ -43,11 +44,14 @@ #endif class DLScriptData; +class DLLibrary; struct NativeLibrary { StringName path; void *handle; + DLLibrary *dllib; + Map<StringName, DLScriptData *> scripts; static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path); @@ -129,7 +133,6 @@ struct DLScriptData { class DLLibrary; class DLScript : public Script { - GDCLASS(DLScript, Script); Ref<DLLibrary> library; @@ -140,12 +143,14 @@ class DLScript : public Script { #ifdef TOOLS_ENABLED Set<PlaceHolderScriptInstance *> placeholders; -// void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); -// virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); + void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); + virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif friend class DLInstance; friend class DLScriptLanguage; + friend class DLReloadNode; + friend class DLLibrary; protected: static void _bind_methods(); @@ -199,18 +204,16 @@ class DLLibrary : public Resource { OBJ_SAVE_TYPE(DLLibrary); Map<StringName, String> platform_files; - NativeLibrary *library; + NativeLibrary *native_library; static DLLibrary *currently_initialized_library; protected: friend class DLScript; friend class NativeLibrary; + friend class DLReloadNode; DLScriptData *get_script_data(const StringName p_name); - Error _initialize(); - Error _terminate(); - bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; @@ -218,6 +221,9 @@ protected: static void _bind_methods(); public: + Error _initialize(); + Error _terminate(); + static DLLibrary *get_currently_initialized_library(); void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func); @@ -277,9 +283,13 @@ public: ~DLInstance(); }; +class DLReloadNode; + class DLScriptLanguage : public ScriptLanguage { friend class DLScript; friend class DLInstance; + friend class DLReloadNode; + friend class DLLibrary; static DLScriptLanguage *singleton; @@ -292,7 +302,7 @@ class DLScriptLanguage : public ScriptLanguage { Mutex *lock; - SelfList<DLScript>::List script_list; + Set<DLScript *> script_list; bool profiling; uint64_t script_frame_time; @@ -384,6 +394,13 @@ public: ~DLScriptLanguage(); }; +class DLReloadNode : public Node { + GDCLASS(DLReloadNode, Node) +public: + static void _bind_methods(); + void _notification(int p_what); +}; + class ResourceFormatLoaderDLScript : public ResourceFormatLoader { public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); |
