SideFX Houdini customization package
git clone https://git.lucas.co/hou-control.git
hooks: refit the hcnetcursor on the click's own mouseup
A click selects its node inside Houdini's NodeClickHandler on the
mouseup, which the hook never sees; the zero-delay sync queued on the
mousedown fired before that and found nothing changed. The cursor only
caught up on the next event to reach the hook, the first mouse move
after the click. The refit now runs as the last step of the one pending
action Houdini completes on that mouseup.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
python3.13libs/nodegraphhooks.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/python3.13libs/nodegraphhooks.py b/python3.13libs/nodegraphhooks.py
index 1a82c70..c94d4d9 100755
--- a/python3.13libs/nodegraphhooks.py
+++ b/python3.13libs/nodegraphhooks.py
@@ -75,7 +75,13 @@ class _PendingMouseAction(base.PendingAction):
handler takes over; completes on the mouseup that handler consumes, after
applyAdjustments has written the new positions. First the grid sweep, then
-- when the press was a plain drag of one node -- the drop swap, which
- must see the swept, final position.
+ must see the swept, final position, then the hcnetcursor refit.
+
+ The refit has to be here: a click selects its node inside Houdini's
+ NodeClickHandler on the mouseup, which the hook never sees, and the
+ delayed sync queued on the mousedown fires before that. Without this the
+ cursor only caught up on the next event to reach the hook -- the first
+ mouse move after the click.
"""
def __init__(self, editor, swap=None):
@@ -92,6 +98,7 @@ class _PendingMouseAction(base.PendingAction):
# catches a modifier pressed mid-drag as well.
if self.swap is not None and not getattr(uievent.modifierstate, "alt", False):
hc_editor.swapDroppedNode(*self.swap)
+ _syncSelection(hc_editor, self.editor)
return True