#include <c4d_graphview.h>
The GV node master class handles a collection of GV nodes and calculates them.
Normally you do not need to create it yourself, but this can be done with GvWorld::AllocNodeMaster() and GvWorld::FreeNodeMaster().
The node master sends these message to its parent: GvMessage
Private Member Functions | |
GvNodeMaster () | |
~GvNodeMaster () | |
Alloc/Free/Create | |
GvNode * | AllocNode (Int32 id) |
void | FreeNode (GvNode *&node) |
GvNode * | CreateNode (GvNode *parent, Int32 id, GvNode *insert=nullptr, Int32 x=-1, Int32 y=-1) |
Miscellaneous | |
GvNode * | GetRoot (void) |
BaseList2D * | GetOwner (void) |
Bool | IsConnectionValid (GvNode *source_node, GvPort *source_port, GvNode *dest_node, GvPort *dest_port, GvNode *&source_node_out, GvPort *&source_port_out, GvNode *&dest_node_out, GvPort *&dest_port_out) |
Int32 | GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags) |
GvRun * | GetRun (void) |
GvCalc * | GetCalc (void) |
Bool | IsEnabled (void) |
Insert/Hierarchy Node | |
Bool | InsertFirst (GvNode *parent, GvNode *node) |
Bool | InsertLast (GvNode *parent, GvNode *node) |
Bool | SetHierarchy (GvNode *insert, GvNode *node, GvInsertMode mode=GV_INSERT_AFTER) |
Calculation | |
GvCalcError | QueryCalculation (GvQuery *query, BaseThread *thread) |
GvCalcError | InitCalculation (GvInit *init, BaseThread *thread) |
GvCalcError | Calculate (Int32 cpu_id) |
GvCalcError | Recalculate (GvNodeMaster *master, GvNode *node, Int32 cpu_id) |
void | FreeCalculation (void) |
GvCalcError | Execute (BaseThread *thread) |
Query | |
GvQuery * | AllocQuery (void) |
void | FreeQuery (GvQuery *&query) |
Init | |
GvInit * | AllocInit (void) |
void | FreeInit (GvInit *&init) |
User Data | |
GvUserDataID | RegisterUserData (void *data=nullptr) |
void | SetUserData (GvUserDataID id, void *data) |
void * | GetUserData (GvUserDataID id) |
Calculation Table | |
GvCalcTable * | AllocCalculationTable (Int32 cpu_count, Bool sort=true, Int32 nr_of_preallocated_entries=16, Bool iteration=false) |
void | FreeCalculationTable (GvCalcTable *&table) |
Draw List | |
Bool | AddToDrawList (GvNode *bn, void **data=nullptr, Int32 data_size=0) |
Copy Buffer | |
GvCopyBuffer * | GetCopyBuffer (GvNode *first=nullptr, Bool copy_selected=true) |
void | FreeCopyBuffer (GvCopyBuffer *&buffer) |
Bool | PasteFromBuffer (GvCopyBuffer &buffer, GvInsertMode mode=GV_INSERT_UNDER, GvNode *dest=nullptr, Int32 x=(LIMIT< Int32 >::MAX), Int32 y=(LIMIT< Int32 >::MAX), Bool center=false, void *info=nullptr) |
Preferences | |
void | SetPrefs (const BaseContainer &bc) |
void | GetPrefs (BaseContainer &bc) |
Undo | |
Bool | AddUndo (void) |
Execute2 | |
GvCalcError | Execute2 (BaseThread *thread, GvCalcFlags flags) |
|
private |
|
private |
Allocates a GV node without inserting it. Use FreeNode() to free the node.
[in] | id | The GV node ID, for example ID_OPERATOR_OBJECT or a custom ID. |
void FreeNode | ( | GvNode *& | node | ) |
Frees GV nodes allocated with AllocNode().
[in,out] | node | The GV node to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
GvNode* CreateNode | ( | GvNode * | parent, |
Int32 | id, | ||
GvNode * | insert = nullptr , |
||
Int32 | x = -1 , |
||
Int32 | y = -1 |
||
) |
Creates a node and inserts it.
[in] | parent | The parent node. GetRoot() to insert a top node. |
[in] | id | The GV node ID, for example ID_OPERATOR_OBJECT or a custom ID. |
[in] | insert | The insertion point. |
[in] | x | The X position. |
[in] | y | The Y position. |
GvNode* GetRoot | ( | void | ) |
Retrieves the root node.
BaseList2D* GetOwner | ( | void | ) |
Retrieves the owner of the node master.
Bool IsConnectionValid | ( | GvNode * | source_node, |
GvPort * | source_port, | ||
GvNode * | dest_node, | ||
GvPort * | dest_port, | ||
GvNode *& | source_node_out, | ||
GvPort *& | source_port_out, | ||
GvNode *& | dest_node_out, | ||
GvPort *& | dest_port_out | ||
) |
Has to be called to make sure that the connection is valid before attempting a GvNode::AddConnection().
[in] | source_node | The source node input. The caller owns the pointed node. |
[in] | source_port | The source port input. The caller owns the pointed node. |
[in] | dest_node | The destination node input. The caller owns the pointed node. |
[in] | dest_port | The destination port input. The caller owns the pointed node. |
[in] | source_node_out | The source node output. The caller owns the pointed node. |
[in] | source_port_out | The source port output. The caller owns the pointed node. |
[in] | dest_node_out | The destination node output. The caller owns the pointed node. |
[in] | dest_port_out | The destination port output. The caller owns the pointed node. |
Inserts a node first in the node list of an Xgroup.
[in] | parent | The parent GV node. Must be a group node owned by the node master. |
[in] | node | The GV node to insert. The master takes over the ownership of the pointed node. |
Inserts a node last in the node list of an Xgroup.
[in] | parent | The parent GV node. Must be a group node owned by the node master. |
[in] | node | The GV node to insert. The master takes over the ownership of the pointed node. |
Bool SetHierarchy | ( | GvNode * | insert, |
GvNode * | node, | ||
GvInsertMode | mode = GV_INSERT_AFTER |
||
) |
Performs a hierarchy operation.
[in] | insert | The insertion point. Must be owned by the node master. |
[in] | node | The GV node to perform the operation on. The master takes over the ownership of the pointed object. |
[in] | mode | The insertion mode: GvInsertMode |
GvCalcError QueryCalculation | ( | GvQuery * | query, |
BaseThread * | thread | ||
) |
Checks if it is OK to begin a calculation.
[in] | query | The GV query object. The caller owns the pointed GvQuery. |
[in] | thread | The thread to use for break checks. The caller owns the pointed thread. |
GvCalcError InitCalculation | ( | GvInit * | init, |
BaseThread * | thread | ||
) |
Tells the nodes to allocate resources for a calculation. Must be called before Calculate(). Call FreeCalculation() afterwards.
[in] | init | The GV init object. The caller owns the pointed GvInit. |
[in] | thread | The thread to use for break checks. The caller owns the pointed thread. |
GvCalcError Calculate | ( | Int32 | cpu_id | ) |
Starts a calculation.
[in] | cpu_id | The CPU ID. Normally 0. |
GvCalcError Recalculate | ( | GvNodeMaster * | master, |
GvNode * | node, | ||
Int32 | cpu_id | ||
) |
Sets all operators' ports connected to the output ports of node to invalid, to enable an iterator loop path.
[in] | master | Not used. The method always uses the this pointer instead. |
[in] | node | The GV node to recalculate. The caller owns the pointed node. |
[in] | cpu_id | The CPU ID. Normally 0. |
void FreeCalculation | ( | void | ) |
Frees resources allocated by the GV nodes for calculation.
GvCalcError Execute | ( | BaseThread * | thread | ) |
Equivalent to calling QueryCalculation(), InitCalculation(), Calculate() and FreeCalculation() with some error checks.
[in] | thread | The thread to use for break checks. The caller owns the pointed thread. |
Int32 GetBranchInfo | ( | BranchInfo * | info, |
Int32 | max, | ||
GETBRANCHINFO | flags | ||
) |
Similar to GeListNode::GetBranchInfo().
GvRun* GetRun | ( | void | ) |
Retrieves the current run helper.
GvCalc* GetCalc | ( | void | ) |
Retrieves the current calculation helper.
Bool IsEnabled | ( | void | ) |
Returns the inverse of GetRoot()->GetDisabledState(), or false if there is no root.
GvQuery* AllocQuery | ( | void | ) |
Allocates a GV query object. Must be freed with FreeQuery().
void FreeQuery | ( | GvQuery *& | query | ) |
Frees GV query objects allocated with AllocQuery().
[in,out] | query | The query object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
GvInit* AllocInit | ( | void | ) |
Allocates a GV init object. Must be freed with FreeInit().
void FreeInit | ( | GvInit *& | init | ) |
Frees GV init objects allocated with AllocInit().
[in,out] | init | The GV init object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
GvUserDataID RegisterUserData | ( | void * | data = nullptr | ) |
Registers a user data pointer with the node master. The user data pointers are only stored for the current session.
[in] | data | The initial value of the user data. |
void SetUserData | ( | GvUserDataID | id, |
void * | data | ||
) |
Sets the user data pointer.
[in] | id | The user data ID. |
[in] | data | The new user data. |
void* GetUserData | ( | GvUserDataID | id | ) |
Retrieves the user data pointer.
[in] | id | The user data ID. |
GvCalcTable* AllocCalculationTable | ( | Int32 | cpu_count, |
Bool | sort = true , |
||
Int32 | nr_of_preallocated_entries = 16 , |
||
Bool | iteration = false |
||
) |
Allocates an allocation table. The allocated table must be freed with FreeCalculationTable().
[in] | cpu_count | The CPU count. Normally 1. |
[in] | sort | If true the table is sorted to reflect the hierarchy. |
[in] | nr_of_preallocated_entries | The space is preallocated for this many entries. The table will still grow if necessary. |
[in] | iteration | true if this is an iteration path. |
void FreeCalculationTable | ( | GvCalcTable *& | table | ) |
Frees calculation tables allocated with AllocCalculationTable().
[in] | table | The table to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
Adds a node the internal list of nodes that need GvOperatorData::SceneDraw() called during the next internal draw.
[in] | bn | The node to add. The caller owns the pointed node. |
[in] | data | This should either be nullptr or point to a data pointer. The function allocates a memory block of data_size bytes and stores a pointer to it in data. Store custom data in this memory block that GvOperatorData::SceneDraw() use. The caller owns the pointed data. The node master owns the pointed data. |
[in] | data_size | The size of data in bytes. Stored and passed to the draw list call. |
Allocates a copy buffer. Must be freed with FreeCopyBuffer(). Paste the buffer with PasteFromBuffer().
[in] | first | The optional first node of the hierarchy to be copied. The caller owns the pointed node. |
[in] | copy_selected | If true (default) the selected objects are copied. |
void FreeCopyBuffer | ( | GvCopyBuffer *& | buffer | ) |
Frees copy buffers allocated with GetCopyBuffer().
[in] | buffer | The buffer to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
Bool PasteFromBuffer | ( | GvCopyBuffer & | buffer, |
GvInsertMode | mode = GV_INSERT_UNDER , |
||
GvNode * | dest = nullptr , |
||
Int32 | x = (LIMIT<Int32>::MAX) , |
||
Int32 | y = (LIMIT<Int32>::MAX) , |
||
Bool | center = false , |
||
void * | info = nullptr |
||
) |
Pastes the contents of a copy buffer created with GetCopyBuffer().
[in] | buffer | The buffer to paste. |
[in] | mode | The insert mode: GvInsertMode |
[out] | dest | An optional destination node. The caller owns the pointed node. |
[out] | x | An optional destination X coordinate. |
[out] | y | An optional destination Y coordinate. |
[in] | center | If true the pasted nodes are centered. |
[in] | info | Internal parameter. Must always be nullptr. |
void SetPrefs | ( | const BaseContainer & | bc | ) |
Sets the preferences for the node master.
[in] | bc | The new preferences. Use these container IDs: GvMasterConfigIDs |
void GetPrefs | ( | BaseContainer & | bc | ) |
Gets the preferences for the node master.
[out] | bc | Filled with the current preferences. Use these container IDs: GvMasterConfigIDs |
Bool AddUndo | ( | void | ) |
Adds changes made in the node master to the undo list.
GvCalcError Execute2 | ( | BaseThread * | thread, |
GvCalcFlags | flags | ||
) |
Equivalent to Execute() but additional flags are used for the calculation.
[in] | thread | The thread to use for break checks. The caller owns the pointed thread. |
[in] | flags | The calculation flags: GvCalcFlags |