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
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "android_input_handler.h"
|
||||
#include "api/java_class_wrapper.h"
|
||||
#include "api/jni_singleton.h"
|
||||
#include "dir_access_jandroid.h"
|
||||
#include "display_server_android.h"
|
||||
#include "file_access_android.h"
|
||||
|
|
@ -43,7 +42,6 @@
|
|||
#include "net_socket_android.h"
|
||||
#include "os_android.h"
|
||||
#include "plugin/godot_plugin_jni.h"
|
||||
#include "string_android.h"
|
||||
#include "thread_jandroid.h"
|
||||
#include "tts_android.h"
|
||||
|
||||
|
|
@ -52,6 +50,10 @@
|
|||
#include "core/input/input.h"
|
||||
#include "main/main.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/xr_server.h"
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
|
@ -205,8 +207,7 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env
|
|||
|
||||
TTS_Android::setup(p_godot_tts);
|
||||
|
||||
java_class_wrapper = memnew(JavaClassWrapper(godot_java->get_activity()));
|
||||
GDREGISTER_CLASS(JNISingleton);
|
||||
java_class_wrapper = memnew(JavaClassWrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +271,20 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env,
|
|||
}
|
||||
|
||||
if (step.get() == STEP_SHOW_LOGO) {
|
||||
Main::setup_boot_logo();
|
||||
bool xr_enabled = false;
|
||||
#ifndef _3D_DISABLED
|
||||
// Unlike PCVR, there's no additional 2D screen onto which to render the boot logo,
|
||||
// so we skip this step if xr is enabled.
|
||||
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
||||
xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
||||
} else {
|
||||
xr_enabled = XRServer::get_xr_mode() == XRServer::XRMODE_ON;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
if (!xr_enabled) {
|
||||
Main::setup_boot_logo();
|
||||
}
|
||||
|
||||
step.increment();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -455,64 +469,65 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env,
|
|||
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) {
|
||||
String js = jstring_to_string(path, env);
|
||||
|
||||
return env->NewStringUTF(GLOBAL_GET(js).operator String().utf8().get_data());
|
||||
Variant setting_with_override = GLOBAL_GET(js);
|
||||
String setting_value = (setting_with_override.get_type() == Variant::NIL) ? "" : setting_with_override;
|
||||
return env->NewStringUTF(setting_value.utf8().get_data());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) {
|
||||
String editor_setting = "";
|
||||
String editor_setting_value = "";
|
||||
#ifdef TOOLS_ENABLED
|
||||
String godot_setting_key = jstring_to_string(p_setting_key, env);
|
||||
editor_setting = EDITOR_GET(godot_setting_key).operator String();
|
||||
Variant editor_setting = EDITOR_GET(godot_setting_key);
|
||||
editor_setting_value = (editor_setting.get_type() == Variant::NIL) ? "" : editor_setting;
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
|
||||
#endif
|
||||
|
||||
return env->NewStringUTF(editor_setting.utf8().get_data());
|
||||
return env->NewStringUTF(editor_setting_value.utf8().get_data());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params) {
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(ID));
|
||||
ERR_FAIL_NULL(obj);
|
||||
|
||||
String str_method = jstring_to_string(method, env);
|
||||
|
||||
int count = env->GetArrayLength(params);
|
||||
|
||||
Variant *vlist = (Variant *)alloca(sizeof(Variant) * count);
|
||||
const Variant **vptr = (const Variant **)alloca(sizeof(Variant *) * count);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
jobject jobj = env->GetObjectArrayElement(params, i);
|
||||
ERR_FAIL_NULL(jobj);
|
||||
memnew_placement(&vlist[i], Variant(_jobject_to_variant(env, jobj)));
|
||||
vptr[i] = &vlist[i];
|
||||
env->DeleteLocalRef(jobj);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant data = _jobject_to_variant(env, p_data);
|
||||
EditorSettings::get_singleton()->set(key, data);
|
||||
}
|
||||
|
||||
Callable::CallError err;
|
||||
obj->callp(str_method, vptr, count, err);
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params) {
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(ID));
|
||||
ERR_FAIL_NULL(obj);
|
||||
JNIEXPORT jobject JNICALL Java_org_godotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value) {
|
||||
jvalret result;
|
||||
|
||||
String str_method = jstring_to_string(method, env);
|
||||
|
||||
int count = env->GetArrayLength(params);
|
||||
|
||||
Variant *args = (Variant *)alloca(sizeof(Variant) * count);
|
||||
const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *) * count);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
jobject jobj = env->GetObjectArrayElement(params, i);
|
||||
ERR_FAIL_NULL(jobj);
|
||||
memnew_placement(&args[i], Variant(_jobject_to_variant(env, jobj)));
|
||||
argptrs[i] = &args[i];
|
||||
env->DeleteLocalRef(jobj);
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String section = jstring_to_string(p_section, env);
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant default_value = _jobject_to_variant(env, p_default_value);
|
||||
Variant data = EditorSettings::get_singleton()->get_project_metadata(section, key, default_value);
|
||||
result = _variant_to_jvalue(env, data.get_type(), &data, true);
|
||||
}
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings Project Metadata is only available on Editor builds");
|
||||
#endif
|
||||
|
||||
Callable(obj, str_method).call_deferredp(argptrs, count);
|
||||
return result.obj;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String section = jstring_to_string(p_section, env);
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant data = _jobject_to_variant(env, p_data);
|
||||
EditorSettings::get_singleton()->set_project_metadata(section, key, data);
|
||||
}
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings Project Metadata is only available on Editor builds");
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz) {
|
||||
|
|
@ -522,6 +537,22 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JN
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_filePickerCallback(JNIEnv *env, jclass clazz, jboolean p_ok, jobjectArray p_selected_paths) {
|
||||
DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton();
|
||||
if (ds) {
|
||||
Vector<String> selected_paths;
|
||||
|
||||
jint length = env->GetArrayLength(p_selected_paths);
|
||||
for (jint i = 0; i < length; ++i) {
|
||||
jstring java_string = (jstring)env->GetObjectArrayElement(p_selected_paths, i);
|
||||
String path = jstring_to_string(java_string, env);
|
||||
selected_paths.push_back(path);
|
||||
env->DeleteLocalRef(java_string);
|
||||
}
|
||||
ds->emit_file_picker_callback(p_ok, selected_paths);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) {
|
||||
String permission = jstring_to_string(p_permission, env);
|
||||
if (permission == "android.permission.RECORD_AUDIO" && p_result) {
|
||||
|
|
@ -562,4 +593,24 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_shouldDispatchInp
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getProjectResourceDir(JNIEnv *env, jclass clazz) {
|
||||
const String resource_dir = OS::get_singleton()->get_resource_dir();
|
||||
return env->NewStringUTF(resource_dir.utf8().get_data());
|
||||
}
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz) {
|
||||
Engine *engine = Engine::get_singleton();
|
||||
if (engine) {
|
||||
return engine->is_editor_hint();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz) {
|
||||
Engine *engine = Engine::get_singleton();
|
||||
if (engine) {
|
||||
return engine->is_project_manager_hint();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue