diff options
Diffstat (limited to 'modules/gdnative')
13 files changed, 32 insertions, 33 deletions
diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml index be86ff0541..afb014d608 100644 --- a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml +++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.1"> +<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.2"> <brief_description> GDNative wrapper for an ARVR interface </brief_description> diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index ca0457623f..e5a59aad07 100644 --- a/modules/gdnative/doc_classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNative" inherits="Reference" category="Core" version="3.1"> +<class name="GDNative" inherits="Reference" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index 754a6d2514..ba5278d440 100644 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.1"> +<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml b/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml index 4433179726..ba481a6d6e 100644 --- a/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml +++ b/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiplayerPeerGDNative" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1"> +<class name="MultiplayerPeerGDNative" inherits="NetworkedMultiplayerPeer" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml index 37d5b79e7a..c50f9eee22 100644 --- a/modules/gdnative/doc_classes/NativeScript.xml +++ b/modules/gdnative/doc_classes/NativeScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NativeScript" inherits="Script" category="Core" version="3.1"> +<class name="NativeScript" inherits="Script" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/PacketPeerGDNative.xml b/modules/gdnative/doc_classes/PacketPeerGDNative.xml index 0ae54bc9c7..f4d7d22f5b 100644 --- a/modules/gdnative/doc_classes/PacketPeerGDNative.xml +++ b/modules/gdnative/doc_classes/PacketPeerGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PacketPeerGDNative" inherits="PacketPeer" category="Core" version="3.1"> +<class name="PacketPeerGDNative" inherits="PacketPeer" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml index 1876d06c20..8510708124 100644 --- a/modules/gdnative/doc_classes/PluginScript.xml +++ b/modules/gdnative/doc_classes/PluginScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PluginScript" inherits="Script" category="Core" version="3.1"> +<class name="PluginScript" inherits="Script" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml b/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml index 61a7f60499..8e7f4698ff 100644 --- a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml +++ b/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderVideoStreamGDNative" inherits="ResourceFormatLoader" category="Core" version="3.1"> +<class name="ResourceFormatLoaderVideoStreamGDNative" inherits="ResourceFormatLoader" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/StreamPeerGDNative.xml b/modules/gdnative/doc_classes/StreamPeerGDNative.xml index d86cd2c25a..eddebf4889 100644 --- a/modules/gdnative/doc_classes/StreamPeerGDNative.xml +++ b/modules/gdnative/doc_classes/StreamPeerGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeerGDNative" inherits="StreamPeer" category="Core" version="3.1"> +<class name="StreamPeerGDNative" inherits="StreamPeer" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/VideoStreamGDNative.xml b/modules/gdnative/doc_classes/VideoStreamGDNative.xml index 20575c768b..d5c5ed7ccf 100644 --- a/modules/gdnative/doc_classes/VideoStreamGDNative.xml +++ b/modules/gdnative/doc_classes/VideoStreamGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VideoStreamGDNative" inherits="VideoStream" category="Core" version="3.1"> +<class name="VideoStreamGDNative" inherits="VideoStream" category="Core" version="3.2"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index b99c5d31ab..7eb4294732 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -279,7 +279,7 @@ List<ClassAPI> generate_c_api_classes() { MethodInfo &method_info = m->get(); //method name - method_api.method_name = m->get().name; + method_api.method_name = method_info.name; //method return type if (method_api.method_name.find(":") != -1) { method_api.return_type = method_api.method_name.get_slice(":", 1); @@ -321,6 +321,8 @@ List<ClassAPI> generate_c_api_classes() { arg_type = arg_info.hint_string; } else if (arg_info.type == Variant::NIL) { arg_type = "Variant"; + } else if (arg_info.type == Variant::OBJECT) { + arg_type = arg_info.class_name; } else { arg_type = Variant::get_type_name(arg_info.type); } diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 2da9d6bfdc..5cf144d4fe 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -160,8 +160,10 @@ bool NativeScript::can_instance() const { NativeScriptDesc *script_data = get_script_desc(); #ifdef TOOLS_ENABLED - - return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled()); + // Only valid if this is either a tool script or a "regular" script. + // (so an environment whre scripting is disabled (and not the editor) would not + // create objects). + return script_data && (is_tool() || ScriptServer::is_scripting_enabled()); #else return script_data; #endif @@ -199,25 +201,6 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) { return NULL; } -#ifdef TOOLS_ENABLED - if (!ScriptServer::is_scripting_enabled() && !is_tool()) { - // placeholder for nodes. For tools we want the rool thing. - - PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(NSL, Ref<Script>(this), p_this)); - placeholders.insert(sins); - - if (script_data->create_func.create_func) { - script_data->create_func.create_func( - (godot_object *)p_this, - script_data->create_func.method_data); - } - - _update_placeholder(sins); - - return sins; - } -#endif - NativeScriptInstance *nsi = memnew(NativeScriptInstance); nsi->owner = p_this; @@ -246,6 +229,19 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) { return nsi; } +PlaceHolderScriptInstance *NativeScript::placeholder_instance_create(Object *p_this) { +#ifdef TOOLS_ENABLED + PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(NSL, Ref<Script>(this), p_this)); + placeholders.insert(sins); + + _update_placeholder(sins); + + return sins; +#else + return NULL; +#endif +} + bool NativeScript::instance_has(const Object *p_this) const { return instance_owners.has((Object *)p_this); } @@ -1691,7 +1687,7 @@ void NativeReloadNode::_notification(int p_what) { // since singleton libraries are not unloaded there is no point // in loading them again. - if (!gdn->get_library()->is_singleton()) { + if (gdn->get_library()->is_singleton()) { continue; } diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 8dd5ba3b9c..a6865c6243 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -149,6 +149,7 @@ public: virtual StringName get_instance_base_type() const; // this may not work in all scripts, will return empty if so virtual ScriptInstance *instance_create(Object *p_this); + virtual PlaceHolderScriptInstance *placeholder_instance_create(Object *p_this); virtual bool instance_has(const Object *p_this) const; virtual bool has_source_code() const; |