2026-02-16

This commit is contained in:
2026-03-17 15:25:32 -06:00
parent d5dd373de0
commit 60100fbab2
560 changed files with 33397 additions and 20776 deletions
@@ -59,8 +59,23 @@ def get_missing(data):
# Blender 4.2/4.5: Both use 'packed_file' (singular)
is_packed = bool(datablock.packed_file) if hasattr(datablock, 'packed_file') else False
# Check if file exists (with special handling for UDIM images)
file_exists = False
if abspath and isinstance(datablock, bpy.types.Image) and '<UDIM>' in abspath:
# UDIM image: check if any UDIM tile files exist
# UDIM tiles are numbered 1001, 1002, etc. (standard range is 1001-1099)
# Check a reasonable range of UDIM tiles
for udim_tile in range(1001, 1100): # Check tiles 1001-1099
udim_path = abspath.replace('<UDIM>', str(udim_tile))
if os.path.isfile(udim_path):
file_exists = True
break
elif abspath:
# Regular file: check if it exists
file_exists = os.path.isfile(abspath)
# if data-block is not packed and has an invalid filepath
if not is_packed and not os.path.isfile(abspath):
if not is_packed and not file_exists:
# if data-block is not in our do not flag list
# append it to the missing data list
@@ -86,3 +101,54 @@ def images():
def libraries():
# returns a list of keys of libraries with a non-existent filepath
return get_missing(bpy.data.libraries)
def get_missing_library_info(library_key):
"""
Get information about a missing library for matching and validation.
Returns:
dict with keys:
- 'filepath': original filepath
- 'filename': basename for matching
- 'linked_data_blocks': list of data-block names linked from this library
"""
if library_key not in bpy.data.libraries:
return None
library = bpy.data.libraries[library_key]
filepath = library.filepath
filename = os.path.basename(bpy.path.abspath(filepath)) if filepath else ""
# Get linked data-block names (collections, objects, materials, etc.)
linked_data_blocks = []
try:
# Collections
for collection in bpy.data.collections:
if collection.library == library:
linked_data_blocks.append(('COLLECTION', collection.name))
# Objects
for obj in bpy.data.objects:
if obj.library == library:
linked_data_blocks.append(('OBJECT', obj.name))
# Materials
for material in bpy.data.materials:
if material.library == library:
linked_data_blocks.append(('MATERIAL', material.name))
# Meshes
for mesh in bpy.data.meshes:
if mesh.library == library:
linked_data_blocks.append(('MESH', mesh.name))
# Armatures
for armature in bpy.data.armatures:
if armature.library == library:
linked_data_blocks.append(('ARMATURE', armature.name))
except Exception:
# If we can't access library data, return what we have
pass
return {
'filepath': filepath,
'filename': filename,
'linked_data_blocks': linked_data_blocks
}