Hi,
I want to switch two object with “switch node”,for example,there is a sphere object node,an object merge node and a switch node in the scene,if there is no object in the merge node,the switch input is 0,else is 1,how to achieve this goal?I tried to write a expression code(as in the screenshot),but doesn't work,could you help me?Thanks in advanced!
How to switch via expression
10946 6 2- sunkjy2017
- Member
- 50 posts
- Joined: April 2017
- Offline
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
Greeting.
You can use npoints function to get number of points in your object merge if it would be zero then it goes with sphere.
Documentation page for npoints:
http://www.sidefx.com/docs/houdini/expressions/npoints [www.sidefx.com]
for your file do this in switch1:
if(npoints(“../object_merge1/”) != 0, 1, 0)
You can use npoints function to get number of points in your object merge if it would be zero then it goes with sphere.
Documentation page for npoints:
http://www.sidefx.com/docs/houdini/expressions/npoints [www.sidefx.com]
for your file do this in switch1:
if(npoints(“../object_merge1/”) != 0, 1, 0)
- sunkjy2017
- Member
- 50 posts
- Joined: April 2017
- Offline
- ninhenzo64
- Member
- 11 posts
- Joined: Jan. 2006
- Offline
- ddankhazi
- Member
- 8 posts
- Joined: Aug. 2015
- Offline
- animatrix_
- Member
- 4731 posts
- Joined: Feb. 2012
- Offline
Hi,
You can also just do something like this:
You can also just do something like this:
npoints("../object_merge1/") > 0
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Mark Wallman
- Member
- 700 posts
- Joined: Aug. 2013
- Offline
Hi
I just found this thread.
There is also a new node to 18.0 called switchif.
https://www.sidefx.com/docs/houdini/nodes/sop/switchif.html [www.sidefx.com]
Best
Mark
I just found this thread.
There is also a new node to 18.0 called switchif.
https://www.sidefx.com/docs/houdini/nodes/sop/switchif.html [www.sidefx.com]
Best
Mark
-
- Quick Links