| 2389 | if (ImGui::MenuItem(LE_ICON_FOLDER " Group Selection", "Ctrl+G")) |
| 2390 | { |
| 2391 | GroupSelectedEntities(); |
| 2392 | ImGui::CloseCurrentPopup(); |
| 2393 | } |
| 2394 | } |
| 2395 | |
| 2396 | if (!bLastSelectedLocked && Registry.GetHierarchy().GetParent(LastSelected) != ECS::NullEntity) |
| 2397 | { |
| 2398 | if (ImGui::MenuItem("Unparent")) |
| 2399 | { |
| 2400 | BeginRelationshipTransaction({ LastSelected }); |
| 2401 | ECS::Utils::RemoveFromParent(Registry, LastSelected); |
| 2402 | EndTransaction("Unparent"); |
| 2403 | ReparentEntityInOutliner(LastSelected); |
| 2404 | ImGui::CloseCurrentPopup(); |
| 2405 | } |
| 2406 | } |
| 2407 | |
| 2408 | if (!bLastSelectedLocked && Registry.GetHierarchy().GetChildCount(LastSelected) != 0) |
| 2409 | { |
| 2410 | if (ImGui::MenuItem("Detach Children")) |
| 2411 | { |
| 2412 | TVector<ECS::FEntity> Children; |
| 2413 | Registry.GetHierarchy().ForEachChild(LastSelected, [&](ECS::FEntity Child) { Children.Add(Child); }); |
| 2414 | BeginRelationshipTransaction({ LastSelected }); |
| 2415 | ECS::Utils::DetachImmediateChildren(Registry, LastSelected); |
| 2416 | EndTransaction("Detach Children"); |
| 2417 | for (ECS::FEntity Child : Children) |
| 2418 | { |
| 2419 | ReparentEntityInOutliner(Child); |
| 2420 | } |
| 2421 | ImGui::CloseCurrentPopup(); |
| 2422 | } |
| 2423 | } |
| 2424 | |
| 2425 | if (!bLastSelectedLocked) |
| 2426 | { |
| 2427 | const bool bIsSelectionRoot = Registry.HasAll<SSelectionRoot>(LastSelected); |
| 2428 | if (ImGui::MenuItem(bIsSelectionRoot ? "Unmark Selection Root" : "Mark as Selection Root")) |
| 2429 | { |
| 2430 | if (bIsSelectionRoot) |
| 2431 | { |
| 2432 | Registry.Remove<SSelectionRoot>(LastSelected); |
| 2433 | } |
| 2434 | else |
| 2435 | { |
| 2436 | Registry.Emplace<SSelectionRoot>(LastSelected); |
| 2437 | } |
| 2438 | ImGui::CloseCurrentPopup(); |
| 2439 | } |
| 2440 | ImGuiX::TextTooltip("{}", "Viewport clicks on any descendant will resolve up to this entity."); |
| 2441 | } |
| 2442 | |
| 2443 | ImGui::Spacing(); |
| 2444 | ImGui::Separator(); |
| 2445 | ImGui::Spacing(); |
| 2446 | |
| 2447 | // Prefab. |
| 2448 | if (ImGui::MenuItem(LE_ICON_PACKAGE_VARIANT " Create Prefab from Selected...")) |
nothing calls this directly
no test coverage detected