Hey @bentraje,
first of all, I understand your frustration, we just yesterday talked about the state of the Nodes API and are well aware of its hurdles for anything but super-experts. On the other hand, I must point out again, that fragments of code or error messages are pretty meaningless. As stated in the forum guidelines, you should post executable code.
With that being said, I can confirm that GraphNode.GetConnectionValues
is behaving oddly. But that could be because Redshift really does not like laptop as a rendering device. Everything else works fine for me here but I still have no clue what you want to do effectively.
PS: The mistake in your GetConnections
call lied in the incorrect mask
value. The documentation for the method is a bit butchered, we will fix that. I would however always recommend using the VS Code bindings, as it would have told you this:

Cheers,
Ferdinand
Graph:

Output:
maxon.GraphModelHelper.GetDirectPredecessors(endNode, maxon.NODE_KIND.NODE) = [standardmaterial@Hv6m0BuyCB4idfeZnssZYC]
maxon.GraphModelHelper.GetDirectPredecessors(endNode, maxon.NODE_KIND.OUTPORT) = [standardmaterial@Hv6m0BuyCB4idfeZnssZYC>com.redshift3d.redshift4c4d.nodes.core.standardmaterial.outcolor]
maxon.GraphModelHelper.GetAllPredecessors(endNode, maxon.NODE_KIND.NODE) = [standardmaterial@Hv6m0BuyCB4idfeZnssZYC, group@WVcBzy1WDR_kJrRviYwbmF, texturesampler@EddwvQ5ALJSnU5EcX99U$x, texturesampler@E1AoVUhQEBEn$4nuyz8irm, rsscalarramp@TEY3JetDLNkqz86IJahb_C, texturesampler@aKfJScQXKF0ugzuJyl27MG, texturesampler@F9gCNSUTGdMlqUsC69b$0A, bumpmap@HiKbvo1FLNCkb4DKLPKvjE, texturesampler@crysppSdAZvt5dCHd$$i1E]
----------------------------------------------------------------------------------------------------
out-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC>com.redshift3d.redshift4c4d.nodes.core.standardmaterial.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0
in-port: output@TvFBXodvDtuu346T8ZukFG<com.redshift3d.redshift4c4d.node.output.surface
out-port: group@WVcBzy1WDR_kJrRviYwbmF>outcolor@KbTuENK$GBdgV12yPDVlKA
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.21404114365577698,0.21404114365577698,0.21404114365577698
in-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC<com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base_color
out-port: texturesampler@EddwvQ5ALJSnU5EcX99U$x>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: group@WVcBzy1WDR_kJrRviYwbmF<in@GrX6SuapEpQkoY6CBvFyAj
out-port: texturesampler@E1AoVUhQEBEn$4nuyz8irm>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: group@WVcBzy1WDR_kJrRviYwbmF<in@fd8$tVTfOhKtjHscJx8tPm
out-port: rsscalarramp@TEY3JetDLNkqz86IJahb_C>com.redshift3d.redshift4c4d.nodes.core.rsscalarramp.out
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0
in-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC<com.redshift3d.redshift4c4d.nodes.core.standardmaterial.refl_weight
out-port: texturesampler@aKfJScQXKF0ugzuJyl27MG>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: rsscalarramp@TEY3JetDLNkqz86IJahb_C<com.redshift3d.redshift4c4d.nodes.core.rsscalarramp.input
out-port: texturesampler@F9gCNSUTGdMlqUsC69b$0A>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC<com.redshift3d.redshift4c4d.nodes.core.standardmaterial.refl_roughness
out-port: texturesampler@EddwvQ5ALJSnU5EcX99U$x>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC<com.redshift3d.redshift4c4d.nodes.core.standardmaterial.sheen_color
out-port: bumpmap@HiKbvo1FLNCkb4DKLPKvjE>com.redshift3d.redshift4c4d.nodes.core.bumpmap.out
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0
in-port: standardmaterial@Hv6m0BuyCB4idfeZnssZYC<com.redshift3d.redshift4c4d.nodes.core.standardmaterial.bump_input
out-port: texturesampler@crysppSdAZvt5dCHd$$i1E>com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor
wires: Wires - Value:16, Event:16, Dependency:16, Context:0, Hidden:0, Inhibit:0, Slink:0, Tlink:0
default: 0.0,0.0,0.0,1.0
in-port: bumpmap@HiKbvo1FLNCkb4DKLPKvjE<com.redshift3d.redshift4c4d.nodes.core.bumpmap.input
Code:
"""Unwinds connection information in the active node space graph of the first material in the
active scene.
"""
import c4d
import maxon
doc: c4d.documents.BaseDocument # The active document
def main() -> None:
"""Unwinds connection information in the active node space graph of the first material in the
active scene.
"""
# Attempt to get the node graph for the active node space for the first material in the document.
material: c4d.BaseMaterial = doc.GetFirstMaterial()
if not material:
return
nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference()
currentSpace: maxon.Id = c4d.GetActiveNodeSpaceId()
graph: maxon.NodesGraphModelInterface = nodeMaterial.GetGraph(currentSpace)
if graph.IsNullValue():
return
# Get the end node in the graph, so that we can unwind connection information.
endNode: maxon.GraphNode = graph.GetNode(nodeMaterial.GetMaterialNodePath(currentSpace))
if endNode.IsNullValue():
return
# Get the direct true node predecessors of the end node, i.e., all true nodes that are connected
# directly to the end node.
print (f"{maxon.GraphModelHelper.GetDirectPredecessors(endNode, maxon.NODE_KIND.NODE) = }")
# Get the direct out-port node predecessors of the end node, i.e., all out-port nodes that are
# connected directly to the end node.
print (f"{maxon.GraphModelHelper.GetDirectPredecessors(endNode, maxon.NODE_KIND.OUTPORT) = }")
# Get all true node predecessors of the end node, i.e., all true nodes that are connected
# directly or indirectly to the end node. In a well connected graph, i.e., a graph where every
# node does contribute to the end node, this will simply yield all true nodes.
print (f"{maxon.GraphModelHelper.GetAllPredecessors(endNode, maxon.NODE_KIND.NODE) = }")
print ("\n", "-" * 100)
def GetPredConnectionInfo(node: maxon.GraphNode) -> None:
"""Prints predecessor connection information for #node in a recursive fashion.
"""
# Bail when the passed node is not a true node.
if node.GetKind() != maxon.NODE_KIND.NODE:
return
# For every input port in #node.
for inPort in node.GetInputs().GetChildren():
# Get the connected output ports and their wires.
for outPort, wires in inPort.GetConnections(
maxon.PORT_DIR.INPUT, None, maxon.Wires.All(), maxon.WIRE_MODE.ALL):
# Get the true node which owns #outPort, i.e., the other true node which is
# connected to the true node #node.
otherNode: maxon.GraphNode = outPort.GetAncestor(maxon.NODE_KIND.NODE)
defaultValue: any = outPort.GetDefaultValue()
print (f"\nout-port: {outPort}")
print (f"wires: {wires}")
print (f"default: {defaultValue}")
print (f"in-port: {inPort}")
# Start the recursion with #otherNode.
GetPredConnectionInfo(otherNode)
GetPredConnectionInfo(endNode)
if __name__ == '__main__':
main()