Extract layer name

   1857   1   0
User Avatar
Member
16 posts
Joined: July 2006
Offline
I'm trying to debug some USD creation tools (external to Houdini). The USD files are value clips with varying time scales (1:24:1200).

What I would like is to grab the layer stack values in the Solaris desktop (Scene Graph Details -> Layer Stack) without using the Solaris desktop (the USD files are large, and switching to Solaris consumes all the memory, most likely trying to populate the Scene Graph Details pane).

I'm using USDImport SOP and modified the underlying LOPNET to include a Python script that is attempting to extract the layer name. Here's the script:

node = hou.pwd()
stage = node.editableStage()

# Add code to modify the stage.
# Use drop down menu to select examples.
# Hardcode the path for now
prim = stage.GetPrimAtPath('/World/Meshes/mesh_0')

ext = prim.GetAttribute('extent')
f = hou.intFrame()
to = hou.evalParm(“../sublayer1/timeoffset1”)
ts = hou.evalParm(“../sublayer1/timescale1”)
stack = ext.GetPropertyStack(f*ts + to)
layer = stack.layer.realPath

#parm = hou.parm('loaded_layer')
#parm.set(layer.split('/'))

print layer, f*ts + to

Since this isn't working properly (it gets the layer name, but it isn't matching the one in the layer stack), what am I missing, or is there an easier way to get at what I want ( for example, I don't see anything in the Geometry Spreadsheet)?

Mark
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
render_dude
What I would like is to grab the layer stack values in the Solaris desktop (Scene Graph Details -> Layer Stack) without using the Solaris desktop (the USD files are large, and switching to Solaris consumes all the memory, most likely trying to populate the Scene Graph Details pane).

It is very unlikely to be the scene graph details or scene graph tree panes at fault. I've only ever seen the viewport take up large amounts of memory. So you could just add a scene graph tree and scene graph details pane to the current desktop if the information you want is already available in those panes.

But getting back to your python question, ext.GetPropertyStack returns a list, so the next line gives me an error:
AttributeError: ‘list’ object has no attribute ‘layer’

If I change that code to:
layers = list(entry.layer.realPath for entry in stack)
print layers, f*ts + to

I get reasonable looking results. Of course I can't vouch for what you'd be seeing without access to your USD files…
  • Quick Links