@@ -21,53 +21,53 @@ static const char *TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH = "res://addons/godot_
2121} // namespace
2222
2323MetaToolkitExportPlugin::MetaToolkitExportPlugin () {
24- _enable_meta_toolkit_option = _generate_export_option (
25- " meta_toolkit/enable_meta_toolkit" ,
26- " " ,
27- Variant::Type::BOOL,
28- PROPERTY_HINT_NONE,
29- " " ,
30- PROPERTY_USAGE_DEFAULT,
31- false ,
32- true );
24+ _enable_meta_toolkit_option = _generate_export_option (
25+ " meta_toolkit/enable_meta_toolkit" ,
26+ " " ,
27+ Variant::Type::BOOL,
28+ PROPERTY_HINT_NONE,
29+ " " ,
30+ PROPERTY_USAGE_DEFAULT,
31+ false ,
32+ true );
3333}
3434
3535void MetaToolkitExportPlugin::_bind_methods () {}
3636
3737Dictionary MetaToolkitExportPlugin::_generate_export_option (const godot::String &p_name,
38- const godot::String &p_class_name,
39- Variant::Type p_type,
40- godot::PropertyHint p_property_hint,
41- const godot::String &p_hint_string,
42- godot::PropertyUsageFlags p_property_usage,
43- const godot::Variant &p_default_value,
44- bool p_update_visibility) {
45- Dictionary option_info;
46- option_info[" name" ] = p_name;
47- option_info[" class_name" ] = p_class_name;
48- option_info[" type" ] = p_type;
49- option_info[" hint" ] = p_property_hint;
50- option_info[" hint_string" ] = p_hint_string;
51- option_info[" usage" ] = p_property_usage;
52-
53- Dictionary export_option;
54- export_option[" option" ] = option_info;
55- export_option[" default_value" ] = p_default_value;
56- export_option[" update_visibility" ] = p_update_visibility;
57-
58- return export_option;
38+ const godot::String &p_class_name,
39+ Variant::Type p_type,
40+ godot::PropertyHint p_property_hint,
41+ const godot::String &p_hint_string,
42+ godot::PropertyUsageFlags p_property_usage,
43+ const godot::Variant &p_default_value,
44+ bool p_update_visibility) {
45+ Dictionary option_info;
46+ option_info[" name" ] = p_name;
47+ option_info[" class_name" ] = p_class_name;
48+ option_info[" type" ] = p_type;
49+ option_info[" hint" ] = p_property_hint;
50+ option_info[" hint_string" ] = p_hint_string;
51+ option_info[" usage" ] = p_property_usage;
52+
53+ Dictionary export_option;
54+ export_option[" option" ] = option_info;
55+ export_option[" default_value" ] = p_default_value;
56+ export_option[" update_visibility" ] = p_update_visibility;
57+
58+ return export_option;
5959}
6060
6161bool MetaToolkitExportPlugin::_supports_platform (const Ref<godot::EditorExportPlatform> &p_platform) const {
62- return p_platform->is_class (EditorExportPlatformAndroid::get_class_static ());
62+ return p_platform->is_class (EditorExportPlatformAndroid::get_class_static ());
6363}
6464
6565bool MetaToolkitExportPlugin::_get_bool_option (const godot::String &p_option) const {
66- Variant option_enabled = get_option (p_option);
67- if (option_enabled.get_type () == Variant::Type::BOOL) {
68- return option_enabled;
69- }
70- return false ;
66+ Variant option_enabled = get_option (p_option);
67+ if (option_enabled.get_type () == Variant::Type::BOOL) {
68+ return option_enabled;
69+ }
70+ return false ;
7171}
7272
7373int MetaToolkitExportPlugin::_get_int_option (const godot::String &p_option, int default_value) const {
@@ -87,32 +87,32 @@ String MetaToolkitExportPlugin::_bool_to_string(bool p_value) const {
8787}
8888
8989TypedArray<Dictionary> MetaToolkitExportPlugin::_get_export_options (const Ref<godot::EditorExportPlatform> &p_platform) const {
90- TypedArray<Dictionary> export_options;
91- if (!_supports_platform (p_platform)) {
92- return export_options;
93- }
90+ TypedArray<Dictionary> export_options;
91+ if (!_supports_platform (p_platform)) {
92+ return export_options;
93+ }
9494
95- export_options.append (_enable_meta_toolkit_option);
95+ export_options.append (_enable_meta_toolkit_option);
9696
97- return export_options;
97+ return export_options;
9898}
9999
100100String MetaToolkitExportPlugin::_get_export_option_warning (
101- const Ref<godot::EditorExportPlatform> &p_platform, const godot::String &p_option) const {
102- return " " ;
101+ const Ref<godot::EditorExportPlatform> &p_platform, const godot::String &p_option) const {
102+ return " " ;
103103}
104104
105105Dictionary MetaToolkitExportPlugin::_get_export_options_overrides (
106- const Ref<godot::EditorExportPlatform> &p_platform) const {
107- Dictionary overrides;
108- if (!_supports_platform (p_platform)) {
109- return overrides;
110- }
106+ const Ref<godot::EditorExportPlatform> &p_platform) const {
107+ Dictionary overrides;
108+ if (!_supports_platform (p_platform)) {
109+ return overrides;
110+ }
111111
112- // Check if this plugin is enabled
113- if (!_is_plugin_enabled ()) {
114- return overrides;
115- }
112+ // Check if this plugin is enabled
113+ if (!_is_plugin_enabled ()) {
114+ return overrides;
115+ }
116116
117117 // Disable gradle build on the Android editor
118118 bool is_mobile_editor = OS::get_singleton ()->has_feature (" mobile" );
@@ -138,91 +138,89 @@ Dictionary MetaToolkitExportPlugin::_get_export_options_overrides(
138138 overrides[" custom_template/release" ] = TOOLKIT_PREBUILT_RELEASE_TEMPLATE_PATH;
139139 }
140140
141- // Check if we have an alternate build template
142- if (FileAccess::file_exists (TOOLKIT_BUILD_TEMPLATE_ZIP_PATH)) {
143- overrides[" gradle_build/gradle_build_directory" ] = " res://addons/godot_meta_toolkit/build" ;
144- overrides[" gradle_build/android_source_template" ] = TOOLKIT_BUILD_TEMPLATE_ZIP_PATH;
145- }
146-
147- // Check if we have a debug keystore available
148- if (FileAccess::file_exists (TOOLKIT_DEBUG_KEYSTORE_PATH)
149- && FileAccess::file_exists (TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH)) {
150- // Read the debug keystore user and password from the properties file
151- // The file should contain the following lines:
152- // key.alias=platformkeystore
153- // key.alias.password=android
154- Ref<FileAccess> file_access = FileAccess::open (TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH, FileAccess::ModeFlags::READ);
155- if (file_access.is_valid ()) {
156- String debug_user;
157- String debug_password;
158-
159- while (file_access->get_position () < file_access->get_length ()
160- && (debug_user.is_empty () || debug_password.is_empty ())) {
161- String current_line = file_access->get_line ();
162- PackedStringArray current_line_splits = current_line.split (" =" , false );
163- if (current_line_splits.size () == 2 ) {
164- if (current_line_splits[0 ] == " key.alias" ) {
165- debug_user = current_line_splits[1 ];
166- } else if (current_line_splits[0 ] == " key.alias.password" ) {
167- debug_password = current_line_splits[1 ];
168- }
169- }
170- }
171-
172- if (!debug_user.is_empty () && !debug_password.is_empty ()) {
173- overrides[" keystore/debug" ] = ProjectSettings::get_singleton ()->globalize_path (TOOLKIT_DEBUG_KEYSTORE_PATH);
174- overrides[" keystore/debug_user" ] = debug_user;
175- overrides[" keystore/debug_password" ] = debug_password;
176- }
177- }
178- }
179-
180- // Architectures overrides
181- overrides[" architectures/armeabi-v7a" ] = false ;
182- overrides[" architectures/arm64-v8a" ] = true ;
183- overrides[" architectures/x86" ] = false ;
184- overrides[" architectures/x86_64" ] = false ;
185-
186- // Package overrides
187- overrides[" package/show_in_android_tv" ] = false ;
141+ // Check if we have an alternate build template
142+ if (FileAccess::file_exists (TOOLKIT_BUILD_TEMPLATE_ZIP_PATH)) {
143+ overrides[" gradle_build/gradle_build_directory" ] = " res://addons/godot_meta_toolkit/build" ;
144+ overrides[" gradle_build/android_source_template" ] = TOOLKIT_BUILD_TEMPLATE_ZIP_PATH;
145+ }
146+
147+ // Check if we have a debug keystore available
148+ if (FileAccess::file_exists (TOOLKIT_DEBUG_KEYSTORE_PATH) && FileAccess::file_exists (TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH)) {
149+ // Read the debug keystore user and password from the properties file
150+ // The file should contain the following lines:
151+ // key.alias=platformkeystore
152+ // key.alias.password=android
153+ Ref<FileAccess> file_access = FileAccess::open (TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH, FileAccess::ModeFlags::READ);
154+ if (file_access.is_valid ()) {
155+ String debug_user;
156+ String debug_password;
157+
158+ while (file_access->get_position () < file_access->get_length () && (debug_user.is_empty () || debug_password.is_empty ())) {
159+ String current_line = file_access->get_line ();
160+ PackedStringArray current_line_splits = current_line.split (" =" , false );
161+ if (current_line_splits.size () == 2 ) {
162+ if (current_line_splits[0 ] == " key.alias" ) {
163+ debug_user = current_line_splits[1 ];
164+ } else if (current_line_splits[0 ] == " key.alias.password" ) {
165+ debug_password = current_line_splits[1 ];
166+ }
167+ }
168+ }
169+
170+ if (!debug_user.is_empty () && !debug_password.is_empty ()) {
171+ overrides[" keystore/debug" ] = ProjectSettings::get_singleton ()->globalize_path (TOOLKIT_DEBUG_KEYSTORE_PATH);
172+ overrides[" keystore/debug_user" ] = debug_user;
173+ overrides[" keystore/debug_password" ] = debug_password;
174+ }
175+ }
176+ }
177+
178+ // Architectures overrides
179+ overrides[" architectures/armeabi-v7a" ] = false ;
180+ overrides[" architectures/arm64-v8a" ] = true ;
181+ overrides[" architectures/x86" ] = false ;
182+ overrides[" architectures/x86_64" ] = false ;
183+
184+ // Package overrides
185+ overrides[" package/show_in_android_tv" ] = false ;
188186 overrides[" package/show_in_app_library" ] = true ;
189187 overrides[" package/show_as_launcher_app" ] = false ;
190188
191- // Screen overrides
192- overrides[" screen/immersive_mode" ] = true ;
193- overrides[" screen/support_small" ] = true ;
194- overrides[" screen/support_normal" ] = true ;
195- overrides[" screen/support_large" ] = true ;
196- overrides[" screen/support_xlarge" ] = true ;
189+ // Screen overrides
190+ overrides[" screen/immersive_mode" ] = true ;
191+ overrides[" screen/support_small" ] = true ;
192+ overrides[" screen/support_normal" ] = true ;
193+ overrides[" screen/support_large" ] = true ;
194+ overrides[" screen/support_xlarge" ] = true ;
197195
198196 // Gesture overrides
199197 overrides[" gesture/swipe_to_dismiss" ] = false ;
200198
201- // XR features overrides
202- overrides[" xr_features/xr_mode" ] = 1 ; // OpenXR mode
203- overrides[" xr_features/enable_khronos_plugin" ] = false ;
204- overrides[" xr_features/enable_lynx_plugin" ] = false ;
205- overrides[" xr_features/enable_meta_plugin" ] = true ;
206- overrides[" xr_features/enable_pico_plugin" ] = false ;
199+ // XR features overrides
200+ overrides[" xr_features/xr_mode" ] = 1 ; // OpenXR mode
201+ overrides[" xr_features/enable_khronos_plugin" ] = false ;
202+ overrides[" xr_features/enable_lynx_plugin" ] = false ;
203+ overrides[" xr_features/enable_meta_plugin" ] = true ;
204+ overrides[" xr_features/enable_pico_plugin" ] = false ;
207205 overrides[" xr_features/enable_magicleap_plugin" ] = false ;
208206
209- return overrides;
207+ return overrides;
210208}
211209
212210PackedStringArray MetaToolkitExportPlugin::_get_android_libraries (const Ref<godot::EditorExportPlatform> &p_platform, bool p_debug) const {
213- PackedStringArray dependencies;
214- if (!_supports_platform (p_platform)) {
215- return dependencies;
216- }
211+ PackedStringArray dependencies;
212+ if (!_supports_platform (p_platform)) {
213+ return dependencies;
214+ }
217215
218- // Check if the Godot Meta toolkit aar dependency is available
219- const String debug_label = p_debug ? " debug" : " release" ;
216+ // Check if the Godot Meta toolkit aar dependency is available
217+ const String debug_label = p_debug ? " debug" : " release" ;
220218 const String toolkit_aar_file_path = " res://addons/godot_meta_toolkit/.bin/android/" + debug_label + " /godot_meta_toolkit-" + debug_label + " .aar" ;
221219 if (FileAccess::file_exists (toolkit_aar_file_path)) {
222- dependencies.append (toolkit_aar_file_path);
223- }
220+ dependencies.append (toolkit_aar_file_path);
221+ }
224222
225- return dependencies;
223+ return dependencies;
226224}
227225
228226bool MetaToolkitExportPlugin::_is_eye_tracking_enabled () const {
0 commit comments