Skip to content
Open
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
26 changes: 19 additions & 7 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
/* 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<SlicePlane>& 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");
Expand Down
Loading