Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
AssetBrowser.h
Go to the documentation of this file.
1/*
2 * Olympe Blueprint Editor - Asset Browser
3 * Frontend component that uses BlueprintEditor backend for asset data
4 */
5
6#pragma once
7
8#include <string>
9#include <vector>
10#include <memory>
11#include <functional>
12
13namespace Olympe
14{
15 // Forward declarations
16 class BlueprintEditor;
17 struct AssetNode;
18
19 // Asset filter options
21 {
22 std::string searchQuery; // Text search in filename
23 std::string typeFilter; // Filter by asset type (empty = all)
24
25 AssetFilter() = default;
26 };
27
29 {
30 public:
33
34 // Initialize the asset browser (sets up UI state)
35 void Initialize(const std::string& assetsRootPath);
36
37 // Refresh asset tree from backend
38 void Refresh();
39
40 // Render the asset browser panel with ImGui
41 void Render();
42
43 // Render content only (without window wrapper) - for fixed layout
44 void RenderContent();
45
46 // Get currently selected asset path (empty if none selected)
47 std::string GetSelectedAssetPath() const;
48
49 // Check if an asset is selected
50 bool HasSelection() const;
51
52 // Set callback for when an asset is double-clicked/opened
53 void SetAssetOpenCallback(std::function<void(const std::string&)> callback);
54
55 private:
56 // Render tree node recursively (uses backend data)
57 void RenderTreeNode(const std::shared_ptr<AssetNode>& node);
58
59 // LEGACY METHOD - No longer used (Runtime Entities tab removed)
60 // void RenderRuntimeEntities();
61
62 // Render node palette tab (F)
63 void RenderNodePalette();
64
65 // Apply filters to determine if node should be visible
66 bool PassesFilter(const std::shared_ptr<AssetNode>& node) const;
67
68 // Render search and filter UI
69 void RenderFilterUI();
70
71 private:
74 std::function<void(const std::string&)> m_OnAssetOpen;
75
76 // UI state
77 char m_SearchBuffer[256];
79 std::vector<std::string> m_AvailableTypes;
80 };
81}
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
bool HasSelection() const
void RenderTreeNode(const std::shared_ptr< AssetNode > &node)
std::vector< std::string > m_AvailableTypes
std::function< void(const std::string &)> m_OnAssetOpen
std::string m_SelectedAssetPath
void Initialize(const std::string &assetsRootPath)
void SetAssetOpenCallback(std::function< void(const std::string &)> callback)
bool PassesFilter(const std::shared_ptr< AssetNode > &node) const
std::string GetSelectedAssetPath() const
< Provides AssetID and INVALID_ASSET_ID
std::string searchQuery
std::string typeFilter