Accessing layer metadata from Python script

   2618   2   2
User Avatar
Member
31 posts
Joined: Feb. 2014
Offline
Hi - any suggestions on how to go about querying the startTimeCode and endTimeCode stored on the root prim within Solaris using Python?

After setting frame ranges using a ConfigureLayerLOP I can see the values in the metadata report for the root prim, and if I use a Karma or USDRender ROP with the range set to "Render Frame Range From Stage" these values are respected. However, I'd like to get at that info for custom farm submission scripts.

Nothing jumped out looking through the docs - possibly something related to getting an editableStage().GetMetadata() from the target LOP node, but I don't seem to be able to do that outside of a PythonLOP. I'd be running this as part of a scripted gui.

Any pointers?

cheers

Ben
Edited by ben toogood - Oct. 30, 2021 16:36:00

Attachments:
Screenshot 2021-10-30 211250.png (85.6 KB)

User Avatar
Member
31 posts
Joined: Feb. 2014
Offline
Nevermind - a bit more digging got there (with help from this https://www.sidefx.com/forum/topic/77650/)

For the future record, this does the job:

import hou
node = hou.node('/stage/karma1')
stage = node.stage()
start = stage.GetMetadata('startTimeCode')
end = stage.GetMetadata('endTimeCode')
User Avatar
Member
354 posts
Joined: Nov. 2013
Offline
There's also dedicated functions
stage.GetStartTimeCode()
stage.GetEndTimeCode()
  • Quick Links