Disabling a node parameter via Python
6888 11 3- bseeley
- Member
- 4 posts
- Joined: July 2017
- Offline
Hi,
So I'm trying to disable a button parameter via python using the parm.disable method however it doesn't appear to do anything.
Just as a test I rigged the button to disable when a toggle was ticked which worked fine. Then I tried to directly disable it purely via code for comparison. The .hide method which I also tested appears to work however the disable method, whilst working according to the returns from .isDisabled wasn't doing anything to the UI.
Any help would be appreciated
An attempt to disable it via the python shell
Toggling the test paramter
So I'm trying to disable a button parameter via python using the parm.disable method however it doesn't appear to do anything.
Just as a test I rigged the button to disable when a toggle was ticked which worked fine. Then I tried to directly disable it purely via code for comparison. The .hide method which I also tested appears to work however the disable method, whilst working according to the returns from .isDisabled wasn't doing anything to the UI.
Any help would be appreciated
An attempt to disable it via the python shell
Toggling the test paramter
Edited by bseeley - March 7, 2018 13:25:41
- goldfarb
- Staff
- 3464 posts
- Joined: July 2005
- Offline
- tamte
- Member
- 8833 posts
- Joined: July 2007
- Offline
- tamte
- Member
- 8833 posts
- Joined: July 2007
- Offline
after a bit of poking around with hou.Parm.disable()
on top of Buttons
- toggle parms don't reflect disable in UI (but became not toggleable anymore)
- Ordered menus neither
- RGBA Mask parms neither
- Parts of Ramps don't reflect that in UI either
- Neither of the Labels of any Parm (including Label Parm)
… maybe some others, so clearly .disable behaves differently from disable rule
- folders disable folder Heading but not contents (however after selecting other node and back current one the content gets correctly disabled, buttons, toggles and others mentioned don't however)
- aaand Key Value Parm doesn't reflect disabled state even if disabled through disable rule
on top of Buttons
- toggle parms don't reflect disable in UI (but became not toggleable anymore)
- Ordered menus neither
- RGBA Mask parms neither
- Parts of Ramps don't reflect that in UI either
- Neither of the Labels of any Parm (including Label Parm)
… maybe some others, so clearly .disable behaves differently from disable rule
- folders disable folder Heading but not contents (however after selecting other node and back current one the content gets correctly disabled, buttons, toggles and others mentioned don't however)
- aaand Key Value Parm doesn't reflect disabled state even if disabled through disable rule
Edited by tamte - March 7, 2018 15:00:49
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- bseeley
- Member
- 4 posts
- Joined: July 2017
- Offline
arctor
can you provide the code you're using?
I was just recreating it ready to send some code and I found something else. To replicate what I was doing previously I added a test button and toggle to a standard environment light and for the sake of it I added a second button which is set to disable when { 1 != 1 } which I tried to enable via code and interestingly, it worked, however once the button was pressed it reverted to being disabled. The same was also observed in the first test button. It would appear that enabling a disabled node is possible, if only temporarily, however the reverse isn't true.
Anyway, as for code, these are the commands I was using to test the single button.
testNode = hou.node("obj/envlight1/") testParm = testNode.parm("testButton") testParm.isDisabled() testParm.disable(True) testParm.isDisabled() testParm.disable(False) testParm.isDisabled()
I've attached the environment light I was testing on as well to save you a job of adding those additional buttons.
Attachment Not Found
- chrisgreb
- Member
- 603 posts
- Joined: Sept. 2016
- Offline
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
up again, I have found another frustrating behavior:
once you disable a parameter via python, it won't stay disabled across sessions.
I attached an example
I've a digital asset that is built specifically around the .disable() function… and I just discovered this show stopper… sad
update: logged as BUG#99387
once you disable a parameter via python, it won't stay disabled across sessions.
I attached an example
I've a digital asset that is built specifically around the .disable() function… and I just discovered this show stopper… sad
update: logged as BUG#99387
Edited by Andr - Sept. 12, 2019 18:11:23
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
I've been told that this bug won't be fixed because:
I've been advised to use hidden parms to store the disable/hide status of a parameter and the use the ‘disable when’ field.
The problem is that I need to disable ONLY certain components of a parameter, not all of them, like the image shows.
And the ‘disable when’ user interface of the Edit Parameters Window only works on the tuple. It would disable all the components at the same time.
Do you know any workaround to permanently disable specific components?
It only comes to my mind to use a script that perform the check/disable routine in the onLoad event handler section so it's run at each session start
'disable' and ‘hide’ parameter states are meant to be dynamic and controlled by scripts. They are both controlled by “disable when” and “hide when” expressions, and the HOM functions are provided to expose this functionality to other dynamic scripts.
Therefore, they have never been saved since the dawn of Houdini, and for backwards consistency and compatibility never will be.
I've been advised to use hidden parms to store the disable/hide status of a parameter and the use the ‘disable when’ field.
The problem is that I need to disable ONLY certain components of a parameter, not all of them, like the image shows.
And the ‘disable when’ user interface of the Edit Parameters Window only works on the tuple. It would disable all the components at the same time.
Do you know any workaround to permanently disable specific components?
It only comes to my mind to use a script that perform the check/disable routine in the onLoad event handler section so it's run at each session start
Edited by Andr - Sept. 15, 2019 09:05:34
- jomaro
- Member
- 102 posts
- Joined: April 2017
- Offline
- jomaro
- Member
- 102 posts
- Joined: April 2017
- Offline
-
- Quick Links