GvNodeMaster Class Reference

#include <c4d_graphview.h>

Inheritance diagram for GvNodeMaster:

Detailed Description

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

GvNodeAllocNode (Int32 id)
 
void FreeNode (GvNode *&node)
 
GvNodeCreateNode (GvNode *parent, Int32 id, GvNode *insert=nullptr, Int32 x=-1, Int32 y=-1)
 

Miscellaneous

GvNodeGetRoot ()
 
BaseList2DGetOwner ()
 
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)
 
GvRunGetRun ()
 
GvCalcGetCalc ()
 
Bool IsEnabled ()
 

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 ()
 
GvCalcError Execute (BaseThread *thread)
 

Query

GvQueryAllocQuery ()
 
void FreeQuery (GvQuery *&query)
 

Init

GvInitAllocInit ()
 
void FreeInit (GvInit *&init)
 

User Data

GvUserDataID RegisterUserData (void *data=nullptr)
 
void SetUserData (GvUserDataID id, void *data)
 
void * GetUserData (GvUserDataID id)
 

Calculation Table

GvCalcTableAllocCalculationTable (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 ()
 

Execute2

GvCalcError Execute2 (BaseThread *thread, GvCalcFlags flags)
 

Additional Inherited Members

- Public Member Functions inherited from BaseList2D
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
String GetName () const
 
void SetName (const maxon::String &name)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot ()
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName ()
 
BaseList2DGetMain () const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot ()
 
GeListHeadGetHiddenShaderRoot ()
 
maxon::NimbusForwardRef GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusForwardRefPrivateGetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::NimbusForwardRef > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
GeListNodeGetPred ()
 
GeListNodeGetDown ()
 
GeListNodeGetUp ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
GeListHeadGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData ()
 
BaseDocumentGetDocument ()
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated ()
 
Int32 GetInfo () const
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 
- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ GvNodeMaster()

GvNodeMaster ( )
private

◆ ~GvNodeMaster()

~GvNodeMaster ( )
private

Member Function Documentation

◆ AllocNode()

GvNode* AllocNode ( Int32  id)

Allocates a GV node without inserting it. Use FreeNode() to free the node.

Note
It is recommended to use CreateNode() instead.
Parameters
[in]idThe GV node ID, for example ID_OPERATOR_OBJECT or a custom ID.
Returns
The allocated GV node, or nullptr. The caller owns the pointed node.

◆ FreeNode()

void FreeNode ( GvNode *&  node)

Frees GV nodes allocated with AllocNode().

Parameters
[in,out]nodeThe GV node to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ CreateNode()

GvNode* CreateNode ( GvNode parent,
Int32  id,
GvNode insert = nullptr,
Int32  x = -1,
Int32  y = -1 
)

Creates a node and inserts it.

Parameters
[in]parentThe parent node. GetRoot() to insert a top node.
[in]idThe GV node ID, for example ID_OPERATOR_OBJECT or a custom ID.
[in]insertThe insertion point.
[in]xThe X position.
[in]yThe Y position.
Returns
The created GV node, or nullptr. The master owns the pointed node.

◆ GetRoot()

GvNode* GetRoot ( )

Retrieves the root node.

Returns
The root node. The master owns the pointed node.

◆ GetOwner()

BaseList2D* GetOwner ( )

Retrieves the owner of the node master.

Returns
The owner. Cinema 4D owns the pointed owner.

◆ IsConnectionValid()

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

Note
Swaps the nodes and the ports to ensure that always source is the output and dest the input. Use the _out parameters with GvNode::AddConnection() if the connection is allowed.
Parameters
[in]source_nodeThe source node input. The caller owns the pointed node.
[in]source_portThe source port input. The caller owns the pointed node.
[in]dest_nodeThe destination node input. The caller owns the pointed node.
[in]dest_portThe destination port input. The caller owns the pointed node.
[in]source_node_outThe source node output. The caller owns the pointed node.
[in]source_port_outThe source port output. The caller owns the pointed node.
[in]dest_node_outThe destination node output. The caller owns the pointed node.
[in]dest_port_outThe destination port output. The caller owns the pointed node.
Returns
true if the connection is allowed, otherwise false.

◆ InsertFirst()

Bool InsertFirst ( GvNode parent,
GvNode node 
)

Inserts a node first in the node list of an Xgroup.

Note
Equivalent to GeListNode::InsertUnder(), but with additional checks that parent is a group node, and that node is removed.
Parameters
[in]parentThe parent GV node. Must be a group node owned by the node master.
[in]nodeThe GV node to insert. The master takes over the ownership of the pointed node.
Returns
true if the node was inserted, otherwise false.

◆ InsertLast()

Bool InsertLast ( GvNode parent,
GvNode node 
)

Inserts a node last in the node list of an Xgroup.

Note
Equivalent to GeListNode::InsertUnderLast(), but with additional checks that parent is a group node, and that node is removed.
Parameters
[in]parentThe parent GV node. Must be a group node owned by the node master.
[in]nodeThe GV node to insert. The master takes over the ownership of the pointed node.
Returns
true if the node was inserted, otherwise false.

◆ SetHierarchy()

Bool SetHierarchy ( GvNode insert,
GvNode node,
GvInsertMode  mode = GV_INSERT_AFTER 
)

Performs a hierarchy operation.

Note
Equivalent to the standard GeListNode calls, but with additional checks.
Parameters
[in]insertThe insertion point. Must be owned by the node master.
[in]nodeThe GV node to perform the operation on. The master takes over the ownership of the pointed object.
[in]modeThe insertion mode: GvInsertMode
Returns
true if the hierarchy was set, otherwise false.

◆ QueryCalculation()

GvCalcError QueryCalculation ( GvQuery query,
BaseThread thread 
)

Checks if it is OK to begin a calculation.

Parameters
[in]queryThe GV query object. The caller owns the pointed GvQuery.
[in]threadThe thread to use for break checks. The caller owns the pointed thread.
Returns
The result of the check.

◆ InitCalculation()

GvCalcError InitCalculation ( GvInit init,
BaseThread thread 
)

Tells the nodes to allocate resources for a calculation. Must be called before Calculate(). Call FreeCalculation() afterwards.

Parameters
[in]initThe GV init object. The caller owns the pointed GvInit.
[in]threadThe thread to use for break checks. The caller owns the pointed thread.
Returns
The result of the initialization.

◆ Calculate()

GvCalcError Calculate ( Int32  cpu_id)

Starts a calculation.

Parameters
[in]cpu_idThe CPU ID. Normally 0.
Returns
The result of the calculation.

◆ Recalculate()

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.

Parameters
[in]masterNot used. The method always uses the this pointer instead.
[in]nodeThe GV node to recalculate. The caller owns the pointed node.
[in]cpu_idThe CPU ID. Normally 0.
Returns
The result of the recalculation.

◆ FreeCalculation()

void FreeCalculation ( )

Frees resources allocated by the GV nodes for calculation.

◆ Execute()

GvCalcError Execute ( BaseThread thread)

Equivalent to calling QueryCalculation(), InitCalculation(), Calculate() and FreeCalculation() with some error checks.

Note
This is the recommended way to execute XPresso. Use Execute2() to pass flags for the execution.
Parameters
[in]threadThe thread to use for break checks. The caller owns the pointed thread.
Returns
The result of the execution.

◆ GetBranchInfo()

Int32 GetBranchInfo ( BranchInfo info,
Int32  max,
GETBRANCHINFO  flags 
)

◆ GetRun()

GvRun* GetRun ( )

Retrieves the current run helper.

Returns
The run helper. The caller owns the pointed GvRun.

◆ GetCalc()

GvCalc* GetCalc ( )

Retrieves the current calculation helper.

Returns
The calculation helper. The caller owns the pointed GvRun.

◆ IsEnabled()

Bool IsEnabled ( )

Returns the inverse of GetRoot()->GetDisabledState(), or false if there is no root.

Returns
true if the node master is enabled, otherwise false.

◆ AllocQuery()

GvQuery* AllocQuery ( )

Allocates a GV query object. Must be freed with FreeQuery().

Returns
The allocated query object. The caller owns the pointed GvQuery.

◆ FreeQuery()

void FreeQuery ( GvQuery *&  query)

Frees GV query objects allocated with AllocQuery().

Parameters
[in,out]queryThe query object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ AllocInit()

GvInit* AllocInit ( )

Allocates a GV init object. Must be freed with FreeInit().

Returns
The allocated GV init object. The caller owns the pointed GvInit.

◆ FreeInit()

void FreeInit ( GvInit *&  init)

Frees GV init objects allocated with AllocInit().

Parameters
[in,out]initThe GV init object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ RegisterUserData()

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.

Parameters
[in]dataThe initial value of the user data.
Returns
The ID of the registered pointer.

◆ SetUserData()

void SetUserData ( GvUserDataID  id,
void *  data 
)

Sets the user data pointer.

Parameters
[in]idThe user data ID.
[in]dataThe new user data.

◆ GetUserData()

void* GetUserData ( GvUserDataID  id)

Retrieves the user data pointer.

Parameters
[in]idThe user data ID.
Returns
The user data pointer.

◆ AllocCalculationTable()

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

Parameters
[in]cpu_countThe CPU count. Normally 1.
[in]sortIf true the table is sorted to reflect the hierarchy.
[in]nr_of_preallocated_entriesThe space is preallocated for this many entries. The table will still grow if necessary.
[in]iterationtrue if this is an iteration path.
Returns
The allocated calculation table. The caller owns the pointed table.

◆ FreeCalculationTable()

void FreeCalculationTable ( GvCalcTable *&  table)

Frees calculation tables allocated with AllocCalculationTable().

Parameters
[in]tableThe table to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ AddToDrawList()

Bool AddToDrawList ( GvNode bn,
void **  data = nullptr,
Int32  data_size = 0 
)

Adds a node the internal list of nodes that need GvOperatorData::SceneDraw() called during the next internal draw.

Parameters
[in]bnThe node to add. The caller owns the pointed node.
[in]dataThis 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_sizeThe size of data in bytes. Stored and passed to the draw list call.
Returns
true if the node was added to the draw list, otherwise false.

◆ GetCopyBuffer()

GvCopyBuffer* GetCopyBuffer ( GvNode first = nullptr,
Bool  copy_selected = true 
)

Allocates a copy buffer. Must be freed with FreeCopyBuffer(). Paste the buffer with PasteFromBuffer().

Parameters
[in]firstThe optional first node of the hierarchy to be copied. The caller owns the pointed node.
[in]copy_selectedIf true (default) the selected objects are copied.
Returns
The allocated copy buffer. The caller owns the pointed buffer.

◆ FreeCopyBuffer()

void FreeCopyBuffer ( GvCopyBuffer *&  buffer)

Frees copy buffers allocated with GetCopyBuffer().

Parameters
[in]bufferThe buffer to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ PasteFromBuffer()

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

Parameters
[in]bufferThe buffer to paste.
[in]modeThe insert mode: GvInsertMode
[out]destAn optional destination node. The caller owns the pointed node.
[out]xAn optional destination X coordinate.
[out]yAn optional destination Y coordinate.
[in]centerIf true the pasted nodes are centered.
[in]infoInternal parameter. Must always be nullptr.
Returns
true if successful, otherwise false.

◆ SetPrefs()

void SetPrefs ( const BaseContainer bc)

Sets the preferences for the node master.

Parameters
[in]bcThe new preferences. Use these container IDs: GvMasterConfigIDs

◆ GetPrefs()

void GetPrefs ( BaseContainer bc)

Gets the preferences for the node master.

Parameters
[out]bcFilled with the current preferences. Use these container IDs: GvMasterConfigIDs

◆ AddUndo()

Bool AddUndo ( )

Adds changes made in the node master to the undo list.

Returns
true if successful, otherwise false.

◆ Execute2()

GvCalcError Execute2 ( BaseThread thread,
GvCalcFlags  flags 
)

Equivalent to Execute() but additional flags are used for the calculation.

Parameters
[in]threadThe thread to use for break checks. The caller owns the pointed thread.
[in]flagsThe calculation flags: GvCalcFlags
Returns
The result of the execution.