Jump to content
monomind

Active Switch Input - Name

Recommended Posts

I'm trying to get the active switch input op name - how is that possible?

 

Share this post


Link to post
Share on other sites

Hi Mono,
something like this, in Python? If you want the result inside a String parm, you have to Add a keyframe to that parm and then change the language to Python. The file is attached.

 

switch = hou.node("../switch")
inputs = switch.inputs()
active = switch.parm("input").eval()
return inputs[active]

image.thumb.png.e660df6096459b11780540c9633b78ab.png

 

switch.hiplc

 

Share this post


Link to post
Share on other sites

Do you have a sample scene?

Share this post


Link to post
Share on other sites

I can prepare - that'd be creating an empty scene and creating a cop network - I just don't know how to script in COPs basically, there is no wrangle in that concept.

Share this post


Link to post
Share on other sites

I am not sure what exactly do you need, but that python can be run in any String parm. Even in a new custom string parm in any node. Btw in Switch COP, the parm is called "index",  not "input". So the third line will be this:

 

active = switch.parm("index").eval()

 

image.thumb.png.fb5d6fee90b9d4210d03e9330bbc5d46.png

Share this post


Link to post
Share on other sites

This is great Masterclass:
https://vimeo.com/14612897

You don't need to see the whole video, first hour (or less) should help you do amazing things.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×