All pastes #249894 Raw Edit

jesterKing

public python v1 · immutable
#249894 ·published 2006-11-16 09:10 UTC
rendered paste body
import Blenderimport Blender.Node# some other class - but won't be instantiated on blender sideclass SomeOtherClass:    def __call__(self, shi):        print shi        def __init__(self, a, b):        print a, b# create your own class, deriving from Blender.Node.node# don't instantiate it, Blender will do that for you.# just implement the __call__ and the __init__ functions# see the examples for their formatclass 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.    # this will be extended to get objects that wrap the actual    # input and output sockets (still undecided.    def __call__(self, shi):        #self.show(shi)        pass        # __init__ is given here two arguments, input_def and output_def.    # these are of type Blender.Node.Inputs and Blender.Node.Outputs respectively.    # They are used to define the input and output sockets (for use in the GUI)    def __init__(self, input_def, output_def):        #input_def.add('color', (Blender.Node.RGBA, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0))        #output_def.add('color', (Blender.Node.RGBA, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0))        print input_def, output_def                soc= SomeOtherClass("x", "y")