Jump to content

VOPS {Append data from a loop into an array} ??


Recommended Posts

A VOP performs a pointcloud lookup and uses while loop in oder to take advandage of the pcimport node to get distance,ptnum ,P etc.

How can I store the result of each loop in a while node in vops? Each loop gives me a point but I only get the last point out of the node( although I have set max number of points to a number higher than one.. )

Maybe somehow push/append them into an array so I can call the later on? If that is the way, arrays in vops need inline code (afaik..) and I haven't managed to figure i out... :blink:

One of my goals is to draw multiple lines that connect the look up point with a number of points on the pointcloud(= max number of points) without puting the VOP and the Foreach node into another ForEach node out side the vop (because it is not fast).

I hope all this makes sense ......thanks

ps. play a bit with the slider of "max number of points". Slide it from 1 to 4 and you'll see the line jumbing to the next point. I want to be able to store these points without movin the slider.. :(



Push in array.hip


Edited by dpap
Link to comment
Share on other sites

Hello! I took a quick look at your scene and figured out a few things I would try to change.

Heads up, I have never created a matrix and generated attributes in a while loop. But is seems as you have to store a large amount of data and attributes in a single point so I tried a different method. But it might not be suitable for your purpose

In the vopsop I calculate the distance and direction between the floating point with the points in the geometry. I also added an interger attribute (in_range). You can then set the geometry points to in range or not depending on an user input. Thereafter delete all points which are not in range. Then copy stamp lines using the direction attribute and the length between the points of the geometry to the floating point. It might be easier to understand if you check out the scene.

You could probably do a for_each if you have other floating points.


forgot the file ofcourse

Push in array.hipnc

Edited by Hudson
  • Like 1
Link to comment
Share on other sites

Thank you for your time and effort Hudson and sorry for late answer !

Although I would like to learn more about arrays, your approach is different and very cleaver. Maybe I have to start thinking in a new way when in houdini...

The bad think is that I am used to ICE and where arrays are very easy to use.Damn I thought I'd be in cg heaven when using Houdini :(

Maybe I'll try again the arrays approach another time.

Thank you again!

Link to comment
Share on other sites

Hi Petz! Thanks for your help! You actually nailed it!!! It gets the job done in a clean and tidy way!

You are right that arrays in Vex are not a problem but you have to know Vex for that to be true...

Although I understood your code, I am far from saying that I know Vex..

So, for guys like me Vops is the way to go, because I dont want to be a programer /* I wouldn't be a good one*/ but I really enjoy a "visual programing " workflow.

Long story short , for educational reasons I changed a little bit your code and tried to "translate" it from VEX into VOPs.

But as I expected : result==failure :blush:

I uploaded the file if someone wants to give it another crack..

And btw since I can set a "float array" at the inline code outpout type,

why can’t I declare an attribute of array type in my “attribute create” node

or my “add attribute node”??? Not very intutive...... :blink:

translating vex to vops.hipnc




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

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