Wrangle Array Issue - Run over Elements of Array Attribute

   1266   3   2
User Avatar
Member
3 posts
Joined: Dec. 2022
Offline
Hey
I am currently having an issue when trying to populate an array attribute with a lop wrangle set to `Run on Elements of Array Attributes` and Array length set to `Specific Attribute`.
In some cases it works fine but many times it just runs over exactly 1024 elements and ignores the rest.

What I am trying to accomplish is creating a Point and Prim ID Attribute per USD Prim in Lops for import into sops to later be able to map the points back to the original one for sparse attribute overrides(don't want to do the id generation in Sops since i would have to unpack :S) - If there are better ways of accomplishing that please let me know as well

My first try to do this was in a for loop in a wrangle but that is very slow since it wont be multithreaded (at least not if there is only one primpath) and that is why I am trying to use the `Run on Elements of Array attribute`.

These are the wrangles I use:
First a wrangle that is running normally over all Prims of type mesh:
string prim_id_attrib = "prim_id";
int primcount = usd_attriblen(0, s@primpath, "faceVertexCount");
if(primcount == 0)
    primcount = usd_attriblen(0, s@primpath, "curveVertexCount");
int prim_ids[];
resize(prim_ids, primcount);
usd_addprimvar(0, s@primpath, prim_id_attrib, "int[]", "uniform");
usd_setprimvar(0, s@primpath, prim_id_attrib, prim_ids);
This seems to generate the attribute with the correct length and when unpacked in sops they do seem to map correctly to prims. Though in theory I found I dont need the resize function when I use the slower for loop mentioned above. Still use it to be sure and not to have to run over the original faceVertexCount attribute.

Then the second wrangle that causes the problems:
- It is also running over all primitives of type Mesh
- Toggled `Run on Elements of Array Attributes`
- Array length is set to `Specific Attribute`
- Attribute Name is set to prim_id
and the code itself is this:
string prim_id_attrib = "prim_id";
usd_setprimvarelement(0, s@primpath, @elemnum, @elemnum);
The result here is that many array attributes are populated correctly to the end but many others just stop at 1024 sadly (the rest is filled with whatever I set in the previous wrangles resize function as default) So it looks like it doesnt pick up the attribute length for some prims correctly for some reason :S.

Any help is greatly appreciated and thanks in advance
User Avatar
Staff
498 posts
Joined: June 2020
Offline
For the problematic prims, is it possible you have a "prim_id" *attribute* on the prim which is 1024 elements long? Does anything change if, on the second wrangle, you put "primvars:prim_id" (instead of "prim_id") as the "Attribute Name"?

Can you share a hip file?
Edited by robp_sidefx - Dec. 2, 2022 06:03:42
User Avatar
Member
3 posts
Joined: Dec. 2022
Offline
Hey thanks for the reply!
hm sadly I still have the issue with primvars:prim_id and i dont have a primvar of that name before the wrangles I'll use a for loop in the meantime.
I cant share the setup where it is breaking right now sadly but i will try to replicate it on the weekend in an new scene : S
Anyways many thanks for the input ill come back with a scene if i can replicate it!
User Avatar
Member
3 posts
Joined: Oct. 2018
Offline
Im getting a very similar issue, running over PointInstancers with large point arrays.

Works fine on smaller point arrays, but at some point stops work when it hits large ones, and just runs to '1024'
  • Quick Links