28 auto& io = ImGui::GetIO();
30 bool paneActive =
false;
32 float insLogoWidth = paneWidth < 150 ? paneWidth : 150;
34 float insLogoHeight = insLogoWidth * 2967.0F / 4073.0F;
35 float childHeight = ImGui::GetContentRegionAvail().y - insLogoHeight;
39 ImGui::BeginChild(
"Selection", ImVec2(paneWidth, childHeight));
41 paneWidth = ImGui::GetContentRegionAvail().x;
43 float colSum = ImGui::GetStyle().Colors[ImGuiCol_WindowBg].x + ImGui::GetStyle().Colors[ImGuiCol_WindowBg].y + ImGui::GetStyle().Colors[ImGuiCol_WindowBg].z;
47 ImGui::Image(instinctLogo, ImVec2(paneWidth, paneWidth * 3000.0F / 13070.0F));
48 ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0F);
51 ImGui::BeginHorizontal(
"Control Buttons", ImVec2(paneWidth, 0));
52 ImGui::Spring(0.0F, 0.0F);
53 if (ImGui::Button(
"Zoom to Content"))
55 ed::NavigateToContent();
57 if (ImGui::IsItemHovered())
59 ImGui::SetTooltip(
"Shortcut: F");
62 ImGui::EndHorizontal();
65 std::vector<ed::NodeId> selectedNodes;
66 std::vector<ed::LinkId> selectedLinks;
67 selectedNodes.resize(
static_cast<size_t>(ed::GetSelectedObjectCount()));
68 selectedLinks.resize(
static_cast<size_t>(ed::GetSelectedObjectCount()));
70 auto nodeCount =
static_cast<size_t>(ed::GetSelectedNodes(selectedNodes.data(),
static_cast<int>(selectedNodes.size())));
71 auto linkCount =
static_cast<size_t>(ed::GetSelectedLinks(selectedLinks.data(),
static_cast<int>(selectedLinks.size())));
73 selectedNodes.resize(nodeCount);
74 selectedLinks.resize(linkCount);
77 ImGui::GetWindowDrawList()->AddRectFilled(
78 ImGui::GetCursorScreenPos(),
79 ImGui::GetCursorScreenPos() + ImVec2(paneWidth, ImGui::GetTextLineHeight()),
80 ImColor(ImGui::GetStyle().Colors[ImGuiCol_HeaderActive]), ImGui::GetTextLineHeight() * 0.25F);
83 ImGui::TextUnformatted(
"Nodes");
87 ImGui::PushID(node->id.AsPointer());
88 auto start = ImGui::GetCursorScreenPos();
92 ImGui::GetWindowDrawList()->AddLine(
93 start + ImVec2(-18, 0),
94 start + ImVec2(-18, ImGui::GetTextLineHeight()),
95 IM_COL32(255, 0, 0, 255 -
static_cast<int>(255 * progress)), 4.0F);
106 if (node->isDisabled())
108 circleCol = IM_COL32(192, 192, 192, 255);
112 circleCol = IM_COL32(144, 202, 238, 255);
116 circleCol = IM_COL32(143, 188, 143, 255);
120 circleCol = IM_COL32(255, 222, 122, 255);
124 circleCol = IM_COL32(240, 128, 128, 255);
128 circleCol = IM_COL32(0, 255, 0, 255);
132 circleCol = IM_COL32(255, 0, 0, 255);
137 bool isSelected = std::ranges::find(selectedNodes, node->id) != selectedNodes.end();
139 if (ImGui::Selectable((
str::replaceAll_copy(node->name,
"\n",
"") +
"##" + std::to_string(
size_t(node->id))).c_str(), &isSelected))
145 ed::SelectNode(node->id,
true);
149 ed::DeselectNode(node->id);
154 ed::SelectNode(node->id,
false);
157 ed::NavigateToSelection();
159 if (ImGui::IsItemHovered())
161 ImGui::SetTooltip(
"Type: %s", node->type().c_str());
178 ImGui::GetWindowDrawList()->AddRectFilled(
179 ImGui::GetCursorScreenPos(),
180 ImGui::GetCursorScreenPos() + ImVec2(paneWidth, ImGui::GetTextLineHeight()),
181 ImColor(ImGui::GetStyle().Colors[ImGuiCol_HeaderActive]), ImGui::GetTextLineHeight() * 0.25F);
184 ImGui::TextUnformatted(
"Selection");
186 ImGui::BeginHorizontal(
"Selection Stats", ImVec2(paneWidth, 0));
187 size_t selectedCount = selectedNodes.size() + selectedLinks.size();
188 ImGui::Text(
"%lu item%s selected", selectedCount, (selectedCount > 1 || selectedCount == 0) ?
"s" :
"");
190 if (ImGui::Button(
"Deselect"))
192 ed::ClearSelection();
194 ImGui::EndHorizontal();
196 for (
size_t i = 0; i < nodeCount; ++i)
199 ImGui::Text(
"%s (%lu)", node !=
nullptr ? node->name.c_str() :
"",
size_t(selectedNodes[i]));
201 for (
size_t i = 0; i < linkCount; ++i)
203 ImGui::Text(
"Link (%lu)",
size_t(selectedLinks[i]));
208 if (ImGui::IsWindowFocused())
215 ImGui::Image(insLogo, ImVec2(insLogoWidth, insLogoHeight));