Skip to content

Commit d5cc777

Browse files
authored
Merge pull request #1803 from dsnopek/4.3-cherrypicks-5
Cherry-picks for the godot-cpp 4.3 branch - 5th batch
2 parents dcd0842 + b1e2ac5 commit d5cc777

File tree

16 files changed

+144
-108
lines changed

16 files changed

+144
-108
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
matrix:
2222
include:
2323
- name: 🐧 Linux (GCC)
24-
os: ubuntu-20.04
24+
os: ubuntu-22.04
2525
platform: linux
2626
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
2727
artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
2828
run-tests: true
2929
cache-name: linux-x86_64
3030

3131
- name: 🐧 Linux (GCC, Double Precision)
32-
os: ubuntu-20.04
32+
os: ubuntu-22.04
3333
platform: linux
3434
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
3535
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
@@ -38,15 +38,15 @@ jobs:
3838
cache-name: linux-x86_64-f64
3939

4040
- name: 🏁 Windows (x86_64, MSVC)
41-
os: windows-2019
41+
os: windows-2022
4242
platform: windows
4343
artifact-name: godot-cpp-windows-msvc2019-x86_64-release
4444
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.lib
4545
run-tests: false
4646
cache-name: windows-x86_64-msvc
4747

4848
- name: 🏁 Windows (x86_64, MinGW)
49-
os: windows-2019
49+
os: windows-2022
5050
platform: windows
5151
artifact-name: godot-cpp-linux-mingw-x86_64-release
5252
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.a
@@ -64,7 +64,7 @@ jobs:
6464
cache-name: macos-universal
6565

6666
- name: 🤖 Android (arm64)
67-
os: ubuntu-20.04
67+
os: ubuntu-22.04
6868
platform: android
6969
artifact-name: godot-cpp-android-arm64-release
7070
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
@@ -82,7 +82,7 @@ jobs:
8282
cache-name: ios-arm64
8383

8484
- name: 🌐 Web (wasm32)
85-
os: ubuntu-20.04
85+
os: ubuntu-22.04
8686
platform: web
8787
artifact-name: godot-cpp-web-wasm32-release
8888
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
@@ -183,7 +183,7 @@ jobs:
183183

184184
linux-cmake:
185185
name: 🐧 Build (Linux, GCC, CMake)
186-
runs-on: ubuntu-20.04
186+
runs-on: ubuntu-22.04
187187
steps:
188188
- name: Checkout
189189
uses: actions/checkout@v4
@@ -207,7 +207,7 @@ jobs:
207207
208208
linux-cmake-ninja:
209209
name: 🐧 Build (Linux, GCC, CMake Ninja)
210-
runs-on: ubuntu-20.04
210+
runs-on: ubuntu-22.04
211211
steps:
212212
- name: Checkout
213213
uses: actions/checkout@v4
@@ -231,7 +231,7 @@ jobs:
231231
232232
windows-msvc-cmake:
233233
name: 🏁 Build (Windows, MSVC, CMake)
234-
runs-on: windows-2019
234+
runs-on: windows-2022
235235
steps:
236236
- name: Checkout
237237
uses: actions/checkout@v4
@@ -240,10 +240,10 @@ jobs:
240240

241241
- name: Build godot-cpp
242242
run: |
243-
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .
243+
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
244244
cmake --build . --verbose --config Release
245245
246246
- name: Build test GDExtension library
247247
run: |
248-
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" .
248+
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 17 2022" .
249249
cmake --build . --verbose --config Release

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
> from Godot's `master` branch.
88
>
99
> For users of stable branches, switch to the branch matching your target Godot version:
10+
> - [`4.4`](https://github.com/godotengine/godot-cpp/tree/4.4)
11+
> - [`4.3`](https://github.com/godotengine/godot-cpp/tree/4.3)
1012
> - [`4.2`](https://github.com/godotengine/godot-cpp/tree/4.2)
1113
> - [`4.1`](https://github.com/godotengine/godot-cpp/tree/4.1)
1214
> - [`4.0`](https://github.com/godotengine/godot-cpp/tree/4.0)
@@ -49,20 +51,13 @@ Godot version.**
4951
5052
## Compatibility
5153

52-
> [!WARNING]
53-
>
54-
> The GDExtension API is brand new in Godot 4.0, and is still
55-
considered in **beta** stage, despite Godot 4.0 itself being released.
56-
>
57-
> This applies to both the GDExtension interface header, the API JSON, and this
58-
first-party `godot-cpp` extension.
59-
>
60-
> Some compatibility breakage is to be expected as GDExtension and `godot-cpp`
61-
> get more used, documented, and critical issues get resolved. See the
62-
> [Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension)
63-
> and the [godot-cpp issue tracker](https://github.com/godotengine/godot-cpp/issues)
64-
> for a list of known issues, and be sure to provide feedback on issues and PRs
65-
> which affect your use of this extension.
54+
GDExtensions targeting an earlier version of Godot should work in later minor versions,
55+
but not vice-versa. For example, a GDExtension targeting Godot 4.2 should work just fine
56+
in Godot 4.3, but one targeting Godot 4.3 won't work in Godot 4.2.
57+
58+
There is one exception to this: extensions targeting Godot 4.0 will _not_ work with
59+
Godot 4.1 and later.
60+
See [Updating your GDExtension for 4.1](https://docs.godotengine.org/en/latest/tutorials/migrating/upgrading_to_godot_4.1.html#updating-your-gdextension-for-godot-4-1).
6661

6762
## Contributing
6863

@@ -145,4 +140,4 @@ See the [godot-cpp-template](https://github.com/godotengine/godot-cpp-template)
145140
generic reusable template.
146141

147142
Or checkout the code for the [Summator example](https://github.com/paddy-exe/GDExtensionSummator)
148-
as shown in the [official documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/gdextension/gdextension_cpp_example.html).
143+
as shown in the [official documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/cpp/gdextension_cpp_example.html).

binding_generator.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,16 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
15911591
result.append(f"\t~{class_name}();")
15921592
result.append("")
15931593

1594+
if class_name == "Object":
1595+
result.append('\tString _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }')
1596+
result.append("")
1597+
1598+
if class_name == "Node":
1599+
result.append(
1600+
'\tString _to_string() const { return (!get_name().is_empty() ? String(get_name()) + ":" : "") + Object::_to_string(); }'
1601+
)
1602+
result.append("")
1603+
15941604
result.append("public:")
15951605

15961606
# Special cases.

include/godot_cpp/classes/wrapped.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Wrapped {
9494
bool _property_can_revert(const StringName &p_name) const { return false; }
9595
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; }
9696
void _validate_property(PropertyInfo &p_property) const {}
97-
String _to_string() const { return "[" + String(get_class_static()) + ":" + itos(get_instance_id()) + "]"; }
97+
String _to_string() const { return "<Wrapped#0>"; }
9898

9999
static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed) {}
100100
static GDExtensionBool set_bind(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value) { return false; }
@@ -123,10 +123,6 @@ class Wrapped {
123123
return string_name;
124124
}
125125

126-
uint64_t get_instance_id() const {
127-
return 0;
128-
}
129-
130126
// Must be public but you should not touch this.
131127
GodotObject *_owner = nullptr;
132128
};

include/godot_cpp/core/engine_ptrcall.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ O *_call_native_mb_ret_obj(const GDExtensionMethodBindPtr mb, void *instance, co
5656

5757
template <typename R, typename... Args>
5858
R _call_native_mb_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) {
59-
R ret;
59+
typename PtrToArg<R>::EncodeT ret;
6060
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
6161
internal::gdextension_interface_object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
62-
return ret;
62+
return static_cast<R>(ret);
6363
}
6464

6565
template <typename... Args>
@@ -70,10 +70,10 @@ void _call_native_mb_no_ret(const GDExtensionMethodBindPtr mb, void *instance, c
7070

7171
template <typename R, typename... Args>
7272
R _call_utility_ret(GDExtensionPtrUtilityFunction func, const Args &...args) {
73-
R ret;
73+
typename PtrToArg<R>::EncodeT ret;
7474
std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } };
7575
func(&ret, mb_args.data(), mb_args.size());
76-
return ret;
76+
return static_cast<R>(ret);
7777
}
7878

7979
template <typename... Args>

0 commit comments

Comments
 (0)