Get camera's background image using python

   1367   1   1
User Avatar
Member
87 posts
Joined: Jan. 2009
Offline
I'm trying to get the houdini:backgroundimage value on my lops camera using python.
This is what I have so far:

lop=hou.node('/stage/cam')
stage=lop.stage()
cam=stage.GetPrimAtPath("/cam")
attr=cam.GetAttribute("houdini:backgroundimage")

Could someone tell me how to evaluate
attr
in my code so I can get the image sequence path stored in my backgroundimage primvar please. I've tried:

attr.Get()

but it just seems to be coming up empty.
Edited by tony_a - Feb. 27, 2023 13:46:37
User Avatar
Staff
616 posts
Joined: June 2020
Offline
Using attr.Get()will pick up the "default" (i.e., the non-animated) value. I expect the expression you're using is being expanded at authoring time and generating time sampled data, so you'll want to pass a "query time" to evaluate the attribute - something like: attr.Get(hou.frame()).
Edited by robp_sidefx - Feb. 28, 2023 08:33:39
  • Quick Links