Callback Button Function for Display Flag

   470   2   1
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
Hello,
I've looked around the internet and found some resources that very closely resemble what I'm trying to do, but I haven't figured out how to tailor those solutions for my specific case.
What I'm trying to do is embarrassingly simple:
I have a button in an HDA. I simply want to add a callback script to that button that will turn on the display flag for that node containing the button. I have been trying to get the python below to work, with no success.

hou.node.setDisplayFlag(True)

I get the error:

'Function object has no attribute 'setDisplayFlag'

I'm guessing that I'm not specifying the node correctly, or am not specifying the display parameter correctly.
Is there anyone more versed in python than I who can tell me what I'm doing wrong?
"Where's my money, Samuel?"
User Avatar
Member
274 posts
Joined: 7月 2013
Offline
node is a method so you need to call it: node()

in the button callback entry it would be:

hou.pwd().setDisplayFlag(True)


The hou.pwd() is short for hou.node(".")
Edited by Jonathan de Blok - 2024年8月1日 11:19:01
More code, less clicks.
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
Thank you for that magical answer. That was it!

hou.pwd().setDisplayFlag(True)
"Where's my money, Samuel?"
  • Quick Links