DisplayMode disappeared from ON_3dmObjectAttributes in WIP


#1

Hi,
I am corrently working on porting Rhino5 Plugins to Rhino 6 WIP and I have found that
the DisplayMode() previously defined in the object attributes like

// OpenNURBS objects can be displayed in one of three ways: wireframe,
// shaded, or render preview. If the display mode is ON::default_display,
// then the display mode of the viewport detrmines how the object
// is displayed. If the display mode is ON::wireframe_display,
// ON::shaded_display, or ON::renderpreview_display, then the object is
// forced to display in that mode.
ON::display_mode DisplayMode() const;
void SetDisplayMode( ON::display_mode ); // See DisplayMode().

has disappeared from there in WIP.
Is there a new way to get to the object’s display mode from the objects attributes ?

Thanks in advance


(Dale Fugier) #2

Hi Heinz,

CRhinoViewport::SetDisplayMode exists - just pass it the uuid of the display mode you want to set. If you want to use a standard display mode, then you can find it on the new ON_StandardDisplayModeId class.

– Dale


#3

Hi Dale,

thank you for the reply !

Let me detail the question a bit. The code I am porting is checking the DisplayMode in the CRhinoObjectAttributes as well as in CRhinoViewport, to find out how the object is actually displayed:

if ( pAttr.DisplayMode() == ON::shaded_display || ( pAttr.DisplayMode() == ON::default_display && m_pVP->DisplayMode() == ON::shaded_display ) …

Is it correct to say that it is now enough to check the display mode in the CRhinoViewport, because there is no longer a display mode in the CRhinoObjectAttributes ?

Thank you
Heinz


(Dale Fugier) #4

Hi @Heinz1,

Given:

ON_UUID shaded_id = ON_StandardDisplayModeId::Shaded;

If you want to know if a viewport is set to shaded display, then you can do this:

if (view->ActiveViewport().View().m_display_mode_id == shaded_id)
{
  // TODO...
}

If you want to know if a viewport’s display attribute supports shading, then you can do this:

if (view->ActiveViewport().DisplayModeIsShaded())
{
  // TODO...
}

If you want to know whether or not an object’s display mode is set to shaded display, then you can do this:

if (obj->Attributes().FindDisplayMaterialId(view->ActiveViewportID(), &shaded_id))
{
  // TODO...
}

Does this help?

– Dale


#5

Hi Dale,

thank you very much, I think this should solve my case !

Heinz