RCG: add assets data file

This commit is contained in:
brothermechanic 2024-04-16 11:02:44 +03:00
parent e396b0c01e
commit 362e0f7a6f
No known key found for this signature in database
GPG key ID: 9C59EF9503ACD106

View file

@ -190,6 +190,8 @@ def assembly_rebuilder():
def build_render_assets(project_dir):
'''
'''
assets_data = []
libs_data_path = os.path.join(project_dir, 'libs.json')
if not os.path.exists(libs_data_path):
raise Exception('No libs database found! Check %s directory' % project_dir)
@ -236,5 +238,19 @@ def build_render_assets(project_dir):
bpy.ops.wm.save_as_mainfile(filepath=blend_path)
logger.info('Render asset %s generated!', tree_item['name'])
assets_data.append(
{
'type': 'RENDER',
'name': tree_item['name'],
'path': os.path.relpath(blend_path, project_dir),
'thumbnail': ''
}
)
logger.info('%s Render Assets was generated!', len(tree_item_list))
# write db file
assets_data_path = os.path.join(project_dir, 'assets.json')
with open(assets_data_path, 'w', encoding='utf-8') as assets_data_file:
json.dump(assets_data, assets_data_file, ensure_ascii=False, indent=4)
logger.info('Database saved successfully to %s!', assets_data_path)
return render_assets_dir