Reference USD attribute data

   376   6   0
User Avatar
Member
18 posts
Joined: June 2019
Offline
Hi,

I am, as a Python beginner, trying to use the USD API to reference a USD attribute in a parameter.
This is how far I've got:


Now it seemed I needed an SdfPath object, but I couldn't figure out how to get one. But after deciding I should try this function (GetAttributeAtPath) just with a string as input then, I saw that my ‘Stage’ object didn't even know that function.

Help would be greatly appreciated.
Edited by Forests - Sept. 17, 2020 03:19:45

Attachments:
sh.png (37.4 KB)

User Avatar
Staff
3741 posts
Joined: July 2005
Offline
I typed in exactly what you have there and I don't get the same error message as is displayed there. GetAttributeAtPath can be passed a regular string, and it is automatically converted to a pxr.Sdf.Path object. If you could post a simple hip file that would make it easier to help you, but also I'd suggest experimenting the in the Python Shell window yourself first. That window provides auto-completion while you type which is extremely helpful in making sure you use the right function names, valid objects, etc.
User Avatar
Member
18 posts
Joined: June 2019
Offline
Thanks for the tip. I checked at the Python Shell and there appear a few functions there, which I think are from the USD API, but not GetAttribureAtPath:


Also here is a small hipfile:
Edited by Forests - Sept. 17, 2020 15:56:52

Attachments:
ScreenFlow_GetAttrib-.gif (2.4 MB)
usd1.usdnc (6.7 KB)
usdhip2.hipnc (103.5 KB)

User Avatar
Member
3843 posts
Joined: Sept. 2011
Offline
mtucker
I typed in exactly what you have there and I don't get the same error message as is displayed there. GetAttributeAtPath can be passed a regular string, and it is automatically converted to a pxr.Sdf.Path object. If you could post a simple hip file that would make it easier to help you, but also I'd suggest experimenting the in the Python Shell window yourself first. That window provides auto-completion while you type which is extremely helpful in making sure you use the right function names, valid objects, etc.

I think GetAttributeAtPath is only available in USD 20.08, and therefore not available in Houdini 18.0

instead of GetAttributeAtPath() you can use GetPrimAtPath().GetAttribute()
Edited by jsmack - Sept. 17, 2020 16:01:53
User Avatar
Staff
3741 posts
Joined: July 2005
Offline
Oh, thanks @jsmack… I didn't realize that was a new API.
User Avatar
Member
18 posts
Joined: June 2019
Offline
Yep, It works..

How can we check what version of USD we are on?
It will be available in H18.5? did we get an accidental feature leak here of H18.5 right from the developers? :-)


Thanks for the help guys
Edited by Forests - Sept. 18, 2020 07:29:35
User Avatar
Staff
3741 posts
Joined: July 2005
Offline
hou.lop.usdVersionInfo() will print the USD version information.
H18.5? What's H18.5?
  • Quick Links