feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -30,12 +30,11 @@
|
|||
|
||||
#include "godot_plugin_jni.h"
|
||||
|
||||
#include "api/java_class_wrapper.h"
|
||||
#include "api/jni_singleton.h"
|
||||
#include "jni_utils.h"
|
||||
#include "string_android.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/error/error_macros.h"
|
||||
|
||||
static HashMap<String, JNISingleton *> jni_singletons;
|
||||
|
|
@ -43,7 +42,6 @@ static HashMap<String, JNISingleton *> jni_singletons;
|
|||
void unregister_plugins_singletons() {
|
||||
for (const KeyValue<String, JNISingleton *> &E : jni_singletons) {
|
||||
Engine::get_singleton()->remove_singleton(E.key);
|
||||
ProjectSettings::get_singleton()->set(E.key, Variant());
|
||||
|
||||
if (E.value) {
|
||||
memdelete(E.value);
|
||||
|
|
@ -59,12 +57,15 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeR
|
|||
|
||||
ERR_FAIL_COND_V(jni_singletons.has(singname), false);
|
||||
|
||||
JNISingleton *s = (JNISingleton *)ClassDB::instantiate("JNISingleton");
|
||||
s->set_instance(env->NewGlobalRef(obj));
|
||||
jni_singletons[singname] = s;
|
||||
jclass java_class = env->GetObjectClass(obj);
|
||||
Ref<JavaClass> java_class_wrapped = JavaClassWrapper::get_singleton()->wrap_jclass(java_class, true);
|
||||
env->DeleteLocalRef(java_class);
|
||||
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton(singname, s));
|
||||
ProjectSettings::get_singleton()->set(singname, s);
|
||||
Ref<JavaObject> plugin_object = memnew(JavaObject(java_class_wrapped, obj));
|
||||
JNISingleton *plugin_singleton = memnew(JNISingleton(plugin_object));
|
||||
jni_singletons[singname] = plugin_singleton;
|
||||
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton(singname, plugin_singleton));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +79,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
|
|||
String mname = jstring_to_string(name, env);
|
||||
String retval = jstring_to_string(ret, env);
|
||||
Vector<Variant::Type> types;
|
||||
String cs = "(";
|
||||
|
||||
int stringCount = env->GetArrayLength(args);
|
||||
|
||||
|
|
@ -86,18 +86,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
|
|||
jstring string = (jstring)env->GetObjectArrayElement(args, i);
|
||||
const String rawString = jstring_to_string(string, env);
|
||||
types.push_back(get_jni_type(rawString));
|
||||
cs += get_jni_sig(rawString);
|
||||
}
|
||||
|
||||
cs += ")";
|
||||
cs += get_jni_sig(retval);
|
||||
jclass cls = env->GetObjectClass(s->get_instance());
|
||||
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
|
||||
if (!mid) {
|
||||
print_line("Failed getting method ID " + mname);
|
||||
}
|
||||
|
||||
s->add_method(mname, mid, types, get_jni_type(retval));
|
||||
s->add_method(mname, types, get_jni_type(retval));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_param_types) {
|
||||
|
|
@ -144,5 +135,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitS
|
|||
}
|
||||
|
||||
singleton->emit_signalp(StringName(signal_name), args, count);
|
||||
|
||||
// Manually invoke the destructor to decrease the reference counts for the variant arguments.
|
||||
for (int i = 0; i < count; i++) {
|
||||
variant_params[i].~Variant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue