@@ -137,15 +137,17 @@ def execute(self, context):
137
137
/ self .new_library_name .replace (" " , "_" ).casefold ()
138
138
)
139
139
dir .mkdir (parents = True , exist_ok = True )
140
- lib = utils .AssetLibrary .create_new_library (
140
+ self . lib = utils .AssetLibrary .create_new_library (
141
141
self .new_library_name , str (dir ), context = context , load_catalogs = True
142
142
)
143
143
self .is_new_library = True
144
144
else :
145
- lib = utils .from_name (self .library , context = context , load_catalogs = True )
145
+ self .lib = utils .from_name (
146
+ self .library , context = context , load_catalogs = True , load_assets = True
147
+ )
146
148
self .is_new_library = False
147
149
148
- lib .path .mkdir (parents = True , exist_ok = True )
150
+ self . lib .path .mkdir (parents = True , exist_ok = True )
149
151
150
152
assets = context .selected_assets
151
153
@@ -155,11 +157,13 @@ def execute(self, context):
155
157
156
158
if self .keep_blend_files_as_is :
157
159
self ._thread = Thread (
158
- target = self .add_to_library_keep , args = (assets , lib .path )
160
+ target = self .add_to_library_keep , args = (assets , self . lib .path )
159
161
)
160
162
# self.add_to_library_keep(assets, lib.path)
161
163
else :
162
- self ._thread = Thread (target = self .add_to_library_split , args = (assets , lib ))
164
+ self ._thread = Thread (
165
+ target = self .add_to_library_split , args = (assets , self .lib )
166
+ )
163
167
# self.add_to_library_split(assets, lib)
164
168
165
169
context .window_manager .modal_handler_add (self )
@@ -195,13 +199,15 @@ def finished(self, context: Context):
195
199
196
200
# try:
197
201
utils .update_asset_browser_areas (context )
202
+ self .lib .save_json ()
198
203
# except Exception as e:
199
204
# print(f"An error occurred while refreshing the asset library: {e}")
200
205
201
206
return {"FINISHED" }
202
207
203
208
def follow_up (self ):
204
209
self .prog .end ()
210
+
205
211
for area in bpy .context .screen .areas :
206
212
area .tag_redraw ()
207
213
@@ -267,7 +273,6 @@ def add_to_library_split(
267
273
self .updated = True
268
274
269
275
with lib .open_catalogs_file () as catfile :
270
- catfile : utils .CatalogsFile
271
276
for catalog in catalogs :
272
277
catfile .add_catalog_from_other (catalog )
273
278
0 commit comments