3
$\begingroup$

If I do:

print(some_node.type)

I get things such as MIX_SHADER

but if I do:

print(some_node)

I get

<bpy_struct, ShaderNodeMixShader("Mix Shader.001") at 0x7fdb7da7f808>

Barring the use of regexes, is there a way to get the type of the bpy_struct - in other words ShaderNodeMixShader?

so I can use it for templating code later?

$\endgroup$

1 Answer 1

4
$\begingroup$
>>> node.bl_idname
'ShaderNodeMixShader'

Alternatively, you can use the same way you get the name of anything's type in Python

>>> type(node)
<class 'bpy.types.ShaderNodeMixShader'>

>>> type(node).__name__
'ShaderNodeMixShader'
$\endgroup$

You must log in to answer this question.

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