Point attribute updates within attribute wrangle

   7739   5   2
User Avatar
Member
4 posts
Joined: 12月 2015
Offline
If I create a grid, add a red color to all points and then add a “attribute wrangle” with

@Cd = rand(1 + @ptnum);
vector test = point(0, "Cd", @ptnum);
printf("test: %p\n ", test);


the result of printf is

test: {1,0,0}


for all points. Not some random color assigned in the first line.

Is this because
point(0, "Cd", @ptnum)
always refers to the attributes of the input geometry (independent of changes made within the attribute wrangle) or because the attribute changes only take effect after the expression completes ? Or both…

thanks,
Bruno
Edited by Bruno Kindt - 2017年3月8日 13:42:12
User Avatar
Member
640 posts
Joined: 7月 2013
Online
@Cd = rand(1 + @ptnum);
Is correct and creates random vectors for the intrinsic Cd attribute.

vector test = point(0, "Cd", @ptnum);
This line is unnecessary, as the Point Attribute Cd is already in scope of the Point Wrangle.

What this line is saying is, hey, you already have Cd point attribute, please go out and look at your input0 and fetch Cd point data again and assign it to my local variable test.

If you want to assign the value of the Cd attribute to your local variable ‘test’, then could do:

vector test = @Cd;

Then, to print out the value of your variable test to the console, you could do:

printf("test %f \n", test);

…all which ends up being:

@Cd = rand(1 + @ptnum);
vector test = @Cd;
printf("test %f \n", test);

But, I would not write values to the console using printf, because its DOG slow, AND because, that's what the Geometry Spreadsheet is built for, inspecting attribute data in Houdini.
Edited by TwinSnakes007 - 2017年3月8日 18:03:47
Houdini Indie
Karma/Redshift 3D
User Avatar
スタッフ
6413 posts
Joined: 7月 2005
Offline
Bruno Kindt
always refers to the attributes of the input geometry (independent of changes made within the attribute wrangle)

That is the answer.

point(0, …) does not refer to the currently processing geometry, but the first input geometry.

There is no way to sanely refer to the currently processing geometry as VEX is not processing the points or your instructions in the order you'd expect.
User Avatar
Member
3 posts
Joined: 5月 2017
Offline
jlait
There is no way to sanely refer to the currently processing geometry as VEX is not processing the points or your instructions in the order you'd expect.

Hi,
how can I change attributes in VEX and update it?

For example:
I start with one Point in a group.
Iterate over all points and check if the iter-point has nearpoints and if one of that is in the group.
If so, i set the iter-point to the group.

It's a kind of infection-map. Sure not all points can be affected, but for this simple setup it should work, I guess

Thank's

Patrick
User Avatar
Member
31 posts
Joined: 12月 2006
Offline
Hi,
Bumping this as have the same issue. Is there a way to force evaluation of vex code in a wrangle at specific points?
Thanks
User Avatar
Member
2127 posts
Joined: 9月 2015
Offline
Hi,
Bumping this as have the same issue. Is there a way to force evaluation of vex code in a wrangle at specific points?
Thanks

Yes and No.

You can't think of it in terms of ‘forcing’ vex code to evaluate. You have to see it in terms of how the vex in a wrangle is related to the rest of the scene, it doesn't exist in isolation.

To better understand, post a hip with your issue, then people could offer tips on workflow to accomplish what it is you want.
  • Quick Links