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

Generating setters for indexed properties, like SpatialMaterial::albedo_texture #689

Closed
ghost opened this issue Feb 4, 2021 · 0 comments · Fixed by #970
Closed

Generating setters for indexed properties, like SpatialMaterial::albedo_texture #689

ghost opened this issue Feb 4, 2021 · 0 comments · Fixed by #970
Labels
c: bindings Component: GDNative bindings (mod api) feature Adds functionality to the library
Milestone

Comments

@ghost
Copy link

ghost commented Feb 4, 2021

As Rust has no language-level notion of properties, the properties list is currently simply ignored, with the assumption that each property would have a corresponding set_ method in the API. However, the Godot API also contains "indexed" properties that wrap around other methods:

{
	"name": "albedo_texture",
	"type": "Texture",
	"getter": "get_texture",
	"setter": "set_texture",
	"index": 0
},

While such properties are still possible to access, using the indexed methods directly, they do not currently have convenience getter/setters, which can be confusing to users: see #688. As a result, we might want to find those properties and generate additional methods for them.

@ghost ghost added feature Adds functionality to the library c: bindings Component: GDNative bindings (mod api) labels Feb 4, 2021
Bromeon added a commit to Bromeon/godot-rust that referenced this issue Sep 26, 2021
The heuristics to translate Godot's documentation to Rustdoc are not perfect, and some features like "indexed properties" (godot-rust#689) are not yet implemented.
Thus avoids noise when running 'cargo doc'.
@Bromeon Bromeon added this to the v0.10.1 milestone Nov 1, 2021
@Bromeon Bromeon modified the milestones: v0.10.1, v0.10.2 Jul 16, 2022
@Bromeon Bromeon modified the milestones: v0.10.2, v0.11.x Oct 1, 2022
chitoyuu added a commit to chitoyuu/godot-rust that referenced this issue Oct 31, 2022
Getters and setters are now generated for indexed properties that are
naturally accessible in GDScript (i.e. do not have '/' in the name),
like `SpatialMaterial::albedo_texture`. Doc generation for the
underlying accessors has also been improved.

Close godot-rust#689
chitoyuu added a commit to chitoyuu/godot-rust that referenced this issue Oct 31, 2022
Getters and setters are now generated for indexed properties that are
naturally accessible in GDScript (i.e. do not have '/' in the name),
like `SpatialMaterial::albedo_texture`. Doc generation for the
underlying accessors has also been improved.

Close godot-rust#689
bors bot added a commit that referenced this issue Oct 31, 2022
970: Generate accessor methods for indexed properties r=Bromeon a=chitoyuu

Getters and setters are now generated for indexed properties that are naturally accessible in GDScript (i.e. do not have '/' in the name), like `SpatialMaterial::albedo_texture`. Doc generation for the underlying accessors has also been improved.

Close #689

Co-authored-by: Chitose Yuuzaki <chitoyuu@potatoes.gay>
@bors bors bot closed this as completed in 7102813 Oct 31, 2022
@chitoyuu chitoyuu modified the milestones: v0.11.x, v0.11.1 Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bindings Component: GDNative bindings (mod api) feature Adds functionality to the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants