Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Olympe::DynamicDataPinManager Class Reference

Generates, tracks, and invalidates DynamicDataPin objects for a node. More...

#include <DynamicDataPinManager.h>

+ Collaboration diagram for Olympe::DynamicDataPinManager:

Public Member Functions

 DynamicDataPinManager (ConditionPresetRegistry &registry)
 Constructs the manager bound to the global preset registry.
 
 ~DynamicDataPinManager ()=default
 
 DynamicDataPinManager (const DynamicDataPinManager &)=delete
 
DynamicDataPinManageroperator= (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 DynamicDataPinGetPinByID (const std::string &pinID) const
 Returns a pointer to the pin with the given UUID, or nullptr.
 
DynamicDataPinGetPinByID (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

DynamicDataPinFindExistingPin (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

ConditionPresetRegistrym_registry
 Shared global registry.
 
std::vector< DynamicDataPinm_pins
 Ordered pin list.
 
std::map< std::string, size_tm_idIndex
 UUID -> index in m_pins (O(1))
 
std::map< std::string, size_tm_keyIndex
 (condIdx,side) -> index in m_pins
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DynamicDataPinManager() [1/2]

Olympe::DynamicDataPinManager::DynamicDataPinManager ( ConditionPresetRegistry registry)
explicit

Constructs the manager bound to the global preset registry.

Parameters
registryGlobal ConditionPresetRegistry (must outlive this manager).

Definition at line 22 of file DynamicDataPinManager.cpp.

◆ ~DynamicDataPinManager()

Olympe::DynamicDataPinManager::~DynamicDataPinManager ( )
default

◆ DynamicDataPinManager() [2/2]

Olympe::DynamicDataPinManager::DynamicDataPinManager ( const DynamicDataPinManager )
delete

Member Function Documentation

◆ Clear()

void Olympe::DynamicDataPinManager::Clear ( )

Removes all managed pins.

Definition at line 235 of file DynamicDataPinManager.cpp.

◆ FindExistingPin()

DynamicDataPin * Olympe::DynamicDataPinManager::FindExistingPin ( int  conditionIndex,
OperandPosition  pos 
)
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:

◆ GetAllPins()

const std::vector< DynamicDataPin > & Olympe::DynamicDataPinManager::GetAllPins ( ) const

Returns all current DynamicDataPins in creation order.

Definition at line 169 of file DynamicDataPinManager.cpp.

◆ GetDynamicPinColor()

void Olympe::DynamicDataPinManager::GetDynamicPinColor ( float r,
float g,
float b,
float a 
)
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:

◆ GetPinByID() [1/2]

DynamicDataPin * Olympe::DynamicDataPinManager::GetPinByID ( const std::string &  pinID)

Returns a mutable pointer to the pin with the given UUID.

Parameters
pinIDUUID to look up.

Definition at line 182 of file DynamicDataPinManager.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ GetPinByID() [2/2]

const DynamicDataPin * Olympe::DynamicDataPinManager::GetPinByID ( const std::string &  pinID) const

Returns a pointer to the pin with the given UUID, or nullptr.

Parameters
pinIDUUID 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:

◆ GetPinCount()

size_t Olympe::DynamicDataPinManager::GetPinCount ( ) const

Returns the total number of managed pins.

Definition at line 202 of file DynamicDataPinManager.cpp.

◆ GetPinsForCondition()

std::vector< const DynamicDataPin * > Olympe::DynamicDataPinManager::GetPinsForCondition ( int  conditionIndex) const

Returns all pins associated with a specific condition index.

Parameters
conditionIndexZero-based condition index.

Definition at line 191 of file DynamicDataPinManager.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ InvalidatePreset()

void Olympe::DynamicDataPinManager::InvalidatePreset ( const std::string &  deletedPresetID)

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.

Parameters
deletedPresetIDUUID of the preset being deleted.

Definition at line 211 of file DynamicDataPinManager.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ MakePinKey()

std::string Olympe::DynamicDataPinManager::MakePinKey ( int  conditionIndex,
OperandPosition  pos 
)
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:

◆ operator=()

DynamicDataPinManager & Olympe::DynamicDataPinManager::operator= ( const DynamicDataPinManager )
delete

◆ RegeneratePinsFromConditions()

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).

Parameters
conditionRefsNode's condition list (modified in-place).
operandRefsOptional: 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:

◆ SyncPins()

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:

  1. Walks every NodeConditionRef in conditionRefs.
  2. For each one, looks up the ConditionPreset in the registry.
  3. If the preset's left operand is Pin-mode -> ensures a Left DynamicDataPin exists for that condition index.
  4. Same for the right operand.
  5. Removes any existing pins that no longer correspond to a Pin-mode operand in a valid preset.

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).

Parameters
conditionRefsNode's condition list (modified in-place to store assigned pin IDs).
operandRefsOptional: 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:

Member Data Documentation

◆ m_idIndex

std::map<std::string, size_t> Olympe::DynamicDataPinManager::m_idIndex
private

UUID -> index in m_pins (O(1))

Definition at line 223 of file DynamicDataPinManager.h.

◆ m_keyIndex

std::map<std::string, size_t> Olympe::DynamicDataPinManager::m_keyIndex
private

(condIdx,side) -> index in m_pins

Definition at line 224 of file DynamicDataPinManager.h.

◆ m_pins

std::vector<DynamicDataPin> Olympe::DynamicDataPinManager::m_pins
private

Ordered pin list.

Definition at line 222 of file DynamicDataPinManager.h.

◆ m_registry

ConditionPresetRegistry& Olympe::DynamicDataPinManager::m_registry
private

Shared global registry.

Definition at line 221 of file DynamicDataPinManager.h.

Referenced by SyncPins().


The documentation for this class was generated from the following files: