UV editor, object visibility & ON::active_space

TL;DR

Is there a way to replicate the functionality of the UV editor? (I need to add custom objects to the ‘UV space’.)

Long version:

Hello!
I have a recurring problem and after digging through the documentation I haven’t found a good solution… yet I know this is possible somehow. Here’s the simplified problem: I have two objects, let’s say a red sphere and a blue sphere. They live in different worlds, so I want to show them in different views. I do not want to show the blue sphere in the red sphere’s view, and vice-versa.

Here’s a screenshot of what I need:

I have seen several posts on this forum with similar problems. The recommended approach always seems to be to use Display Conduits. This is what I used to generate that screenshot. However, this is not good enough. As already pointed out in this post , you can still interact with objects that are not visible in a view. Like so:

I really need to avoid such interactions. I’ve searched OpenNURBS and Rhino’s documentation thoroughly, and here are a few of the promising things I tried, but didn’t work:

  • I tried putting the objects on different layers, and toggling their visibility with ON_Layer::SetPerViewportVisible. Sounds promising, but it is not working at all. Is it true that this only works for CRhinoPageViews?
  • Subclassing the Rhino view - CRhinoView. I could not make it work, but I think this is probably the least safe option. Also CRhinoDoc::CreateRhinoView does not seem to work correctly on Rhino 8, whereas it worked ok on Rhino 7.
  • ON_3dmObjectAttributes::m_space seems to be exactly what I need (different objects in different spaces). I tried setting this attribute for an object, and creating a view with the corresponding ON_3dmView::m_view_type. But this attribute is somehow overwritten and all objects get displayed on all views.

What I ultimately need is to replicate the functionality of the UV editor (which feels like it’s using ON::active_space::uveditor_space, correct?), but I need to add different objects to the ‘UV space’.

I would really appreciate any help to get this to work! Is this in the public API? And if not, could it be made part of it? I’m mainly working on C++, but a RhinoCommon solution would also work, if that’s something it can do. Thanks!

Hi @victorceballos,

Try setting the layer’s model visibility to false.

ON_Layer::SetModelVisible

Does this help?

– Dale