maxon.frameworks.nodes.NodesGraphModelInterface

Description

A maxon.frameworks.nodes.NodesGraphModelRef is an implementation of maxon.frameworks.graph.GraphModelInterface which wraps a maxon.frameworks.nodes.NodeSystem.
There may be more than one model working on the same maxon.frameworks.nodes.NodeSystem reference, this is handled by a shared maxon.frameworks.nodes.NodeSystemManagerRef.
Each maxon.frameworks.nodes.NodesGraphModelRef is a certain CreateView “view” on the NodeSystem with individual filter settings and root paths.
The manager (maxon.frameworks.nodes.NodeSystemManagerInterface) coordinates the accesses of the views.

maxon.frameworks.nodes.NodesGraphModelClass is the base implementation of this interface.
It has to be used as base class for custom implementations.

Inheritance diagram

Inheritance

Parent Class:

Child Class:

Methods Signature

AddChild(childId, nodeId, args)

Adds an instance of a node system as child of the root node to this graph.

CreateView(filter, rootPath)

Creates a new view for the node system of this view.

GetBase(node)

Return the original base node.

MoveToGroup(groupRoot, groupId, selection)

Groups the selection of nodes of this graph into a new group node.

Ungroup(group)

Dissolves the given group into its children.

Methods Definition

NodesGraphModelInterface.AddChild(childId, nodeId, args)
Adds an instance of a node system as child of the root node to this graph.
If childId is empty, a UUID will be chosen as identifier of the child, otherwise childId.
In the latter case it is an error if this root node already has a child with that identifier.
Parameters
  • childId (maxon.Id) – Identifier for the child node (if empty, a UUID is chosen).

  • nodeId (maxon.Id) – Identifier of the NodeTemplate

  • args (maxon.DataDictionnary) – Template arguments for templ.

Returns

A GraphNode referencing the added child.

Return type

maxon.frameworks.graph.GraphNode

NodesGraphModelInterface.CreateView(filter, rootPath)
Creates a new view for the node system of this view.
The returned view will be managed by the same maxon.frameworks.nodes.NodeSystemManagerRef as this view.
Parameters
  • filter (maxon.frameworks.nodes.NodeSystemManagerInterface.FILTER) –

    The filter to use for the view.
    If this view is read-only, the FILTER.READ_ONLY flag will be set implicitly.

  • rootPath (maxon.frameworks.graph.NodePath) –

    The absolute path to the root node of the new view.
    Use this if the new view shall not represent the whole graph, but only a node and its inner parts.
    Note that this is an absolute path, so the path of the current view is always ignored.

Returns

A new maxon.frameworks.nodes.NodesGraphModelRef view for the same node system.

Return type

maxon.frameworks.nodes.NodesGraphModelRef

NodesGraphModelInterface.GetBase(node)

Return the original base node.

Parameters

node (maxon.frameworks.graph.GraphNode) – The node to retrieve the NodeSystem from.

Returns

The base NodeSystem of the node.

Return type

maxon.frameworks.nodes.NodeSystem

NodesGraphModelInterface.MoveToGroup(groupRoot, groupId, selection)
Groups the selection of nodes of this graph into a new group node.
groupRoot is used to set up the new group node.
You can leave this empty, then a new node system will be created as an instance of a group asset which fits to the selection (group assets already used by the selection are considered).
But you can also provide a valid node system.

All selected nodes are moved to the group using their original identifiers, including inner connections.
Afterwards the group is MutableRoot::EndModification “finalized” and an instance of the group is added to this graph using the given groupId.
Connections which leave the group are kept by adding ports to the group node as needed, and connecting them correspondingly.
If the used group node already has ports, these will be used where identifiers mach.
Parameters
  • groupRoot (maxon.frameworks.graph.GraphNode) – The GraphNode of another (usually empty) node system which will become the group, can be empty.

  • groupId (Union[str, maxon.Id, maxon.InternedId, maxon.StringInterface]) – Identifier for the new group within this node system (if empty, a UUID is chosen).

  • selection (maxon.BaseArray`[:class:`maxon.frameworks.graph.GraphNode]) – A selection of nodes. Only nodes which are direct children of the root node of this view are considered.

Returns

A GraphNode referencing the added child.

Return type

maxon.frameworks.graph.GraphNode

NodesGraphModelInterface.Ungroup(group)
Dissolves the given group into its children.
This moves all children of group including their inner connections to the parent of group.
External connections (from the group to other nodes) are moved to the inner nodes as well.
Parameters

group (maxon.frameworks.graph.GraphNode) – The group node to dissolve.

Returns

The mapping from original identifiers within the group to the new identifiers used at parent level.

Return type

list[tuple[maxon.InternedId, maxon.InternedId]]