![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
ImGui panel for creating, editing, duplicating, and deleting global condition presets. More...
#include <ConditionPresetLibraryPanel.h>
Collaboration diagram for Olympe::ConditionPresetLibraryPanel:Public Member Functions | |
| ConditionPresetLibraryPanel (ConditionPresetRegistry ®istry) | |
| Constructs the panel with a reference to the preset registry. | |
| ~ConditionPresetLibraryPanel ()=default | |
| ConditionPresetLibraryPanel (const ConditionPresetLibraryPanel &)=delete | |
| ConditionPresetLibraryPanel & | operator= (const ConditionPresetLibraryPanel &)=delete |
| bool | IsOpen () const |
| Returns true if the panel window is open. | |
| void | Open () |
| Opens the panel window. | |
| void | Close () |
| Closes the panel window. | |
| void | Render () |
| Renders the full panel window using ImGui. | |
| void | SetSearchFilter (const std::string &filter) |
| Sets the search filter string (case-insensitive substring). | |
| const std::string & | GetSearchFilter () const |
| Returns the current search filter string. | |
| void | SetSelectedPresetID (const std::string &id) |
| Selects the preset with the given ID. | |
| const std::string & | GetSelectedPresetID () const |
| Returns the currently selected preset ID (empty if none). | |
| bool | IsDeleteConfirmationVisible () const |
| Returns true if the delete confirmation dialog is currently shown. | |
| const std::string & | GetPresetToDelete () const |
| Returns the ID of the preset pending deletion confirmation. | |
| ConditionPresetRegistry & | GetRegistry () |
| Returns a reference to the registry managed by this panel. | |
| std::vector< ConditionPreset > | GetFilteredPresets () const |
| Returns filtered presets based on the current search filter. | |
| void | SetReferenceMap (const std::map< std::string, std::vector< std::string > > &refMap) |
| Sets the reference analysis map (nodeID -> list of preset IDs used). | |
| std::vector< std::string > | GetReferencingNodes (const std::string &presetID) const |
| Returns a list of node IDs that reference the given preset. | |
| std::string | OnAddPresetClicked () |
| Handles the "Add Preset" button. | |
| std::string | OnDuplicatePresetClicked (const std::string &presetID) |
| Handles the "Duplicate" button for a preset. | |
| void | OnDeletePresetClicked (const std::string &presetID) |
| Handles the "Delete" button for a preset. | |
| void | OnDeleteConfirmed (const std::string &presetID) |
| Confirms the pending deletion. | |
| void | OnDeleteCancelled () |
| Cancels the pending deletion and hides the confirmation dialog. | |
| void | OnPresetSelected (const std::string &presetID) |
| Selects a preset (highlights it in the list). | |
Public Attributes | |
| std::function< void(const std::string &)> | OnPresetCreated |
| Invoked after a new preset is added. | |
| std::function< void(const std::string &)> | OnPresetModified |
| Invoked after an existing preset is modified. | |
| std::function< void(const std::string &)> | OnPresetDeleted |
| Invoked after a preset is deleted. | |
Private Member Functions | |
| void | RenderToolbar () |
| void | RenderPresetList () |
| void | RenderPresetItem (const std::string &presetID, const ConditionPreset &preset) |
| void | RenderDeleteConfirmationDialog () |
| void | RenderReferenceAnalysis (const std::string &presetID) |
Private Attributes | |
| ConditionPresetRegistry & | m_registry |
| Global preset registry. | |
| bool | m_isOpen = false |
| std::string | m_selectedPresetID |
| Highlighted preset ID. | |
| std::string | m_searchFilter |
| Current search text. | |
| bool | m_showDeleteConfirmation = false |
| std::string | m_presetToDelete |
| ID queued for deletion. | |
| std::map< std::string, std::vector< std::string > > | m_refMap |
| External reference map: nodeID -> list of preset IDs that node references. | |
ImGui panel for creating, editing, duplicating, and deleting global condition presets.
The panel uses ConditionPresetEditDialog internally for the create/edit workflow. Deletion requires confirmation via a modal dialog.
Optional callbacks allow the host (e.g. the Blueprint Editor) to react to preset lifecycle events:
Definition at line 58 of file ConditionPresetLibraryPanel.h.
|
explicit |
Constructs the panel with a reference to the preset registry.
| registry | The global ConditionPresetRegistry to operate on. |
Definition at line 27 of file ConditionPresetLibraryPanel.cpp.
|
default |
|
delete |
|
inline |
Closes the panel window.
Definition at line 84 of file ConditionPresetLibraryPanel.h.
References m_isOpen.
| std::vector< ConditionPreset > Olympe::ConditionPresetLibraryPanel::GetFilteredPresets | ( | ) | const |
Returns filtered presets based on the current search filter.
Delegates to ConditionPresetRegistry::GetFilteredPresets().
Definition at line 60 of file ConditionPresetLibraryPanel.cpp.
References Olympe::ConditionPresetRegistry::GetFilteredPresets(), m_registry, and m_searchFilter.
Referenced by RenderPresetList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Returns the ID of the preset pending deletion confirmation.
Definition at line 145 of file ConditionPresetLibraryPanel.h.
References m_presetToDelete.
| std::vector< std::string > Olympe::ConditionPresetLibraryPanel::GetReferencingNodes | ( | const std::string & | presetID | ) | const |
Returns a list of node IDs that reference the given preset.
| presetID | Preset ID to query. |
Definition at line 76 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), and m_refMap.
Referenced by RenderDeleteConfirmationDialog(), and RenderReferenceAnalysis().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Returns a reference to the registry managed by this panel.
Definition at line 150 of file ConditionPresetLibraryPanel.h.
References m_registry.
|
inline |
Returns the current search filter string.
Definition at line 124 of file ConditionPresetLibraryPanel.h.
References m_searchFilter.
|
inline |
Returns the currently selected preset ID (empty if none).
Definition at line 135 of file ConditionPresetLibraryPanel.h.
References m_selectedPresetID.
|
inline |
Returns true if the delete confirmation dialog is currently shown.
Definition at line 140 of file ConditionPresetLibraryPanel.h.
References m_showDeleteConfirmation.
|
inline |
Returns true if the panel window is open.
Definition at line 78 of file ConditionPresetLibraryPanel.h.
References m_isOpen.
| std::string Olympe::ConditionPresetLibraryPanel::OnAddPresetClicked | ( | ) |
Handles the "Add Preset" button.
Creates a new empty ConditionPreset in the registry. Fires OnPresetCreated with the new ID.
Definition at line 101 of file ConditionPresetLibraryPanel.cpp.
References Olympe::Operand::CreateConst(), Olympe::ConditionPresetRegistry::CreatePreset(), Olympe::Operand::CreateVariable(), Olympe::Equal, GetComponentTypeID_Static(), m_registry, m_selectedPresetID, Olympe::ConditionPreset::name, OnPresetCreated, ResolveResourcePath(), and Olympe::ConditionPresetRegistry::Save().
Here is the call graph for this function:| void Olympe::ConditionPresetLibraryPanel::OnDeleteCancelled | ( | ) |
Cancels the pending deletion and hides the confirmation dialog.
Definition at line 176 of file ConditionPresetLibraryPanel.cpp.
References m_presetToDelete, and m_showDeleteConfirmation.
Referenced by RenderDeleteConfirmationDialog().
Here is the caller graph for this function:Confirms the pending deletion.
Removes the preset from the registry and fires OnPresetDeleted. Resets m_showDeleteConfirmation to false.
| presetID | ID of the preset to delete (must match m_presetToDelete). |
Definition at line 149 of file ConditionPresetLibraryPanel.cpp.
References Olympe::ConditionPresetRegistry::DeletePreset(), m_presetToDelete, m_registry, m_selectedPresetID, m_showDeleteConfirmation, OnPresetDeleted, ResolveResourcePath(), and Olympe::ConditionPresetRegistry::Save().
Referenced by RenderDeleteConfirmationDialog().
Here is the call graph for this function:
Here is the caller graph for this function:Handles the "Delete" button for a preset.
Sets m_showDeleteConfirmation = true and records m_presetToDelete. Does NOT delete immediately; call OnDeleteConfirmed() to confirm.
| presetID | ID of the preset the user wants to delete. |
Definition at line 143 of file ConditionPresetLibraryPanel.cpp.
References m_presetToDelete, and m_showDeleteConfirmation.
Referenced by RenderPresetItem().
Here is the caller graph for this function:| std::string Olympe::ConditionPresetLibraryPanel::OnDuplicatePresetClicked | ( | const std::string & | presetID | ) |
Handles the "Duplicate" button for a preset.
Duplicates the preset in the registry. Fires OnPresetCreated with the new ID.
| presetID | ID of the preset to duplicate. |
Definition at line 126 of file ConditionPresetLibraryPanel.cpp.
References Olympe::ConditionPresetRegistry::DuplicatePreset(), GetComponentTypeID_Static(), m_registry, OnPresetCreated, ResolveResourcePath(), and Olympe::ConditionPresetRegistry::Save().
Referenced by RenderPresetItem().
Here is the call graph for this function:
Here is the caller graph for this function:Selects a preset (highlights it in the list).
| presetID | ID of the preset to select. |
Definition at line 51 of file ConditionPresetLibraryPanel.cpp.
References m_selectedPresetID.
Referenced by RenderPresetItem().
Here is the caller graph for this function:
|
inline |
Opens the panel window.
Definition at line 81 of file ConditionPresetLibraryPanel.h.
References m_isOpen.
|
delete |
| void Olympe::ConditionPresetLibraryPanel::Render | ( | ) |
Renders the full panel window using ImGui.
Must be called once per frame while the panel is open. No-op when !IsOpen().
Definition at line 186 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), m_isOpen, m_showDeleteConfirmation, RenderDeleteConfirmationDialog(), RenderPresetList(), and RenderToolbar().
Here is the call graph for this function:
|
private |
Definition at line 291 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetPreset(), GetReferencingNodes(), m_presetToDelete, m_registry, OnDeleteCancelled(), and OnDeleteConfirmed().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 247 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), m_selectedPresetID, OnDeletePresetClicked(), OnDuplicatePresetClicked(), OnPresetSelected(), and RenderReferenceAnalysis().
Referenced by RenderPresetList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 235 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), GetFilteredPresets(), and RenderPresetItem().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 328 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), and GetReferencingNodes().
Referenced by RenderPresetItem().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 215 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), and m_searchFilter.
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::ConditionPresetLibraryPanel::SetReferenceMap | ( | const std::map< std::string, std::vector< std::string > > & | refMap | ) |
Sets the reference analysis map (nodeID -> list of preset IDs used).
This data is supplied externally by the host (e.g. Blueprint Editor) and used to display "Used by: Node_A, Node_C" in the panel.
| refMap | Map from nodeID to vector of preset IDs that node uses. |
Definition at line 69 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), and m_refMap.
Here is the call graph for this function:Sets the search filter string (case-insensitive substring).
| filter | Filter text. Empty string shows all presets. |
Definition at line 37 of file ConditionPresetLibraryPanel.cpp.
References GetComponentTypeID_Static(), and m_searchFilter.
Here is the call graph for this function:Selects the preset with the given ID.
| id | Preset ID to select, or empty string to deselect. |
Definition at line 46 of file ConditionPresetLibraryPanel.cpp.
References m_selectedPresetID.
|
private |
ID queued for deletion.
Definition at line 252 of file ConditionPresetLibraryPanel.h.
Referenced by GetPresetToDelete(), OnDeleteCancelled(), OnDeleteConfirmed(), OnDeletePresetClicked(), and RenderDeleteConfirmationDialog().
|
private |
External reference map: nodeID -> list of preset IDs that node references.
Definition at line 255 of file ConditionPresetLibraryPanel.h.
Referenced by GetReferencingNodes(), and SetReferenceMap().
|
private |
Global preset registry.
Definition at line 247 of file ConditionPresetLibraryPanel.h.
Referenced by GetFilteredPresets(), GetRegistry(), OnAddPresetClicked(), OnDeleteConfirmed(), OnDuplicatePresetClicked(), and RenderDeleteConfirmationDialog().
|
private |
Current search text.
Definition at line 250 of file ConditionPresetLibraryPanel.h.
Referenced by GetFilteredPresets(), GetSearchFilter(), RenderToolbar(), and SetSearchFilter().
|
private |
Highlighted preset ID.
Definition at line 249 of file ConditionPresetLibraryPanel.h.
Referenced by GetSelectedPresetID(), OnAddPresetClicked(), OnDeleteConfirmed(), OnPresetSelected(), RenderPresetItem(), and SetSelectedPresetID().
Definition at line 251 of file ConditionPresetLibraryPanel.h.
Referenced by IsDeleteConfirmationVisible(), OnDeleteCancelled(), OnDeleteConfirmed(), OnDeletePresetClicked(), and Render().
Invoked after a new preset is added.
Arg: preset ID.
Definition at line 103 of file ConditionPresetLibraryPanel.h.
Referenced by OnAddPresetClicked(), and OnDuplicatePresetClicked().
Invoked after a preset is deleted.
Arg: preset ID.
Definition at line 109 of file ConditionPresetLibraryPanel.h.
Referenced by OnDeleteConfirmed().
Invoked after an existing preset is modified.
Arg: preset ID.
Definition at line 106 of file ConditionPresetLibraryPanel.h.