Jump to content
Sign in to follow this  


Recommended Posts

Hello everyone,

I'm trying to make a screenShot script with python that load my image in the network view

Well everything goes well until the end of the script:

editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
image = hou.NetworkImage()
image.setRect(hou.BoundingRect(0, 0, 5, 5))

I found this piece of code in the houdini documentation. The problem is when navigate from /obj/geo to /obj and go back to /obj/geo the image is gone.

is anybody has an idea ?

Thanks !

here is my full script:

def screenShot():
    """take a screen shot of the current viewport at the current frame"""
    import hou
    import toolutils
    import os
    #selected node
    nodeSelect = hou.selectedNodes()
    path = hou.expandString("$HIP")
    frame = hou.expandString("$F")
    frame = int(frame)
    #name check there is a node selected
    if len(nodeSelect)<1:
        print ("!!!    error: select a node    !!!")
        for node in nodeSelect:
            name = node.name()
        #Get the current Desktop
        desktop = hou.ui.curDesktop()
        # Get the scene viewer
        scene= toolutils.sceneViewer()
        flipbook_options = scene.flipbookSettings().stash()
        # set frame range
        #set output path
        root ="{1}/{2}/{0}/".format(name,path,"screenShot")
        if os.path.exists(root):
            listPath = os.listdir(root)
            inc = len(listPath)
            inc = int(inc)   
            outputPath = "{}{}.{:04d}.jpg".format(root,name,inc)
            inc = 0
            outputPath = "{}{}.{:04d}.jpg".format(root,name,inc)
        #set flipbook current path     
        #run flipbook
        # reload image
        print (outputPath)
        editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
        image = hou.NetworkImage()
        image.setRect(hou.BoundingRect(0, 0, 5, 5))




Share this post

Link to post
Share on other sites

Afaik when you add a background image via their snippet, the .userDataDict() of the node is not being registered/saved (you can try adding a network bg image by hand and calling 


You'll get something like:

{'___Version___': '16.0.736', 'backgroundimages': '[{"relativetopath": "volumevisualization24", "path": "/path/to/image.png", "rect": [-202.1, -265.1, 60.2, -85.3], "brightness": 0.54}]'}

Pretty sure this is a bug not a feature. Adding these values to the userDict works but if you screw up the formatting you can corrupt a node and houdini doesn't like it.

  • Like 1

Share this post

Link to post
Share on other sites

Sent a RFE and it's normal behaviour, if anyone googles the problem:


Our developers comment:
That is correct, setting the image on the network editor does not automatically save the change to the current network's userDataDict. On the other hand if you edit the network's userDataDict, the network editor should automatically update with the change. So you can either edit the userDataDict to make your desired changes, or you can use the nodegraphutils.saveBackgroundImages() method to save the backgroun image from the network editor into the network's userDataDict.

All the best,
(ID# 90646)

(i hope it's ok to post this. they are super responsive!)

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this