@needle-tools/gltf-build-pipeline 2.15.0-next.ca2fe5b → 2.15.0-next.fd1fff4
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/dist/cache/cache.js
CHANGED
|
@@ -191,8 +191,6 @@ export function getHash(property, level = 0) {
|
|
|
191
191
|
if (property instanceof ExtensibleProperty) {
|
|
192
192
|
const extensions = property.listExtensions();
|
|
193
193
|
const extras = property.getExtras();
|
|
194
|
-
// const slots = listTextureSlots(doc, texture);
|
|
195
|
-
// const channels = getTextureChannelMask(doc, texture);
|
|
196
194
|
hash += hashObject({
|
|
197
195
|
extensions,
|
|
198
196
|
extras,
|
|
@@ -269,38 +267,44 @@ function hashObject(obj, depth = 0) {
|
|
|
269
267
|
return hashString(String(obj));
|
|
270
268
|
}
|
|
271
269
|
try {
|
|
272
|
-
const
|
|
270
|
+
const seen = new WeakSet();
|
|
271
|
+
const str = JSON.stringify(obj, (_key, value) => {
|
|
272
|
+
if (typeof value === 'object' && value !== null) {
|
|
273
|
+
if (seen.has(value))
|
|
274
|
+
return undefined;
|
|
275
|
+
seen.add(value);
|
|
276
|
+
}
|
|
277
|
+
if (typeof value === 'function')
|
|
278
|
+
return undefined;
|
|
279
|
+
return value;
|
|
280
|
+
});
|
|
273
281
|
return hashString(str);
|
|
274
282
|
}
|
|
275
283
|
catch (err) {
|
|
276
284
|
console.warn("WARN: [Cache] error during hashing of object:\n" + err);
|
|
277
285
|
if (debugLogs)
|
|
278
286
|
debugger;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let fallbackHashj = 0;
|
|
282
|
-
if (typeof obj === 'object') {
|
|
283
|
-
if (obj === null)
|
|
284
|
-
return 0;
|
|
287
|
+
let fallbackHash = 0;
|
|
288
|
+
if (typeof obj === 'object' && obj !== null) {
|
|
285
289
|
for (const key in obj) {
|
|
286
290
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
287
291
|
const value = obj[key];
|
|
288
|
-
|
|
289
|
-
if (typeof value === 'object') {
|
|
292
|
+
fallbackHash += hashString(key);
|
|
293
|
+
if (typeof value === 'object' && value !== null) {
|
|
290
294
|
if (depth > 10) {
|
|
291
|
-
|
|
295
|
+
fallbackHash += hashString("[object]");
|
|
292
296
|
}
|
|
293
297
|
else {
|
|
294
|
-
|
|
298
|
+
fallbackHash += hashObject(value, depth + 1);
|
|
295
299
|
}
|
|
296
300
|
}
|
|
297
301
|
else {
|
|
298
|
-
|
|
302
|
+
fallbackHash += hashString(String(value));
|
|
299
303
|
}
|
|
300
304
|
}
|
|
301
305
|
}
|
|
302
306
|
}
|
|
303
|
-
return
|
|
307
|
+
return fallbackHash;
|
|
304
308
|
}
|
|
305
309
|
}
|
|
306
310
|
function hashBuffer(buffer, offset, length) {
|
|
@@ -76,10 +76,9 @@ export class NeedleToktxContext {
|
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
this.basisuExtension = document.createExtension(KHRTextureBasisu).setRequired(true);
|
|
79
|
-
const tmpDir = `${tmp.tmpdir}/gltf-transform`;
|
|
79
|
+
const tmpDir = `${tmp.tmpdir}/gltf-transform/${uuid()}`;
|
|
80
80
|
this.cacheDirectory = tmpDir;
|
|
81
|
-
|
|
82
|
-
mkdirSync(tmpDir);
|
|
81
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
83
82
|
this.tmpPathBase = tmpDir + "/" + uuid();
|
|
84
83
|
this.numTextures = document.getRoot().listTextures().length;
|
|
85
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.15.0-next.
|
|
1
|
+
export declare const version = "2.15.0-next.fd1fff4";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.15.0-next.
|
|
1
|
+
export const version = "2.15.0-next.fd1fff4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.15.0-next.
|
|
3
|
+
"version": "2.15.0-next.fd1fff4",
|
|
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",
|