Skip to content

Remove dependence on Qt#170

Open
macumber wants to merge 26 commits into
developfrom
remove_qt
Open

Remove dependence on Qt#170
macumber wants to merge 26 commits into
developfrom
remove_qt

Conversation

@macumber
Copy link
Copy Markdown
Collaborator

@macumber macumber commented Mar 15, 2026

Recreate the inspector dialog using SketchUp Html Dialog to remove the dependency of the SketchUp Plug-in on Qt

Fixes #167

Depends on openstudiocoalition/OpenStudioApplication#864

Testing

  • Compare with current inspector screens
  • Selecting object in inspector selects object in SketchUp
  • Selecting object in SketchUp selects object in inspector
  • Add object works for all allowable types
  • Copy object works for all allowable types
  • Remove object works for all allowable types
  • Purge object works for all allowable types
  • Surface other side coefficient setting works
  • SubSurface other side coefficient setting works
  • Changing object and saving updates in OSM
  • Changing OSM triggers reload, updates in inspector
  • Setting constructions works when rendering by construction
  • Setting thermal zone works when rendering by thermal zone
  • Placing luminaires creates definition
  • Inspector performance acceptable on large model
  • Progress bar works when opening large model
  • Progress bar works when running user script on large model
  • Test on Mac
  • Check units on all fields
  • Check changing IP<->SI works

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes Qt/C++ Modeleditor dependencies by replacing key components with pure-Ruby implementations and a new SketchUp UI::HtmlDialog-based Inspector UI.

Changes:

  • Replaced the Qt-backed path watcher with a pure-Ruby polling watcher using UI.start_timer.
  • Replaced the Qt-backed GitHub release checker with a pure-Ruby update checker using Sketchup::Http::Request.
  • Added a new HtmlDialog-based InspectorDialog (Ruby backend + HTML/Vue frontend) and wired it into menu/dialog management.

Reviewed changes

Copilot reviewed 12 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
plugin/openstudio/lib/watchers/PluginPathWatcher.rb Replaces Qt/C++ PathWatcher with Ruby polling watcher.
plugin/openstudio/lib/watchers/PluginModelWatcher.rb Switches to new OpenStudio::ensureSpaceLoadDefinition callsite.
plugin/openstudio/lib/interfaces/Luminaire.rb Switches to new OpenStudio::ensureSpaceLoadDefinition callsite.
plugin/openstudio/lib/dialogs/InspectorDialog/vendor/modus/jquery.js Adds vendored jQuery for the new inspector UI.
plugin/openstudio/lib/dialogs/InspectorDialog/vendor/modus/bootstrap.bundle.min.js Adds vendored Bootstrap bundle for the new inspector UI.
plugin/openstudio/lib/dialogs/InspectorDialog/reload.rb Adds dev-only reload helper for the new inspector dialog.
plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb New Ruby HtmlDialog backend for inspector + access policy parsing + CRUD.
plugin/openstudio/lib/dialogs/InspectorDialog/html/inspector_dialog.html New Vue-based inspector frontend and Ruby↔JS glue functions.
plugin/openstudio/lib/dialogs/InspectorDialog/copilot-instructions.md Adds dialog/porting guidance doc for contributors.
plugin/openstudio/lib/dialogs/InspectorDialog/SketchUpPluginPolicy.xml Adds XML access policy source consumed by the inspector.
plugin/openstudio/lib/UpdateManager.rb Replaces Qt HTTP release checker with Sketchup::Http::Request implementation.
plugin/openstudio/lib/PluginManager.rb Updates startup requires (now includes ModelEditor).
plugin/openstudio/lib/MenuManager.rb Swaps old inspector dialog integration to new HtmlDialog-based inspector.
plugin/openstudio/lib/DialogManager.rb Instantiates new inspector dialog and updates related method calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread plugin/openstudio/lib/DialogManager.rb Outdated
Comment thread plugin/openstudio/lib/DialogManager.rb
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/reload.rb Outdated
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb Outdated
Comment thread plugin/openstudio/lib/PluginManager.rb
@macumber
Copy link
Copy Markdown
Collaborator Author

@jmarrec I merged your ProgressBar in, I was getting bug splats in my first implementation but yours worked, I must have been forgetting a virtual method or something. This is nice, it will allow us to completely get rid of the openstudio_modeleditor.so file

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the SketchUp plugin’s dependency on Qt/Modeleditor UI components by porting key features (notably the Inspector) to SketchUp’s UI::HtmlDialog and replacing Qt-backed utilities with pure-Ruby/SketchUp API equivalents.

Changes:

  • Replaces the Qt-based Inspector dialog with a new Ruby + HTML/Vue UI::HtmlDialog implementation, including field access policy enforcement and model/watch integration.
  • Replaces Qt-backed utilities (PathWatcher, UpdateManager, ProgressBar, ensureSpaceLoadDefinition) with pure-Ruby implementations using SketchUp APIs.
  • Adds/updates policy parsing (XML) and introduces/extends tests around access policy behavior.

Reviewed changes

Copilot reviewed 18 out of 23 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
plugin/openstudio/test/AccessPolicyStore_Test.rb Adds Minitest coverage for AccessPolicyStore and field-name alignment with the OpenStudio IDD.
plugin/openstudio/lib/watchers/PluginPathWatcher.rb Replaces Qt/C++ PathWatcher with a polling watcher using UI.start_timer.
plugin/openstudio/lib/watchers/PluginModelWatcher.rb Switches ensureSpaceLoadDefinition call to the new pure-Ruby implementation.
plugin/openstudio/lib/interfaces/SelectionInterface.rb Minor cleanup (whitespace) in selection handling.
plugin/openstudio/lib/interfaces/ModelInterface.rb Hooks inspector dialog to a new on_model_attached lifecycle event.
plugin/openstudio/lib/interfaces/Luminaire.rb Switches ensureSpaceLoadDefinition call to the new pure-Ruby implementation.
plugin/openstudio/lib/dialogs/ProgressDialog.rb Replaces Qt progress bar wrapper with a pure-Ruby status-text-based progress display.
plugin/openstudio/lib/dialogs/InspectorDialog/vendor/modus/jquery.js Adds vendored jQuery used by the HtmlDialog UI.
plugin/openstudio/lib/dialogs/InspectorDialog/vendor/modus/bootstrap.bundle.min.js Adds vendored Bootstrap bundle used by the HtmlDialog UI.
plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb New HtmlDialog-backed Inspector implementation (Ruby backend + watchers + CRUD + unit conversion).
plugin/openstudio/lib/dialogs/InspectorDialog/html/inspector_dialog.html New Vue-based 3-panel Inspector UI (types/objects/fields).
plugin/openstudio/lib/dialogs/InspectorDialog/copilot-instructions.md Adds local development notes/instructions for porting/architecture.
plugin/openstudio/lib/dialogs/InspectorDialog/access_policy_store.rb New AccessPolicyStore implementation parsing SketchUpPluginPolicy.xml.
plugin/openstudio/lib/dialogs/InspectorDialog/SketchUpPluginPolicy.xml Adds the policy XML used to lock/hide fields by IDD type/field.
plugin/openstudio/lib/dialogs/InspectorDialog/.gitignore Ignores local porting/reference directories under InspectorDialog.
plugin/openstudio/lib/UpdateManager.rb Replaces Qt HTTP update checker with Sketchup::Http::Request + GitHub Releases API parsing.
plugin/openstudio/lib/PluginManager.rb Removes Qt application initialization/event pumping; adjusts require order (adds ModelEditor).
plugin/openstudio/lib/ModelEditor.rb Adds pure-Ruby OpenStudio.ensureSpaceLoadDefinition replacement.
plugin/openstudio/lib/MenuManager.rb Wires menu command to the new Inspector dialog and updated method names.
plugin/openstudio/lib/DialogManager.rb Swaps inspector dialog class, updates API calls, and forwards unit system changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/openstudio/test/AccessPolicyStore_Test.rb Outdated
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb Outdated
Comment thread plugin/openstudio/lib/dialogs/InspectorDialog/inspector_dialog.rb
Comment thread plugin/openstudio/lib/dialogs/ProgressDialog.rb
@macumber
Copy link
Copy Markdown
Collaborator Author

macumber commented Mar 29, 2026

Seeing this in a bugsplat on Mac, copilot diagnosed, environment variable is working when set before loading OpenStudio

The disassembly tells us everything. Look at __armv8_rng_probe:

__armv8_rng_probe:0000000002274704    mrs     x0, S3_3_C2_C4_0   ← RNDR instruction0000000002274708    mrs     x0, S3_3_C2_C4_1   ← RNDRRS instruction000000000227470c    ret
These mrs S3_3_C2_C4_x instructions ARE the ARMv8.5-A RNDR/RNDRRS hardware RNG instructions. They are executed directly — with no signal handler protection — during the probe call at 0x2274de0.

Why It Crashes on M1
Feature Your Mac (M1, Macmini9,1) Required
ARMv8 generation ARMv8.4 ARMv8.5
RNDR instruction ❌ Not supported ✅ Required
RNDRRS instruction ❌ Not supported ✅ Required
The library statically compiled OpenSSL 3.x inside libopenstudiolib.dylib (no separate libcrypto.dylib — confirmed by otool -L returning nothing for crypto). OpenSSL 3.x on arm64 probes for RNDR by executing it raw and expecting the OS signal handler to catch SIGILL. However, this OpenSSL build's _ill_handler (visible in the disassembly at 0x2274df8) is either not being installed, or is failing.

Verify the Signal Handler Bug

# Check if OPENSSL_cpuid_setup / ill_handler is called before the probeotool -tv /Applications/OpenStudioApplication-1.11.0/lib/libopenstudiolib.dylib | grep -B 5 "_ill_handler"# Check what calls armv8_rng_probe (the caller at 0x2274de0)otool -tv /Applications/OpenStudioApplication-1.11.0/lib/libopenstudiolib.dylib | grep -B 30 "2274de0"
Your Options
Option 1 — Workaround via environment variable (try first):

# OpenSSL 3.x respects this to disable ARMv8 capability probing OPENSSL_armcap=0 /Applications/OpenStudioApplication-1.11.0/OpenStudioApplication.app/Contents/MacOS/OpenStudioApplication

Option 2 — Wrap with a launcher script:

#!/bin/bashexport OPENSSL_armcap=0exec /Applications/OpenStudioApplication-1.11.0/OpenStudioApplication.app/Contents/MacOS/OpenStudioApplication "$@"

chmod +x ~/launch_openstudio.sh
Option 3 — Patch the binary (advanced): Patch __armv8_rng_probe to return immediately without executing RNDR:

# Back up firstcp /Applications/OpenStudioApplication-1.11.0/lib/libopenstudiolib.dylib \   /Applications/OpenStudioApplication-1.11.0/lib/libopenstudiolib.dylib.bak# The function at offset 0x2274704 should be patched to:# mov x0, xzr  (return 0 = not supported)# ret# nop# instead of executing RNDR/RNDRRS
Option 4 — Report & wait: File a bug with the OpenStudioApplication team — this is their bundled OpenSSL compiled with ARMv8.5 instructions on a build machine (M2/M3) without runtime CPU guards working correctly on M1.

@jmarrec
Copy link
Copy Markdown
Contributor

jmarrec commented Mar 30, 2026

Testing on macOS M1, arm64, Tahoe 26.4, at 3d125c5

The Progress bar never updates and never closes. f5e6697 is probably guilty.

image

@jmarrec
Copy link
Copy Markdown
Contributor

jmarrec commented Mar 30, 2026

Correction, if I keep it open, I see it update sometimes on the subsequent operation.

image

It seems to be unreliable.

@jmarrec
Copy link
Copy Markdown
Contributor

jmarrec commented Mar 30, 2026

Ok so after some investigation:

  • Most of our User Scripts (eg: "Clean Up Origins") never actually update the progress bar
  • https://ruby.sketchup.com/UI/HtmlDialog.html#hide-instance_method . UI::HtmlDialog#hide was added in Sketchup 2026.1 only. We should probably just use close.
  • I wonder whether the class shared_dialog is worth it at all. This seems like a premature optimization (the Progress bar is dead simple), with more complexity

@macumber
Copy link
Copy Markdown
Collaborator Author

macumber commented Apr 4, 2026

Thanks for cleaning up all the user scripts @jmarrec. shared_dialog was an attempt to avoid having to create a new window every time we make a dialog. I don't know that it is helping that much, the dialogs aren't as responsive as I was hoping (given that Chrome is running in another process), I don't know if there is a separate thread for sending the messages to Chrome from Ruby, I assume that sending the messages out is where the holdup is. The progress bar isn't great, but it is something (it is better than status_text) and I haven't seen it cause any issues.

@jmarrec
Copy link
Copy Markdown
Contributor

jmarrec commented Apr 7, 2026

I have a branch, https://github.com/openstudiocoalition/openstudio-sketchup-plugin/tree/tweak_progressdialog, where I tried a bunch of things. It's still not behaving exactly like I wanted and it's time consuming.

One thing to note is that I'm testing on SU 2024, where you don't have dialog.hide.

@macumber
Copy link
Copy Markdown
Collaborator Author

macumber commented Apr 8, 2026

I have a branch, https://github.com/openstudiocoalition/openstudio-sketchup-plugin/tree/tweak_progressdialog, where I tried a bunch of things. It's still not behaving exactly like I wanted and it's time consuming.

One thing to note is that I'm testing on SU 2024, where you don't have dialog.hide.

Yeah, the main point of the PR is replacing the inspector dialog and removing Qt. The progress bar is just kind of an annoying detail; I don't think it's worth sucking up too much time and attention. I've assumed that anyone with a license would update to the latest but I can test in SU 2025 as well.

@jmarrec
Copy link
Copy Markdown
Contributor

jmarrec commented Apr 8, 2026

Merge away if you're satisfied @macumber !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dependency on Qt

3 participants