Selection bug with SetPerViewportVisible?

Hi there,

I’m playing with SetPerViewportVisible in my Rhino plugin and might have encountered a selection bug related to it.
I found out that if some object like a curve is on a layer that is set to be visible only in a specific viewport this behaviour happens :

  • The object is only displayed in the designated viewport (expected)

  • Using guizmos to move / scale / rotate the object makes the guizmo AND the shadow of current object visible in ALL viewports ( might be a bug but is not really a problem)

  • Direct mouse click in a viewport where the object is NOT visible allows to select it (bug : invisible objects should not be selectable ? )

  • Selection area with mouse doesn’t allow to select the objet in a viewport where it is not visible (expected)

Selection context is especially weird for me since selection area and mouse click behaviour give different results…

This test has been run on the 8.13 version of Rhino and also in the latest 8.25 on windows.
Here is a video of the found bug and a sample code of what has been done to display it :

var doc = RhinoDoc.ActiveDoc;
var view_rectangle = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ScreenRectangle;

var new_view = doc.Views.Add(“LensFront Modeling”,
Rhino.Display.DefinedViewportProjection.Top,
view_rectangle,
true);
Guid vpId = new_view.ActiveViewportID;

var layerindex = doc.Layers.AddPath(“toto”);

var layer = doc.Layers[layerindex];
layer.IsVisible = true;
foreach( var view in doc.Views)
{
layer.SetPerViewportVisible(view.ActiveViewportID, false);
}

layer.SetPerViewportVisible(vpId, true);

var attr = new ObjectAttributes { LayerIndex = layerindex, Name = “Lens2DCurve”, ObjectColor = Color.OrangeRed, ColorSource = ObjectColorSource.ColorFromObject, ViewportId = view.ActiveViewportID};
Guid objID = doc.Objects.Add(new Circle(20).ToNurbsCurve(), attr);

My goal is to have a design view without other objects messing around and a basic view with all objects except the design specific objects.

So are these really bugs ? Is there another way to achieve objects visible and selectable only in specific viewports ?

Sorry for the repost but I guess the other thread was dead since I had no answer on it since december so here it is again :slight_smile:

Thanks for your help,

Thomas

Hi @thomas.pitiot,

If I understand correctly, objects on layers hidden in model views are still gumball selectable?

I’m not sure how much q&a we’ve done on this as SetPerViewportVisible is really for layout/detail views.

– Dale

Hi Dale,

Yes you understand correctly, objects are displayed in one view and hidden in others and are still gumball selectable in views where they are hidden.

Hi @thomas.pitiot,

I’ve logged the issue - https://mcneel.myjetbrains.com/youtrack/issue/RH-94773

– Dale

1 Like