Skip to content

Commit

Permalink
Merge pull request #20 from CGCookie/generate-previews
Browse files Browse the repository at this point in the history
Generating Previews
  • Loading branch information
Fweeb committed Mar 17, 2023
2 parents 9bbd11c + bc59fb3 commit 01e2e24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


import bpy

import time

def actually_export(export_scene, filepath):
# Set the export scene as the active scene
Expand Down Expand Up @@ -82,10 +82,16 @@ def export_blend_objects(context, export_settings):
export_collection.objects.link(ob)
elif export_settings["export_as_collection"] == False and export_settings["mark_asset"]:
ob.asset_mark()
ob.asset_generate_preview()

# If exporting as a collection and marking as an asset, only mark the collection as an asset
if export_settings["export_selected"] and export_settings["export_as_collection"] and export_settings["mark_asset"]:
export_collection.asset_mark()
export_collection.asset_generate_preview()

# Temporary hack to give the preview time to generate.
# Ideally, we would wait until preview.image_size[0] != 0
time.sleep(0.5)

actually_export(export_scene, export_settings["filepath"])

Expand Down

0 comments on commit 01e2e24

Please sign in to comment.