diff --git a/grill/views/_graph.py b/grill/views/_graph.py
index 4311f913..5d50371c 100644
--- a/grill/views/_graph.py
+++ b/grill/views/_graph.py
@@ -621,7 +621,7 @@ def _load_graph(self, graph):
def _add_node(nx_node):
node_data = graph.nodes[nx_node]
- plugs = node_data.pop('plugs', ())
+ plugs = node_data.pop('plugs', ()) # implementation detail
nodes_attrs = ChainMap(node_data, graph_node_attrs)
if (shape := nodes_attrs.get('shape')) == 'record':
try:
diff --git a/grill/views/description.py b/grill/views/description.py
index b6256e1b..f26227de 100644
--- a/grill/views/description.py
+++ b/grill/views/description.py
@@ -255,6 +255,7 @@ def traverse(api: UsdShade.ConnectableAPI):
node_id = _get_node_id(current_prim)
label = f'<
'
label += table_row.format(port="", color="white", text=f'{api.GetPrim().GetName()}')
+ plugs = {"": 0} # {graphviz port name: port index order}
for index, plug in enumerate(chain(api.GetInputs(), api.GetOutputs()), start=1): # we start at 1 because index 0 is the node itself
plug_name = plug.GetBaseName()
sources, __ = plug.GetConnectedSources() # (valid, invalid): we care only about valid sources (index 0)
@@ -263,8 +264,9 @@ def traverse(api: UsdShade.ConnectableAPI):
for source in sources:
_add_edges(_get_node_id(source.source.GetPrim()), source.sourceName, node_id, plug_name)
traverse(source.source)
+ plugs[plug_name] = index
label += '
>'
- all_nodes[node_id] = dict(label=label)
+ all_nodes[node_id] = dict(label=label, plugs=plugs)
traverse(connections_api)
diff --git a/tests/test_views.py b/tests/test_views.py
index b53e7fe2..1b8cb95e 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -117,7 +117,6 @@ def test_connection_view(self):
cycle_input = pbrShader.CreateInput("cycle_in", Sdf.ValueTypeNames.Float)
cycle_output = pbrShader.CreateOutput("cycle_out", Sdf.ValueTypeNames.Float)
cycle_input.ConnectToSource(cycle_output)
- description._graph_from_connections(material)
viewer = description._ConnectableAPIViewer()
# GraphView capabilities are tested elsewhere, so mock 'view' here.
viewer._graph_view.view = lambda indices: None