Jump to content

How to disable controls if an input is connected?


Recommended Posts

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 :)

Link to comment
Share on other sites

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 :)

  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 by anim
  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...