String attribute on each part of a heightfield tile split

   1653   2   2
User Avatar
Member
13 posts
Joined: 4月 2019
Offline
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
User Avatar
Member
459 posts
Joined: 10月 2011
Offline
Depending on how you are planning to use your attribute later, you could just use a primitive wrangle and set your attributes in there.

-b

Attachments:
hf_attributes.hiplc (76.1 KB)

http://www.racecar.no [www.racecar.no]
User Avatar
Member
13 posts
Joined: 4月 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:
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 - 2019年4月26日 04:49:56

Attachments:
attributes.PNG (42.0 KB)

  • Quick Links