0

I just learned the below:

tl = bpy.context.scene.node_tree.links

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'links'

enter image description here

Ray Mairlot
  • 29,192
  • 11
  • 103
  • 125
jow
  • 11
  • 1
  • 3
  • bpy.context.scene.node_tree refers to the compositor node_tree. If there's no compositor setup, then there's no node_tree and therefore node_tree.links doesn't exist. If you want the material node_tree you should use bpy.data.materials['yourmaterial'].node_tree. – Secrop Jan 26 '19 at 15:27
  • @Secrop suspect it's a follow on from https://blender.stackexchange.com/questions/129948/what-causes-attributeerror-material-object-has-no-attribute-texture-slots – batFINGER Jan 26 '19 at 15:40
  • @batFINGER, yeah, an unfamiliarity with the api. – Secrop Jan 26 '19 at 22:06
  • sorry, I want to know how to link the Surface to BSDF or Color to Base Color in the picture by python script – jow Jan 27 '19 at 11:08

0 Answers0