Not sure if anyone needs it but I wrote a shelf tool that sets the display/render flag to the nearest node to your cursor in the network editor. When you bind it to a hotkey, it boosts your productivity by 2% as you don't have to carefully focus on the display flag of nodes to set them Just hover around with your pen.
If there is a simpler way to get the current cursor position over the network editor, I would love to know. Here is the code:
import ctypes
MOUSEEVENTF_LEFTDOWN = 0x0002 # Left button down
MOUSEEVENTF_LEFTUP = 0x0004 # Left button up
MOUSEEVENTF_CLICK = MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP
selNodes = hou.selectedNodes ( )
networkEditor = hou.ui.paneTabOfType ( hou.paneTabType.NetworkEditor )
currentPath = networkEditor.pwd ( ).path ( )
context = networkEditor.pwd ( ).childTypeCategory ( )
ctypes.windll.user32.mouse_event ( MOUSEEVENTF_CLICK, 0, 0, 0, 0 )
ctypes.windll.user32.mouse_event ( MOUSEEVENTF_CLICK, 0, 0, 0, 0 )
pos = networkEditor.selectPosition ( None, -1, None, -1 )
nodes = hou.node ( currentPath ).children ( )
nearestNode = None
dist = 999999999.0
for node in nodes:
d = node.position ( ).distanceTo ( pos )
if d < dist:
nearestNode = node
dist = d
if nearestNode:
nearestNode.setDisplayFlag ( True )
nearestNode.setRenderFlag ( True )
nearestNode.setSelected ( True, clear_all_selected=True )
Enjoy
New hotkey: Display Nearest Node
4544 11 1- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- pezetko
- Member
- 390 posts
- Joined: 11月 2008
- Offline
- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
Thanks a lot, simplifies my code a lot Now I wonder why that is not documented?:
http://www.sidefx.com/docs/houdini14.0/hom/hou/NetworkEditor [sidefx.com]
http://www.sidefx.com/docs/houdini14.0/hom/hou/NetworkEditor [sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Anonymous
- Member
- 678 posts
- Joined: 7月 2005
- Offline
- Doudini
- Member
- 333 posts
- Joined: 10月 2012
- Offline
- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
mantragorapusat
… it boosts your productivity by 2%…
Err… thanks???
It's up to 7% now
New changes:
Simplified position checking (thanks to pezetko)
More accurate distance calculation
For Object level nodes, it dives inside the nearest node
If a node is already selected either manually or with this tool and it's called again near the same node, it dives inside. So press the same hotkey twice if you want to dive inside Attrib VOPSOP, Volume VOPSOP, etc.
For VOP nodes, it selects the nearest node
networkEditor = kwargs
currentPath = networkEditor.pwd ( ).path ( )
context = networkEditor.pwd ( ).childTypeCategory ( )
currentContext = context.name()
pos = networkEditor.cursorPosition ( )
nodes = hou.node ( currentPath ).children ( )
nearestNode = None
dist = 999999999.0
for node in nodes:
d = ( node.position ( ) + ( node.size ( ) * 0.5 ) ).distanceTo ( pos )
#print “{0} {1} {2}”.format(d, node.position(), node.name())
if d < dist:
nearestNode = node
dist = d
handled = False
if nearestNode:
if currentContext == ‘Object’:
networkEditor.cd ( nearestNode.path ( ) )
if currentContext == ‘Sop’:
if nearestNode.isDisplayFlagSet ( ):
networkEditor.cd ( nearestNode.path ( ) )
handled = True
else:
nearestNode.setDisplayFlag ( True )
nearestNode.setRenderFlag ( True )
if currentContext != ‘Object’ and not handled:
nearestNode.setSelected ( True, clear_all_selected=True )
Feedback is welcome as always
Edited by - 2015年4月30日 16:02:50
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Alexey Vanzhula
- Member
- 538 posts
- Joined: 12月 2006
- Offline
- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
Thanks mate
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Alexey Vanzhula
- Member
- 538 posts
- Joined: 12月 2006
- Offline
- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
Thanks that's a good point Changed the code to reflect that.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Alejandro Echeverry
- Member
- 691 posts
- Joined: 6月 2006
- Offline
Very Nice!!
Feel The Knowledge, Kiss The Goat!!!
http://www.linkedin.com/in/alejandroecheverry [linkedin.com]
http://vimeo.com/lordpazuzu/videos [vimeo.com]
http://www.linkedin.com/in/alejandroecheverry [linkedin.com]
http://vimeo.com/lordpazuzu/videos [vimeo.com]
- animatrix_
- Member
- 4621 posts
- Joined: 2月 2012
- Offline
Thanks It would be awesome if I could conditionally assign it to wacom pen. I never use the right click menu on the network editor outside the nodes. It would be nice if this could be configured so if you right click on the empty area of the network editor, it would invoke this hotkey.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
-
- Quick Links