I have a large collection of models that I'd like to batch mark as asset. I use a .bat file to open the .blend and then mark as asset and then save and quit. It works but the issue is the preview. The models I'm trying to mark as asset already have rendered preview images. I just want to assign the corresponding image preview to the asset. This is what I've got so far:
import bpy for obj in bpy.data.objects: if obj.type == "MESH": obj.asset_mark() name = obj.name + ".jpg" dir = "C:\\path\\" + name bpy.ops.ed.lib_id_generate_preview(filepath=dir) bpy.ops.wm.save_mainfile()
It gives an error of course.