c4d.modules.graphview.GvNode

class c4d.modules.graphview.GvNode
Use GvNodeMaster.CreateNode() to create nodes.
The GvNode is a double BaseList2D node.

Warning

This type cannot be instantiated.

Note

Please use GvNode.GetOperatorContainer() to access most parameters.

A GvNode is a node which is stored in a GvNodeMaster.
A node contains ports represented by GvPort.
../../../../_images/gvnode_main.png

Methods Signatures

GvNode.Redraw(self)

Redraws the node.

GvNode.GetOperatorID(self)

Returns the operator ID.

GvNode.GetOwnerID(self)

Returns the owner ID of the node.

GvNode.GetNodeMaster(self)

Returns the GvNodeMaster where the node is attached to.

GvNode.IsGroupNode(self)

Checks if the node is a group node.

GvNode.SetPortType(self, port, id)

Changes the type of a port of this node.

GvNode.ResetPortType(self, id)

Changes the type of the port. Used to manage dynamic data ports.

GvNode.RemoveUnusedPorts(self[, message])

Removes all unused ports - Sends a message to the node.

GvNode.RemoveConnections(self)

Removes all connections of the node.

GvNode.RemovePort(self, port[, message])

Removes a port from this node.

GvNode.RemovePortIsOK(self, port)

Checks if it is OK to remove a port from this node.

GvNode.GetPort(self, sub_id)

Retrieves a port by sub ID.

GvNode.GetPortIndex(self, id)

Gets the index of a port by sub ID.

GvNode.GetOutPorts(self[, type])

Retrieves all outports of a node.

GvNode.GetInPorts(self[, type])

Retrieves all inports of a node.

GvNode.GetInPort(self, id)

Retrieves an inport by index.

GvNode.GetOutPort(self, id)

Retrieves an outport by index.

GvNode.GetInPortCount(self)

Returns the count of the inports.

GvNode.GetOutPortCount(self)

Returns the count of the outports.

GvNode.SetOperatorContainer(self, bc)

Set the settings container.

GvNode.GetOpContainerInstance(self)

Retrieves a pointer to the internal operator’s container.

GvNode.GetOperatorContainer(self)

Returns the settings container.

GvNode.AddPort(self, io, id[, flag, ...])

Adds a port to the node.

GvNode.AddPortIsOK(self, io, id)

Checks if AddPort() would be successful.

GvNode.OperatorSetData(self, type, data, mode)

Sets data in the operator. Usually simulates dragging onto the node.

Inheritance

Parent Class:

Methods Documentation

GvNode.Redraw(self)

Redraws the node.

GvNode.GetOperatorID(self)

Returns the operator ID.

Return type

int

Returns

The id.

GvNode.GetOwnerID(self)

Returns the owner ID of the node.

Return type

int

Returns

The id.

ID_GV_SYSTEM_OWNER

System.

ID_GV_GENERAL_OWNER

General.

ID_GV_IGNORE_OWNER

Ignore owner.

GvNode.GetNodeMaster(self)

Returns the GvNodeMaster where the node is attached to.

Return type

Optional[c4d.modules.graphview.GvNodeMaster]

Returns

The GvNodeMaster or None if there is no nodemaster.

GvNode.IsGroupNode(self)

Checks if the node is a group node.

Return type

bool

Returns

True if the node is a group node, otherwise False.

GvNode.SetPortType(self, port, id)

Changes the type of a port of this node.

Parameters
GvNode.ResetPortType(self, id)

Changes the type of the port. Used to manage dynamic data ports.

Parameters

id (int) – The type.

GvNode.RemoveUnusedPorts(self, message=True)

Removes all unused ports - Sends a message to the node.

Parameters

message (bool) – If this is True, the operator receives a message when the ports are removed.

GvNode.RemoveConnections(self)

Removes all connections of the node.

GvNode.RemovePort(self, port, message=False)

Removes a port from this node.

Parameters
  • port (c4d.modules.graphview.GvPort) – A port of this node to remove.

  • message (bool) – If this is True the operator receives a message when the port is removed.

GvNode.RemovePortIsOK(self, port)

Checks if it is OK to remove a port from this node.

Note

Used to check if a call to GvNode.RemovePort() would succeed.

Parameters

port (c4d.modules.graphview.GvPort) – A port of this node to remove.

Return type

bool

Returns

True if this port can be remove.

GvNode.GetPort(self, sub_id)

Retrieves a port by sub ID.

Parameters

sub_id (int) – Port sub ID.

Return type

Optional[c4d.modules.graphview.GvPort]

Returns

The retrieved port, or None.

GvNode.GetPortIndex(self, id)

Gets the index of a port by sub ID.

Parameters

id (int) – Port sub ID.

Return type

int

Returns

Port index.

GvNode.GetOutPorts(self, type=- 1)

Retrieves all outports of a node.

Parameters

type (int) –

If type is set, just the ports with the given type will be returned.
Each port has its own type ID’s for the ports so check the C-header files of the node.

Return type

Optional[List[c4d.modules.graphview.GvPort]]

Returns

The GvPorts or None if no port was found.

GvNode.GetInPorts(self, type=- 1)

Retrieves all inports of a node.

Parameters

type (int) –

If type is set, just the ports with the given type will be returned.
Each port has its own type ID’s for the ports so check the C-header files of the node.

Return type

Optional[List[c4d.modules.graphview.GvPort]]

Returns

The GvPorts or None if no port was found.

GvNode.GetInPort(self, id)

Retrieves an inport by index.

Parameters

id (int) – the index

Return type

Optional[c4d.modules.graphview.GvPort]

Returns

The GvPort or None if no port was found.

GvNode.GetOutPort(self, id)

Retrieves an outport by index.

Parameters

id (int) – the index

Return type

Optional[c4d.modules.graphview.GvPort]

Returns

The GvPort or None if no port was found.

GvNode.GetInPortCount(self)

Returns the count of the inports.

Return type

int

Returns

The count.

GvNode.GetOutPortCount(self)

Returns the count of the outports.

Return type

int

Returns

The count

GvNode.SetOperatorContainer(self, bc)

Set the settings container.

Parameters

str – The container.

GvNode.GetOpContainerInstance(self)
Retrieves a pointer to the internal operator’s container.
This means that the container can be changed directly.
Return type

c4d.BaseContainer

Returns

The container.

GvNode.GetOperatorContainer(self)

Returns the settings container.

Return type

c4d.BaseContainer

Returns

The container.

GvNode.AddPort(self, io, id, flag=GV_PORT_FLAG_IS_VISIBLE, message=False)

Adds a port to the node.

Note

To add a port for a user data parameter create the DescID of that parameter:

USERDATA_NUMBER = 1
nodeObjOut.AddPort(c4d.GV_PORT_OUTPUT, c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(USERDATA_NUMBER)), message=True)
Parameters
  • io (int) –

    The IO mode of the port to create:

    GV_PORT_INVALID

    Invalid.

    GV_PORT_INPUT

    Input.

    GV_PORT_OUTPUT

    Output.

    GV_PORT_INPUT_OR_GEDATA

    Input or GeData.

  • id (Union[int, c4d.DescID]) – The ID of the port to create.

  • flag (int) –

    Flags:

    GV_PORT_FLAG_NONE

    No flag.

    GV_PORT_FLAG_IS_VISIBLE

    Visible port.

    GV_PORT_FLAG_IS_ITERATE

    Iteration port.

  • message (bool) – If True the operator receives a message when the port is added.

Return type

Optional[c4d.modules.graphview.GvPort]

Returns

The created port or None if creation failed.

GvNode.AddPortIsOK(self, io, id)

Checks if AddPort() would be successful.

Parameters
  • io (int) –

    The port mode:

    GV_PORT_INVALID

    Invalid.

    GV_PORT_INPUT

    Input.

    GV_PORT_OUTPUT

    Output.

    GV_PORT_INPUT_OR_GEDATA

    Input or GeData.

  • id (int) – The type id of the port.

Return type

bool

Returns

True if adding the port would succeed, otherwise False.

GvNode.OperatorSetData(self, type, data, mode)

Sets data in the operator. Usually simulates dragging onto the node.

New in version R18.057.

Parameters
  • type (int) –

    The data type:

    GV_ATOMARRAY

    list of c4d.C4DAtom

    The active objects.

    GV_ATOM

    c4d.C4DAtom

    The active object.

    GV_DESCID

    dict(‘did’: c4d.DescID, ‘arr’: list of c4d.C4DAtom)

    The description ID and related active object(s).

  • data (any) – The data to set. Depends on type.

  • mode (int) –

    The set data mode:

    GV_OP_NOP

    Ignore.

    GV_OP_SET

    Set the internal value to the parameter value. (The constant node uses this.)

    GV_OP_DROP

    An atom has been dropped over the node.

    GV_OP_DROP_IN_BODY

    An atom has been dropped over the body of the node.

    GV_OP_DROP_IN_INDOCK

    An atom has been dropped in the inport area of the node.

    GV_OP_DROP_IN_OUTDOCK

    An atom has been dropped in the outport area of the node.

Return type

bool

Returns

True if the data was set, otherwise False.