magneto Posted August 2, 2012 Share Posted August 2, 2012 Hi, I am making an asset where I want to have some of the controls disabled if an input is connected. Similar to the Box SOP, where it disables the Size and Center if you connect a node to its input. I just don't know how to detect this at the asset level and use it in the Disabled When field. Thanks Quote Link to comment Share on other sites More sharing options...
ranxerox Posted August 2, 2012 Share Posted August 2, 2012 can you use opinput and test if it returns a null string ? -G Hi, I am making an asset where I want to have some of the controls disabled if an input is connected. Similar to the Box SOP, where it disables the Size and Center if you connect a node to its input. I just don't know how to detect this at the asset level and use it in the Disabled When field. Thanks 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted August 2, 2012 Author Share Posted August 2, 2012 I tried the opinput inside the Disabled When field but it didn't work. Can I use those expressions inside Disabled When? I thought that field has a very specific limited syntax for logic. Quote Link to comment Share on other sites More sharing options...
Annon Posted August 2, 2012 Share Posted August 2, 2012 Set up an integer field that you then make it invisible (lets say "hasConnection". Then use a little python, look up hou.node.inputs. Do something like (might be wrong, it's off the top of my head and I hardly ever code): node = hou.pwd() inputs = node.inputs() if not inputs: return 1 else: return 0 then you could disable a folder or any other parameter based on the result of the int field. Disable if: [hasConnection == 0] Something like that should work. Hope that helps Magneto. Christian 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted August 2, 2012 Author Share Posted August 2, 2012 Wow that's an awesome trick. Thanks Christian Quote Link to comment Share on other sites More sharing options...
anim Posted August 2, 2012 Share Posted August 2, 2012 (edited) hidden int parms are usually used for this but maybe rather than using python for the simple expression you can use hscript like opninputs(".") == 1 or more specificlally as ranxerox suggested opinput(".",1) == "" Edited August 2, 2012 by anim 1 Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted August 2, 2012 Share Posted August 2, 2012 If you put this Python expression in a parameter it will be True if input connector #3 is connected to something. len([1 for c in hou.pwd().inputConnections() if c.inputIndex() == 2]) NOTE: inputIndex starts at zero. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted August 2, 2012 Author Share Posted August 2, 2012 Thanks alot guys, really cool tricks Btw all these codes are to be used as Default Expression for the parameter right? Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted August 2, 2012 Share Posted August 2, 2012 I would put it in the Scripts section under the "On Input Changed" and have it set a parameter value to 0/1 when the inputs change. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted August 2, 2012 Author Share Posted August 2, 2012 Thanks hopbin, got it. I was using the default expression. Both should work I guess. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.