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 filename widget when empty #1878

Merged
merged 1 commit into from
Jan 5, 2025
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 @@ -228,6 +228,7 @@ f3d_test(NAME TestComponentName DATA from_abq.vtu ARGS --scalar-coloring --color
f3d_test(NAME TestNoRender DATA dragon.vtu NO_RENDER)
f3d_test(NAME TestNoRenderWithOptions DATA dragon.vtu ARGS --hdri-ambient --axis NO_RENDER) # These options causes issues if not handled correctly
f3d_test(NAME TestNoFile NO_DATA_FORCE_RENDER)
f3d_test(NAME TestNoFileEmptyFileName ARGS --filename NO_DATA_FORCE_RENDER)
f3d_test(NAME TestMultiFile DATA mb/recursive ARGS --multi-file-mode=all UI)
f3d_test(NAME TestMultiFileColoring DATA mb/recursive ARGS --multi-file-mode=all -s --coloring-array=Polynomial -b UI)
f3d_test(NAME TestMultiFileVolume DATA multi ARGS --multi-file-mode=all -vsb --coloring-array=Scalars_)
Expand Down
3 changes: 3 additions & 0 deletions testing/baselines/TestNoFileEmptyFileName.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 15 additions & 12 deletions vtkext/private/module/vtkF3DImguiActor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,25 @@ vtkF3DImguiActor::~vtkF3DImguiActor() = default;
//----------------------------------------------------------------------------
void vtkF3DImguiActor::RenderFileName()
{
ImGuiViewport* viewport = ImGui::GetMainViewport();
if (!this->FileName.empty())
{
ImGuiViewport* viewport = ImGui::GetMainViewport();

constexpr float marginTop = 5.f;
ImVec2 winSize = ImGui::CalcTextSize(this->FileName.c_str());
winSize.x += 2.f * ImGui::GetStyle().WindowPadding.x;
winSize.y += 2.f * ImGui::GetStyle().WindowPadding.y;
constexpr float marginTop = 5.f;
ImVec2 winSize = ImGui::CalcTextSize(this->FileName.c_str());
winSize.x += 2.f * ImGui::GetStyle().WindowPadding.x;
winSize.y += 2.f * ImGui::GetStyle().WindowPadding.y;

::SetupNextWindow(ImVec2(viewport->GetWorkCenter().x - 0.5f * winSize.x, marginTop), winSize);
ImGui::SetNextWindowBgAlpha(0.35f);
::SetupNextWindow(ImVec2(viewport->GetWorkCenter().x - 0.5f * winSize.x, marginTop), winSize);
ImGui::SetNextWindowBgAlpha(0.35f);

ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMove;
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMove;

ImGui::Begin("FileName", nullptr, flags);
ImGui::TextUnformatted(this->FileName.c_str());
ImGui::End();
ImGui::Begin("FileName", nullptr, flags);
ImGui::TextUnformatted(this->FileName.c_str());
ImGui::End();
}
}

//----------------------------------------------------------------------------
Expand Down
Loading