Split camera frame render-graph stage recording helpers
This commit is contained in:
146
new_editor/app/Features/Project/ProjectPanel.h
Normal file
146
new_editor/app/Features/Project/ProjectPanel.h
Normal file
@@ -0,0 +1,146 @@
|
||||
#pragma once
|
||||
|
||||
#include "Project/ProductProjectBrowserModel.h"
|
||||
|
||||
#include <XCEditor/Collections/UIEditorTreeViewInteraction.h>
|
||||
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelContentHost.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEngine/UI/Widgets/UIExpansionModel.h>
|
||||
#include <XCEngine/UI/Widgets/UISelectionModel.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
class ProductBuiltInIcons;
|
||||
|
||||
class ProductProjectPanel {
|
||||
public:
|
||||
enum class CursorKind : std::uint8_t {
|
||||
Arrow = 0,
|
||||
ResizeEW
|
||||
};
|
||||
|
||||
enum class EventKind : std::uint8_t {
|
||||
None = 0,
|
||||
AssetSelected,
|
||||
AssetSelectionCleared,
|
||||
FolderNavigated,
|
||||
AssetOpened,
|
||||
ContextMenuRequested
|
||||
};
|
||||
|
||||
enum class EventSource : std::uint8_t {
|
||||
None = 0,
|
||||
Tree,
|
||||
Breadcrumb,
|
||||
GridPrimary,
|
||||
GridDoubleClick,
|
||||
GridSecondary,
|
||||
Background
|
||||
};
|
||||
|
||||
struct Event {
|
||||
EventKind kind = EventKind::None;
|
||||
EventSource source = EventSource::None;
|
||||
std::string itemId = {};
|
||||
std::filesystem::path absolutePath = {};
|
||||
std::string displayName = {};
|
||||
bool directory = false;
|
||||
};
|
||||
|
||||
void Initialize(const std::filesystem::path& repoRoot);
|
||||
void SetBuiltInIcons(const ProductBuiltInIcons* icons);
|
||||
void SetTextMeasurer(const ::XCEngine::UI::Editor::UIEditorTextMeasurer* textMeasurer);
|
||||
void ResetInteractionState();
|
||||
void Update(
|
||||
const UIEditorPanelContentHostFrame& contentHostFrame,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
bool allowInteraction,
|
||||
bool panelActive);
|
||||
void Append(::XCEngine::UI::UIDrawList& drawList) const;
|
||||
|
||||
CursorKind GetCursorKind() const;
|
||||
bool WantsHostPointerCapture() const;
|
||||
bool WantsHostPointerRelease() const;
|
||||
bool HasActivePointerCapture() const;
|
||||
const std::vector<Event>& GetFrameEvents() const;
|
||||
|
||||
private:
|
||||
using BrowserModel = ::XCEngine::UI::Editor::App::Project::ProductProjectBrowserModel;
|
||||
using FolderEntry = BrowserModel::FolderEntry;
|
||||
using AssetEntry = BrowserModel::AssetEntry;
|
||||
|
||||
struct BreadcrumbItemLayout {
|
||||
std::string label = {};
|
||||
std::string targetFolderId = {};
|
||||
::XCEngine::UI::UIRect rect = {};
|
||||
bool separator = false;
|
||||
bool clickable = false;
|
||||
bool current = false;
|
||||
};
|
||||
|
||||
struct AssetTileLayout {
|
||||
std::size_t itemIndex = static_cast<std::size_t>(-1);
|
||||
::XCEngine::UI::UIRect tileRect = {};
|
||||
::XCEngine::UI::UIRect previewRect = {};
|
||||
::XCEngine::UI::UIRect labelRect = {};
|
||||
};
|
||||
|
||||
struct Layout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect leftPaneRect = {};
|
||||
::XCEngine::UI::UIRect treeRect = {};
|
||||
::XCEngine::UI::UIRect dividerRect = {};
|
||||
::XCEngine::UI::UIRect rightPaneRect = {};
|
||||
::XCEngine::UI::UIRect browserHeaderRect = {};
|
||||
::XCEngine::UI::UIRect browserBodyRect = {};
|
||||
::XCEngine::UI::UIRect gridRect = {};
|
||||
std::vector<BreadcrumbItemLayout> breadcrumbItems = {};
|
||||
std::vector<AssetTileLayout> assetTiles = {};
|
||||
};
|
||||
|
||||
const FolderEntry* FindFolderEntry(std::string_view itemId) const;
|
||||
const AssetEntry* FindAssetEntry(std::string_view itemId) const;
|
||||
const UIEditorPanelContentHostPanelState* FindMountedProjectPanel(
|
||||
const UIEditorPanelContentHostFrame& contentHostFrame) const;
|
||||
Layout BuildLayout(const ::XCEngine::UI::UIRect& bounds) const;
|
||||
std::size_t HitTestBreadcrumbItem(const ::XCEngine::UI::UIPoint& point) const;
|
||||
std::size_t HitTestAssetTile(const ::XCEngine::UI::UIPoint& point) const;
|
||||
void SyncCurrentFolderSelection();
|
||||
bool NavigateToFolder(std::string_view itemId, EventSource source = EventSource::None);
|
||||
void EmitEvent(EventKind kind, EventSource source, const FolderEntry* folder);
|
||||
void EmitEvent(EventKind kind, EventSource source, const AssetEntry* asset);
|
||||
void EmitSelectionClearedEvent(EventSource source);
|
||||
void ResetTransientFrames();
|
||||
|
||||
BrowserModel m_browserModel = {};
|
||||
const ProductBuiltInIcons* m_icons = nullptr;
|
||||
const ::XCEngine::UI::Editor::UIEditorTextMeasurer* m_textMeasurer = nullptr;
|
||||
::XCEngine::UI::Widgets::UISelectionModel m_folderSelection = {};
|
||||
::XCEngine::UI::Widgets::UIExpansionModel m_folderExpansion = {};
|
||||
::XCEngine::UI::Widgets::UISelectionModel m_assetSelection = {};
|
||||
UIEditorTreeViewInteractionState m_treeInteractionState = {};
|
||||
UIEditorTreeViewInteractionFrame m_treeFrame = {};
|
||||
std::vector<Event> m_frameEvents = {};
|
||||
Layout m_layout = {};
|
||||
std::string m_hoveredAssetItemId = {};
|
||||
std::string m_lastPrimaryClickedAssetId = {};
|
||||
float m_navigationWidth = 248.0f;
|
||||
std::uint64_t m_lastPrimaryClickTimeMs = 0u;
|
||||
std::size_t m_hoveredBreadcrumbIndex = static_cast<std::size_t>(-1);
|
||||
std::size_t m_pressedBreadcrumbIndex = static_cast<std::size_t>(-1);
|
||||
bool m_visible = false;
|
||||
bool m_splitterHovered = false;
|
||||
bool m_splitterDragging = false;
|
||||
bool m_requestPointerCapture = false;
|
||||
bool m_requestPointerRelease = false;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
Reference in New Issue
Block a user