Hey guys,
I am writing a shelf tool that toggles on a parameter on a node. I have the shelf tool working if I have the node selected but I want it to work so that I do not need the node selected, just that if it has the display flag toggled.
I have been stuck on finding this node in python. I would not know the /obj/* path ahead of time so the tool would need to figure out my network editor path. Let me know if anyone has any tips!
Python get the node that has the display flag toggled
3775 4 3- harshmallow
- Member
- 13 posts
- Joined: Dec. 2016
- Offline
- Enivob
- Member
- 2627 posts
- Joined: June 2008
- Offline
- harshmallow
- Member
- 13 posts
- Joined: Dec. 2016
- Offline
I was trying to search for finding the current context but that was the wrong keyword. I meant to be searching for getting the current pwd of the network editor.
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
- OdFotan
- Member
- 192 posts
- Joined: April 2015
- Offline
For in an Object Merge node:
I am wondering tho how I could have this updated every time I change a Display Flag in the currentTab..
Right now I have to change some parameter on the Object Merge to have it update.
Anyone any ideas ?
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_path = network_path.displayNode().path() return display_node_path
I am wondering tho how I could have this updated every time I change a Display Flag in the currentTab..
Right now I have to change some parameter on the Object Merge to have it update.
Anyone any ideas ?
- monomon
- Member
- 40 posts
- Joined: May 2019
- Offline
I believe you can use nodesearch [www.sidefx.com] for this
I don't know the exact state that you need, but this may help you get started:
I don't know the exact state that you need, but this may help you get started:
import nodesearch matcher = nodesearch.State("displaydescriptivename", False) network = hou.node("/obj/") for node in matcher.nodes(network, recursive=True): ...
-
- Quick Links