Show a UI popup or anything alike with a message

Depends on where your code is running:
  • if you are adding code to a customized version of OBS, or writing a plugin, then sure: use QMessageBox or do anything else you like
  • if you are writing a script in Lua or Python for OBS, then I believe your UI is limited to what is allowed on the "Tools", "Scripts" dialog
  • if your code is running in a browser source or browser dock, then you can show whatever you want within the context of the source or dock. For example, I wrote a browser dock to let me select or edit presets for a PTZ camera. A "save/load" button reconfigures the UI to show what looks like a modal dialog with controls for saving or loading presets to a file. The dock interacts with the camera via VISCA, and with OBS using Websocket.
 

Destroy666

Member
The trick here is to use undocumented
Code:
obs_queue_task(OBS_TASK_UI, yourFunctionShowingPopup, ...)
to ensure the function runs with next UI thread - credits to Warmuptill who already utilized it in Advanced Scene Switcher.
 

halioris

New Member
The trick here is to use undocumented
Code:
obs_queue_task(OBS_TASK_UI, yourFunctionShowingPopup, ...)
to ensure the function runs with next UI thread - credits to Warmuptill who already utilized it in Advanced Scene Switcher.
when you say Warmuptill already implemented in Advanced Scene Switcher can you elaborate? I am using AdvSS just for its websocket trigger and sending a custom message from outside to it and then having AdvSS get the message and dump the message in a text source and fire a hotkey that calls my Lua script so I can act on it. What I'd like to do now is throw up a dialog box if any error occurs in those scripts. I'm assuming the code above can only be used in C++ or can I use it from Lua to popup a dialog. If only in C++, did Warmuptill put something in AdvSS that I could use as an action to popup a dialog? I did not see any kind of dialog popop action. Any other idea would be appreciated as well (I thought about writing a file with the error as an html file then opening that in interact mode but that seems really hacky).
 

Destroy666

Member
when you say Warmuptill already implemented in Advanced Scene Switcher can you elaborate? I am using AdvSS just for its websocket trigger and sending a custom message from outside to it and then having AdvSS get the message and dump the message in a text source and fire a hotkey that calls my Lua script so I can act on it. What I'd like to do now is throw up a dialog box if any error occurs in those scripts. I'm assuming the code above can only be used in C++ or can I use it from Lua to popup a dialog. If only in C++, did Warmuptill put something in AdvSS that I could use as an action to popup a dialog? I did not see any kind of dialog popop action. Any other idea would be appreciated as well (I thought about writing a file with the error as an html file then opening that in interact mode but that seems really hacky).

That is unrelated to the topic of development - for questions like this I recommend asking in AdvSS topic next time.

Anyways, I started working on widget action for AdvSS a while back (more or less when this question was asked), never got to finish it. https://github.com/WarmUpTill/SceneSwitcher/pull/899 And won't finish it anytime soon likely, as my IDE of choice started lagging hard with new version and C++ recently. So you'll have to wait or motivate me somehow :P
 
Top