@@ -5,6 +5,7 @@ import { PROGRESS_DESCRIPTION, openExportProgressDialog } from '../interface/exp
55import { openUnexpectedErrorDialog } from '../interface/unexpectedErrorDialog'
66import { resolveEnvVariables } from '../util/misc'
77import { translate } from '../util/translation'
8+ import { Variant } from '../variants'
89import { hashAnimations , renderProjectAnimations } from './animationRenderer'
910import { compileDataPack } from './datapackCompiler'
1011import { exportJSON } from './jsonExporter'
@@ -18,6 +19,8 @@ async function actuallyExportProject(forceSave = true) {
1819 const dialog = openExportProgressDialog ( )
1920 // Wait for the dialog to open
2021 await new Promise ( resolve => requestAnimationFrame ( resolve ) )
22+ const selectedVariant = Variant . selected
23+ Variant . getDefault ( ) . select ( )
2124 try {
2225 console . time ( 'Exporting project took' )
2326
@@ -112,11 +115,9 @@ async function actuallyExportProject(forceSave = true) {
112115 console . timeEnd ( 'Exporting project took' )
113116
114117 if ( forceSave ) saveBlueprint ( )
115- dialog . close ( 0 )
116118 Blockbench . showQuickMessage ( 'Project exported successfully!' , 2000 )
117119 } catch ( e : any ) {
118120 console . error ( e )
119- dialog . close ( 0 )
120121 if ( e instanceof IntentionalExportError ) {
121122 Blockbench . showMessageBox ( {
122123 title : translate ( 'misc.failed_to_export.title' ) ,
@@ -126,6 +127,9 @@ async function actuallyExportProject(forceSave = true) {
126127 return
127128 }
128129 openUnexpectedErrorDialog ( e as Error )
130+ } finally {
131+ selectedVariant ?. select ( )
132+ dialog . close ( 0 )
129133 }
130134}
131135
0 commit comments