You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix ClassDB API portability with some android and editor classes
- `EditorNavigationMeshGenerator` was being registered as part of the Core API, even afterd3f48f88bb. We must make sure to set Editor as the current ClassDB API type before creating an instance. - The `VisualScriptEngineSingleton.constant` property has a property hint string that's different between tools and non-tools builds. This commit makes the hint string to no longer be set in `_bind_methods`, and to instead set it in `_validate_property`. This way it's ignored when calculating the API hash. - `JavaClassWrapper` is now registered in ClassDB on all platforms, using a dummy implementation on platforms other than Android. This fixes API portability between Android and other platforms. - Updated `--class-db-json` command to ignore non-virtual methods that start with an underscore (see:4be87c6016).
This commit is contained in:
56
platform/android/api/api.cpp
Normal file
56
platform/android/api/api.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "api.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "java_class_wrapper.h"
|
||||
|
||||
#if !defined(ANDROID_ENABLED)
|
||||
static JavaClassWrapper *java_class_wrapper = NULL;
|
||||
#endif
|
||||
|
||||
void register_android_api() {
|
||||
|
||||
#if !defined(ANDROID_ENABLED)
|
||||
java_class_wrapper = memnew(JavaClassWrapper); // Dummy
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<JavaClass>();
|
||||
ClassDB::register_class<JavaClassWrapper>();
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaClassWrapper", JavaClassWrapper::get_singleton()));
|
||||
}
|
||||
|
||||
void unregister_android_api() {
|
||||
|
||||
#if !defined(ANDROID_ENABLED)
|
||||
memdelete(java_class_wrapper);
|
||||
#endif
|
||||
}
|
||||
|
||||
void JavaClassWrapper::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("wrap", "name"), &JavaClassWrapper::wrap);
|
||||
}
|
||||
|
||||
#if !defined(ANDROID_ENABLED)
|
||||
|
||||
Variant JavaClass::call(const StringName &, const Variant **, int, Variant::CallError &) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
JavaClass::JavaClass() {
|
||||
}
|
||||
|
||||
Variant JavaObject::call(const StringName &, const Variant **, int, Variant::CallError &) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
JavaClassWrapper *JavaClassWrapper::singleton = NULL;
|
||||
|
||||
Ref<JavaClass> JavaClassWrapper::wrap(const String &) {
|
||||
return Ref<JavaClass>();
|
||||
}
|
||||
|
||||
JavaClassWrapper::JavaClassWrapper() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user