Jump to content

Conditional output switch?


Recommended Posts

Hello all,

    I was wondering if there exists any sort of conditional output switch. A switch with more than one output which decides which output to use based on a condition. An example would be I wanted to see if I could output from a solver to one file cache if a switch higher up in the network was set to one input, but then output to a different file cache from the same solver if the switch above was set to a different input.

GGLKGbD.png

 

If anyone knows of a way in which I might be able to go about this, I would greatly appreciate your suggestions.

Thanks,

-MH

 

Link to comment
Share on other sites

You can achieve the same result in the reverse if the switch is not being driven by an expression and you are just setting the value.  

A Geometry ROP can activate the switch for you before rendering to disk using prerender scripts and a global variable.

Edit/Aliases & Variables - > click the second tab at the top for global variables. There's boxes at the bottom for creating a new one so do something like
"SWITCH"   |     0

Then in your network you can use $SWITCH to call that variable in your switch node.

On the geometry Rop you can add a prerender script.

set -g "SWITCH" = 0

You can add this to a second geometry rop as 

set -g "SWITCH" = 1

And output the result to a different location while switch is set to 1.

Keep in mind, if you're using an expression to drive the switch, a prerender script may not able to evaluate the expression to determine the answer.

 

Link to comment
Share on other sites

I definitely appreciate the reply. Because I was a new member, my posts got hung in limbo for a day or two. I was able to figure it out by the time this actually showed up but the information you gave is quite useful and it will be nice to have it for reference.

I was able to get what I was after using an attribute wrangle plugged into the spare input nodes of two switches as seen below:

 

lXfwErT.png

 

It worked out how I was wanting for now, which was just a quick switch for testing to swap between two different types of fracturing. That, and I am just trying to learn as much about Houdini as I can, so I am trying to automate little tasks which probably have no need to be automated, just so I can learn how to do it, as well as making little useless tools with python, etc.

Link to comment
Share on other sites

No worries, that little buffer of "needs to be approved by admin" right?

Just a heads up, your current solution may set you up with a rather frustrating workflow in the future. In that way the switch functioning properly is entirely dependent on whether or not the detail attribute exists. The switch, while usually correctly set to 1, on a weird frame that geometry disappears or changes defaults to 0 rather than stays on its correct value if set globally at render time. 

Link to comment
Share on other sites

Yeah, luckily that post delay has been removed now, lol. I have the switches value being set from the null at the end, which has a slider I control to switch the things between the two. I can see what you are saying and will keep it in mind. With this particular thing I am making, and most things I will be making, I am just creating some RBD animation to export out as FBX to use in Unity. Not sure if this would come into play in that situation, but luckily things worked out well for me exporting it the few times I have done it so far. Going forward I probably won't need to use this, I was just using it to quickly jump back and forth between voronoi and material fracture to see which I wanted to use since I am new to Houdini, I wanted to see the difference between the changes I was making in both situations.

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...

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...