Parameter's (isDisabled) of nodes created using Python

   213   2   0
User Avatar
Member
8 posts
Joined: Dec. 2015
Offline
Hi,

I'm facing something strange. I'm creating nodes using Python, but when I try to get the isDisabled to check if the parameter is disabled or not after creation, it always return false even if it's disabled by default. The stranger part is that if I selected that node in the network view then I tried to get the isDisabled, it returns the correct value. For example

import hou

geo = hou.node('obj/geo1')
geo.createNode('box')
node = geo.children()
parm_tuples = node.parmTuples()
parm = parm_tuples # divs parameter

print(f"parm {parm.name()} - {parm.isDisabled()}")

it returns false even though the divs parameter is disabled, but if I selected the node in network view and tried to get the isDisabled then it will print True. Am I doing it wrong or is this a bug?
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
The issue is that such things as disabled/hidden are UI states and not guaranteed to be accurate at any given time. If the parameter interface hasn't had to display that node yet then its state is going to be unclear. You'll want to call hou.OpNode.updateParmStates() before checking the value which should give you your expected result.

https://www.sidefx.com/docs/houdini/hom/hou/OpNode.html#cooking [www.sidefx.com]
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
8 posts
Joined: Dec. 2015
Offline
graham
The issue is that such things as disabled/hidden are UI states and not guaranteed to be accurate at any given time. If the parameter interface hasn't had to display that node yet then its state is going to be unclear. You'll want to call hou.OpNode.updateParmStates() before checking the value which should give you your expected result.

https://www.sidefx.com/docs/houdini/hom/hou/OpNode.html#cooking [www.sidefx.com]

Thank you so much, it worked perfectly.
  • Quick Links