3
$\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$
3
  • $\begingroup$ Do you mean 'active' as in the selected group in the node editor? $\endgroup$ May 30, 2016 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$ May 30, 2016 at 17:18
  • $\begingroup$ I want to know the name of the currently selected material. $\endgroup$
    – John Roper
    May 30, 2016 at 20:56

1 Answer 1

6
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .