From db8f1826212af4172934d48fe5a0cf826683c778 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Mon, 5 Oct 2020 14:16:03 +0200 Subject: [PATCH] spns #18447: backport bos #19139 which fixes VTK issue --- products/GUI.pyconf | 5 + products/patches/gui-SVTK-VTKView.patch | 131 ++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 products/patches/gui-SVTK-VTKView.patch diff --git a/products/GUI.pyconf b/products/GUI.pyconf index a54ce60..ed1328b 100644 --- a/products/GUI.pyconf +++ b/products/GUI.pyconf @@ -73,6 +73,11 @@ default_win : } +version_V9_5_0: +{ + patches: ['gui-SVTK-VTKView.patch'] # backporting bos #19139 +} + version_8_5_0_to_9_4_0 : { depend : ["KERNEL", diff --git a/products/patches/gui-SVTK-VTKView.patch b/products/patches/gui-SVTK-VTKView.patch new file mode 100644 index 0000000..be7eb1f --- /dev/null +++ b/products/patches/gui-SVTK-VTKView.patch @@ -0,0 +1,131 @@ +diff -Naur gui-9.5.0/src/SVTK/SVTK.h gui-master/src/SVTK/SVTK.h +--- gui-9.5.0/src/SVTK/SVTK.h 2020-10-05 13:35:56.580949966 +0200 ++++ gui-master/src/SVTK/SVTK.h 2020-10-05 13:34:10.374221860 +0200 +@@ -25,6 +25,8 @@ + + #include "VTKViewer.h" + ++#define VGL_WORKAROUND ++ + #ifdef WIN32 + # if defined SVTK_EXPORTS + # define SVTK_EXPORT __declspec(dllexport) +diff -Naur gui-9.5.0/src/SVTK/SVTK_InteractorStyle.cxx gui-master/src/SVTK/SVTK_InteractorStyle.cxx +--- gui-9.5.0/src/SVTK/SVTK_InteractorStyle.cxx 2020-10-05 13:35:56.581949973 +0200 ++++ gui-master/src/SVTK/SVTK_InteractorStyle.cxx 2020-10-05 13:34:10.378221887 +0200 +@@ -1551,6 +1551,9 @@ + // check if bounding box was changed + if ( GetCurrentRenderer() ) + { ++#ifdef VGL_WORKAROUND ++ GetCurrentRenderer()->Render(); ++#endif + double aCurrBBCenter[3]; + if ( ComputeBBCenter(GetCurrentRenderer(),aCurrBBCenter) ) + { +diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewModel.cxx gui-master/src/SVTK/SVTK_ViewModel.cxx +--- gui-9.5.0/src/SVTK/SVTK_ViewModel.cxx 2020-10-05 13:35:56.582949980 +0200 ++++ gui-master/src/SVTK/SVTK_ViewModel.cxx 2020-10-05 13:34:10.384221928 +0200 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -186,7 +187,7 @@ + this, SLOT(onActorAdded(VTKViewer_Actor*))); + connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ), + this, SLOT(onActorRemoved(VTKViewer_Actor*))); +- ++ + return aViewWindow; + } + +@@ -528,6 +529,9 @@ + + connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), + this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*))); ++ ++ connect(theViewManager, SIGNAL(viewCreated(SUIT_ViewWindow*)), ++ this, SLOT(onViewCreated(SUIT_ViewWindow*))); + } + + /*! +@@ -865,3 +869,10 @@ + { + emit actorRemoved((SVTK_ViewWindow*)sender(), theActor); + } ++ ++void SVTK_Viewer::onViewCreated( SUIT_ViewWindow* view) { ++#ifdef VGL_WORKAROUND ++ if ( SVTK_ViewWindow* svw = dynamic_cast( view ) ) ++ QTimer::singleShot(500, [svw] () { svw->Repaint(); } ); ++#endif ++} +diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewModel.h gui-master/src/SVTK/SVTK_ViewModel.h +--- gui-9.5.0/src/SVTK/SVTK_ViewModel.h 2020-10-05 13:35:56.582949980 +0200 ++++ gui-master/src/SVTK/SVTK_ViewModel.h 2020-10-05 13:34:10.384221928 +0200 +@@ -220,6 +220,8 @@ + void onActorAdded(VTKViewer_Actor*); + void onActorRemoved(VTKViewer_Actor*); + ++ void onViewCreated( SUIT_ViewWindow* ); ++ + private: + void updateToolBars(); + +diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewWindow.cxx gui-master/src/SVTK/SVTK_ViewWindow.cxx +--- gui-9.5.0/src/SVTK/SVTK_ViewWindow.cxx 2020-10-05 13:35:56.584949994 +0200 ++++ gui-master/src/SVTK/SVTK_ViewWindow.cxx 2020-10-05 13:34:10.385221935 +0200 +@@ -34,6 +34,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -789,8 +790,16 @@ + GetInteractor()->update(); + + SVTK_InteractorStyle* aStyle = (SVTK_InteractorStyle*)getInteractor()->GetInteractorStyle(); +- if ( aStyle ) ++ if ( aStyle ) { ++#ifdef VGL_WORKAROUND ++ if ( aStyle->GetCurrentRenderer() == nullptr ) { ++ if( GetRenderer() ) { ++ aStyle->SetCurrentRenderer(GetRenderer()->GetDevice()); ++ } ++ } ++#endif + aStyle->OnTimer(); ++ } + } + + /*! +@@ -2828,3 +2837,10 @@ + + blockSignals( blocked ); + } ++ ++void SVTK_ViewWindow::resizeEvent( QResizeEvent* theEvent ) ++{ ++#ifdef VGL_WORKAROUND ++ Repaint(); ++#endif ++} +diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewWindow.h gui-master/src/SVTK/SVTK_ViewWindow.h +--- gui-9.5.0/src/SVTK/SVTK_ViewWindow.h 2020-10-05 13:35:56.584949994 +0200 ++++ gui-master/src/SVTK/SVTK_ViewWindow.h 2020-10-05 13:34:10.385221935 +0200 +@@ -416,6 +416,9 @@ + enum AnaglyphFilter { RedCyan, YellowBlue, GreenMagenta }; + + protected: ++ ++ virtual void resizeEvent( QResizeEvent* ); ++ + virtual void Initialize(SVTK_View* theView, + SVTK_ViewModelBase* theModel); + -- 2.39.2