SOLVED String values for the "FindChild"?

There is no string they are just IDs. The string is converted to an maxon::Id

You can not use fresnel_useior because this is not the ID of the port. The ID of the port is com.redshift3d.redshift4c4d.nodes.core.fresnel.fresnel_useior (and yes this is a bit verbose)

The symbol for this ID (at least in c++) should be redshift3d::redshift4c4d::nodes::core::fresnel::fresnel_useior but again they are not exposed.

@ferdinand created a nice c++ example about connecting ports in redshift and using the texture node. You can see there that he first search for the port bundle and then, search for the file port.

    // Retrieve the "Filename" port of the texture node.
    maxon::GraphNode tex0InportRust = rustTextureNode.GetInputs().FindChild(
      maxon::Id("com.redshift3d.redshift4c4d.nodes.core.texturesampler.tex0")) iferr_return;
    if (!tex0InportRust.IsValid())
      return maxon::UnexpectedError(MAXON_SOURCE_LOCATION, "Failed to access port."_s);
    // The "Filename" port is a port bundle which consists out of two sub-ports, the "path" and the
    // "layer" port. The texture URL is written into the "path" sub-port.
    maxon::GraphNode pathInportRust = tex0InportRust.FindChild(maxon::Id("path")) iferr_return;
    if (!pathInportRust.IsValid())
      return maxon::UnexpectedError(MAXON_SOURCE_LOCATION, "Failed to access port."_s);
    // Set the path of the rust texture node to the URL of the rust texture asset.
    pathInportRust.SetDefaultValue(rustTextureUrl) iferr_return;



RE: There is no string they are just IDs.
Ah. I guess I was misguided.
I was thinking the FindChild spits out the verbose id.
For the sake of argument, why did the script used a string value?
colordePort = bsdfNodeInputs.FindChild("color")
That's the basis of my confusion lol

RE: nice c++ example
Missed this one out. Thanks! At least now I have a base example to check.

@bentraje said in String values for the "FindChild"?:

For the sake of argument, why did the script used a string value?

When I wrote the nodes examples, the symbols were not necessarily available, and/or public. The node API is now more stable, i need to update some examples.



Thanks for the response but it still gives me error though.

I tried this one:

fresnel_port = node.FindChild(maxon.Id("com.redshift3d.redshift4c4d.nodes.core.fresnel.fresnel_useior"))

It gives me an error of
TypeError: unable to convert builtins.NativePyData to @net.maxon.datatype.internedid

or is there a different way to access the port?

I also tried the actual string id

fresnel_port = node.FindChild("com.redshift3d.redshift4c4d.nodes.core.fresnel.fresnel_useior")
it gives me null.

All of the examples in the github does not access one port (it access all ports) except for the so I'm not sure how to proceed.

Example in this thread is using a generic string too instead of an ID so can't really refer directly


sorry, we must define which version you want to use. Depending on the version this can vary a lot. On some version, functions are in a different class, Strings are not converted to maxon::Id. Using python for the node API was a bit limited in r25.



gotcha sorry about that.
what are my options for R25? (i.e. how can I use the FindChild with the Maxon Id ? )


Something like this should works in R25. This will find the base_color ports of the redshift material. The Material must be a standard material and the standard node must be selected.

import c4d
import maxon
from c4d import gui
from maxon.frameworks import nodes

# Main function
def main():
    mat = doc.GetActiveMaterial()
    if mat is None:
        raise ValueError("can't retrieve the selected material")

    nodespaceId = c4d.GetActiveNodeSpaceId()
    nodemat = mat.GetNodeMaterialReference()
    graph = nodemat.GetGraph(nodespaceId)

    def PrintNode(node):
        colorNode = node.GetInputs().FindChild("com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base_color")
        print (colorNode)
        return True

    # With newest version of cinema 4D,  the function to retrieve the selected nodes was moved to another class so instead use the new one.
    #maxon.GraphModelHelper.GetSelectedNodes(graph, maxon.NODE_KIND.ALL_MASK, PrintNode)
# Execute main()

if __name__=='__main__':



Gotcha. Thanks for the clarification.
Sorry for the trouble.

Works as expected. Will close this thread now.