migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.11k stars 75 forks source link

Surface _notification #2

Open migueldeicaza opened 1 year ago

migueldeicaza commented 1 year ago

Surface _notification, we are getting the event, they are just not being posted to the object yet.

Need to decide if we create a big "Notification" enum with all possible notifications, or if "Notification" should be narrowed to the type they are declared on, and whether it is an enum or a constant. In the former case, we can use an enum, in the latter case we would need to use constants, in case new subclasses introduce new notifications.

LemmaEOF commented 2 months ago

I think constants narrowed to type would be better because not all object types receive the same notifications. The only ones on base Object are POSTINITIALIZE and PREDELETE, then nodes and such add a bunch more. People might want to make their own custom notifications, too.

migueldeicaza commented 2 days ago

Update: we already surfaced all the constants in each type, so they are already there, we could reuse those to prototype at least.

I think that what needs to be done is to add a new virtual

open func notification(...)

Method in the generated Object, and then we would just call it from the notification callback in Wrapper.