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 translate(d) to translate(d)_local in Transform 2D/3D #57698

Conversation

bluenote10
Copy link
Contributor

@bluenote10 bluenote10 commented Feb 6, 2022

This is an accompanying PR for #55923 / godotengine/godot-proposals#1336.

It isolates the renaming for translated to translated_local (and in-place versions) without re-adding the same function with the new global semantics in the same PR to ensure that we have refactored 100% of occurrences if CI passes. This PR does nothing else.

If we want to move forwards with #55923 the idea would be to merge this PR first, and then I'll rebase the other PR, which adds all remaining variants of translated/scaled/rotated. This will simplify the other diff and should make its review more convenient.

@bluenote10 bluenote10 requested review from a team as code owners February 6, 2022 10:57
@Calinou Calinou added this to the 4.0 milestone Feb 6, 2022
@bluenote10 bluenote10 force-pushed the feature/rename_translated_to_translated_local branch from 3da9f9e to f2256f4 Compare February 6, 2022 12:38
@bluenote10 bluenote10 requested a review from a team as a code owner February 6, 2022 12:38
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

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

@bluenote10 bluenote10 force-pushed the feature/rename_translated_to_translated_local branch from f2256f4 to 674c2fb Compare February 9, 2022 19:37
@bluenote10 bluenote10 requested a review from a team as a code owner February 9, 2022 19:37
@bluenote10
Copy link
Contributor Author

Looks good except we should also do the same change in C#.

Thanks, good catch, adapted now as well. Was this missed by a CI check or is the API consistency towards C# only verified manually in general?

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

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

@bluenote10 Only manually, we don't have any checks for this. At some point we should add test cases to C# which we can start by copying the ones from C++ (which would help verify equivalent behavior), but this is not a priority right now.

This PR looks good to me. Even without the rest of the discussed changes, this change makes sense on its own, so I think this is good, and then the rest of the changes can be in follow-up PRs.

@bluenote10
Copy link
Contributor Author

@BastiaanOlij Hello Bastiaan, is there anything I can do to move forward with this PR and #55923? If it would e.g. help to have a call in person to walk you through the plan behind godotengine/godot-proposals#1336 I could surely arrange that.

@BastiaanOlij
Copy link
Contributor

Hey @bluenote10,

Sorry for not noticing this until now, also very interested in knowing about your Guitar VR project so if you have a link to what you're working on, I'd love to check it out.

On topic, we had a big discussion some months ago about which way around things should be and what default behavior we expect. I can't fully remember what the outcome was there but it came down that the current approach was mostly correct.

The problem being that there is a big disjoint between what is expected behavior for the different functions and that the need for their functional behavior is more important than consistency in behavior.

I can't remember what the outcome of the naming there was, whether we agreed that it would be assume that transform was local, and global_transform global, I vaguely remember we did want to replace the global name because that name can be misleading and rotation and scaling on global_transform is still a locally applied (and should be).

So I'm not sure what the best forum is for getting consensus on the naming and whether we actually want to change anything here.

@aaronfranke
Copy link
Member

aaronfranke commented Apr 7, 2022

@BastiaanOlij We had a discussion about this about a month ago. It was discussed that having both versions makes sense. I remember specifically that we brought up if there should be _global suffixes, but this was rejected because using the word global for parent-relative things was confusing, so it was decided that the self-relative versions should be named local and the parent-relative versions should have no suffix. Reduz commented on #55923 that it looks good as-is. However, there were some concerns in the discussion about mid-air conflicts with other PRs since it renames an existing method and adds a new one with the old name. This PR is a subset of the other one that only has the method rename to try and avoid mid-air conflicts.

See the discussions in #55923 and godotengine/godot-proposals#1336 for more information.

Also, these renames have nothing to do with transform or global_transform. This is about translate.

@bluenote10
Copy link
Contributor Author

the need for their functional behavior is more important than consistency in behavior.

I think everyone involved in the discussion on various GitHub threads was agreeing that the current inconsistency with mixing local and global operations is a design flaw that should be fixed before 4.0. The main question then became how to resolve the inconsistency: Either by breaking the behavior of the two functions (scaled and rotated) or the behavior of only translated. What I'm suggesting is mainly motivated by pragmatism: Breaking just 1 function is better than breaking 2 functions, and going down that path even fits better to the existing code in Basis, which already has _local variants anyway. Going down the other path would be a much bigger breaking change.

@bluenote10 bluenote10 force-pushed the feature/rename_translated_to_translated_local branch from 7ac5c41 to 4f7c512 Compare April 7, 2022 17:54
@YuriSizov
Copy link
Contributor

Mentioned in the PR review meeting, decided that @reduz would take a look separately.

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

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

This still looks good to me. It needs a rebase when you can.

@aaronfranke aaronfranke requested a review from reduz July 12, 2022 13:20
@bluenote10 bluenote10 requested a review from a team as a code owner July 16, 2022 09:29
@YuriSizov YuriSizov removed request for a team July 16, 2022 09:54
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Checked against current master and I don't see new translate() / translated() calls added since the last rebase, so should be good to go.

@akien-mga akien-mga merged commit 199ea34 into godotengine:master Jul 28, 2022
@akien-mga
Copy link
Member

Thanks!

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.

7 participants