To Store Point Position on Vex

   3280   7   1
User Avatar
Member
14 posts
Joined: 9月 2016
Offline
Hi!
How do I Store the @P of a another geo node inside a point wrangler? , I look at the point() function wich can call specific point but I din't find out how to store All the points.
User Avatar
Member
7770 posts
Joined: 9月 2011
Online
JMKinte
t I din't find out how to store All the points.

There isn't a way to do that directly. You can get the number of points on an input with npoints(input), and then loop over all of the points with the point function and store the result in an array. The array can be stored as a vector array attribute either with setpointattrib() or with a binding 'v[]@myarray'
Edited by jsmack - 2021年3月17日 14:02:18
User Avatar
Member
14 posts
Joined: 9月 2016
Offline
Thanks!, I try the for loop way, but I couldn't pull it off,the function keeps running loong time, and i don't have a clue why..?
I attach the Hip and a pic of the code,
What actually works was doing a point("op:../geonode", "P", @ptnum) on a wrangler with the same amount of points.

Anyway I would like to know why my function is not working just to learn what I'm doing wrong..?
Edited by Kinte3d - 2021年3月19日 01:45:21

Attachments:
PointFunc11.hip (116.0 KB)
func.jpg (76.4 KB)

User Avatar
Member
46 posts
Joined: 4月 2016
Offline
JMKinte
Thanks!, I try the for loop way, but I couldn't pull it off,the function keeps running loong time, and i don't have a clue why..?
I attach the Hip and a pic of the code,
What actually works was doing a point("op:../geonode", "P", @ptnum) on a wrangler with the same amount of points.

Anyway I would like to know why my function is not working just to learn what I'm doing wrong..?
In 'for' loop inside function shape must be 'i < np' instead of 'i = np', which is always true now and loop is endless.
User Avatar
Member
2040 posts
Joined: 9月 2015
Online
vicvvsh
In 'for' loop inside function shape must be 'i < np' instead of 'i = np', which is always true now and loop is endless.

i = np is not always true, it's that it never satisfies an initial condition. So it's more that it just hangs and doesn't loop at all, rather than endlessly loops.

If you put a delete node before the Null1 to remove all points and then return to the wrangle with i = np you will see it loops at least once since np is 0 and i = 0 in the first iteration - 'allowing it to pass through'. However, since there are no points, there is no attribute values to get and you have an empty array as the result.
Edited by BabaJ - 2021年3月19日 12:13:50
User Avatar
Member
46 posts
Joined: 4月 2016
Offline
BabaJ
vicvvsh
In 'for' loop inside function shape must be 'i < np' instead of 'i = np', which is always true now and loop is endless.

i = np is not always true, it's that it never satisfies an initial condition. So it's more that it just hangs and doesn't loop at all, rather than endlessly loops.

If you put a delete node before the Null1 to remove all points and then return to the wrangle with i = np you will see it loops at least once since np is 0 and i = 0 in the first iteration - 'allowing it to pass through'. However, since there are no points, there is no attribute values to get and you have an empty array as the result.

OK, I agree, not always but when np != 0. You was right, if delete all points and write 'for(int i = 0; i = 0; i++)' in the code, it loops one time (you can do not delete points actually, it will behave the same way - one loop). But if instead of 0 put any number, it stops respond.
User Avatar
Member
1 posts
Joined: 3月 2021
Offline
User Avatar
Member
14 posts
Joined: 9月 2016
Offline
Thanks for the clearing out about the for(),
I could go forward on what I wanted to do wich is to store blendshapes on arrays and blend them based on a weightmap.. I attach the example File..
the only thing I couldn't figure out was how to merge this two functions on the attached picture(they do the same but one takes an int and the other a string),so how can I assign multiple possible type for a variable on a function just like the point() does with it's first input wich can take 0 or a string path ?

Attachments:
Captura de pantalla (3).png (44.5 KB)
PointFunc35.hip (494.3 KB)

  • Quick Links