Fix ClassDB API portability with some android and editor classes

- `EditorNavigationMeshGenerator` was being registered as part of the Core API,
even after d3f48f88bb. 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:
Ignacio Etcheverry 2020-01-19 20:02:40 +01:00
parent d11d7dfe3e
commit a6105c8ea0
10 changed files with 135 additions and 20 deletions

View file

@ -2377,10 +2377,7 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output
return tg;
}
void VisualScriptEngineSingleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_singleton", "name"), &VisualScriptEngineSingleton::set_singleton);
ClassDB::bind_method(D_METHOD("get_singleton"), &VisualScriptEngineSingleton::get_singleton);
void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) const {
String cc;
@ -2397,7 +2394,16 @@ void VisualScriptEngineSingleton::_bind_methods() {
cc += E->get().name;
}
ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton");
property.hint = PROPERTY_HINT_ENUM;
property.hint_string = cc;
}
void VisualScriptEngineSingleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_singleton", "name"), &VisualScriptEngineSingleton::set_singleton);
ClassDB::bind_method(D_METHOD("get_singleton"), &VisualScriptEngineSingleton::get_singleton);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant"), "set_singleton", "get_singleton");
}
VisualScriptEngineSingleton::VisualScriptEngineSingleton() {