Hi,
I know about callbacks and I know they are heavily used in a lot of frameworks. As Java RCP-Developer Iām more used to listeners rather than callbacks. Both systems are quite nice and encapsulate āuser logicā from the core processing.
I wondered about the statement āConsistent with BGE API (e.g., render callbacks)ā. As far as I see render callbacks belong to Blender not to the BGE respectivly the BGE logic.
Currently I canāt see callbacks somewhere at the current BGE logic. That was the reason why I asked where to find them.
Because of that I think you need to add a complete new concept on top of or beside the existing event systems (SCA). Iām worried that this is a bit out of scope of the topic āThreaded Loadingā. I fully understand your question what we would like to get.
Somehow I have the impression some people see callbacks as the āmagical super weaponā against logic bricks (which seems to be not that super ;)).
One of the problem I see with callbacks is, they do not have the usual context of the BGE Python code. E.g. current controller, current object, current scene. The context would be essential as the user would try to get the information from the callback into the BGE logic.
It is also a timing issue.
When is a callback called? (At sensors evaluation? At controller execution? At actuator running? What is the order? )
With multiple scenes running the scenes are processed one after the other. When does the callback trigger? (I guess loading belongs to a specific scene).
This is important as the user usually needs to know when the code is executed (before or after other logic).
Callbacks completely bypass the SCA (as they do not fit into the SCA event-system). This means they will not be available for non-programmers.
The progress bar feature is mainly asked by noobs (I guess because advanced BGE users know it is currently not possible). Beginners are usually not really hot to add code (if they even know what a callback is).
Anyway, if moguri can add both then Iām happy about it.
In near future a developer should be able to wrap your future object with an LoadingActuator. The benefits are:
- easy to use GUI (useful for beginners and experts)
- perfectly fitting into the SCA-scheme
- user defined activation
- auto-deactivation after loading -> which means you can use an actuator sensor
- (optional) similar to the ActionActuator it can write the estimated percentage into a property -> Progressbar!
- as usually the actuator can still be configured and activated via Python controller.
- Python purists still do not need to use them as it is a wrapper.
Disadvantages:
- someone has to implement is
I do not think we need this as logic block right now, but we should keep this in mind and in the design.
Iām not sure if the ActionActuator is even possible with a callback.
Thanks for reading
Monster