Skip to content

Can't add input and connect to it by index right away? #448

Open
@herronelou

Description

@herronelou

Hey Johnny Chan hope you're doing good.
Needed a node graph today and remembered this project.

I'm building a visual representation of RV's node graph, so it's a bit odd as I take a node graph and convert it to another node graph, but I bumped into a little hiccup.

I don't know if it's user error or a bug, but somewhere in my code I do:

            for i, input_node_name in enumerate(inputs):
                input_node = graph.get_node_by_name(input_node_name)
                if input_node:
                    node.add_input(f"in{i}", color=(180, 80, 0))
                    node.set_input(i, input_node.output(0))

However I'm greeted with a

Traceback (most recent call last):
 File "\packages\ext\openrv\2.2.0.1\platform-windows\plugins\Python\node_graph_viz.py", line 207, in show_graph_window
   self.graph_dialog.build_graph()
 File "\packages\ext\openrv\2.2.0.1\platform-windows\plugins\Python\node_graph_viz.py", line 175, in build_graph
   node.set_input(i, input_node.output(0))
 File "\packages\user\eleroy\NodeGraphQt\0.6.38\b821b6f8a3d04be07cae976a50d84283e2a305ef\python\NodeGraphQt\nodes\base_node.py", line 673, in set_input
   src_port = self.input(index)
 File "\packages\user\eleroy\NodeGraphQt\0.6.38\b821b6f8a3d04be07cae976a50d84283e2a305ef\python\NodeGraphQt\nodes\base_node.py", line 663, in input
   return self._inputs[index]
IndexError: list index out of range

Am I being dumb?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions