According to the documentation I’ve found, .rui file registrations happen via HKCU, but the plugin I’m developing must (for reasons beyond my control) be installed per-machine. As far as I can tell, this means that my plugin installer can’t really automatically register the plugin’s toolbar; at best, it will register and unregister it only for the user who happened to run the installer, and everyone else will have to manually do it. Is there any way around this? I tried just putting the .rui registration key in HKLM, but unsurprisingly, it didn’t work. A crazy idea I had was to stick some logic in the plugin that would, on Rhino startup, search for the toolbar’s presence and register it if it’s missing, but I can’t find any events that fire early enough in the Rhino startup process for this to work, and it still doesn’t solve the uninstallation problem.
If you use RHI installer files for development, this should work.
Could you tell me where to find this documentation regarding RUI registration in the HKCU registry you mentioned? I haven’t been able to find this… I’m rolling my own installer that installs plug-ins in user space, so I need to register RUI files in HKCU.
I did find this http://wiki.mcneel.com/developer/scriptsamples/loadingtoolbars but it does not seem to concern installing plug-ins.
I was mistaken; it’s not documentation, it’s a forum post by Dave Fugier: http://v5.rhino3d.com/forum/topics/rui-question. It appears to be accurate.
I will do some testing regarding RHI files, but the reason that we’re not using them in the first place is that our IT folks have expressed dislike for them specifically because they only install things per-user.
RHIs should allow for installing for “All Users” now. I believe @rajaa recently added this feature in the latest service release of Rhino.
Here is how you can use the RHI installer for Rhino plugins.
You can install for current or all users and if you include your .rui file, then the toolbars should show on the list of toolbars (when run ToolbarLayout).
Will RHI files allow for the installation of files to specific directories on the target computer? Unfortunately, some auxiliary files for my plugin need to be installed to a specific directory at the root of the system drive. (I’m really unhappy about this, but there’s nothing I can do.) http://wiki.mcneel.com/developer/rhinoinstallerengine/authoring seems to indicate that I can’t choose the specific target location for the installation.
No. In that case you are going to need to write your own full fledged installer; sorry. I believe that if you place the rui file next to the plug-in and give it the same name it will auto-load in Rhino.
We used to distribute our plug-ins using RHI, but recently switched to an MSI-based installer. I have some experience with WiX for installing plug-ins. Drop me a line if you’re interested.
That’s too bad. I can’t get the toolbar to auto-load the way you described, either. I was thinking, though, if the Rhino Installer Engine is capable of installing toolbars per-system, shouldn’t I just be able to emulate whatever it’s doing to do that? Unfortunately, I can’t get a simple test .rhi file to auto-register an .rui file, either, both when installing for the current user or for all users. I’m following the directions at http://wiki.mcneel.com/developer/rhinoinstallerengine/authoring, but the toolbar (despite being copied into the correct location) isn’t even listed in the Toolbar Layout list, much less shown automatically the next time Rhino starts.
@JohnM, can you look into this and provide some help?
There is some code in Rhino to keep a plug-in associated RUI file from loading when Rhino starts if a user has previously closed the RUI file. This functionality is there to keep Rhino from loading a file the user previously closed. If you close your plug-in associated RUI file then run your test to see if it will auto open it will not unless you delete the HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\5.0x64\Scheme: Default\Window Positions\Docking Toolbars\ClosedRuiFileList" registry key prior to starting rihino.
When a plug-in is successfully loaded Rhino gets the full path to the RHP file and replaces RHP with RUI and attempts to load the RUI file (as long as it is not in the CloseRuiFileList), if the file does not exist Rhino will look in the parent folder and attempt to load the file from there if it exists (as long as it is not in the CloseRuiFileList).
Thanks so much, that did the trick!
I’m bumping this three-month-old thread because of something new I’ve discovered that I need to work around. My .rui file is auto-loading correctly, but I guess Rhino stashes a copy of it in %APPDATA%\McNeel\Rhinoceros\5.0\Plug-ins\[plugin folder]. This, of course, makes sense, since each user should be able to configure their interface however they want without interfering with other users on the same machine. The problem occurs when I want to update my toolbar - even if the installed .rui file changes, Rhino will happily load the old one, and I can’t purge it with the .msi (either on install or on uninstall), because per-machine installers (which I have to use) can’t see per-user locations like %APPDATA%.
My only faint hope here is that somehow I can tell Rhino to delete the associated .rui file when the plugin is uninstalled (and hopefully this carries over to MSI upgrades). Rhino can obviously tell that the .rui is associated with the plugin (because it’s hidden when the plugin isn’t there), so I’m wondering if there’s a way to get it to delete the .rui file (or at least never load it again) rather than just suppressing it until my plugin returns.
edit: I have located a registry key for my plugin associated with the stored copy of the .rui file that I can use to delete it, so my problem appears to be solved.
@JohnM I do not see this key when closing my toolbar down: HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\5.0x64\Scheme: Default\Window Positions\Docking Toolbars\ClosedRuiFileList
HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\5.0x64\Scheme: Default\Window Positions\Docking Toolbars\Rui files
Is there a reason I would not see the regkey ?