Open MSP-Greg opened 7 months ago
You are right. There is no way to detect WHEN the last model is closed in Mac OSX. You can sill call Sketchup.active_model
, and if it is nil
, then it means there is NO model open.
So, I support your request to have a more comprehensive set of observer methods to track models on Mac:
activate
callback of the model becoming active)Thanks. Just trying to provide users with a good UX. Using UI::Command#set_validation_proc
allows checking Sketchup.active_model
, but that still leaves open dialogs. One could add something in set_validation_proc
to disable dialogs.
But, all of the above has been a PITA for an existing plugin/extension that works fine on Windows.
Also, the UX on macOS seems very odd. SU's native toolbars are 'attached' to model windows, but plugin/extension toolbars are not.
None of these issues would exist in macOS SU if all SU UI objects (both native and plugin/extension) were hidden when no model was active...
Recently added an Apple iMac to my desk, mostly to investigate issues with UI::HtmlDialogs.
Just noticed that I can't see a way to determine if there isn't an active model on macOS. Or, there's no observer event/callback for it.
I've got plugin/extension that I wrote a long time ago (circa 2010), and it's a lot of code. Main purpose is export/import, with a few additional features that test and modify models. At the time, the external apps it worked with were Windows only.
Now, as with a lot of apps, everything is cross-platform (macOS & Windows). Recently, the plugin was resurrected, and I'm updating it for a client (new export format). One issue is macOS compatibility.
So, I'm not familiar with all the code. When there is no model open, something is disabling all the menu items. But, the toolbar buttons are still active.
Maybe
AppObserver#onActivateModel
could be called withnil
, since that is the value ofSketchup.active_model
when there are no open models? Or, a new event/callback could be added?Since I'm somewhat new to SU on macOS, I might be missing something...