SideFX Houdini customization package
git clone https://git.lucas.co/hou-control.git
hc: delete the dead _traversalTarget
Nothing called it. navigateDirection, the only thing that would have,
goes through moveHcnetcursor instead, so its 51 lines of wire traversal
-- up to the first input, down to the first output, left/right cycling
through nodes that share a downstream child, plus a visibility test and a
viewport-centre fallback -- never ran.
It turned up in the currentNode audit, which listed it as "never started
from the current node". That was true and beside the point: it never
started at all.
_nearestNodeToViewportCenter stays; _initialHcnetcursorState still uses
it for the no-current-node fallback.
Co-Authored-By: Claude Opus 5 <[email protected]>
python3.13libs/hc/hcnetworkeditor.py | 51 ------------------------------------
1 file changed, 51 deletions(-)
diff --git a/python3.13libs/hc/hcnetworkeditor.py b/python3.13libs/hc/hcnetworkeditor.py
index 9f7d63d..e5f713b 100644
--- a/python3.13libs/hc/hcnetworkeditor.py
+++ b/python3.13libs/hc/hcnetworkeditor.py
@@ -50,57 +50,6 @@ class HCNetworkEditor(HCPathTab):
""" Navigation """
- def _traversalTarget(self, direction, from_node=None):
- """Find the next node via wire traversal from from_node (default: the
- editor's current node). If no node is current or visible, falls back
- to the node nearest to the viewport center.
- up = first input; down = first output;
- left/right = cycle through nodes sharing a downstream child (ordered
- by x-position)."""
- if from_node is None:
- from_node = self.currentNode()
-
- # Check if from_node is visible in the current viewport
- is_visible = False
- if from_node is not None:
- # itemRect returns coordinates in network space
- # visibleBounds returns the viewport in network space
- if self.hou_tab.visibleBounds().intersects(self.hou_tab.itemRect(from_node)):
- is_visible = True
-
- # Fallback to viewport center if no node is current OR current node is off-screen
- if from_node is None or not is_visible:
- nearest = self._nearestNodeToViewportCenter()
- if nearest:
- # If the current node was off-screen, the first press brings us to the center
- return nearest
-
- if from_node is None:
- return None
-
- if direction == 'up':
- inputs = [n for n in from_node.inputs() if n is not None]
- return inputs[0] if inputs else None
- if direction == 'down':
- outputs = list(from_node.outputs())
- return outputs[0] if outputs else None
- if direction in ('left', 'right'):
- neighbors = set()
- for child in from_node.outputs():
- for sibling in child.inputs():
- if sibling is not None and sibling != from_node:
- neighbors.add(sibling)
- if not neighbors:
- return None
- ordered = sorted(
- neighbors | {from_node},
- key=lambda n: (n.position()[0], n.position()[1]),
- )
- idx = ordered.index(from_node)
- step = -1 if direction == 'left' else 1
- return ordered[(idx + step) % len(ordered)]
- return None
-
def navigateDirection(self, direction):
self.moveHcnetcursor(direction)