From 68bad1e38b4b54cd17ca7a8c96ca295c51ee2501 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Tue, 27 Aug 2024 16:38:29 +0200 Subject: [PATCH] Automatic updates. Fix ios binary name. (#228) - Fixes https://github.com/appsinacup/godot-rapier-physics/issues/209 - Fixes https://github.com/appsinacup/godot-rapier-physics/issues/227 --- .github/workflows/godot_builds.yml | 5 + .github/workflows/ios_builds.yml | 4 +- .github/workflows/runner.yml | 2 +- CHANGELOG.md | 9 + .../libgodot_rapier.ios.framework/Info.plist | 2 +- .../updater/download_update_panel.gd | 24 +- .../updater/download_update_panel.tscn | 2 +- bin2d/addons/godot-rapier2d/plugin.cfg | 5 +- .../libgodot_rapier.ios.framework/Info.plist | 2 +- .../generated/updater/assets/Progress1.svg | 1 + .../updater/assets/Progress1.svg.import | 38 ++ .../generated/updater/assets/Progress2.svg | 1 + .../updater/assets/Progress2.svg.import | 38 ++ .../generated/updater/assets/Progress3.svg | 1 + .../updater/assets/Progress3.svg.import | 38 ++ .../generated/updater/assets/Progress4.svg | 1 + .../updater/assets/Progress4.svg.import | 38 ++ .../generated/updater/assets/Progress5.svg | 1 + .../updater/assets/Progress5.svg.import | 38 ++ .../generated/updater/assets/Progress6.svg | 1 + .../updater/assets/Progress6.svg.import | 38 ++ .../generated/updater/assets/Progress7.svg | 1 + .../updater/assets/Progress7.svg.import | 38 ++ .../generated/updater/assets/Progress8.svg | 1 + .../updater/assets/Progress8.svg.import | 38 ++ .../updater/assets/border_bottom.png | Bin 0 -> 1757 bytes .../updater/assets/border_bottom.png.import | 34 ++ .../generated/updater/assets/border_top.png | Bin 0 -> 1749 bytes .../updater/assets/border_top.png.import | 34 ++ .../generated/updater/assets/dot1.png | Bin 0 -> 730 bytes .../generated/updater/assets/dot1.png.import | 34 ++ .../generated/updater/assets/dot2.png | Bin 0 -> 883 bytes .../generated/updater/assets/dot2.png.import | 34 ++ .../generated/updater/assets/embedded.png | Bin 0 -> 287 bytes .../updater/assets/embedded.png.import | 34 ++ .../updater/assets/horizontal-line2.png | Bin 0 -> 332 bytes .../assets/horizontal-line2.png.import | 34 ++ .../updater/download_update_panel.gd | 217 +++++++++++ .../updater/download_update_panel.tscn | 116 ++++++ .../generated/updater/plugin-updater.json | 6 + .../generated/updater/spinner.tres | 30 ++ .../generated/updater/updater_config.gd | 58 +++ .../generated/updater/updater_http_client.gd | 79 ++++ .../updater/updater_markdown_reader.gd | 340 ++++++++++++++++++ .../generated/updater/updater_sem_ver.gd | 42 +++ bin3d/addons/godot-rapier3d/plugin.cfg | 8 + bin3d/addons/godot-rapier3d/plugin.gd | 12 + bin3d/project.godot | 1 - 48 files changed, 1460 insertions(+), 20 deletions(-) create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/border_bottom.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/border_bottom.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/border_top.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/border_top.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/dot1.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/dot1.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/embedded.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/embedded.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/horizontal-line2.png create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/assets/horizontal-line2.png.import create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/download_update_panel.gd create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/download_update_panel.tscn create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/plugin-updater.json create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/spinner.tres create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/updater_config.gd create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/updater_http_client.gd create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/updater_markdown_reader.gd create mode 100644 bin3d/addons/godot-rapier3d/generated/updater/updater_sem_ver.gd create mode 100644 bin3d/addons/godot-rapier3d/plugin.cfg create mode 100644 bin3d/addons/godot-rapier3d/plugin.gd diff --git a/.github/workflows/godot_builds.yml b/.github/workflows/godot_builds.yml index 8cff893a..2e2ee582 100644 --- a/.github/workflows/godot_builds.yml +++ b/.github/workflows/godot_builds.yml @@ -15,6 +15,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Update plugin.cfg + shell: sh + run: | + sed -i "s//godot-rapier-2d-${{ matrix.precision }}-${{ matrix.features }}/g" bin2d/addons/godot-rapier2d/plugin.cfg + sed -i "s//godot-rapier-3d-${{ matrix.precision }}-${{ matrix.features }}/g" bin3d/addons/godot-rapier3d/plugin.cfg - name: Upload uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml index 4b075e0d..bd69e758 100644 --- a/.github/workflows/ios_builds.yml +++ b/.github/workflows/ios_builds.yml @@ -24,12 +24,12 @@ jobs: - name: Copy to bin shell: sh run: | - mv target/release/libgodot_rapier.dylib bin${{ matrix.dimensions.short }}/addons/godot-rapier${{ matrix.dimensions.short }}/bin/libgodot_rapier.ios.framework/libgodot_rapier.ios.dylib + mv target/release/libgodot_rapier.dylib bin${{ matrix.dimensions.short }}/addons/godot-rapier${{ matrix.dimensions.short }}/bin/libgodot_rapier.ios.framework/libgodot_rapier.ios - name: Upload uses: actions/upload-artifact@v4 with: name: godot-rapier-${{ matrix.dimensions.short }}-${{ matrix.precision }}-${{ matrix.features.name }}-${{ matrix.arch}} path: | - bin${{ matrix.dimensions.short }}/**/*.dylib + bin${{ matrix.dimensions.short }}/**/*.ios if-no-files-found: error diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index e2cb8f7e..4c3b87c8 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -74,7 +74,7 @@ jobs: contents: write needs: [merge] uses: ./.github/workflows/release.yml - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' deploy: name: Deploy Release to Godot Asset Library diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f84600d..c3ee0a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## v0.7.27 + +* Add functions to get objects positions in bulk by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/188 +* Fix teleport ruining mass properties by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/190 +* fix set_pos_and_velocity of fluid by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/196 +* Fix area not detected issue by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/197 +* add experimental threads for now to fix wrong thread access by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/198 +* add stub functions by @Ughuuu in https://github.com/appsinacup/godot-rapier-physics/pull/199 + ## v0.7.26 - Fix areas removed issue by [@Ughuuu](https://github.com/Ughuuu) in [#187](https://github.com/appsinacup/godot-rapier-physics/pull/187) diff --git a/bin2d/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist b/bin2d/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist index 54ca996a..56c6af57 100644 --- a/bin2d/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist +++ b/bin2d/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist @@ -7,7 +7,7 @@ CFBundleDevelopmentRegion en CFBundleExecutable - libgodot_rapier.ios.dylib + libgodot_rapier.ios CFBundleName Godot Rapier2D CFBundleDisplayName diff --git a/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.gd b/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.gd index fab3330d..a9c1cf2e 100644 --- a/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.gd +++ b/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.gd @@ -63,7 +63,6 @@ func _check_for_updater(): func show_update() -> void: message_h4("\n\n\nRequest release infos ... [img=24x24]%s[/img]" % spinner_icon, Color.SNOW) popup_centered_ratio(.5) - prints("Scanning for %s Update ..." % config.plugin_name) var content :String var response: HttpClient.HttpResponse = await _http_client.request_releases() @@ -101,9 +100,14 @@ static func extract_latest_version(response: HttpClient.HttpResponse) -> SemVer: var body :Array = response.response() return SemVer.parse(body[0]["name"]) -static func extract_zip_url(response: HttpClient.HttpResponse) -> String: - var body :Array = response.response() - return body[0]["zipball_url"] +func extract_current_flavour() -> String: + var config_file = ConfigFile.new() + config_file.load('addons/%s/plugin.cfg' % config.plugin_name) + return config_file.get_value('plugin', 'flavour') + +func extract_zip_url(response: HttpClient.HttpResponse) -> String: + var flavour := extract_current_flavour() + return 'https://github.com/%s/releases/download/%s/%s.zip' % [config.github_repo, _latest_version, flavour] func extract_releases(response: HttpClient.HttpResponse, current_version) -> String: await get_tree().process_frame @@ -142,15 +146,12 @@ func _skip_update(): UpdaterConfig.save_skip_config(skip_config) func _on_update_pressed(): - hide() _update_button.set_disabled(true) - #TODO: How do I give the plugins a hook to perform actions before updating? - - #TODO: Perform the update, maybe use the simpler approach from the dialog plugin var updater_http_request = HTTPRequest.new() updater_http_request.accept_gzip = true add_child(updater_http_request) + message_h4("\n\n\nStaring download %s ... [img=24x24]%s[/img]" % [_download_zip_url, spinner_icon], Color.SNOW) updater_http_request.request_completed.connect(_on_http_request_request_completed) updater_http_request.request(_download_zip_url) @@ -159,6 +160,7 @@ func _on_http_request_request_completed(result: int, response_code: int, headers if result != HTTPRequest.RESULT_SUCCESS: message_h4("\n\n\nError downloading update!", Color.RED) return + message_h4("\n\n\nSuccesfuly downloaded release. Saving file to user://temp.zip", Color.SNOW) # Save the downloaded zip var zip_file: FileAccess = FileAccess.open(TEMP_FILE_NAME, FileAccess.WRITE) @@ -176,7 +178,7 @@ func _on_http_request_request_completed(result: int, response_code: int, headers files.remove_at(0) # Remove assets folder files.remove_at(0) - + for path in files: var new_file_path: String = path.replace(base_path, "") if path.ends_with("/"): @@ -189,8 +191,8 @@ func _on_http_request_request_completed(result: int, response_code: int, headers DirAccess.remove_absolute(TEMP_FILE_NAME) updated.emit() - - #TODO: Show that we successfully updated + print("Finished Updating.") + hide() func _on_close_pressed(): hide() diff --git a/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.tscn b/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.tscn index 174e4d3c..843820ed 100644 --- a/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.tscn +++ b/bin2d/addons/godot-rapier2d/generated/updater/download_update_panel.tscn @@ -46,7 +46,7 @@ theme_override_constants/margin_bottom = 4 [node name="header" type="Label" parent="Panel/GridContainer/PanelContainer"] layout_mode = 2 size_flags_horizontal = 9 -text = "Current version 'v0.7.27'. A new version 'v0.8.0' is available" +text = "Current version 'v0.7.20'. A new version 'v0.8.0' is available" [node name="PanelContainer2" type="PanelContainer" parent="Panel/GridContainer"] layout_mode = 2 diff --git a/bin2d/addons/godot-rapier2d/plugin.cfg b/bin2d/addons/godot-rapier2d/plugin.cfg index 9bb7dd2a..1786d094 100644 --- a/bin2d/addons/godot-rapier2d/plugin.cfg +++ b/bin2d/addons/godot-rapier2d/plugin.cfg @@ -2,6 +2,7 @@ name="Godot Rapier 2D" description="A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids." -author="ughuuu" -version="0.8.0" +author="appsinacup" +version="0.8.1" script="plugin.gd" +flavour="" diff --git a/bin3d/addons/godot-rapier3d/bin/libgodot_rapier.ios.framework/Info.plist b/bin3d/addons/godot-rapier3d/bin/libgodot_rapier.ios.framework/Info.plist index aaf1b900..255221c3 100644 --- a/bin3d/addons/godot-rapier3d/bin/libgodot_rapier.ios.framework/Info.plist +++ b/bin3d/addons/godot-rapier3d/bin/libgodot_rapier.ios.framework/Info.plist @@ -7,7 +7,7 @@ CFBundleDevelopmentRegion en CFBundleExecutable - libgodot_rapier.ios.dylib + libgodot_rapier.ios CFBundleName Godot Rapier3D CFBundleDisplayName diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg new file mode 100644 index 00000000..07505ddd --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg.import new file mode 100644 index 00000000..6de7360d --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress1.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddxpytkht0m5p" +path="res://.godot/imported/Progress1.svg-0b332643565f056defca50271035ff5f.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress1.svg" +dest_files=["res://.godot/imported/Progress1.svg-0b332643565f056defca50271035ff5f.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg new file mode 100644 index 00000000..0a48f7d3 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg.import new file mode 100644 index 00000000..14bee7ac --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress2.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dowca7ike2thl" +path="res://.godot/imported/Progress2.svg-63481703eac1538805fd27a6cd7aa2df.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress2.svg" +dest_files=["res://.godot/imported/Progress2.svg-63481703eac1538805fd27a6cd7aa2df.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg new file mode 100644 index 00000000..a7f0f9c9 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg.import new file mode 100644 index 00000000..a81720b4 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress3.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cwh8md6qipmdw" +path="res://.godot/imported/Progress3.svg-3192e7faf7f63dc2fae3cd132e44d749.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress3.svg" +dest_files=["res://.godot/imported/Progress3.svg-3192e7faf7f63dc2fae3cd132e44d749.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg new file mode 100644 index 00000000..17192091 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg.import new file mode 100644 index 00000000..1fdf8629 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress4.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dm0jpqdjetv2c" +path="res://.godot/imported/Progress4.svg-49d57b9a26188090729d3ef08c8b1e81.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress4.svg" +dest_files=["res://.godot/imported/Progress4.svg-49d57b9a26188090729d3ef08c8b1e81.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg new file mode 100644 index 00000000..7289b7b8 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg.import new file mode 100644 index 00000000..efee5434 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress5.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkj6kjyjyi7cd" +path="res://.godot/imported/Progress5.svg-c9413815fb239fd6212004da635a591e.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress5.svg" +dest_files=["res://.godot/imported/Progress5.svg-c9413815fb239fd6212004da635a591e.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg new file mode 100644 index 00000000..3deba6d4 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg.import new file mode 100644 index 00000000..3b5e748e --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress6.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsljbs1aiyels" +path="res://.godot/imported/Progress6.svg-ede382e2b4041b71f3227d74b75787b3.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress6.svg" +dest_files=["res://.godot/imported/Progress6.svg-ede382e2b4041b71f3227d74b75787b3.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg new file mode 100644 index 00000000..546155dc --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg.import new file mode 100644 index 00000000..d3e29b21 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress7.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cct6crbhix7u8" +path="res://.godot/imported/Progress7.svg-4c5f04ae64eac0be8c35dec4ad33053c.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress7.svg" +dest_files=["res://.godot/imported/Progress7.svg-4c5f04ae64eac0be8c35dec4ad33053c.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg new file mode 100644 index 00000000..b56ffcb7 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg @@ -0,0 +1 @@ + diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg.import new file mode 100644 index 00000000..ea93495b --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/Progress8.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dqc521iq12a7l" +path="res://.godot/imported/Progress8.svg-d231f7c81ec3ee3e0171a1d6b740eca4.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/Progress8.svg" +dest_files=["res://.godot/imported/Progress8.svg-d231f7c81ec3ee3e0171a1d6b740eca4.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 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/border_bottom.png b/bin3d/addons/godot-rapier3d/generated/updater/assets/border_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..aa16bb72598cb6f1c703257f4fb38bd64aa5bc8d GIT binary patch literal 1757 zcmbVMZA@EL7{0(z7;Zltp#&FqclqIDYwrj2wmq(6tSz*%GE(YRO)y;UJ*7AFesJ$) zEuHg&{ZJGAp;-i-LNm>Xx&U!oG%z#N=@Jt)LMBQ!KeEKQ>0&en6Js*ZDQ&}ay0|8{ z=e*}U@AH0~_kEx4>}XrJwr(v!5bHuge}o{`Or!ms6}O@P_L+M;XsOhL51Ir~wE=%6 z#7i&N5=6O8j>fE5csCF=#UV&qFLb089ia(gdvjVB#C~Xzy|7PKz0}XMXDCvZywpBt zm`R19oLPqGG0B^hi|m4sv@MAOZzi0-08lstM9wD#r`Z9v{;bnS)sUUaAEf zBxB)D(x(}aD0&O)j3_Msf_t(hNtl9y`|vSOzdIGXJBHIYWwrh`%*& z3`t%pVOct$=~OD^NHsb%qYvqNJeY&y>0mvl^7JgNUNIpJfV!yX+fu12ZLkE0VT1B(+7=Y&bTDfFbNf?S|-A>MXa9CEX_=4 z|3Y27zRm#3Z8%)CaYJ7erD(#m0{c-I`GnjMZAOQ5NJpTl4H_a0>_=|a<7jl?GoWB; zMpV<1g_r6qxJ+`agCn=>lT}GenfIj6&Zbx>3@l3)op1xq4`Ylb4AfMrGKgS4*pQDiZVz^5fO0~to%HLgAn z`Fx#*7MGLg!i==-B0~Wm&w6;|yo1fT8xDhzYFdIS!jRufq2xGZSpuxn<>XnH+wKtr zRJc+Tw7cCbw2J~KxggK5afvVJ`!#V8mq0;Z`k(rH3>o#Hki2Cc+?lv`Ku|W(s}AK` zrwb0`cS)Jdl?xC=+y-7s#P1I!Dt|2Bat2mtQwfMj|D!HeV5SzgQi1_n`cSrRT6Z*Z zp2iKk5(oYF5Oa5{n!5l;69aFHvkD2tX$Ms_;tVv)j@O)dfFMeeA%9CWy>#`$=KI$O zwdcP33Lbf?^+eBxXUFD_-u>QNWbbc8ru5Yh`5($pet9-|sfoJZP7t3q# z8aOeBPKj)yCWgi8PfDxM^7zqHwwU(%$gyY2u@pIJi@km6$ADOZq-^!o@-MnFyW7t% zhPEM@7=35FdGp3s-d_qfww57zXXR4W@e%9r_X}g62tO$=jbha3;fEKR#SH^Ote@YT365NDxcJ)Q$K$8VcG_MzH?`PW zV(C*)M26Ovp8s~_v+;!v&^{|Wl{y<%@4oBLUoIX1n_OVPIa1RwF-2szcJ!2Vf8C#r mjvbo&eNRQscmKh9jLu4%s_%1$+uSc82q4Y4NZz1!VQt0<94 zX6BxIzjMxa&OPV6-qo>hW6ky&ilR1#+5+7aRW*s%n>MV+-}VcQBK}nyZBJViRlAwI z71YVmZ4~9WUyDTTXn4P*prlh)Q4BgWNdu!PYIkeKkd;Ab(=phu>0V~>iy4O2R4>!( z4ui1ahXYz$&V)U=j);;QR790&eS+Sdk+6Xzv}HPzOz4)B@iGOw5?+&Sj-d+>d(g}H zh(kIW?xOw3gtW&ASOoxq=6R2k_qdupp2uhb2s{S_ju%;>N#cP7n(5-hV0We(m%0Oc zi_Wm*Wd>~9kT@=#PCL_0PGt6DT~Q=91cAi}*2?O(oMCmVzGNW)EydIfTSGccEXpyI zvb_wZx)MXuD4W%-VxDluxQuLYyc3X^3P4pUb8Zkd>LyDARAc& z=wD2ikJmWBxebTQK5ok;nJl}o?BEa%qnMD}qOC~QfLu4UP|8$ba0t_^C(#&^--NP_ z%m_k>(oJ=hDANM(6zHA3ny#X>^~fp(7?5q~Wyr0uz{3hH5#W*BqU3h%0)hm<3N(yV zEuQ@cQ~(k$O1!WJifcxdZTXI1RgvPzOv*T5Eh+ay&d~cAx|~MIj}pkljxoEY)%zj8 zzsp2%ErAcL?tOdcP|)w;MGq$LKdqNE>(=h1@?>nc}u~*BMwbn;wAJ=zrA33d}-rJ1v{g*N?Mx$GYP% zd5$#fN*vtZLoA%FYVHyoPYkjw&nhgGrybPsh%@mlYk%_WDT=C4LjhkTbM?lx5A-d* zZLeLw`OfjD0+p#Vo9nJOJUV%}LaaVLwY~P96JL&w?5y!EOx|0SpE~tczTuhu)gvE% zcj1l9gH82^hQELRhbxJ=JKRG?E6DG-ukfF`_U*`xp+7!ZJT&K15a|bSUW*vBAmioyte@4l< z>`*$LRAKF2j*ggN7|gb9rfC{mTU#@d$z&#xND$mNH8n+&Bn1kEf;Kld7q@Mj`u+Yj0b`81 z-7bMtk|dg#m|Q%R^>9pMN($KObqg+Y}52Ne~3``Fw7~cRa((rXf%3HP!#0}5~gXo zj9xJ!S{Vd`fxz$g6K*3Ci98m@#>O( za*pG;?|iLR`;Fmv0C33k9EZJ#0t^$yhGF1l{_ypB{WF#Xl01N$K!YmKKbEf1XkegU z_)e$ut5__4Y&M$|jYj{g0v-qi$g(V|R4P=hRzF={URHcFGc(j|HoqPpAHP%-#Sf4{ zRv2V^#j2_Tzz&5%4-$z)ms?$3b?>*)XkRaH}mhlj5xCnui*L=?sAfuZNUy}b_{$E_S39Gqis+`kbA zpa2$&#Z1F6o~f$(c57?vp(u)Xkhd(W-fp+QGsemzBO~stTmT~a3l!tbyQS)@;{X5v M07*qoM6N<$g8z+L0RR91 literal 0 HcmV?d00001 diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/dot1.png.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/dot1.png.import new file mode 100644 index 00000000..9fbacd71 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/dot1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ce2eojg0pwpov" +path="res://.godot/imported/dot1.png-c00b4754690c77b15a0250949441f64e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/dot1.png" +dest_files=["res://.godot/imported/dot1.png-c00b4754690c77b15a0250949441f64e.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/bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png b/bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png new file mode 100644 index 0000000000000000000000000000000000000000..4a744986cde29235547d0252db909b92a7e962f1 GIT binary patch literal 883 zcmV-(1C0EMP)@lpPePF)v>>8_Plb8v5AiZ!A1sQ{7nz6% z^+g|QDI5omL|SiHlTLauHK)l;a?Z(4cK6v!wmKjM{oeLseIM)l)?O0)gJQ7=v$L~s zcz6h7V`EdLQt72^Hd`7Fhfu54j*gFyzoL|WUnmq{Z*LDyPf!0Ms*eP0+XlyRBCD&b z?=LSezco5Kin1(o#+cOW^<*Kuv$OM2r_;IZx~}_(CnXXI==b}OPN$!&R4Vu8=H?Q< z?{^%>Ic1Dpa?S&)s%CXvztLPp1CX?|2;Ah|Wf6z3oCnh%x<5e}2$rNQ-M#fkd03ISDyH5TW2qFqgBoc{$ zu%n7SGsZww)gWU`L&X1NBccodAMV$Z6oW*B2nF~*Gl5xAi!$~dJo z+HSYOb=~`NyO&|a^nbi3UgBHjuHgRl4d{bxrakAnZoxFouw_|8&+|qCfq*A% zY;1rm%g|^vis^LvUb$ROL3CWo=;9rK9MBp_WAjF*KwS`uTeCJ2?S!X znA2{z-!x70PPJNnQP=fxQTIHrP6+uL5v`Gt5r{^k;&K51;7_G{#P;7*2HgMv002ov JPDHLkV1hPknQj08 literal 0 HcmV?d00001 diff --git a/bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png.import b/bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png.import new file mode 100644 index 00000000..bdc62ba4 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/assets/dot2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cvwa5lg3qj0e2" +path="res://.godot/imported/dot2.png-672a5d87adc87e39b53da49835da73fa.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier3d/generated/updater/assets/dot2.png" +dest_files=["res://.godot/imported/dot2.png-672a5d87adc87e39b53da49835da73fa.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/bin3d/addons/godot-rapier3d/generated/updater/assets/embedded.png b/bin3d/addons/godot-rapier3d/generated/updater/assets/embedded.png new file mode 100644 index 0000000000000000000000000000000000000000..15cb9ab0b6eca8d6a4394a33bb8fd646a96449e4 GIT binary patch literal 287 zcmV+)0pR|LP)RN8VLJ46=Ue4!JA=Gu1Qtw(nt+hUSAAOAWY3;7{ zF6CWzzVKoIiU9eiDyjlIvZdI4GX>C~76|~+IF)Ta4xouO6;xePI^4d4SS=0`Kp~HA z*e4_bKFu`L=&%qh$nxL}`i4-DJ9(>~v*!wRRYUhk;=3t;_(1EK|y z#|K&wFeBtypU8Ih17+hPKTosh!>$Z0s)OQJdz)Atgy`+P-d@pkl}E;BtF=CnwR?0Y zMnH{h9u{ZUh@0hve51iysl)Q29t1pOq-*5s4V$Ms%gJhHbD+MxH$+42#pwQ6ob_QG enQl}Y5jg-sxRj$tBTAnD0000 void: + message_h4("\n\n\nRequest release infos ... [img=24x24]%s[/img]" % spinner_icon, Color.SNOW) + popup_centered_ratio(.5) + var content :String + + var response: HttpClient.HttpResponse = await _http_client.request_releases() + if response.code() == 200: + content = await extract_releases(response, extract_current_version()) + else: + message_h4("\n\n\nError checked request available releases!", Color.RED) + return + + # finally force rescan to import images as textures + if Engine.is_editor_hint(): + await rescan() + message(content, Color.WHITE_SMOKE) + _update_button.set_disabled(false) + +func rescan() -> void: + if Engine.is_editor_hint(): + if OS.is_stdout_verbose(): + prints(".. reimport release resources") + var fs := EditorInterface.get_resource_filesystem() + fs.scan() + while fs.is_scanning(): + if OS.is_stdout_verbose(): + progress_bar(fs.get_scanning_progress() * 100 as int) + await Engine.get_main_loop().process_frame + await Engine.get_main_loop().process_frame + await Engine.get_main_loop().create_timer(1).timeout + +func extract_current_version() -> SemVer: + var config_file = ConfigFile.new() + config_file.load('addons/%s/plugin.cfg' % config.plugin_name) + return SemVer.parse(config_file.get_value('plugin', 'version')) + +static func extract_latest_version(response: HttpClient.HttpResponse) -> SemVer: + var body :Array = response.response() + return SemVer.parse(body[0]["name"]) + +func extract_current_flavour() -> String: + var config_file = ConfigFile.new() + config_file.load('addons/%s/plugin.cfg' % config.plugin_name) + return config_file.get_value('plugin', 'flavour') + +func extract_zip_url(response: HttpClient.HttpResponse) -> String: + var flavour := extract_current_flavour() + return 'https://github.com/%s/releases/download/%s/%s.zip' % [config.github_repo, _latest_version, flavour] + +func extract_releases(response: HttpClient.HttpResponse, current_version) -> String: + await get_tree().process_frame + var result := "" + for release in response.response(): + if SemVer.parse(release["tag_name"]).equals(current_version): + break + var release_description :String = release["body"] + result += await _md_reader.to_bbcode(release_description) + return result + +func message_h4(message :String, color :Color, clear := true) -> void: + if clear: + _content.clear() + _content.append_text("[font_size=36]%s[/font_size]" % _colored(message, color)) + +func message(message :String, color :Color) -> void: + _content.clear() + _content.append_text(_colored(message, color)) + +func progress_bar(p_progress :int, p_color :Color = Color.POWDER_BLUE): + if p_progress < 0: + p_progress = 0 + if p_progress > 100: + p_progress = 100 + printraw("scan [%-50s] %-3d%%\r" % ["".lpad(int(p_progress/2.0), "#").rpad(50, "-"), p_progress]) + +func _colored(message :String, color :Color) -> String: + return "[color=#%s]%s[/color]" % [color.to_html(), message] + +func _skip_update(): + # Store a setting in the config. + var skip_config = UpdaterConfig.get_skip_config() # Read this again in case it was changed + skip_config[config.plugin_name] = str(_latest_version) + # Write the config into the addons dir so it gets removed on update + UpdaterConfig.save_skip_config(skip_config) + +func _on_update_pressed(): + _update_button.set_disabled(true) + + var updater_http_request = HTTPRequest.new() + updater_http_request.accept_gzip = true + add_child(updater_http_request) + message_h4("\n\n\nStaring download %s ... [img=24x24]%s[/img]" % [_download_zip_url, spinner_icon], Color.SNOW) + + updater_http_request.request_completed.connect(_on_http_request_request_completed) + updater_http_request.request(_download_zip_url) + +func _on_http_request_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void: + if result != HTTPRequest.RESULT_SUCCESS: + message_h4("\n\n\nError downloading update!", Color.RED) + return + message_h4("\n\n\nSuccesfuly downloaded release. Saving file to user://temp.zip", Color.SNOW) + + # Save the downloaded zip + var zip_file: FileAccess = FileAccess.open(TEMP_FILE_NAME, FileAccess.WRITE) + zip_file.store_buffer(body) + zip_file.close() + + OS.move_to_trash(ProjectSettings.globalize_path("res://addons/%s" % config.plugin_name)) + + var zip_reader: ZIPReader = ZIPReader.new() + zip_reader.open(TEMP_FILE_NAME) + var files: PackedStringArray = zip_reader.get_files() + + var base_path = files[1] + # Remove archive folder + files.remove_at(0) + # Remove assets folder + files.remove_at(0) + + for path in files: + var new_file_path: String = path.replace(base_path, "") + if path.ends_with("/"): + DirAccess.make_dir_recursive_absolute("res://addons/%s" % new_file_path) + else: + var file: FileAccess = FileAccess.open("res://addons/%s" % new_file_path, FileAccess.WRITE) + file.store_buffer(zip_reader.read_file(path)) + + zip_reader.close() + DirAccess.remove_absolute(TEMP_FILE_NAME) + + updated.emit() + print("Finished Updating.") + hide() + +func _on_close_pressed(): + hide() + if $Panel/GridContainer/Panel/HBoxContainer/skip_update.button_pressed: + _skip_update() + +func _on_content_meta_clicked(meta :String): + var properties = str_to_var(meta) + if properties.has("url"): + OS.shell_open(properties.get("url")) + +func _on_content_meta_hover_started(meta :String): + var properties = str_to_var(meta) + if properties.has("tool_tip"): + _content.set_tooltip_text(properties.get("tool_tip")) + +func _on_content_meta_hover_ended(meta): + _content.set_tooltip_text("") + + +func _on_close_requested() -> void: + _on_close_pressed() diff --git a/bin3d/addons/godot-rapier3d/generated/updater/download_update_panel.tscn b/bin3d/addons/godot-rapier3d/generated/updater/download_update_panel.tscn new file mode 100644 index 00000000..23935e59 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/download_update_panel.tscn @@ -0,0 +1,116 @@ +[gd_scene load_steps=3 format=3 uid="uid://br17ciqiitq6s"] + +[ext_resource type="Script" path="res://addons/godot-rapier3d/generated/updater/download_update_panel.gd" id="1_uai4s"] +[ext_resource type="Script" path="res://addons/godot-rapier3d/generated/updater/updater_http_client.gd" id="2_qpn7s"] + +[node name="Window" type="Window"] +disable_3d = true +gui_embed_subwindows = true +title = "godot-rapier3d Plugin Update" +initial_position = 1 +size = Vector2i(800, 400) +wrap_controls = true +transient = true +min_size = Vector2i(800, 400) +script = ExtResource("1_uai4s") + +[node name="HttpClient" type="Node" parent="."] +script = ExtResource("2_qpn7s") +github_repo = "appsinacup/godot-rapier-physics" + +[node name="Panel" type="Panel" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="GridContainer" type="VBoxContainer" parent="Panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 + +[node name="PanelContainer" type="MarginContainer" parent="Panel/GridContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 + +[node name="header" type="Label" parent="Panel/GridContainer/PanelContainer"] +layout_mode = 2 +size_flags_horizontal = 9 +text = "Current version 'v0.7.20'. A new version 'v0.8.0' is available" + +[node name="PanelContainer2" type="PanelContainer" parent="Panel/GridContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="Panel/GridContainer/PanelContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="MarginContainer" type="MarginContainer" parent="Panel/GridContainer/PanelContainer2/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 + +[node name="content" type="RichTextLabel" parent="Panel/GridContainer/PanelContainer2/ScrollContainer/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +focus_mode = 2 +bbcode_enabled = true +fit_content = true +selection_enabled = true + +[node name="Panel" type="MarginContainer" parent="Panel/GridContainer"] +layout_mode = 2 +size_flags_vertical = 4 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 + +[node name="HBoxContainer" type="HBoxContainer" parent="Panel/GridContainer/Panel"] +use_parent_material = true +layout_mode = 2 +theme_override_constants/separation = 4 + +[node name="skip_update" type="CheckBox" parent="Panel/GridContainer/Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Skip this version" + +[node name="update" type="Button" parent="Panel/GridContainer/Panel/HBoxContainer"] +custom_minimum_size = Vector2(100, 40) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Update" + +[node name="close" type="Button" parent="Panel/GridContainer/Panel/HBoxContainer"] +custom_minimum_size = Vector2(100, 40) +layout_mode = 2 +size_flags_horizontal = 10 +size_flags_vertical = 4 +text = "Close" + +[connection signal="close_requested" from="." to="." method="_on_close_requested"] +[connection signal="meta_clicked" from="Panel/GridContainer/PanelContainer2/ScrollContainer/MarginContainer/content" to="." method="_on_content_meta_clicked"] +[connection signal="meta_hover_ended" from="Panel/GridContainer/PanelContainer2/ScrollContainer/MarginContainer/content" to="." method="_on_content_meta_hover_ended"] +[connection signal="meta_hover_started" from="Panel/GridContainer/PanelContainer2/ScrollContainer/MarginContainer/content" to="." method="_on_content_meta_hover_started"] +[connection signal="pressed" from="Panel/GridContainer/Panel/HBoxContainer/update" to="." method="_on_update_pressed"] +[connection signal="pressed" from="Panel/GridContainer/Panel/HBoxContainer/close" to="." method="_on_close_pressed"] diff --git a/bin3d/addons/godot-rapier3d/generated/updater/plugin-updater.json b/bin3d/addons/godot-rapier3d/generated/updater/plugin-updater.json new file mode 100644 index 00000000..0c220c50 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/plugin-updater.json @@ -0,0 +1,6 @@ +{ + "plugin_name": "godot-rapier3d", + "secs_before_check_for_update": 2, + "github_repo": "appsinacup/godot-rapier-physics", + "editor_plugin_meta": "Rapier3DEditorPlugin" +} diff --git a/bin3d/addons/godot-rapier3d/generated/updater/spinner.tres b/bin3d/addons/godot-rapier3d/generated/updater/spinner.tres new file mode 100644 index 00000000..86606582 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/spinner.tres @@ -0,0 +1,30 @@ +[gd_resource type="AnimatedTexture" load_steps=9 format=3 uid="uid://dljx0fmjlrbuh"] + +[ext_resource type="Texture2D" uid="uid://ddxpytkht0m5p" path="res://addons/godot-rapier3d/generated/updater/assets/Progress1.svg" id="1_ctgew"] +[ext_resource type="Texture2D" uid="uid://dowca7ike2thl" path="res://addons/godot-rapier3d/generated/updater/assets/Progress2.svg" id="2_xwye8"] +[ext_resource type="Texture2D" uid="uid://cwh8md6qipmdw" path="res://addons/godot-rapier3d/generated/updater/assets/Progress3.svg" id="3_53vx7"] +[ext_resource type="Texture2D" uid="uid://dm0jpqdjetv2c" path="res://addons/godot-rapier3d/generated/updater/assets/Progress4.svg" id="4_eecnj"] +[ext_resource type="Texture2D" uid="uid://bkj6kjyjyi7cd" path="res://addons/godot-rapier3d/generated/updater/assets/Progress5.svg" id="5_auay0"] +[ext_resource type="Texture2D" uid="uid://bsljbs1aiyels" path="res://addons/godot-rapier3d/generated/updater/assets/Progress6.svg" id="6_fx28b"] +[ext_resource type="Texture2D" uid="uid://cct6crbhix7u8" path="res://addons/godot-rapier3d/generated/updater/assets/Progress7.svg" id="7_giugp"] +[ext_resource type="Texture2D" uid="uid://dqc521iq12a7l" path="res://addons/godot-rapier3d/generated/updater/assets/Progress8.svg" id="8_yppa0"] + +[resource] +frames = 8 +speed_scale = 2.5 +frame_0/texture = ExtResource("1_ctgew") +frame_0/duration = 0.2 +frame_1/texture = ExtResource("2_xwye8") +frame_1/duration = 0.2 +frame_2/texture = ExtResource("3_53vx7") +frame_2/duration = 0.2 +frame_3/texture = ExtResource("4_eecnj") +frame_3/duration = 0.2 +frame_4/texture = ExtResource("5_auay0") +frame_4/duration = 0.2 +frame_5/texture = ExtResource("6_fx28b") +frame_5/duration = 0.2 +frame_6/texture = ExtResource("7_giugp") +frame_6/duration = 0.2 +frame_7/texture = ExtResource("8_yppa0") +frame_7/duration = 0.2 diff --git a/bin3d/addons/godot-rapier3d/generated/updater/updater_config.gd b/bin3d/addons/godot-rapier3d/generated/updater/updater_config.gd new file mode 100644 index 00000000..41dd0646 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/updater_config.gd @@ -0,0 +1,58 @@ +extends RefCounted + +## Expected format of config is a JSON file like: +## { +## "plugin_name": "plugin_updater", +## "secs_before_check_for_update": 5, +## "github_repo": "myyk/godot-plugin-updater", +## "editor_plugin_meta": "PluginUpdaterEditorPlugin" +## } + +const PLUGIN_NAME: String = "godot-rapier3d" # This is replaced when code is generated +const PLUGIN_MAKER_CONFIG_PATH = "res://plugin-updater.json" +const PLUGIN_USER_CONFIG_PATH_FORMAT = "res://addons/%s/generated/updater/plugin-updater.json" +const PLUGIN_SKIP_CONFIG_PATH = "res://.godot/plugin-updater-skip.json" + +static func get_user_config() -> Dictionary: + return _get_config(PLUGIN_USER_CONFIG_PATH_FORMAT % PLUGIN_NAME) + +static func get_repo_config() -> Dictionary: + return _get_config(PLUGIN_MAKER_CONFIG_PATH) + +static func _get_config(path: String) -> Dictionary: + var config = { + secs_before_check_for_update = 5, + } + + if !FileAccess.file_exists(path): + push_error("plugin-updater: Needs a config at " + path) + + var file: FileAccess = FileAccess.open(path, FileAccess.READ) + config.merge(JSON.parse_string(file.get_as_text()), true) + + return config + +# Skip config is a JSON file like: +# { +# "plugin_name_1": "1.0.0" +# "plugin_name_2": "1.2.3" +# } +static func get_skip_config() -> Dictionary: + if !FileAccess.file_exists(PLUGIN_SKIP_CONFIG_PATH): + return {} + + var file: FileAccess = FileAccess.open(PLUGIN_SKIP_CONFIG_PATH, FileAccess.READ) + if file == null: + push_error("plugin-updater: Could not open file at " + PLUGIN_SKIP_CONFIG_PATH) + return {} + return JSON.parse_string(file.get_as_text()) + +static func save_skip_config(config: Dictionary) -> Error: + var file: FileAccess = FileAccess.open(PLUGIN_SKIP_CONFIG_PATH, FileAccess.WRITE) + if file == null: + push_error("plugin-updater: Could not open file at " + PLUGIN_SKIP_CONFIG_PATH) + return FileAccess.get_open_error() + + file.store_string(JSON.stringify(config)) + file.close() + return OK diff --git a/bin3d/addons/godot-rapier3d/generated/updater/updater_http_client.gd b/bin3d/addons/godot-rapier3d/generated/updater/updater_http_client.gd new file mode 100644 index 00000000..36f13463 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/updater_http_client.gd @@ -0,0 +1,79 @@ +@tool +extends Node + +## Credits: Mostly copied from https://github.com/MikeSchulze/gdUnit4/blob/99b7c323f443e5fcc67f9a79b4df532727e8986f/addons/gdUnit4/src/update/GdUnitUpdateClient.gd + +signal request_completed(response) + +@export var github_repo = "" + +class HttpResponse: + var _code :int + var _body :PackedByteArray + + + func _init(code_ :int, body_ :PackedByteArray): + _code = code_ + _body = body_ + + func code() -> int: + return _code + + func response() -> Variant: + var test_json_conv := JSON.new() + test_json_conv.parse(_body.get_string_from_utf8()) + return test_json_conv.get_data() + + func body() -> PackedByteArray: + return _body + +var _http_request :HTTPRequest = HTTPRequest.new() + +func _ready(): + add_child(_http_request) + _http_request.connect("request_completed", Callable(self, "_on_request_completed")) + + +func _notification(what): + if what == NOTIFICATION_PREDELETE: + if is_instance_valid(_http_request): + _http_request.queue_free() + + +func request_latest_version() -> HttpResponse: + var error = _http_request.request("https://api.github.com/repos/%s/tags" % github_repo) + if error != OK: + var message = "request_latest_version failed: %d" % error + return HttpResponse.new(error, message.to_utf8_buffer()) + return await self.request_completed + + +func request_releases() -> HttpResponse: + var error = _http_request.request("https://api.github.com/repos/%s/releases" % github_repo) + if error != OK: + var message = "request_releases failed: %d" % error + return HttpResponse.new(error, message.to_utf8_buffer()) + return await self.request_completed + + +func request_image(url :String) -> HttpResponse: + var error = _http_request.request(url) + if error != OK: + var message = "request_image failed: %d" % error + return HttpResponse.new(error, message.to_utf8_buffer()) + return await self.request_completed + + +func request_zip_package(url :String, file :String) -> HttpResponse: + _http_request.set_download_file(file) + var error = _http_request.request(url) + if error != OK: + var message = "request_zip_package failed: %d" % error + return HttpResponse.new(error, message.to_utf8_buffer()) + return await self.request_completed + + +func _on_request_completed(_result :int, response_code :int, _headers :PackedStringArray, body :PackedByteArray): + if _http_request.get_http_client_status() != HTTPClient.STATUS_DISCONNECTED: + _http_request.set_download_file("") + request_completed.emit(HttpResponse.new(response_code, body)) diff --git a/bin3d/addons/godot-rapier3d/generated/updater/updater_markdown_reader.gd b/bin3d/addons/godot-rapier3d/generated/updater/updater_markdown_reader.gd new file mode 100644 index 00000000..945f85a1 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/updater_markdown_reader.gd @@ -0,0 +1,340 @@ +extends RefCounted + +const UpdaterConfig = preload("updater_config.gd") +var config = UpdaterConfig.get_user_config() + +const FONT_H1 := 42 +const FONT_H2 := 32 +const FONT_H3 := 26 +const FONT_H4 := 22 +const FONT_H5 := 16 +const FONT_H6 := 12 + +var HORIZONTAL_RULE: String = "[img=4000x2]res://addons/%s/generated/updater/assets/horizontal-line2.png[/img]\n" % config.plugin_name +const HEADER_RULE := "[font_size=%d]$1[/font_size]\n" +const HEADER_CENTERED_RULE := "[font_size=%d][center]$1[/center][/font_size]\n" + +const image_download_folder := "res://cached/updater/" + +const exclude_font_size := "\b(?!(?:(font_size))\b)" + +var md_replace_patterns := [ + # horizontal rules + [regex("(?m)^[ ]{0,3}---$"), HORIZONTAL_RULE], + [regex("(?m)^[ ]{0,3}___$"), HORIZONTAL_RULE], + [regex("(?m)^[ ]{0,3}\\*\\*\\*$"), HORIZONTAL_RULE], + + # headers + [regex("(?m)^###### (.*)"), HEADER_RULE % FONT_H6], + [regex("(?m)^##### (.*)"), HEADER_RULE % FONT_H5], + [regex("(?m)^#### (.*)"), HEADER_RULE % FONT_H4], + [regex("(?m)^### (.*)"), HEADER_RULE % FONT_H3], + [regex("(?m)^## (.*)"), (HEADER_RULE + HORIZONTAL_RULE) % FONT_H2], + [regex("(?m)^# (.*)"), (HEADER_RULE + HORIZONTAL_RULE) % FONT_H1], + [regex("(?m)^(.+)=={2,}$"), HEADER_RULE % FONT_H1], + [regex("(?m)^(.+)--{2,}$"), HEADER_RULE % FONT_H2], + # html headers + [regex("

((.*?\\R?)+)<\\/h1>"), (HEADER_RULE + HORIZONTAL_RULE) % FONT_H1], + [regex("((.*?\\R?)+)<\\/h1>"), (HEADER_CENTERED_RULE + HORIZONTAL_RULE) % FONT_H1], + [regex("

((.*?\\R?)+)<\\/h2>"), (HEADER_RULE + HORIZONTAL_RULE) % FONT_H2], + [regex("((.*?\\R?)+)<\\/h2>"), (HEADER_CENTERED_RULE + HORIZONTAL_RULE) % FONT_H1], + [regex("

((.*?\\R?)+)<\\/h3>"), HEADER_RULE % FONT_H3], + [regex("((.*?\\R?)+)<\\/h3>"), HEADER_CENTERED_RULE % FONT_H3], + [regex("

((.*?\\R?)+)<\\/h4>"), HEADER_RULE % FONT_H4], + [regex("((.*?\\R?)+)<\\/h4>"), HEADER_CENTERED_RULE % FONT_H4], + [regex("
((.*?\\R?)+)<\\/h5>"), HEADER_RULE % FONT_H5], + [regex("((.*?\\R?)+)<\\/h5>"), HEADER_CENTERED_RULE % FONT_H5], + [regex("
((.*?\\R?)+)<\\/h6>"), HEADER_RULE % FONT_H6], + [regex("((.*?\\R?)+)<\\/h6>"), HEADER_CENTERED_RULE % FONT_H6], + + # asterics + #[regex("(\\*)"), "xxx$1xxx"], + + # extract/compile image references + [regex("!\\[(.*?)\\]\\[(.*?)\\]"), Callable(self, "process_image_references")], + # extract images with path and optional tool tip + [regex("!\\[(.*?)\\]\\((.*?)(( )+(.*?))?\\)"), Callable(self, "process_image")], + + # links + [regex("([!]|)\\[(.+)\\]\\(([^ ]+?)\\)"), "[url={\"url\":\"$3\"}]$2[/url]"], + # links with tool tip + [regex("([!]|)\\[(.+)\\]\\(([^ ]+?)( \"(.+)\")?\\)"), "[url={\"url\":\"$3\", \"tool_tip\":\"$5\"}]$2[/url]"], + + # embeded text + [regex("(?m)^[ ]{0,3}>(.*?)$"), "[img=50x14]res://addons/%s/generated/updater/assets/embedded.png[/img][i]$1[/i]" % config.plugin_name], + + # italic + bold font + [regex("[_]{3}(.*?)[_]{3}"), "[i][b]$1[/b][/i]"], + [regex("[\\*]{3}(.*?)[\\*]{3}"), "[i][b]$1[/b][/i]"], + # bold font + [regex("(.*?)<\\/b>"), "[b]$1[/b]"], + [regex("[_]{2}(.*?)[_]{2}"), "[b]$1[/b]"], + [regex("[\\*]{2}(.*?)[\\*]{2}"), "[b]$1[/b]"], + # italic font + [regex("(.*?)<\\/i>"), "[i]$1[/i]"], + [regex(exclude_font_size+"_(.*?)_"), "[i]$1[/i]"], + [regex("\\*(.*?)\\*"), "[i]$1[/i]"], + + # strikethrough font + [regex("(.*?)"), "[s]$1[/s]"], + [regex("~~(.*?)~~"), "[s]$1[/s]"], + [regex("~(.*?)~"), "[s]$1[/s]"], + + # handling lists + # using an image for dots as workaroud because list is not supported checked Godot 3.x + [regex("(?m)^[ ]{0,1}[*\\-+] (.*)$"), list_replace(0)], + [regex("(?m)^[ ]{2,3}[*\\-+] (.*)$"), list_replace(1)], + [regex("(?m)^[ ]{4,5}[*\\-+] (.*)$"), list_replace(2)], + [regex("(?m)^[ ]{6,7}[*\\-+] (.*)$"), list_replace(3)], + [regex("(?m)^[ ]{8,9}[*\\-+] (.*)$"), list_replace(4)], + + # code blocks, code blocks looks not like code blocks in richtext + [regex("```(javascript|python|shell|gdscript)([\\s\\S]*?\n)```"), code_block("$2", true)], + [regex("``([\\s\\S]*?)``"), code_block("$1")], + [regex("`([\\s\\S]*?)`{1,2}"), code_block("$1")], +] + +var _img_replace_regex := RegEx.new() +var _image_urls := PackedStringArray() +var _on_table_tag := false +var _client + + +func regex(pattern :String) -> RegEx: + var regex_ := RegEx.new() + var err = regex_.compile(pattern) + if err != OK: + push_error("error '%s' checked pattern '%s'" % [err, pattern]) + return null + return regex_ + + +func _init(): + _img_replace_regex.compile("\\[img\\]((.*?))\\[/img\\]") + + +func set_http_client(client) -> void: + _client = client + + +func _notification(what): + if what == NOTIFICATION_PREDELETE: + # finally remove_at the downloaded images + for image in _image_urls: + DirAccess.remove_absolute(image) + DirAccess.remove_absolute(image + ".import") + + +func list_replace(indent :int) -> String: + var replace_pattern: String = ("[img=12x12]res://addons/%s/generated/updater/assets/dot2.png[/img]" % config.plugin_name) if indent %2 else ("[img=12x12]res://addons/%s/generated/updater/assets/dot1.png[/img]" % config.plugin_name) + replace_pattern += " $1" + + for index in indent: + replace_pattern = replace_pattern.insert(0, " ") + return replace_pattern + + +func code_block(replace :String, border :bool = false) -> String: + var cb := "[code][color=aqua][font_size=16]%s[/font_size][/color][/code]" % replace + if border: + return ("[img=1400x14]res://addons/%s/generated/updater/assets/border_top.png[/img]" % config.plugin_name)\ + + "[indent]" + cb + "[/indent]"\ + + ("[img=1400x14]res://addons/%s/generated/updater/assets/border_bottom.png[/img]\n" % config.plugin_name) + return cb + + +func to_bbcode(input :String) -> String: + input = process_tables(input) + + for pattern in md_replace_patterns: + var regex_ :RegEx = pattern[0] + var bb_replace = pattern[1] + if bb_replace is Callable: + input = await bb_replace.call(regex_, input) + else: + input = regex_.sub(input, bb_replace, true) + return input + "\n" + + +func process_tables(input :String) -> String: + var bbcode := Array() + var lines := Array(input.split("\n")) + while not lines.is_empty(): + if is_table(lines[0]): + bbcode.append_array(parse_table(lines)) + continue + bbcode.append(lines.pop_front()) + return "\n".join(PackedStringArray(bbcode)) + + +class Table: + var _columns :int + var _rows := Array() + + class Row: + var _cells := PackedStringArray() + + func _init(cells :PackedStringArray,columns :int): + _cells = cells + for i in range(_cells.size(), columns): + _cells.append("") + + func to_bbcode(cell_sizes :PackedInt32Array, bold :bool) -> String: + var cells := PackedStringArray() + for cell_index in _cells.size(): + var cell :String = _cells[cell_index] + if cell.strip_edges() == "--": + cell = create_line(cell_sizes[cell_index]) + if bold: + cell = "[b]%s[/b]" % cell + cells.append("[cell]%s[/cell]" % cell) + return "|".join(cells) + + func create_line(length :int) -> String: + var line := "" + for i in length: + line += "-" + return line + + func _init(columns :int): + _columns = columns + + func parse_row(line :String) -> bool: + # is line containing cells? + if line.find("|") == -1: + return false + _rows.append(Row.new(line.split("|"), _columns)) + return true + + func calculate_max_cell_sizes() -> PackedInt32Array: + var cells_size := PackedInt32Array() + for column in _columns: + cells_size.append(0) + + for row_index in _rows.size(): + var row :Row = _rows[row_index] + for cell_index in row._cells.size(): + var cell_size :int = cells_size[cell_index] + var size := row._cells[cell_index].length() + if size > cell_size: + cells_size[cell_index] = size + return cells_size + + func to_bbcode() -> PackedStringArray: + var cell_sizes := calculate_max_cell_sizes() + var bb_code := PackedStringArray() + + bb_code.append("[table=%d]" % _columns) + for row_index in _rows.size(): + bb_code.append(_rows[row_index].to_bbcode(cell_sizes, row_index==0)) + bb_code.append("[/table]\n") + return bb_code + + +func parse_table(lines :Array) -> PackedStringArray: + var line :String = lines[0] + var table := Table.new(line.count("|") + 1) + while not lines.is_empty(): + line = lines.pop_front() + if not table.parse_row(line): + break + return table.to_bbcode() + + +func is_table(line :String) -> bool: + return line.find("|") != -1 + + +func open_table(line :String) -> String: + _on_table_tag = true + return "[table=%d]" % (line.count("|") + 1) + + +func close_table() -> String: + _on_table_tag = false + return "[/table]" + + +func extract_cells(line :String, bold := false) -> String: + var cells := "" + for cell in line.split("|"): + if bold: + cell = "[b]%s[/b]" % cell + cells += "[cell]%s[/cell]" % cell + return cells + + +func process_image_references(p_regex :RegEx, p_input :String) -> String: + # exists references? + var matches := p_regex.search_all(p_input) + if matches.is_empty(): + return p_input + # collect image references and remove_at it + var references := Dictionary() + var link_regex := regex("\\[(\\S+)\\]:(\\S+)([ ]\"(.*)\")?") + # create copy of original source to replace checked it + var input := p_input.replace("\r", "") + var extracted_references := p_input.replace("\r", "") + for reg_match in link_regex.search_all(input): + var line = reg_match.get_string(0) + "\n" + var ref = reg_match.get_string(1) + #var topl_tip = reg_match.get_string(4) + # collect reference and url + references[ref] = reg_match.get_string(2) + extracted_references = extracted_references.replace(line, "") + + # replace image references by collected url's + for reference_key in references.keys(): + var regex_key := regex("\\](\\[%s\\])" % reference_key) + for reg_match in regex_key.search_all(extracted_references): + var ref :String = reg_match.get_string(0) + var image_url :String = "](%s)" % references.get(reference_key) + extracted_references = extracted_references.replace(ref, image_url) + return extracted_references + + +func process_image(p_regex :RegEx, p_input :String) -> String: + var to_replace := PackedStringArray() + var tool_tips := PackedStringArray() + # find all matches + var matches := p_regex.search_all(p_input) + if matches.is_empty(): + return p_input + for reg_match in matches: + # grap the parts to replace and store temporay because a direct replace will distort the offsets + to_replace.append(p_input.substr(reg_match.get_start(0), reg_match.get_end(0))) + # grap optional tool tips + tool_tips.append(reg_match.get_string(5)) + # finally replace all findings + for replace in to_replace: + var re := p_regex.sub(replace, "[img]$2[/img]") + p_input = p_input.replace(replace, re) + return await _process_external_image_resources(p_input) + + +func _process_external_image_resources(input :String) -> String: + DirAccess.make_dir_recursive_absolute(image_download_folder) + # scan all img for external resources and download it + for value in _img_replace_regex.search_all(input): + if value.get_group_count() >= 1: + var image_url :String = value.get_string(1) + # if not a local resource we need to download it + if image_url.begins_with("http"): + if OS.is_stdout_verbose(): + prints("download image:", image_url) + var response = await _client.request_image(image_url) + if response.code() == 200: + var image = Image.new() + var error = image.load_png_from_buffer(response.body()) + if error != OK: + prints("Error creating image from response", error) + # replace characters where format characters + var new_url := image_download_folder + image_url.get_file().replace("_", "-") + if new_url.get_extension() != 'png': + new_url = new_url + '.png' + var err := image.save_png(new_url) + if err: + push_error("Can't save image to '%s'. Error: %s" % [new_url, error_string(err)]) + _image_urls.append(new_url) + input = input.replace(image_url, new_url) + return input diff --git a/bin3d/addons/godot-rapier3d/generated/updater/updater_sem_ver.gd b/bin3d/addons/godot-rapier3d/generated/updater/updater_sem_ver.gd new file mode 100644 index 00000000..cf7f036b --- /dev/null +++ b/bin3d/addons/godot-rapier3d/generated/updater/updater_sem_ver.gd @@ -0,0 +1,42 @@ +extends RefCounted + +## Credits: Copied from https://github.com/MikeSchulze/gdUnit4/blob/99b7c323f443e5fcc67f9a79b4df532727e8986f/addons/gdUnit4/src/core/GdUnit4Version.gd before edits. + +const VERSION_PATTERN = "[center][color=#9887c4]gd[/color][color=#7a57d6]Unit[/color][color=#9887c4]4[/color] [color=#9887c4]${version}[/color][/center]" + +var _major :int +var _minor :int +var _patch :int + + +func _init(major :int,minor :int,patch :int): + _major = major + _minor = minor + _patch = patch + + +static func parse(value :String): + var regex := RegEx.new() + regex.compile("[a-zA-Z:,-]+") + var cleaned := regex.sub(value, "", true) + var parts := cleaned.split(".") + var major := parts[0].to_int() + var minor := parts[1].to_int() + var patch := parts[2].to_int() if parts.size() > 2 else 0 + return new(major, minor, patch) + + +func equals(other :) -> bool: + return _major == other._major and _minor == other._minor and _patch == other._patch + + +func is_greater(other :) -> bool: + if _major > other._major: + return true + if _major == other._major and _minor > other._minor: + return true + return _major == other._major and _minor == other._minor and _patch > other._patch + + +func _to_string() -> String: + return "v%d.%d.%d" % [_major, _minor, _patch] diff --git a/bin3d/addons/godot-rapier3d/plugin.cfg b/bin3d/addons/godot-rapier3d/plugin.cfg new file mode 100644 index 00000000..7e16ef07 --- /dev/null +++ b/bin3d/addons/godot-rapier3d/plugin.cfg @@ -0,0 +1,8 @@ +[plugin] + +name="Godot Rapier 3D" +description="A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids." +author="appsinacup" +version="0.8.1" +script="plugin.gd" +flavour="" \ No newline at end of file diff --git a/bin3d/addons/godot-rapier3d/plugin.gd b/bin3d/addons/godot-rapier3d/plugin.gd new file mode 100644 index 00000000..d3b2d21e --- /dev/null +++ b/bin3d/addons/godot-rapier3d/plugin.gd @@ -0,0 +1,12 @@ +@tool +extends EditorPlugin + +func _enter_tree(): + if Engine.is_editor_hint(): + Engine.set_meta("Rapier3DEditorPlugin", self) + var update_tool: Node = load("res://addons/godot-rapier3d/generated/updater/download_update_panel.tscn").instantiate() + Engine.get_main_loop().root.call_deferred("add_child", update_tool) + +func _exit_tree(): + if Engine.has_meta("Rapier3DEditorPlugin"): + Engine.remove_meta("Rapier3DEditorPlugin") diff --git a/bin3d/project.godot b/bin3d/project.godot index 9b955c62..9f31cb8f 100644 --- a/bin3d/project.godot +++ b/bin3d/project.godot @@ -32,4 +32,3 @@ enabled=PackedStringArray("res://addons/godot-rapier3d/plugin.cfg") 2d/physics_engine="Rapier2D" 3d/physics_engine="Rapier3D" -rapier/fluid/fluid_particle_radius_3d=0.5