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

Rename properties unnecessarily using slash (/) in their names and cleanup Joint3D angular limit bindings #64719

Merged
merged 2 commits into from
Aug 23, 2022

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Aug 22, 2022

This is a legacy of Godot 2 days before the inspector had support for groups.
"Properties" with a slash in their name can't be accessed from script unless
using set()/get() so they were not actual properties as far as script
languages are concerned.


Joint3D: Remove utility method bindings for angular limits

The inspector now supports converting degrees to radians automatically when
using the radians hint, so all those utility bindings were redundant.

This cleans things up by making these properties with slash properly bound
to set_param/get_param which the users can call with the relevant enum.


@akien-mga akien-mga added this to the 4.0 milestone Aug 22, 2022
@akien-mga akien-mga requested review from a team as code owners August 22, 2022 09:34
@akien-mga akien-mga force-pushed the property-slasher branch 2 times, most recently from 7303b7a to 63c62f0 Compare August 22, 2022 10:02
@akien-mga akien-mga requested a review from a team as a code owner August 22, 2022 10:02
@YuriSizov
Copy link
Contributor

There's been a PR that does some more renames like that (#64553), but it doesn't seem these two have conflicts.

@@ -179,6 +173,12 @@
<member name="moving_platform_wall_layers" type="int" setter="set_moving_platform_wall_layers" getter="get_moving_platform_wall_layers" default="0">
Collision layers that will be included for detecting wall bodies that will act as moving platforms to be followed by the [CharacterBody2D]. By default, all wall bodies are ignored.
</member>
<member name="safe_margin" type="float" setter="set_safe_margin" getter="get_safe_margin" default="0.08">
Copy link
Member

@Calinou Calinou Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be named collision_safe_margin instead? I don't have a strong opinion on it, but it may be less confusing. Same for CharacterBody3D.

Copy link
Member Author

@akien-mga akien-mga Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered too, but since the setter was set_safe_margin, and that's the only direct way this could be used until now, I opted for that one. If we prefer to use collision_safe_margin, then the setter and getter should be renamed too. I'm fine with either - since it's a physics body I think it's implicit that a margin refers to collision with other bodies, but we can make it explicit too.

We can also add back a Collision group for this property, with or without prefix, to get back the ordering of before this PR. But it didn't seem particularly useful to me.

CC @godotengine/physics

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the "collision_safe_margin" (maybe biased with habit) seems a bit long, however, it is a parameter that rarely needs to be changed, being in a Collision group a bit apart seems relevant to me, so we can rename it for me (in his group).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you'd suggest renaming to collision_safe_margin and adding a "Collision" group? (And then also rename the setter/getter to set/get_collision_safe_margin)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with an intermediate approach to keep the short safe_margin name (internally it's even just margin, and safe_margin is used as parameter name in move_and_slide), and just moved it back to the end in a prefix-less "Collision" group.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't entirely convinced tbh, this morning I thought of collision_margin (safe is a bit useless), your solution avoid a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And btw, there are some pretty long names currently in the properties, in the "floor" or "moving_platform" group, if you have an opinion/suggestion (or reduz) on that.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, aside of the concern about the safe_margin naming.

This is a legacy of Godot 2 days before the inspector had support for groups.
"Properties" with a slash in their name can't be accessed from script unless
using `set()`/`get()` so they were not actual properties as far as script
languages are concerned.

Part of godotengine#17558.
The inspector now supports converting degrees to radians automatically when
using the `radians` hint, so all those utility bindings were redundant.

This cleans things up by making these properties with slash properly bound
to `set_param`/`get_param` which the users can call with the relevant enum.
@akien-mga akien-mga merged commit be5c1e2 into godotengine:master Aug 23, 2022
@akien-mga akien-mga deleted the property-slasher branch August 23, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants