I'm trying to expand on a tool I created a couple of months ago by adding a selected list of assets to the Layout Asset Gallery via Python. I've pretty much gotten everything down except for the thumbnail portion of this code snippet:
(This is an example code)
import hou ag = hou.AssetGalleryDataSource('C:\\Users\\joeshmoe\\Desktop\\test.db') label = 'Sphere' file = 'C:\\Users\\joeshmoe\\Desktop\\sphere.abc' thumbnail = b'C:\\Users\\joeshmoe\\Desktop\\sphere.jpg' ag.addItem(label, file, thumbnail) ag.saveAs('C:\\Users\\joeshmoe\\Desktop\\test.db')
When I reload the .db file the asset does show up in my gallery, however there is no thumbnail like you would anticipate. The path and label are all populated but not the thumbnail. It's wanting the path converted to bytes in the string but I'm not sure why.
Is there something I'm doing incorrectly or is there something I need to add?
While I'm here, is there any way of refreshing/reloading the Layout Asset Gallery pane tab with python? It doesn't automatically populate the gallery when I use the script so I'm wondering if I can just reload the db file with some code.
Thanks!