# Imeshh - Blender Add-on

1. User authentication process begins with login.
2. Upon successful login, an authentication token is generated.
3. Using this token, the system retrieves categories and products via API calls (downloading all pages and thumbnails in the background).
4. All API responses are cached locally in JSON files.
5. Products are filtered based on user selections (asset type, category, subcategory) in the UI. This provides fast performance since filtering happens locally without additional API calls.

## HDRI Preview System

The add-on includes an intelligent HDRI preview system that automatically handles large HDRI files:

- **Automatic Preview Generation**: Large HDRI files (above the size limit) are automatically converted to small preview images using Pillow
- **Memory Optimization**: Instead of loading 4K/8K HDRI files directly into Blender's preview system, small optimized thumbnails are generated and cached
- **Background Processing**: Preview generation happens in background threads to avoid blocking the UI
- **Cache Management**: Generated previews are cached for fast subsequent access
- **Size Limit Control**: Users can configure the maximum file size for direct HDRI loading in preferences
- **Fallback System**: If preview generation fails or is in progress, appropriate fallback icons are shown

### Configuration

In Preferences > Preview tab:

- **HDRI Preview Size Limit**: Maximum file size (MB) for direct HDRI loading. Larger files will use generated previews.
- **Cache Management**: View cache statistics and clear cached previews to free disk space.

### Supported HDRI Formats

- .hdr, .hdri, .exr (High Dynamic Range formats)
- .tiff, .tif (High bit-depth formats)
- .jpg, .jpeg, .png (Standard formats)
