Disabling a node parameter via Python

   496   4   1
User Avatar
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
Edited by bseeley - March 7, 2018 13:25:41

Attachments:
toggle.PNG (1.7 KB)
viaPython.PNG (1.5 KB)

User Avatar
Staff
3159 posts
Joined: July 2005
Offline
hi
testing here we're finding disable doesn't seem to do anything - can you provide the code you're using?
Michael Goldfarb | www.odforce.net
Senior Technical Director
SideFX
www.sidefx.com
User Avatar
Member
3547 posts
Joined: July 2007
Offline
.disable() seems to work on sliders, but not on buttons, feels like a bug
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
3547 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
Edited by tamte - March 7, 2018 15:00:49
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
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

Attachments:
OPlibObject.hda (41.5 KB)

  • Quick Links