Plugin with Toolbar - Rhino installer package issues

rhino

#1

Hello,

I’ve produced a rhino installer (RHI) file that installs a plug-in. I have also included a custom tool bar in the installer.

The installer seems to work correctly however the installer does not make the tool bar available to the user - for instance, the tool bar does not appear as a tool bar, nor is it available for being made visible in the normal “show toolbar” method.

The RHI package is structured this way, per the instructions listed [ here ]:

NamePlugin
.Rhino 5.0
…x86
…NamePlugin.rhp
…x64
…NamePlugin.rhp
.Common
…NamePlugin.rui

Notes:

  • I am using the current release of Rhino 5 to produce the RUI file.
  • The plugin works faultlessly after install.
  • The RUI was built correctly and have tested it by loading it manually - users just cant access it via the installer.

Plug-in deployment, RHI?
(Dale Fugier) #2

The Rhino Installer Engine will install your Common folder. But it don’t do anything with the files in it, including your .RUI file. But your plug-in should know where it is “…/Common/”, so it can load it if needed…


#3

Dale,

Interesting - so how can I enable the plugin to load its toolbar?

Until now I’ve been using a toolbar to let the user load / activate its plugin - but maybe my understanding about plugins and toolbars is incorrect.

What is the most user friendly way to have a toolbar and plug-in each be installed so that the user can enable or use the plug-in without typing in any commands?


#4

Dale,

Any help that you can provide would be helpful. I’m a little confused by all of this.


(Dale Fugier) #5

Until now I’ve been using a toolbar to let the user load / activate its plugin…

Toolbar are end-user created UI widgets that run commands or command macros. If you run a command (from the command line, a menu, or a toolbar) and the command resides in a plug-in that is not loaded, Rhino will automatically load the plug-in (if it is registered) and then run the command.

Like I said, the Rhino Installer Engine does not automatically register any .RUI files, included in your .RUI, for automatic loading by Rhino. It simply installed them (e.g. copies) them into a location that can be easily found by a plug-in that wants to load them. User can also load .RUI files themselves, using the Toolbar command, if they know the location.

Your plug-in can load and unload toolbars. If you are using C++, see the CRhinoUiFile class. If you are using .NET, see the Rhino.UI.ToolbarFileCollection class and associated classes.

Also, regarding toolbars created and modified within Rhino’s UI, if you give the .RUI file the exact same name as the plug-in .RHP file and install it in the folder containing the RHP file, Rhino will automatically stage it in a writable location and open it at startup. Note, staging is required because each user on a system get their own version of toolbar files so they can edit them.

Hope this helps.


#6

Dale,

I appreciate being turned in the right direction. Just curious if there are any examples that I can look at to help speed things up? In the mean time I will dig through the posts on this site and look through rhino common.

My preferred user interaction experience would look like:

  1. User installs plugin after downloading.

  2. User starts rhino.

  3. User clicks on newly installed toolbar button.

  4. Newly installed plugin launches.

I’ve found other means - for example - to auto load the plugin on startup, but I’d prefer not to do this to the user and give them the option to enable everything when they are ready.


(Dale Fugier) #7

Just to be clear, running a .RUI file will “install” your plug-in. That is, after you run a .RUI, you can then run Rhino, run one your plug-in commands, and your plug-in will load and the command will run.

Now, if want to run an installer and have both your plug-in installed and your toolbar registered so it too will appear, then a .RHI is not going work for you. You will have to create your own installer using Wix, InstallShield, Wise, etc.


(Dale Fugier) #8

I might also add that I can see why you’d assume .RUI files would be installed, based on the referenced wiki article. I’ve added a bug to either clarify or fix this.

http://mcneel.myjetbrains.com/youtrack/issue/RH-32791


#9

Dale,

A sincere thanks. Here are some notes that I hope might help you and your team. I have no idea if this is something you can fix quickly but it’d be appreciated tremendously if so.

  1. Naming the plugin.rui and plugin.rhp and altering the rhi installer structure to appear like this (below) appears to work such that when rhino first launches with a new plugin - as installed by the rhi - will actually show the plugin rui toolbar.Structure that achieves this is shown at the bottom of this entry – you might consider updating the installer description page [ here ] to reflect this information.

  2. Button icon of loaded toolbar - Shows Blank ( * * Appears to be a bug * * ).
    Toolbar buttons do not save icons unless both left and right mouse button actions are set to a command.

  3. Tab icon of loaded toolbar - Shows Correctly.
    . This icon, like the button icon was supplied with three different image sizes per your standards and works.

Structure which works per point 1 is:

PluginName/
. Rhino 5.0/
…x64/
…PluginName.rhp
…PluginName.rui
…x86/
…PluginName.rhp
…PluginName.rui


(Dale Fugier) #11

You #1 does not surprise me, based on a prior reply of mine.

The toolbar icon issues are a bit odd, being that the icons are embedded in the .RUI file.

Any way I can get a look at your .RUI. Free free to email me (dale@mcneel.com) directly if needed.

– Dale


#12

Hi @dale ,

Any news on the status for this toolbar icon issue?

Regards,
Nathan


(Dale Fugier) #13

Hi Nathan,

Looking at the YouTrack item, it appears to have been fixed in thin WIP back in April of last year.

http://mcneel.myjetbrains.com/youtrack/issue/RH-32791

Let us know if you find otherwise.

– Dale


#14

This is exactly what I am trying to do. I have a tool that I have built (not a Rhino plugin) and I have created an Alias for it. I am using a CreateInstall installer to copy the tool files, register the aliases. I am now trying to add a toolbar that will launch my tool, and I would like my installer to register the RUI and have it show up in the Rhino interface automatically, alongside all the standard tabs at the top of the screen.

Can you point me to an example or reference document for doing this?

Thanks,
Marc


(Dale Fugier) #15

Have you seen this?

Please review and let me know if you have any questions.

– Dale


#16

Hi Dale –

I’m revisiting this issue but may abandon toolbar deployment if it is handled primarily through the Rhino plugin itself. As you might recall from the AEC Hack, I’ve got a massive Grasshopper definition that is deployed as an application on top of Rhino, and that is what I am building the toolbar for – to launch this tool. As it is not a Rhino plugin itself, I can’t use the code samples you posted back in September, AFAICT.

I do see a potential solution, but it would involve building yet another piece of infrastructure, which is a GHA that can scrape a folder for toolbars (+ associated metadata) and install and load them automatically. It’s not a terrible idea, because it would be a generic independent piece of infrastructure that we could use for future deployments. I would like to be able to progressively add to toolbars as users add new tools. For instance, creating an “NBBJ” toolbar which gets a new button each time a new tool is installed.

Before I decide whether to take on this project, I’d be curious if you have any thoughts. This is how I imagine it would work.

CreateIntall installer installs:

  • GH file and associated dependencies
  • Toolbar Installer GHA
  • Toolbar in “Toolbars folder”

On first load, GH:

  • Loads GHAs
    • Toolbar Installer scrapes “Toolbars folder” for toolbars
    • Foreach toolbar + metadata:
      • Checks for existing user toolbar with same name
      • Creates a toolbar if it doesn’t exist
      • Checks existing buttons for matches with buttons to install
      • Installs any missing buttons into the existing toolbar
      • Activates toolbar as necessary

Any thoughts on roadblocks to this approach?

Thanks,
Marc


(Dale Fugier) #17

Hi @marcsyp,

At first glance, your toolbar loading process sounds reasonable. You might also review how Rhino deploys plug-in toolbar to see if you’ve missed anything.

http://developer.rhino3d.com/guides/rhinocommon/create-deploy-plugin-toolbar/

– Dale