# OneDrive Thumbnail Override Fix

## 🎯 Problem Description

OneDrive's on-demand sync overrides locally-generated thumbnails with generic file icons when cloud services don't support specific file types (like `.blend`, `.psd`, etc.). This prevents you from seeing your custom thumbnails for unsupported formats.

## 🔍 Root Cause

1. **OneDrive Files On-Demand** uses cloud thumbnail providers that take precedence over local thumbnails
2. When OneDrive doesn't support a file type, it shows a generic file icon
3. This **overrides** your custom locally-generated thumbnails, even for files you've created beautiful previews for

## ✅ Solution Overview

This fix disables OneDrive's cloud thumbnail providers and restores priority to your local thumbnails while keeping OneDrive sync functionality intact.

## 🛠️ How to Use

### Method 1: Automated PowerShell Script (Recommended)

1. **Run the batch file:**
   ```cmd
   autoThumbs.bat
   ```

2. **Select option 4:** "Fix OneDrive thumbnail override"

3. **Follow prompts** - the script will run as administrator and fix the issue

### Method 2: Manual Registry Fix

1. **Run as Administrator:**
   ```cmd
   regedit
   ```

2. **Import the registry file:**
   ```cmd
   disable_onedrive_thumbnails.reg
   ```

3. **Restart Windows Explorer**

### Method 3: PowerShell Direct

Run PowerShell as Administrator and execute:
```powershell
.\fix_thumbnail_override.ps1
```

## 📋 What Gets Changed

### ✅ Registry Modifications

1. **OneDrive Policies:**
   - `HKCU\SOFTWARE\Policies\Microsoft\OneDrive` → `DisableCloudThumbnails = 1`
   - `HKLM\SOFTWARE\Policies\Microsoft\OneDrive` → `DisableCloudThumbnails = 1`

2. **Cloud Thumbnail Provider Removal:**
   - Removes: `HKLM\...\ThumbnailProviders\{E357FCCD-A995-4576-B01F-234630154E96}`

3. **Local Thumbnail Preferences:**
   - `HKCU\...\Explorer\Advanced` → `UseLocalThumbnailProvider = 1`
   - `HKCU\...\Explorer\Advanced` → `IconsOnly = 0`

4. **OneDrive Shell Overlays Disabled:**
   - Removes OneDrive1-7 shell icon overlays that can interfere

5. **Thumbnail Cache Protection:**
   - Prevents Windows from auto-deleting thumbnail cache
   - `HKLM\...\VolumeCaches\Thumbnail Cache` → `Autorun = 0`

### 🔄 Process Changes

1. **Explorer Process Restart** - Clears cached thumbnail providers
2. **Thumbnail Cache Regeneration** - Forces fresh thumbnail creation
3. **Local Provider Priority** - Your custom thumbnails now take precedence

## ⚠️ Important Notes

### ✅ What Still Works
- ✅ OneDrive sync functionality (unchanged)
- ✅ File access and collaboration
- ✅ Cloud storage features
- ✅ Local thumbnail generation

### ❌ What Changes
- ❌ OneDrive won't override your custom thumbnails anymore
- ❌ Cloud-based thumbnail generation is disabled
- ❌ Some OneDrive visual overlays may be reduced

## 🔧 Troubleshooting

### If thumbnails still don't appear:

1. **Clear thumbnail cache manually:**
   ```cmd
   del /f /s /q "%LocalAppData%\Microsoft\Windows\Explorer\thumbcache_*.db"
   ```

2. **Restart Windows Explorer:**
   ```cmd
   taskkill /f /im explorer.exe && start explorer.exe
   ```

3. **Regenerate thumbnails:**
   ```cmd
   python psthumbgen.py --directory "Your\Directory\Path"
   ```

### If you want to revert changes:

Use the restore registry file:
```cmd
restore_onedrive_thumbnails.reg
```

## 🎉 Expected Results

After applying this fix:

1. **Your custom thumbnails** (like for `.blend` files) will display properly
2. **OneDrive sync continues** working normally
3. **File access remains** unchanged
4. **Local thumbnail generation** takes priority over cloud providers

## 📝 Technical Details

### Cloud Thumbnail Provider GUID
The key provider that overrides local thumbnails:
- `{E357FCCD-A995-4576-B01F-234630154E96}` - Windows Cloud Files Thumbnail Provider

### OneDrive Shell Overlays
These overlays can interfere with thumbnail display:
- `OneDrive1` through `OneDrive7` in `ShellIconOverlayIdentifiers`

### Registry Locations
```
# User-level policies
HKCU\SOFTWARE\Policies\Microsoft\OneDrive

# Machine-level policies  
HKLM\SOFTWARE\Policies\Microsoft\OneDrive

# Thumbnail providers
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ThumbnailProviders

# Explorer settings
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
```

## 🔄 Maintenance

- **Reboot required** for full effect
- **May need to reapply** after major Windows updates
- **Compatible** with Windows 10/11 and current OneDrive versions

---

**🎨 Now you can enjoy your beautiful custom thumbnails without OneDrive interference!** 