Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ops/add_categories_to_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def execute(self, context: bpy.types.Context) -> set[str]:
hive_mind.load_categories()

with lib.open_catalogs_file() as cat_file:
cat_file: utils.CatalogsFile
for category_uuid, sub_list in hive_mind.SUBCATEGORIES_DICT.items():
cat_info = hive_mind.CATEGORIES_DICT.get(category_uuid)
cat = cat_file.find_catalog(category_uuid)
Expand Down
17 changes: 11 additions & 6 deletions ops/add_to_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,17 @@ def execute(self, context):
/ self.new_library_name.replace(" ", "_").casefold()
)
dir.mkdir(parents=True, exist_ok=True)
lib = utils.AssetLibrary.create_new_library(
self.lib = utils.AssetLibrary.create_new_library(
self.new_library_name, str(dir), context=context, load_catalogs=True
)
self.is_new_library = True
else:
lib = utils.from_name(self.library, context=context, load_catalogs=True)
self.lib = utils.from_name(
self.library, context=context, load_catalogs=True, load_assets=True
)
self.is_new_library = False

lib.path.mkdir(parents=True, exist_ok=True)
self.lib.path.mkdir(parents=True, exist_ok=True)

assets = context.selected_assets

Expand All @@ -155,11 +157,13 @@ def execute(self, context):

if self.keep_blend_files_as_is:
self._thread = Thread(
target=self.add_to_library_keep, args=(assets, lib.path)
target=self.add_to_library_keep, args=(assets, self.lib.path)
)
# self.add_to_library_keep(assets, lib.path)
else:
self._thread = Thread(target=self.add_to_library_split, args=(assets, lib))
self._thread = Thread(
target=self.add_to_library_split, args=(assets, self.lib)
)
# self.add_to_library_split(assets, lib)

context.window_manager.modal_handler_add(self)
Expand Down Expand Up @@ -195,13 +199,15 @@ def finished(self, context: Context):

# try:
utils.update_asset_browser_areas(context)
self.lib.save_json()
# except Exception as e:
# print(f"An error occurred while refreshing the asset library: {e}")

return {"FINISHED"}

def follow_up(self):
self.prog.end()

for area in bpy.context.screen.areas:
area.tag_redraw()

Expand Down Expand Up @@ -267,7 +273,6 @@ def add_to_library_split(
self.updated = True

with lib.open_catalogs_file() as catfile:
catfile: utils.CatalogsFile
for catalog in catalogs:
catfile.add_catalog_from_other(catalog)

Expand Down
1 change: 0 additions & 1 deletion ops/asset_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def execute(self, context):
asset.catalog_id = cat.id
else:
with lib.open_catalogs_file() as cat_file:
cat_file: "utils.CatalogsFile"
if "/" in catalog_simple_name:
name = catalog_simple_name.split("/")[-1]
cat = cat_file.add_catalog(name, path=catalog_simple_name)
Expand Down
2 changes: 0 additions & 2 deletions ops/remove_empty_catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def execute(self, context):
print("No catalogs used in library")

with lib.open_catalogs_file() as cat_file:
cat_file: utils.CatalogsFile

for cat in cat_file.get_catalogs():
if cat.id not in catalog_ids and not cat.has_child(catalog_ids):
cat.remove_self()
Expand Down
1 change: 0 additions & 1 deletion settings/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ def process_asset_metadata(
asset.catalog_id = cat.id
if not cat:
with lib.open_catalogs_file() as cat_file:
cat_file: "utils.CatalogsFile"
if "/" in catalog_simple_name:
name = catalog_simple_name.split("/")[-1]
cat = cat_file.add_catalog(
Expand Down
Loading