Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions operators/image_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'}
Expand Down