Big bug in Rhino panels, SR1

unhandled

#1

There is a big bug which breaks Rhino panels UI drawing in SR1.

  1. Opening a panel raises two times the event “VisibleChanged” event.
  2. Closing a panel raises two times the event “VisibleChanged” event but Visibility property is True, in SR0 it was False which is the right one.
  3. Closing the panel makes that all the other panels of the container have the closed panel inside but without any background. (see the following video)

Here the code:

Plugin:

public class PanelBugRh6Sr1PlugIn : PlugIn
    {
        public PanelBugRh6Sr1PlugIn()
        {
            Instance = this;
        }

        public static PanelBugRh6Sr1PlugIn Instance { get; private set; }

        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            Panels.RegisterPanel(this, typeof(PanelTestCtrl), "TestPanel", System.Drawing.SystemIcons.Application);
            return base.OnLoad(ref errorMessage);
        }
    }

Open panel command:

public class PanelBugRh6Sr1CommandOpen : Command
    {
        public PanelBugRh6Sr1CommandOpen()
        {
            Instance = this;
        }

        ///<summary>The only instance of this command.</summary>
        public static PanelBugRh6Sr1CommandOpen Instance { get; private set; }

        public override string EnglishName => "PanelBugRh6Sr1CommandOpen";

        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            return Panels.OpenPanelAsSibling(PanelTestCtrl.Id, PanelIds.Layers) ? Result.Success : Result.Failure;
        }
    }

Close Panel Command:

public class PanelBugRh6Sr1CommandClose : Command
    {
        public PanelBugRh6Sr1CommandClose()
        {
            Instance = this;
        }

        public static PanelBugRh6Sr1CommandClose Instance { get; private set; }

        public override string EnglishName => "PanelBugRh6Sr1CommandClose";

        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            Panels.ClosePanel(typeof(PanelTestCtrl));
            return Result.Success;
        }
    }

Here the example plugin source code with the rhp file: PanelBug_Rh6_Sr1.7z (206.9 KB)
I hope you can fix it soon, so it’s breaking all the workflow of our plugin.

Thanks and best regards.

Enric


(John Morse) #5

I was able to reproduce this and am in the progress of fixing it, see RH-44059


(John Morse) #6

RH-44059 Has now been fixed, this should work correctly in the next SR2 build.


#7

Thank you for the quick fix @JohnM , should it be working fine in the latest release candidate?

Thanks and best regards.


(John Morse) #8

Yes, it should be in the latest SR2 release candidate.


#9

Hi @JohnM

I’m afraid it’s not fixed, so take a look at this short video showing the multiple fail cases.

  1. First time It raises the VisibiltyChanged event 2 times when it turns Visible
  2. Next times the VisibiltyChanged when panel is shown, is not raised
  3. When Panel is hidden it raises VisibiltyChanged as Visible = True
  4. The Panels.Show event is raised multiple times (I check the Id of the panel if is not the right one, it returns)
  5. Showing the panel raises the event 4 times as False, and finally 1 as True
  6. Changing between other panels (Layers and properties for example) raises the Panels.Show as false

Here the video:

Here the exemple project:
PanelBug_Rh6_Sr1.zip (351.0 KB)

I used Rhino 6.2 RC

Thanks and Regards


(Nathan 'jesterKing' Letwory) #10

Not looking at the code yet, but you may want to at least want to fix your .csproj to point to the correct RhinoCommon location. It currently has a relative path something like ..\..\..\Program Files\Rhinoceros 6\System\RhinoCommon.dll, but you have it probably installed under C:\Program Files\Rhino 6\System\RhinoCommon.dll


#11

Hi Nathan,

I’m sorry I forgot to change the path, anyway in my case it’s right, Rhino is installed in C:\Program Files\Rhinoceros 6


(Nathan 'jesterKing' Letwory) #12

Then I don’t see how your Rhino.UI.dll reference works? Because that is pointing to the Rhino 6 folder I mentioned…
image