-
Notifications
You must be signed in to change notification settings - Fork 211
update GDNative headers and API bindings, add associated constants #207
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
update GDNative headers and API bindings, add associated constants #207
Conversation
Oops, I forgot the proper resolution of extension-extensions, will fix ASAP |
Okay, should be fixed now! |
Awesome! Thanks for fixing those types, they were really bothering me too.
I will check out your code and build my game against it for testing.
We really need to output a rust docs website during the api build process,
reading the code and understanding is hard.
…On Sun, 22 Sep 2019, 05:04 Thomas Herzog, ***@***.***> wrote:
This PR does multiple things:
- update the headers to he state of 3.1 (see the tag
<https://github.com/GodotNativeTools/godot_headers/tree/3.1> on the
godot_headers repo).
- update the api.json to the state of stable 3.1 and fix wrapper
generation
- add bindings to associated constants of a class (many constants are
also enum variants, but not all)
I think from the 3.1 version on all items in the api.json file are
actually sorted so that diffs are a lot cleaner and not 80000 lines of
changes every time 😄
The update in the api.json also contains a fix that makes most parameters
be the actual object type (for example Node) instead of falling back to
Object. This means that some code might break, but this was an error to
begin with.
------------------------------
Since this is a rather big change I would love to get some feedback from
people, so if this change could be tested locally, that would be great!
cc @tom-leys <https://github.com/tom-leys>, @toasteater
<https://github.com/toasteater>
------------------------------
You can view, comment on, or merge this pull request online at:
#207
Commit Summary
- update headers and GodotApi generation
- fix binding generation
- generate constants-impl for class constants
File Changes
- *M* bindings_generator/api.json
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-0>
(169325)
- *D* bindings_generator/namespaces.json
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-1>
(539)
- *M* bindings_generator/src/api.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-2>
(14)
- *M* bindings_generator/src/classes.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-3>
(57)
- *M* bindings_generator/src/lib.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-4>
(2)
- *M* examples/scene_create/src/lib.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-5>
(2)
- *M* gdnative-core/src/generated.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-6>
(1)
- *D* gdnative-core/src/internal.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-7>
(3418)
- *M* gdnative-core/src/lib.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-8>
(4)
- *M* gdnative-sys/Cargo.toml
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-9>
(2)
- *M* gdnative-sys/build.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-10>
(394)
- *M* gdnative-sys/godot_headers/android/godot_android.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-11>
(4)
- *M* gdnative-sys/godot_headers/arvr/godot_arvr.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-12>
(4)
- *M* gdnative-sys/godot_headers/gdnative/aabb.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-13>
(4)
- *M* gdnative-sys/godot_headers/gdnative/array.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-14>
(12)
- *M* gdnative-sys/godot_headers/gdnative/basis.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-15>
(19)
- *M* gdnative-sys/godot_headers/gdnative/color.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-16>
(18)
- *M* gdnative-sys/godot_headers/gdnative/dictionary.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-17>
(10)
- *M* gdnative-sys/godot_headers/gdnative/gdnative.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-18>
(12)
- *M* gdnative-sys/godot_headers/gdnative/node_path.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-19>
(6)
- *M* gdnative-sys/godot_headers/gdnative/plane.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-20>
(4)
- *M* gdnative-sys/godot_headers/gdnative/pool_arrays.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-21>
(4)
- *M* gdnative-sys/godot_headers/gdnative/quat.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-22>
(8)
- *M* gdnative-sys/godot_headers/gdnative/rect2.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-23>
(10)
- *D* gdnative-sys/godot_headers/gdnative/rect3.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-24>
(108)
- *M* gdnative-sys/godot_headers/gdnative/rid.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-25>
(4)
- *M* gdnative-sys/godot_headers/gdnative/string.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-26>
(12)
- *M* gdnative-sys/godot_headers/gdnative/string_name.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-27>
(4)
- *M* gdnative-sys/godot_headers/gdnative/transform.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-28>
(5)
- *M* gdnative-sys/godot_headers/gdnative/transform2d.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-29>
(4)
- *M* gdnative-sys/godot_headers/gdnative/variant.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-30>
(48)
- *M* gdnative-sys/godot_headers/gdnative/vector2.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-31>
(4)
- *M* gdnative-sys/godot_headers/gdnative/vector3.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-32>
(4)
- *M* gdnative-sys/godot_headers/gdnative_api.json
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-33>
(414)
- *M* gdnative-sys/godot_headers/gdnative_api_struct.gen.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-34>
(74)
- *M* gdnative-sys/godot_headers/nativescript/godot_nativescript.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-35>
(16)
- *M* gdnative-sys/godot_headers/net/godot_net.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-36>
(14)
- *M* gdnative-sys/godot_headers/pluginscript/godot_pluginscript.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-37>
(4)
- *A* gdnative-sys/godot_headers/videodecoder/godot_videodecoder.h
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-38>
(75)
- *A* gdnative-sys/src/api.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-39>
(98)
- *M* gdnative-sys/src/lib.rs
<https://github.com/GodotNativeTools/godot-rust/pull/207/files#diff-40>
(4)
Patch Links:
- https://github.com/GodotNativeTools/godot-rust/pull/207.patch
- https://github.com/GodotNativeTools/godot-rust/pull/207.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#207>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABIKNVOAQBXI4SMEZUBYTZDQKZHZHANCNFSM4IY64XXA>
.
|
Hi @karroffel - I'm very happy with this.
I'll be using your branch going forward, even prior to you merging it ;) |
enum_variant: &'a str, | ||
} | ||
|
||
const ENUM_VARIANTS_TO_SKIP: &[EnumReference<'static>] = &[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to skip deprecated constants? It might not be very sustainable to manually maintain a list of exceptions, when there are so many classes and constants around. Maybe it's better to just leave it to Godot's documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I see it's required for Rust enum generation. But methods still take i64
s, so these might not be as useful as the associated constants, that don't require this uniqueness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The associated constants do exist as well, but most of the enums (all except the two that are special cased here) have distinct variants, so for me this is a matter of deprecated items and a single weird "Default" enum that I think should probably not be there in the first place.
That said I agree with you, enums are only a subset of the associated constants and have more limitations, but when these limitations are dealt with properly they are quite nice to use (being able to do an exhaustive match for example).
These changes look great to me! I tried it locally and didn't see any unexpected breakage in my project. One thing to mention is the state of #183: previously as a workaround for it, the return types of VarArgs methods were manually altered in api.json. Updating the file undoes that change, so a proper fix is now required in |
@@ -84,6 +85,9 @@ impl GodotClass { | |||
} | |||
} | |||
|
|||
pub type ConstantName = String; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why these type aliases are needed. Perhaps you wanted newtypes for type safety...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just put type aliases so the HashMap is a bit easier to read meaning into. I did not really aim for strongly typed wrappers. I could make them newtypes if you think it's worth, I just preferred this over a comment :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! I think the String should be pretty self-explanatory, but I agree that a bare i64
can be a bit hard to make sense of.
I don't think they have to be newtypes. Maybe ConstantValue
can be an enum if you want, in case constants of other types get added in the future, but at this point it probably only adds complexity. I think it's fine either way.
Thanks for the feedback you two! Seems like it's basically good to go! I will add a fix for the #183 issue either in this PR or merge this and make that fix separately (I think that's better, makes this PR a bit more self-contained). So thanks again! 💙 |
This PR does multiple things:
3.1
(see the tag on thegodot_headers
repo).api.json
to the state of stable3.1
and fix wrapper generationI think from the 3.1 version on all items in the
api.json
file are actually sorted so that diffs are a lot cleaner and not 80000 lines of changes every time 😄The update in the
api.json
also contains a fix that makes most parameters be the actual object type (for exampleNode
) instead of falling back toObject
. This means that some code might break, but this was an error to begin with.Since this is a rather big change I would love to get some feedback from people, so if this change could be tested locally, that would be great!
cc @tom-leys, @toasteater