MCPcopy Create free account
hub / github.com/Kitware/VTK / SetCurrentRenderer

Method SetCurrentRenderer

Rendering/Core/vtkInteractorObserver.cxx:62–104  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

60
61//------------------------------------------------------------------------------
62void vtkInteractorObserver::SetCurrentRenderer(vtkRenderer* _arg)
63{
64 if (this->CurrentRenderer == _arg)
65 {
66 return;
67 }
68
69 if (this->CurrentRenderer != nullptr)
70 {
71 this->CurrentRenderer->UnRegister(this);
72 }
73
74 // WARNING: see .h, if the DefaultRenderer is set, whatever the value
75 // of _arg (except nullptr), we are going to use DefaultRenderer
76 // Normally when the widget is activated (SetEnabled(1) or when
77 // keypress activation takes place), the renderer over which the mouse
78 // pointer is positioned is used to call SetCurrentRenderer().
79 // Alternatively, we may want to specify a user-defined renderer to bind the
80 // interactor to when the interactor observer is activated.
81 // The problem is that in many 3D widgets, when SetEnabled(0) is called,
82 // the CurrentRender is set to nullptr. In that case, the next time
83 // SetEnabled(1) is called, the widget will try to set CurrentRenderer
84 // to the renderer over which the mouse pointer is positioned, and we
85 // will use our user-defined renderer. To solve that, we introduced the
86 // DefaultRenderer ivar, which will be used to force the value of
87 // CurrentRenderer each time SetCurrentRenderer is called (i.e., no matter
88 // if SetCurrentRenderer is called with the renderer that was poked at
89 // the mouse coords, the DefaultRenderer will be used).
90
91 if (_arg && this->DefaultRenderer)
92 {
93 _arg = this->DefaultRenderer;
94 }
95
96 this->CurrentRenderer = _arg;
97
98 if (this->CurrentRenderer != nullptr)
99 {
100 this->CurrentRenderer->Register(this);
101 }
102
103 this->Modified();
104}
105
106//------------------------------------------------------------------------------
107// This adds the keypress event observer and the delete event observer

Callers 15

TestLabeledDataMappersFunction · 0.45
TestPolyDataToContextFunction · 0.45
TestOSPRayPassFunction · 0.45
TestOSPRayRotatedNormalsFunction · 0.45
TestPathTracerMaterialsFunction · 0.45
TestPathTracerLuminousFunction · 0.45
TestOSPRayAmbientFunction · 0.45
TestOSPRayImplicitsFunction · 0.45
TestPathTracerShadowsFunction · 0.45
TestOSPRayLightsFunction · 0.45
TestOSPRayRenderMeshFunction · 0.45

Calls 3

UnRegisterMethod · 0.45
RegisterMethod · 0.45
ModifiedMethod · 0.45

Tested by 15

TestLabeledDataMappersFunction · 0.36
TestPolyDataToContextFunction · 0.36
TestOSPRayPassFunction · 0.36
TestOSPRayRotatedNormalsFunction · 0.36
TestPathTracerMaterialsFunction · 0.36
TestPathTracerLuminousFunction · 0.36
TestOSPRayAmbientFunction · 0.36
TestOSPRayImplicitsFunction · 0.36
TestPathTracerShadowsFunction · 0.36
TestOSPRayLightsFunction · 0.36
TestOSPRayRenderMeshFunction · 0.36
TestOSPRayLightWidgetFunction · 0.36