Best practice.RUI file update

So, I I’m in the process of adding a new module to my suite of tools in my Rhino plugin.

This requires the adding of a new item in my custom drop down menu in the UI.

Now my plugin is complied using the Rhino Script Complier and sent out as a .YAK file for users to drop/drop install. I include the .RUI file in the YAK for the drop down menu.

On FIRST install the menu will be added to Rhino, but it never updates on future installs.

What is the easiest way for less technically minded end users to update the UI to be able to access the new modules.

Cheers

DK

There is a short note by @dale how you can use C# or C++ to update your toolbar .rui file during OnLoad Rhino - Creating and Deploying Plugin Toolbars

However:

  • if you compiled with RhinoScriptCompiler this would require you to ask RhinoScriptCompiler to create Visual Studio Project, edit it there and compile. AFAIK there is no possibility to utilize onload in scripts.
  • I am not sure is it valid approach for Rhino 8. My plugin is loading it 3 times currently
    image

can you share a bit more info on that?
I logged a bug the other day about plugins appearing twice, but on my end it was only on the first run. RH-78113 Installed plugin appears twice in the Menu

I will provide more details in the evening.

EDIT:
@Gijs So I can see plugin is appearing once in a list, but most likely .rui file is loaded 3 times. My .rui file inclides top menu and side toolbar.

Just after downloading package from yak (.rui loaded once):

After restart when .rui toolbar is not yet loaded into container - same (.rui loaded once).

After restart when .rui toolbar is loaded into container (.rui loaded 3x):

@kiteboardshaper if you need help with adding this functionality into Visual Studio project created by RhinoScriptCompiler I can help. Just PM me.

Hi @mlukasz87 ,
I also encountered the same problem, have you fixed this error, can you help me?

As @Gijs wrote above, issue is logged under https://mcneel.myjetbrains.com/youtrack/issue/RH-78113. We are waiting for solution.

You could not supply top menu in your toolbar file for now.

1 Like

in case it is useful, been trying to make a menu for my plugin, and I get the double menu in v8 as well:

bella_rhino.rui (21.7 KB)

the .rui is being auto-loaded from the plugin directory and does not even show up here at all:

running the Menus command and trying to choose my .rui from the dropdown, I get this exception:

System.ArgumentException: An item with the same key has already been added.
Command: Menus
Exception caught during RunCommand
System.ArgumentException: An item with the same key has already been added. Key: c7b8a775-7e8d-4da4-9ed7-6100fae16180
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Rhino.UI.Internal.TabPanels.MenuEditor.MenuEditorViewModel.LoadFile(ToolBarFileController file)
   at Rhino.UI.Internal.TabPanels.MenuEditor.RhinoMenuEditorPanel.<CreateFileDropDown>b__3_0(Object s, EventArgs e)
   at Eto.Forms.ListControl.OnSelectedValueChanged(EventArgs e) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Controls\ListControl.cs:line 213
   at Eto.Forms.ListControl.OnSelectedIndexChanged(EventArgs e) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Controls\ListControl.cs:line 179
   at Eto.Forms.ListControl.Callback.OnSelectedIndexChanged(ListControl widget, EventArgs e) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Controls\ListControl.cs:line 449
   at Eto.Wpf.Forms.Controls.DropDownHandler`3.<.ctor>b__1_0(Object sender, SelectionChangedEventArgs e) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto.Wpf\Forms\Controls\DropDownHandler.cs:line 95
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Controls.ComboBox.OnSelectionChanged(SelectionChangedEventArgs e)
   at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(ItemInfo info, Boolean assumeInItemsCollection)
   at System.Windows.Controls.ComboBox.NotifyComboBoxItemMouseUp(ComboBoxItem comboBoxItem)
   at System.Windows.Controls.ComboBoxItem.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()
   at Eto.Wpf.Forms.DialogHandler.ShowModal() in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto.Wpf\Forms\DialogHandler.cs:line 68
   at Eto.Forms.Dialog.ShowModal() in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Dialog.cs:line 221
   at Eto.Forms.Dialog.ShowModal(Control owner) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Dialog.cs:line 203
   at Eto.Forms.Dialog`1.ShowModal(Control owner) in D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto\Forms\Dialog.cs:line 83
   at Rhino.UI.Internal.TabPanels.MenuEditor.RhinoMenuEditorPanel.Show(Guid toolBarFileId, Window owner)
   at Commands.Commands.TabPanels.MenusCommand.RunCommand(RhinoDoc doc, RunMode mode)
   at Rhino.Commands.Command.OnRunCommand(Int32 commandSerialNumber, UInt32 docSerialNumber, Int32 mode)

this is all on windows 8.1.23325.13001; on macos 8.2.23346.13002 it actually seems to behave properly, from what I can tell so far

1 Like

RH-78113 is fixed in Rhino 8 Service Release 3 Release Candidate

I can confirm I see now only 1 menu for HSA.

However I am unsure how to adress initial problem of this topic. Is it still possible to update rui file with staging it like in version 7, or are they just overrided by default in version 8, when installer includes newer rui file?

I’ve asked for more info how this is handled

I’m not quite sure what you mean by staging

Here is some relevant information about how the RUI files in Rhino 8 are handled: