@@ -5,6 +5,7 @@ import { PROGRESS_DESCRIPTION, openExportProgressDialog } from '../interface/exp
5
5
import { openUnexpectedErrorDialog } from '../interface/unexpectedErrorDialog'
6
6
import { resolveEnvVariables } from '../util/misc'
7
7
import { translate } from '../util/translation'
8
+ import { Variant } from '../variants'
8
9
import { hashAnimations , renderProjectAnimations } from './animationRenderer'
9
10
import { compileDataPack } from './datapackCompiler'
10
11
import { exportJSON } from './jsonExporter'
@@ -18,6 +19,8 @@ async function actuallyExportProject(forceSave = true) {
18
19
const dialog = openExportProgressDialog ( )
19
20
// Wait for the dialog to open
20
21
await new Promise ( resolve => requestAnimationFrame ( resolve ) )
22
+ const selectedVariant = Variant . selected
23
+ Variant . getDefault ( ) . select ( )
21
24
try {
22
25
console . time ( 'Exporting project took' )
23
26
@@ -112,11 +115,9 @@ async function actuallyExportProject(forceSave = true) {
112
115
console . timeEnd ( 'Exporting project took' )
113
116
114
117
if ( forceSave ) saveBlueprint ( )
115
- dialog . close ( 0 )
116
118
Blockbench . showQuickMessage ( 'Project exported successfully!' , 2000 )
117
119
} catch ( e : any ) {
118
120
console . error ( e )
119
- dialog . close ( 0 )
120
121
if ( e instanceof IntentionalExportError ) {
121
122
Blockbench . showMessageBox ( {
122
123
title : translate ( 'misc.failed_to_export.title' ) ,
@@ -126,6 +127,9 @@ async function actuallyExportProject(forceSave = true) {
126
127
return
127
128
}
128
129
openUnexpectedErrorDialog ( e as Error )
130
+ } finally {
131
+ selectedVariant ?. select ( )
132
+ dialog . close ( 0 )
129
133
}
130
134
}
131
135
0 commit comments