Export cleanup
This commit is contained in:
+1
-5
@@ -52,7 +52,6 @@ class App {
|
||||
public static var uibox:Zui;
|
||||
public static var uimenu:Zui;
|
||||
public static var fileArg = "";
|
||||
public static var saveAndQuit = false;
|
||||
public static var ELEMENT_H = 28;
|
||||
|
||||
public function new() {
|
||||
@@ -181,10 +180,7 @@ class App {
|
||||
|
||||
static function saveAndQuitCallback(save:Bool) {
|
||||
saveWindowRect();
|
||||
if (save) {
|
||||
saveAndQuit = true;
|
||||
Project.projectSave();
|
||||
}
|
||||
if (save) Project.projectSave(true);
|
||||
else System.stop();
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -1,5 +1,6 @@
|
||||
package arm;
|
||||
|
||||
import kha.System;
|
||||
import kha.Window;
|
||||
import zui.Zui;
|
||||
import zui.Id;
|
||||
@@ -24,6 +25,7 @@ import arm.io.ImportAsset;
|
||||
import arm.io.ImportArm;
|
||||
import arm.io.ImportBlend;
|
||||
import arm.io.ImportMesh;
|
||||
import arm.io.ExportArm;
|
||||
using StringTools;
|
||||
|
||||
class Project {
|
||||
@@ -60,13 +62,19 @@ class Project {
|
||||
});
|
||||
}
|
||||
|
||||
public static function projectSave() {
|
||||
public static function projectSave(saveAndQuit = false) {
|
||||
if (filepath == "") {
|
||||
projectSaveAs();
|
||||
return;
|
||||
}
|
||||
Window.get(0).title = UIFiles.filename + " - ArmorPaint";
|
||||
UITrait.inst.projectExport = true;
|
||||
|
||||
function export(_) {
|
||||
ExportArm.runProject();
|
||||
iron.App.removeRender(export);
|
||||
if (saveAndQuit) System.stop();
|
||||
}
|
||||
iron.App.notifyOnRender(export);
|
||||
}
|
||||
|
||||
public static function projectSaveAs() {
|
||||
|
||||
@@ -69,8 +69,12 @@ class BoxExport {
|
||||
UIBox.show = false;
|
||||
var filters = UITrait.inst.bitsHandle.position > 0 ? "exr" : UITrait.inst.formatType == 0 ? "png" : "jpg";
|
||||
UIFiles.show(filters, true, function(path:String) {
|
||||
UITrait.inst.textureExport = true;
|
||||
UITrait.inst.textureExportPath = path;
|
||||
function export(_) {
|
||||
ExportTexture.run(path);
|
||||
iron.App.removeRender(export);
|
||||
}
|
||||
iron.App.notifyOnRender(export);
|
||||
});
|
||||
}
|
||||
if (ui.isHovered) ui.tooltip("Export texture files (" + Config.keymap.file_export_textures + ")");
|
||||
|
||||
+10
-20
@@ -245,9 +245,7 @@ class UITrait {
|
||||
public var vxaoOffset = 1.5;
|
||||
public var vxaoAperture = 1.2;
|
||||
public var vignetteStrength = 0.4;
|
||||
public var textureExport = false;
|
||||
public var textureExportPath = "";
|
||||
public var projectExport = false;
|
||||
public var headerHandle = new Handle({layout:Horizontal});
|
||||
public var toolbarHandle = new Handle();
|
||||
public var statusHandle = new Handle({layout:Horizontal});
|
||||
@@ -406,16 +404,6 @@ class UITrait {
|
||||
}
|
||||
|
||||
public function update() {
|
||||
if (textureExport) {
|
||||
textureExport = false;
|
||||
ExportTexture.run(textureExportPath);
|
||||
}
|
||||
if (projectExport) {
|
||||
projectExport = false;
|
||||
ExportArm.runProject();
|
||||
if (App.saveAndQuit) System.stop();
|
||||
}
|
||||
|
||||
isScrolling = ui.isScrolling;
|
||||
updateUI();
|
||||
|
||||
@@ -443,13 +431,15 @@ class UITrait {
|
||||
else if (Operator.shortcut(Config.keymap.file_new)) Project.projectNewBox();
|
||||
else if (Operator.shortcut(Config.keymap.file_export_textures)) {
|
||||
if (textureExportPath == "") { // First export, ask for path
|
||||
var filters = bitsHandle.position > 0 ? "exr" : formatType == 0 ? "png" : "jpg";
|
||||
UIFiles.show(filters, true, function(path:String) {
|
||||
textureExport = true;
|
||||
textureExportPath = path;
|
||||
});
|
||||
BoxExport.showTextures();
|
||||
}
|
||||
else {
|
||||
function export(_) {
|
||||
ExportTexture.run(textureExportPath);
|
||||
iron.App.removeRender(export);
|
||||
}
|
||||
iron.App.notifyOnRender(export);
|
||||
}
|
||||
else textureExport = true;
|
||||
}
|
||||
else if (Operator.shortcut(Config.keymap.file_export_textures_as)) BoxExport.showTextures();
|
||||
else if (Operator.shortcut(Config.keymap.file_import_assets)) Project.importAsset();
|
||||
@@ -579,7 +569,7 @@ class UITrait {
|
||||
if (borderStarted == 0) {
|
||||
UINodes.inst.defaultWindowW -= Std.int(mouse.movementX);
|
||||
if (UINodes.inst.defaultWindowW < 32) UINodes.inst.defaultWindowW = 32;
|
||||
else if (UINodes.inst.defaultWindowW > kha.System.windowWidth() * 0.7) UINodes.inst.defaultWindowW = Std.int(kha.System.windowWidth() * 0.7);
|
||||
else if (UINodes.inst.defaultWindowW > System.windowWidth() * 0.7) UINodes.inst.defaultWindowW = Std.int(System.windowWidth() * 0.7);
|
||||
}
|
||||
else { // UINodes / UIView2D ratio
|
||||
UINodes.inst.defaultWindowH -= Std.int(mouse.movementY);
|
||||
@@ -591,7 +581,7 @@ class UITrait {
|
||||
if (borderStarted == 0) {
|
||||
defaultWindowW -= Std.int(mouse.movementX);
|
||||
if (defaultWindowW < 32) defaultWindowW = 32;
|
||||
else if (defaultWindowW > kha.System.windowWidth() - 32) defaultWindowW = kha.System.windowWidth() - 32;
|
||||
else if (defaultWindowW > System.windowWidth() - 32) defaultWindowW = System.windowWidth() - 32;
|
||||
windowW = Std.int(defaultWindowW * Config.raw.window_scale);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user