SOP Intrinsic: usdViewportPurpose

   376   3   2
User Avatar
Member
123 posts
Joined: Nov. 2016
Offline
Hi!

I noticed that the usdViewportPurpose intrinsic attribute is an array of the USD purpose of an usd imported geometry using the SOP Modify LOP. The thing is that I think that maybe this should be an string attribute instead with the primitive purpose because right now the usdViewportPurpose intrinsic attribute is the same array for Proxy or Render geometries as you can see here:



On that example is very easy to see which prim has a Proxy purpose or the Render purpose because it is created with the Component Builder setup so the purposes are also on the primpath, but on a non-component builder prims, it can be more difficult to check which is the purpose from each one:



So, there is another method to select in SOP the purpose of the prims?

Thanks!
User Avatar
Member
130 posts
Joined: Jan. 2015
Offline
Im only on my phone.

But if I remember correctly you only need create a string attribute named purpose with purpose you want as value.
User Avatar
Member
31 posts
Joined: March 2017
Offline
Heileif
Im only on my phone.

But if I remember correctly you only need create a string attribute named purpose with purpose you want as value.

That's definitely the case for sending geo from sops to lops. I think cdordelly is asking about a clear attribute to show what the purpose was when getting geo into sops from lops.

I had a quick look and I ran into the same thing, an intrinsic array is created that ends up being the same across all geo so you need to rely on the path to determine the purpose.
User Avatar
Member
130 posts
Joined: Jan. 2015
Offline
The intrinsic attributes was indeed not useful.

But as a workaround this python code can work.

node = hou.pwd()
geo = node.geometry()
stage = hou.node("../../..").inputs()[0].stage()
geo.addAttrib(hou.attribType.Prim, 'purpose', 'value')

for prim in geo.prims():
    path = prim.stringAttribValue('path')
    UsdPurpose = stage.GetObjectAtPath(path).GetAttribute('purpose').Get()
    prim.setAttribValue('purpose', UsdPurpose)
Edited by Heileif - April 29, 2024 05:05:04
  • Quick Links