Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide console badge when rendering offscreen #1840

Merged
merged 6 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
3 changes: 2 additions & 1 deletion library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ window_impl::window_impl(const options& options, const std::optional<Type>& type
this->Internals->Camera = std::make_unique<detail::camera_impl>();
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());
Expand Down
4 changes: 2 additions & 2 deletions testing/baselines/TestSDKInteractorCallBackDefault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSDKInteractorCallBackDefaultAgain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSDKInteractorCallBackModified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSDKInteractorCallBackModifiedAgain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2639,3 +2639,9 @@ void vtkF3DRenderer::SetUIDeltaTime(double time)
{
this->UIActor->SetDeltaTime(time);
}

//----------------------------------------------------------------------------
void vtkF3DRenderer::SetConsoleBadgeEnabled(bool enabled)
{
this->UIActor->SetConsoleBadgeEnabled(enabled);
}
5 changes: 5 additions & 0 deletions vtkext/private/module/vtkF3DRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion vtkext/private/module/vtkF3DUIActor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<CheatSheetGroup>& cheatsheet)
{
Expand Down Expand Up @@ -113,7 +119,7 @@ int vtkF3DUIActor::RenderOverlay(vtkViewport* vp)
{
this->RenderConsole();
}
else
else if (this->ConsoleBadgeEnabled)
{
this->RenderConsoleBadge();
}
Expand Down
7 changes: 7 additions & 0 deletions vtkext/private/module/vtkF3DUIActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -150,6 +156,7 @@ class vtkF3DUIActor : public vtkProp
std::vector<CheatSheetGroup> CheatSheet;

bool ConsoleVisible = false;
bool ConsoleBadgeEnabled = false;

bool FpsCounterVisible = false;
int FpsValue = 0;
Expand Down
Loading