Page MenuHome

material_pynode_template.py

material_pynode_template.py

#!BPY
"""
Name: 'Material PyNode'
Blender: 248
Group: 'ScriptTemplate'
Tooltip: 'Create a new material PyNode based on template'
"""
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
from Blender import Window
import bpy
script_data = \
'''
# John Doe 2008
# State license used here and provide a link to it if you want to use one
from Blender import Node
class TemplateNode(Node.Scripted): # change TemplateNode to match the name of your node
def __init__(self, sockets):
sockets.input = [Node.Socket('Color', val = 4*[1.0])] # define inputs here
sockets.output = [Node.Socket('Color', val = 4*[1.0])] # define outputs here
def __call__(self):
# this just passes the input color to output using map. alter lambda to
# provide functionality (hint 1.0 - x for invert)
self.output.Color = map(lambda x: x, self.input.Color) # do operation here
__node__ = TemplateNode # change TemplateNode to match the name of your node
'''
new_text = bpy.data.texts.new('material_pynode_template.py')
new_text.write(script_data)
bpy.data.texts.active = new_text
Window.RedrawAll()

File Metadata

Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d5/c4/8871962e172f6c57441282936060

Event Timeline