From 925284ac3ace399c3cfe9f1957f04d61d16df75d Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sun, 23 Jul 2023 20:45:04 +0200 Subject: [PATCH] add basic impl for force_integration_callback update signing Update macos_builds.yml Update README.md Update README.md update readme add thirdparty.txtf ile update thirdparty update path try sign verify with verbose list files try again to sign using an action this time remove exit update signing Update macos_builds.yml Update macos_builds.yml sign manually upd upd try without timestamp copy license in addons export also try with timestamp again use debug and release target to reduze binary size. disable ios build for now add info.plist Update linux_builds.yml Update CHANGELOG.md Update README.md Update README.md Update README.md Update README.md export again both Update CHANGELOG.md Update CHANGELOG.md --- .github/actions/upload/action.yml | 2 +- .github/workflows/linux_builds.yml | 4 +- .github/workflows/macos_builds.yml | 5 +- .github/workflows/runner.yml | 8 +- .github/workflows/windows_builds.yml | 1 - .gitignore | 3 +- CHANGELOG.md | 5 + README.md | 33 +++-- THIRDPARTY.txt | 117 ++++++++++++++++++ dist/addons/godot-box2d/LICENSE.txt | 21 ++++ dist/addons/godot-box2d/THIRDPARTY.txt | 117 ++++++++++++++++++ .../Resources/Info.plist | 28 +++++ .../Resources/Info.plist | 28 +++++ scripts/ci-sign-macos.ps1 | 21 +++- src/bodies/box2d_body.cpp | 26 ++-- src/bodies/box2d_body.h | 11 +- src/servers/physics_server_box2d.cpp | 10 +- src/spaces/box2d_sweep_test.cpp | 6 +- 18 files changed, 406 insertions(+), 40 deletions(-) create mode 100644 THIRDPARTY.txt create mode 100644 dist/addons/godot-box2d/LICENSE.txt create mode 100644 dist/addons/godot-box2d/THIRDPARTY.txt create mode 100644 dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_debug.framework/Resources/Info.plist create mode 100644 dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_release.framework/Resources/Info.plist mode change 100644 => 100755 scripts/ci-sign-macos.ps1 diff --git a/.github/actions/upload/action.yml b/.github/actions/upload/action.yml index 469a5f2..dcc60fa 100644 --- a/.github/actions/upload/action.yml +++ b/.github/actions/upload/action.yml @@ -7,7 +7,7 @@ runs: - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: Physics Server Box2D + name: Godot Box2D path: | ${{ github.workspace }}/dist/** retention-days: 14 diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 8708766..396c0d7 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -7,8 +7,8 @@ env: SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no jobs: - ios: - runs-on: "ubuntu-20.04" + linux: + runs-on: ubuntu-20.04 name: Linux Build ${{ matrix.target }} ${{ matrix.arch }} strategy: fail-fast: false diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index 0960316..1d1ce0f 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -29,7 +29,7 @@ jobs: arch: ${{ matrix.arch }} platform: macos target: ${{ matrix.target }} - + - name: Sign frameworks shell: pwsh env: @@ -38,7 +38,8 @@ jobs: APPLE_DEV_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} APPLE_DEV_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} APPLE_DEV_PASSWORD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} - run: gci -R ./dist/addons/*.framework | ./scripts/ci-sign-macos.ps1 + APPLE_DEV_APP_ID: ${{ secrets.PROD_MACOS_APPLE_DEV_APP_ID }} + run: ./scripts/ci-sign-macos.ps1 dist/addons/godot-box2d/bin/libgodot-box2d.macos.${{ matrix.target }}.framework if: ${{ env.APPLE_DEV_ID }} - name: Upload ${{ matrix.target }} ${{ matrix.arch }} diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 7000b86..2c6a2c4 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -14,10 +14,10 @@ jobs: needs: static-checks uses: ./.github/workflows/android_builds.yml - ios-build: - name: 🍏 iOS - needs: static-checks - uses: ./.github/workflows/ios_builds.yml + #ios-build: + # name: 🍏 iOS + # needs: static-checks + # uses: ./.github/workflows/ios_builds.yml linux-build: name: 🐧 Linux diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index fa1a061..b2f6de5 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -33,4 +33,3 @@ jobs: - name: Upload ${{ matrix.target }} ${{ matrix.arch }} uses: ./.github/actions/upload - diff --git a/.gitignore b/.gitignore index 183bced..5b02e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,8 @@ *.dblite # Generated directories with binaries -dist/addons/godot-box2d/bin/** +dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_debug.framework/libgodot-box2d.macos.template_debug +dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_release.framework/libgodot-box2d.macos.template_release .DS_Store .vscode diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6de82..07c2419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [v0.3](https://github.com/godot-box2d/godot-box2d/releases/tag/v0.3) + +- Fix mac binary signing +- Add basic implementation for force_integration_callback + ## [v0.2](https://github.com/godot-box2d/godot-box2d/releases/tag/v0.2) - Fix CharacterController2D to correctly work(passing 19/20 tests) diff --git a/README.md b/README.md index 29af823..de03d4f 100644 --- a/README.md +++ b/README.md @@ -3,32 +3,37 @@ # Godot Box2D [![🔗 Build Status](https://github.com/godot-box2d/godot-box2d/actions/workflows/runner.yml/badge.svg)](https://github.com/godot-box2d/godot-box2d/actions/workflows/runner.yml) + A [box2D](https://github.com/erincatto/box2d) physics server for [Godot Engine](https://github.com/godotengine/godot) 4.1, implemented as a GDExtension. -Based of [rburing/physics_server_box2d](https://github.com/rburing/physics_server_box2d). +## Limitations + +- Having non symetrical physics mask/layers results in no collision. Eg. if we had the following: + +|object|mask|category| +|---|---|---| +|object A|1|2| +|object B|2|2| + + In godot would result a collision, but would be very weird, as only one of the objects would receive collision restution. ## Missing/Not implemented - Skewed shapes - Scaled shapes - Constant speed on static bodies -- Collision layers and masks don't work exactly the same (having non symetric layer/mask) - Body pickable - Torque uses wrong values -## Install from binaries +## Install -Currently it's built automatically for: +### From Godot Asset Store -- Windows (x86-64, x86) -- Linux (x86-64) -- macOS (x86-64 + Apple Silicon) -- iOS (arm64) -- Android (arm64 + x86_64) +[Godot Asset Library](https://godotengine.org/asset-library/asset/2007) -Go to any action workflow on this project: [Actions List](https://github.com/rburing/physics_server_box2d/actions) +### From Github Releases -1. [Download latest release](https://github.com/godot-box2d/godot-box2d/releases/latest) from github job +1. Download from [Github Releases](https://github.com/godot-box2d/godot-box2d/releases/latest) 2. Extract the ZIP archive and move the `addons/` folder it contains into your project folder 3. Open your project settings 4. Make sure "Advanced Settings" is enabled @@ -38,7 +43,7 @@ Go to any action workflow on this project: [Actions List](https://github.com/rbu ## Building from source -1. Clone the git repository, including its `box2d` and `godot-cpp` submodules. +1. Clone the git repository, including its submodules. 2. Open a terminal application and change its working directory to the `godot-box2d` git repository. @@ -57,3 +62,7 @@ Go to any action workflow on this project: [Actions List](https://github.com/rbu ## Lint Run `scripts/clang-tidy.sh` in order to lint. + +## Credits + +Based of [rburing/physics_server_box2d](https://github.com/rburing/physics_server_box2d). Many thanks to you for starting implementation on this! diff --git a/THIRDPARTY.txt b/THIRDPARTY.txt new file mode 100644 index 0000000..3e7a988 --- /dev/null +++ b/THIRDPARTY.txt @@ -0,0 +1,117 @@ +Godot Box2D 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/godot-jolt/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. + +box2d (https://github.com/erincatto/box2d) + + MIT License + + Copyright (c) 2019 Erin Catto + + 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 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. + + +godot_box2d (https://github.com/briansemrau/godot_box2d) + MIT License + + Copyright (c) 2020 Brian Semrau + + 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/dist/addons/godot-box2d/LICENSE.txt b/dist/addons/godot-box2d/LICENSE.txt new file mode 100644 index 0000000..57f6dc5 --- /dev/null +++ b/dist/addons/godot-box2d/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022-present Ricardo Buring 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/dist/addons/godot-box2d/THIRDPARTY.txt b/dist/addons/godot-box2d/THIRDPARTY.txt new file mode 100644 index 0000000..3e7a988 --- /dev/null +++ b/dist/addons/godot-box2d/THIRDPARTY.txt @@ -0,0 +1,117 @@ +Godot Box2D 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/godot-jolt/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. + +box2d (https://github.com/erincatto/box2d) + + MIT License + + Copyright (c) 2019 Erin Catto + + 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 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. + + +godot_box2d (https://github.com/briansemrau/godot_box2d) + MIT License + + Copyright (c) 2020 Brian Semrau + + 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/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_debug.framework/Resources/Info.plist b/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_debug.framework/Resources/Info.plist new file mode 100644 index 0000000..c11f66f --- /dev/null +++ b/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_debug.framework/Resources/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleExecutable + libgodot-box2d.macos.template_debug + CFBundleIdentifier + org.godot-box2d.godot-box2d + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Godot Box2D + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + MacOSX + + NSHumanReadableCopyright + Copyright (c) 2022-present Ricardo Buring and Dragos Daian. + CFBundleVersion + 1.0.0 + LSMinimumSystemVersion + 10.12 + + diff --git a/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_release.framework/Resources/Info.plist b/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_release.framework/Resources/Info.plist new file mode 100644 index 0000000..0e97b33 --- /dev/null +++ b/dist/addons/godot-box2d/bin/libgodot-box2d.macos.template_release.framework/Resources/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleExecutable + libgodot-box2d.macos.template_release + CFBundleIdentifier + org.godot-box2d.godot-box2d + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Godot Box2D + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + MacOSX + + NSHumanReadableCopyright + Copyright (c) 2022-present Ricardo Buring and Dragos Daian. + CFBundleVersion + 1.0.0 + LSMinimumSystemVersion + 10.12 + + diff --git a/scripts/ci-sign-macos.ps1 b/scripts/ci-sign-macos.ps1 old mode 100644 new mode 100755 index 6b6592e..2db2de0 --- a/scripts/ci-sign-macos.ps1 +++ b/scripts/ci-sign-macos.ps1 @@ -32,10 +32,12 @@ begin { $DevId = $env:APPLE_DEV_ID $DevTeamId = $env:APPLE_DEV_TEAM_ID $DevPassword = $env:APPLE_DEV_PASSWORD + $DeveloperIdApplication = $env:APPLE_DEV_APP_ID if (!$CertificateBase64) { throw "No certificate provided" } if (!$CertificatePassword) { throw "No certificate password provided" } if (!$DevId) { throw "No Apple Developer ID provided" } + if (!$DeveloperIdApplication) { throw "No Apple Developer ID Application provided" } if (!$DevTeamId) { throw "No Apple Team ID provided" } if (!$DevPassword) { throw "No Apple Developer password provided" } @@ -73,22 +75,33 @@ process { Write-Output "Signing '$Framework'..." - & $CodesignPath --sign "Developer ID" "$Framework" + & $CodesignPath --force --verify --timestamp --verbose --sign $DeveloperIdApplication "$Framework" Write-Output "Verifying signing..." - & $CodesignPath --verify "$Framework" + & $CodesignPath --verify --verbose "$Framework" Write-Output "Archiving framework to '$Archive'..." - ditto -ck "$Framework" "$Archive" + ditto -ck --sequesterRsrc --keepParent "$Framework" "$Archive" Write-Output "Submitting archive for notarization..." - xcrun notarytool submit "$Archive" ` + $output = xcrun notarytool submit "$Archive" ` --apple-id $DevId ` --team-id $DevTeamId ` --password $DevPassword ` --wait + echo $output + $matches = $output -match '((\d|[a-z])+-(\d|[a-z])+-(\d|[a-z])+-(\d|[a-z])+-(\d|[a-z])+)' + if ($output) { + $id_res = $matches[0].Substring(6) + } + xcrun notarytool log $id_res ` + --apple-id $DevId ` + --team-id $DevTeamId ` + --password $DevPassword ` + developer_log.json + get-content developer_log.json } } diff --git a/src/bodies/box2d_body.cpp b/src/bodies/box2d_body.cpp index cf4b93e..3f30cf9 100644 --- a/src/bodies/box2d_body.cpp +++ b/src/bodies/box2d_body.cpp @@ -5,6 +5,19 @@ bool Box2DBody::is_active() const { return active; } // Physics Server +void Box2DBody::set_omit_force_integration(bool p_enable) { + omit_force_integration = p_enable; +} +bool Box2DBody::is_omitting_force_integration() { + return omit_force_integration; +} +void Box2DBody::set_force_integration_callback(const Callable &p_callable, const Variant &p_userdata) { + body_force_integration_callback = p_callable; + body_force_integration_userdata = p_userdata; +} +void Box2DBody::set_state_sync_callback(const Callable &p_callable) { + body_state_sync_callback = p_callable; +} void Box2DBody::set_max_contacts_reported(int32 p_max_contacts_reported) { max_contacts_reported = p_max_contacts_reported; } @@ -20,10 +33,6 @@ void Box2DBody::wakeup() { set_active(true); } -void Box2DBody::set_state_sync_callback(const Callable &p_callable) { - body_state_callback = p_callable; -} - Box2DDirectBodyState *Box2DBody::get_direct_state() { if (!direct_state) { direct_state = memnew(Box2DDirectBodyState); @@ -200,15 +209,18 @@ void Box2DBody::set_space(Box2DSpace *p_space) { } void Box2DBody::after_step() { - if (body_state_callback.is_valid()) { + if (body_state_sync_callback.is_valid() || (!!omit_force_integration && body_force_integration_callback.is_valid())) { get_space()->body_add_to_state_query_list(&direct_state_query_list); } } void Box2DBody::call_queries() { Variant direct_state = get_direct_state(); - if (body_state_callback.is_valid()) { - body_state_callback.callv(Array::make(direct_state)); + if (body_state_sync_callback.is_valid()) { + body_state_sync_callback.callv(Array::make(direct_state)); + } + if (!omit_force_integration && body_force_integration_callback.is_valid()) { + body_force_integration_callback.callv(Array::make(direct_state, body_force_integration_userdata)); } } diff --git a/src/bodies/box2d_body.h b/src/bodies/box2d_body.h index 65f3d15..555909d 100644 --- a/src/bodies/box2d_body.h +++ b/src/bodies/box2d_body.h @@ -26,22 +26,27 @@ class Box2DBody : public Box2DCollisionObject { Transform2D new_transform; - Callable body_state_callback; + Callable body_force_integration_callback; + Variant body_force_integration_userdata; + Callable body_state_sync_callback; Box2DDirectBodyState *direct_state = nullptr; HashSet joints; int32 max_contacts_reported = 0; + bool omit_force_integration = true; public: // Physics Server + void set_omit_force_integration(bool p_enable); void set_max_contacts_reported(int32 p_max_contacts_reported); + bool is_omitting_force_integration(); + void set_force_integration_callback(const Callable &p_callable, const Variant &p_userdata); + void set_state_sync_callback(const Callable &p_callable); int32 get_max_contacts_reported(); void set_space(Box2DSpace *p_space) override; - void set_state_sync_callback(const Callable &p_callable); - Box2DDirectBodyState *get_direct_state(); void set_active(bool p_active); diff --git a/src/servers/physics_server_box2d.cpp b/src/servers/physics_server_box2d.cpp index 4ae0ce4..ac387d8 100644 --- a/src/servers/physics_server_box2d.cpp +++ b/src/servers/physics_server_box2d.cpp @@ -955,11 +955,19 @@ double PhysicsServerBox2D::_body_get_contacts_reported_depth_threshold(const RID return 0; } void PhysicsServerBox2D::_body_set_omit_force_integration(const RID &p_body, bool p_enable) { + Box2DBody *body = body_owner.get_or_null(p_body); + ERR_FAIL_COND(!body); + body->set_omit_force_integration(p_enable); } bool PhysicsServerBox2D::_body_is_omitting_force_integration(const RID &p_body) const { - return false; + Box2DBody *body = body_owner.get_or_null(p_body); + ERR_FAIL_COND_V(!body, false); + return body->is_omitting_force_integration(); } void PhysicsServerBox2D::_body_set_force_integration_callback(const RID &p_body, const Callable &p_callable, const Variant &p_userdata) { + Box2DBody *body = body_owner.get_or_null(p_body); + ERR_FAIL_COND(!body); + body->set_force_integration_callback(p_callable, p_userdata); } bool PhysicsServerBox2D::_body_collide_shape(const RID &p_body, int32_t p_body_shape, const RID &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, void *p_results, int32_t p_result_max, int32_t *p_result_count) { Box2DBody *body = body_owner.get_or_null(p_body); diff --git a/src/spaces/box2d_sweep_test.cpp b/src/spaces/box2d_sweep_test.cpp index e0b926a..c1a99ae 100644 --- a/src/spaces/box2d_sweep_test.cpp +++ b/src/spaces/box2d_sweep_test.cpp @@ -38,8 +38,10 @@ real_t SweepTestResult::unsafe_fraction(float safe_fraction) { if (safe_fraction <= b2_epsilon) { return 0; } - float unsafe = safe_fraction + b2_linearSlop; - return unsafe; + if (safe_fraction >= toi_output.t) { + return safe_fraction + b2_linearSlop; + } + return toi_output.t; } b2Sweep Box2DSweepTest::create_b2_sweep(b2Transform p_transform, b2Vec2 p_center, b2Vec2 p_motion) {