Jump to content

VOP questions, while loop, for loop, each loop, if block, while loop


tagosaku

Recommended Posts

Hi, 

I have used Houdini for a few years, but have not used these loop block nodes so much in VOP. This is because it's really hard to understand what's happening on the way and how to use input and output exactly, although I understand SOP level's loop nodes well.

Thus, I really appreciate if anyone explain each usage of input and output with typical examples for each block/loop node!  For instance, blockA is good for creating primitive line. blockB is convenient with checking nearest points, blockC is same as loop-SOP but faster, etc...

Many thanks!!

 

 

blockBeginEnd.png

2019-11-24 01_02_17-Houdini Apprentice Non-Commercial - Help.png

Link to comment
Share on other sites

Well, I don't know have you ever used loops in vex or not. The loops in vops is the same with the vex. There is not much specifically which one is better for what kind of condition, but normally foreach loops will need to plug in an array to loop over each array element. And do_while, foreach_until and for_until will loop have the condition for stopping the loop. And while loop will have condition to start the loop. Same as vex.

So for example if you wanna use point cloud with for loop, better use pcopen and length_in(how many iterations) should be the pcnumfind. And if you wanna use point cloud with foreach loop, better use pcfind or pcfind_radius, cuz the result is an array. If you wanna use while loops, better use pcopen and the condition_in should be pciterate.

In for loop, the for_begin length_in is how many total iterations you want it to loop over, and the index_out is the current iteration inside of the loop. So think about in vex, you have something like for(int i = 0; i < 50; i ++), and in vops, length_in is 50, and i is the current index_out, which is the iterator. For example if you plug a contant 0 into the next_in, and call it something like "val", and inside the loop you just addconstant 1, and connect to end_for next_in and named it same as "val", the loop will start, you can see a purple line connect from right to left. It equals like:

int val = 0;
for(int i = 0; i < 50; i++){
    val += 1;                  
}

 

And in foreach loop is very similar, it needs a array to loop over each array elements, the element_out is the current iteration of the array element and index_out is the current iteration. 

I know loops in vop can be a little bit of confusing, but I hope this can help you for a better understanding.

 

 

Edited by jimeng20
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...