@gltf-transform/functions
Advanced tools
Comparing version 4.0.2 to 4.0.4
@@ -11,2 +11,8 @@ import { Transform } from '@gltf-transform/core'; | ||
/** | ||
* Whether to keep unused vertex attributes, such as UVs without an assigned | ||
* texture. If kept, unused UV coordinates may prevent palette texture | ||
* creation. Default: false. | ||
*/ | ||
keepAttributes?: boolean; | ||
/** | ||
* Whether to perform cleanup steps after completing the operation. Recommended, and enabled by | ||
@@ -13,0 +19,0 @@ * default. Cleanup removes temporary resources created during the operation, but may also remove |
@@ -25,5 +25,13 @@ import { Transform } from '@gltf-transform/core'; | ||
* ```javascript | ||
* import { PropertyType } from '@gltf-transform/core'; | ||
* import { prune } from '@gltf-transform/functions'; | ||
* | ||
* document.getRoot().listMaterials(); // → [Material, Material] | ||
* | ||
* await document.transform(prune()); | ||
* await document.transform( | ||
* prune({ | ||
* propertyTypes: [PropertyType.MATERIAL], | ||
* keepExtras: true | ||
* }) | ||
* ); | ||
* | ||
@@ -33,4 +41,4 @@ * document.getRoot().listMaterials(); // → [Material] | ||
* | ||
* Use {@link PruneOptions} to control what content should be pruned. For example, you can preserve | ||
* empty objects in the scene hierarchy using the option `keepLeaves`. | ||
* By default, pruning will aggressively remove most unused resources. Use | ||
* {@link PruneOptions} to limit what is considered for pruning. | ||
* | ||
@@ -37,0 +45,0 @@ * @category Transforms |
{ | ||
"name": "@gltf-transform/functions", | ||
"version": "4.0.2", | ||
"version": "4.0.4", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -38,4 +38,4 @@ "homepage": "https://gltf-transform.dev/functions.html", | ||
"dependencies": { | ||
"@gltf-transform/core": "^4.0.2", | ||
"@gltf-transform/extensions": "^4.0.2", | ||
"@gltf-transform/core": "^4.0.4", | ||
"@gltf-transform/extensions": "^4.0.4", | ||
"ktx-parse": "^0.7.0", | ||
@@ -57,3 +57,3 @@ "ndarray": "^1.0.19", | ||
}, | ||
"gitHead": "1bd66c6c1b2706a3c130f08a0a8e8c689add1e96" | ||
"gitHead": "5f0e85f208498ad458eb7b12a99c1bea4dc0f27b" | ||
} |
@@ -30,2 +30,8 @@ import { | ||
/** | ||
* Whether to keep unused vertex attributes, such as UVs without an assigned | ||
* texture. If kept, unused UV coordinates may prevent palette texture | ||
* creation. Default: false. | ||
*/ | ||
keepAttributes?: boolean; | ||
/** | ||
* Whether to perform cleanup steps after completing the operation. Recommended, and enabled by | ||
@@ -44,2 +50,3 @@ * default. Cleanup removes temporary resources created during the operation, but may also remove | ||
min: 5, | ||
keepAttributes: false, | ||
cleanup: true, | ||
@@ -93,10 +100,12 @@ }; | ||
// Find and remove unused TEXCOORD_n attributes. | ||
await document.transform( | ||
prune({ | ||
propertyTypes: [PropertyType.ACCESSOR], | ||
keepAttributes: false, | ||
keepIndices: true, | ||
keepLeaves: true, | ||
}), | ||
); | ||
if (!options.keepAttributes) { | ||
await document.transform( | ||
prune({ | ||
propertyTypes: [PropertyType.ACCESSOR], | ||
keepAttributes: false, | ||
keepIndices: true, | ||
keepLeaves: true, | ||
}), | ||
); | ||
} | ||
@@ -103,0 +112,0 @@ const prims = new Set<Primitive>(); |
@@ -79,5 +79,13 @@ import { | ||
* ```javascript | ||
* import { PropertyType } from '@gltf-transform/core'; | ||
* import { prune } from '@gltf-transform/functions'; | ||
* | ||
* document.getRoot().listMaterials(); // → [Material, Material] | ||
* | ||
* await document.transform(prune()); | ||
* await document.transform( | ||
* prune({ | ||
* propertyTypes: [PropertyType.MATERIAL], | ||
* keepExtras: true | ||
* }) | ||
* ); | ||
* | ||
@@ -87,4 +95,4 @@ * document.getRoot().listMaterials(); // → [Material] | ||
* | ||
* Use {@link PruneOptions} to control what content should be pruned. For example, you can preserve | ||
* empty objects in the scene hierarchy using the option `keepLeaves`. | ||
* By default, pruning will aggressively remove most unused resources. Use | ||
* {@link PruneOptions} to limit what is considered for pruning. | ||
* | ||
@@ -91,0 +99,0 @@ * @category Transforms |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2143179
102
22034