From 945752ccf5a8537eff3b8a7cbf8eaa0c7adcfc6a Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 24 Sep 2020 19:12:54 +0200 Subject: [PATCH] Set layers export type when opening export dialog --- Sources/arm/ui/BoxExport.hx | 4 +++- Sources/arm/ui/TabLayers.hx | 5 ++++- Sources/arm/ui/UIMenu.hx | 5 ++++- Sources/arm/ui/UISidebar.hx | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Sources/arm/ui/BoxExport.hx b/Sources/arm/ui/BoxExport.hx index 2e12c99a..e7954eb3 100644 --- a/Sources/arm/ui/BoxExport.hx +++ b/Sources/arm/ui/BoxExport.hx @@ -79,7 +79,9 @@ class BoxExport { ui.enabled = true; ui.row([0.5, 0.5]); ui.enabled = !bakeMaterial; - Context.layersExport = ui.combo(Id.handle({position: Context.layersExport}), [tr("Visible"), tr("Selected")], tr("Layers"), true); + var layersExportHandle = Id.handle(); + layersExportHandle.position = Context.layersExport; + Context.layersExport = ui.combo(layersExportHandle, [tr("Visible"), tr("Selected")], tr("Layers"), true); ui.enabled = true; ui.combo(hpreset, files, tr("Preset"), true); if (hpreset.changed) preset = null; diff --git a/Sources/arm/ui/TabLayers.hx b/Sources/arm/ui/TabLayers.hx index b00d833b..b8018d3c 100644 --- a/Sources/arm/ui/TabLayers.hx +++ b/Sources/arm/ui/TabLayers.hx @@ -332,7 +332,10 @@ class TabLayers { UIMenu.draw(function(ui: Zui) { ui.text(l.name, Right, ui.t.HIGHLIGHT_COL); - if (ui.button(tr("Export"), Left)) BoxExport.showTextures(); + if (ui.button(tr("Export"), Left)) { + Context.layersExport = 1; + BoxExport.showTextures(); + } if (l.getChildren() == null && l.fill_layer == null && ui.button(tr("To Fill Layer"), Left)) { function makeFill(g: kha.graphics4.Graphics) { diff --git a/Sources/arm/ui/UIMenu.hx b/Sources/arm/ui/UIMenu.hx index a694fe13..3dc1dbab 100644 --- a/Sources/arm/ui/UIMenu.hx +++ b/Sources/arm/ui/UIMenu.hx @@ -73,7 +73,10 @@ class UIMenu { if (ui.button(" " + tr("Reimport Mesh"), Left, Config.keymap.file_reimport_mesh)) Project.reimportMesh(); if (ui.button(" " + tr("Reimport Textures"), Left, Config.keymap.file_reimport_textures)) Project.reimportTextures(); ui.fill(0, 0, sepw, 1, ui.t.ACCENT_SELECT_COL); - if (ui.button(" " + tr("Export Textures..."), Left, Config.keymap.file_export_textures_as)) BoxExport.showTextures(); + if (ui.button(" " + tr("Export Textures..."), Left, Config.keymap.file_export_textures_as)) { + Context.layersExport = 0; + BoxExport.showTextures(); + } if (ui.button(" " + tr("Export Mesh..."), Left)) BoxExport.showMesh(); if (ui.button(" " + tr("Bake Material..."), Left)) BoxExport.showBakeMaterial(); ui.fill(0, 0, sepw, 1, ui.t.ACCENT_SELECT_COL); diff --git a/Sources/arm/ui/UISidebar.hx b/Sources/arm/ui/UISidebar.hx index 1988ee39..8bc1f6c8 100644 --- a/Sources/arm/ui/UISidebar.hx +++ b/Sources/arm/ui/UISidebar.hx @@ -195,6 +195,7 @@ class UISidebar { else if (Operator.shortcut(Config.keymap.file_new)) Project.projectNewBox(); else if (Operator.shortcut(Config.keymap.file_export_textures)) { if (Context.textureExportPath == "") { // First export, ask for path + Context.layersExport = 0; BoxExport.showTextures(); } else { @@ -205,7 +206,10 @@ class UISidebar { iron.App.notifyOnRender(export); } } - else if (Operator.shortcut(Config.keymap.file_export_textures_as)) BoxExport.showTextures(); + else if (Operator.shortcut(Config.keymap.file_export_textures_as)) { + Context.layersExport = 0; + BoxExport.showTextures(); + } else if (Operator.shortcut(Config.keymap.file_import_assets)) Project.importAsset(); else if (Operator.shortcut(Config.keymap.edit_prefs)) BoxPreferences.show();