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 // Get currently selected asset path (empty if none selected)
44 std::string GetSelectedAssetPath() const;
45
46 // Check if an asset is selected
47 bool HasSelection() const;
48
49 // Set callback for when an asset is double-clicked/opened
50 void SetAssetOpenCallback(std::function<void(const std::string&)> callback);
51
52 private:
53 // Render tree node recursively (uses backend data)
54 void RenderTreeNode(const std::shared_ptr<AssetNode>& node);
55
56 // Render runtime entities section (B)
58
59 // Render node palette tab (F)
60 void RenderNodePalette();
61
62 // Apply filters to determine if node should be visible
63 bool PassesFilter(const std::shared_ptr<AssetNode>& node) const;
64
65 // Render search and filter UI
66 void RenderFilterUI();
67
68 private:
71 std::function<void(const std::string&)> m_OnAssetOpen;
72
73 // UI state
74 char m_SearchBuffer[256];
76 std::vector<std::string> m_AvailableTypes;
77 };
78}
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
std::string searchQuery
std::string typeFilter