RCG: add assets data file
This commit is contained in:
parent
e396b0c01e
commit
362e0f7a6f
1 changed files with 16 additions and 0 deletions
|
@ -190,6 +190,8 @@ def assembly_rebuilder():
|
||||||
def build_render_assets(project_dir):
|
def build_render_assets(project_dir):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
|
assets_data = []
|
||||||
|
|
||||||
libs_data_path = os.path.join(project_dir, 'libs.json')
|
libs_data_path = os.path.join(project_dir, 'libs.json')
|
||||||
if not os.path.exists(libs_data_path):
|
if not os.path.exists(libs_data_path):
|
||||||
raise Exception('No libs database found! Check %s directory' % project_dir)
|
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)
|
bpy.ops.wm.save_as_mainfile(filepath=blend_path)
|
||||||
logger.info('Render asset %s generated!', tree_item['name'])
|
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))
|
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
|
return render_assets_dir
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue