How to select the node with display flag?

   Views 1206   Replies 5   Subscribers 0
User Avatar
Member
540 posts
Joined: Aug. 2019
Offline
Pressing R puts the display flag on the selected node.

However, is there a hotkey to do the opposite? In other words, to select the node with display flag.
User Avatar
Member
540 posts
Joined: Aug. 2019
Offline
A script that does it:

def get_display_node():
    editors = [pane for pane in hou.ui.paneTabs() if isinstance(pane, hou.NetworkEditor) and pane.isCurrentTab()]
    if not editors:
        return None
    network_editor = editors[-1]
    network_path = network_editor.pwd()
    display_node = network_path.displayNode()
    return display_node
        
node = get_display_node()
node.setSelected(1,1)

Still I'd like to know if there a built-in way for it.
User Avatar
Member
21 posts
Joined: Oct. 2019
Offline
Hello raincole! Thank you for taking the time to send the code. Where would you run it? In a python node inside any Geo node? In the middle of the node stream of any project? Or directly in a python node at object level? Or better in a callback button? I ask this to understand how you would think about structuring many scenes so that it does not become a problem later.

Attachments:
DisplayFlagProblem.hipnc (293.3 KB)

User Avatar
Member
540 posts
Joined: Aug. 2019
Offline
Two common places for Python script like this are:

1. Shelf tool (RMB on shelf -> New Tool -> RMB on that tool -> Edit Tool -> Script tab)
2. Radial menu (Script Action)
User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
This is a good idea. It can also be developed in the direction where you want to get focus on the displayed node without clearing the selection from the current node.

import hou
import nodegraphview

def focusDispayNode():
    editors = [pane for pane in hou.ui.paneTabs() \
    if isinstance(pane, hou.NetworkEditor) and pane.isCurrentTab()]
    if not editors:
        return None
    for editor in editors:
        pwd = editor.pwd()
        if hasattr(pwd, "displayNode"):
            nodegraphview.frameItems(editor, (pwd.displayNode(),))
        
focusDispayNode()
User Avatar
Member
4741 posts
Joined: Feb. 2012
Offline
nazimba
Hello raincole! Thank you for taking the time to send the code. Where would you run it? In a python node inside any Geo node? In the middle of the node stream of any project? Or directly in a python node at object level? Or better in a callback button? I ask this to understand how you would think about structuring many scenes so that it does not become a problem later.

Create a shelf tool and assign a hotkey to it for the fastest access.
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
  • Quick Links