-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Extend Curve to allow for domains outside of [0, 1]. #67857
Conversation
Compilation is failing due to compiler not knowing whether to use lerp(floats) or lerp(doubles) when I think it also speaks as to whether we should make a decision to use real_t, float or double for these values. Or maybe just not use lerp at all? |
879be3c
to
364a301
Compare
Fixed all the issues that were showing up in the checks! I'd love to work on some UI/UX work on the editor itself next , but that only makes sense once this PR is mostly settled :) Looking at godotengine/godot-proposals#5579 and godotengine/godot-proposals#3267, for example! So LMK if there's any issues or feedback <3 |
364a301
to
c0543b1
Compare
c0543b1
to
a3cc2c4
Compare
Converted to draft since I'm fairly certain this isn't the best way to do it. Will work on it once 4.0 is released! |
Is this superseded by #74959? |
It is not! :) It still very much is something I want to do, but I believe I have a better approach and I will work on reimplementing it as time allows. Might be a while still. |
d380715
to
336f71a
Compare
Finally fixed and reopened this PR! I updated the original post with information. Couple of changes:
Most of the lines of code are documentation and tests. The changes themselves are relatively small, especially once you remove the other two cherry-picked commits. I have I believe CI is passing, I just seem to have a perpetual single build type that fails? |
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 code that exists LGTM, however, additional changes are needed to make domains play nicely with existing functionality.
The hidden Alt functionality still considers that 0 and 1 are the edges, and so if you use it on a leftmost or rightmost point, it will be forced into that part of the domain.
Snapping doesn't work properly, because it still snaps on the x-axis based on 1.0/snap_divisions.x
. When you fix this, remember that you need to do it in two places, once for the dragging logic, and once for the adding a point logic.
Shift for snapping to an axis will also draw the horizontal line only from 0 to 1.
Thanks for the reviews! Excited to see where extended curves may be used elsewhere in the engine :) Let me know if you want me to squash the 3 commits (which include the two other ancillary PRs). |
We prefer squashed commits. For future prs, if you want to separate them, use different pull requests. |
They are different pull requests already though. |
It was mostly to separate discussion & ease of reviewing. It sounds like reviewers are OK with them, so I'll go ahead and squash, especially since some of the latest changes are in the latest commit but really should've applied to other PRs. |
0a221e3
to
3e6dac3
Compare
Looks like I messed up the commits, as usual. Will try fixing soon 🤦 -- edit -- Done! |
3e6dac3
to
b9143ed
Compare
b9143ed
to
6c65213
Compare
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.
Tested locally, it works as expected. Code looks good to me.
One potential UX concern is that the concept of unit curve isn't enforced in the inspector, so many nodes will expose the domain properties within the Curve resources even though they shouldn't. This adds visual noise to the inspector, but also room for accidental edits.
The best way to resolve this would be to add a new property hint similar to PROPERTY_HINT_COLOR_NO_ALPHA
, except that PROPERTY_HINT_RESOURCE_TYPE
is already used here to specify Curve as a valid resource type.
Nonetheless, I'll still approve this PR considering it improves Curve's usability for game design use cases, particularly for users who are not writing the scripts that handle the curves in question.
Testing project: test_pr_67857.zip
Thank you for the review! I only found unsatisfactory solutions to that problem, unfortunately, though I agree it exists. We could make this into an Having The other solution, which is perhaps most viable, is to add a "unit" toggle for curves, which enables domain properties. Every place that uses curves would still need to check & enforce that it is using unit curves though, so it only solves the problem partially. |
So a correct inheritance hierarchy would be (naming aside):
The shared functionality would be in If I don't think this discussion warrants holding up the PR further, though. Just wanted to write it down for posterity. |
Oh, excellent point, hadn't thought of it at all, thanks for bringing it up. I think it's worth taking time to do well though, because otherwise restructuring to something sensible probably only happens for Godot 5. So the question is whether it's worth refactoring things in the way you describe. We could keep a unit curve named But it also feels annoying to have things named |
Mistakenly closed because toddler shenanigans 😅 |
Only tangentially related, but this falls into the idea I've been concocting for a really long time, involving turning |
Thanks! And congrats for |
Oh my goodness! This legitimately feels so nice :) Very excited to see all the regressions from arbitrary curves making their sneaky way around Godot, hehehe 🤣 |
This PR allows users to make curves in whatever app/game-specific domain they wish 📈 Previously, curves were restricted to a domain of [0,1]. Implements proposal, closes #5607.
Depends on #78931 and #77622, whose commits have been cherry-picked in this PR. Can rebase/remove those commits when/if they get merged. I can also squash them into this PR if preferred. Let me know 🥰
Recording.2023-07-06.141220.mp4
Things accounted for