From 61a22ca5298100db0de79cfab56c79d9ac2b27c4 Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Thu, 26 Dec 2024 23:29:28 +0100 Subject: [PATCH 1/6] Hide console badge when rendering offscreen --- application/testing/CMakeLists.txt | 1 + library/src/window_impl.cxx | 2 ++ vtkext/private/module/vtkF3DRenderer.cxx | 6 ++++++ vtkext/private/module/vtkF3DRenderer.h | 5 +++++ vtkext/private/module/vtkF3DUIActor.cxx | 8 +++++++- vtkext/private/module/vtkF3DUIActor.h | 7 +++++++ 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index 10121bff51..9173ee1b41 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -129,6 +129,7 @@ function(f3d_test) set(f3d_test_env_vars ${F3D_TEST_ENV}) list(APPEND f3d_test_env_vars "CTEST_F3D_PROGRESS_BAR=1") + list(APPEND f3d_test_env_vars "CTEST_F3D_CONSOLE_BADGE=1") if (F3D_TEST_NO_DATA_FORCE_RENDER) list(APPEND f3d_test_env_vars "CTEST_F3D_NO_DATA_FORCE_RENDER=1") endif () diff --git a/library/src/window_impl.cxx b/library/src/window_impl.cxx index ec7cab309f..c9bebf15c3 100644 --- a/library/src/window_impl.cxx +++ b/library/src/window_impl.cxx @@ -186,6 +186,8 @@ window_impl::window_impl(const options& options, const std::optional& type this->Internals->Camera = std::make_unique(); this->Internals->Camera->SetVTKRenderer(this->Internals->Renderer); + this->Internals->Renderer->SetConsoleBadgeEnabled(!offscreen || std::getenv("CTEST_F3D_CONSOLE_BADGE")); + this->Initialize(); log::debug("VTK window class type is ", this->Internals->RenWin->GetClassName()); diff --git a/vtkext/private/module/vtkF3DRenderer.cxx b/vtkext/private/module/vtkF3DRenderer.cxx index 31e50b1e02..97938dcc26 100644 --- a/vtkext/private/module/vtkF3DRenderer.cxx +++ b/vtkext/private/module/vtkF3DRenderer.cxx @@ -2639,3 +2639,9 @@ void vtkF3DRenderer::SetUIDeltaTime(double time) { this->UIActor->SetDeltaTime(time); } + +//---------------------------------------------------------------------------- +void vtkF3DRenderer::SetConsoleBadgeEnabled(bool enabled) +{ + this->UIActor->SetConsoleBadgeEnabled(enabled); +} diff --git a/vtkext/private/module/vtkF3DRenderer.h b/vtkext/private/module/vtkF3DRenderer.h index 40c030da9d..c0e5533332 100644 --- a/vtkext/private/module/vtkF3DRenderer.h +++ b/vtkext/private/module/vtkF3DRenderer.h @@ -377,6 +377,11 @@ class vtkF3DRenderer : public vtkOpenGLRenderer */ void SetUIDeltaTime(double time); + /** + * Set console badge enabled status + */ + void SetConsoleBadgeEnabled(bool enabled); + private: vtkF3DRenderer(); ~vtkF3DRenderer() override; diff --git a/vtkext/private/module/vtkF3DUIActor.cxx b/vtkext/private/module/vtkF3DUIActor.cxx index f73c8beeb8..5f5f745328 100644 --- a/vtkext/private/module/vtkF3DUIActor.cxx +++ b/vtkext/private/module/vtkF3DUIActor.cxx @@ -48,6 +48,12 @@ void vtkF3DUIActor::SetConsoleVisibility(bool show) this->ConsoleVisible = show; } +//---------------------------------------------------------------------------- +void vtkF3DUIActor::SetConsoleBadgeEnabled(bool enabled) +{ + this->ConsoleBadgeEnabled = enabled; +} + //---------------------------------------------------------------------------- void vtkF3DUIActor::SetCheatSheet(const std::vector& cheatsheet) { @@ -113,7 +119,7 @@ int vtkF3DUIActor::RenderOverlay(vtkViewport* vp) { this->RenderConsole(); } - else + else if (this->ConsoleBadgeEnabled) { this->RenderConsoleBadge(); } diff --git a/vtkext/private/module/vtkF3DUIActor.h b/vtkext/private/module/vtkF3DUIActor.h index a8ef79a1c5..419d5d67ab 100644 --- a/vtkext/private/module/vtkF3DUIActor.h +++ b/vtkext/private/module/vtkF3DUIActor.h @@ -62,6 +62,12 @@ class vtkF3DUIActor : public vtkProp */ void SetConsoleVisibility(bool show); + /** + * Set the console badge enabled status + * False by default + */ + void SetConsoleBadgeEnabled(bool enabled); + /** * Set the cheatsheet string * Empty by default @@ -150,6 +156,7 @@ class vtkF3DUIActor : public vtkProp std::vector CheatSheet; bool ConsoleVisible = false; + bool ConsoleBadgeEnabled = false; bool FpsCounterVisible = false; int FpsValue = 0; From 42dc7a3183e4ac5595397fb9dfc9ed464b517ad0 Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Fri, 27 Dec 2024 11:50:01 +0100 Subject: [PATCH 2/6] baseline --- testing/baselines/TestSDKInteractorCallBackDefault.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/baselines/TestSDKInteractorCallBackDefault.png b/testing/baselines/TestSDKInteractorCallBackDefault.png index 8a9166935d..1b2c28c17c 100644 --- a/testing/baselines/TestSDKInteractorCallBackDefault.png +++ b/testing/baselines/TestSDKInteractorCallBackDefault.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98faa9ce96b4bc96e8f92c114039d3d9f9c2b076b59c9b1beccd29b34b928c36 -size 29622 +oid sha256:a40cafb0a5ff4adede4123de4ccaf1575e91e99ceda87972f11683f782ac327e +size 29286 From 7bee3f1a021d3e6e61283845d091a6a455b53a27 Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Sat, 28 Dec 2024 22:46:33 +0100 Subject: [PATCH 3/6] baseline --- testing/baselines/TestSDKInteractorCallBackModified.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/baselines/TestSDKInteractorCallBackModified.png b/testing/baselines/TestSDKInteractorCallBackModified.png index be5bd56e0b..5e2b2b3605 100644 --- a/testing/baselines/TestSDKInteractorCallBackModified.png +++ b/testing/baselines/TestSDKInteractorCallBackModified.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f6edb962ab029c374879b9309a109bdcd817209cb87fd9c256d392d2745c425 -size 60698 +oid sha256:9ca8ce62e5927f324b6a09fa22433c5d8b9fd13d4fee168f07857a4d6ec79944 +size 60327 From dbd6c7c7099a8e96e4324343402a7666656bb6f0 Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Sat, 28 Dec 2024 23:17:14 +0100 Subject: [PATCH 4/6] baseline --- testing/baselines/TestSDKInteractorCallBackModifiedAgain.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/baselines/TestSDKInteractorCallBackModifiedAgain.png b/testing/baselines/TestSDKInteractorCallBackModifiedAgain.png index be5bd56e0b..5e2b2b3605 100644 --- a/testing/baselines/TestSDKInteractorCallBackModifiedAgain.png +++ b/testing/baselines/TestSDKInteractorCallBackModifiedAgain.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f6edb962ab029c374879b9309a109bdcd817209cb87fd9c256d392d2745c425 -size 60698 +oid sha256:9ca8ce62e5927f324b6a09fa22433c5d8b9fd13d4fee168f07857a4d6ec79944 +size 60327 From 532a51e5805e42e00a8dfa4b7d5a14a3029c8835 Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Mon, 30 Dec 2024 07:58:18 +0100 Subject: [PATCH 5/6] baseline --- testing/baselines/TestSDKInteractorCallBackDefaultAgain.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/baselines/TestSDKInteractorCallBackDefaultAgain.png b/testing/baselines/TestSDKInteractorCallBackDefaultAgain.png index e5dfb1c206..bd6017ddfe 100644 --- a/testing/baselines/TestSDKInteractorCallBackDefaultAgain.png +++ b/testing/baselines/TestSDKInteractorCallBackDefaultAgain.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44518fc48c217066211eaa25df80afea4ef49591a6a8d823f3462617ef893e84 -size 81849 +oid sha256:0d01d95e5cc331366528c0b249b4863cd398fa216f3ef6f351effeb0112da663 +size 80703 From 4bb0fb1f6bf6fbc2d0db5cac676f81fce7d1a3ec Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Mon, 30 Dec 2024 08:18:25 +0100 Subject: [PATCH 6/6] ci --- library/CMakeLists.txt | 3 ++- library/src/window_impl.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index cebe1f7a01..7d95444d8e 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -184,7 +184,8 @@ endif () if(F3D_STRICT_BUILD AND MSVC) # There are warnings in VTK related to deprecated features in C++17 - target_compile_definitions(libf3d PRIVATE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) + # Using std::getenv is also considered unsecured on Windows + target_compile_definitions(libf3d PRIVATE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _CRT_SECURE_NO_WARNINGS) endif() if(APPLE) diff --git a/library/src/window_impl.cxx b/library/src/window_impl.cxx index c9bebf15c3..db1e85d5b4 100644 --- a/library/src/window_impl.cxx +++ b/library/src/window_impl.cxx @@ -186,7 +186,8 @@ window_impl::window_impl(const options& options, const std::optional& type this->Internals->Camera = std::make_unique(); this->Internals->Camera->SetVTKRenderer(this->Internals->Renderer); - this->Internals->Renderer->SetConsoleBadgeEnabled(!offscreen || std::getenv("CTEST_F3D_CONSOLE_BADGE")); + this->Internals->Renderer->SetConsoleBadgeEnabled( + !offscreen || std::getenv("CTEST_F3D_CONSOLE_BADGE")); this->Initialize();