| 1156 | ImGuiWindowFlags_NoFocusOnAppearing | |
| 1157 | ImGuiWindowFlags_NoNav | |
| 1158 | ImGuiWindowFlags_AlwaysAutoResize; |
| 1159 | |
| 1160 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Padding, Padding)); |
| 1161 | ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, CornerRounding); |
| 1162 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ItemSpacing, ItemSpacing)); |
| 1163 | ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 6.0f); |
| 1164 | |
| 1165 | // ImGui keys windows globally by name, so a shared literal made every tool share one bar. |
| 1166 | const FFixedString WindowName = GetToolWindowName("##ViewportToolbar", CurrDockspaceID); |
| 1167 | return ImGui::Begin(*WindowName, nullptr, WindowFlags); |
| 1168 | } |
| 1169 | |
| 1170 | void FEditorTool::EndViewportToolbarWindow() |
| 1171 | { |
| 1172 | ImGui::End(); |
| 1173 | ImGui::PopStyleVar(4); |
| 1174 | } |
| 1175 | |
| 1176 | void FEditorTool::DrawViewModeButton(float ButtonSize) |
| 1177 | { |
| 1178 | if (ImGuiX::IconButton(LE_ICON_EYE, "##ViewMode", 0xFFFFFFFF, ImVec2(ButtonSize, ButtonSize))) |
| 1179 | { |
| 1180 | ImGui::OpenPopup("ViewModePopup"); |
| 1181 | } |
| 1182 | if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) |
| 1183 | { |
| 1184 | ImGui::SetTooltip("View Mode Options"); |
| 1185 | } |
| 1186 | |
| 1187 | if (ImGui::BeginPopup("ViewModePopup", ImGuiWindowFlags_NoMove)) |
| 1188 | { |
| 1189 | DrawViewModePopupContents(); |
| 1190 | ImGui::EndPopup(); |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | void FEditorTool::DrawViewModePopupContents() |
| 1195 | { |
| 1196 | IRenderScene* RenderScene = HasWorld() ? World->GetRenderer() : nullptr; |
| 1197 | |
| 1198 | ImGui::Text("Visualizations"); |
| 1199 | ImGui::Separator(); |
| 1200 | |
| 1201 | if (ImGui::BeginMenu("Components")) |
| 1202 | { |
| 1203 | ImGui::Checkbox("Show All", &bShowComponentVisualizers); |
| 1204 | ImGui::BeginDisabled(!bShowComponentVisualizers); |
| 1205 | |
| 1206 | ImGui::Checkbox("Interactive Handles", &bVisualizerHandlesEnabled); |
| 1207 | ImGui::SetItemTooltip("Face, radius and cone handles you can drag in the viewport."); |
| 1208 | |
| 1209 | ImGui::Checkbox("Show All in Hierarchy", &bShowHierarchyVisualizers); |
| 1210 | ImGui::SetItemTooltip("Draws every visualizer in the selected entity's tree, from its root down, not only the selection."); |
| 1211 | ImGui::Separator(); |
| 1212 | |
| 1213 | for (auto&& [Struct, Visualizer] : CComponentVisualizerRegistry::Get().GetVisualizers()) |
| 1214 | { |
| 1215 | bool bVisible = !HiddenVisualizerTypes.Contains(Struct); |
nothing calls this directly
no test coverage detected