I am trying to update linked rigs in blends files. It works fine, but it seems not to care about updating all connected data (rigs have linked models). I need to use function bpy.ops.outliner.lib_operation(type='RESOLVE') but if I saw what operation it makes it would be better to use them in our workflow
def updateAssets():
print('\n============================================')
# Loop through all the linked blend files
scene_path = bpy.data.filepath
resolved_path = ''
linked = bpy.data.libraries
updated = []
if linked:
for lib in linked:
#print(lib)
# Check if the blend file is actually linked
#Print the file path of the linked blend file
if 'Rigging' in lib.filepath:
print("Linked blend file:", lib.filepath)
filepath = lib.filepath
resolved_path = resolvePath(scene_path,lib.filepath)
if resolved_path:
print('[RESOLVED]: '+resolved_path[0])
latest = getLatest(resolved_path[0],resolved_path[1])
print('[latets]: '+latest[0])
if latest[1]:
up_version = update(lib.filepath,latest[0])
lib.filepath = up_version #!!!!!!!!!!!!!!!!!!!!!!
print('\n\t>>>>>[UPDATE]: '+up_version)
updated.append('>: '+latest[0])
# Get the collections from this library
with bpy.data.libraries.load(filepath) as (data_from, data_to):
# get the collections from the linked library
collections = data_from.collections
# Loop through the collections and print their names
for col in collections:
print(" ", col)
updated = list(set(updated))
#Shows a message box with a specific message
if updated:
ShowMessageBox(updated,"--UPDATIN_ASSETS--", "PLUS")
else:
updated = ["","ALL_UPTO DATE"]
ShowMessageBox( updated,"--UPDATING_ASSETS--")
else:
ShowMessageBox([],' no assets linked', "ERROR")
bpy.context.view_layer.update()
#updateAssets()
Maybe it doesn't work fine is because I only look at rigging paths but sometimes last rig has not last model so I needed to update just rigging package, but was hoping for correct model.