![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Generates, tracks, and invalidates DynamicDataPin objects for a node. More...
#include <DynamicDataPinManager.h>
Collaboration diagram for Olympe::DynamicDataPinManager:Public Member Functions | |
| DynamicDataPinManager (ConditionPresetRegistry ®istry) | |
| Constructs the manager bound to the global preset registry. | |
| ~DynamicDataPinManager ()=default | |
| DynamicDataPinManager (const DynamicDataPinManager &)=delete | |
| DynamicDataPinManager & | operator= (const DynamicDataPinManager &)=delete |
| void | SyncPins (std::vector< NodeConditionRef > &conditionRefs, const std::vector< ConditionRef > &operandRefs=std::vector< ConditionRef >()) |
| Rebuilds the pin set to match the given condition list. | |
| void | RegeneratePinsFromConditions (std::vector< NodeConditionRef > &conditionRefs, const std::vector< ConditionRef > &operandRefs=std::vector< ConditionRef >()) |
| Regenerates pins from the current condition list. | |
| const std::vector< DynamicDataPin > & | GetAllPins () const |
| Returns all current DynamicDataPins in creation order. | |
| const DynamicDataPin * | GetPinByID (const std::string &pinID) const |
| Returns a pointer to the pin with the given UUID, or nullptr. | |
| DynamicDataPin * | GetPinByID (const std::string &pinID) |
| Returns a mutable pointer to the pin with the given UUID. | |
| std::vector< const DynamicDataPin * > | GetPinsForCondition (int conditionIndex) const |
| Returns all pins associated with a specific condition index. | |
| size_t | GetPinCount () const |
| Returns the total number of managed pins. | |
| void | InvalidatePreset (const std::string &deletedPresetID) |
| Removes all pins that belong to the given preset. | |
| void | Clear () |
| Removes all managed pins. | |
Static Public Member Functions | |
| static void | GetDynamicPinColor (float &r, float &g, float &b, float &a) |
| Returns the RGBA color used to render dynamic data pins. | |
Private Member Functions | |
| DynamicDataPin * | FindExistingPin (int conditionIndex, OperandPosition pos) |
| Looks for an existing pin matching (conditionIndex, position). | |
Static Private Member Functions | |
| static std::string | MakePinKey (int conditionIndex, OperandPosition pos) |
| Builds a unique key for the (conditionIndex, position) pair used in the lookup map. | |
Private Attributes | |
| ConditionPresetRegistry & | m_registry |
| Shared global registry. | |
| std::vector< DynamicDataPin > | m_pins |
| Ordered pin list. | |
| std::map< std::string, size_t > | m_idIndex |
| UUID -> index in m_pins (O(1)) | |
| std::map< std::string, size_t > | m_keyIndex |
| (condIdx,side) -> index in m_pins | |
Generates, tracks, and invalidates DynamicDataPin objects for a node.
The manager is bound to a single NodeBranch (one per node). It operates on the node's conditions list and produces the matching dynamicPins list.
Thread safety: single-threaded editor context only.
Definition at line 60 of file DynamicDataPinManager.h.
|
explicit |
Constructs the manager bound to the global preset registry.
| registry | Global ConditionPresetRegistry (must outlive this manager). |
Definition at line 22 of file DynamicDataPinManager.cpp.
|
default |
|
delete |
| void Olympe::DynamicDataPinManager::Clear | ( | ) |
Removes all managed pins.
Definition at line 235 of file DynamicDataPinManager.cpp.
|
private |
Looks for an existing pin matching (conditionIndex, position).
Returns a pointer into m_pins, or nullptr if not found.
Definition at line 261 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| const std::vector< DynamicDataPin > & Olympe::DynamicDataPinManager::GetAllPins | ( | ) | const |
Returns all current DynamicDataPins in creation order.
Definition at line 169 of file DynamicDataPinManager.cpp.
|
static |
Returns the RGBA color used to render dynamic data pins.
Always returns yellow: { 1.0f, 1.0f, 0.0f, 1.0f }. The caller can pass this to ImGui::PushStyleColor(ImGuiCol_Text, …).
Definition at line 247 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| DynamicDataPin * Olympe::DynamicDataPinManager::GetPinByID | ( | const std::string & | pinID | ) |
Returns a mutable pointer to the pin with the given UUID.
| pinID | UUID to look up. |
Definition at line 182 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| const DynamicDataPin * Olympe::DynamicDataPinManager::GetPinByID | ( | const std::string & | pinID | ) | const |
Returns a pointer to the pin with the given UUID, or nullptr.
| pinID | UUID to look up (O(1) via internal map). |
Definition at line 174 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| size_t Olympe::DynamicDataPinManager::GetPinCount | ( | ) | const |
Returns the total number of managed pins.
Definition at line 202 of file DynamicDataPinManager.cpp.
| std::vector< const DynamicDataPin * > Olympe::DynamicDataPinManager::GetPinsForCondition | ( | int | conditionIndex | ) | const |
Returns all pins associated with a specific condition index.
| conditionIndex | Zero-based condition index. |
Definition at line 191 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:Removes all pins that belong to the given preset.
Should be called when a preset is deleted from the registry so that stale pins are cleaned up. Also clears leftPinID / rightPinID in any cached condition refs that pointed to the deleted preset's pins.
| deletedPresetID | UUID of the preset being deleted. |
Definition at line 211 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:
|
staticprivate |
Builds a unique key for the (conditionIndex, position) pair used in the lookup map.
Definition at line 270 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:
|
delete |
| void Olympe::DynamicDataPinManager::RegeneratePinsFromConditions | ( | std::vector< NodeConditionRef > & | conditionRefs, |
| const std::vector< ConditionRef > & | operandRefs = std::vector<ConditionRef>() |
||
| ) |
Regenerates pins from the current condition list.
Convenience alias for SyncPins(). Called by NodeBranchRenderer and NodeConditionsPanel after the user confirms changes in the edit modal.
Walks every NodeConditionRef, looks up the ConditionPreset in the registry, and creates/destroys yellow DynamicDataPins for every operand whose BindingType is Pin. Pre-existing pin UUIDs are reused so that graph connections survive minor edits.
Also updates leftPinID / rightPinID inside each NodeConditionRef.
Phase 24: When operandRefs is provided, pin labels are built from the ACTUAL operand data (not the static preset preview), allowing dynamic updates when users change operand modes (e.g., Const -> Pin).
| conditionRefs | Node's condition list (modified in-place). |
| operandRefs | Optional: actual operand data for dynamic label building. If empty, falls back to preset preview. |
Definition at line 155 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static().
Referenced by Olympe::NodeBranchRenderer::TriggerPinRegeneration().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::DynamicDataPinManager::SyncPins | ( | std::vector< NodeConditionRef > & | conditionRefs, |
| const std::vector< ConditionRef > & | operandRefs = std::vector<ConditionRef>() |
||
| ) |
Rebuilds the pin set to match the given condition list.
The method:
conditionRefs.Pre-existing pin UUIDs are reused when condition-index + operand-side match, so graph connections survive minor edits.
Also updates the leftPinID and rightPinID fields inside each NodeConditionRef in the provided vector.
Phase 24: When operandRefs is provided, pin labels are built from the ACTUAL operand data (not the static preset preview), allowing dynamic updates when users change operand modes (e.g., Const -> Pin).
| conditionRefs | Node's condition list (modified in-place to store assigned pin IDs). |
| operandRefs | Optional: actual operand data for dynamic label building. If empty, falls back to preset preview. |
Definition at line 31 of file DynamicDataPinManager.cpp.
References GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetPreset(), Olympe::Left, m_registry, Olympe::ConditionRef::operatorStr, Olympe::OperandRef::Pin, Olympe::Right, and Olympe::OperandRef::Variable.
Here is the call graph for this function:
|
private |
UUID -> index in m_pins (O(1))
Definition at line 223 of file DynamicDataPinManager.h.
|
private |
(condIdx,side) -> index in m_pins
Definition at line 224 of file DynamicDataPinManager.h.
|
private |
Ordered pin list.
Definition at line 222 of file DynamicDataPinManager.h.
|
private |
Shared global registry.
Definition at line 221 of file DynamicDataPinManager.h.
Referenced by SyncPins().