maxon.NodePathInterface

Description

A maxon.NodePath identifies a graph node (a true node, port or port list) within a node graph.
It consists of a list of identifiers (one for each hierarchy level) just like the path of a file in a file system. In the textual notation of a path we use / as separator character (except around < or >, see below).
The root node has an empty path, and port lists use the special identifiers < (input port list) and > (output port list).
For example in the graph there are the following paths:
  • The empty path identifies the root node.

  • < is the path of the input port list of the root node (containing the object port), > of the output port list (containing the center port).

  • <object, <object/geometry, <object/bounds are the paths of the input ports of the root node.

  • >center is the path of the output port of the root node.

  • x is the path of the child node x.

  • x has the input port x<bounds and the output port x>c.

  • x has the inner node x/n with ports x/n<in and x/n>out.

A path cannot contain more than one of the port list identifiers < or >.
All methods which initialize or modify a path return an error if the result was such an invalid path.
To make the string representation shorter and more readable, the separator character / is only used between regular identifiers, but not around the port list identifiers < or >.
Therefore we write e.g. x/n>out instead of x/n/>/out.

Inheritance diagram

Inheritance

Child Class:

Methods Signature

Compare(other)

Compares this and other.

DescribeIO(*args)

FromCString(path)

Parses a node path given as a character block into a NodePath object.

GetCount()

Returns the length of this path.

GetHashCode()

Returns the hash code of maxon.NodePath.

GetKind()

Returns the node kind of the graph node which is identified by this path: - A path without path list identifiers < or > is a true node (maxon.NODE_KIND.NODE), for example node/child.

GetLastId()

Returns the last element of this path.

GetNode()

Returns only the path of the node without ports.

GetNodeDepth()

Returns the hierarchy depth of the true node which is identified by this path.

GetParent()

Returns the path of the parent of this path.

GetPart(src, count)

Returns a part of this node path as a new NodePath.

GetPortPart()

Returns the port part of this path as a new NodePath.

GetPortPath()

Returns only the relative port path without the node path.

GetTopLevelPort()

Returns the path to the @ref Port “top-level port” of this path.

IsEmpty()

Checks if this path is an empty path.

IsInputsOrOutputs(i)

Checks if the identifier i stands for the input or output port list of a node, so if it is either ‘<’ or ‘>’.

IsPopulated()

Checks if this path contains anything.

IsPortOfRoot()

Checks if this path identifies a port of the root node of a node system.

IsTopLevelPort()

Checks if this path identifies a “top-level port”.

LessThan(other)

LessThanOrEqual(other)

Prepend(prefix)

Prepends a node prefix at the beginning of this path.

PrivateGetKind()

StartsWith(other)

Checks whether this path starts with other.

ToString()

__add__(other)

Appends a node subpath at the end of this path.

__eq__(other)

Checks if self equals to other.

__getitem__(index)

Returns the path element at the given #index.

__hash__()

Return hash(self).

__iter__()

Returns an iterator pointing to the first identifier of this path.

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

__ne__(other)

Checks if self is not equals to other.

Methods Definition

NodePathInterface.Compare(other)

Compares this and other.

Parameters

other – Another maxon.NodePath

Return type

maxon.COMPARERESULT

Returns

Result of the comparison

static NodePathInterface.DescribeIO(*args)
static NodePathInterface.FromCString(path)

Parses a node path given as a character block into a NodePath object.

The given #path has to match the format returned by ToCString, otherwise an error is returned.

Parameters

path (maxon.Block [maxon.Char]) – The path to parse.

Returns

The parsed NodePath.

Return type

maxon.NodePath

NodePathInterface.GetCount()

Returns the length of this path.

Note

The path elements have indices from 0 up to length-1.

Returns

Number of elements of this path.

Return type

int

NodePathInterface.GetHashCode()

Returns the hash code of maxon.NodePath.

Returns

Hash code.

Return type

int

NodePathInterface.GetKind()

Returns the node kind of the graph node which is identified by this path: - A path without path list identifiers < or > is a true node (maxon.NODE_KIND.NODE), for example node/child. - A path which ends with < or > is a port list (maxon.NODE_KIND.INPUTS or maxon.NODE_KIND.OUTPUTS), for example node/child/<. - A path which contains < or >, but does not end with such an identifier is a port (maxon.NODE_KIND.INPORT or maxon.NODE_KIND.OUTPORT), for example node/child/</in.

Returns

The node kind of the graph node identified by this path.

Return type

maxon.NODE_KIND

NodePathInterface.GetLastId()

Returns the last element of this path.

Returns

Last element of this path, or an empty identifier if the path is empty.

Return type

maxon.InternedId

NodePathInterface.GetNode()

Returns only the path of the node without ports.

Returns

maxon.NodePath with the node path on success.

Return type

maxon.NodePath

NodePathInterface.GetNodeDepth()
Returns the hierarchy depth of the true node which is identified by this path.
If this path identifies a true node directly, the depth is the number of path elements. Otherwise, if this path identifies a port or port list, the depth is the depth of the innermost enclosing true node, i.e., the number of path elements up to but excluding the port list identifier.
For example all of the paths node/child, node/child/< and node/child/</in have a node depth of 2 because for all those paths node/child is the innermost true node.
Returns

The depth of the true node given by this path.

Return type

int

NodePathInterface.GetParent()

Returns the path of the parent of this path.

Return type

maxon.NodePath

Returns

The parent of this path, or an empty path if this path is already the root path.

NodePathInterface.GetPart(src, count)

Returns a part of this node path as a new NodePath.

Parameters
  • src (int) – Position where the new partial path will start. This has to be within the bounds, otherwise an error is returned.

  • count (int) – Number of identifiers for the partial path. If it is larger than the number of available identifiers an error is returned.

Returns

The partial path.

Return type

maxon.NodePath

NodePathInterface.GetPortPart()
Returns the port part of this path as a new NodePath.
The port parts starts at the input/output list identifier.
Returns

The port part of this path.

Return type

maxon.NodePath

NodePathInterface.GetPortPath()

Returns only the relative port path without the node path.

Returns

PathBlock with the ports on success.

Return type

maxon.Block [maxon.InternedId]

NodePathInterface.GetTopLevelPort()
Returns the path to the @ref Port “top-level port” of this path.
The top-level port of a port is the outermost enclosing port, i.e., an enclosing port which is a direct child of a port list, or the port itself it this is already a direct child of a port list.
Returns

The path to the top-level port of the port given by this path. If this path doesn’t represent a port, an error is returned.

Return type

maxon.NodePath

NodePathInterface.IsEmpty()

Checks if this path is an empty path. The root node of a node system is identified by an empty path.

Returns

True if this is an empty path (of length 0), False otherwise.

Return type

bool

NodePathInterface.IsInputsOrOutputs(i)

Checks if the identifier i stands for the input or output port list of a node, so if it is either ‘<’ or ‘>’.

Parameters

i (maxon.InternedId) – An identifier for a general node.

Returns

True if the identifier stands for the input or output port list.

Return type

bool

NodePathInterface.IsPopulated()

Checks if this path contains anything.

Returns

True if this is not an empty path (of length 0), False otherwise.

Return type

bool

NodePathInterface.IsPortOfRoot()
Checks if this path identifies a port of the root node of a node system.
This includes not only top-level ports, but also nested ports.
Returns

True if this path stands for a port of the root node, False otherwise.

Return type

bool

NodePathInterface.IsTopLevelPort()
Checks if this path identifies a “top-level port”.
A top-level port is a port which is not nested within another port, but a direct child of the input or output port list of a node.
Return type

bool

Returns

True if this path stands for a top-level port, False otherwise.

NodePathInterface.LessThan(other)
NodePathInterface.LessThanOrEqual(other)
NodePathInterface.Prepend(prefix)

Prepends a node prefix at the beginning of this path.

Parameters

prefix (maxon.Block [maxon.InternedId]) – The prefix to insert.

Returns

The newly maxon.NodePath

Return type

maxon.NodePath

NodePathInterface.PrivateGetKind()
NodePathInterface.StartsWith(other)

Checks whether this path starts with other.

Parameters

other (maxon.Block [maxon.InternedId]) – Another path.

Returns

True if this path starts with the given path or in case of error, otherwise False.

Return type

bool

NodePathInterface.ToString()
NodePathInterface.__add__(other)

Appends a node subpath at the end of this path.

Parameters

other (Union[maxon.Id, str, maxon.InternedId, maxon.NodePath]) – The subpath to append.

Returns

The operation result.

Return type

maxon.NodePath

NodePathInterface.__eq__(other)

Checks if self equals to other.

Parameters

other (Union[maxon.Id, str, maxon.InternedId, maxon.NodePath]) – The other to check against self.

Returns

True if this equals other, False otherwise.

NodePathInterface.__getitem__(index)

Returns the path element at the given #index.

Note

The index is zero-based, i.e., from 0 up to length-1.

Parameters

index (int) – The index of the element to return. It has to be within the bounds, otherwise the behaviour is undefined.

Returns

The path element at index.

Return type

maxon.InternedId

NodePathInterface.__hash__()

Return hash(self).

NodePathInterface.__iter__()

Returns an iterator pointing to the first identifier of this path.

Returns

Generator pointing to first identifier.

Return type

Generator[maxon.InternedId]

NodePathInterface.__le__(other)

Return self<=value.

NodePathInterface.__lt__(other)

Return self<value.

NodePathInterface.__ne__(other)

Checks if self is not equals to other.

Parameters

other (Union[maxon.Id, str, maxon.InternedId, maxon.NodePath]) – The other to check against self.

Returns

True if this is not equals other, False otherwise.