Rhino C++ API
8.13
|
#include <rhinoSdkEventWatcher.h>
Classes | |
class | CParameters |
Public Member Functions | |
CRhinoDisplayModeChanged (ON_UUID plugin_id) | |
CRhinoDisplayModeChanged (ON_UUID plugin_id, bool headlessDocAware, bool headlessAppAware) | |
virtual void | Notify (const class CRhinoDisplayModeChanged::CParameters ¶ms)=0 |
Public Member Functions inherited from CRhinoEventWatcherEx | |
void | Enable (bool bEnable) |
bool | IsEnabled () const |
bool | IsHeadlessAppAware () const |
bool | IsHeadlessDocAware () const |
bool | IsRegistered () const |
void | operator delete (void *) |
void | operator delete (void *, void *) |
void | operator delete[] (void *) |
void * | operator new (size_t) |
new/delete More... | |
void * | operator new (size_t, void *) |
in place new/delete More... | |
void * | operator new[] (size_t) |
array new/delete More... | |
bool | Register () |
bool | Unregister () |
CRhinoDisplayModeChanged::CRhinoDisplayModeChanged | ( | ON_UUID | plugin_id | ) |
CRhinoDisplayModeChanged::CRhinoDisplayModeChanged | ( | ON_UUID | plugin_id, |
bool | headlessDocAware, | ||
bool | headlessAppAware | ||
) |
|
pure virtual |
Rhino will call Notify() immediately after changing the view's display mode. WARNING: Never modify the Rhino document or application state in a Notify override. Never attempt to change the view's (or any other view) display mode inside your Notify routine, or you will eventually crash Rhino.
Rhino will also call Notify() whenever a display mode's attributes change, so do NOT attempt to change any display attributes (ala CRhinoDisplayAttrsMgr) inside your Notify routine, or you may experience undefined behavior...
There are three different states that can be observed using the notifier...
1) A view's display mode has been set. 2) The attributes of the display mode used by the active view have changed. 3) The attributes of a specific display mode have changed.
...all three can be determined using the CParameters:
1) If ( (params.m_vp != NULL) && (params.m_changed_display_mode_id != params.m_old_display_mode_id) ) then m_vp's display mode has just been set/changed.
2) If ( (params.m_vp != NULL) && (params.m_changed_display_mode_id == params.m_old_display_mode_id) ) then the attributes of the display mode used by the ACTIVE viewport have changed.
3) If ( (params.m_vp == NULL) && (params.m_old_display_mode_id == ON_nil_uuid) ) then the attributes of the display mode specified by params.m_changed_display_mode_id have changed (i.e. no viewport involved whatsoever).
...any other combinations of params are not yet determined. The differences are subtle, but each condition can require completely different processing depending on the use of the notifier.
Note: If you need to check against a specific CRhinoView (i.e. the active view), then you will need to get it from params.m_vp, like so:
CRhinoView* view = params.m_vp ? params.m_vp->ParentView() : NULL;
...there will be cases where viewports are not attached to views, so you'll need to handle those as well.
Note2: You cannot just assume that if (view == RhinoApp().ActiveView()) then the active view's display mode changed. Likewise, you cannot assume that if (view != RhinoApp().ActiveView()) then only the attributes have changed...you must look at each CParameters value in order to determine specific conditions.