Skip to content

Commit 5f77e26

Browse files
committed
⚠️ Fixed Parentless Cubes Silently Failing
1 parent 374f257 commit 5f77e26

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/systems/exporter.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { compileDataPack } from './datapackCompiler'
1010
import { compileResourcePack } from './resourcepackCompiler'
1111
import { renderRig, hashRig } from './rigRenderer'
1212

13+
export class IntentionalExportError extends Error {}
14+
1315
async function actuallyExportProject() {
1416
const aj = Project!.animated_java
1517
const dialog = openExportProgressDialog()
@@ -92,6 +94,14 @@ async function actuallyExportProject() {
9294
} catch (e: any) {
9395
console.error(e)
9496
dialog.close(0)
97+
if (e instanceof IntentionalExportError) {
98+
Blockbench.showMessageBox({
99+
title: translate('misc.failed_to_export.title'),
100+
message: e.message,
101+
buttons: [translate('misc.failed_to_export.button')],
102+
})
103+
return
104+
}
95105
openUnexpectedErrorDialog(e as Error)
96106
}
97107
}

src/systems/rigRenderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import * as crypto from 'crypto'
2323
import { JsonText } from './minecraft/jsonText'
2424
import { VanillaItemDisplay } from '../outliner/vanillaItemDisplay'
2525
import { VanillaBlockDisplay } from '../outliner/vanillaBlockDisplay'
26+
import { IntentionalExportError } from './exporter'
2627

2728
export interface IRenderedFace {
2829
uv: number[]
@@ -690,7 +691,9 @@ export function renderRig(modelExportFolder: string, textureExportFolder: string
690691
const display = renderBlockDisplay(node, rig)
691692
if (display) rootNode.children.push(display)
692693
} else if (node instanceof Cube) {
693-
console.error(`Encountered cube in root of outliner:`, node)
694+
throw new IntentionalExportError(
695+
`Cubes cannot be exported as root nodes. Please parent them to a bone. (Found '${node.name}' outside of a bone)`
696+
)
694697
} else {
695698
console.warn(`Encountered unknown node type:`, node)
696699
}

0 commit comments

Comments
 (0)