1
$\begingroup$

I want to add nodes to a node group, but for that, I need to know the name of the currently selected material. How can I find the active material with python?

$\endgroup$
  • $\begingroup$ Do you mean 'active' as in the selected group in the node editor? $\endgroup$ – Ray Mairlot May 30 '16 at 17:15
  • $\begingroup$ Also, do you want to find the active material or the active node group? The title is asking one thing but the question itself implies something else. $\endgroup$ – Ray Mairlot May 30 '16 at 17:18
  • $\begingroup$ I want to know the name of the currently selected material. $\endgroup$ – John Roper May 30 '16 at 20:56
1
$\begingroup$

The answer is bpy.context.active_object.active_material.name

$\endgroup$

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.