![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Modal dialog for adding, removing, and reordering conditions on a node. More...
#include <NodeConditionsEditModal.h>
Collaboration diagram for Olympe::NodeConditionsEditModal:Public Member Functions | |
| NodeConditionsEditModal (ConditionPresetRegistry ®istry) | |
| Constructs the modal bound to a global preset registry. | |
| ~NodeConditionsEditModal ()=default | |
| NodeConditionsEditModal (const NodeConditionsEditModal &)=delete | |
| NodeConditionsEditModal & | operator= (const NodeConditionsEditModal &)=delete |
| bool | IsOpen () const |
| Returns true if the modal is currently open. | |
| void | Open (const std::vector< NodeConditionRef > ¤tRefs, const std::vector< ConditionRef > &operandRefs=std::vector< ConditionRef >()) |
| Opens the modal, loading the given condition refs for editing. | |
| void | Close () |
| Closes the modal without confirming changes. | |
| bool | IsConfirmed () const |
| Returns true if the user clicked "Apply" and the modal was closed. | |
| const std::vector< NodeConditionRef > & | GetConditionRefs () const |
| Returns the edited condition ref list. | |
| const std::vector< ConditionRef > & | GetConditionOperandRefs () const |
| Returns the edited operand ref list (Phase 24). | |
| size_t | GetConditionCount () const |
| Returns the number of conditions in the working copy. | |
| void | AddCondition (const std::string &presetID) |
| Appends a new condition for the given preset to the working copy. | |
| void | RemoveCondition (size_t index) |
| Removes the condition at the given index from the working copy. | |
| void | SetLogicalOp (size_t index, LogicalOp op) |
| Sets the logical operator for the condition at the given index. | |
| void | MoveConditionUp (size_t index) |
Moves the condition at index one position earlier (swap with index-1). | |
| void | MoveConditionDown (size_t index) |
Moves the condition at index one position later (swap with index+1). | |
| void | Confirm () |
| Programmatically confirms the modal (equivalent to clicking Apply). | |
| void | SetLocalVariables (const std::vector< BlackboardEntry > &localVars) |
| Sets the list of local variables for combo population. | |
| void | SetDropdownFilter (const std::string &filter) |
| Sets the search filter for the "Add Condition" preset picker. | |
| const std::string & | GetDropdownFilter () const |
| Returns the current dropdown filter string. | |
| std::vector< ConditionPreset > | GetFilteredPresetsForDropdown () const |
| Returns presets matching the current dropdown filter. | |
| void | Render () |
| Renders the modal dialog using ImGui. | |
Public Attributes | |
| std::function< void()> | OnApply |
| Optional callback fired when the user clicks "Apply" (Confirm). | |
Private Member Functions | |
| void | RenderConditionRow (size_t index, const NodeConditionRef &ref) |
| void | RenderAddConditionPicker () |
| void | RenderFooterButtons () |
| void | NormalizeLogicalOps () |
| Ensures the first condition's logicalOp is always Start. | |
Private Attributes | |
| ConditionPresetRegistry & | m_registry |
| Shared global registry. | |
| std::vector< NodeConditionRef > | m_workingCopy |
| Editable in-progress copy. | |
| std::vector< ConditionRef > | m_workingCopyOperandRefs |
| Phase 24: Operand data. | |
| bool | m_isOpen = false |
| bool | m_isConfirmed = false |
| std::string | m_dropdownFilter |
| Preset-picker search filter. | |
| bool | m_pickerOpen = false |
| Whether the add-preset picker is open. | |
| std::vector< BlackboardEntry > | m_localVariables |
| Phase 24: Local variables for combo. | |
Modal dialog for adding, removing, and reordering conditions on a node.
The modal contains:
Definition at line 62 of file NodeConditionsEditModal.h.
|
explicit |
Constructs the modal bound to a global preset registry.
| registry | Global ConditionPresetRegistry (must outlive this modal). |
Definition at line 26 of file NodeConditionsEditModal.cpp.
|
default |
|
delete |
Appends a new condition for the given preset to the working copy.
The logicalOp defaults to And (Start for the first condition).
| presetID | UUID of the preset to add. |
Definition at line 76 of file NodeConditionsEditModal.cpp.
References Olympe::And, m_workingCopy, NormalizeLogicalOps(), and Olympe::Start.
Referenced by RenderAddConditionPicker().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::NodeConditionsEditModal::Close | ( | ) |
Closes the modal without confirming changes.
Definition at line 47 of file NodeConditionsEditModal.cpp.
References m_isOpen, and m_pickerOpen.
Referenced by Confirm(), and RenderFooterButtons().
Here is the caller graph for this function:| void Olympe::NodeConditionsEditModal::Confirm | ( | ) |
Programmatically confirms the modal (equivalent to clicking Apply).
Marks the modal as confirmed and closes it. Always succeeds. Fires the OnApply callback (if set) before closing.
Definition at line 121 of file NodeConditionsEditModal.cpp.
References Close(), m_isConfirmed, and OnApply.
Referenced by RenderFooterButtons().
Here is the call graph for this function:
Here is the caller graph for this function:| size_t Olympe::NodeConditionsEditModal::GetConditionCount | ( | ) | const |
Returns the number of conditions in the working copy.
Definition at line 71 of file NodeConditionsEditModal.cpp.
References m_workingCopy.
| const std::vector< ConditionRef > & Olympe::NodeConditionsEditModal::GetConditionOperandRefs | ( | ) | const |
Returns the edited operand ref list (Phase 24).
Only meaningful when IsConfirmed() is true.
Definition at line 62 of file NodeConditionsEditModal.cpp.
References m_workingCopyOperandRefs.
| const std::vector< NodeConditionRef > & Olympe::NodeConditionsEditModal::GetConditionRefs | ( | ) | const |
Returns the edited condition ref list.
Only meaningful when IsConfirmed() is true.
Definition at line 57 of file NodeConditionsEditModal.cpp.
References m_workingCopy.
|
inline |
Returns the current dropdown filter string.
Definition at line 229 of file NodeConditionsEditModal.h.
References m_dropdownFilter.
| std::vector< ConditionPreset > Olympe::NodeConditionsEditModal::GetFilteredPresetsForDropdown | ( | ) | const |
Returns presets matching the current dropdown filter.
Definition at line 139 of file NodeConditionsEditModal.cpp.
References Olympe::ConditionPresetRegistry::FindPresetsByName(), Olympe::ConditionPresetRegistry::GetAllPresetIDs(), GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetPreset(), m_dropdownFilter, and m_registry.
Referenced by RenderAddConditionPicker().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Returns true if the user clicked "Apply" and the modal was closed.
Reset by Open().
Definition at line 106 of file NodeConditionsEditModal.h.
References m_isConfirmed.
|
inline |
Returns true if the modal is currently open.
Definition at line 84 of file NodeConditionsEditModal.h.
References m_isOpen.
Moves the condition at index one position later (swap with index+1).
No-op when index is the last element.
| index | Zero-based index. |
Definition at line 112 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_workingCopy, and NormalizeLogicalOps().
Referenced by RenderConditionRow().
Here is the call graph for this function:
Here is the caller graph for this function:Moves the condition at index one position earlier (swap with index-1).
No-op when index == 0.
| index | Zero-based index. |
Definition at line 103 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_workingCopy, and NormalizeLogicalOps().
Referenced by RenderConditionRow().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Ensures the first condition's logicalOp is always Start.
Definition at line 305 of file NodeConditionsEditModal.cpp.
References m_workingCopy, and Olympe::Start.
Referenced by AddCondition(), MoveConditionDown(), MoveConditionUp(), Open(), and RemoveCondition().
Here is the caller graph for this function:| void Olympe::NodeConditionsEditModal::Open | ( | const std::vector< NodeConditionRef > & | currentRefs, |
| const std::vector< ConditionRef > & | operandRefs = std::vector<ConditionRef>() |
||
| ) |
Opens the modal, loading the given condition refs for editing.
Resets the confirmed flag and takes a COPY of the refs to edit.
| currentRefs | Condition refs from the selected node. |
Definition at line 35 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_dropdownFilter, m_isConfirmed, m_isOpen, m_pickerOpen, m_workingCopy, m_workingCopyOperandRefs, and NormalizeLogicalOps().
Referenced by Olympe::NodeConditionsPanel::RenderConditionsPreview().
Here is the call graph for this function:
Here is the caller graph for this function:
|
delete |
Removes the condition at the given index from the working copy.
| index | Zero-based index. |
Definition at line 86 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_workingCopy, and NormalizeLogicalOps().
Referenced by RenderConditionRow().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::NodeConditionsEditModal::Render | ( | ) |
Renders the modal dialog using ImGui.
Must be called once per frame from the host's render loop. No-op when !IsOpen().
Definition at line 169 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_isOpen, m_workingCopy, RenderAddConditionPicker(), RenderConditionRow(), and RenderFooterButtons().
Here is the call graph for this function:
|
private |
Definition at line 257 of file NodeConditionsEditModal.cpp.
References AddCondition(), GetComponentTypeID_Static(), GetFilteredPresetsForDropdown(), m_pickerOpen, and SetDropdownFilter().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 204 of file NodeConditionsEditModal.cpp.
References Olympe::And, GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetPreset(), m_registry, MoveConditionDown(), MoveConditionUp(), Olympe::Or, RemoveCondition(), and SetLogicalOp().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 288 of file NodeConditionsEditModal.cpp.
References Close(), Confirm(), and GetComponentTypeID_Static().
Referenced by Render().
Here is the call graph for this function:
Here is the caller graph for this function:Sets the search filter for the "Add Condition" preset picker.
| filter | Substring filter (empty = show all). |
Definition at line 133 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), and m_dropdownFilter.
Referenced by RenderAddConditionPicker().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Sets the list of local variables for combo population.
| localVars | Vector of local blackboard entries. |
Definition at line 211 of file NodeConditionsEditModal.h.
References GetComponentTypeID_Static(), and m_localVariables.
Here is the call graph for this function:Sets the logical operator for the condition at the given index.
Index 0 is always forced to LogicalOp::Start.
| index | Zero-based index. |
| op | Desired operator (And or Or). |
Definition at line 95 of file NodeConditionsEditModal.cpp.
References GetComponentTypeID_Static(), m_workingCopy, and Olympe::Start.
Referenced by RenderConditionRow().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Preset-picker search filter.
Definition at line 275 of file NodeConditionsEditModal.h.
Referenced by GetDropdownFilter(), GetFilteredPresetsForDropdown(), Open(), and SetDropdownFilter().
Definition at line 273 of file NodeConditionsEditModal.h.
Referenced by Confirm(), IsConfirmed(), and Open().
|
private |
Phase 24: Local variables for combo.
Definition at line 277 of file NodeConditionsEditModal.h.
Referenced by SetLocalVariables().
Whether the add-preset picker is open.
Definition at line 276 of file NodeConditionsEditModal.h.
Referenced by Close(), Open(), and RenderAddConditionPicker().
|
private |
Shared global registry.
Definition at line 269 of file NodeConditionsEditModal.h.
Referenced by GetFilteredPresetsForDropdown(), and RenderConditionRow().
|
private |
Editable in-progress copy.
Definition at line 270 of file NodeConditionsEditModal.h.
Referenced by AddCondition(), GetConditionCount(), GetConditionRefs(), MoveConditionDown(), MoveConditionUp(), NormalizeLogicalOps(), Open(), RemoveCondition(), Render(), and SetLogicalOp().
|
private |
Phase 24: Operand data.
Definition at line 271 of file NodeConditionsEditModal.h.
Referenced by GetConditionOperandRefs(), and Open().
| std::function<void()> Olympe::NodeConditionsEditModal::OnApply |
Optional callback fired when the user clicks "Apply" (Confirm).
Set this before opening the modal. The callback is invoked from within Confirm() after m_isConfirmed is set but before Close() is called, allowing the host to read GetConditionRefs() synchronously.
Example:
Definition at line 201 of file NodeConditionsEditModal.h.
Referenced by Confirm().