Hey, thanks for the help!
I've changed type hinting, just to make sure that was not the source of the problem.
The weird thing is, this is the whole script, so I have no clue where the traceback error is coming from.
InternedId is indeed not in my code.
Even this script is giving that error now and that one was working just fine earlier today
https://github.com/PluginCafe/cinema4d_py_sdk_extended/blob/master/scripts/05_modules/node/access_graph_entities_2024_2.py
import c4d
import maxon
doc: c4d.documents.BaseDocument # The active document.
def main():
# For the selected mateiral in the currently active document ...
for material in doc.GetActiveMaterials():
# ... get its node material reference and step over all materials which do not have a
# Redshift graph or where the graph is malformed.
nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference()
if not nodeMaterial.HasSpace("com.redshift3d.redshift4c4d.class.nodespace"):
continue
graph: maxon.GraphModelRef = nodeMaterial.GetGraph(
"com.redshift3d.redshift4c4d.class.nodespace")
if graph.IsNullValue():
raise RuntimeError("Found malformed empty graph associated with node space.")
# Get the root of the graph, the node which contains all other nodes.
root: maxon.GraphNode = graph.GetRoot()
# Iterate over all nodes in the graph, i.e., unpack things like nodes nested in groups.
# With the mask argument we could also include ports in this iteration.
for node in root.GetInnerNodes(mask=maxon.NODE_KIND.NODE, includeThis=False):
# There is a difference between the asset ID of a node and its ID. The asset ID is
# the identifier of the node template asset from which a node has been instantiated.
# It is more or less the node type identifier. When we have three RS Texture nodes
# in a graph they will all have the same asset ID. But their node ID on the other hand
# will always be unique to a node.
assetId: maxon.Id = node.GetValue("net.maxon.node.attribute.assetid")[0]
nodeId: maxon.Id = node.GetId()
# Step over everything that is not a Texture node, we could also check here for a node
# id, in case we want to target a specific node instance.
if assetId != maxon.Id("com.redshift3d.redshift4c4d.nodes.core.texturesampler") and node.GetBit(c4d.BIT_ACTIVE):
continue
print("texture node found")
port = node.GetInputs().FindChild("com.redshift3d.redshift4c4d.nodes.core.texturesampler.tspace_id")
port.SetPortValue("RS_INPUT_COLORSPACE_RAW ")
if __name__ == "__main__":
main()
Traceback (most recent call last):
File "scriptmanager", line 45, in <module>
File "scriptmanager", line 37, in main
TypeError: 'InternedId' object is not callable