From cda6bd4a926bc466256abdcc72bd88684203e286 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:27:08 +0000 Subject: [PATCH] Fix base icon loading skipping logic in `image_ops` Co-authored-by: rayvy <29858688+rayvy@users.noreply.github.com> --- operators/image_ops.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/operators/image_ops.py b/operators/image_ops.py index 188a700..5748a82 100644 --- a/operators/image_ops.py +++ b/operators/image_ops.py @@ -66,22 +66,22 @@ def execute(self, context): except ValueError: parsed_id = -1 - # If no prefix, we still load it! + # Check if it exists by ID + if parsed_id != -1 and parsed_id in existing_base_ids: + print(f"[IconsDebug] Skipping '{filename}': ID {parsed_id} already loaded.") + continue + + # Check if it exists by Display Name + if any(img.display_name == display_name for img in rzm_images if img.source_type == 'BASE'): + print(f"[IconsDebug] Skipping '{filename}': Display name already exists.") + continue + + # Generate a new ID if needed if parsed_id == -1: - # Check if an image with this name is already in the library to avoid duplicates - if any(img.display_name == display_name for img in rzm_images if img.source_type == 'BASE'): - print(f"[IconsDebug] Skipping '{filename}': Display name already exists.") - continue - - # Generate a new ID from ..core.utils import get_next_image_id parsed_id = get_next_image_id(rzm_images) print(f"[IconsDebug] Auto-generated ID {parsed_id} for '{display_name}'") - if parsed_id in existing_base_ids: - print(f"[IconsDebug] Skipping '{filename}': ID {parsed_id} already loaded.") - continue - try: filepath = os.path.join(assets_dir, filename) bl_image = bpy.data.images.load(filepath) @@ -96,7 +96,8 @@ def execute(self, context): existing_base_ids.add(parsed_id) print(f"[IconsDebug] Successfully loaded: {filename} as ID {parsed_id}") except Exception as e: - print(f"[IconsDebug] Error loading icon {filename}: {e}") + import traceback + print(f"[IconsDebug] Error loading icon {filename}: {e}\n{traceback.format_exc()}") self.report({'INFO'}, f"Loaded {loaded_count} icons from {len(scan_dirs)} source(s).") return {'FINISHED'}