Jump to content

Attribute VOP : If block in Foreach ?

Recommended Posts

Hello everyone ! :)

I've been trying for day (literally.) to make a super simple thing in Houdini :

- I have a Float Array with infinity values I want extract

My idea was to make a FOREACH in this array, and when I have a infinite value, I put it on an array. When I have a real number, I put it on another array.

But I can't understand the Attribute Vop For Each and If System... Were they drunk when they make a system like this ? ^^' It drives me crazy 

here's my situation at the beginning : 


I have my array (AllMax) and 2 empty arrays (MaxBad for infinites values, and MaxGood for the rest)

My main array have 70k+ values like this :


I'm trying to do something like this : 


(I tried with getAttribute, with Bind, I'm not sure if I need to bind_export each time I want to update the binded array, ...)

The best result I get (I'm not sure I can get again haha I'm empty) is that I have the good values in the good array but when the IF BLOCK have a false value, my foreach end and I have only one value in one of the two arrays.

I don't understand well the Houdini if and foreach system I think

I don't understand why they don't have a system like Unreal Engine, with a if node which have two output, one for true and one for false... and have "exec" input/out to control the flow... it's much easier :/


Thanks in advance guys !!!

Share this post

Link to post
Share on other sites


I'm more of a VEX guy but I think you have the right idea in your VOP as it looks similar to how you can do it in VEX. You essentially would need to create a foreach loop that goes through every index of your AllMax array, then using if statements you would check if an index is infinite or not, then append each index accordingly to MaxBad & MaxGood arrays.    

I have attached bellow a screenshot showing the solution inside a point wrangle:



Hope this is what you want! ^_^

Edited by Ziyad

Share this post

Link to post
Share on other sites

Thanks for your answer !! :) Ok it's working... haha 

I'm trying for 2 days with nodes and It works with a few code lines...

I need to learn VEX (if you have some tutorials or tips don't hesitate :p)

I don't understand why it didn't work with nodes... maybe I don't understand the way the handle their foreach and if paired blocks (it's too confusing for me)

Thanks again, you motivates me to learn VEX :P

Share this post

Link to post
Share on other sites

Hi again !

Wow, it seems really cool :) maybe I'll try ! The thing is to find project to experiment with VEX ^^

Thanks again !!

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