@needle-tools/gltf-build-pipeline 1.4.1-beta.14 → 1.4.1-beta.15
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
CHANGED
|
@@ -4,8 +4,9 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
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
|
-
## [1.4.1-beta.
|
|
7
|
+
## [1.4.1-beta.15] - 2023-04-02
|
|
8
8
|
- fix: issue where discarding all LODs might result in broken mesh due to simplify having modified the original mesh
|
|
9
|
+
- fix: don't produce LODs if GLB/glTF was produced with old generator
|
|
9
10
|
|
|
10
11
|
## [1.4.1-beta.13] - 2023-03-26
|
|
11
12
|
- change: passthrough `NEEDLE_editor` & `NEEDLE_gltf_dependencies` extensions
|
|
@@ -20,5 +20,6 @@ export interface IExtensionWriter {
|
|
|
20
20
|
assignTo?(obj: object): any;
|
|
21
21
|
write(context: WriterContext, prop: IExtensibleProperty): void;
|
|
22
22
|
}
|
|
23
|
+
export declare let currentGenerator: string;
|
|
23
24
|
export declare function createOpaqueExtension(name: string, types: PropertyType | PropertyType[], opts?: Options): IOpaqueExtension;
|
|
24
25
|
export {};
|
|
@@ -4,6 +4,7 @@ const ALL_PROPERTY_TYPES = [];
|
|
|
4
4
|
for (const key in PropertyType) {
|
|
5
5
|
ALL_PROPERTY_TYPES.push(PropertyType[key]);
|
|
6
6
|
}
|
|
7
|
+
export let currentGenerator = "";
|
|
7
8
|
// an opaque extension can be used to pass data through the gltf transform process
|
|
8
9
|
// it should also be able to re-write/fix json pointers after the transformation which might have shuffled them around
|
|
9
10
|
export function createOpaqueExtension(name, types, opts) {
|
|
@@ -18,6 +19,7 @@ export function createOpaqueExtension(name, types, opts) {
|
|
|
18
19
|
// private roots: Array<OpaqueProperty> = [];
|
|
19
20
|
jsonPointerHandler;
|
|
20
21
|
read(context) {
|
|
22
|
+
currentGenerator = context.jsonDoc.json.asset?.generator;
|
|
21
23
|
if (debugLog)
|
|
22
24
|
console.log("READ " + EXTENSION_NAME);
|
|
23
25
|
this.jsonPointerHandler = new JsonPointerHandler(this.document, EXTENSION_NAME);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BufferUtils, Document, NodeIO, PropertyType } from '@gltf-transform/core';
|
|
2
2
|
import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS, listTextureSlots, sparse } from '@gltf-transform/functions';
|
|
3
3
|
import { NEEDLE_PROGRESSIVE_EXTENSION_NAME, NEEDLE_progressive } from "../extensions/NEEDLE_progressive/index.js";
|
|
4
|
-
import { createOpaqueExtension, NEEDLE_compression_texture, NEEDLE_mesh_compression, NEEDLE_progressive_mesh_settings, NEEDLE_progressive_texture_settings, registerExtensions as registerDefaultExtensions } from '../extensions/index.js';
|
|
4
|
+
import { createOpaqueExtension, currentGenerator, NEEDLE_compression_texture, NEEDLE_mesh_compression, NEEDLE_progressive_mesh_settings, NEEDLE_progressive_texture_settings, registerExtensions as registerDefaultExtensions } from '../extensions/index.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { existsSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
|
|
7
7
|
import { addMetaToCache, addToCache, getHash, getKey, tryGetFromCache, tryGetMetaFromCache } from '../cache/index.js';
|
|
@@ -299,6 +299,12 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
299
299
|
// const fileNameWithoutExtension = path.basename(filePath, path.extname(filePath));
|
|
300
300
|
const outputDirectory = directory + "/";
|
|
301
301
|
return createTransform("PROGRESSIVE_MESHES", async (doc, _context) => {
|
|
302
|
+
// this is to ensure we're not creating progressive meshes for engine versions that don't support loading them yet
|
|
303
|
+
// the generator should include the version or the app that produced the GLB too (needle engine repo: 2c00d0e304e205cf9d4ac0499faabb92a706a5c4)
|
|
304
|
+
if (currentGenerator == "Needle Engine") {
|
|
305
|
+
console.log("WARN: Skip creating mesh LODs - Unsupported generator found... Please update your editor integration");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
302
308
|
if (isMeshLOD(filePath)) {
|
|
303
309
|
console.log("Progressive Mesh Transform: skip lod at " + filePath);
|
|
304
310
|
return Promise.resolve();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.4.1-beta.
|
|
3
|
+
"version": "1.4.1-beta.15",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|