Skip to content

Instantly share code, notes, and snippets.

@AjayTalati
Forked from p2or/blender-anisotropic-shader.py
Last active August 29, 2015 14:23
Show Gist options
  • Save AjayTalati/a360f04594b7ca11a486 to your computer and use it in GitHub Desktop.
Save AjayTalati/a360f04594b7ca11a486 to your computer and use it in GitHub Desktop.
import bpy
# get the material
mat = bpy.data.materials['Material']
# get the nodes
nodes = mat.node_tree.nodes
# clear all nodes to start clean
for node in nodes:
nodes.remove(node)
# create emission node
node_emission = nodes.new(type='ShaderNodeBsdfAnisotropic')
node_emission.inputs[0].default_value = (0,1,0,1) # green RGBA
node_emission.inputs[1].default_value = 5.0 # strength
node_emission.location = 0,0
# create output node
node_output = nodes.new(type='ShaderNodeOutputMaterial')
node_output.location = 400,0
# link nodes
links = mat.node_tree.links
link = links.new(node_emission.outputs[0], node_output.inputs[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment