8000 real fix for 3MF export by pca006132 · Pull Request #627 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

real fix for 3MF export #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related e 8000 mails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bindings/wasm/examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bindings/wasm/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@gltf-transform/core": "^3.8.0",
"@gltf-transform/extensions": "^3.8.0",
"@gltf-transform/functions": "^3.8.0",
"@jscadui/3mf-export": "^0.4.2",
"@jscadui/3mf-export": "^0.5.0",
"fflate": "^0.8.0",
"gl-matrix": "^3.4.3",
"simple-dropzone": "0.8.3",
Expand All @@ -29,4 +29,4 @@
"vite": "^4.5.0",
"vitest": "^0.31.1"
}
}
}
10 changes: 7 additions & 3 deletions bindings/wasm/examples/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import {Accessor, Animation, Document, mat4, Material, Node, WebIO} from '@gltf-transform/core';
import {KHRMaterialsUnlit, KHRONOS_EXTENSIONS} from '@gltf-transform/extensions';
import {fileForContentTypes, fileForRelThumbnail, to3dmodel} from '@jscadui/3mf-export';
import {fileForContentTypes, FileForRelThumbnail, to3dmodel} from '@jscadui/3mf-export';
import {strToU8, Zippable, zipSync} from 'fflate'
import * as glMatrix from 'gl-matrix';

Expand Down Expand Up @@ -166,7 +166,8 @@ const nodes = new Array<GLTFNode>();
const id2material = new Map<number, GLTFMaterial>();
const materialCache = new Map<GLTFMaterial, Material>();
const object2globalID = new Map<GLTFNode|Manifold, number>();
let nextGlobalID = 0;
// lib3mf doesn't like objectid=0
let nextGlobalID = 1;
let animation: Animation;
let timesAccessor: Accessor;
let hasAnimation: boolean;
Expand All @@ -179,7 +180,7 @@ function cleanup() {
id2material.clear();
materialCache.clear();
object2globalID.clear();
nextGlobalID = 0;
nextGlobalID = 1;
}

interface Mesh3MF {
Expand Down Expand Up @@ -641,6 +642,9 @@ async function exportModels(defaults: GlobalDefaults, manifold?: Manifold) {
const glb = await io.writeBinary(doc);
const blobGLB = new Blob([glb], {type: 'application/octet-stream'});

const fileForRelThumbnail = new FileForRelThumbnail();
fileForRelThumbnail.add3dModel('3D/3dmodel.model')

const model = to3dmodel(to3mf);
const files: Zippable = {};
files['3D/3dmodel.model'] = strToU8(model);
Expand Down
0