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

ImGui sub-panel for editing MathOp operands and operator. More...

#include <MathOpPropertyPanel.h>

+ Collaboration diagram for Olympe::MathOpPropertyPanel:

Public Member Functions

 MathOpPropertyPanel (ConditionPresetRegistry &registry, DynamicDataPinManager &dynamicPinMgr)
 Constructs the panel bound to a preset registry.
 
 ~MathOpPropertyPanel ()=default
 
 MathOpPropertyPanel (const MathOpPropertyPanel &)=delete
 
MathOpPropertyPaneloperator= (const MathOpPropertyPanel &)=delete
 
void SetMathOpRef (const MathOpRef &ref)
 Sets the MathOpRef to edit.
 
const MathOpRefGetMathOpRef () const
 Returns the current (possibly modified) MathOpRef.
 
void SetDynamicPins (const std::vector< DynamicDataPin > &pins)
 Provides the read-only list of dynamic pins for display.
 
void SetNodeName (const std::string &name)
 Sets the node name displayed in the title section.
 
bool IsDirty () const
 Returns true if the operand or operator has been modified since the last call to ClearDirty().
 
void ClearDirty ()
 Resets the dirty flag.
 
void SetOnOperandChange (std::function< void()> cb)
 Registers a callback to be invoked when Pin-mode operands change.
 
void Render ()
 Renders the panel into the current ImGui context.
 

Private Member Functions

void RenderTitleSection ()
 Renders the title section (node name in blue background).
 
void RenderInlineOperandEditor ()
 Renders the operand editor (collapsible section with 3 rows).
 
void RenderOperandRow (int rowIndex, MathOpOperand &operand)
 Renders one operand row with mode selector and value input.
 
void RenderOperatorSelector ()
 Renders the operator dropdown ("+", "-", "*", "/", "%", "^").
 
void RenderDynamicPinsSection ()
 Renders the dynamic pins section (read-only display).
 
void RenderVariableModeInput (MathOpOperand &operand)
 Helper to render Variable mode input field.
 
void RenderConstModeInput (MathOpOperand &operand)
 Helper to render Const mode input field.
 
void RenderPinModeSelector (MathOpOperand &operand)
 Helper to render Pin mode selector (list of available pins).
 

Private Attributes

ConditionPresetRegistrym_registry
 Global preset registry.
 
DynamicDataPinManagerm_dynamicPinMgr
 Pin generation manager.
 
std::string m_nodeName
 Node name for display.
 
MathOpRef m_mathOpRef
 Current operand configuration.
 
std::vector< DynamicDataPinm_dynamicPins
 Read-only dynamic pins display.
 
bool m_operandEditorOpen = true
 Collapsible section state.
 
bool m_dirty = false
 Changed since last ClearDirty()
 
std::function< void()> m_onOperandChange
 Callback when operands change.
 

Detailed Description

ImGui sub-panel for editing MathOp operands and operator.

The panel does NOT own the data — it holds references. The caller is responsible for persisting changes from GetMathOpRef() back to the node definition.

Dependency injection: MathOpPropertyPanel panel(registry, dynamicPinManager); panel.SetMathOpRef(node.mathOpRef); panel.SetDynamicPins(node.dynamicPins); panel.SetNodeName(node.NodeName); panel.Render(); if (panel.IsDirty()) { node.mathOpRef = panel.GetMathOpRef(); panel.ClearDirty(); }

Definition at line 53 of file MathOpPropertyPanel.h.

Constructor & Destructor Documentation

◆ MathOpPropertyPanel() [1/2]

Olympe::MathOpPropertyPanel::MathOpPropertyPanel ( ConditionPresetRegistry registry,
DynamicDataPinManager dynamicPinMgr 
)
explicit

Constructs the panel bound to a preset registry.

Parameters
registryGlobal ConditionPresetRegistry (must outlive this panel).
dynamicPinMgrDynamicDataPinManager for Pin-mode generation.

Definition at line 17 of file MathOpPropertyPanel.cpp.

◆ ~MathOpPropertyPanel()

Olympe::MathOpPropertyPanel::~MathOpPropertyPanel ( )
default

◆ MathOpPropertyPanel() [2/2]

Olympe::MathOpPropertyPanel::MathOpPropertyPanel ( const MathOpPropertyPanel )
delete

Member Function Documentation

◆ ClearDirty()

void Olympe::MathOpPropertyPanel::ClearDirty ( )
inline

Resets the dirty flag.

Definition at line 107 of file MathOpPropertyPanel.h.

References m_dirty.

◆ GetMathOpRef()

const MathOpRef & Olympe::MathOpPropertyPanel::GetMathOpRef ( ) const

Returns the current (possibly modified) MathOpRef.

Definition at line 33 of file MathOpPropertyPanel.cpp.

References m_mathOpRef.

◆ IsDirty()

bool Olympe::MathOpPropertyPanel::IsDirty ( ) const
inline

Returns true if the operand or operator has been modified since the last call to ClearDirty().

Definition at line 102 of file MathOpPropertyPanel.h.

References m_dirty.

◆ operator=()

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

◆ Render()

void Olympe::MathOpPropertyPanel::Render ( )

Renders the panel into the current ImGui context.

Must be called between ImGui::Begin() / ImGui::End() or within a child window. Handles layout, operand editors, and state synchronization.

Definition at line 52 of file MathOpPropertyPanel.cpp.

References m_dynamicPins, RenderDynamicPinsSection(), RenderInlineOperandEditor(), and RenderTitleSection().

+ Here is the call graph for this function:

◆ RenderConstModeInput()

void Olympe::MathOpPropertyPanel::RenderConstModeInput ( MathOpOperand operand)
private

Helper to render Const mode input field.

Definition at line 156 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), and m_dirty.

Referenced by RenderOperandRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderDynamicPinsSection()

void Olympe::MathOpPropertyPanel::RenderDynamicPinsSection ( )
private

Renders the dynamic pins section (read-only display).

Definition at line 217 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), and m_dynamicPins.

Referenced by Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderInlineOperandEditor()

void Olympe::MathOpPropertyPanel::RenderInlineOperandEditor ( )
private

Renders the operand editor (collapsible section with 3 rows).

Definition at line 72 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), Olympe::MathOpRef::leftOperand, m_mathOpRef, RenderOperandRow(), RenderOperatorSelector(), and Olympe::MathOpRef::rightOperand.

Referenced by Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderOperandRow()

void Olympe::MathOpPropertyPanel::RenderOperandRow ( int  rowIndex,
MathOpOperand operand 
)
private

Renders one operand row with mode selector and value input.

Parameters
rowIndex0 = left operand, 1 = right operand
operandMathOpOperand to edit

Definition at line 106 of file MathOpPropertyPanel.cpp.

References Olympe::MathOpOperand::Const, GetComponentTypeID_Static(), m_dirty, m_onOperandChange, Olympe::MathOpOperand::Pin, RenderConstModeInput(), RenderPinModeSelector(), RenderVariableModeInput(), and Olympe::MathOpOperand::Variable.

Referenced by RenderInlineOperandEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderOperatorSelector()

void Olympe::MathOpPropertyPanel::RenderOperatorSelector ( )
private

Renders the operator dropdown ("+", "-", "*", "/", "%", "^").

Definition at line 196 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), m_dirty, m_mathOpRef, and Olympe::MathOpRef::mathOperator.

Referenced by RenderInlineOperandEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderPinModeSelector()

void Olympe::MathOpPropertyPanel::RenderPinModeSelector ( MathOpOperand operand)
private

Helper to render Pin mode selector (list of available pins).

Definition at line 170 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), m_dirty, m_dynamicPins, and m_onOperandChange.

Referenced by RenderOperandRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderTitleSection()

void Olympe::MathOpPropertyPanel::RenderTitleSection ( )
private

Renders the title section (node name in blue background).

Definition at line 65 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), and m_nodeName.

Referenced by Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderVariableModeInput()

void Olympe::MathOpPropertyPanel::RenderVariableModeInput ( MathOpOperand operand)
private

Helper to render Variable mode input field.

Definition at line 139 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), m_dirty, and m_onOperandChange.

Referenced by RenderOperandRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDynamicPins()

void Olympe::MathOpPropertyPanel::SetDynamicPins ( const std::vector< DynamicDataPin > &  pins)

Provides the read-only list of dynamic pins for display.

Parameters
pinsCurrent dynamic pins associated with this MathOp node.

Definition at line 38 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), and m_dynamicPins.

+ Here is the call graph for this function:

◆ SetMathOpRef()

void Olympe::MathOpPropertyPanel::SetMathOpRef ( const MathOpRef ref)

Sets the MathOpRef to edit.

Parameters
refMathOpRef from node.mathOpRef.

Definition at line 28 of file MathOpPropertyPanel.cpp.

References GetComponentTypeID_Static(), and m_mathOpRef.

+ Here is the call graph for this function:

◆ SetNodeName()

void Olympe::MathOpPropertyPanel::SetNodeName ( const std::string &  name)

Sets the node name displayed in the title section.

Parameters
nameHuman-readable node name (e.g., "MathOp_1").

Definition at line 43 of file MathOpPropertyPanel.cpp.

References m_nodeName.

◆ SetOnOperandChange()

void Olympe::MathOpPropertyPanel::SetOnOperandChange ( std::function< void()>  cb)
inline

Registers a callback to be invoked when Pin-mode operands change.

The callback should regenerate dynamic pins via DynamicDataPinManager and trigger a canvas refresh.

Parameters
cbCallback function.

Definition at line 117 of file MathOpPropertyPanel.h.

References GetComponentTypeID_Static(), and m_onOperandChange.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_dirty

bool Olympe::MathOpPropertyPanel::m_dirty = false
private

◆ m_dynamicPinMgr

DynamicDataPinManager& Olympe::MathOpPropertyPanel::m_dynamicPinMgr
private

Pin generation manager.

Definition at line 175 of file MathOpPropertyPanel.h.

◆ m_dynamicPins

std::vector<DynamicDataPin> Olympe::MathOpPropertyPanel::m_dynamicPins
private

Read-only dynamic pins display.

Definition at line 179 of file MathOpPropertyPanel.h.

Referenced by Render(), RenderDynamicPinsSection(), RenderPinModeSelector(), and SetDynamicPins().

◆ m_mathOpRef

MathOpRef Olympe::MathOpPropertyPanel::m_mathOpRef
private

Current operand configuration.

Definition at line 178 of file MathOpPropertyPanel.h.

Referenced by GetMathOpRef(), RenderInlineOperandEditor(), RenderOperatorSelector(), and SetMathOpRef().

◆ m_nodeName

std::string Olympe::MathOpPropertyPanel::m_nodeName
private

Node name for display.

Definition at line 177 of file MathOpPropertyPanel.h.

Referenced by RenderTitleSection(), and SetNodeName().

◆ m_onOperandChange

std::function<void()> Olympe::MathOpPropertyPanel::m_onOperandChange
private

Callback when operands change.

Definition at line 184 of file MathOpPropertyPanel.h.

Referenced by RenderOperandRow(), RenderPinModeSelector(), RenderVariableModeInput(), and SetOnOperandChange().

◆ m_operandEditorOpen

bool Olympe::MathOpPropertyPanel::m_operandEditorOpen = true
private

Collapsible section state.

Definition at line 181 of file MathOpPropertyPanel.h.

◆ m_registry

ConditionPresetRegistry& Olympe::MathOpPropertyPanel::m_registry
private

Global preset registry.

Definition at line 174 of file MathOpPropertyPanel.h.


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