From 74724423b4fd3ae8e89af9c20452c73f57bc2e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cchristopheseux=E2=80=9D?= <“seuxchristophe@hotmail.fr”> Date: Wed, 28 Dec 2022 00:09:57 +0100 Subject: [PATCH] continue refacto --- action/__init__.py | 5 +++-- action/{render_preview.py => _render_preview.py} | 0 action/operators.py | 9 +++++---- adapters/adapter.py | 13 ++++++++----- collection/__init__.py | 9 +++++---- 5 files changed, 21 insertions(+), 15 deletions(-) rename action/{render_preview.py => _render_preview.py} (100%) diff --git a/action/__init__.py b/action/__init__.py index f567ade..6aabd72 100644 --- a/action/__init__.py +++ b/action/__init__.py @@ -7,7 +7,8 @@ from asset_library.action import ( operators, properties, rename_pose, - render_preview,) + #render_preview + ) if 'bpy' in locals(): import importlib @@ -19,7 +20,7 @@ if 'bpy' in locals(): importlib.reload(operators) importlib.reload(properties) importlib.reload(rename_pose) - importlib.reload(render_preview) + #importlib.reload(render_preview) def register(): operators.register() diff --git a/action/render_preview.py b/action/_render_preview.py similarity index 100% rename from action/render_preview.py rename to action/_render_preview.py diff --git a/action/operators.py b/action/operators.py index 6554252..36121f3 100644 --- a/action/operators.py +++ b/action/operators.py @@ -73,8 +73,8 @@ from asset_library.action.functions import ( from asset_library.common.functions import ( #get_actionlib_dir, get_asset_source, - get_catalog_path, - read_catalog, + #get_catalog_path, + #read_catalog, #set_actionlib_dir, resync_lib, get_active_library, @@ -299,7 +299,7 @@ class ACTIONLIB_OT_apply_anim(Operator): return {'FINISHED'} - +""" class ACTIONLIB_OT_publish(Operator): bl_idname = "actionlib.publish" bl_label = "Publish Library" @@ -444,6 +444,7 @@ class ACTIONLIB_OT_publish(Operator): print('[>-] Publish Done.') return {"FINISHED"} +""" class ACTIONLIB_OT_create_anim_asset(Operator): @@ -1059,7 +1060,7 @@ class ACTIONLIB_OT_store_anim_pose(Operator): classes = ( ACTIONLIB_OT_assign_action, ACTIONLIB_OT_restore_previous_action, - ACTIONLIB_OT_publish, + #ACTIONLIB_OT_publish, ACTIONLIB_OT_apply_anim, ACTIONLIB_OT_replace_pose, ACTIONLIB_OT_create_anim_asset, diff --git a/adapters/adapter.py b/adapters/adapter.py index f9203fd..070cda9 100644 --- a/adapters/adapter.py +++ b/adapters/adapter.py @@ -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) diff --git a/collection/__init__.py b/collection/__init__.py index a9ab241..b90a7a4 100644 --- a/collection/__init__.py +++ b/collection/__init__.py @@ -3,8 +3,9 @@ from asset_library.collection import ( gui, operators, keymaps, - build_collection_blends, - create_collection_library) + #build_collection_blends, + #create_collection_library, + ) if 'bpy' in locals(): import importlib @@ -12,8 +13,8 @@ if 'bpy' in locals(): importlib.reload(gui) importlib.reload(operators) importlib.reload(keymaps) - importlib.reload(build_collection_blends) - importlib.reload(create_collection_library) + #importlib.reload(build_collection_blends) + #importlib.reload(create_collection_library) def register():