commit c1475e5274221cf6d7ca9c84b75569743c04966b Author: Stefano Pigozzi Date: Sun Sep 22 21:42:06 2024 +0200 Create project with Rapier2D installed diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..99000f3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Configure linguist for Godot projects +addons/** linguist-vendored +**/generated/** linguist-generated + +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf + +# Use git-lfs for common media types +*.png filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +*.flac filter=lfs diff=lfs merge=lfs -text +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.webp filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 0000000..5063bd9 --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,27 @@ +# Attribution notices + +
+ +Godot Rapier Physics - MIT License + +Copyright (c) 2023 Fabrice Cipolla, Sp3ctralCat and Dragos Daian + +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. + +
\ No newline at end of file diff --git a/addons/godot-rapier2d/Fluid2D.svg b/addons/godot-rapier2d/Fluid2D.svg new file mode 100644 index 0000000..e55507f --- /dev/null +++ b/addons/godot-rapier2d/Fluid2D.svg @@ -0,0 +1,3 @@ + + + diff --git a/addons/godot-rapier2d/Fluid2D.svg.import b/addons/godot-rapier2d/Fluid2D.svg.import new file mode 100644 index 0000000..4a1f6c6 --- /dev/null +++ b/addons/godot-rapier2d/Fluid2D.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cv17s0qjrqj16" +path="res://.godot/imported/Fluid2D.svg-947567c51a8b586a0e695be7cba2d975.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/Fluid2D.svg" +dest_files=["res://.godot/imported/Fluid2D.svg-947567c51a8b586a0e695be7cba2d975.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=false diff --git a/addons/godot-rapier2d/LICENSE b/addons/godot-rapier2d/LICENSE new file mode 100644 index 0000000..556baa8 --- /dev/null +++ b/addons/godot-rapier2d/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Fabrice Cipolla, Sp3ctralCat and Dragos Daian + +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. diff --git a/addons/godot-rapier2d/Radial2D.svg b/addons/godot-rapier2d/Radial2D.svg new file mode 100644 index 0000000..e7f0c49 --- /dev/null +++ b/addons/godot-rapier2d/Radial2D.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/addons/godot-rapier2d/Radial2D.svg.import b/addons/godot-rapier2d/Radial2D.svg.import new file mode 100644 index 0000000..317d9d1 --- /dev/null +++ b/addons/godot-rapier2d/Radial2D.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cho3shol3rky2" +path="res://.godot/imported/Radial2D.svg-4380d9841bddc115105cff2016be7c6a.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/Radial2D.svg" +dest_files=["res://.godot/imported/Radial2D.svg-4380d9841bddc115105cff2016be7c6a.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=false diff --git a/addons/godot-rapier2d/THIRDPARTY.txt b/addons/godot-rapier2d/THIRDPARTY.txt new file mode 100644 index 0000000..d115c87 --- /dev/null +++ b/addons/godot-rapier2d/THIRDPARTY.txt @@ -0,0 +1,288 @@ +Godot Rapier incorporates third-party material from the projects listed below. + +Godot Engine (https://github.com/godotengine/godot) + + Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). + Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. + + 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. + +godot-cpp (https://github.com/godotengine/godot-cpp) + + Copyright (c) 2017-present Godot Engine contributors. + Copyright (c) 2022-present Mikael Hermansson. + + 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. + +rapier (https://github.com/dimforge/rapier) + + Copyright 2020 Sébastien Crozet + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +Godot Jolt (https://github.com/godot-jolt/godot-jolt) + + Copyright (c) Mikael Hermansson and Godot Jolt contributors. + + 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. + +salva (https://github.com/dimforge/salva) + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Sébastien Crozet + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/addons/godot-rapier2d/bin/godot_rapier.wasm b/addons/godot-rapier2d/bin/godot_rapier.wasm new file mode 100644 index 0000000..0bf09a2 Binary files /dev/null and b/addons/godot-rapier2d/bin/godot_rapier.wasm differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.android.aarch64-linux-android.so b/addons/godot-rapier2d/bin/libgodot_rapier.android.aarch64-linux-android.so new file mode 100644 index 0000000..9d78e5f Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.android.aarch64-linux-android.so differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.android.i686-linux-android.so b/addons/godot-rapier2d/bin/libgodot_rapier.android.i686-linux-android.so new file mode 100644 index 0000000..4694a06 Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.android.i686-linux-android.so differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.android.x86_64-linux-android.so b/addons/godot-rapier2d/bin/libgodot_rapier.android.x86_64-linux-android.so new file mode 100644 index 0000000..6cca8ae Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.android.x86_64-linux-android.so differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist b/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist new file mode 100644 index 0000000..56c6af5 --- /dev/null +++ b/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libgodot_rapier.ios + CFBundleName + Godot Rapier2D + CFBundleDisplayName + Godot Rapier2D + CFBundleIdentifier + org.godot-rapier2d.godot-rapier2d + NSHumanReadableCopyright + Copyright (c) 2023-present Fabrice Cipolla, Sp3ctralCat and Dragos Daian. + CFBundleVersion + 0.12.0 + CFBundleShortVersionString + 0.12.0 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + iphoneos + MinimumOSVersion + 12.0 + + diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/libgodot_rapier.ios b/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/libgodot_rapier.ios new file mode 100644 index 0000000..f98bbff Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.ios.framework/libgodot_rapier.ios differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so b/addons/godot-rapier2d/bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so new file mode 100644 index 0000000..2fa492e Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/Resources/Info.plist b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/Resources/Info.plist new file mode 100644 index 0000000..bde2089 --- /dev/null +++ b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/Resources/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleExecutable + libgodot_rapier.macos.dylib + CFBundleIdentifier + org.godot-rapier2d.godot-rapier2d + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Godot Rapier2D + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + MacOSX + + NSHumanReadableCopyright + Copyright (c) 2023-present Fabrice Cipolla, Sp3ctralCat and Dragos Daian. + CFBundleVersion + 1.0.0 + LSMinimumSystemVersion + 10.12 + + diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/_CodeSignature/CodeResources b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..1eaabd7 --- /dev/null +++ b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/_CodeSignature/CodeResources @@ -0,0 +1,128 @@ + + + + + files + + Resources/Info.plist + + FZy7+eYDJuYSbntBY+mwtyopSvE= + + + files2 + + Resources/Info.plist + + hash2 + + MMDYIVdI76poLGbcF02jJpJ+oHcs7q1NjyfgsaN1jus= + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/libgodot_rapier.macos.dylib b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/libgodot_rapier.macos.dylib new file mode 100644 index 0000000..37ab1c8 Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.macos.framework/libgodot_rapier.macos.dylib differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll b/addons/godot-rapier2d/bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll new file mode 100644 index 0000000..48152c1 Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll b/addons/godot-rapier2d/bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll new file mode 100644 index 0000000..67a9367 Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll differ diff --git a/addons/godot-rapier2d/bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll b/addons/godot-rapier2d/bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll new file mode 100644 index 0000000..611d3fd Binary files /dev/null and b/addons/godot-rapier2d/bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll differ diff --git a/addons/godot-rapier2d/bin/wasm-nothreads/godot_rapier.wasm b/addons/godot-rapier2d/bin/wasm-nothreads/godot_rapier.wasm new file mode 100644 index 0000000..b4837bf Binary files /dev/null and b/addons/godot-rapier2d/bin/wasm-nothreads/godot_rapier.wasm differ diff --git a/addons/godot-rapier2d/circle_mesh.tres b/addons/godot-rapier2d/circle_mesh.tres new file mode 100644 index 0000000..630e7ea --- /dev/null +++ b/addons/godot-rapier2d/circle_mesh.tres @@ -0,0 +1,15 @@ +[gd_resource type="ArrayMesh" format=3 uid="uid://dahp28qij58i1"] + +[resource] +_surfaces = [{ +"2d": true, +"aabb": AABB(-16, -16, 0, 32, 32, 0), +"attribute_data": PackedByteArray(0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63), +"format": 34393296913, +"index_count": 6, +"index_data": PackedByteArray(3, 0, 0, 0, 1, 0, 1, 0, 2, 0, 3, 0), +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 4, +"vertex_data": PackedByteArray(0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 193, 0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 65) +}] diff --git a/addons/godot-rapier2d/faucet_2d.gd b/addons/godot-rapier2d/faucet_2d.gd new file mode 100644 index 0000000..7100e31 --- /dev/null +++ b/addons/godot-rapier2d/faucet_2d.gd @@ -0,0 +1,24 @@ +class_name Faucet2D +extends Fluid2D + +var points_new: PackedVector2Array +@export var interval := 0.06 +var velocities_new: PackedVector2Array +@export var max_particles: int = 1000 +@export var width: int = 4 +@export var height: int = 2 + +func _ready(): + points_new = create_rectangle_points(width, height) + velocities_new.resize(points_new.size()) + var gravity_value = ProjectSettings.get("physics/2d/default_gravity") + var gravity_dir = ProjectSettings.get("physics/2d/default_gravity_vector") + var dir = global_transform.basis_xform(gravity_dir * gravity_value) + velocities_new.fill(dir) + get_tree().create_timer(interval).timeout.connect(_on_timer_timeout) + +func _on_timer_timeout(): + get_tree().create_timer(interval).timeout.connect(_on_timer_timeout) + if len(points) > max_particles: + return + add_points_and_velocities(points_new, velocities_new) diff --git a/addons/godot-rapier2d/fluid_2d_circle.gd b/addons/godot-rapier2d/fluid_2d_circle.gd new file mode 100644 index 0000000..5c93e74 --- /dev/null +++ b/addons/godot-rapier2d/fluid_2d_circle.gd @@ -0,0 +1,10 @@ +@tool +extends Fluid2D + +@export var circle_radius := 10: + set(value): + if circle_radius != value: + circle_radius = value + points = create_circle_points(circle_radius) + get: + return circle_radius diff --git a/addons/godot-rapier2d/fluid_2d_rectangle.gd b/addons/godot-rapier2d/fluid_2d_rectangle.gd new file mode 100644 index 0000000..d1eb6a2 --- /dev/null +++ b/addons/godot-rapier2d/fluid_2d_rectangle.gd @@ -0,0 +1,17 @@ +@tool +extends Fluid2D + +@export var height := 10: + set(value): + if height != value: + height = value + points = create_rectangle_points(width, height) + get: + return height +@export var width := 10: + set(value): + if width != value: + width = value + points = create_rectangle_points(width, height) + get: + return width diff --git a/addons/godot-rapier2d/fluid_2d_renderer.gd b/addons/godot-rapier2d/fluid_2d_renderer.gd new file mode 100644 index 0000000..1978881 --- /dev/null +++ b/addons/godot-rapier2d/fluid_2d_renderer.gd @@ -0,0 +1,29 @@ +@tool +class_name Fluid2DRenderer +extends MultiMeshInstance2D + +@export var fluid: Fluid2D +@export var color: Color = Color(0.8, 0.8, 0.8, 0.3) + + +func _ready(): + if multimesh == null: + multimesh = MultiMesh.new() + multimesh.mesh = load("res://addons/godot-rapier2d/circle_mesh.tres").duplicate() + multimesh.use_colors = true + if texture == null: + texture = load("res://addons/godot-rapier2d/Radial2D.svg") + +func _process(_delta): + if fluid == null: + return + global_transform = fluid.global_transform + var index = 0 + multimesh.instance_count = fluid.points.size() + var points = fluid.points + for i in points.size(): + var point = points[i] + var new_transform: Transform2D = Transform2D(0, Vector2(5, 5), 0, point) + multimesh.set_instance_transform_2d(index, new_transform) + multimesh.set_instance_color(index, color) + index += 1 diff --git a/addons/godot-rapier2d/fluid_2d_shader_renderer.gd b/addons/godot-rapier2d/fluid_2d_shader_renderer.gd new file mode 100644 index 0000000..30bfaba --- /dev/null +++ b/addons/godot-rapier2d/fluid_2d_shader_renderer.gd @@ -0,0 +1,79 @@ +@tool +class_name Fluid2DShaderRenderer +extends CanvasLayer + +@export var fluid: Fluid2D: + set(value): + fluid = value + update_configuration_warnings() +@export var camera: Camera2D +@export var water_material: Material = load("res://addons/godot-rapier2d/water_shader.tres") +var fluid_renderer: Fluid2DRenderer +var inside_camera: Camera2D: + set(value): + inside_camera = value + update_configuration_warnings() +var sub_viewport_container: SubViewportContainer +var sub_viewport: SubViewport + +func _get_configuration_warnings(): + var warnings = [] + if camera == null: + warnings += ["Camera property is empty."] + if fluid == null: + warnings += ["Fluid property is empty."] + return warnings + + +func _create_subviewport_container(): + sub_viewport_container = SubViewportContainer.new() + sub_viewport_container.name = "SubViewportContainer" + add_child(sub_viewport_container) + sub_viewport_container.material = water_material + sub_viewport_container.size = Vector2( + ProjectSettings.get("display/window/size/viewport_width"), + ProjectSettings.get("display/window/size/viewport_height") + ) + +func _create_subviewport(): + sub_viewport = SubViewport.new() + sub_viewport.name = "SubViewport" + sub_viewport_container.add_child(sub_viewport) + sub_viewport.transparent_bg = true + sub_viewport.size = sub_viewport_container.size + +func _create_fluid_renderer(): + fluid_renderer = Fluid2DRenderer.new() + fluid_renderer.name = "Fluid2DRenderer" + fluid_renderer.color = Color(255,0,255) + fluid_renderer.fluid = fluid + sub_viewport.add_child(fluid_renderer) + +func _create_inside_camera(): + inside_camera = Camera2D.new() + inside_camera.name = "Camera2D" + inside_camera.material = water_material + sub_viewport.add_child(inside_camera) + +func _ready() -> void: + _create_subviewport_container() + _create_subviewport() + _create_fluid_renderer() + _create_inside_camera() + if fluid: + fluid.debug_draw = false + +func _process(delta: float) -> void: + if camera != null: + inside_camera.offset = camera.offset + inside_camera.zoom = camera.zoom + inside_camera.transform = camera.transform + sub_viewport_container.scale = Vector2(1.0 / camera.zoom.x, 1.0 / camera.zoom.y) + sub_viewport_container.position = camera.global_position + sub_viewport.size = sub_viewport_container.size + if camera.anchor_mode == Camera2D.AnchorMode.ANCHOR_MODE_FIXED_TOP_LEFT: + sub_viewport_container.position -= sub_viewport_container.size / 2 + if !camera.ignore_rotation: + sub_viewport_container.rotation = camera.global_rotation + else: + sub_viewport_container.rotation = 0 diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress1.svg b/addons/godot-rapier2d/generated/updater/assets/Progress1.svg new file mode 100644 index 0000000..07505dd --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress1.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress1.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress1.svg.import new file mode 100644 index 0000000..3009597 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress1.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddxpytkht0m5p" +path="res://.godot/imported/Progress1.svg-4c67bc9979d74bc8a460d9eb07a2c04c.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress1.svg" +dest_files=["res://.godot/imported/Progress1.svg-4c67bc9979d74bc8a460d9eb07a2c04c.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/addons/godot-rapier2d/generated/updater/assets/Progress2.svg b/addons/godot-rapier2d/generated/updater/assets/Progress2.svg new file mode 100644 index 0000000..0a48f7d --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress2.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress2.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress2.svg.import new file mode 100644 index 0000000..a12678b --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress2.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dowca7ike2thl" +path="res://.godot/imported/Progress2.svg-8504d77be0fc9a48adff096c00560fac.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress2.svg" +dest_files=["res://.godot/imported/Progress2.svg-8504d77be0fc9a48adff096c00560fac.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/addons/godot-rapier2d/generated/updater/assets/Progress3.svg b/addons/godot-rapier2d/generated/updater/assets/Progress3.svg new file mode 100644 index 0000000..a7f0f9c --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress3.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress3.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress3.svg.import new file mode 100644 index 0000000..578b0a6 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress3.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cwh8md6qipmdw" +path="res://.godot/imported/Progress3.svg-e38cf6a56b985d7e7fa7472e057ce3e5.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress3.svg" +dest_files=["res://.godot/imported/Progress3.svg-e38cf6a56b985d7e7fa7472e057ce3e5.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/addons/godot-rapier2d/generated/updater/assets/Progress4.svg b/addons/godot-rapier2d/generated/updater/assets/Progress4.svg new file mode 100644 index 0000000..1719209 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress4.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress4.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress4.svg.import new file mode 100644 index 0000000..dd1beb6 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress4.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dm0jpqdjetv2c" +path="res://.godot/imported/Progress4.svg-2c536d8d07b08b10b0d56dd6b498e182.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress4.svg" +dest_files=["res://.godot/imported/Progress4.svg-2c536d8d07b08b10b0d56dd6b498e182.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/addons/godot-rapier2d/generated/updater/assets/Progress5.svg b/addons/godot-rapier2d/generated/updater/assets/Progress5.svg new file mode 100644 index 0000000..7289b7b --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress5.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress5.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress5.svg.import new file mode 100644 index 0000000..6f4e9ae --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress5.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkj6kjyjyi7cd" +path="res://.godot/imported/Progress5.svg-6a2e86bfe29d7ef19937e393bd446959.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress5.svg" +dest_files=["res://.godot/imported/Progress5.svg-6a2e86bfe29d7ef19937e393bd446959.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/addons/godot-rapier2d/generated/updater/assets/Progress6.svg b/addons/godot-rapier2d/generated/updater/assets/Progress6.svg new file mode 100644 index 0000000..3deba6d --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress6.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress6.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress6.svg.import new file mode 100644 index 0000000..b0968f2 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress6.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsljbs1aiyels" +path="res://.godot/imported/Progress6.svg-847d0e3ae51aa33e84715058ee9f1d88.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress6.svg" +dest_files=["res://.godot/imported/Progress6.svg-847d0e3ae51aa33e84715058ee9f1d88.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/addons/godot-rapier2d/generated/updater/assets/Progress7.svg b/addons/godot-rapier2d/generated/updater/assets/Progress7.svg new file mode 100644 index 0000000..546155d --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress7.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress7.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress7.svg.import new file mode 100644 index 0000000..e272d0f --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress7.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cct6crbhix7u8" +path="res://.godot/imported/Progress7.svg-0b5f28f5e4b7291603ae2f7b7f534bdc.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress7.svg" +dest_files=["res://.godot/imported/Progress7.svg-0b5f28f5e4b7291603ae2f7b7f534bdc.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/addons/godot-rapier2d/generated/updater/assets/Progress8.svg b/addons/godot-rapier2d/generated/updater/assets/Progress8.svg new file mode 100644 index 0000000..b56ffcb --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress8.svg @@ -0,0 +1 @@ + diff --git a/addons/godot-rapier2d/generated/updater/assets/Progress8.svg.import b/addons/godot-rapier2d/generated/updater/assets/Progress8.svg.import new file mode 100644 index 0000000..25b7960 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/Progress8.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dqc521iq12a7l" +path="res://.godot/imported/Progress8.svg-01a6c510553331c426b175a929f97995.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/Progress8.svg" +dest_files=["res://.godot/imported/Progress8.svg-01a6c510553331c426b175a929f97995.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/addons/godot-rapier2d/generated/updater/assets/border_bottom.png b/addons/godot-rapier2d/generated/updater/assets/border_bottom.png new file mode 100644 index 0000000..2eb4a6f --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/border_bottom.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37a40709349e82f04b542de8d17c4118d68531f6515964b0e03f28f6ee529772 +size 1757 diff --git a/addons/godot-rapier2d/generated/updater/assets/border_bottom.png.import b/addons/godot-rapier2d/generated/updater/assets/border_bottom.png.import new file mode 100644 index 0000000..0e63e75 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/border_bottom.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dmv3ld2otx1e2" +path="res://.godot/imported/border_bottom.png-57eaece612033b44553803bae1bed8cc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/border_bottom.png" +dest_files=["res://.godot/imported/border_bottom.png-57eaece612033b44553803bae1bed8cc.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/godot-rapier2d/generated/updater/assets/border_top.png b/addons/godot-rapier2d/generated/updater/assets/border_top.png new file mode 100644 index 0000000..fcfe17d --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/border_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca6f5d7f59cf272dc87fc4762bd7ec82502bb1987c7803ebaea594408401ac47 +size 1749 diff --git a/addons/godot-rapier2d/generated/updater/assets/border_top.png.import b/addons/godot-rapier2d/generated/updater/assets/border_top.png.import new file mode 100644 index 0000000..e3713ad --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/border_top.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b4sio0j5om50s" +path="res://.godot/imported/border_top.png-189e90fa324f96478fce0fb20176c395.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/border_top.png" +dest_files=["res://.godot/imported/border_top.png-189e90fa324f96478fce0fb20176c395.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/godot-rapier2d/generated/updater/assets/dot1.png b/addons/godot-rapier2d/generated/updater/assets/dot1.png new file mode 100644 index 0000000..0ae482f --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/dot1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f37474a8d5dc0c9574cef6fad5308922841e60deb31213e2723e3dd2755bd7e5 +size 730 diff --git a/addons/godot-rapier2d/generated/updater/assets/dot1.png.import b/addons/godot-rapier2d/generated/updater/assets/dot1.png.import new file mode 100644 index 0000000..e8d65cd --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/dot1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ce2eojg0pwpov" +path="res://.godot/imported/dot1.png-ce212c4b64977cbf71f1ecdd531281cd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/dot1.png" +dest_files=["res://.godot/imported/dot1.png-ce212c4b64977cbf71f1ecdd531281cd.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/godot-rapier2d/generated/updater/assets/dot2.png b/addons/godot-rapier2d/generated/updater/assets/dot2.png new file mode 100644 index 0000000..02b0af7 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/dot2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c12758bd1b0b0ef88811b50affd3957bbf9c9e6c0922c0de199a4a3649643103 +size 883 diff --git a/addons/godot-rapier2d/generated/updater/assets/dot2.png.import b/addons/godot-rapier2d/generated/updater/assets/dot2.png.import new file mode 100644 index 0000000..533ea40 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/dot2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cvwa5lg3qj0e2" +path="res://.godot/imported/dot2.png-e37c7300c62fe4f74a78c2c148fdcd38.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/dot2.png" +dest_files=["res://.godot/imported/dot2.png-e37c7300c62fe4f74a78c2c148fdcd38.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/godot-rapier2d/generated/updater/assets/embedded.png b/addons/godot-rapier2d/generated/updater/assets/embedded.png new file mode 100644 index 0000000..b09c232 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/embedded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08cead78bbc3d7aefda91f376b1280195333d94a32222b1490876fabf0823f6b +size 287 diff --git a/addons/godot-rapier2d/generated/updater/assets/embedded.png.import b/addons/godot-rapier2d/generated/updater/assets/embedded.png.import new file mode 100644 index 0000000..4d679d4 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/embedded.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://63wk5nib3r7q" +path="res://.godot/imported/embedded.png-cb03d2626ef24143491c5f1bf62cd67c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/embedded.png" +dest_files=["res://.godot/imported/embedded.png-cb03d2626ef24143491c5f1bf62cd67c.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/godot-rapier2d/generated/updater/assets/horizontal-line2.png b/addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png new file mode 100644 index 0000000..91ccc24 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb01fb89e6b3ff826f05e772336f0cd855e1e838ef920cac9fd6a3e3504dacd9 +size 332 diff --git a/addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png.import b/addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png.import new file mode 100644 index 0000000..8376129 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dgaa5faajesgv" +path="res://.godot/imported/horizontal-line2.png-cfa4f3add1c707a77eabccac70481cf7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/generated/updater/assets/horizontal-line2.png" +dest_files=["res://.godot/imported/horizontal-line2.png-cfa4f3add1c707a77eabccac70481cf7.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/godot-rapier2d/generated/updater/download_update_panel.gd b/addons/godot-rapier2d/generated/updater/download_update_panel.gd new file mode 100644 index 0000000..a9c1cf2 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/download_update_panel.gd @@ -0,0 +1,217 @@ +@tool +extends Window + +## Updater heaviliy inspired by GDUnit4's updater, but decoupled completely from GDUnit. Also did not +## include all the patching that included since it seemed to complicated to include for most projects. + +signal updated + +var config = UpdaterConfig.get_user_config() + +var spinner_icon = "res://addons/%s/generated/updater/spinner.tres" % config.plugin_name + +# Using this style of import avoids polluting user's namespaces +const UpdaterConfig = preload("updater_config.gd") +const SemVer = preload("updater_sem_ver.gd") +const HttpClient = preload("updater_http_client.gd") +const MarkDownReader = preload("updater_markdown_reader.gd") + +const TEMP_FILE_NAME = "user://temp.zip" + +@onready var _md_reader: MarkDownReader = MarkDownReader.new() +@onready var _http_client: HttpClient = $HttpClient +@onready var _header: Label = $Panel/GridContainer/PanelContainer/header +@onready var _content: RichTextLabel = $Panel/GridContainer/PanelContainer2/ScrollContainer/MarginContainer/content +@onready var _update_button: Button = $Panel/GridContainer/Panel/HBoxContainer/update + +var _latest_version: SemVer +var _download_zip_url: String + +func _ready(): + hide() + _http_client.github_repo = config.github_repo + + title = "%s Plugin Update" % config.plugin_name + var plugin :EditorPlugin = Engine.get_meta(config.editor_plugin_meta) + + # wait a bit to allow the editor to initialize itself + await Engine.get_main_loop().create_timer(float(config.secs_before_check_for_update)).timeout + + _check_for_updater() + +func _check_for_updater(): + var response = await _http_client.request_latest_version() + if response.code() != 200: + push_warning("Update information cannot be retrieved from GitHub! \n %s %s" % [response.response(), response.code()]) + return + _latest_version = extract_latest_version(response) + var current_version := extract_current_version() + + # if the current version is less than or equal to the skip version, skip the update + var skip_config = UpdaterConfig.get_skip_config() + if config.plugin_name in skip_config: + var skip_version: SemVer = SemVer.parse(skip_config[config.plugin_name]) + if !_latest_version.is_greater(skip_version): + return + + # if same version exit here no update need + if _latest_version.is_greater(current_version): + _download_zip_url = extract_zip_url(response) + _header.text = "Current version '%s'. A new version '%s' is available" % [current_version, _latest_version] + await show_update() + +func show_update() -> 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/addons/godot-rapier2d/generated/updater/download_update_panel.tscn b/addons/godot-rapier2d/generated/updater/download_update_panel.tscn new file mode 100644 index 0000000..cde3a81 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/download_update_panel.tscn @@ -0,0 +1,117 @@ +[gd_scene load_steps=3 format=3 uid="uid://br17ciqiitq6s"] + +[ext_resource type="Script" path="res://addons/godot-rapier2d/generated/updater/download_update_panel.gd" id="1_uai4s"] +[ext_resource type="Script" path="res://addons/godot-rapier2d/generated/updater/updater_http_client.gd" id="2_qpn7s"] + +[node name="Window" type="Window"] +disable_3d = true +gui_embed_subwindows = true +title = "godot-rapier2d Plugin Update" +initial_position = 1 +size = Vector2i(800, 400) +visible = false +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/addons/godot-rapier2d/generated/updater/plugin-updater.json b/addons/godot-rapier2d/generated/updater/plugin-updater.json new file mode 100644 index 0000000..e8310b2 --- /dev/null +++ b/addons/godot-rapier2d/generated/updater/plugin-updater.json @@ -0,0 +1,6 @@ +{ + "plugin_name": "godot-rapier2d", + "secs_before_check_for_update": 2, + "github_repo": "appsinacup/godot-rapier-physics", + "editor_plugin_meta": "Rapier2DEditorPlugin" +} diff --git a/addons/godot-rapier2d/generated/updater/spinner.tres b/addons/godot-rapier2d/generated/updater/spinner.tres new file mode 100644 index 0000000..64b3cb8 --- /dev/null +++ b/addons/godot-rapier2d/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-rapier2d/generated/updater/assets/Progress1.svg" id="1_ctgew"] +[ext_resource type="Texture2D" uid="uid://dowca7ike2thl" path="res://addons/godot-rapier2d/generated/updater/assets/Progress2.svg" id="2_xwye8"] +[ext_resource type="Texture2D" uid="uid://cwh8md6qipmdw" path="res://addons/godot-rapier2d/generated/updater/assets/Progress3.svg" id="3_53vx7"] +[ext_resource type="Texture2D" uid="uid://dm0jpqdjetv2c" path="res://addons/godot-rapier2d/generated/updater/assets/Progress4.svg" id="4_eecnj"] +[ext_resource type="Texture2D" uid="uid://bkj6kjyjyi7cd" path="res://addons/godot-rapier2d/generated/updater/assets/Progress5.svg" id="5_auay0"] +[ext_resource type="Texture2D" uid="uid://bsljbs1aiyels" path="res://addons/godot-rapier2d/generated/updater/assets/Progress6.svg" id="6_fx28b"] +[ext_resource type="Texture2D" uid="uid://cct6crbhix7u8" path="res://addons/godot-rapier2d/generated/updater/assets/Progress7.svg" id="7_giugp"] +[ext_resource type="Texture2D" uid="uid://dqc521iq12a7l" path="res://addons/godot-rapier2d/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/addons/godot-rapier2d/generated/updater/updater_config.gd b/addons/godot-rapier2d/generated/updater/updater_config.gd new file mode 100644 index 0000000..feb90e1 --- /dev/null +++ b/addons/godot-rapier2d/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-rapier2d" # 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/addons/godot-rapier2d/generated/updater/updater_http_client.gd b/addons/godot-rapier2d/generated/updater/updater_http_client.gd new file mode 100644 index 0000000..36f1346 --- /dev/null +++ b/addons/godot-rapier2d/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/addons/godot-rapier2d/generated/updater/updater_markdown_reader.gd b/addons/godot-rapier2d/generated/updater/updater_markdown_reader.gd new file mode 100644 index 0000000..945f85a --- /dev/null +++ b/addons/godot-rapier2d/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/addons/godot-rapier2d/generated/updater/updater_sem_ver.gd b/addons/godot-rapier2d/generated/updater/updater_sem_ver.gd new file mode 100644 index 0000000..cf7f036 --- /dev/null +++ b/addons/godot-rapier2d/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/addons/godot-rapier2d/godot-rapier2d.gdextension b/addons/godot-rapier2d/godot-rapier2d.gdextension new file mode 100644 index 0000000..de8926f --- /dev/null +++ b/addons/godot-rapier2d/godot-rapier2d.gdextension @@ -0,0 +1,34 @@ +[configuration] + +entry_symbol = "gdext_rust_init" +compatibility_minimum = 4.3 + + +[libraries] + +macos.debug = "bin/libgodot_rapier.macos.framework" +macos.release = "bin/libgodot_rapier.macos.framework" +windows.debug.x86_64 = "bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll" +windows.release.x86_64 = "bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll" +windows.debug.x86_32 = "bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll" +windows.release.x86_32 = "bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll" +windows.debug.arm64 = "bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll" +windows.release.arm64 = "bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll" +linux.debug.x86_64 = "bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so" +linux.release.x86_64 = "bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so" +android.debug.x86_64 = "bin/libgodot_rapier.android.x86_64-linux-android.so" +android.release.x86_64 = "bin/libgodot_rapier.android.x86_64-linux-android.so" +android.debug.x86_32 = "bin/libgodot_rapier.android.i686-linux-android.so" +android.release.x86_32 = "bin/libgodot_rapier.android.i686-linux-android.so" +android.debug.arm64 = "bin/libgodot_rapier.android.aarch64-linux-android.so" +android.release.arm64 = "bin/libgodot_rapier.android.aarch64-linux-android.so" +ios.debug = "bin/libgodot_rapier.ios.framework" +ios.release = "bin/libgodot_rapier.ios.framework" +web.debug.threads.wasm32 = "bin/godot_rapier.wasm" +web.release.threads.wasm32 = "bin/godot_rapier.wasm" +web.debug.wasm32 = "bin/wasm-nothreads/godot_rapier.wasm" +web.release.wasm32 = "bin/wasm-nothreads/godot_rapier.wasm" + +[icons] + +Fluid2D = "Fluid2D.svg" diff --git a/addons/godot-rapier2d/logo_square_2d.png b/addons/godot-rapier2d/logo_square_2d.png new file mode 100644 index 0000000..11d29d1 --- /dev/null +++ b/addons/godot-rapier2d/logo_square_2d.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3387239654b30b3e24ca3c42e9c320a11b130031df7ac65caee8d39341212f2 +size 31025 diff --git a/addons/godot-rapier2d/logo_square_2d.png.import b/addons/godot-rapier2d/logo_square_2d.png.import new file mode 100644 index 0000000..35dc183 --- /dev/null +++ b/addons/godot-rapier2d/logo_square_2d.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d1iwpd5epp8u6" +path="res://.godot/imported/logo_square_2d.png-ee7cb55fd9c4d1815ce7e83cd5401198.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-rapier2d/logo_square_2d.png" +dest_files=["res://.godot/imported/logo_square_2d.png-ee7cb55fd9c4d1815ce7e83cd5401198.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/godot-rapier2d/plugin.cfg b/addons/godot-rapier2d/plugin.cfg new file mode 100644 index 0000000..36d6b4d --- /dev/null +++ b/addons/godot-rapier2d/plugin.cfg @@ -0,0 +1,8 @@ +[plugin] + +name="Godot Rapier 2D" +description="A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids." +author="appsinacup" +version="0.8.2" +script="plugin.gd" +flavour="godot-rapier-2d-single-enhanced-determinism" diff --git a/addons/godot-rapier2d/plugin.gd b/addons/godot-rapier2d/plugin.gd new file mode 100644 index 0000000..d44c57b --- /dev/null +++ b/addons/godot-rapier2d/plugin.gd @@ -0,0 +1,12 @@ +@tool +extends EditorPlugin + +func _enter_tree(): + if Engine.is_editor_hint(): + Engine.set_meta("Rapier2DEditorPlugin", self) + var update_tool: Node = load("res://addons/godot-rapier2d/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("Rapier2DEditorPlugin"): + Engine.remove_meta("Rapier2DEditorPlugin") diff --git a/addons/godot-rapier2d/water_shader.gdshader b/addons/godot-rapier2d/water_shader.gdshader new file mode 100644 index 0000000..ce31fd6 --- /dev/null +++ b/addons/godot-rapier2d/water_shader.gdshader @@ -0,0 +1,22 @@ +shader_type canvas_item; + +uniform float threshold = 0.8; +uniform vec4 water_color: source_color = vec4(0.12,0.24,0.45,0.65); +uniform vec4 test_color: source_color = vec4(1,0,1,1); + +uniform float speed = 0.1; // Speed of movement +uniform float amplitude = 0.1; // Amplitude of movement + +uniform sampler2D water_texture; + +void fragment(){ + float displacement = sin(TIME * speed) * amplitude; + vec4 screen_tex = texture(TEXTURE, SCREEN_UV).rgba; + + float color_distance = screen_tex.r; + if (color_distance > threshold) { + COLOR = texture(water_texture, SCREEN_UV + displacement).rgba * water_color; + } else { + COLOR = vec4(0.0); + } +} \ No newline at end of file diff --git a/addons/godot-rapier2d/water_shader.tres b/addons/godot-rapier2d/water_shader.tres new file mode 100644 index 0000000..1566b3c --- /dev/null +++ b/addons/godot-rapier2d/water_shader.tres @@ -0,0 +1,11 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://cysnk7s2ll173"] + +[ext_resource type="Shader" path="res://addons/godot-rapier2d/water_shader.gdshader" id="1_wgm3x"] + +[resource] +shader = ExtResource("1_wgm3x") +shader_parameter/threshold = 0.8 +shader_parameter/water_color = Color(0.12, 0.24, 0.45, 0.65) +shader_parameter/test_color = Color(1, 0, 1, 1) +shader_parameter/speed = 0.1 +shader_parameter/amplitude = 0.1 diff --git a/camera/scene/scene_camera.gd b/camera/scene/scene_camera.gd new file mode 100644 index 0000000..83b5de8 --- /dev/null +++ b/camera/scene/scene_camera.gd @@ -0,0 +1,6 @@ +extends Camera2D +# Do not add a class_name here. SceneCamera is already an autoload singleton. + + +func _ready() -> void: + Log.debug(self, "SceneCamera is ready!") diff --git a/camera/scene/scene_camera.tscn b/camera/scene/scene_camera.tscn new file mode 100644 index 0000000..10ff013 --- /dev/null +++ b/camera/scene/scene_camera.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://betkkg11qmour"] + +[ext_resource type="Script" path="res://camera/scene/scene_camera.gd" id="1_7mr1j"] + +[node name="SceneCamera" type="Camera2D"] +script = ExtResource("1_7mr1j") diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..2deca2f --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://df3v65dc74xy8" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..45fed2b --- /dev/null +++ b/project.godot @@ -0,0 +1,25 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="chiodini" +run/main_scene="res://root.tscn" +config/features=PackedStringArray("4.3", "Forward Plus") +config/icon="res://icon.svg" + +[autoload] + +SceneCamera="*res://camera/scene/scene_camera.tscn" +Log="*res://utils/log/log.tscn" + +[rendering] + +environment/defaults/default_clear_color=Color(0.0627451, 0.0627451, 0.0705882, 1) diff --git a/root.tscn b/root.tscn new file mode 100644 index 0000000..1f70029 --- /dev/null +++ b/root.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://d15wtjeqete7v"] + +[node name="Root" type="Node2D"] diff --git a/utils/log/log.gd b/utils/log/log.gd new file mode 100644 index 0000000..9704b13 --- /dev/null +++ b/utils/log/log.gd @@ -0,0 +1,66 @@ +extends Node + + +## Global logging utilities. + +## The level used by default by all objects not specified in [field levels]. +## +## Only read on [func _ready]. +var root_max_level := 100 + +## Mapping between objects and their log level. +var levels := {} + + +func trace(obj: Node, message: String) -> void: + _log(60, obj, message) + +func debug(obj: Node, message: String) -> void: + _log(50, obj, message) + +func info(obj: Node, message: String) -> void: + _log(40, obj, message) + +func success(obj: Node, message: String) -> void: + _log(30, obj, message) + +func warning(obj: Node, message: String) -> void: + _log(20, obj, message) + +func error(obj: Node, message: String) -> void: + _log(10, obj, message) + + +func _log(level: int, obj: Node, message: String) -> void: + var color = _get_color(level) + var max_level = _get_max_level(obj) + if level <= max_level: + print_rich("[color=%s]<%s> %s[/color]" % [color, obj, message]) + +func _get_color(level: int) -> String: + if level <= 10: + return "#ffa6a6" + elif level <= 20: + return "#ffffa6" + elif level <= 30: + return "#a6ffa6" + elif level <= 40: + return "#99eeff" + elif level <= 50: + return "#a8a8ff" + else: + return "#dfabff" + +func _get_max_level(obj: Node) -> int: + while obj != null: + var level = levels.get(obj) + if level != null: + return level + else: + obj = obj.get_parent() + return root_max_level + + +func _ready() -> void: + var tree := get_tree() + levels[tree] = root_max_level diff --git a/utils/log/log.tscn b/utils/log/log.tscn new file mode 100644 index 0000000..b59c65a --- /dev/null +++ b/utils/log/log.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://b4qr4afktsoap"] + +[ext_resource type="Script" path="res://utils/log/log.gd" id="1_cem14"] + +[node name="Log" type="Node2D"] +script = ExtResource("1_cem14")