The material is looking like this:
I'm trying with this code:
nodes = mat.node_tree.nodes
for n in mat.node_tree.nodes:
print(m.name)
#I use startswith so I can check if there are node groups duplicated
if nodes.name.startswith("Custom Node"):
#Here I want to dive inside the node group and check if there is an image texture node inside
And this is what I get in the console: Material Output Principled BSDF Group
I'm wondering how can I get the actual name of the group.
Then I would like to dive inside the node groups (all the node groups whose name start with "Custom Node" actually) and check if a certain node is inside them, let's say for example an image texture node. The code should be something like this
mat = bpy.data.materials.get(bpy.context.selected_objects[0].active_material.name)
mat.use_nodes = True
nodes = mat.node_tree.nodes
for n in mat.node_tree.nodes:
print(n.name)
#I use startsswith so I can check if there are node groups duplicated
if n.name.startswith("Custom Node"):
#Here I want to dive inside the node group and check if there is an image texture node inside.
#This DOESN'T WORK but helps to have an idea of what i want
for n2 in n.node_tree.nodes:
if n2.name == "ShaderNodeTexImage":
print("Found Image texture")