-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Fix Curve min/max limits being bypassed on first assignment. #88224
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
Fix Curve min/max limits being bypassed on first assignment. #88224
Conversation
27eb5f9 to
0a708bc
Compare
|
@ttencate I believe this is similar to what you suggested here and in RocketChat. Pulling the post-load hook into I do think maintainers might not be excited at how not-local this solution is, but we'll see! Perhaps other folks that have run into this problem will come out of the woodwork and say they wish there was something like this for more resources than just |
|
Thanks for taking the time you said you didn't have! Needless to say, I like this better 🙂 Could it be a notification instead of a virtual function? That's slightly less intrusive perhaps. Consider exposing the notification constant to GDScript as well. But... how is |
Managed to push through the depression for a little bit, it felt nice to work on code again :)
During the discussion in RocketChat, some maintainers said that notifications/signals are much heavier weight, and should be avoided unless there are very strong arguments for having them. I'm not sure we have those strong arguments. The issue is present in GDScript Nodes, but this approach can be used there as well if/when necessary as follows: var loading = true
@export var max_var : int:
set(value):
if value > min_var or loading:
max_var = value
@export var min_var : int:
set(value):
if value < max_var or loading:
min_var = value
func _ready():
loading = falseNot entirely sure we can fix it with Resources since they don't have a
This is a good point. Right now, the variable is initialized to So we need to find a way to have that pre-load hook after all! |
f1a512a to
5fa3a9a
Compare
5fa3a9a to
add0827
Compare
|
Set this as draft, as it's currently in proof-of-concept stage, but does seem to work. Would love some input from the team on whether this feels like a good direction to go in. Here's the updates:
Would still need call the hooks in Having GDScript support for this would also make sense, but we can dig into that if we feel this is the way to go. |
|
What's the reason for having this intermediate The drawback of an intermediate subclass is that classes further down the inheritance chain can't opt in to receiving load hooks if their parents don't. (Unless we use multiple inheritance, but I'm not sure the engine supports it, and it's a can of worms we'd rather not open.) For example, if |
|
Honestly, I'm pretty unhappy with every solution we've come up with. None of them feel good. I'm almost back to just thinking having dummy properties is the way to go, despite it being a hacky work-around😭 I'd really like to avoid @akien-mga mentioned that |
|
Or maybe we go back to thinking about property hints or something and find a way to bypass regular setters there... |
|
Closed as it is an unsatisfactory solution. |
This is an alternative PR to #78931 - see that PR for problem description. It does add a step to resource loading in general, but in doing so provides a simple hook for post-loading logic to be executed in any resource.
This enables
Curve- or any other resource with mutually dependent variables - to have a simple_is_loadingvariable, which toggles whether setters enforce dependencies/restrictions (no during loading, yes otherwise). This means we don't need workaround "fake" properties like in #78931, which increase code complexity & number of properties.