RE: Lua - prompt and wait for selection?
2021-09-25, 18:58 (This post was last modified: 2021-09-25, 19:00 by Roland Melkert.)
2021-09-25, 18:58 (This post was last modified: 2021-09-25, 19:00 by Roland Melkert.)
(2021-09-25, 4:23)David Manley Wrote: Is there a "proper" way to achieve what I'm wanting to do (i.e. wait until a part is selected) using the LDCad Lua scripting?
Interesting use case.
At the moment any callback function will block the main gui until it returns (hence the maximum execution time protection).
Only exception are the ldc.dialog calls which will reset the script execution timing.
This also means writing an infinite loop with a message box will lock the program , an issue which will be solved in Alpha 2 though.
A proper way of doing what you want would need a way to setup a callback on selection events.
Alpha 2 has an ldc.event object, which is used to capture mouse and keyboard events for use during the new interactive animation mode, but what you are describing here would need such callbacks during normal editing.
An interesting thing to do though, so I might add something for it.
In the meantime you could solve this by using multiple macros like eg "start", "proceed", "done", "cancel" which the user could use to go trough the stages of the intended process.
If you, or anyone else, has some additional ideas on api extensions please let me know.