Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync to latest changes #2

Merged
merged 24 commits into from
Apr 8, 2023
Merged

Conversation

Hapenia-Lans
Copy link
Owner

No description provided.

ttencate and others added 24 commits March 27, 2023 11:20
Refactors `KvParser` to accept some expressions, as long as they don't
contain a comma at the top level outside any pair of `[]`, `()` or `{}`.

Also tightens up spans in error messages quite a bit.
203: Make `get` and `set` arguments take identifiers instead of strings r=Bromeon a=ttencate

Refactors `KvParser` to accept some expressions, as long as they don't
contain a comma at the top level outside any pair of `[]`, `()` or `{}`.

Also tightens up spans in error messages quite a bit.

Prelude for #199.

Co-authored-by: Thomas ten Cate <ttencate@gmail.com>
205: Implement #[init(default = ...)] annotation r=Bromeon a=ttencate

Fixes #199

Co-authored-by: Thomas ten Cate <ttencate@gmail.com>
Add `Mul<X>` impls for `Transform2/3D` for the new types
Add `min/max` functions for `Vector2/3`
180: Add basic impls of `Rect2`, `Rect2i`, `Aabb`, `Plane` r=Bromeon a=sayaks

- adds basic impls of `Rect2`, `Rect2i`, `Aabb`, `Plane`, so that every function/operator is usable (though many through `InnerX`)
- adds `Mul<X>` impls for `Transform2/3D` for the new types 
- adds `min/max` functions for `Vector2/3/4`

i did not add `Mul<Transform2/3D>` for these types because they are actually kinda odd in how they work in godot. We could consider adding them later but it seems there are some outstanding issues in godot related to them (such as godotengine/godot#71035) so it'd probably be good to wait and see if anything is changing there. 

min/max is there mainly to make the implementation of `Transform2D * Rect2` and `Transform3D * Aabb` cleaner. But are convenient functions to have in general.

Co-authored-by: Lili Zoey <lili.andersen@nrk.no>
…ivate)

Rename opaque pointer types to highlight their private nature.
Needs an update in packed_array.rs because it accidentally uses private implementation details.
Also update artifacts repo + branch version to "4.0.1"
…ic analysis)

A directory /.generated in the repo root seems to _mostly_ work, but on CLion it needs an extra "Cargo sync" in fresh/cleaned projects.
This creates extra friction that a crate-local `gen` directory doesn't have. Maybe reconsider this once IDEs handle things better.
211: Prebuilt Godot artifacts r=Bromeon a=Bromeon

Closes #12 
Closes #107 

From now on, gdext by default fetches pre-generated versions of these files, published in the [`godot4-prebuilt`](https://github.com/godot-rust/godot4-prebuilt) repo:
* `extension_api.json` (from Godot binary)
* `gdextension_interface.h` (from Godot binary)
* `gdextension_interface.rs` (through bindgen -- currently supports 3 platforms)

This has several benefits:
1. Significantly fewer dependencies, as bindgen is no longer needed, and thus smaller compile times.
2. Most CI jobs no longer need the Godot binary (clippy, test), speeding up CI _in addition_ to (1).
3. It's possible to change the Godot API behind gdext without manually rebuilding the artifacts.
4. Easy comparison between the Godot APIs of different released versions.


### Using a custom Godot binary

It is still possible to generate those files locally like before, through the use of the `custom-godot` feature on the `godot` crate.

This is necessary for any platform/configuration different from the 3 main supported ones (because bindgen generates different Rust bindings), as well as any in-development or modified Godot versions.


### Changing the Godot release

By default, the latest Godot release is used as input to gdext. Switching between different Godot versions is easily possible, although a bit cumbersome.

If you want to use an older version `4.0`, add this to your **workspace** (not sub-crate) `Cargo.toml`:
```toml
# We need to trick Cargo into seeing a different URL; rust-lang/cargo#5478
[patch."https://github.com/godot-rust/godot4-prebuilt"]
godot4-prebuilt = { git = "https://github.com//godot-rust/godot4-prebuilt", branch = "4.0"}
```
We're looking into ways to simplify this. In a crates.io release (#2), we would need to rethink this anyway, mapping Godot versions to Rust release versions (which is not trivial).

Co-authored-by: Jan Haller <bromeon@gmail.com>
Fixes #190

Some node methods are expected to return values. The corresponding
virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit makes
`godot_codegen::clas_generator::make_function_definition` and
`make_return` aware of virtual method. It also adds a test making sure
we can call a virtual method that has a return value.
207: Add return values when generating virtual methods r=Bromeon a=jbarnoud

Fixes #190

Some node methods are expected to return values. The corresponding virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit adapts what I think is the relevant code from
`godot_codegen::class_generator::make_method_definition` into `make_virtual_method`.

Note that I am very unfamiliar with most of the code I had to touch here as well as with the project.

Co-authored-by: Jonathan Barnoud <jonathan@barnoud.net>
217: check.sh: find Godot 4 executable when available as `godot` r=Bromeon a=yannick-was-taken

# The Issue

Some package managers (Arch Linux) install Godot 4.x as `godot` in the PATH. This is currently not correctly dealt with by check.sh, requiring the user to set GODOT4_BIN manually.

# The Solution

If `godot` is available, `check.sh` now inspects the version of that Godot installation, and if 4.x, accepts it gladly, removing the need to manually set GODOT4_BIN.

# Detail

The version check applies the regex `^4\.` to the version returned by `godot --version`. An example version (the one available in Arch Linux's community repo) is `4.0.1.stable.arch_linux`.

Co-authored-by: yannick-was-taken <yannick-was-taken@posteo.de>
215: Contribution guidelines, update `.gdextension` configurations r=Bromeon a=Bromeon

Elaborates the contribution process, documents `#[itest]` and unifies the `.gdextension` library entries.

Fixes #208.

Co-authored-by: Jan Haller <bromeon@gmail.com>
@Hapenia-Lans Hapenia-Lans merged commit 7592cf3 into Hapenia-Lans:master Apr 8, 2023
Hapenia-Lans pushed a commit that referenced this pull request May 26, 2023
# This is the 1st commit message:

Parse gdextension_interface.h declarations using regex

# This is the commit message #2:

AsUninit trait to convert FFI pointers to their uninitialized versions

# This is the commit message godot-rust#3:

GodotFfi::from_sys_init() now uses uninitialized pointer types

# This is the commit message godot-rust#4:

Introduce GDExtensionUninitialized*Ptr, without changing semantics

# This is the commit message godot-rust#5:

Adjust init code to new get_proc_address mechanism

# This is the commit message godot-rust#6:

Make `trace` feature available in godot-ffi, fix interface access before initialization

# This is the commit message godot-rust#7:

Compatibility layer between Godot 4.0 and 4.1 (different GDExtension APIs)

# This is the commit message godot-rust#8:

Add GdextBuild to access build/runtime metadata

# This is the commit message godot-rust#9:

Detect 4.0 <-> 4.1 mismatches in both directions + missing `compatibility_minimum = 4.1`

# This is the commit message godot-rust#10:

Detect legacy/modern version of C header (also without `custom-godot` feature)

# This is the commit message godot-rust#11:

CI: add jobs that use patched 4.0.x versions

# This is the commit message godot-rust#12:

Remove several memory leaks by constructing into uninitialized pointers

# This is the commit message godot-rust#13:

CI: memcheck jobs for both 4.0.3 and nightly

# This is the commit message godot-rust#14:

Remove ToVariant, FromVariant, and VariantMetadata impls for pointers

This commit splits SignatureTuple into two separate traits:
PtrcallSignatureTuple and VarcallSignatureTuple. The latter is a child
of the former. PtrcallSignatureTuple is used for ptrcall and only
demands GodotFuncMarshall of its arguments. VarcallSignatureTuple is
used for varcall and additionally demands ToVariant, FromVariant, and
VariantMetadata of its arguments, so pointers cannot benefit from the
optimizations provided by varcall over ptrcall.

# This is the commit message godot-rust#15:

Adds FromVariant and ToVariant proc macros

# This is the commit message godot-rust#16:

godot-core: builtin: reimplement Plane functions/methods

# This is the commit message godot-rust#17:

impl GodotFfi for Option<T> when T is pointer sized and nullable godot-rust#240

Additionally FromVariant and ToVariant are also implemented for Option<Gd<T>>
to satisfy all the requirements for ffi and godot_api.

# This is the commit message godot-rust#18:

Fix UB in virtual method calls that take objects
Fix incorrect incrementing of refcount when calling in to godot
Fix refcount not being incremented when we receive a refcounted object in virtual methods

# This is the commit message godot-rust#19:

fix UB caused by preload weirdness

# This is the commit message godot-rust#20:

Implements swizzle and converts from/to tuples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants