For many years I’ve thought that a community (and possibly Trimble) supported framework for dialogs would be very helpful.
Three main reasons come to mind. First, (and not based on any hard data), I think about all the duplicated code that exists when people have multiple plugins loaded. Secondly, I’m sure many plugin authors, although intelligent people, are not familiar with the OOP concepts that a good, full featured framework could be based on. Third, using dialogs requires javascript, so one must be fluent in two languages. I’ve programmed for a long time, and I still get tripped up when moving between languages…
So, the framwork would contain ruby, javascript, and css files, and a few sample (or tutorial) html dialog files that could be used as starting templates for plugin authors.
Background
Over the years, I’ve done quite a bit of html/js, including multi-column grids/tables with embedded radio, checkbox and text controls. I didn’t keep track, but I believe I rewrote almost all of the js used on File: SketchUp Ruby API — SketchUp Ruby API main, along with removing JQuery. So, at the minimum, I’m familiar with js. Also, years ago I started on a very involved SU dialog framework, and somewhat recently I wrote a simpler one.
When SU 8 was the current version, I started on some code for my own use, with one export dialog box. Two commercial companies then added it to their software. I think the final version had eight dialogs, two of which mimicked the SU layers & materials panes. Features like font-size, hide/show additional controls, added metadata, etc. Some dialogs were modal, others non-modal.
I mention this because I made more than a few revisions that dealt with creating more shared code (and removing duplicated code) from all my dialog code.
Initial Main Goals
- Wrap most the communication between a plugin and dialog boxes with an API.
Contrived example of SU → Dialog communication
MyDialog.checkboxes[:Transparent].checked = false
MyDialog.radios[:ColorBy].selected = :Layer
MyDialog.update # performs execute script
- Have code to make it easier to deal with:
- MacOS vs Windows
- WebDialog vs HTMLDialog
- Changes between versions of SU (limit to?)
Long Term:
Other items that might be added to the framework could be handling of app settings, observers, etc.
Re observers, I recall creating a class for RenderingOptionsObserver that allowed registering callbacks based on a subset of options. If something like this was available, the framework could have one RenderingOptionsObserver, and call multiple plugins only when an option they were concerned about changed.
Any code that is likely to be duplicated across plugins could be considered for inclusion in the framework.
Misc
There are many js frameworks available, with many purposes. In a plugin, we are creating pc application windows, not web pages viewable on multiple devices. We also are not connnecting to a web server. Hence, I do not see a need to include a traditional js framework in a SketchUp framework.
Elephant in the room. I’m sure everyone would appreciate Dan and Thomas’s participation, but I’m not sure if they can help with something designed to work with as many versions of SketchUp as possible.
At present, I’m a windows only coder. I would need help with MacOS.
Anyone interested in helping?