Houdini 19.0 Python scripting hou hou.qt

hou.qt.AssetGallery class

A module for the the Asset Gallery used by the layout node.

This module contains scriptable methods for manipulating the Asset Gallery database.

To programmatically add items to the Asset Gallery database you would need only provide a display name, the path to the asset and an image to be used as the asset’s thumbnail.

A simple script for making a new database and adding an asset would look like this:

import hou
from Pyside2 import QtGui

# set the db file to be something specific
hou.qt.AssetGallery.setAssetDBFile("d:/myproject/MyProject_AssetGalleryDb.db")

# read in the thumbnail
thumbnail_path = "d:/assets/newasset1/newasset1.png"
thumbnail = QtGui.QImage()
thumbnail.load(thumbnail_path)

# add the database entry
item_uuid = hou.qt.AssetGallery.addAsset(
     "new asset 1",
     "d:/assets/newasset1/newasset1.usd",
     thumbnail)
print("new asset uuid:", item_uuid)

Note

The database does not store the asset directly, it only stores the path to it. The thumbnail, though, is stored directly in the database. If the thumbnail file later changes on disk, that change will not be reflected in the Asset Gallery database.

Methods

hou.qt