Jump to content

Attribute VOP : If block in Foreach ?


Midway83

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 : 

6193cde380852_ScreenShot2021-11-16at16_27_12.png.4afa7a7a3497a3efb9551751dbcbe873.png

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 :

6193ce478f35e_ScreenShot2021-11-16at16_27_21.thumb.png.8619986cf56bad036fab38ea5e181b1f.png

I'm trying to do something like this : 

6193ce5d3a879_ScreenShot2021-11-16at16_28_43.thumb.png.a2f776cef221241948f884fb6cd7c39d.png

(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 !!!

Link to comment
Share on other sites

Hi,

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:

image.thumb.png.bb5f7daad8a5112f540fad551afbb168.png

 

Hope this is what you want! ^_^

Edited by Ziyad
typo
Link to comment
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

Link to comment
Share on other sites

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