Using an Attribute to drive the Group Parameter in a Loop

   465   3   1
User Avatar
Member
8 posts
Joined: July 2022
Offline
Hi everyone!

I am trying to make a custom UV layout setup that takes into account which materials are assigned to a primitive and grouping their UV islands together. Depending on which material a primitive has assigned to it it has a prim attribute that corresponds to the material.

My plan was to create a for loop that takes the total number of materials used as the number of iterations. I created a detail attribute that has a list of all the materials in an array and I want to use the iteration number to iterate over that array and use that to only create a uv layout for one material at a time. When the loop is done and every material has a layout that has the uv islands grouped together, I would use the uv layout node aga
in and keep the islands connected via the connectivity override.

Unfortunately I cannot figure out how to drive the group parameter in the uv layout node with the content of my "currentGroup" attribute. In my current state I use this expression:

`detail("../get_current_group", "currentGroup", 0)`




however it does not seem to work.

Can anyone tell me how one would achieve this or even have a more clever way of achieving the same thing?

Cheers!

Attachments:
uv_layout_material.png (131.9 KB)
node_tree.png (181.7 KB)

User Avatar
Member
463 posts
Joined: Nov. 2016
Offline
It would help to see the content of your wrangle, but I would probably try to create a currentGroup directly in the wrangle, with an unchanging name but changing content, and perform the uv layout on that.
User Avatar
Member
8 posts
Joined: July 2022
Offline
Here is the content of the Wrangle node.



If I am understanding you correctly that is what I am currently trying to do.
Edited by V4PostPro - Nov. 5, 2024 10:09:23

Attachments:
Wrangle.png (31.0 KB)

User Avatar
Member
463 posts
Joined: Nov. 2016
Offline
I would try making the wrangle a Primitive wrangle, and changing its last line to:

i@group_currentGroup = inprimgroup(0, groups[iteration], i@primnum);

Then just use currentGroup in your uv layout group parameter.
Edited by Tanto - Nov. 5, 2024 10:25:41
  • Quick Links