All pastes #249835 Raw Edit

jesterKing

public text v1 · immutable
#249835 ·published 2006-11-16 06:05 UTC
rendered paste body
# some output currently generated:
# ['__class__', '__cmp__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'global_tex_coord', 'surface_normal', 'surface_view_vec', 'tex_coord', 'view_normal']
# Texture coordinate (0.061890885233879089, -0.45436245203018188, 0.88916003704071045)
# Surface normal (-0.070243678987026215, -0.88472998142242432, -0.46078059077262878)
# Surface view vector (0.030386274680495262, 0.43047207593917847, -0.90209227800369263)
# View normal (-0.062225442379713058, -0.88793331384658813, -0.4557437002658844)

import Blender
import Blender.Node

class MyNode(Blender.Node.node):
    
    def show(self, shi):
        print dir(shi) # print out to show what ShadeInput makes available
        print "Texture coordinate", shi.tex_coord
        print "Surface normal", shi.surface_normal
        print "Surface view vector", shi.surface_view_vec
        print "View normal", shi.view_normal

    # __call__ will be given one parameter, which is a
    # Blender.Node.ShadeInput. This can be used to get
    # interesting info to play with.
    def __call__(self, shi):
        self.show(shi)
        pass
    
    def __init__(self):
        print "init"

# currently we still need to do this. 'node' is the name we need
# that way the C-side knows what to call :)
# So now the script is run only once, but then the node object
# will be called in subsequent runs through the node tree

node=MyNode()