GvPort Class Reference

#include <c4d_graphview.h>

Detailed Description

There are three kinds of port IDs:

  • Main: The type of the port, for example GV_FORMULA_INPUT in GVformula.
  • Sub: A unique ID for each instance of multiple ports with the same Main ID. Assigned when the port is created.
  • User: A place to store an ID for custom management. Cinema 4D ignores this value.

Cannot be instantiated. Call GvNode::AddPort() to create a port.

Private Member Functions

 GvPort ()
 
 ~GvPort ()
 

Connections

void RemoveConnection (void)
 
Int32 GetNrOfConnections (void)
 
void RemovePortConnections (void)
 
Bool IsIncomingConnected (void)
 
Bool GetIncomingDestination (GvNode *&node, GvPort *&port)
 
Bool GetIncomingSource (GvNode *&node, GvPort *&port)
 

Port IDs

GvPortIO GetIO (void)
 
void SetMainID (Int32 id)
 
Int32 GetMainID (void)
 
Int32 GetSubID (void)
 
void SetUserID (Int32 id)
 
Int32 GetUserID (void)
 

ValueType/Visible/Valid

GvValueID GetValueType (void)
 
void SetVisible (Bool v)
 
Bool GetVisible (void)
 
void SetValid (GvRun *r, Bool v)
 
Bool GetValid (GvRun *r)
 

Calculate

void SetCalculated (GvRun *r)
 
GvPortCalculate (GvNode *bn, GvRun *r, GvCalc *c)
 
Bool SetRecalculate (GvRun *r, Bool force_set=false)
 

Get Value

Bool GetBool (Bool *b, GvRun *r)
 
Bool GetInteger (Int32 *i, GvRun *r)
 
Bool GetFloat (Float *f, GvRun *r)
 
Bool GetVector (Vector *v, GvRun *r)
 
Bool GetNormal (Vector *n, GvRun *r)
 
Bool GetMatrix (Matrix *m, GvRun *r)
 
Bool GetTime (BaseTime *t, GvRun *r)
 
Bool GetString (String *s, GvRun *r)
 
Bool GetObject (BaseList2D *&o, GvRun *r)
 
Bool GetData (void *d, GvValueID type, GvRun *r)
 
Bool GetDataInstance (const void *&d, GvValueID type, GvRun *r)
 

Set Value

Bool SetBool (Bool b, GvRun *r)
 
Bool SetInteger (Int32 i, GvRun *r)
 
Bool SetFloat (Float f, GvRun *r)
 
Bool SetVector (const Vector &v, GvRun *r)
 
Bool SetMatrix (const Matrix &m, GvRun *r)
 
Bool SetNormal (const Vector &n, GvRun *r)
 
Bool SetTime (const BaseTime &t, GvRun *r)
 
Bool SetString (const maxon::String &s, GvRun *r)
 
Bool SetObject (const BaseList2D *o, GvRun *r)
 
Bool SetData (const void *d, GvValueID type, GvRun *r)
 
const String GetName (GvNode *node)
 
void SetName (const maxon::String &name)
 

Copy Data

Bool CopyPortData (GvPort *source, GvRun *r)
 
Bool CopyRawData (void *source, GvRun *r)
 

Calculate Data

Bool CalculateRawData (void *data, void *dest, GvRun *r, GvValueFlags calculation, Float parm1=0.0_f)
 
Bool CalculateRawRawData (void *data1, void *data2, void *dest, GvRun *r, GvValueFlags calculation, Float parm1=0.0_f)
 
Bool CalculatePortData (GvPort *data, void *dest, GvRun *r, GvValueFlags calculation, Float parm1=0.0_f)
 
Bool CalculateRawDataRev (void *data, void *dest, GvRun *r, GvValueFlags calculation, Float parm1=0.0_f)
 

Get/Set Tag/Material/Instance/Object

Bool GetTag (BaseList2D *&t, GvRun *r, Int32 *index=nullptr)
 
Bool SetTag (const BaseList2D *const t, GvRun *r, Int32 index=0)
 
Bool GetMaterial (BaseList2D *&m, GvRun *r, Int32 *index=nullptr)
 
Bool SetMaterial (const BaseList2D *const m, GvRun *r, Int32 index=0)
 
Bool GetInstance (BaseList2D *&i, GvRun *r, Int32 *index=nullptr)
 
Bool SetInstance (const BaseList2D *const i, GvRun *r, Int32 index=0)
 
Bool GetObjectWithIndex (BaseList2D *&o, GvRun *r, Int32 *index=nullptr)
 
Bool SetObjectWithIndex (const BaseList2D *const o, GvRun *r, Int32 index=0)
 

Outgoing/Destination Information

GvDestinationGetOutgoing (Int32 index)
 

User Data

GeDataGetUserData ()
 
void SetUserData (const GeData &data)
 

Constructor & Destructor Documentation

◆ GvPort()

GvPort ( )
private

◆ ~GvPort()

~GvPort ( )
private

Member Function Documentation

◆ RemoveConnection()

void RemoveConnection ( void  )

Removes the incoming connection.

◆ GetNrOfConnections()

Int32 GetNrOfConnections ( void  )

Gets the number of connections, including both the incoming and outgoing connections.

Returns
The number of connections.

◆ RemovePortConnections()

void RemovePortConnections ( void  )

Removes all outgoing connections.

◆ IsIncomingConnected()

Bool IsIncomingConnected ( void  )

Checks if there is an incoming connection.

Returns
true if there is an incoming connection to the port, otherwise false.

◆ GetIncomingDestination()

Bool GetIncomingDestination ( GvNode *&  node,
GvPort *&  port 
)

Gets the destination of the incoming connection.

Parameters
[out]nodeAssigned the incoming destination node.
[out]portAssigned the incoming destination port.
Returns
true if the incoming destination was retrieved, otherwise false.

◆ GetIncomingSource()

Bool GetIncomingSource ( GvNode *&  node,
GvPort *&  port 
)

Gets the source of the incoming connection.

Parameters
[out]nodeAssigned the incoming source node.
[out]portAssigned the incoming source port.
Returns
true if the incoming source was retrieved, otherwise false.

◆ GetIO()

GvPortIO GetIO ( void  )

Gets the IO mode for the port.

Returns
The IO mode: GvPortIO

◆ SetMainID()

void SetMainID ( Int32  id)

Sets the main ID of the port.

Parameters
[in]idThe main ID to set.

◆ GetMainID()

Int32 GetMainID ( void  )

Gets the main ID of the port.

Returns
The main ID.

◆ GetSubID()

Int32 GetSubID ( void  )

Gets the sub ID of the port.

Returns
The sub ID.

◆ SetUserID()

void SetUserID ( Int32  id)

Sets the user ID of the port.

Parameters
[in]idThe user ID to set.

◆ GetUserID()

Int32 GetUserID ( void  )

Gets the user ID of the port.

Returns
The user ID.

◆ GetValueType()

GvValueID GetValueType ( void  )

Gets the value type of the port.

Returns
The value type.

◆ SetVisible()

void SetVisible ( Bool  v)

Hides or shows the port.

Parameters
[in]vtrue if the port should be visible and false if it should be hidden.

◆ GetVisible()

Bool GetVisible ( void  )

Checks if the port is hidden or visible.

Returns
true if the port is visible and false if it is hidden.

◆ SetValid()

void SetValid ( GvRun r,
Bool  v 
)

Reports this port as valid or invalid during a run.

Parameters
[in]rThe run helper. The caller owns the pointed run helper.
[in]vtrue if the port is valid, otherwise false.

◆ GetValid()

Bool GetValid ( GvRun r)

Checks if the port is valid during a run.

Parameters
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the port is valid, otherwise false.

◆ SetCalculated()

void SetCalculated ( GvRun r)

Reports that this port has been calculated in this run.

Parameters
[in]rThe run helper. The caller owns the pointed run helper.

◆ Calculate()

GvPort* Calculate ( GvNode bn,
GvRun r,
GvCalc c 
)

Calculates the port.

Note
Calculate() should normally not be used. Use GvValue::Calculate() instead.
Parameters
[in]bnThe node that the ports belongs to. The caller owns the pointed node.
[in]rThe run helper. The caller owns the pointed run helper.
[in]cThe calculation helper. The caller owns the pointed calculation helper.
Returns
The calculated port.

◆ SetRecalculate()

Bool SetRecalculate ( GvRun r,
Bool  force_set = false 
)

Marks all outgoing port connections for recalculation. This will also call GvOperatorData::SetRecalculate().

Parameters
[in]rThe run helper. The caller owns the pointed run helper.
[in]force_setForces all nodes to be recalculated, even if they seem to be valid.
Returns
true if successful, otherwise false.

◆ GetBool()

Bool GetBool ( Bool b,
GvRun r 
)

Retrieves a boolean value from the port.

Parameters
[out]bAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetInteger()

Bool GetInteger ( Int32 i,
GvRun r 
)

Retrieves an integer value from the port.

Parameters
[out]iAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetFloat()

Bool GetFloat ( Float f,
GvRun r 
)

Retrieves a float value from the port.

Parameters
[out]fAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetVector()

Bool GetVector ( Vector v,
GvRun r 
)

Retrieves a vector value from the port.

Parameters
[out]vAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetNormal()

Bool GetNormal ( Vector n,
GvRun r 
)

Retrieves a normal vector value from the port.

Parameters
[out]nAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetMatrix()

Bool GetMatrix ( Matrix m,
GvRun r 
)

Retrieves a matrix value from the port.

Parameters
[out]mAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetTime()

Bool GetTime ( BaseTime t,
GvRun r 
)

Retrieves a time value from the port.

Parameters
[out]tAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetString()

Bool GetString ( String s,
GvRun r 
)

Retrieves a string value from the port.

Parameters
[out]sAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetObject()

Bool GetObject ( BaseList2D *&  o,
GvRun r 
)

Retrieves an object value from the port.

Parameters
[out]oAssigned the port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetData()

Bool GetData ( void *  d,
GvValueID  type,
GvRun r 
)

Retrieves the data from the port.

Parameters
[out]dAssigned the port value. The port owns the pointed data.
Points to GV data. The layout of the pointed data is determined by type.
[in]typeDetermines the type of d.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ GetDataInstance()

Bool GetDataInstance ( const void *&  d,
GvValueID  type,
GvRun r 
)

Retrieves the data pointer from the port.

Parameters
[out]dAssigned a pointer to the port data. The port owns the pointed data.
Points to GV data. The layout of the pointed data is determined by type.
[in]typeDetermines the type of d.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was retrieved, otherwise false.

◆ SetBool()

Bool SetBool ( Bool  b,
GvRun r 
)

Sets a boolean value in the port.

Parameters
[in]bThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetInteger()

Bool SetInteger ( Int32  i,
GvRun r 
)

Sets an integer value in the port.

Parameters
[in]iThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetFloat()

Bool SetFloat ( Float  f,
GvRun r 
)

Sets a float value in the port.

Parameters
[in]fThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetVector()

Bool SetVector ( const Vector v,
GvRun r 
)

Sets a vector value in the port.

Parameters
[in]vThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetMatrix()

Bool SetMatrix ( const Matrix m,
GvRun r 
)

Sets a matrix value in the port.

Parameters
[in]mThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetNormal()

Bool SetNormal ( const Vector n,
GvRun r 
)

Sets a normal vector value in the port.

Parameters
[in]nThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetTime()

Bool SetTime ( const BaseTime t,
GvRun r 
)

Sets a time value in the port.

Parameters
[in]tThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetString()

Bool SetString ( const maxon::String s,
GvRun r 
)

Sets a string value in the port.

Parameters
[in]sThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetObject()

Bool SetObject ( const BaseList2D o,
GvRun r 
)

Sets an object value in the port.

Parameters
[in]oThe new port value.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ SetData()

Bool SetData ( const void *  d,
GvValueID  type,
GvRun r 
)

Sets the data in the port.

Parameters
[in]dThe new port value. The port owns the pointed data.
Points to GV data. The layout of the pointed data is determined by type.
[in]typeDetermines the type of d.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the value was set, otherwise false.

◆ GetName()

const String GetName ( GvNode node)

Gets the name of the port.

Parameters
[in]nodeThe node the ports belongs to. The caller owns the pointed node.
Returns
The port name.

◆ SetName()

void SetName ( const maxon::String name)

Sets the name of the port.

Parameters
[in]nameThe new port name.

◆ CopyPortData()

Bool CopyPortData ( GvPort source,
GvRun r 
)

Copies the data from the source port.

Parameters
[in]sourceThe source port. The caller owns the pointed port.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the data was copied, otherwise false.

◆ CopyRawData()

Bool CopyRawData ( void *  source,
GvRun r 
)

Copies the raw void* data from source.

Parameters
[in]sourceThe source data. The caller owns the pointed data.
[in]rThe run helper. The caller owns the pointed run helper.
Returns
true if the raw data was copied, otherwise false.

◆ CalculateRawData()

Bool CalculateRawData ( void *  data,
void *  dest,
GvRun r,
GvValueFlags  calculation,
Float  parm1 = 0.0_f 
)

Convenience function to do calculation with unknown data.
Uses the port's value handler to call GV_VALUE_HANDLER::Calculate(userdata, value_id, portdata, data, dest, 0, calculation, parm1), where portdata is the data of the port.
For example, the result operator does:

if (!v1->GetPort()->CalculateRawData(nullptr, &result, r, GV_CALC_STR))
return false;
@ GV_CALC_STR
Print: *((String*)dest) = String(source1[cpu_id])
Definition: c4d_graphview_enum.h:69
PyObject PyObject * result
Definition: abstract.h:43
Parameters
[in]dataThe second data. This port data is used as first data. The caller owns the pointed data.
[out]destThe destination. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[in]rThe run helper. The caller owns the pointed run helper.
[in]calculationThe calculation to perform: GvValueFlags
[in]parm1An additional parameter.
Returns
true if the result is GV_CALC_ERR_NONE, otherwise false. If there is an error GvRun::SetError() is called.

◆ CalculateRawRawData()

Bool CalculateRawRawData ( void *  data1,
void *  data2,
void *  dest,
GvRun r,
GvValueFlags  calculation,
Float  parm1 = 0.0_f 
)

Convenience function to do calculation with unknown data.
Uses the port's value handler to call GV_VALUE_HANDLER::Calculate(userdata, value_id, data1, data2, dest, 0, calculation, parm1).

Parameters
[in]data1The first data. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[in]data2The second data. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[out]destThe destination. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[in]rThe run helper. The caller owns the pointed run helper.
[in]calculationThe calculation to perform: GvValueFlags
[in]parm1An additional parameter.
Returns
true if the result is GV_CALC_ERR_NONE, otherwise false. If there is an error GvRun::SetError() is called.

◆ CalculatePortData()

Bool CalculatePortData ( GvPort data,
void *  dest,
GvRun r,
GvValueFlags  calculation,
Float  parm1 = 0.0_f 
)

Convenience function to do calculation with unknown data.
Uses the port's value handler to call GV_VALUE_HANDLER::Calculate(userdata, value_id, portdata1, portdata2, dest, 0, calculation, parm1), where portdata1 is the data of the port and portdata2 is the data of the data port.

Parameters
[in]dataThe port with the second data. This port data is used as first data. The caller owns the pointed port.
[out]destThe destination. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[in]rThe run helper. The caller owns the pointed run helper.
[in]calculationThe calculation to perform: GvValueFlags
[in]parm1An additional parameter.
Returns
true if the result is GV_CALC_ERR_NONE, otherwise false. If there is an error GvRun::SetError() is called.

◆ CalculateRawDataRev()

Bool CalculateRawDataRev ( void *  data,
void *  dest,
GvRun r,
GvValueFlags  calculation,
Float  parm1 = 0.0_f 
)

Convenience function to do calculation with unknown data.
Uses the port's value handler to call GV_VALUE_HANDLER::Calculate(userdata, value_id, data, portdata, dest, 0, calculation, parm1), where portdata is the data of the port.

Parameters
[in]dataThe first data. This port data is used as second data. The caller owns the pointed data.
[out]destThe destination. The caller owns the pointed data.
Points to GV data. The layout of the pointed data is determined by value_id.
[in]rThe run helper. The caller owns the pointed run helper.
[in]calculationThe calculation to perform: GvValueFlags
[in]parm1An additional parameter.
Returns
true if the result is GV_CALC_ERR_NONE, otherwise false. If there is an error GvRun::SetError() is called.

◆ GetTag()

Bool GetTag ( BaseList2D *&  t,
GvRun r,
Int32 index = nullptr 
)

Retrieves an indexed tag value from the port.

Parameters
[out]tAssigned the retrieved tag if successful.
[in]rThe run helper. The caller owns the pointed run helper.
[out]indexAssigned the index of the data, if not nullptr. Used by iterators to specify the index of the retrieved data.
Returns
true if the tag was retrieved, otherwise false.

◆ SetTag()

Bool SetTag ( const BaseList2D *const  t,
GvRun r,
Int32  index = 0 
)

Sets an indexed tag value in the port.

Parameters
[in]tThe tag to set. The caller owns the pointed tag.
[in]rThe run helper. The caller owns the pointed run helper.
[in]indexThe data index. Used by iterators.
Returns
true if the tag was set, otherwise false.

◆ GetMaterial()

Bool GetMaterial ( BaseList2D *&  m,
GvRun r,
Int32 index = nullptr 
)

Retrieves an indexed material value from the port.

Parameters
[out]mAssigned the retrieved material if successful.
[in]rThe run helper. The caller owns the pointed run helper.
[out]indexAssigned the index of the data, if not nullptr. Used by iterators to specify the index of the retrieved data.
Returns
true if the material was retrieved, otherwise false.

◆ SetMaterial()

Bool SetMaterial ( const BaseList2D *const  m,
GvRun r,
Int32  index = 0 
)

Sets an indexed material value in the port.

Parameters
[in]mThe material to set. The caller owns the pointed material.
[in]rThe run helper. The caller owns the pointed run helper.
[in]indexThe data index. Used by iterators.
Returns
true if the material was set, otherwise false.

◆ GetInstance()

Bool GetInstance ( BaseList2D *&  i,
GvRun r,
Int32 index = nullptr 
)

Retrieves an indexed instance value from the port.

Parameters
[out]iAssigned the retrieved instance if successful.
[in]rThe run helper. The caller owns the pointed run helper.
[out]indexAssigned the index of the data, if not nullptr. Used by iterators to specify the index of the retrieved data.
Returns
true if the instance was retrieved, otherwise false.

◆ SetInstance()

Bool SetInstance ( const BaseList2D *const  i,
GvRun r,
Int32  index = 0 
)

Sets an indexed instance value in the port.

Parameters
[in]iThe instance to set. The caller owns the pointed instance.
[in]rThe run helper. The caller owns the pointed run helper.
[in]indexThe data index. Used by iterators.
Returns
true if the instance was set, otherwise false.

◆ GetObjectWithIndex()

Bool GetObjectWithIndex ( BaseList2D *&  o,
GvRun r,
Int32 index = nullptr 
)

Retrieves an indexed object value from the port.

Parameters
[out]oAssigned the retrieved object if successful.
[in]rThe run helper. The caller owns the pointed run helper.
[out]indexAssigned the index of the data, if not nullptr. Used by iterators to specify the index of the retrieved data.
Returns
true if the object was retrieved, otherwise false.

◆ SetObjectWithIndex()

Bool SetObjectWithIndex ( const BaseList2D *const  o,
GvRun r,
Int32  index = 0 
)

Sets an indexed object value in the port.

Parameters
[in]oThe object to set. The caller owns the pointed object.
[in]rThe run helper. The caller owns the pointed run helper.
[in]indexThe data index. Used by iterators.
Returns
true if the object was set, otherwise false.

◆ GetOutgoing()

GvDestination* GetOutgoing ( Int32  index)

Retrieves information about the outgoing destinations.

Parameters
[in]indexThe destination index: 0 <= index < GetNrOfConnections()-(IsIncomingConnected() ? 1 : 0)
Returns
The destination information, or nullptr. Cinema 4D owns the pointed GvDestination.

◆ GetUserData()

GeData* GetUserData ( )

Internal.

Since
R17.032

◆ SetUserData()

void SetUserData ( const GeData data)

Internal.

Since
R17.032