Hi all,
I'm trying to wrap my head around on how the for each loops work in Houdini.
I have a heightfield which I wanna split up with a heightfield split node which is pretty simple. However I'd like to assign an attribute to each part. Their respective xy coordinate to be precise. So the first tile(0) would receive a string attribute similar to “tile_x0_y0”. I know I have access to stuff like ch(“tilecountx”), but I have no clue on how to properly assign them.
Thanks
String attribute on each part of a heightfield tile split
1657 2 2- neo_Flore
- Member
- 13 posts
- Joined: April 2019
- Offline
- bonsak
- Member
- 459 posts
- Joined: Oct. 2011
- Offline
- neo_Flore
- Member
- 13 posts
- Joined: April 2019
- Offline
Hi bonsak, thanks for your answer!
I didn't realise the attribute wrangle would already loop through the primitives, making a for each loop unnecessary.
My attribute is now correctly assigned, I will post the code incase someone else needs something similar.
I was working with the unreal plugin, however that part I didn't manage to get working yet.
(I want to change the actor label to these specific names instead of the auto generated ones)
VEX code:
Which give the following attributes:
I didn't realise the attribute wrangle would already loop through the primitives, making a for each loop unnecessary.
My attribute is now correctly assigned, I will post the code incase someone else needs something similar.
I was working with the unreal plugin, however that part I didn't manage to get working yet.
(I want to change the actor label to these specific names instead of the auto generated ones)
VEX code:
int xvalue = floor(primattrib(0, "tile",@primnum,1) % ch("../Split_Heightfield/tilecountx")); int yvalue = floor(primattrib(0, "tile",@primnum,1)/ch("../Split_Heightfield/tilecountx")); s@unreal_uproperty_ActorLabel = sprintf('landscape_x%g_y%g', xvalue, yvalue);
Which give the following attributes:
Edited by neo_Flore - April 26, 2019 04:49:56
-
- Quick Links