chore: sync workspace state

This commit is contained in:
2026-03-29 01:36:53 +08:00
parent eb5de3e3d4
commit e5cb79f3ce
4935 changed files with 35593 additions and 360696 deletions

View File

@@ -200,7 +200,7 @@ inline void DrawHierarchyBackgroundContextPopup(IEditorContext& context, UI::Def
}
inline void DrawHierarchyContextActions(IEditorContext& context, ::XCEngine::Components::GameObject* gameObject) {
if (UI::DrawMenuScope("Create", [&]() {
if (UI::DrawPopupSubmenuScope("Create", [&]() {
DrawHierarchyCreateActions(context, gameObject);
})) {
}

View File

@@ -31,34 +31,14 @@ inline bool IsProjectAssetBeingDragged(const AssetItemPtr& item) {
return item != nullptr && draggedPath != nullptr && item->fullPath == draggedPath;
}
inline std::string AcceptProjectAssetDropPayload(const AssetItemPtr& targetFolder) {
if (!targetFolder || !targetFolder->isFolder || !ImGui::BeginDragDropTarget()) {
return {};
}
std::string draggedPath;
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(ProjectAssetPayloadType())) {
const char* payloadPath = static_cast<const char*>(payload->Data);
if (payloadPath) {
draggedPath = payloadPath;
}
}
ImGui::EndDragDropTarget();
return draggedPath;
}
inline bool BeginProjectAssetDrag(const AssetItemPtr& item, UI::AssetIconKind iconKind) {
if (!item || item->fullPath.empty() || !ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) {
if (!item || item->fullPath.empty() || !ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoPreviewTooltip)) {
return false;
}
(void)iconKind;
ImGui::SetDragDropPayload(ProjectAssetPayloadType(), item->fullPath.c_str(), item->fullPath.length() + 1);
ImVec2 previewMin = ImGui::GetMousePos();
const ImVec2 previewSize = UI::AssetDragPreviewSize();
ImVec2 previewMax = ImVec2(previewMin.x + previewSize.x, previewMin.y + previewSize.y);
UI::DrawAssetIcon(ImGui::GetForegroundDrawList(), previewMin, previewMax, iconKind);
ImGui::EndDragDropSource();
return true;
}
@@ -82,8 +62,11 @@ inline bool DrawProjectNavigateBackAction(IProjectManager& projectManager) {
return true;
}
inline void HandleProjectBackgroundPrimaryClick(IProjectManager& projectManager) {
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(0) && !ImGui::IsAnyItemHovered()) {
template <size_t BufferCapacity>
inline void HandleProjectBackgroundPrimaryClick(
IProjectManager& projectManager,
const UI::InlineTextEditState<std::string, BufferCapacity>& renameState) {
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(0) && !ImGui::IsAnyItemHovered() && !renameState.IsActive()) {
projectManager.ClearSelection();
}
}
@@ -133,52 +116,19 @@ inline void DrawProjectAssetContextActions(IEditorContext& context, const AssetI
});
}
template <size_t BufferCapacity>
inline void DrawProjectEmptyContextActions(UI::TextInputPopupState<BufferCapacity>& createFolderDialog) {
DrawMenuAction(MakeCreateFolderAction(), [&]() {
createFolderDialog.RequestOpen("NewFolder");
});
}
template <size_t BufferCapacity>
template <typename CreateFolderFn>
inline void DrawProjectEmptyContextPopup(
UI::DeferredPopupState& emptyContextMenu,
UI::TextInputPopupState<BufferCapacity>& createFolderDialog) {
CreateFolderFn&& createFolder) {
emptyContextMenu.ConsumeOpenRequest("EmptyContextMenu");
if (!UI::BeginPopup("EmptyContextMenu")) {
return;
}
DrawProjectEmptyContextActions(createFolderDialog);
UI::EndPopup();
}
template <size_t BufferCapacity>
inline void DrawProjectCreateFolderDialog(IEditorContext& context, UI::TextInputPopupState<BufferCapacity>& createFolderDialog) {
createFolderDialog.ConsumeOpenRequest("Create Folder");
if (!UI::BeginModalPopup("Create Folder")) {
return;
}
ImGui::InputText("Name", createFolderDialog.Buffer(), createFolderDialog.BufferSize());
ImGui::Separator();
switch (UI::DrawDialogActionRow("Create", "Cancel", !createFolderDialog.Empty())) {
case UI::DialogActionResult::Primary:
if (Commands::CreateFolder(context.GetProjectManager(), createFolderDialog.Buffer())) {
createFolderDialog.Clear();
ImGui::CloseCurrentPopup();
}
break;
case UI::DialogActionResult::Secondary:
createFolderDialog.Clear();
ImGui::CloseCurrentPopup();
break;
case UI::DialogActionResult::None:
break;
}
DrawMenuAction(MakeCreateFolderAction(), [&]() {
createFolder();
});
UI::EndPopup();
}