I am trying to make this simple node group that would simply connect the input to the output so it would simply repeat an image like below.
What is the problem with my code? It's like nothing is coming out from the output.
import bpy
class Repeat (bpy.types.NodeCustomGroup):
bl_name='Repeat'
bl_label='Repeat'
def init(self, context):
self.node_tree=bpy.data.node_groups.new(self.bl_name, 'CompositorNodeTree')
if hasattr(self.node_tree, 'is_hidden'):
self.node_tree.is_hidden=True
self.node_tree.inputs.new("NodeSocketColor", "Image")
self.node_tree.outputs.new("NodeSocketColor", "Image")
self.node_tree.nodes.new('NodeGroupInput')
self.node_tree.nodes.new('NodeGroupOutput')
#trying to connect input to output here, possible problem?
self.node_tree.links.new(self.node_tree.nodes['Group Input'].outputs[0],self.node_tree.nodes['Group Output'].inputs[0])
def free(self):
bpy.data.node_groups.remove(self.node_tree, do_unlink=True)
from nodeitems_utils import NodeItem, register_node_categories, unregister_node_categories
from nodeitems_builtins import CompositorNodeCategory
def register():
bpy.utils.register_class(Repeat)
newcatlist = [CompositorNodeCategory("CP_GENERATE", "Testing", items=[NodeItem("Repeat"),]),]
register_node_categories("GENERATE_NODES", newcatlist)
def unregister():
unregister_node_categories("GENERATE_NODES")
bpy.utils.unregister_class(Repeat)
try :
unregister()
except:
pass
register()
PyNodes do not make it possible to extend Blender Internal, Cycles or the compositor with new nodes
. At this stage a group node is the option you have, you just have to accept having the node group list in your node until a developer offers a better solution. $\endgroup$