HI,
I change one point attribute in point wrangle,I want copy this value to other points in this point wrangle,how to do this?
set attribute in vex
1820 9 1- damonmaster
- Member
- 4 posts
- Joined: 6月 2017
- Offline
- animatrix_
- Member
- 4729 posts
- Joined: 2月 2012
- Offline
Hi,
You can use the setpointattrib function:
https://www.sidefx.com/docs/houdini/vex/functions/setpointattrib.html [www.sidefx.com]
You can use the setpointattrib function:
https://www.sidefx.com/docs/houdini/vex/functions/setpointattrib.html [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- damonmaster
- Member
- 4 posts
- Joined: 6月 2017
- Offline
animatrix_
Hi,
You can use the setpointattrib function:
https://www.sidefx.com/docs/houdini/vex/functions/setpointattrib.html [www.sidefx.com]
Yes,I often use this function,but The situation is like this,
I have some points,they have a float attribute f@a equal random number;
then in point wangle:
for(int i==0;i<10;i++)
{
if(@ptnum ==0) f@a = rand(f@a+i*123.6);
setpointattrib(0,"a",@ptnum,"f@a","set"); ///This is the wrong result
}
how to set the value of point 0 to other point in this wrangle?
- Andr
- Member
- 899 posts
- Joined: 2月 2016
- Offline
Hi,
are you aware that a point wrangle executes the code in parallel on each point?
Anyway,
if the random number is already computed for point 0, you can then write the following in point wrangle:
or you can just use the rand() function with the same seed for each point
are you aware that a point wrangle executes the code in parallel on each point?
Anyway,
if the random number is already computed for point 0, you can then write the following in point wrangle:
float a0 = point(0, "a" , 0); f@a = a0;
or you can just use the rand() function with the same seed for each point
Edited by Andr - 2023年9月23日 06:27:08
- Dougie0047
- Member
- 82 posts
- Joined:
- Offline
- mandrake0
- Member
- 644 posts
- Joined: 6月 2006
- Offline
// user parameters int seed = chi("seed"); // Getting a seed Value float a = point(0, "a", 0); // fetch the "a" attribute from point 0 a = rand(a+seed*123.6); // Creating a random value from 0 to 1 with a seed value from a + seed + 123.6 @a = a;
why do you want to get one point attribute value for just add to a random seed value that returns a random value?
Andr made a post exactly what i was thinking you have mean.
i think we/i misunderstand your question.
made a example file
- Dougie0047
- Member
- 82 posts
- Joined:
- Offline
@mandrake0
I'm sorry, I'm a bit confused by your reply. It looks to me like you think that I started the thread, which I didn't. I read damonmaster's original question, and the code snippet he then posted above (that is where my a = rand(a+seed*123.6) comes from, more or less). And then I posted a possible answer. My question was addressed to damonmaster to check if it was what he was looking for/something he could use. Sorry again, but I must have overlooked Andr's answer, which is really similar, before I added my own.
Cheers,
Dag
I'm sorry, I'm a bit confused by your reply. It looks to me like you think that I started the thread, which I didn't. I read damonmaster's original question, and the code snippet he then posted above (that is where my a = rand(a+seed*123.6) comes from, more or less). And then I posted a possible answer. My question was addressed to damonmaster to check if it was what he was looking for/something he could use. Sorry again, but I must have overlooked Andr's answer, which is really similar, before I added my own.
Cheers,
Dag
- damonmaster
- Member
- 4 posts
- Joined: 6月 2017
- Offline
- damonmaster
- Member
- 4 posts
- Joined: 6月 2017
- Offline
mandrake0// user parameters int seed = chi("seed"); // Getting a seed Value float a = point(0, "a", 0); // fetch the "a" attribute from point 0 a = rand(a+seed*123.6); // Creating a random value from 0 to 1 with a seed value from a + seed + 123.6 @a = a;
why do you want to get one point attribute value for just add to a random seed value that returns a random value?
Andr made a post exactly what i was thinking you have mean.
i think we/i misunderstand your question.
made a example file
My situation is that each time the value of @a is the result obtained from the last loop, how can I copy the result of the loop to other points in the same wrangle? I know this would be very simple just using two wrangle nodes!
Edited by damonmaster - 2023年9月26日 02:55:24
- mandrake0
- Member
- 644 posts
- Joined: 6月 2006
- Offline
Dougie0047
@mandrake0
I'm sorry, I'm a bit confused by your reply. It looks to me like you think that I started the thread, which I didn't. I read damonmaster's original question, and the code snippet he then posted above (that is where my a = rand(a+seed*123.6) comes from, more or less). And then I posted a possible answer. My question was addressed to damonmaster to check if it was what he was looking for/something he could use. Sorry again, but I must have overlooked Andr's answer, which is really similar, before I added my own.
Cheers,
Dag
Sorry Dag it was just confusing
damonmaster
My situation is that each time the value of @a is the result obtained from the last loop, how can I copy the result of the loop to other points in the same wrangle? I know this would be very simple just using two wrangle nodes!
it is okey to use 2 Wrangler nodes when the attribute can't be accessed or there is a special situation
this is a test script where you can check if you can get the attribute value.
https://www.sidefx.com/docs/houdini/vex/attrib_suite.html#checked [www.sidefx.com]
int success = 0; f@value = pointattrib(0,"a",0,success); i@success = success;
-
- Quick Links