From c8eda41ebb30ea29a5b5b64b9be0a373d9d65e06 Mon Sep 17 00:00:00 2001 From: Felix Herbst Date: Tue, 11 Jun 2024 15:48:13 +0200 Subject: [PATCH] cleanup and better logs --- src/dynamicFiles.ts | 23 ++++++++++++++++------- src/routes/[slug]/Model.svelte | 2 ++ submodules/glTF-Sample-Models | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/dynamicFiles.ts b/src/dynamicFiles.ts index 94c60c5..18f1d3d 100644 --- a/src/dynamicFiles.ts +++ b/src/dynamicFiles.ts @@ -44,7 +44,7 @@ async function collectFileInformation(filter: string | undefined = undefined, ru const runThreeConversion = false; const runBlenderConversion = false; const runOmniverseConversion = false; - const runGucConversion = true; + const runGucConversion = false; const runUsdChecksAndRender = false; // patch FileLoader to use fs instead of fetch @@ -305,12 +305,15 @@ async function collectFileInformation(filter: string | undefined = undefined, ru await new Promise((resolve, reject) => { const screenshotPath = path.resolve(file, "..", fileName + ".png"); const domeLightAbsPath = path.resolve("src/lib/images/neutral.hdr").replaceAll("\\", "/"); - const cmd = 'python3 usd/generate_thumbnail.py "' + usdzFile + '" ' + '--dome-light ' + '"' + domeLightAbsPath + '"' + ' --width 900 --height 760'; + + // Mac: "python3" + // Windows: "python" + const cmd = 'python usd/generate_thumbnail.py "' + usdzFile + '" ' + '--dome-light ' + '"' + domeLightAbsPath + '"' + ' --width 900 --height 760'; // console.log(" " + cmd) subProcess.exec(cmd, (err, stdout, stderr) => { if (err) { - console.log("❌ " + fileName + " failed generate_thumbnail"); + console.log("❌ " + fileName + " failed generate_thumbnail (" + cmd + ")"); console.group(); console.log(`${stdout.toString()}`); console.log(`${stderr.toString()}`); @@ -357,6 +360,10 @@ async function collectFileInformation(filter: string | undefined = undefined, ru try { let usdzArrayBuffer : ArrayBuffer | null = null; if (runConversions && runThreeConversion) { + + + // start puppeteer with non-headless mode and run the conversion incl. animations + usdzArrayBuffer = await new Promise((resolve, reject) => { try { // const manager = new LoadingManager(); @@ -402,12 +409,13 @@ async function collectFileInformation(filter: string | undefined = undefined, ru // blender conversion await new Promise((resolve, reject) => { // /Applications/Blender.app/Contents/MacOS/Blender -b -P blender/blender_gltf_converter.py -- -mp "/Users/herbst/Downloads/2CylinderEngine.glb" - const blenderPath = '/Applications/Blender.app/Contents/MacOS/Blender'; + // const blenderPath = '/Applications/Blender.app/Contents/MacOS/Blender'; + const blenderPath = 'D:/SteamLibrary/steamapps/common/Blender/blender.exe'; const cmd = blenderPath + ' -b -P blender/blender_gltf_converter.py -- -mp "' + file + '"'; subProcess.exec(cmd, (err, stdout, stderr) => { if (err) { - console.log("❌ " + fileName + " failed blender conversion"); + console.log("❌ " + fileName + " failed blender conversion (" + cmd + ")"); console.group(); console.log(`${stdout.toString()}`); console.log(`${stderr.toString()}`); @@ -430,7 +438,7 @@ async function collectFileInformation(filter: string | undefined = undefined, ru subProcess.exec(cmd, (err, stdout, stderr) => { if (err) { - console.log("❌ " + fileName + " failed Omniverse conversion"); + console.log("❌ " + fileName + " failed Omniverse conversion (" + cmd + ")"); console.group(); console.log(`${stdout.toString()}`); console.log(`${stderr.toString()}`); @@ -450,6 +458,7 @@ async function collectFileInformation(filter: string | undefined = undefined, ru await new Promise((resolve, reject) => { const gucPath = "guc"; // must be in PATH const cmd = gucPath + ' ' + file + ' ' + gucUsdzFilePathAbs; + console.log(cmd); subProcess.exec(cmd, (err, stdout, stderr) => { if (err) { @@ -495,7 +504,7 @@ async function collectFileInformation(filter: string | undefined = undefined, ru previewUri: firstFoundImage, uri: basePath + "/" + path.parse(file).name, - downloadUri: basePath + "/downloads/" + path.parse(file).name + ".glb", + downloadUri: basePath + "downloads/" + path.parse(file).name + ".glb", readmeSrc: readmeInRepo, originalFileSrc: srcFileInRepo, diff --git a/src/routes/[slug]/Model.svelte b/src/routes/[slug]/Model.svelte index cc0c16f..01ac12c 100644 --- a/src/routes/[slug]/Model.svelte +++ b/src/routes/[slug]/Model.svelte @@ -164,6 +164,7 @@ onMount(() => { Converted with Omniverse Kit 105.0 + {#if false}
  • screenshot from guc conversion @@ -176,6 +177,7 @@ onMount(() => { Converted with guc 0.4
  • + {/if} diff --git a/submodules/glTF-Sample-Models b/submodules/glTF-Sample-Models index 834fdec..39dd5dc 160000 --- a/submodules/glTF-Sample-Models +++ b/submodules/glTF-Sample-Models @@ -1 +1 @@ -Subproject commit 834fdecdb16dd2c84cc3c8ee6c23ea82c8a93ac9 +Subproject commit 39dd5dcd52446119da6d82aadbe8e090089b1339