<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Script to change parameters across all similar nodes material]]></title><description><![CDATA[<p dir="auto">Hi, I want to change all settings of thickness in Contour node of all toon materials?<br />
Any idea of how to do this?<br />
thanks</p>
<pre><code>import c4d
from c4d import gui

def traverse_nodes(graph, ext_value, int_value):
    """Recursively search nodes in a graph."""
    for node in graph.GetNodes():
        try:
            node_id = node.GetDefinition().GetID()
        except:
            node_id = None

        # Look for the RS Contour node by its ID string
        if node_id == "com.redshift3d.redshift4c4d.nodes.core.contour":
            print(f"✅ Found Contour node in: {node.GetName()}")
            node.SetParameter("com.redshift3d.redshift4c4d.nodes.core.contour.externalthickness", ext_value, c4d.DESCFLAGS_SET_0)
            node.SetParameter("com.redshift3d.redshift4c4d.nodes.core.contour.internalthickness", int_value, c4d.DESCFLAGS_SET_0)

        # Check if the node contains subgraphs
        for port in node.GetInputs() + node.GetOutputs():
            subgraph = port.GetNodeGraph()
            if subgraph:
                traverse_nodes(subgraph, ext_value, int_value)

def main():
    # Get user values
    ext_str = gui.InputDialog("External Thickness", "1.0")
    int_str = gui.InputDialog("Internal Thickness", "1.0")

    try:
        ext_value = float(ext_str)
        int_value = float(int_str)
    except ValueError:
        gui.MessageDialog("Invalid number input.")
        return

    # Loop through all materials
    for mat in doc.GetMaterials():
        if not mat.CheckType(1036224):  # Redshift material
            continue

        node_material = mat.GetNodeMaterialReference()
        if not node_material:
            continue

        # Try all available graphs inside the material
        graphs = node_material.GetGraphs()
        if not graphs:
            continue

        print(f"Scanning material: {mat.GetName()}")

        for graph in graphs:
            traverse_nodes(graph, ext_value, int_value)

    c4d.EventAdd()

if __name__ == "__main__":
    main()

</code></pre>
]]></description><link>http://developers.maxon.net/forum/topic/16313/script-to-change-parameters-across-all-similar-nodes-material</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 13:43:06 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16313.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Aug 2025 00:23:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Script to change parameters across all similar nodes material on Tue, 19 Aug 2025 06:24:22 GMT]]></title><description><![CDATA[<p dir="auto">okay the docs you gave were great for insight</p>
<p dir="auto">working code to change parameter of roughness for x given mat selections</p>
<pre><code class="language-py">import c4d
import maxon
from maxon import GraphDescription

doc = c4d.documents.GetActiveDocument()

# Get selected materials directly
selected_materials = doc.GetActiveMaterials()

# Modify roughness for each selected material
for material in selected_materials:
    graph = GraphDescription.GetGraph(material, 
                                      nodeSpaceId=maxon.NodeSpaceIdentifiers.RedshiftMaterial)
    
    GraphDescription.ApplyDescription(graph, {
        "$query": {
            "$type": "Standard Material"
        },
        "Reflection/Roughness": 1
    })

c4d.EventAdd()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/76776</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76776</guid><dc:creator><![CDATA[annoyedUser]]></dc:creator><pubDate>Tue, 19 Aug 2025 06:24:22 GMT</pubDate></item><item><title><![CDATA[Reply to Script to change parameters across all similar nodes material on Thu, 14 Aug 2025 08:58:34 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/annoyeduser">@<bdi>annoyedUser</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. Your code looks very much like generated by a chatbot or generated with the help of a chatbot. Please note our <a href="https://developers.maxon.net/forum/topic/15244/support-procedures/3" target="_blank" rel="noopener noreferrer nofollow ugc">Support Procedures: Scope of Support</a> regrading the usage of AI. Please also post into the correct forum for future topics, I have moved your topic into the <em>Cinema 4D SDK</em> forum.</p>
<p dir="auto">Your code does not make too much sense, I cannot dissect all the issues there. It is possible to do with the Nodes API what you want to do but it is more an API for experts. You can find <a href="https://github.com/Maxon-Computer/Cinema-4D-Python-API-Examples/tree/master/scripts/05_modules/node" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> some code examples for it. Novice users should rather use <a href="https://developers.maxon.net/docs/py/2025_3_1/manuals/manual_graphdescription.html" target="_blank" rel="noopener noreferrer nofollow ugc">graph descriptions</a> which is a less powerful but also simpler API.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
<p dir="auto">To change the external thickness of each Contour node in a document, you could write something like using a graph description query:</p>
<pre><code class="language-py">"""Sets the external thickness of all 'Contour' nodes in Redshift material graphs of the active 
document to 2.
"""

import c4d
import maxon

doc: c4d.documents.BaseDocument  # The currently active document.
op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.

def main() -&gt; None:
    """Called by Cinema 4D when the script is being executed.
    """
    # Iterate over the material graphs of all Redshift materials in the document.
    for graph in maxon.GraphDescription.GetMaterialGraphs(
        doc, maxon.NodeSpaceIdentifiers.RedshiftMaterial):
        # Apply a graph description to each of them which ...
        maxon.GraphDescription.ApplyDescription(graph, 
        {
            # ... queries all nodes of type 'Contour' in the graph ...
            "$query": {
                "$qmode": maxon.GraphDescription.QUERY_FLAGS.MATCH_ALL | 
                          maxon.GraphDescription.QUERY_FLAGS.MATCH_MAYBE,
                "$type": "Contour",
            },
            # ... so that we can set the thickness value of all matching nodes to 2.
            "External/Thickness": 2
        })


if __name__ == '__main__':
    main()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/76768</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76768</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Thu, 14 Aug 2025 08:58:34 GMT</pubDate></item></channel></rss>