Removes properties from the file if they are not referenced by a Scene. Commonly helpful for cleaning up after other operations, e.g. allowing a node to be detached and any unused meshes, materials, or other resources to be removed automatically.
Example:
import { PropertyType } from '@gltf-transform/core'; import { prune } from '@gltf-transform/functions'; document.getRoot().listMaterials(); // → [Material, Material] await document.transform( prune({ propertyTypes: [PropertyType.MATERIAL], keepExtras: true }) ); document.getRoot().listMaterials(); // → [Material]
By default, pruning will aggressively remove most unused resources. Use PruneOptions to limit what is considered for pruning.
Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.
Removes properties from the file if they are not referenced by a Scene. Commonly helpful for cleaning up after other operations, e.g. allowing a node to be detached and any unused meshes, materials, or other resources to be removed automatically.
Example:
import { PropertyType } from '@gltf-transform/core'; import { prune } from '@gltf-transform/functions'; document.getRoot().listMaterials(); // → [Material, Material] await document.transform( prune({ propertyTypes: [PropertyType.MATERIAL], keepExtras: true }) ); document.getRoot().listMaterials(); // → [Material]
By default, pruning will aggressively remove most unused resources. Use PruneOptions to limit what is considered for pruning.