Hi Guys,
I’ve searched everywhere on the Internet without finding what I’m looking for.
Let’s say I want to create a new node type using Python; for example an image filter with an input yellow (image) socket and an output yellow (image) socket.
The filter processes the image in some ways and returns an other imag, for example like the blur node, but with a new function that doesn’t exist in any blender node.
I would like to learn how to create new node types but I don’t find any good guide/tutorial on it.
I’ve found this: http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes#Basic_API_functions
I tried to register new node types, node tree types and node socket types with the code on the wiki;
class MyCustomNode(bpy.types.Node):
# Description string
'''A custom node'''
# Optional identifier string. If not explicitly defined, the python class name is used.
bl_idname = 'CustomNodeType'
# Label for nice name display
bl_label = 'Custom Node'
# Icon identifier
bl_icon = 'SOUND' class MyCustomSocket(bpy.types.NodeSocket):
# Description string
'''Custom node socket type'''
# Optional identifier string. If not explicitly defined, the python class name is used.
bl_idname = 'CustomSocketType'
# Label for nice name display
bl_label = 'Custom Node Socket'
# Socket color
bl_color = (1.0, 0.4, 0.216, 0.5)
class MyCustomTree(bpy.types.NodeTree):
# Description string
'''A custom node tree type that will show up in the node editor header'''
# Optional identifier string. If not explicitly defined, the python class name is used.
bl_idname = 'CustomTreeType'
# Label for nice name display
bl_label = 'Custom Node Tree'
# Icon identifier
# Note: If no icon is defined, the node tree will not show up in the editor header!
# This can be used to make additional tree types for groups and similar nodes
bl_icon = 'NODETREE'
I use python but in this case I’m afraid not to understand the way it works.
I try adding new types but nothing happens and I cannot find any new types in the add menu.
Is there somewhere a good tutorial/guide on how to define a new node type with its sockets (inputs and outputs), buttons, text fields number fields and functions that process the inputs and return the outputs?
Thanks in advance.
P. S.: I’m not English mothertongue. I hope my post is not too bad.