Skip to content

Core::GraphManager

You must manage GraphManager lifecycle. More...

#include "Core/Nodes/GraphManager.h"

Public Functions

Name
CameraPtrcreateCamera()
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).
voidinit()
ENodePlugResultisPlugCorrect(const Pin & input, const Pin & output)<br>Is used to check before connecting to avoid cycles in the node graph.
boolisTrackingEnabled()
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)
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 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 init

cpp
static void init()
static void init()

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 isTrackingEnabled

cpp
static bool isTrackingEnabled()
static bool isTrackingEnabled()

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 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 2024-11-06 at 20:16:54 +0000