GUI - Rhino - Radial Menu - Cross Platform

I’ve asked the 3Dconnexion if it was possible to add a 16 button radial menu and the response was it’s currently not feasible just like that. I was given the opportunity to enter my wish as a feature request so let’s hope they implement it

1 Like

As this being a Cross Platform topic … It would be kind of nice if 3Dc were to consider upping the Radial Manu on the Mac driver from 4 to 8 first…

Just saying.

No intention to be grumpy here. Only that the prospect of a great radial manu being created by some of the talented users here, some time in the near future, feels more in tune with our Rhino needs.

here’s another radial example , a complicated one, that can do lots of things [Spotlight in ZB]

4 Likes

Hello Taraskydon, I also try both Mac an Pc, and I have the same problem with MonoMac that ‘AppKit’ does not exist in the Namespace ‘Monomac’
It seem that Monomac isn’t load from script editor of Rhino…
I mostly use python and external libraries could be load at the beginning of script with # r:XXX but it seems that a similar command does not exist in C#…
Any ideas from Mac developper?
Thanks

1 Like

I got tired of looking for solutions. I gave up. Maybe someday I’ll come back to this once I get a little better at C# programming. :upside_down_face:

1 Like

I’ve just found this:

Haven’t tested it, and it is Windows-only, but maybe that’s the solution to introducing custom Pie menu’s for all users?

1 Like

All users except Mac :sweat_smile:

I was just about to share that as well, came across it in researching pie menu examples.

I’m going to test it but still work on a Rhino solution as I think it’s important to develop something for the community and in the event Auto Hot Pie stops being supported I would love to have a solution on these forums that users can further improve upon or modify for Rhino needs.

I’m going back and forth in my head thinking about the transparent form for Mac OS and I feel there is a workaround I saw recently. I’ll edit back here when I hopefully find it again

2 Likes

Hi @michaelvollrath, did you get a fully transparent window background to work in Python under Windows ?

I’ve tried various ways but it never gets transparent if the Title was hidden using Eto.Forms.WindowStyle.None . With Title i could only get the window to around 50% transparency if i set Opacity=0 but this makes all content invisible including buttons or a drawable…

_
c.

1 Like

@michaelvollrath, @taraskydon could you please try the following code?

  1. Add this reference:
    image

  2. Use Monomac.AppKit like so:

        private static void ApplyTransparency(Panel control, MonoMac.AppKit.NSWindow window)
        {
            control.BackgroundColor = Eto.Drawing.Colors.Transparent;
            window.BackgroundColor = MonoMac.AppKit.NSColor.Clear;
            
            window.HasShadow = false;
            window.Level = MonoMac.AppKit.NSWindowLevel.Floating;
        }
  1. Apply the styles:
        public static void SetStyles()
        {
            RegisterStyle<Panel>("transparent", control =>
            {
                    var nsWindow = (MonoMac.AppKit.NSWindow)control.ControlObject;
                    ApplyTransparency(control, nsWindow);
                
            });
        }
1 Like

@clement, directly setting opacity on a window won’t work. You need to define it in the style and assign it to the window:

1 Like

@mrhe, thanks. That is the example i’ve started from when i tried it. Tested various things in python on init of a dialog or form using:

self.Styles.Add[Eto.Forms.Window](None, self.MyTestStyler)

or as in your example using:

self.Styles.Add[Eto.Forms.Panel](None, self.MyTestStyler)

and then accessing the ControlObject (which is a EtoWindow on Python) but neither did what i would have expected.

The first seemed to change something (when the Title is visible) using below function:

def MyTestStyler(self, control):
    control.AllowsTransparency = True
    control.Background = System.Windows.Media.Brushes.Transparent
    control.BackgroundColor = Eto.Drawing.Colors.Transparent
    control.Opacity = 0.0
    control.WindowStyle = Eto.Forms.WindowStyle.Default
    control.ShowActivated = False

But it made the dialog or form content invisible too. If i hide the title, it lost the partial transparency:

Even tried to set transparency and other available properties (if present) on any control using:

self.Styles.Add[Eto.Forms.Control](None, self.MyTestStyler)

I did try this on the dialog (self), it’s ControlObject, its Handler or the ParentWindow or all at once. Nothing changed what is visible in that short video above. I have the feeling that Eto does override some properties with styles i’m not able to influence using just Python.

_
c.

1 Like
 public static class StyleSetter2
    {
        public static void SetStyles()
        {
            Eto.Style.Add<Eto.Forms.Panel>("Transpar3", control =>
            {
                var nsWindow = (MonoMac.AppKit.NSWindow)control.ControlObject;
                ApplyTransparency(control, nsWindow);

            });
        }

        private static void ApplyTransparency(Panel control, MonoMac.AppKit.NSWindow window)
        {
            control.BackgroundColor = Eto.Drawing.Colors.Transparent;
            window.BackgroundColor = MonoMac.AppKit.NSColor.Clear;

            window.HasShadow = false;
            window.Level = MonoMac.AppKit.NSWindowLevel.Floating;
        }
    }

photo_2024-03-05_17-54-45

If you run it without the dll file, it says that monomac is not found. If you drop the dll into the folder, there is an incompatibility problem. :thinking:

1 Like

Thanks for testing! Have you tried casting it to Eto.Mac.Forms.EtoWindow instead?

        private static void ApplyTransparency(Panel control, Eto.Mac.Forms.EtoWindow window)
        {
            control.BackgroundColor = Eto.Drawing.Colors.Transparent;
            window.BackgroundColor = MonoMac.AppKit.NSColor.Clear;
            
            window.HasShadow = false;
            window.Level = MonoMac.AppKit.NSWindowLevel.Floating;
        }

Without access to a Mac computer I can only test what compiles on my Windows machine, but can’t troubleshoot it for you.

1 Like

[A]Eto.Mac.Forms.EtoWindow cannot be cast to [B]Eto.Mac.Forms.EtoWindow. Type A originates from ‘Eto.macOS, Version=2.7.0.0, Culture=neutral, PublicKeyToken=552281e97c755530’ in the context ‘Default’ at location ‘/Applications/Rhino 8.app/Contents/Frameworks/RhCore.framework/Resources/Eto.macOS.dll’. Type B originates from ‘Eto.Mac64, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null’ in the context ‘Default’ at location ‘/Users/taraskydon/Library/Application Support/McNeel/Rhinoceros/packages/8.0/Grasshopper_Gold_Tools/1.0/Eto.Mac64.dll’.
:joy: :joy: :joy: :joy: :joy: :joy: :joy: :joy:

1 Like

Looks like you’re referencing Eto.Mac64.dll and Eto.macOS.dll. You should only reference Eto.macOS.dll when compiling for Rhino 8.

2 Likes

can you help to make the mac window transparent by assigning a new style?

  public static class StyleSetter
    {
        public static void SetStyles()
        {
            Eto.Style.Add<Eto.Forms.Panel>("Transpar2", control =>
            {
                var wpfwnd = (System.Windows.Window)control.ControlObject;
                wpfwnd.AllowsTransparency = true;
                wpfwnd.Background = System.Windows.Media.Brushes.Transparent;
            });
        }
    }

I need an analog of this code, but only that it works for macOS. :pleading_face:

2 Likes

Hi everyone @antoine @mrhe @taraskydon @clement ,

Made a little progress on this today (I think).

This code is based on previous code from @Mahdiyar in this post:

I modified it to hide the menu bar/title bar and we now have a basic “transparent form” to work with.

Can a Mac OS user test?

import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms

class EtoTransparentDialog(forms.Dialog[bool]):

    def __init__(self):
        self.Title = 'Transparency'
        self.ClientSize = drawing.Size(400, 200)
        self.Padding = drawing.Padding(10)
        self.Resizable = False
        self.WindowStyle = forms.WindowStyle.Default
        self.Opacity = .5

        self.m_checkbox = forms.CheckBox(Text='Toggle Title Bar', Checked=True)
        self.m_checkbox.CheckedChanged += self.OnCheckBoxChanged
        self.m_slider = forms.Slider(MinValue=10, MaxValue=100, Value=50)
        self.m_slider.ValueChanged += self.OnSliderChanged
        self.DefaultButton = forms.Button(Text='EXIT')
        self.DefaultButton.Click += self.OnOKButtonClick

        layout = forms.DynamicLayout()
        layout.Spacing = drawing.Size(5, 5)
        layout.AddRow(self.m_checkbox)
        layout.AddRow(self.m_slider)
        layout.AddRow(self.DefaultButton)
        self.Content = layout

    def OnSliderChanged(self, sender, e):
        self.Opacity = self.m_slider.Value * 0.01

    def OnOKButtonClick(self, sender, e):
        self.Close(False)

    def OnCheckBoxChanged(self, sender, e):
        if self.m_checkbox.Checked:
            self.WindowStyle = forms.WindowStyle.Default
        else:
            self.WindowStyle = forms.WindowStyle.None

dialog = EtoTransparentDialog()
dialog.WindowStyle = forms.WindowStyle.None  # Set the WindowStyle to None to hide the title bar
rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

Rhino_KO6cc0KkaA

3 Likes

No, that’s not what we’re trying to do. It’s not full transparency.

The value is clamped at min. 10 right now for testing. If you set it to 0 it should work? Testing now…

EDIT:

Bummer, it looks like you’re right. 0 value yields this result as you showed earlier:
image

I see the issue now

actually working on Mac, but same grey result…I only keep the layout that why there is only a grey square

1 Like

@michaelvollrath, i can just give a small hint what i’ve found out so far to make it work under windows and partially for mac:

  1. It must be a Eto.Forms.Form, an Eto.Forms.Dialog does not work
  2. WindowStyle must be None
  3. You don’t need to change Opacity (but can if you like it semitransparent).
  4. The Style must be applied as in @mrhe’s example code

I generally like the idea of transparent forms, below shows an old example from 2014 using System.Windows.Forms which i still use a lot to set object colors:

Proof of concept with Eto drawable in Rhino 8 (Win), nothing fancy yet i’ll just try to plan how this could work to make it customizable for the user:

I thought of giving it multiple “levels” which could be switched to using the mouse wheel once it is open. This way it could host a lot of buttons…need more time, hopefully be the weekend.

_
c.

7 Likes