|
@@ -1,5 +1,5 @@
|
|
|
/*************************************************************************/
|
|
|
-/* dl_script.h */
|
|
|
+/* gdnative.h */
|
|
|
/*************************************************************************/
|
|
|
/* This file is part of: */
|
|
|
/* GODOT ENGINE */
|
|
@@ -27,8 +27,8 @@
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
/*************************************************************************/
|
|
|
-#ifndef DL_SCRIPT_H
|
|
|
-#define DL_SCRIPT_H
|
|
|
+#ifndef GDNATIVE_H
|
|
|
+#define GDNATIVE_H
|
|
|
|
|
|
#include "io/resource_loader.h"
|
|
|
#include "io/resource_saver.h"
|
|
@@ -40,26 +40,22 @@
|
|
|
|
|
|
#include "godot.h"
|
|
|
|
|
|
-#ifdef TOOLS_ENABLED
|
|
|
-#define DLSCRIPT_EDITOR_FEATURES
|
|
|
-#endif
|
|
|
-
|
|
|
-class DLScriptData;
|
|
|
-class DLLibrary;
|
|
|
+class GDNativeScriptData;
|
|
|
+class GDNativeLibrary;
|
|
|
|
|
|
struct NativeLibrary {
|
|
|
StringName path;
|
|
|
void *handle;
|
|
|
|
|
|
- DLLibrary *dllib;
|
|
|
+ GDNativeLibrary *dllib;
|
|
|
|
|
|
- Map<StringName, DLScriptData *> scripts;
|
|
|
+ Map<StringName, GDNativeScriptData *> scripts;
|
|
|
|
|
|
static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path);
|
|
|
static Error terminate(NativeLibrary *&p_native_lib);
|
|
|
};
|
|
|
|
|
|
-struct DLScriptData {
|
|
|
+struct GDNativeScriptData {
|
|
|
/* typedef void* (InstanceFunc)(godot_object* instance);
|
|
|
typedef void (DestroyFunc)(godot_object* instance,void* userdata);
|
|
|
typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args);
|
|
@@ -111,18 +107,18 @@ struct DLScriptData {
|
|
|
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
|
|
|
StringName base;
|
|
|
StringName base_native_type;
|
|
|
- DLScriptData *base_data;
|
|
|
+ GDNativeScriptData *base_data;
|
|
|
godot_instance_create_func create_func;
|
|
|
godot_instance_destroy_func destroy_func;
|
|
|
|
|
|
bool is_tool;
|
|
|
|
|
|
- DLScriptData() {
|
|
|
+ GDNativeScriptData() {
|
|
|
base = StringName();
|
|
|
base_data = NULL;
|
|
|
is_tool = false;
|
|
|
}
|
|
|
- DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
|
|
|
+ GDNativeScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
|
|
|
base = p_base;
|
|
|
base_data = NULL;
|
|
|
create_func = p_instance;
|
|
@@ -131,16 +127,16 @@ struct DLScriptData {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-class DLLibrary;
|
|
|
+class GDNativeLibrary;
|
|
|
|
|
|
-class DLScript : public Script {
|
|
|
- GDCLASS(DLScript, Script);
|
|
|
+class GDNativeScript : public Script {
|
|
|
+ GDCLASS(GDNativeScript, Script);
|
|
|
|
|
|
- Ref<DLLibrary> library;
|
|
|
+ Ref<GDNativeLibrary> library;
|
|
|
StringName script_name;
|
|
|
StringName base_native_type;
|
|
|
Set<Object *> instances;
|
|
|
- DLScriptData *script_data;
|
|
|
+ GDNativeScriptData *script_data;
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
Set<PlaceHolderScriptInstance *> placeholders;
|
|
@@ -148,10 +144,10 @@ class DLScript : public Script {
|
|
|
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
|
|
|
#endif
|
|
|
|
|
|
- friend class DLInstance;
|
|
|
- friend class DLScriptLanguage;
|
|
|
- friend class DLReloadNode;
|
|
|
- friend class DLLibrary;
|
|
|
+ friend class GDNativeInstance;
|
|
|
+ friend class GDNativeScriptLanguage;
|
|
|
+ friend class GDNativeReloadNode;
|
|
|
+ friend class GDNativeLibrary;
|
|
|
|
|
|
protected:
|
|
|
static void _bind_methods();
|
|
@@ -188,32 +184,32 @@ public:
|
|
|
virtual void get_script_method_list(List<MethodInfo> *p_list) const;
|
|
|
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
|
|
|
|
|
|
- Ref<DLLibrary> get_library() const;
|
|
|
- void set_library(Ref<DLLibrary> p_library);
|
|
|
+ Ref<GDNativeLibrary> get_library() const;
|
|
|
+ void set_library(Ref<GDNativeLibrary> p_library);
|
|
|
|
|
|
StringName get_script_name() const;
|
|
|
void set_script_name(StringName p_script_name);
|
|
|
|
|
|
- DLScript();
|
|
|
- ~DLScript();
|
|
|
+ GDNativeScript();
|
|
|
+ ~GDNativeScript();
|
|
|
};
|
|
|
|
|
|
-class DLLibrary : public Resource {
|
|
|
+class GDNativeLibrary : public Resource {
|
|
|
_THREAD_SAFE_CLASS_
|
|
|
|
|
|
- GDCLASS(DLLibrary, Resource);
|
|
|
- OBJ_SAVE_TYPE(DLLibrary);
|
|
|
+ GDCLASS(GDNativeLibrary, Resource);
|
|
|
+ OBJ_SAVE_TYPE(GDNativeLibrary);
|
|
|
|
|
|
Map<StringName, String> platform_files;
|
|
|
NativeLibrary *native_library;
|
|
|
- static DLLibrary *currently_initialized_library;
|
|
|
+ static GDNativeLibrary *currently_initialized_library;
|
|
|
|
|
|
protected:
|
|
|
- friend class DLScript;
|
|
|
+ friend class GDNativeScript;
|
|
|
friend class NativeLibrary;
|
|
|
- friend class DLReloadNode;
|
|
|
+ friend class GDNativeReloadNode;
|
|
|
|
|
|
- DLScriptData *get_script_data(const StringName p_name);
|
|
|
+ GDNativeScriptData *get_script_data(const StringName p_name);
|
|
|
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
@@ -225,7 +221,7 @@ public:
|
|
|
Error _initialize();
|
|
|
Error _terminate();
|
|
|
|
|
|
- static DLLibrary *get_currently_initialized_library();
|
|
|
+ static GDNativeLibrary *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);
|
|
|
void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
|
|
@@ -236,18 +232,18 @@ public:
|
|
|
void set_platform_file(StringName p_platform, String p_file);
|
|
|
String get_platform_file(StringName p_platform) const;
|
|
|
|
|
|
- DLLibrary();
|
|
|
- ~DLLibrary();
|
|
|
+ GDNativeLibrary();
|
|
|
+ ~GDNativeLibrary();
|
|
|
};
|
|
|
|
|
|
-class DLInstance : public ScriptInstance {
|
|
|
- friend class DLScript;
|
|
|
+class GDNativeInstance : public ScriptInstance {
|
|
|
+ friend class GDNativeScript;
|
|
|
|
|
|
Object *owner;
|
|
|
- Ref<DLScript> script;
|
|
|
+ Ref<GDNativeScript> script;
|
|
|
void *userdata;
|
|
|
|
|
|
- void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
|
|
|
+ void _ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
|
|
|
|
|
|
public:
|
|
|
_FORCE_INLINE_ Object *get_owner() { return owner; }
|
|
@@ -280,19 +276,19 @@ public:
|
|
|
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
|
|
|
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
|
|
|
|
|
|
- DLInstance();
|
|
|
- ~DLInstance();
|
|
|
+ GDNativeInstance();
|
|
|
+ ~GDNativeInstance();
|
|
|
};
|
|
|
|
|
|
-class DLReloadNode;
|
|
|
+class GDNativeReloadNode;
|
|
|
|
|
|
-class DLScriptLanguage : public ScriptLanguage {
|
|
|
- friend class DLScript;
|
|
|
- friend class DLInstance;
|
|
|
- friend class DLReloadNode;
|
|
|
- friend class DLLibrary;
|
|
|
+class GDNativeScriptLanguage : public ScriptLanguage {
|
|
|
+ friend class GDNativeScript;
|
|
|
+ friend class GDNativeInstance;
|
|
|
+ friend class GDNativeReloadNode;
|
|
|
+ friend class GDNativeLibrary;
|
|
|
|
|
|
- static DLScriptLanguage *singleton;
|
|
|
+ static GDNativeScriptLanguage *singleton;
|
|
|
|
|
|
Variant *_global_array; // @Unused necessary?
|
|
|
Vector<Variant> global_array; // @Unused necessary?
|
|
@@ -303,7 +299,7 @@ class DLScriptLanguage : public ScriptLanguage {
|
|
|
|
|
|
Mutex *lock;
|
|
|
|
|
|
- Set<DLScript *> script_list;
|
|
|
+ Set<GDNativeScript *> script_list;
|
|
|
|
|
|
bool profiling;
|
|
|
uint64_t script_frame_time;
|
|
@@ -317,7 +313,7 @@ class DLScriptLanguage : public ScriptLanguage {
|
|
|
public:
|
|
|
Map<StringName, NativeLibrary *> initialized_libraries;
|
|
|
|
|
|
- _FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; }
|
|
|
+ _FORCE_INLINE_ static GDNativeScriptLanguage *get_singleton() { return singleton; }
|
|
|
|
|
|
virtual String get_name() const;
|
|
|
|
|
@@ -391,18 +387,18 @@ public:
|
|
|
/* HACKER FUNCTIONS */
|
|
|
void _compile_dummy_for_the_api();
|
|
|
|
|
|
- DLScriptLanguage();
|
|
|
- ~DLScriptLanguage();
|
|
|
+ GDNativeScriptLanguage();
|
|
|
+ ~GDNativeScriptLanguage();
|
|
|
};
|
|
|
|
|
|
-class DLReloadNode : public Node {
|
|
|
- GDCLASS(DLReloadNode, Node)
|
|
|
+class GDNativeReloadNode : public Node {
|
|
|
+ GDCLASS(GDNativeReloadNode, Node)
|
|
|
public:
|
|
|
static void _bind_methods();
|
|
|
void _notification(int p_what);
|
|
|
};
|
|
|
|
|
|
-class ResourceFormatLoaderDLScript : public ResourceFormatLoader {
|
|
|
+class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader {
|
|
|
public:
|
|
|
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
|
|
|
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
|
@@ -410,12 +406,10 @@ public:
|
|
|
virtual String get_resource_type(const String &p_path) const;
|
|
|
};
|
|
|
|
|
|
-class ResourceFormatSaverDLScript : public ResourceFormatSaver {
|
|
|
+class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver {
|
|
|
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
|
|
|
virtual bool recognize(const RES &p_resource) const;
|
|
|
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
|
|
|
};
|
|
|
|
|
|
-// ugly, but hey
|
|
|
-
|
|
|
-#endif // DL_SCRIPT_H
|
|
|
+#endif // GDNATIVE_H
|