continue refacto

This commit is contained in:
“christopheseux”
2022-12-28 00:09:57 +01:00
parent 575bbade7b
commit 74724423b4
5 changed files with 21 additions and 15 deletions
+8 -5
View File
@@ -1,5 +1,5 @@
from asset_library.common.functions import (read_catalog, write_catalog, norm_asset_datas)
from asset_library.common.functions import (norm_asset_datas,)
from asset_library.common.bl_utils import get_addon_prefs, load_datablocks
from asset_library.common.file_utils import read_file, write_file
from asset_library.common.template import Template
@@ -317,6 +317,9 @@ class AssetLibraryAdapter(PropertyGroup):
"""Read the catalog file of the library target directory or of the specified directory"""
catalog_path = self.get_catalog_path(directory)
if not catalog_path.exists():
return {}
cat_data = {}
for line in catalog_path.read_text(encoding="utf-8").split('\n'):
@@ -761,12 +764,12 @@ class AssetLibraryAdapter(PropertyGroup):
print(f'Saving Blend to {blend_path}')
#blend_path.parent.mkdir(exist_ok=True, parents=True)
blend_path.parent.mkdir(exist_ok=True, parents=True)
#bpy.ops.wm.save_as_mainfile(filepath=str(blend_path), compress=True)
bpy.ops.wm.save_as_mainfile(filepath=str(blend_path), compress=True)
#if write_cache:
# self.write_cache(cache)
if write_cache:
self.write_cache(cache)
self.write_catalog(catalog_data)