diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 850cb4b..12abc79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,15 +9,15 @@ on: env: # Which godot version to use for exporting. - GODOT_VERSION: 4.4.1 + GODOT_VERSION: 4.5 # Which godot release to use for exporting. (stable/rc/beta/alpha) - GODOT_RELEASE: stable + GODOT_RELEASE: beta1 # Used in the editor config file name. Do not change this for patch releases. - GODOT_FEATURE_VERSION: 4.4 + GODOT_FEATURE_VERSION: 4.5 # Commit hash - GODOT_COMMIT_HASH: 49a5bc7b6 + GODOT_COMMIT_HASH: 46c495ca2 PROJECT_NAME: GodSVG Mobile - BUILD_OPTIONS: target=template_release lto=full production=yes deprecated=no minizip=no brotli=no vulkan=no openxr=no use_volk=no disable_3d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes module_mbedtls_enabled=yes swappy=no build_profile=../godsvg/.github/disabled_classes.build + BUILD_OPTIONS: target=template_release lto=full production=yes deprecated=no minizip=no brotli=no vulkan=no openxr=no use_volk=no disable_3d=yes disable_physics_2d=yes disable_navigation_2d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes module_mbedtls_enabled=yes swappy=no build_profile=../godsvg/.github/disabled_classes.build GODOT_REPO: https://github.com/godotengine/godot.git jobs: diff --git a/addons/SystemBarColorChanger/SystemBarColorChanger.gd b/addons/SystemBarColorChanger/SystemBarColorChanger.gd deleted file mode 100644 index 1d6c61e..0000000 --- a/addons/SystemBarColorChanger/SystemBarColorChanger.gd +++ /dev/null @@ -1,98 +0,0 @@ -# MIT License -# -# Copyright (c) 2024-present Anish Mishra (syntaxerror247) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -@tool -extends Node - -const _plugin_name: String = "SystemBarColorChanger" -var is_light_status_bar: bool = false -var is_light_navigation_bar: bool = false - -var android_runtime: Object - -func _ready() -> void: - if Engine.has_singleton("AndroidRuntime"): - android_runtime = Engine.get_singleton("AndroidRuntime") - var layout_params = JavaClassWrapper.wrap("android.view.WindowManager$LayoutParams") - var window = android_runtime.getActivity().getWindow() - window.addFlags(layout_params.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - else: - printerr("AndroidRuntime singleton not found! Try it on an Android device.") - - -func set_status_bar_color(color: Color) -> void: - if not android_runtime: - printerr("%s plugin not initialized!" % _plugin_name) - return - - var activity = android_runtime.getActivity() - var callable = func (): - var window = activity.getWindow() - window.setStatusBarColor(color.to_argb32()) - if is_light_status_bar != (color.get_luminance() > 0.6): - is_light_status_bar = color.get_luminance() > 0.6 - var wic = JavaClassWrapper.wrap("android.view.WindowInsetsController") - var insets_controller = window.getInsetsController() - insets_controller.setSystemBarsAppearance( - wic.APPEARANCE_LIGHT_STATUS_BARS if is_light_status_bar else 0, - wic.APPEARANCE_LIGHT_STATUS_BARS) - - activity.runOnUiThread(android_runtime.createRunnableFromGodotCallable(callable)) - - -func set_navigation_bar_color(color: Color) -> void: - if not android_runtime: - printerr("%s plugin not initialized!" % _plugin_name) - return - - var activity = android_runtime.getActivity() - var callable = func (): - var window = activity.getWindow() - window.setNavigationBarColor(color.to_argb32()) - if is_light_navigation_bar != (color.get_luminance() > 0.6): - is_light_navigation_bar = color.get_luminance() > 0.6 - var wic = JavaClassWrapper.wrap("android.view.WindowInsetsController") - var insets_controller = window.getInsetsController() - insets_controller.setSystemBarsAppearance( - wic.APPEARANCE_LIGHT_NAVIGATION_BARS if is_light_navigation_bar else 0, - wic.APPEARANCE_LIGHT_NAVIGATION_BARS) - - activity.runOnUiThread(android_runtime.createRunnableFromGodotCallable(callable)) - - -func set_translucent_system_bars(translucent = true) -> void: - if not android_runtime: - printerr("%s plugin not initialized!" % _plugin_name) - return - - var activity = android_runtime.getActivity() - var callable = func (): - var layout_params = JavaClassWrapper.wrap("android.view.WindowManager$LayoutParams") - var window = activity.getWindow() - if translucent: - window.addFlags(layout_params.FLAG_TRANSLUCENT_STATUS) - window.addFlags(layout_params.FLAG_TRANSLUCENT_NAVIGATION) - else: - window.clearFlags(layout_params.FLAG_TRANSLUCENT_STATUS) - window.clearFlags(layout_params.FLAG_TRANSLUCENT_NAVIGATION) - - activity.runOnUiThread(android_runtime.createRunnableFromGodotCallable(callable)) diff --git a/addons/SystemBarColorChanger/SystemBarColorChanger.gd.uid b/addons/SystemBarColorChanger/SystemBarColorChanger.gd.uid deleted file mode 100644 index 865e5cd..0000000 --- a/addons/SystemBarColorChanger/SystemBarColorChanger.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://btbu7ipw8efpj diff --git a/addons/SystemBarColorChanger/icon.png b/addons/SystemBarColorChanger/icon.png deleted file mode 100644 index 90671de..0000000 Binary files a/addons/SystemBarColorChanger/icon.png and /dev/null differ diff --git a/addons/SystemBarColorChanger/icon.png.import b/addons/SystemBarColorChanger/icon.png.import deleted file mode 100644 index 9fde075..0000000 --- a/addons/SystemBarColorChanger/icon.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://b21otadglrwgf" -path="res://.godot/imported/icon.png-62f6d5c31a8cda23c897eeed30370292.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://addons/SystemBarColorChanger/icon.png" -dest_files=["res://.godot/imported/icon.png-62f6d5c31a8cda23c897eeed30370292.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/addons/SystemBarColorChanger/plugin.cfg b/addons/SystemBarColorChanger/plugin.cfg deleted file mode 100644 index beb512b..0000000 --- a/addons/SystemBarColorChanger/plugin.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[plugin] - -name="SystemBarColorChanger" -description="Plugin to change System Bar (status and navigation bar) color dynamically and enable translucent system bars on Android." -author="Anish" -version="2.0" -script="plugin.gd" diff --git a/addons/SystemBarColorChanger/plugin.gd b/addons/SystemBarColorChanger/plugin.gd deleted file mode 100644 index a82624a..0000000 --- a/addons/SystemBarColorChanger/plugin.gd +++ /dev/null @@ -1,8 +0,0 @@ -@tool -extends EditorPlugin - -func _enter_tree() -> void: - add_autoload_singleton("SystemBarColorChanger", "res://addons/SystemBarColorChanger/SystemBarColorChanger.gd") - -func _exit_tree() -> void: - remove_autoload_singleton("SystemBarColorChanger") diff --git a/addons/SystemBarColorChanger/plugin.gd.uid b/addons/SystemBarColorChanger/plugin.gd.uid deleted file mode 100644 index 226f878..0000000 --- a/addons/SystemBarColorChanger/plugin.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bcuens7c62isp diff --git a/export_presets.cfg b/export_presets.cfg index 1f8f8f7..dacdae4 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -25,10 +25,10 @@ custom_template/release="" gradle_build/use_gradle_build=false gradle_build/gradle_build_directory="" gradle_build/android_source_template="" -gradle_build/compress_native_libraries=false gradle_build/export_format=0 gradle_build/min_sdk="" gradle_build/target_sdk="" +gradle_build/custom_theme_attributes={} architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false @@ -49,9 +49,10 @@ launcher_icons/adaptive_foreground_432x432="res://godot_only/android_icons/adapt launcher_icons/adaptive_background_432x432="res://godot_only/android_icons/adaptive_background.png" launcher_icons/adaptive_monochrome_432x432="uid://cop6bgxvtv4uq" graphics/opengl_debug=false +shader_baker/enabled=false xr_features/xr_mode=0 gesture/swipe_to_dismiss=false -screen/immersive_mode=false +screen/immersive_mode=true screen/support_small=true screen/support_normal=true screen/support_large=true @@ -214,6 +215,7 @@ permissions/write_sms=false permissions/write_social_stream=false permissions/write_sync_settings=false permissions/write_user_dictionary=false +gradle_build/compress_native_libraries=false wear_os/swipe_to_dismiss=true [preset.1] @@ -243,10 +245,10 @@ custom_template/release="" gradle_build/use_gradle_build=false gradle_build/gradle_build_directory="" gradle_build/android_source_template="" -gradle_build/compress_native_libraries=false gradle_build/export_format=0 gradle_build/min_sdk="" gradle_build/target_sdk="" +gradle_build/custom_theme_attributes={} architectures/armeabi-v7a=true architectures/arm64-v8a=false architectures/x86=false @@ -267,6 +269,7 @@ launcher_icons/adaptive_foreground_432x432="res://godot_only/android_icons/adapt launcher_icons/adaptive_background_432x432="res://godot_only/android_icons/adaptive_background.png" launcher_icons/adaptive_monochrome_432x432="uid://cop6bgxvtv4uq" graphics/opengl_debug=false +shader_baker/enabled=false xr_features/xr_mode=0 gesture/swipe_to_dismiss=false screen/immersive_mode=false @@ -432,4 +435,5 @@ permissions/write_sms=false permissions/write_social_stream=false permissions/write_sync_settings=false permissions/write_user_dictionary=false +gradle_build/compress_native_libraries=false wear_os/swipe_to_dismiss=true diff --git a/project.godot b/project.godot index a22d2f0..f813883 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ config/version="1.0-alpha3" config/tags=PackedStringArray("application", "mobile", "project") run/main_scene="uid://bihwwoedqcyo8" config/use_custom_user_dir=true -config/features=PackedStringArray("4.4") +config/features=PackedStringArray("4.5") run/low_processor_mode=true boot_splash/bg_color=Color(0.1065, 0.1181, 0.15, 1) boot_splash/fullsize=false @@ -31,7 +31,6 @@ driver/driver="Dummy" Configs="*res://src/autoload/Configs.gd" State="*res://src/autoload/State.gd" HandlerGUI="*res://src/autoload/HandlerGUI.gd" -SystemBarColorChanger="*res://addons/SystemBarColorChanger/SystemBarColorChanger.gd" [display] diff --git a/src/autoload/State.gd b/src/autoload/State.gd index 8e24f28..52ffa70 100644 --- a/src/autoload/State.gd +++ b/src/autoload/State.gd @@ -4,7 +4,6 @@ extends Node const OptionsDialogScene = preload("res://src/ui_widgets/options_dialog.tscn") const PathCommandPopupScene = preload("res://src/ui_widgets/path_popup.tscn") - signal svg_unknown_change signal svg_resized @@ -63,6 +62,10 @@ func _enter_tree() -> void: Configs.active_tab_changed.connect(setup_from_tab) setup_from_tab.call_deferred() # Let everything load before emitting signals. + + # Need to wait a frame so the import warnings panel becomes available. + await get_tree().process_frame + FileUtils.apply_svgs_from_paths(OS.get_cmdline_args(), false) func setup_from_tab() -> void: var active_tab := Configs.savedata.get_active_tab() diff --git a/src/ui_parts/editor_scene.gd b/src/ui_parts/editor_scene.gd index 4549b3b..0cbe287 100644 --- a/src/ui_parts/editor_scene.gd +++ b/src/ui_parts/editor_scene.gd @@ -18,8 +18,6 @@ func update_theme() -> void: stylebox.bg_color = ThemeUtils.overlay_panel_inner_color stylebox.set_content_margin_all(0) panel_container.add_theme_stylebox_override("panel", stylebox) - SystemBarColorChanger.set_status_bar_color(ThemeUtils.overlay_panel_inner_color) - SystemBarColorChanger.set_navigation_bar_color(ThemeUtils.overlay_panel_inner_color) func update_layout() -> void: diff --git a/src/utils/FileUtils.gd b/src/utils/FileUtils.gd index 711e944..3b33f4a 100644 --- a/src/utils/FileUtils.gd +++ b/src/utils/FileUtils.gd @@ -17,8 +17,10 @@ static func reset_svg() -> void: if FileAccess.file_exists(file_path): State.apply_svg_text(FileAccess.get_file_as_string(file_path)) -static func apply_svgs_from_paths(paths: PackedStringArray) -> void: - _start_file_import_process(paths, _apply_svg, PackedStringArray(["svg"])) +static func apply_svgs_from_paths(paths: PackedStringArray, +show_incorrect_extension_errors := true) -> void: + _start_file_import_process(paths, _apply_svg, PackedStringArray(["svg"]), + show_incorrect_extension_errors) static func compare_svg_to_disk_contents(idx := -1) -> FileState: var tab := Configs.savedata.get_active_tab() if idx == -1 else Configs.savedata.get_tab(idx) @@ -216,16 +218,28 @@ completion_callback: Callable, multi_select := false) -> void: # Preprocessing step where all files with wrong extensions are discarded. static func _start_file_import_process(file_paths: PackedStringArray, -completion_callback: Callable, allowed_extensions: PackedStringArray) -> void: +completion_callback: Callable, allowed_extensions: PackedStringArray, +show_incorrect_extension_errors := true) -> void: + if not show_incorrect_extension_errors: + for i in range(file_paths.size() - 1, -1, -1): + if not file_paths[i].get_extension() in allowed_extensions: + file_paths.remove_at(i) + if not file_paths.is_empty(): + _file_import_proceed(file_paths, completion_callback) + return + var incorrect_extension_file_paths := PackedStringArray() for i in range(file_paths.size() - 1, -1, -1): if not file_paths[i].get_extension() in allowed_extensions: incorrect_extension_file_paths.append(Utils.simplify_file_path(file_paths[i])) file_paths.remove_at(i) + if file_paths.is_empty(): + return + var proceed_callback := _file_import_proceed.bind(file_paths, completion_callback) - if not incorrect_extension_file_paths.is_empty(): + if show_incorrect_extension_errors and not incorrect_extension_file_paths.is_empty(): var error_text := TranslationUtils.get_extension_alert_text(allowed_extensions) + "\n" var passed_list := PackedStringArray() # Only pass if there are more than two. if incorrect_extension_file_paths.size() >= 2: