HDK operate on chunks of points based on "path"

   665   3   2
User Avatar
Member
82 posts
Joined:
Offline
I may be overthinking this, but I'm working on an HDK plugin that I have a need to internally process batches of points based on the primitive attribute "path".

so, basically work thru all the geometry points like a for-loop sop node functions if you changed the "piece attr" to "path"


I was thinking of creating and destroying groups for each and then looping on each group using GA_FOR_ALL_GROUP_PTOFF
but I feel like that could be pretty slow.



The For-each sop is so fast, there has to be a way to quickly do this, but I'm just not thinking about it correctly.

Thanks in advance.
User Avatar
Staff
794 posts
Joined: Oct. 2012
Offline
I think you likely want GU_Detail::getLookupTable(attrib) which can give you a list of the unique string / int values for the attribute, as well as a list of the element offsets for each value which you can iterate over
User Avatar
Member
82 posts
Joined:
Offline
Thank you!

I figured out what I needed I think.. I got the lookup table of individual "path" prims
Then I had to iterate thru those and get the offsets of the points (basically the vertices) of each prim path.

I could then flatten this list to remove duplicates, and that was the "points" (offset array) I was after.
Then I could just iterate thru that array of point offsets and update my point attributes.

Very much appreciate the point in the right direction!

-johnc
User Avatar
Staff
794 posts
Joined: Oct. 2012
Offline
Great!
One other note is that you might be able to use GA_Range to build the point range from the primitive offsets, something like (untested)
GA_Range prim_range(geo.getPrimitiveMap(), prim_offset_list);
GA_Range pt_range(geo, prim_range, GA_ATTRIB_POINT, GA_Range::primitiveref(), /*harden*/false);
for (GA_Offset ptoff : pt_range)
{
    ...
}
  • Quick Links