Skip to content

Core::GraphManager

You must manage GraphManager lifecycle. More...

#include "Core/Nodes/GraphManager.h"

Public Functions

Name
CameraPtrcreateCamera()
template <typename T ,typename... Args&gt; <br>Ptr< Node >createCustomNode(Args &&... args)
Ptr< Core::Cycle >createCycle()<br>Create Cycle.
Ptr< Model >createModel()
template <EOperatorType T&gt; <br>Ptr< Node >createNode()
Ptr< Sequence >createSequence()
template <ETransformType T&gt; <br>Ptr< Transform >createTransform()
voiddestroy()
std::vector< Ptr< Node > >getAllInputNodes(const Ptr< Node > & node)
std::vector< Ptr< Node > >getAllOutputNodes(Ptr< Node > & node)
const Operation &getOperation(const Pin * pin)
std::vector< Ptr< Node > >getOutputNodes(const Ptr< Node > & node, size_t index)
Ptr< Node >getParent(const Ptr< Node > & node, size_t index =0)<br>Returns parent node of given node (the topmost one).
Ptr< Sequence >getParentSequence(Ptr< Sequence > sequence, bool skipEmptySeq =false)
Ptr< Node >getParentSequenceOrCamera(Ptr< Sequence > sequence, bool & isCamera, bool skipEmptySeq =false, bool skipEmptyCamera =false)
MatrixTracker *getTracker()
voidinit()
boolisCamera(Node * node)
boolisModel(Node * node)
ENodePlugResultisPlugCorrect(const Pin & input, const Pin & output)<br>Is used to check before connecting to avoid cycles in the node graph.
boolisSequence(Node * node)
boolisTracking()
boolisTrackingFromLeft()
ENodePlugResultplug(const Ptr< Core::Node > & lhs, const Ptr< Core::Node > & rhs)<br>Plug first output pin of lhs to the first input pin of rhs.
ENodePlugResultplug(const Ptr< Node > & fromNode, const Ptr< Node > & toNode, unsigned fromIndex, unsigned toIndex)<br>Connect given node output pin to this operator input pin.
ENodePlugResultplugSequenceValueInput(const Ptr< Node > & seq, const Ptr< Node > & node, unsigned nodeOutputIndex =0)
ENodePlugResultplugSequenceValueOutput(const Ptr< Node > & seq, const Ptr< Node > & node, unsigned nodeInputIndex =0)
MatrixTracker *startTracking(Ptr< Sequence > beginSequence, Ptr< Camera > beginCamera, TrackingDirection direction)
MatrixTracker *startTracking(Ptr< Sequence > beginSequence, TrackingDirection direction)
voidstopTracking()
voidunplugAll(const Ptr< Node > & node)<br>Unplug all inputs and outputs.
voidunplugInput(const Ptr< Core::Node > & node, int index)<br>Unplug plugged node from given input pin of this node.
voidupdate(double tick)
std::vector< Ptr< Core::Cycle > > &getCycles()

Detailed Description

cpp
class Core::GraphManager;
class Core::GraphManager;

You must manage GraphManager lifecycle.

cpp
GraphManager::init();

// interaction with GraphManager

GraphManager::destroy();
GraphManager::init();

// interaction with GraphManager

GraphManager::destroy();

Public Functions Documentation

function createCamera

cpp
static inline CameraPtr createCamera()
static inline CameraPtr createCamera()

function createCustomNode

cpp
template <typename T ,
typename... Args>
static inline Ptr< Node > createCustomNode(
    Args &&... args
)
template <typename T ,
typename... Args>
static inline Ptr< Node > createCustomNode(
    Args &&... args
)

function createCycle

cpp
static inline Ptr< Core::Cycle > createCycle()
static inline Ptr< Core::Cycle > createCycle()

Create Cycle.

function createModel

cpp
static Ptr< Model > createModel()
static Ptr< Model > createModel()

function createNode

cpp
template <EOperatorType T>
static inline Ptr< Node > createNode()
template <EOperatorType T>
static inline Ptr< Node > createNode()

function createSequence

cpp
static Ptr< Sequence > createSequence()
static Ptr< Sequence > createSequence()

TodoMH Temporary workaround:

function createTransform

cpp
template <ETransformType T>
static inline Ptr< Transform > createTransform()
template <ETransformType T>
static inline Ptr< Transform > createTransform()

function destroy

cpp
static void destroy()
static void destroy()

function getAllInputNodes

cpp
static std::vector< Ptr< Node > > getAllInputNodes(
    const Ptr< Node > & node
)
static std::vector< Ptr< Node > > getAllInputNodes(
    const Ptr< Node > & node
)

Return: All nodes connected to given node inputs.

function getAllOutputNodes

cpp
static std::vector< Ptr< Node > > getAllOutputNodes(
    Ptr< Node > & node
)
static std::vector< Ptr< Node > > getAllOutputNodes(
    Ptr< Node > & node
)

Return: All nodes plugged into given node output pins.

function getOperation

cpp
static const Operation & getOperation(
    const Pin * pin
)
static const Operation & getOperation(
    const Pin * pin
)

function getOutputNodes

cpp
static std::vector< Ptr< Node > > getOutputNodes(
    const Ptr< Node > & node,
    size_t index
)
static std::vector< Ptr< Node > > getOutputNodes(
    const Ptr< Node > & node,
    size_t index
)

Return: All nodes plugged into node input pin on given index.

function getParent

cpp
static Ptr< Node > getParent(
    const Ptr< Node > & node,
    size_t index =0
)
static Ptr< Node > getParent(
    const Ptr< Node > & node,
    size_t index =0
)

Returns parent node of given node (the topmost one).

Parameters:

  • index input pin index.

Todo: Move me to NodeUtils.

For example for a node plugged into a sequence node, the real parent would be the multiplier node, but the sequence node would be returned.

function getParentSequence

cpp
static Ptr< Sequence > getParentSequence(
    Ptr< Sequence > sequence,
    bool skipEmptySeq =false
)
static Ptr< Sequence > getParentSequence(
    Ptr< Sequence > sequence,
    bool skipEmptySeq =false
)

function getParentSequenceOrCamera

cpp
static Ptr< Node > getParentSequenceOrCamera(
    Ptr< Sequence > sequence,
    bool & isCamera,
    bool skipEmptySeq =false,
    bool skipEmptyCamera =false
)
static Ptr< Node > getParentSequenceOrCamera(
    Ptr< Sequence > sequence,
    bool & isCamera,
    bool skipEmptySeq =false,
    bool skipEmptyCamera =false
)

function getTracker

cpp
static inline MatrixTracker * getTracker()
static inline MatrixTracker * getTracker()

function init

cpp
static void init()
static void init()

function isCamera

cpp
static inline bool isCamera(
    Node * node
)
static inline bool isCamera(
    Node * node
)

function isModel

cpp
static inline bool isModel(
    Node * node
)
static inline bool isModel(
    Node * node
)

function isPlugCorrect

cpp
static ENodePlugResult isPlugCorrect(
    const Pin & input,
    const Pin & output
)
static ENodePlugResult isPlugCorrect(
    const Pin & input,
    const Pin & output
)

Is used to check before connecting to avoid cycles in the node graph.

Parameters:

  • input Pin of right node.
  • output Pin of left node.

The function is used in plug() function.

Algorithm described in panel Algoritmus 1 in [Folta, page 30]

function isSequence

cpp
static inline bool isSequence(
    Node * node
)
static inline bool isSequence(
    Node * node
)

function isTracking

cpp
static bool isTracking()
static bool isTracking()

function isTrackingFromLeft

cpp
static bool isTrackingFromLeft()
static bool isTrackingFromLeft()

function plug

cpp
static ENodePlugResult plug(
    const Ptr< Core::Node > & lhs,
    const Ptr< Core::Node > & rhs
)
static ENodePlugResult plug(
    const Ptr< Core::Node > & lhs,
    const Ptr< Core::Node > & rhs
)

Plug first output pin of lhs to the first input pin of rhs.

function plug

cpp
static ENodePlugResult plug(
    const Ptr< Node > & fromNode,
    const Ptr< Node > & toNode,
    unsigned fromIndex,
    unsigned toIndex
)
static ENodePlugResult plug(
    const Ptr< Node > & fromNode,
    const Ptr< Node > & toNode,
    unsigned fromIndex,
    unsigned toIndex
)

Connect given node output pin to this operator input pin.

Parameters:

  • parentNode Reference to a unique pointer to a parent node to which parentOutputPinIndex this node should be connected to.
  • rightNode node which should be connected to right node output.
  • parentOutputPinIndex Index of the output pin of the parent node.
  • myInputPinIndex Index of input pin of this node.

See: ENodePlugResult.

Return: Result enum is returned from the function.

Usage:

cpp
   // Create nodes.
   auto vec1    = Core::Builder::createOperator<OperationType::Vector3>();
   auto vec2    = Core::Builder::createOperator<OperationType::Vector3>();
   auto dotNode =
Core::Builder::createOperator<OperationType::Vector3DotVector3>();

   // Plug vector nodes output to dot node inputs.
   GraphManager::plug(vec1, dotNode, 0, 0);
   GraphManager::plug(vec2, dotNode, 1, 0);
   // Create nodes.
   auto vec1    = Core::Builder::createOperator<OperationType::Vector3>();
   auto vec2    = Core::Builder::createOperator<OperationType::Vector3>();
   auto dotNode =
Core::Builder::createOperator<OperationType::Vector3DotVector3>();

   // Plug vector nodes output to dot node inputs.
   GraphManager::plug(vec1, dotNode, 0, 0);
   GraphManager::plug(vec2, dotNode, 1, 0);

function plugSequenceValueInput

cpp
static ENodePlugResult plugSequenceValueInput(
    const Ptr< Node > & seq,
    const Ptr< Node > & node,
    unsigned nodeOutputIndex =0
)
static ENodePlugResult plugSequenceValueInput(
    const Ptr< Node > & seq,
    const Ptr< Node > & node,
    unsigned nodeOutputIndex =0
)

function plugSequenceValueOutput

cpp
static ENodePlugResult plugSequenceValueOutput(
    const Ptr< Node > & seq,
    const Ptr< Node > & node,
    unsigned nodeInputIndex =0
)
static ENodePlugResult plugSequenceValueOutput(
    const Ptr< Node > & seq,
    const Ptr< Node > & node,
    unsigned nodeInputIndex =0
)

function startTracking

cpp
static MatrixTracker * startTracking(
    Ptr< Sequence > beginSequence,
    Ptr< Camera > beginCamera,
    TrackingDirection direction
)
static MatrixTracker * startTracking(
    Ptr< Sequence > beginSequence,
    Ptr< Camera > beginCamera,
    TrackingDirection direction
)

function startTracking

cpp
static MatrixTracker * startTracking(
    Ptr< Sequence > beginSequence,
    TrackingDirection direction
)
static MatrixTracker * startTracking(
    Ptr< Sequence > beginSequence,
    TrackingDirection direction
)

function stopTracking

cpp
static void stopTracking()
static void stopTracking()

function unplugAll

cpp
static void unplugAll(
    const Ptr< Node > & node
)
static void unplugAll(
    const Ptr< Node > & node
)

Unplug all inputs and outputs.

function unplugInput

cpp
static void unplugInput(
    const Ptr< Core::Node > & node,
    int index
)
static void unplugInput(
    const Ptr< Core::Node > & node,
    int index
)

Unplug plugged node from given input pin of this node.

Parameters:

  • index Index of the input pin

function update

cpp
static void update(
    double tick
)
static void update(
    double tick
)

Parameters:

  • tick in seconds.

function getCycles

cpp
inline std::vector< Ptr< Core::Cycle > > & getCycles()
inline std::vector< Ptr< Core::Cycle > > & getCycles()

Updated on 2025-05-31 at 12:55:31 +0000