[R8 issues] UI.Controls.ViewportControl creates unintentional viewport

I don’t recall having this problem in R7

Are you able to test Rhino 7 with your code to see if this is a regression?

If not, do you have some code so I can replicate?

Just tried it in Rhino 7, Custom view didn’t show up. It’s a regression for sure.

Try to run the below command in Rhino 7 and Rhino 8. I think you would replicate the issue I have.

        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {

            var viewportControl = new Rhino.UI.Controls.ViewportControl();

            return Result.Success;
        }

Thanks @Wiley,

I can repeat this behaviour, I’ll look into why this is

bump

I’m still looking into this, apologies it’s taking a while.

bump

@CallumSykes
bump

@CallumSykes bump

bump

bump. this still hasn’t been fixed

I’ve also noticed this. Have kind of a janky work-around where I just close the view that was created right after, e.g.

            string viewportName = "The name";

            // Note that when we instantiate a ViewportControl, Rhino automatically (for some reason)
            // creates a view by the name we passed. i.e. a view at the same level of
            // Perspective, Top, Front, Right. We don't actually want it. So at the end of the function
            // we search for that newly-created view and close it.
            ViewportControl viewportControl = new(viewportName);
            ViewportControl = viewportControl;
            viewportControl.Viewport.Name = viewportName;

            // Close the newly-created view
            var view = RhinoDoc.ActiveDoc.Views.Find(viewportName, true);
            view.Close();

Hi @Wiley,

Can you provide a simple example, that I can run here, that repeats the issue?

Thanks,

– Dale

@dale

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {

        var viewportControl = new Rhino.UI.Controls.ViewportControl();

        return Result.Success;
    }

I see the issue has been logged, but not activity on it.

@CallumSykes - were you ever able to bisect this?