diff --git a/.specstory/history/2025-08-20_22-43Z-creating-a-blender-extension-for-asset-replacement.md b/.specstory/history/2025-08-20_22-43Z-creating-a-blender-extension-for-asset-replacement.md index b7a9686..a3e54d5 100644 --- a/.specstory/history/2025-08-20_22-43Z-creating-a-blender-extension-for-asset-replacement.md +++ b/.specstory/history/2025-08-20_22-43Z-creating-a-blender-extension-for-asset-replacement.md @@ -2601,3 +2601,128 @@ Try enabling the addon again - it should work now! --- +_**User**_ + +Let's not list the linked datablocks; there will almost universally be far too many to be reasonable to list. + +--- + +_**Assistant**_ + +Good point! Having hundreds of linked datablocks listed would make the UI cluttered and unusable. Let me remove the linked datablocks display and simplify the library listing: + + +--- + +Model failed to call the tool with correct arguments. + +--- + +
Edit file: ui.py + +undefined + +**Chunk 1** +Lines added: 1, lines removed: 6 + +```diff +@@ -68,10 +68,5 @@ + open_op.filepath = lib_item.filepath + +- # Draw linked datablocks underneath +- if lib_item.linked_datablocks: +- col = sub_box.column(align=True) +- col.label(text=" Linked Datablocks:") +- for db_item in lib_item.linked_datablocks: +- col.label(text=f" - {db_item.name} ({db_item.type})") ++ + + # Asset replacement section +``` + +
+ +--- + +Now let me also simplify the operators to not collect the datablock information since we're not displaying it: + + +--- + +
Edit file: operators.py + +undefined + +**Chunk 1** +Lines added: 1, lines removed: 30 + +```diff +@@ -167,34 +167,5 @@ + lib_item.is_missing = is_file_missing(filepath) + +- # Add linked datablocks info +- for obj in bpy.data.objects: +- if hasattr(obj, 'library') and obj.library and obj.library.filepath == filepath: +- db_item = lib_item.linked_datablocks.add() +- db_item.name = obj.name +- db_item.type = "OBJECT" +- +- if obj.data and hasattr(obj.data, 'library') and obj.data.library and obj.data.library.filepath == filepath: +- db_item = lib_item.linked_datablocks.add() +- db_item.name = f"{obj.name} ({type(obj.data).__name__})" +- db_item.type = "DATA" +- +- # Check other data types +- for armature in bpy.data.armatures: +- if hasattr(armature, 'library') and armature.library and armature.library.filepath == filepath: +- db_item = lib_item.linked_datablocks.add() +- db_item.name = armature.name +- db_item.type = "ARMATURE" +- +- for mesh in bpy.data.meshes: +- if hasattr(mesh, 'library') and mesh.library and mesh.library.filepath == filepath: +- db_item = lib_item.linked_datablocks.add() +- db_item.name = mesh.name +- db_item.type = "MESH" +- +- for material in bpy.data.materials: +- if hasattr(material, 'library') and material.library and material.library.filepath == filepath: +- db_item = lib_item.linked_datablocks.add() +- db_item.name = material.name +- db_item.type = "MATERIAL" ++ + + # Show detailed info +``` + +
+ +--- + +Perfect! Now the UI is much cleaner and more focused. The linked libraries section will show: + +## ✅ **Simplified Library Display:** + +1. **Library Name** - The filename of the .blend file +2. **File Path** - Full path to the library file +3. **Missing Status** - Red "MISSING" label with ERROR icon for broken links +4. **Open Button** - Direct access to open each library file +5. **Clean Layout** - No overwhelming lists of individual datablocks + +## �� **Benefits of This Approach:** + +- **Faster Scanning** - No need to collect hundreds of datablock names +- **Cleaner UI** - Focus on what matters: library files and their status +- **Better Performance** - Less memory usage and faster UI updates +- **Easier Navigation** - Users can quickly see which libraries are missing and open them + +The extension now provides a clean, professional interface that shows you exactly what you need to know: +- How many libraries are linked +- Which ones are missing (highlighted in red) +- Easy access to open any library file +- No overwhelming detail that clutters the interface + +This is much more practical for real-world use where scenes can have hundreds or thousands of linked objects! + +--- + diff --git a/operators.py b/operators.py index 1926136..ae8e740 100644 --- a/operators.py +++ b/operators.py @@ -166,36 +166,7 @@ class DYNAMICLINK_OT_scan_linked_assets(Operator): lib_item.name = get_library_name(filepath) lib_item.is_missing = is_file_missing(filepath) - # Add linked datablocks info - for obj in bpy.data.objects: - if hasattr(obj, 'library') and obj.library and obj.library.filepath == filepath: - db_item = lib_item.linked_datablocks.add() - db_item.name = obj.name - db_item.type = "OBJECT" - - if obj.data and hasattr(obj.data, 'library') and obj.data.library and obj.data.library.filepath == filepath: - db_item = lib_item.linked_datablocks.add() - db_item.name = f"{obj.name} ({type(obj.data).__name__})" - db_item.type = "DATA" - - # Check other data types - for armature in bpy.data.armatures: - if hasattr(armature, 'library') and armature.library and armature.library.filepath == filepath: - db_item = lib_item.linked_datablocks.add() - db_item.name = armature.name - db_item.type = "ARMATURE" - - for mesh in bpy.data.meshes: - if hasattr(mesh, 'library') and mesh.library and mesh.library.filepath == filepath: - db_item = lib_item.linked_datablocks.add() - db_item.name = mesh.name - db_item.type = "MESH" - - for material in bpy.data.materials: - if hasattr(material, 'library') and material.library and material.library.filepath == filepath: - db_item = lib_item.linked_datablocks.add() - db_item.name = material.name - db_item.type = "MATERIAL" + # Show detailed info self.report({'INFO'}, f"Found {len(all_libraries)} unique linked library files") diff --git a/ui.py b/ui.py index 8e64f22..228206c 100644 --- a/ui.py +++ b/ui.py @@ -67,12 +67,7 @@ class DYNAMICLINK_PT_main_panel(Panel): open_op = row.operator("dynamiclink.open_linked_file", text="Open", icon='FILE_BLEND') open_op.filepath = lib_item.filepath - # Draw linked datablocks underneath - if lib_item.linked_datablocks: - col = sub_box.column(align=True) - col.label(text=" Linked Datablocks:") - for db_item in lib_item.linked_datablocks: - col.label(text=f" - {db_item.name} ({db_item.type})") + # Asset replacement section box = layout.box()