29 auto& io = ImGui::GetIO();
31 bool paneActive =
false;
33 float insLogoWidth = paneWidth < 150 ? paneWidth : 150;
35 float insLogoHeight = insLogoWidth * 2967.0F / 4073.0F;
36 float childHeight = ImGui::GetContentRegionAvail().y - insLogoHeight;
40 ImGui::BeginChild(
"Selection", ImVec2(paneWidth, childHeight));
42 paneWidth = ImGui::GetContentRegionAvail().x;
44 float colSum = ImGui::GetStyle().Colors[ImGuiCol_WindowBg].x + ImGui::GetStyle().Colors[ImGuiCol_WindowBg].y + ImGui::GetStyle().Colors[ImGuiCol_WindowBg].z;
48 ImGui::Image(instinctLogo, ImVec2(paneWidth, paneWidth * 3000.0F / 13070.0F));
49 ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0F);
52 ImGui::BeginHorizontal(
"Control Buttons", ImVec2(paneWidth, 0));
53 ImGui::Spring(0.0F, 0.0F);
54 if (ImGui::Button(
"Zoom to Content"))
56 ed::NavigateToContent();
58 if (ImGui::IsItemHovered())
60 ImGui::SetTooltip(
"Shortcut: F");
63 ImGui::EndHorizontal();
66 std::vector<ed::NodeId> selectedNodes;
67 std::vector<ed::LinkId> selectedLinks;
68 selectedNodes.resize(
static_cast<size_t>(ed::GetSelectedObjectCount()));
69 selectedLinks.resize(
static_cast<size_t>(ed::GetSelectedObjectCount()));
71 auto nodeCount =
static_cast<size_t>(ed::GetSelectedNodes(selectedNodes.data(),
static_cast<int>(selectedNodes.size())));
72 auto linkCount =
static_cast<size_t>(ed::GetSelectedLinks(selectedLinks.data(),
static_cast<int>(selectedLinks.size())));
74 selectedNodes.resize(nodeCount);
75 selectedLinks.resize(linkCount);
78 ImGui::GetWindowDrawList()->AddRectFilled(
79 ImGui::GetCursorScreenPos(),
80 ImGui::GetCursorScreenPos() + ImVec2(paneWidth, ImGui::GetTextLineHeight()),
81 ImColor(ImGui::GetStyle().Colors[ImGuiCol_HeaderActive]), ImGui::GetTextLineHeight() * 0.25F);
84 ImGui::TextUnformatted(
"Nodes");
88 ImGui::PushID(node->id.AsPointer());
89 auto start = ImGui::GetCursorScreenPos();
93 ImGui::GetWindowDrawList()->AddLine(
94 start + ImVec2(-18, 0),
95 start + ImVec2(-18, ImGui::GetTextLineHeight()),
96 IM_COL32(255, 0, 0, 255 -
static_cast<int>(255 * progress)), 4.0F);
107 if (node->isDisabled())
109 circleCol = IM_COL32(192, 192, 192, 255);
113 circleCol = IM_COL32(144, 202, 238, 255);
117 circleCol = IM_COL32(143, 188, 143, 255);
121 circleCol = IM_COL32(255, 222, 122, 255);
125 circleCol = IM_COL32(240, 128, 128, 255);
129 circleCol = IM_COL32(0, 255, 0, 255);
133 circleCol = IM_COL32(255, 0, 0, 255);
138 bool isSelected = std::ranges::find(selectedNodes, node->id) != selectedNodes.end();
140 if (ImGui::Selectable((
str::replaceAll_copy(node->name,
"\n",
"") +
"##" + std::to_string(
size_t(node->id))).c_str(), &isSelected))
146 ed::SelectNode(node->id,
true);
150 ed::DeselectNode(node->id);
155 ed::SelectNode(node->id,
false);
158 ed::NavigateToSelection();
160 if (ImGui::IsItemHovered())
162 ImGui::SetTooltip(
"Type: %s", node->type().c_str());
179 ImGui::GetWindowDrawList()->AddRectFilled(
180 ImGui::GetCursorScreenPos(),
181 ImGui::GetCursorScreenPos() + ImVec2(paneWidth, ImGui::GetTextLineHeight()),
182 ImColor(ImGui::GetStyle().Colors[ImGuiCol_HeaderActive]), ImGui::GetTextLineHeight() * 0.25F);
185 ImGui::TextUnformatted(
"Selection");
187 ImGui::BeginHorizontal(
"Selection Stats", ImVec2(paneWidth, 0));
188 size_t selectedCount = selectedNodes.size() + selectedLinks.size();
189 ImGui::Text(
"%lu item%s selected", selectedCount, (selectedCount > 1 || selectedCount == 0) ?
"s" :
"");
191 if (ImGui::Button(
"Deselect"))
193 ed::ClearSelection();
195 ImGui::EndHorizontal();
197 for (
size_t i = 0; i < nodeCount; ++i)
200 ImGui::Text(
"%s (%lu)", node !=
nullptr ? node->name.c_str() :
"",
size_t(selectedNodes[i]));
202 for (
size_t i = 0; i < linkCount; ++i)
204 ImGui::Text(
"Link (%lu)",
size_t(selectedLinks[i]));
209 if (ImGui::IsWindowFocused())
216 ImGui::Image(insLogo, ImVec2(insLogoWidth, insLogoHeight));