From 5695d9892ec337699ba9b8b44a67146a7fe39f3a Mon Sep 17 00:00:00 2001 From: Karroffel Date: Sat, 8 Apr 2017 01:28:14 +0200 Subject: [DLScript] in-editor reloading --- modules/dlscript/dl_script.cpp | 223 +++++++++++++++++++++++++++++++---------- 1 file changed, 169 insertions(+), 54 deletions(-) (limited to 'modules/dlscript/dl_script.cpp') diff --git a/modules/dlscript/dl_script.cpp b/modules/dlscript/dl_script.cpp index 9ded081466..47b54f5f33 100644 --- a/modules/dlscript/dl_script.cpp +++ b/modules/dlscript/dl_script.cpp @@ -41,6 +41,10 @@ #include "api_generator.h" #endif +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif + Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p_path) { if (DLScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) { @@ -115,6 +119,29 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) { } // Script +#ifdef TOOLS_ENABLED + +void DLScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { + + List pinfo; + Map values; + + for (Map::Element *E = script_data->properties.front(); E; E = E->next()) { + PropertyInfo p = E->get().info; + p.name = String(E->key()); + pinfo.push_back(p); + values[p.name] = E->get().default_value; + } + + p_placeholder->update(pinfo, values); +} + +void DLScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { + + placeholders.erase(p_placeholder); +} + +#endif bool DLScript::can_instance() const { #ifdef DLSCRIPT_EDITOR_FEATURES @@ -161,13 +188,10 @@ ScriptInstance *DLScript::instance_create(Object *p_this) { PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(DLScriptLanguage::singleton, Ref