TOON BSDF SCRIPTS

 TOON BSDF SCRIPTS

* Select your Object and Go to Scripting and Paste the code below and Run .


import bpy


# Create a new material

mat = bpy.data.materials.new(name="Anime Toon")


# Enable use nodes

mat.use_nodes = True

nodes = mat.node_tree.nodes


# Clear default nodes

for node in nodes:

    nodes.remove(node)


# Add nodes

diffuse_node = nodes.new(type='ShaderNodeBsdfDiffuse')

toon_node = nodes.new(type='ShaderNodeBsdfToon')

output_node = nodes.new(type='ShaderNodeOutputMaterial')


# Link nodes

links = mat.node_tree.links

link = links.new(diffuse_node.outputs['BSDF'], toon_node.inputs['Color'])

link = links.new(toon_node.outputs['BSDF'], output_node.inputs['Surface'])


# Assign material to active object

for obj in bpy.context.selected_objects:

    if obj.type == 'MESH':

        obj.active_material = mat


Comments