Setting background image on render view using python

   1081   2   0
User Avatar
Member
2 posts
Joined: March 2017
Offline
Hello everyone!

I would like to set a background image automatically using python on the render view, but without having to open the dialog box in the image...
I looked into the documentation and tried to use IPRViewer class [www.sidefx.com], but it doesn't seem to have the required methods to call and set the parameter. I have also found out that a `compdisplay.pref` file is saved with the information as background.filename, but doesn't seem to be reloaded automatically, nor I found a way to force it to reload..

Is it even possible to change the filename using python? Or is there any other idea how to solve this problem?

Attachments:
Captura de Tela 2023-07-17 às 17.07.33.png (30.8 KB)

User Avatar
Member
30 posts
Joined:
Offline
Hey there,

you can do it, by calling a hscript command

copPath = "/my/plate/here.exr"
hou.hscript('imgdispopt -f %s' % copPath)

cheers,
chrisg
Edited by doctorbob - July 18, 2023 22:41:38
User Avatar
Member
2 posts
Joined: March 2017
Offline
Thank you, Chrisg~!
Works like a charm
  • Quick Links