Core: Remove class_db.h include from ref_counted.h
This commit is contained in:
parent
f630133a01
commit
abdde1b69d
48 changed files with 185 additions and 84 deletions
|
|
@ -28,7 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "core/crypto/aes_context.h"
|
||||
#include "aes_context.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/crypto/crypto_core.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class AESContext : public RefCounted {
|
||||
GDCLASS(AESContext, RefCounted);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class HashingContext : public RefCounted {
|
||||
GDCLASS(HashingContext, RefCounted);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "core/os/memory.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
/**
|
||||
* Multi-Platform abstraction for accessing to files.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "file_access_compressed.h"
|
||||
|
||||
#include "core/math/math_funcs_binary.h"
|
||||
|
||||
void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, uint32_t p_block_size) {
|
||||
magic = p_magic.ascii().get_data();
|
||||
magic = (magic + " ").substr(0, 4);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/io/ip_address.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
template <typename T>
|
||||
class TypedArray;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "core/io/dir_access.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/string_builder.h"
|
||||
|
||||
#define FILESYSTEM_CACHE_VERSION 1
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "stream_peer_socket.compat.inc"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
Error StreamPeerSocket::poll() {
|
||||
if (status == STATUS_CONNECTED) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
void StreamPeerTCP::accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) {
|
||||
_sock = p_sock;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
void StreamPeerUDS::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("bind", "path"), &StreamPeerUDS::bind);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "core/object/ref_counted.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/vector.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
/*
|
||||
Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/templates/safe_refcount.h"
|
||||
|
||||
|
|
@ -239,40 +238,6 @@ public:
|
|||
void set_ref(const Ref<RefCounted> &p_ref);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct PtrToArg<Ref<T>> {
|
||||
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
|
||||
if (p_ptr == nullptr) {
|
||||
return Ref<T>();
|
||||
}
|
||||
// p_ptr points to a RefCounted object
|
||||
return Ref<T>(*reinterpret_cast<T *const *>(p_ptr));
|
||||
}
|
||||
|
||||
typedef Ref<T> EncodeT;
|
||||
|
||||
_FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) {
|
||||
// p_ptr points to an EncodeT object which is a Ref<T> object.
|
||||
*(const_cast<Ref<RefCounted> *>(reinterpret_cast<const Ref<RefCounted> *>(p_ptr))) = p_val;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct GetTypeInfo<Ref<T>> {
|
||||
static const Variant::Type VARIANT_TYPE = Variant::OBJECT;
|
||||
static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE;
|
||||
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return PropertyInfo(Variant::OBJECT, String(), PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VariantInternalAccessor<Ref<T>> {
|
||||
static _FORCE_INLINE_ Ref<T> get(const Variant *v) { return Ref<T>(*VariantInternal::get_object(v)); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const Ref<T> &p_ref) { VariantInternal::object_assign(v, p_ref); }
|
||||
};
|
||||
|
||||
// Zero-constructing Ref initializes reference to nullptr (and thus empty).
|
||||
template <typename T>
|
||||
struct is_zero_constructible<Ref<T>> : std::true_type {};
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#include "core/core_globals.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
static PrintHandlerList *print_handler_list = nullptr;
|
||||
static thread_local bool is_printing = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -270,9 +270,32 @@ struct PtrToArg<const T *> {
|
|||
}
|
||||
};
|
||||
|
||||
// This is for Ref.
|
||||
|
||||
template <typename T>
|
||||
struct PtrToArg<Ref<T>> {
|
||||
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
|
||||
if (p_ptr == nullptr) {
|
||||
return Ref<T>();
|
||||
}
|
||||
// p_ptr points to a RefCounted object
|
||||
return Ref<T>(*reinterpret_cast<T *const *>(p_ptr));
|
||||
}
|
||||
|
||||
typedef Ref<T> EncodeT;
|
||||
|
||||
_FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) {
|
||||
// p_ptr points to an EncodeT object which is a Ref<T> object.
|
||||
*(const_cast<Ref<T> *>(reinterpret_cast<const Ref<T> *>(p_ptr))) = p_val;
|
||||
}
|
||||
};
|
||||
|
||||
// This is for RequiredParam.
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class RequiredParam;
|
||||
|
||||
template <typename T>
|
||||
struct PtrToArg<RequiredParam<T>> {
|
||||
typedef typename RequiredParam<T>::persistent_type EncodeT;
|
||||
|
||||
|
|
@ -290,7 +313,10 @@ struct PtrToArg<RequiredParam<T>> {
|
|||
|
||||
// This is for RequiredResult.
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class RequiredResult;
|
||||
|
||||
template <typename T>
|
||||
struct PtrToArg<RequiredResult<T>> {
|
||||
typedef typename RequiredResult<T>::ptr_type EncodeT;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,10 +183,20 @@ struct GetTypeInfo<T *, std::enable_if_t<std::is_base_of_v<Object, T>>> {
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct GetTypeInfo<Ref<T>> {
|
||||
static const Variant::Type VARIANT_TYPE = Variant::OBJECT;
|
||||
static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE;
|
||||
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return PropertyInfo(Variant::OBJECT, String(), PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class RequiredParam;
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class RequiredResult;
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -637,6 +637,12 @@ struct VariantInternalAccessor<Object *> {
|
|||
static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { VariantInternal::object_assign(v, p_value); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VariantInternalAccessor<Ref<T>> {
|
||||
static _FORCE_INLINE_ Ref<T> get(const Variant *v) { return Ref<T>(const_cast<Object *>(*VariantInternal::get_object(v))); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const Ref<T> &p_ref) { VariantInternal::object_assign(v, p_ref); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct VariantInternalAccessor<RequiredParam<T>> {
|
||||
static _FORCE_INLINE_ RequiredParam<T> get(const Variant *v) { return RequiredParam<T>(Object::cast_to<T>(const_cast<Object *>(*VariantInternal::get_object(v)))); }
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
class EditorExportPlatform;
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class EditorExportPreset : public RefCounted {
|
||||
GDCLASS(EditorExportPreset, RefCounted);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include "mobile_vr_interface.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
Ref<MobileVRInterface> mobile_vr;
|
||||
|
||||
void initialize_mobile_vr_module(ModuleInitializationLevel p_level) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "nav_mesh_queries_2d.h"
|
||||
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/os/semaphore.h"
|
||||
|
||||
class NavLinkIteration2D;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "2d/nav_base_iteration_2d.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "nav_base_2d.h"
|
||||
#include "nav_utils_2d.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/object/worker_thread_pool.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "servers/navigation_2d/navigation_constants_2d.h"
|
||||
|
||||
#include <KdTree2d.h>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "nav_mesh_queries_3d.h"
|
||||
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/os/semaphore.h"
|
||||
|
||||
class NavLinkIteration3D;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "3d/nav_base_iteration_3d.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "nav_base_3d.h"
|
||||
#include "nav_utils_3d.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/object/worker_thread_pool.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "servers/navigation_3d/navigation_constants_3d.h"
|
||||
|
||||
#include <KdTree2d.h>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
#include "upnp_miniupnp.h"
|
||||
#endif
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void initialize_upnp_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "upnp_device.h"
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class UPNP : public RefCounted {
|
||||
GDCLASS(UPNP, RefCounted);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class UPNPDevice : public RefCounted {
|
||||
GDCLASS(UPNPDevice, RefCounted);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,14 @@
|
|||
|
||||
#include "upnp_miniupnp.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
#include <miniupnpc/upnpcommands.h>
|
||||
|
||||
UPNPDevice *UPNPDeviceMiniUPNP::_create(bool p_notify_postinitialize) {
|
||||
return static_cast<UPNPDevice *>(ClassDB::creator<UPNPDeviceMiniUPNP>(p_notify_postinitialize));
|
||||
}
|
||||
|
||||
void UPNPDeviceMiniUPNP::make_default() {
|
||||
UPNPDevice::_create = UPNPDeviceMiniUPNP::_create;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class UPNPDeviceMiniUPNP : public UPNPDevice {
|
|||
GDCLASS(UPNPDeviceMiniUPNP, UPNPDevice);
|
||||
|
||||
private:
|
||||
static UPNPDevice *_create(bool p_notify_postinitialize) { return static_cast<UPNPDevice *>(ClassDB::creator<UPNPDeviceMiniUPNP>(p_notify_postinitialize)); }
|
||||
static UPNPDevice *_create(bool p_notify_postinitialize);
|
||||
|
||||
String description_url;
|
||||
String service_type;
|
||||
|
|
|
|||
|
|
@ -34,11 +34,17 @@
|
|||
|
||||
#include "upnp_device_miniupnp.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
#include <miniupnpc/miniwget.h>
|
||||
#include <miniupnpc/upnpcommands.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
UPNP *UPNPMiniUPNP::_create(bool p_notify_postinitialize) {
|
||||
return static_cast<UPNP *>(ClassDB::creator<UPNPMiniUPNP>(p_notify_postinitialize));
|
||||
}
|
||||
|
||||
void UPNPMiniUPNP::make_default() {
|
||||
UPNP::_create = UPNPMiniUPNP::_create;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class UPNPMiniUPNP : public UPNP {
|
|||
GDCLASS(UPNPMiniUPNP, UPNP);
|
||||
|
||||
private:
|
||||
static UPNP *_create(bool p_notify_postinitialize) { return static_cast<UPNP *>(ClassDB::creator<UPNPMiniUPNP>(p_notify_postinitialize)); }
|
||||
static UPNP *_create(bool p_notify_postinitialize);
|
||||
|
||||
String discover_multicast_if = "";
|
||||
int discover_local_port = 0;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#include "webxr_interface.h"
|
||||
#include "webxr_interface_js.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
#ifdef WEB_ENABLED
|
||||
Ref<WebXRInterfaceJS> webxr;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "jni_singleton.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
#if !defined(ANDROID_ENABLED)
|
||||
static JavaClassWrapper *java_class_wrapper = nullptr;
|
||||
|
|
|
|||
77
platform/android/api/jni_singleton.cpp
Normal file
77
platform/android/api/jni_singleton.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/**************************************************************************/
|
||||
/* jni_singleton.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "jni_singleton.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void JNISingleton::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("has_java_method", "method"), &JNISingleton::has_java_method);
|
||||
}
|
||||
|
||||
Variant JNISingleton::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||
// Godot methods take precedence.
|
||||
Variant ret = Object::callp(p_method, p_args, p_argcount, r_error);
|
||||
if (r_error.error == Callable::CallError::CALL_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Check the method we're looking for is in the JNISingleton map.
|
||||
// This is done because JNISingletons register methods differently than wrapped JavaClass / JavaObject to allow
|
||||
// for access to private methods annotated with the @UsedByGodot annotation.
|
||||
// In the future, we should remove access to private methods and require that JNISingletons' methods exposed to
|
||||
// GDScript be all public, similarly to what we do for wrapped JavaClass / JavaObject methods. Doing so will
|
||||
// also allow dropping and deprecating the @UsedByGodot annotation.
|
||||
RBMap<StringName, MethodData>::Element *E = method_map.find(p_method);
|
||||
if (E) {
|
||||
if (wrapped_object.is_valid()) {
|
||||
return wrapped_object->callp(p_method, p_args, p_argcount, r_error);
|
||||
} else {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
}
|
||||
}
|
||||
return Variant();
|
||||
}
|
||||
|
||||
void JNISingleton::add_method(const StringName &p_name, const Vector<Variant::Type> &p_args, Variant::Type p_ret_type) {
|
||||
MethodData md;
|
||||
md.argtypes = p_args;
|
||||
md.ret_type = p_ret_type;
|
||||
method_map[p_name] = md;
|
||||
}
|
||||
|
||||
void JNISingleton::add_signal(const StringName &p_name, const Vector<Variant::Type> &p_args) {
|
||||
MethodInfo mi;
|
||||
mi.name = p_name;
|
||||
for (int i = 0; i < p_args.size(); i++) {
|
||||
mi.arguments.push_back(PropertyInfo(p_args[i], "arg" + itos(i + 1)));
|
||||
}
|
||||
ADD_SIGNAL(mi);
|
||||
}
|
||||
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "java_class_wrapper.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/templates/rb_map.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
|
|
@ -48,34 +47,10 @@ class JNISingleton : public Object {
|
|||
Ref<JavaObject> wrapped_object;
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("has_java_method", "method"), &JNISingleton::has_java_method);
|
||||
}
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override {
|
||||
// Godot methods take precedence.
|
||||
Variant ret = Object::callp(p_method, p_args, p_argcount, r_error);
|
||||
if (r_error.error == Callable::CallError::CALL_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Check the method we're looking for is in the JNISingleton map.
|
||||
// This is done because JNISingletons register methods differently than wrapped JavaClass / JavaObject to allow
|
||||
// for access to private methods annotated with the @UsedByGodot annotation.
|
||||
// In the future, we should remove access to private methods and require that JNISingletons' methods exposed to
|
||||
// GDScript be all public, similarly to what we do for wrapped JavaClass / JavaObject methods. Doing so will
|
||||
// also allow dropping and deprecating the @UsedByGodot annotation.
|
||||
RBMap<StringName, MethodData>::Element *E = method_map.find(p_method);
|
||||
if (E) {
|
||||
if (wrapped_object.is_valid()) {
|
||||
return wrapped_object->callp(p_method, p_args, p_argcount, r_error);
|
||||
} else {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
}
|
||||
}
|
||||
return Variant();
|
||||
}
|
||||
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override;
|
||||
|
||||
Ref<JavaObject> get_wrapped_object() const {
|
||||
return wrapped_object;
|
||||
|
|
@ -85,21 +60,9 @@ public:
|
|||
return method_map.has(p_method);
|
||||
}
|
||||
|
||||
void add_method(const StringName &p_name, const Vector<Variant::Type> &p_args, Variant::Type p_ret_type) {
|
||||
MethodData md;
|
||||
md.argtypes = p_args;
|
||||
md.ret_type = p_ret_type;
|
||||
method_map[p_name] = md;
|
||||
}
|
||||
void add_method(const StringName &p_name, const Vector<Variant::Type> &p_args, Variant::Type p_ret_type);
|
||||
|
||||
void add_signal(const StringName &p_name, const Vector<Variant::Type> &p_args) {
|
||||
MethodInfo mi;
|
||||
mi.name = p_name;
|
||||
for (int i = 0; i < p_args.size(); i++) {
|
||||
mi.arguments.push_back(PropertyInfo(p_args[i], "arg" + itos(i + 1)));
|
||||
}
|
||||
ADD_SIGNAL(mi);
|
||||
}
|
||||
void add_signal(const StringName &p_name, const Vector<Variant::Type> &p_args);
|
||||
|
||||
JNISingleton() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class Tween;
|
||||
class Node;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
/**
|
||||
The camera server is a singleton object that gives access to the various
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "servers/navigation_2d/navigation_constants_2d.h"
|
||||
|
||||
class NavigationPathQueryParameters2D : public RefCounted {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "servers/navigation_2d/navigation_constants_2d.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "servers/navigation_3d/navigation_constants_3d.h"
|
||||
|
||||
class NavigationPathQueryParameters3D : public RefCounted {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "servers/navigation_3d/navigation_constants_3d.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
/**
|
||||
The XR interface is a template class on top of which we build interface to different AR, VR and tracking SDKs.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
|
||||
class XRPose : public RefCounted {
|
||||
GDCLASS(XRPose, RefCounted);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/variant/binder_common.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
class XRInterface;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ TEST_FORCE_LINK(test_tcp_server)
|
|||
#include "core/config/project_settings.h"
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
#include "core/io/tcp_server.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ TEST_FORCE_LINK(test_udp_server)
|
|||
|
||||
#include "core/io/packet_peer_udp.h"
|
||||
#include "core/io/udp_server.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ TEST_FORCE_LINK(test_uds_server)
|
|||
#include "core/io/file_access.h"
|
||||
#include "core/io/stream_peer_uds.h"
|
||||
#include "core/io/uds_server.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
TEST_FORCE_LINK(test_worker_thread_pool)
|
||||
|
||||
#include "core/object/callable_method_pointer.h"
|
||||
#include "core/object/worker_thread_pool.h"
|
||||
|
||||
namespace TestWorkerThreadPool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue