Преглед изворни кода

Add types ref to export in package.json for packages.

master
Palash Bansal пре 1 година
родитељ
комит
8be3756c7d
No account linked to committer's email address

+ 2
- 1
plugins/blend-importer/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-blend-importer",
"description": "Basic importer for .blend file",
"version": "0.0.3",
"version": "0.0.4",
"devDependencies": {
},
"dependencies": {
@@ -9,6 +9,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 2
- 1
plugins/blueprintjs/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-blueprintjs",
"description": "Blueprint.js UI Plugin for ThreePipe",
"version": "0.3.2",
"version": "0.3.3",
"devDependencies": {
"uiconfig-blueprint": "0.1.0-dev.5",
"uiconfig.js": "^0.1.3"
@@ -11,6 +11,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 2
- 1
plugins/configurator/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-configurator",
"description": "Plugins for creating material and object configurators in threepipe.",
"version": "0.1.2",
"version": "0.1.3",
"devDependencies": {
},
"dependencies": {
@@ -23,6 +23,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 2
- 1
plugins/extra-importers/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugins-extra-importers",
"description": "Extra Threepipe plugins for importing several file types.",
"version": "0.2.2",
"version": "0.2.3",
"devDependencies": {
},
"dependencies": {
@@ -24,6 +24,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./dist/": {

+ 2
- 1
plugins/gltf-transform/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-gltf-transform",
"description": "Utility plugins for threepipe using gltf-transform to optimize/compress glTF files.",
"version": "0.1.2",
"version": "0.1.3",
"devDependencies": {
"@gltf-transform/core": "3.2.1",
"@gltf-transform/extensions": "3.2.1"
@@ -11,6 +11,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 37
- 30
plugins/gltf-transform/src/GLTFDracoExporter.ts Прегледај датотеку

@@ -67,7 +67,7 @@ export class GLTFDracoExporter extends GLTFExporter2 implements IExportParser {

}

async parseAsync(obj: any, {compress = false, dracoOptions, ...options}: {compress: boolean, dracoOptions?: EncoderOptions} & GLTFExporter2Options): Promise<Blob> {
async parseAsync(obj: any, {compress = false, dracoOptions, ...options}: {compress: boolean, dracoOptions?: EncoderOptions} & GLTFExporter2Options, throwOnError = false): Promise<Blob> {
if (!this.loader) {
console.error('GLTFDracoExporter: No DRACOLoader2 instance provided')
return super.parseAsync(obj, options)
@@ -86,42 +86,49 @@ export class GLTFDracoExporter extends GLTFExporter2 implements IExportParser {
const uncompressedBlob = await super.parseAsync(uncompressed, ops)
if (!compress) return uncompressedBlob

if (!uncompressed) throw new Error('GLTFDracoExporter: gltf is null')
try {
if (!uncompressed) throw new Error('GLTFDracoExporter: gltf is null')

let gltf = uncompressed
let gltf = uncompressed

const bytes = (gltf as ArrayBuffer).byteLength || Infinity
const bytes = (gltf as ArrayBuffer).byteLength || Infinity

const iDocument = await (typeof gltf === 'object' && !(gltf as any).byteLength ? this._io.readJSON({
json: gltf as GLTF.IGLTF,
resources: {},
}) : this._io.readBinary(new Uint8Array(gltf as ArrayBuffer)))
const iDocument = await (typeof gltf === 'object' && !(gltf as any).byteLength ? this._io.readJSON({
json: gltf as GLTF.IGLTF,
resources: {},
}) : this._io.readBinary(new Uint8Array(gltf as ArrayBuffer)))

// iDocument.createExtension(GLTFViewerConfigExtensionGP)
iDocument.createExtension(KHRDracoMeshCompression)
.setRequired(true)
.setEncoderOptions({...this._encoderOptions, ...dracoOptions ?? {}})
// iDocument.createExtension(GLTFViewerConfigExtensionGP)
iDocument.createExtension(KHRDracoMeshCompression)
.setRequired(true)
.setEncoderOptions({...this._encoderOptions, ...dracoOptions ?? {}})

if (ops.exportExt === 'glb') {
gltf = await this._io.writeBinary(iDocument)
if (isFinite(bytes)) {
console.log('DRACO Compression ratio: ' + ((gltf as ArrayBuffer).byteLength / bytes).toFixed(5))
}
} else {
const jDoc = await this._io.writeJSON(iDocument)
gltf = jDoc.json
if (Object.values(jDoc.resources).filter(v => v).length > 0) {
console.warn('DRACOExporter: extra resources in resources not supported properly')
;(gltf as any).resources = jDoc.resources
if (ops.exportExt === 'glb') {
gltf = await this._io.writeBinary(iDocument)
if (isFinite(bytes)) {
console.log('DRACO Compression ratio: ' + ((gltf as ArrayBuffer).byteLength / bytes).toFixed(5))
}
} else {
const jDoc = await this._io.writeJSON(iDocument)
gltf = jDoc.json
if (Object.values(jDoc.resources).filter(v => v).length > 0) {
console.warn('DRACOExporter: extra resources in resources not supported properly')
;(gltf as any).resources = jDoc.resources
}
}
}

gltf.__isGLTFOutput = true
const blob = await super.parseAsync(gltf, ops) as any // this will just convert it to blob because __isGLTFOutput is set (checked in GLTFExporter2)
if (!blob) throw new Error('GLTFDracoExporter: blob is null')
blob.ext = 'glb'
;(blob as any).__uncompressed = uncompressedBlob
return blob
gltf.__isGLTFOutput = true
const blob = await super.parseAsync(gltf, ops) as any // this will just convert it to blob because __isGLTFOutput is set (checked in GLTFExporter2)
if (!blob) throw new Error('GLTFDracoExporter: blob is null')
blob.ext = 'glb'
;(blob as any).__uncompressed = uncompressedBlob
return blob
} catch (e) {
if (throwOnError) throw e
console.error('Unable to compress glb with DRACO extension, fallback to uncompressed')
console.error(e)
return uncompressedBlob
}
}

addExtension(extension: typeof Extension): this {

+ 2
- 1
plugins/network/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-network",
"description": "Network/AWS/Cloud related plugins for threepipe",
"version": "0.1.1",
"version": "0.1.2",
"devDependencies": {
},
"dependencies": {
@@ -10,6 +10,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 1
- 0
plugins/plugin-template-rollup/package.json Прегледај датотеку

@@ -10,6 +10,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 1
- 0
plugins/plugin-template-vite/package.json Прегледај датотеку

@@ -26,6 +26,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

+ 2
- 1
plugins/svg-renderer/package.json Прегледај датотеку

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-svg-renderer",
"description": "Plugins for SVG Rendering of 3d objects for Threepipe",
"version": "0.2.2",
"version": "0.2.3",
"devDependencies": {
"@svgdotjs/svg.js": "^3.2.0",
"@svgdotjs/svg.topath.js": "^2.0.3",
@@ -18,6 +18,7 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},

Loading…
Откажи
Сачувај