Export
Author: Vincenzo Mossuto Creation Date: 30/09/2025
Reviewer: Sara Altomare/Rossana Mazza
What it is
This document describes the scripts in the Export section included in the Spaarkly Scripts add-on for Blender:
- Export component as asset
- Export material as asset
The Export panel provides operators to generate clean, reusable .blend assets from selected objects or materials.
These scripts automate the process of saving, cataloging, and cleaning up data, ensuring that every exported component or material is lightweight, consistent with naming conventions, and ready to be integrated into the Spaarkly production pipeline.
See the Export section for detailed guidelines.
Export component as asset
What it does
This operator exports the selected eyewear component(s) into a new .blend file located in a user-chosen directory.
It handles the saving process, generates asset previews, purges orphan data, and removes unused objects or brushes to keep the exported file clean and light.
It is especially useful for creating standalone assets of mechanical parts like hinges or screws.
Prerequisites
- Only one object should be selected in the 3D Viewport.
- The current Blender file must already be saved.
Steps
- Select the component to be exported.
- For single-object components, just select it.
- For hinges, select the hinge (
HN_*) and the related screws (SR_*).
- Run Export component as asset from the Export panel.
- Choose the target directory from the file browser.
- The operator will:
- Create a temporary export scene.
- Generate preview and asset data.
- Purge orphan data and remove unnecessary elements.
- Save a
.blendfile named after the active component. - Remove any
.blend1backup file.

Troubleshooting
- File not saved → The operator stops if the current file hasn’t been saved.
- Multiple selection not valid → If multiple objects are selected but not a hinge with screws, export is cancelled.
Export material as asset
What it does
This operator exports the active material of the selected object into a clean .blend file.
It marks the material as an asset, generates its preview, assigns it to the correct catalog based on naming prefixes, and removes all unused materials and objects to ensure a lightweight export file.
This tool standardizes the way materials are shared and reused across projects.
Prerequisites
- Exactly one object must be selected in the 3D Viewport.
- The selected object must have a valid active material.
- The current Blender file must already be saved.
Steps
- Select one object with the material you want to export.
- Run Export material as asset from the Export panel.
- Choose the target directory from the file browser.
- The operator will:
- Duplicate the object into a temporary scene.
- Remove all other materials.
- Mark the active material as an asset and generate its preview.
- Assign the material to a catalog (Metals, Dielectric, Lenses, Decals, Transmissive) based on its prefix.
- Delete unused objects, pack resources, and purge orphan data.
- Save a
.blendfile named after the material. - Remove any
.blend1backup file.
Troubleshooting
- No object selected → The operator cancels if no active object is found.
- No active material → If the object doesn’t have a valid material, export is cancelled.
- Missing catalog file → If
blender_assets.cats.txtis not found or accessible, the script cannot assign the material to a catalog. - Unrecognized prefix → If the material’s name doesn’t start with a known prefix (
MT, DE, LN, DC, TR), the material is not assigned to a catalog.