検索 - User list
Full Version: Parameter's (isDisabled) of nodes created using Python
Root » Technical Discussion » Parameter's (isDisabled) of nodes created using Python
Raytracing6478
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?
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]
Raytracing6478
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB