1
$\begingroup$

I will be much appreciated if anyone can give me a pointer. I've no idea why there is no item but only "Remove" and "Disconnect" in the combo box of the right panel. There are actually two parts on the right surface panel, the top one is generated by me with about 100 line of code, it is flexible because I can change anything in it. However the bottom one is more elegant, it is generated through this function "layout.template_node_view" which I notice from the source code of "Cycles", the thing is there is no other items in the combo box. Where is the definition of this function? I searched the whole folder of blender, found nothing but references of this function.

And BTW, why are the two comboboxes have different style? What are the official name of them?

Thanks for any tips. enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

It's defined in C code here: rna_ui_api.c#871

And this is called: node_templates.c#721

I don't know how to use it properly, but I guess you need to roll your own panel for your custom nodes in a custom node tree. This seems to work as panel draw code:

    def draw(self, context):
        layout = self.layout

        ntree = bpy.data.node_groups["NodeTree"] # our custom node tree
        node = ntree.nodes.active # selected node
        for socket in node.outputs:
            layout.template_node_view(ntree, node, socket)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .