MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / handleFilterChange

Function handleFilterChange

renderer.js:12490–12508  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12488 } catch (embeddedError) {
12489 console.error(`Error extracting embedded image from 3MF: ${model.filePath}`, embeddedError);
12490 }
12491 }
12492
12493 // 2. If no embedded thumbnail, try 3D rendering
12494 if (!thumbnail) {
12495 console.log(`[DEBUG] generateThumbnailsForModels: Rendering 3D model for ${model.filePath}`);
12496 try {
12497 thumbnail = await generateThumbnail(model.filePath);
12498 } catch (renderError) {
12499 console.error(`Error generating 3D thumbnail for ${model.filePath}:`, renderError);
12500 }
12501 }
12502
12503 // 3. Validate and fallback to default if necessary (STL/3MF only reach here)
12504 if (!thumbnail || typeof thumbnail !== 'string' || !thumbnail.startsWith('data:image') || isFailurePlaceholderThumbnail(thumbnail)) {
12505 thumbnail = '3d.png';
12506 }
12507
12508 // 4. Save real renders only — never lock in failure placeholders
12509 if (!saved3mfEmbedsViaBatch && thumbnail !== '3d.png') {
12510 await window.electron.saveThumbnail(model.filePath, thumbnail);
12511 } else if (!saved3mfEmbedsViaBatch) {

Callers 1

renderer.jsFile · 0.85

Calls 3

displayModelsFunction · 0.85

Tested by

no test coverage detected