Skip to content

Commit

Permalink
Hide console badge when rendering offscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Meakk committed Dec 26, 2024
1 parent 7a649d4 commit 61a22ca
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
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
2 changes: 2 additions & 0 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ 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
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

0 comments on commit 61a22ca

Please sign in to comment.