You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Godot notification function is a special case in the Object API. At first glance it looks like a regular virtual function but behind the hood it's using some macro black magic to call all the _notification implementations in the class hierarchy.
It also have the option to make calls in reverse order (so from children's notifications to parent's notifications).
Previously, Scripts and Extensions were not part of the ordering but it changed in a recent PR (from an issue I posted myself :p): godotengine/godot#78634
In that PR, the "reversed" parameter is added to the notification method for scripts and extensions. The expected behaviour is the same as native Godot classes, the hierarchy of scripts' _notification should be called in the correct order. We are not supposed to rely on the user making a super call everytime the previous notification is overridden.
We have to investigate if the current KotlinScript structure allows for that as we need to be able to access the parent script notification method as well.
If I remember correctly, we do things differently from the rest of Godot. We simply store all methods a script has, even the ones inherited from the parents if not overridden. Godot doesn't make any "copies" and relies on recursive calls to parents for everything, nut just notifications.
The text was updated successfully, but these errors were encountered:
CedNaru
changed the title
add notification ordering to Kotlin scripts.
Add notification ordering to Kotlin scripts.
Sep 15, 2023
Godot
notification
function is a special case in the Object API. At first glance it looks like a regular virtual function but behind the hood it's using some macro black magic to call all the_notification
implementations in the class hierarchy.It also have the option to make calls in reverse order (so from children's notifications to parent's notifications).
Previously, Scripts and Extensions were not part of the ordering but it changed in a recent PR (from an issue I posted myself :p):
godotengine/godot#78634
In that PR, the
"reversed"
parameter is added to thenotification
method for scripts and extensions. The expected behaviour is the same as native Godot classes, the hierarchy of scripts'_notification
should be called in the correct order. We are not supposed to rely on the user making a super call everytime the previous notification is overridden.We have to investigate if the current KotlinScript structure allows for that as we need to be able to access the parent script notification method as well.
If I remember correctly, we do things differently from the rest of Godot. We simply store all methods a script has, even the ones inherited from the parents if not overridden. Godot doesn't make any "copies" and relies on recursive calls to parents for everything, nut just notifications.
The text was updated successfully, but these errors were encountered: