Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
EditorContext.h
Go to the documentation of this file.
1/*
2 * Olympe Blueprint Editor - Editor Context
3 *
4 * Defines capability-driven editor modes (Runtime vs Standalone)
5 * Controls what operations are available in each mode
6 */
7
8#pragma once
9
10namespace Olympe
11{
12 /**
13 * EditorCapabilities - Defines what operations are enabled
14 * Used to gate UI elements and functionality
15 */
17 {
18 bool isRuntime; // True for Runtime Editor, false for Standalone
19 bool canCreate; // Can create new nodes/links
20 bool canEdit; // Can edit existing nodes
21 bool canDelete; // Can delete nodes/links
22 bool canLink; // Can create/remove links
23 bool canSave; // Can save changes to disk
24 bool showEntityContext; // Show entity selection context
25
26 // Default constructor: Standalone mode (full capabilities)
37
38 // Runtime mode: read-only visualization
40 {
42 caps.isRuntime = true;
43 caps.canCreate = false;
44 caps.canEdit = false;
45 caps.canDelete = false;
46 caps.canLink = false;
47 caps.canSave = false;
48 caps.showEntityContext = true;
49 return caps;
50 }
51
52 // Standalone mode: full CRUD operations
54 {
56 caps.isRuntime = false;
57 caps.canCreate = true;
58 caps.canEdit = true;
59 caps.canDelete = true;
60 caps.canLink = true;
61 caps.canSave = true;
62 caps.showEntityContext = false;
63 return caps;
64 }
65 };
66
67 /**
68 * EditorContext - Singleton managing editor mode and capabilities
69 * Provides global access to current editor configuration
70 */
72 {
73 public:
74 static EditorContext& Instance();
75 static EditorContext& Get() { return Instance(); }
76
77 // Initialize editor mode
78 void InitializeRuntime();
80
81 // Query capabilities
83 bool IsRuntime() const { return m_Capabilities.isRuntime; }
84 bool IsStandalone() const { return !m_Capabilities.isRuntime; }
85
86 bool CanCreate() const { return m_Capabilities.canCreate; }
87 bool CanEdit() const { return m_Capabilities.canEdit; }
88 bool CanDelete() const { return m_Capabilities.canDelete; }
89 bool CanLink() const { return m_Capabilities.canLink; }
90 bool CanSave() const { return m_Capabilities.canSave; }
92
93 private:
96
97 EditorContext(const EditorContext&) = delete;
99
100 private:
102 };
103}
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
EditorContext - Singleton managing editor mode and capabilities Provides global access to current edi...
const EditorCapabilities & GetCapabilities() const
static EditorContext & Get()
bool ShowEntityContext() const
EditorContext & operator=(const EditorContext &)=delete
static EditorContext & Instance()
EditorContext(const EditorContext &)=delete
bool IsStandalone() const
EditorCapabilities m_Capabilities
EditorCapabilities - Defines what operations are enabled Used to gate UI elements and functionality.
static EditorCapabilities Runtime()
static EditorCapabilities Standalone()