From 19b2f10d1dba660ad725c3f1bf0c59a1cbad3bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20de=20Vill=C3=A8le?= <25150288+Thibaulltt@users.noreply.github.com> Date: Wed, 25 Mar 2026 02:31:23 +0100 Subject: [PATCH 1/2] feat: add a per-structure slicing plane button --- src/structure.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/structure.cpp b/src/structure.cpp index 9e6c3ee2..9386ffe3 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -92,22 +92,34 @@ void Structure::buildUI() { // Toggle whether slice planes apply if (ImGui::BeginMenu("Slice planes")) { + if (ImGui::Button("Add slice plane")) { + openSlicePlaneMenu = true; + addSlicePlane(); + } + if (ImGui::Button("...for this structure only")) { + openSlicePlaneMenu = true; + SlicePlane* plane = addSlicePlane(std::string("Slice plane of ") + this->name); + /* Set all structures to ignore this plane, except for this one in particular! */ + for (auto const& supermap: state::structures) { + for (auto const& map: supermap.second) { + map.second->setIgnoreSlicePlane(plane->name, supermap.first != this->typeName() or map.first != this->name); + } + } + } + ImGui::Separator(); + ImGui::TextUnformatted("Applies to this structure:"); + ImGui::Indent(20); if (state::slicePlanes.empty()) { // if there are none, show a helpful message - if (ImGui::Button("Add slice plane")) { - openSlicePlaneMenu = true; - addSlicePlane(); - } + ImGui::TextWrapped("< none >"); } else { // otherwise, show toggles for each - ImGui::TextUnformatted("Applies to this structure:"); - ImGui::Indent(20); for (std::unique_ptr& s : state::slicePlanes) { bool ignorePlane = getIgnoreSlicePlane(s->name); if (ImGui::MenuItem(s->name.c_str(), NULL, !ignorePlane)) setIgnoreSlicePlane(s->name, !ignorePlane); } - ImGui::Indent(-20); } + ImGui::Indent(-20); ImGui::TextUnformatted(""); ImGui::Separator(); ImGui::TextUnformatted("Note: Manage slice planes in"); From 9f340c1603f55107362ccfbb92e7dd1c12a031f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20de=20Vill=C3=A8le?= <25150288+Thibaulltt@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:01:40 +0100 Subject: [PATCH 2/2] fix: don't try to be fancy with names --- src/structure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structure.cpp b/src/structure.cpp index 9386ffe3..da8bf5e6 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -98,7 +98,7 @@ void Structure::buildUI() { } if (ImGui::Button("...for this structure only")) { openSlicePlaneMenu = true; - SlicePlane* plane = addSlicePlane(std::string("Slice plane of ") + this->name); + SlicePlane* plane = addSlicePlane(); /* Set all structures to ignore this plane, except for this one in particular! */ for (auto const& supermap: state::structures) { for (auto const& map: supermap.second) {