1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Godot Android plugin re-architecture

This commit is contained in:
Fredia Huya-Kouadio
2023-07-17 12:11:37 -07:00
parent fa3428ff25
commit 8cc7739197
13 changed files with 169 additions and 207 deletions

View File

@@ -129,31 +129,4 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitS
singleton->emit_signalp(StringName(signal_name), args, count);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterGDExtensionLibraries(JNIEnv *env, jclass clazz, jobjectArray gdextension_paths) {
int gdextension_count = env->GetArrayLength(gdextension_paths);
if (gdextension_count == 0) {
return;
}
// Retrieve the current list of gdextension libraries.
Array singletons;
if (ProjectSettings::get_singleton()->has_setting("gdextension/singletons")) {
singletons = GLOBAL_GET("gdextension/singletons");
}
// Insert the libraries provided by the plugin
for (int i = 0; i < gdextension_count; i++) {
jstring relative_path = (jstring)env->GetObjectArrayElement(gdextension_paths, i);
String path = "res://" + jstring_to_string(relative_path, env);
if (!singletons.has(path)) {
singletons.push_back(path);
}
env->DeleteLocalRef(relative_path);
}
// Insert the updated list back into project settings.
ProjectSettings::get_singleton()->set("gdextension/singletons", singletons);
}
}