Custom data from sops

   299   4   1
User Avatar
Member
798 posts
Joined: 4月 2020
オフライン
hello all,

I am looking for a way to bring custom data ( the type you can retrieve with prim.GetCustomDataByKey ) from sops to lops, is this possible? I have found the option for custom attributes in the sop import lop, but the way those are brought in does not work great for me.

As an alternative, is there a way to set the custom data in vex?

Any help would be apreciated,

Thanks,
Koen
Edited by koen - 2026年2月19日 07:27:00
User Avatar
Member
448 posts
Joined: 4月 2018
オンライン
Just so we avoid any XY problem [xyproblem.info] issues, can you describe what you are actually trying to achieve?
User Avatar
Member
798 posts
Joined: 4月 2020
オフライン
I am exporting houdini scenes to our game engine from houdini. One of the features I support is to re-use existing data from the game. For example, if I already have a teapot in the game, and I export a scene full of teapots, I can add a custom attribute with a guid pointing to the existing asset to the prim referencing the teapot. This way when I import the scene, I look for this attribute and instead of converting the teapot again to a new asset, I point to the existing one and prune the children of the prim with this guid. ( the existing assets point to converted data, so not usd files ).

Artists will often author in sops, lots of copy to points etc. It's easy here to add a prim attribute to point to our assets. The question for me is how to get this into lops cleanly. I would really like to use customData instead of custom attributes. I can get the prim attribute into lops, but first it does not seem to be marked as custom, so it will have issues with schema validation, but I can fix this with the usd_addattribute function. However, I would really prefer customData as we have some other things we pass along as customData as well. The only way I have found to do this cleanly is with the Configure Primitive Lop and set the custom data there. But that makes it harder to limit this to just the prims that have this guid set and the scripting in there to get the value from the custom attribute is not super intuitive.

I think the most likely solution is to traverse the stage myself in a python lop and look up the imported attribute, and if it exists create custom data for this prim. However, when I block the custom attribute, it still gets written to the usd, so the "temp" attribute I create to bring the data from sops into lops sticks around. I'd like to clean that up properly.

( also, I have not found out yet how to bring in name spaced attributes from sops, "koen:guid" is not a valid sops prim attribute name and tips here would also be very welcome ) .

Ideally in my case, the sop import lop would have a "Usd Custom Data" field in addition to the usd custom attribute field, and some way to add this namespace, either in the import lop or directly in sops.

Thoughts?

Thanks,
Koen
Edited by koen - 2026年2月21日 08:53:04
User Avatar
Member
300 posts
Joined: 1月 2015
オンライン
Attached scene show how you can get the namespace into Solaris from SOPs.

In short you need to toggle a button on the node that creates the attribute.

Attribute Create = Encode Invalid Attribute Names
Attribute Wrangle = Standard Variable Names Only

Not long ago I noticed the toggles for the first time, after using Houdini for 11 years.

Attachments:
USD_koen_guid_custom_attrib_01.hipnc (294.5 KB)

User Avatar
Member
798 posts
Joined: 4月 2020
オフライン
Oh thanks! I had never noticed either, that helps with part of the problem for sure.

Cheers,
Koen
  • Quick Links