Python Cycles shader graph connect

Would anybody happen to know what this means (see attached image) regarding “Cycles shader graph connect: can only connect closure to closure etc etc”?


It means what it says. A connection between two incompatible socket types exists and is not valid.

Did you write code to connect a closure socket type to a float?

Thanks for the reply but consider me uneducated. No I don’t think I have done anything like that just used normal nodes set ups, nothing fancy. I wouldn’t know how to code anything. Could it be a leftover from using the Lens Flare https://www.youtube.com/watch?v=Whbq8H6Ltvk that I deleted?

Show a screenshot of your nodes and we’ll tell you immediately where the problem is.

Ok I have 276 items in the scene. I went through all of them and from what I can tell they all seem normal node setups to me. Diffuse, Glossy, Add Shader and Displacement. I will have to go through them all again and see what I can find. Cheers gregzaal

Like I said, just show a screenshot. If you don’t know what the problem is, what’s the point in telling me what you know? Show me.

What all 276 items?

try this script… it will list in the Console all the materials with Closures connected to Closures.
then you’ll have to fix them

import bpy
for mt in bpy.data.materials:
     if(hasattr(mt.node_tree, 'nodes')):
         for nd in mt.node_tree.nodes:
             if(nd.type.find('BSDF')>-1):
                 for inp in nd.inputs:
                     if (inp.is_linked):
                         link=inp.links[0].from_node
                         if (link.type.find('BSDF')>-1):
                             print(mt.name, " - ", nd.name)

Oh sweet Secrop, thanks a bunch I will give this a whirl later and report back. I wish I could get my head around Python but I don’t have that type of brain. I can learn software very fast but this is why beyond me and yes for many years I have tried.

Oh yeah that is so cool. Only two items and one node out of place. Thank you so much, now that is what I call excellent help. I will keep this script handy if I ever need it. Can I share it with others if I see someone asking the same thing?

yes, of course. :slight_smile:
For me it’s just straightforward do check data in Blender using the python console… So much that the ‘for object in library:’ loop, comes quite automatically. :RocknRoll:

Sweet thanks again Secrop