It seems like in the 2.73a version (and 2.74), bpy.context.selected_nodes method is not available despite the documentation showing it up. Does anyone have an idea on what could be happening ?


  • $\begingroup$ selected_nodes is only available in the Nodes space context (not the 3D view or any other). Make sure you run that from an operator with the right context from the nodes editor $\endgroup$ – brita_ Apr 12 '15 at 18:22

You might be able to filter on node.select for your application:

mat = bpy.data.materials['checker']
nodes = [ n for n in mat.node_tree.nodes if n.select ]

Although, I'm not entirely sure how that works with node groups (where you have a compound node selected and tab into it and select other nodes).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.