MostHated Posted January 17, 2020 Share Posted January 17, 2020 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. If anyone knows of a way in which I might be able to go about this, I would greatly appreciate your suggestions. Thanks, -MH Quote Link to comment Share on other sites More sharing options...
Feather Posted January 20, 2020 Share Posted January 20, 2020 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. Quote Link to comment Share on other sites More sharing options...
MostHated Posted January 20, 2020 Author Share Posted January 20, 2020 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: 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. Quote Link to comment Share on other sites More sharing options...
Feather Posted January 20, 2020 Share Posted January 20, 2020 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. Quote Link to comment Share on other sites More sharing options...
MostHated Posted January 20, 2020 Author Share Posted January 20, 2020 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. Quote Link to comment Share on other sites More sharing options...
arqueiro Posted February 14, 2020 Share Posted February 14, 2020 I have been trying to do something similar the whole week. thanks 1 Quote Link to comment Share on other sites More sharing options...
bunker Posted February 15, 2020 Share Posted February 15, 2020 You can also use and expression with ifs and create the filepath based on the switch $HIP/geo/`ifs(ch("../switch1/input"),"A","B")`.$F4.bgeo.sc returns A.0001.bgeo.sc or B.0001.bgeo.sc conditional_output.hiplc 3 Quote Link to comment Share on other sites More sharing options...
arqueiro Posted February 18, 2020 Share Posted February 18, 2020 On 2/15/2020 at 2:02 AM, bunker said: You can also use and expression with ifs and create the filepath based on the switch $HIP/geo/`ifs(ch("../switch1/input"),"A","B")`.$F4.bgeo.sc returns A.0001.bgeo.sc or B.0001.bgeo.sc conditional_output.hiplc that is really great thanks. Quote Link to comment Share on other sites More sharing options...
davidinlines Posted March 12, 2021 Share Posted March 12, 2021 On 15/2/2020 at 8:02 AM, bunker said: You can also use and expression with ifs and create the filepath based on the switch $HIP/geo/`ifs(ch("../switch1/input"),"A","B")`.$F4.bgeo.sc returns A.0001.bgeo.sc or B.0001.bgeo.sc conditional_output.hiplc Wow!! Cool solution!! Thanks! 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.