If_Then in VOP?

   1771   6   1
User Avatar
Member
44 posts
Joined: April 2017
Offline
Hey! VOP has only Switch node, but it has single output.

My situation, then inside Foreach loop, sometimes I get wrong result, so I need to branch to either perform additional nodes, or go directly to loop end and cointinue looping.

VOP has no if_then node, if_else, or _branch or anything similar with multiple outputs based on condition.

Any idea to workaround that?
Edited by assignators - July 17, 2018 15:00:23
User Avatar
Member
8555 posts
Joined: July 2007
Offline
you don't need more outputs for Switch VOP, it simply switches between False (0) and True (1) inputs or if you want even more inputs
the downside is that all of them get evaluated before switching

so alternatively
use If Block

also this can help:
https://www.sidefx.com/tutorials/h15-masterclass-loops/ [www.sidefx.com]
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
205 posts
Joined: Dec. 2009
Offline
I'm not at work so I can't verify but, did you have a look at this? http://www.sidefx.com/docs/houdini/nodes/vop/if.html [www.sidefx.com]
User Avatar
Member
44 posts
Joined: April 2017
Offline
Maybe I used wrong terminology, and I am inside SOP, not VOP, as all I have is switch node only.

Attachments:
noif.png (180.7 KB)

User Avatar
Member
8555 posts
Joined: July 2007
Offline
In yhat case Switch is all you need

It will switch to yhe branch you want so if you put your condition to the Input parm it will execute first stream when false (0) and second stream when true (1)
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
44 posts
Joined: April 2017
Offline
Yes, but there is scenario, when I don't need any of inputs and just want to exit the loop, i.e. output should go directly to loop end. Hmmm, but maybe you are right, seems like I need somehow fully redo my node tree to accommodate switch usage

This is because sometimes both inputs are empty, and houdini hangs up in infinite loop. So I wanted to have several outputs to get out of this situation.
Edited by assignators - July 18, 2018 05:45:33
User Avatar
Member
8555 posts
Joined: July 2007
Offline
to get out of For Loop SOP earlier you can use Stop Condition parm on Block End SOP
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links