-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add error checks for bad configuration in PathFollow2D/3D
set_progress_ratio
#94886
Conversation
This introduces errors where none were before, this is not necessarily appropriate, also makes the code significantly different from the 3D case |
Thanks for this feedback. About
Yes, correct. And it turns out that's the point. Some context (that I could have shared earlier, sorry for that): I had code like this
and it took me dozens of minutes to understand why the value printed was About
thanks for drawing my attention on it. It indeed would make sense to have in the 3D case as well. --
or do you feel it's a change that you would not want merged anyway? |
I think this might be better to document instead, but I'm fine with either way, but:
|
Thanks for that answer. Just to make sure I understand correctly: when you say that it should be documented, do you mean that I should do a PR on the documentation repo in order to make it clear on the doc of the |
No it should be here, documentation is generated from |
Thanks for this pointer. I should be able to take the time to do this change today or tomorrow 👍 |
I just updated that pull request accordingly, with both the changes in the code (fixes for Don't hesitate to let me know if there are other things you'd rather I change. |
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.
I wonder if get_progress_ratio()
should also have similar error. Technically this will fail silently too:
myPathFollow2D.progress = 100
print(myPathFollow2D.progress_ratio) # 0
yes, correct: it has the same behavior. That's why the doc updated by this commit also mentions the getter. I did not add the That being said, if you believe it would be better to emit those error messages in the getter too, I can amend this PR. |
Hi there, I understand that you are all pretty busy with other stuff (like summer holidays, or shipping godot 4.3 (thanks btw), or anything else), so it's cool that this PR is on hold. |
PathFollow2D.set_progress_ratio
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.
Makes sense to me.
I force pushed an amend of the commit to make it match the PR title, which is more informative.
PathFollow2D.set_progress_ratio
PathFollow2D/3D
set_progress_ratio
…ress_ratio` When a PathFollow is badly configured it's possible to have code that call get_progress_ratio just after set_progress_ratio does not return the value just set, which may be confusing for developer (ie that myPathFollow2D.set_progress_ratio(0.5) myPathFollow2D.get_progress_ratio() does not return 0.5) This commit makes ensures the developer has useful error messages in such case, to make it easier to troubleshot it.
Thanks! And congrats for your first merged Godot contribution 🎉 |
When a
PathFollow2D
is badly configured it's possible to have code that a call toget_progress_ratio
just after aset_progress_ratio
, does not return the value just set, which may be confusing for developer (ie thatdoes not return
0.5
)This commit makes sure the developer has a useful error messages in such case, to make it easier to troubleshoot it.