@needle-tools/gltf-build-pipeline 2.2.0-alpha.2 → 2.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -5
- package/dist/cli/index.js +21 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
## [2.2.0-alpha.2] - 2023-06-06
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
8
|
+
- add: CLI `--progressive` option to `transform` command (default is true)
|
|
9
|
+
- add: CLI `--compress` option to `transform` command (default is true)
|
|
10
|
+
- add: config `meshes: { lods: boolean }` option
|
|
11
|
+
- remove: CLI "compress" command
|
|
12
|
+
- change: enable texture LODs by default
|
|
13
|
+
- fix: `--config` path can now point to a directory or a `needle.config.json` file as well
|
|
13
14
|
|
|
14
15
|
## [2.1.0-alpha.6] - 2023-06-04
|
|
15
16
|
- fix: errors when invoking npm scripts caused by the cli program
|
package/dist/cli/index.js
CHANGED
|
@@ -32,6 +32,7 @@ Each version will be compressed and written to the output directory.
|
|
|
32
32
|
`)
|
|
33
33
|
.argument('<input>', "The input glTF, GLB or VRM file that should be compressed OR a directory that contains files to be compressed")
|
|
34
34
|
// .argument('<output>', "The output file. If not provided, the input file will be overwritten.", { default: "" })
|
|
35
|
+
.option("--compress", `When enabled files will be compressed`, { validator: program.BOOLEAN, default: true })
|
|
35
36
|
.option("--progressive", `When enabled files will processed to be progressively loaded`, { validator: program.BOOLEAN, default: true })
|
|
36
37
|
.option("--usecase <usecase>", `The usecase for the compression. This will set the compression settings. Possible options: [${UsecaseOptions.join(", ")}]`, { validator: program.STRING })
|
|
37
38
|
.option("--config <config>", "The path to a JSON file containing the compression settings. This can also be a needle.config.json file with a \"compression\" object or usecase string.", { validator: program.STRING })
|
|
@@ -39,6 +40,10 @@ Each version will be compressed and written to the output directory.
|
|
|
39
40
|
.option("--cache", "Use \"--cache False\" to disable caching.\nWhen caching is enabled then previously processed files will be detected and loaded from disc cache instead of being processed again if settings or the file contents have not changed.", { validator: program.BOOLEAN, default: true })
|
|
40
41
|
.option("--debug", "Enable for more verbose outout with \"--debug True\"", { validator: program.BOOLEAN, default: false })
|
|
41
42
|
.action(async ({ logger, args, options }) => {
|
|
43
|
+
if (options.compress === false && options.progressive === false) {
|
|
44
|
+
logger.error("You need to enable at least one of the options: --compress or --progressive");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
42
47
|
logger.info("Transforming glTF file: " + args.input);
|
|
43
48
|
const stats = {
|
|
44
49
|
startTime: Date.now(),
|
|
@@ -83,23 +88,25 @@ Each version will be compressed and written to the output directory.
|
|
|
83
88
|
process.exit(ERROR_CODES.PROGRESSIVE_FAILED);
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
if (options.compress === true) {
|
|
92
|
+
const opts = {
|
|
93
|
+
config,
|
|
94
|
+
stats,
|
|
95
|
+
packedFiles: set,
|
|
96
|
+
debug,
|
|
97
|
+
useCache,
|
|
98
|
+
logger: logger,
|
|
99
|
+
file_stats,
|
|
100
|
+
};
|
|
101
|
+
for (const res of progressive_results) {
|
|
102
|
+
if (await packGLTF(res, res, opts) === false) {
|
|
103
|
+
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (await packGLTF(file, file, opts) === false) {
|
|
97
107
|
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
|
-
if (await packGLTF(file, file, opts) === false) {
|
|
101
|
-
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
102
|
-
}
|
|
103
110
|
});
|
|
104
111
|
printStats(stats, logger, config);
|
|
105
112
|
if (options.stats) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.3",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|