-
-
Notifications
You must be signed in to change notification settings - Fork 18
Attempt manifold 3D text mesh creation with verbose logging and fallback #524
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 emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e94aa6e
70c0434
364ce0b
c503569
5fd2ff4
105da91
46a4f81
5b0d1a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -751,6 +751,9 @@ export const flockCSG = { | |||||
| }; | ||||||
|
|
||||||
| return new Promise((resolve) => { | ||||||
| console.info( | ||||||
| `[subtractMeshes][path] approach=merge modelId=${modelId} base=${baseMeshName} tools=${meshNames.length}`, | ||||||
| ); | ||||||
| flock.whenModelReady(baseMeshName, (baseMesh) => { | ||||||
| if (!baseMesh) return resolve(null); | ||||||
| let actualBase = baseMesh.metadata?.modelName | ||||||
|
|
@@ -767,6 +770,9 @@ export const flockCSG = { | |||||
| } | ||||||
|
|
||||||
| flock.prepareMeshes(modelId, meshNames, blockKey).then((validMeshes) => { | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] validTools=${validMeshes.length}`, | ||||||
| ); | ||||||
| const inferredUvProjection = | ||||||
| options.uvProjection === undefined && | ||||||
| flock.toolMeshesUseTextures(validMeshes) | ||||||
|
|
@@ -783,6 +789,9 @@ export const flockCSG = { | |||||
| // Check if mesh itself has valid geometry (e.g., manifold text meshes) | ||||||
| const meshHasGeometry = | ||||||
| mesh.getTotalVertices && mesh.getTotalVertices() > 0; | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] toolIndex=${meshIndex} name=${mesh.name} parts=${parts.length} meshHasGeometry=${meshHasGeometry}`, | ||||||
| ); | ||||||
|
|
||||||
| if (parts.length > 0) { | ||||||
| const partClones = parts.map((p, i) => | ||||||
|
|
@@ -820,18 +829,30 @@ export const flockCSG = { | |||||
| // Direct mesh without children (e.g., manifold text mesh) | ||||||
| const clone = cloneForCSG(mesh, `direct_tool_${meshIndex}`); | ||||||
| subtractDuplicates.push(clone); | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] toolIndex=${meshIndex} using=direct_mesh`, | ||||||
| ); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| console.info( | ||||||
| `[subtractMeshes][merge] subtractToolCount=${subtractDuplicates.length}`, | ||||||
| ); | ||||||
| subtractDuplicates.forEach((m, idx) => { | ||||||
| try { | ||||||
| const meshCSG = flock.BABYLON.CSG2.FromMesh(m, false); | ||||||
| outerCSG = outerCSG.subtract(meshCSG); | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] subtractionIndex=${idx} status=ok tool=${m.name}`, | ||||||
| ); | ||||||
| } catch (e) { | ||||||
| console.warn( | ||||||
| `[subtractMeshesMerge] Subtraction ${idx} failed:`, | ||||||
| e.message, | ||||||
| ); | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] subtractionIndex=${idx} status=failed tool=${m.name}`, | ||||||
| ); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
|
|
@@ -844,6 +865,9 @@ export const flockCSG = { | |||||
| if (!resultMesh || resultMesh.getTotalVertices() === 0) { | ||||||
| throw new Error("CSG produced empty mesh"); | ||||||
| } | ||||||
| console.info( | ||||||
| `[subtractMeshes][merge] result=status_ok vertices=${resultMesh.getTotalVertices()}`, | ||||||
| ); | ||||||
| } catch (e) { | ||||||
| console.warn( | ||||||
| "[subtractMeshesMerge] CSG subtract failed:", | ||||||
|
|
@@ -922,6 +946,9 @@ export const flockCSG = { | |||||
| }; | ||||||
|
|
||||||
| return new Promise((resolve) => { | ||||||
| console.info( | ||||||
| `[subtractMeshes][path] approach=individual modelId=${modelId} base=${baseMeshName} tools=${meshNames.length}`, | ||||||
| ); | ||||||
| flock.whenModelReady(baseMeshName, (baseMesh) => { | ||||||
| if (!baseMesh) return resolve(null); | ||||||
| let actualBase = baseMesh; | ||||||
|
|
@@ -941,6 +968,9 @@ export const flockCSG = { | |||||
| } | ||||||
|
|
||||||
| flock.prepareMeshes(modelId, meshNames, blockKey).then((validMeshes) => { | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] validTools=${validMeshes.length}`, | ||||||
| ); | ||||||
| const inferredUvProjection = | ||||||
| options.uvProjection === undefined && | ||||||
| flock.toolMeshesUseTextures(validMeshes) | ||||||
|
|
@@ -958,8 +988,11 @@ export const flockCSG = { | |||||
|
|
||||||
| let outerCSG = flock.BABYLON.CSG2.FromMesh(baseDuplicate, false); | ||||||
| const allToolParts = []; | ||||||
| validMeshes.forEach((mesh) => { | ||||||
| validMeshes.forEach((mesh, meshIndex) => { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix ESLint violation: unused The pipeline is failing because 🔧 Proposed fix- validMeshes.forEach((mesh, meshIndex) => {
+ validMeshes.forEach((mesh, _meshIndex) => {Alternatively, if the index is not needed at all: - validMeshes.forEach((mesh, meshIndex) => {
+ validMeshes.forEach((mesh) => {📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: ESLint[error] 978-978: ESLint (no-unused-vars): 'meshIndex' is defined but never used. Allowed unused args must match /^_/u 🪛 GitHub Check: eslint[failure] 978-978: 🤖 Prompt for AI Agents |
||||||
| const parts = collectMaterialMeshesDeep(mesh); | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] toolIndex=${meshIndex} name=${mesh.name} parts=${parts.length}`, | ||||||
| ); | ||||||
| parts.forEach((p) => { | ||||||
| const dup = p.clone("partDup", null, true); | ||||||
| dup.computeWorldMatrix(true); | ||||||
|
|
@@ -968,12 +1001,21 @@ export const flockCSG = { | |||||
| }); | ||||||
| }); | ||||||
|
|
||||||
| allToolParts.forEach((part) => { | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] subtractPartCount=${allToolParts.length}`, | ||||||
| ); | ||||||
| allToolParts.forEach((part, index) => { | ||||||
| try { | ||||||
| const partCSG = flock.BABYLON.CSG2.FromMesh(part, false); | ||||||
| outerCSG = outerCSG.subtract(partCSG); | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] subtractionIndex=${index} status=ok tool=${part.name}`, | ||||||
| ); | ||||||
| } catch (e) { | ||||||
| console.warn(e); | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] subtractionIndex=${index} status=failed tool=${part.name}`, | ||||||
| ); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
|
|
@@ -986,6 +1028,9 @@ export const flockCSG = { | |||||
| if (!resultMesh || resultMesh.getTotalVertices() === 0) { | ||||||
| throw new Error("CSG produced empty mesh"); | ||||||
| } | ||||||
| console.info( | ||||||
| `[subtractMeshes][individual] result=status_ok vertices=${resultMesh.getTotalVertices()}`, | ||||||
| ); | ||||||
| } catch (e) { | ||||||
| console.warn( | ||||||
| "[subtractMeshesIndividual] CSG subtract failed:", | ||||||
|
|
@@ -1058,6 +1103,9 @@ export const flockCSG = { | |||||
| typeof optionsOrApproach === "string" | ||||||
| ? optionsOrApproach | ||||||
| : options.approach || "merge"; | ||||||
| console.info( | ||||||
| `[subtractMeshes][entry] requestedApproach=${approach} modelId=${modelId} base=${baseMeshName} tools=${meshNames.length}`, | ||||||
| ); | ||||||
|
|
||||||
| if (approach === "individual") { | ||||||
| return this.subtractMeshesIndividual( | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.