Krom guards

This commit is contained in:
luboslenco
2019-05-06 11:32:40 +02:00
parent d9e3bc1847
commit ea7c0948ae
4 changed files with 13 additions and 3 deletions
+7 -1
View File
@@ -316,6 +316,7 @@ class App extends iron.Trait {
static function renderFiles(g:kha.graphics2.Graphics) {
// Krom with native file dialogs
#if kha_krom
if (untyped Krom.openDialog != null) {
showFiles = false;
path = untyped foldersOnly ? Krom.saveDialog() : Krom.openDialog();
@@ -329,6 +330,7 @@ class App extends iron.Trait {
}
return;
}
#end
modalW = Std.int(625 * uimodal.SCALE);
modalH = Std.int(545 * uimodal.SCALE);
@@ -544,6 +546,7 @@ class App extends iron.Trait {
}
else if (menuCategory == 3) {
if (ui.button("Manual", Left)) {
#if kha_krom
if (kha.System.systemId == "Windows") {
Krom.sysCommand('explorer "https://armorpaint.org/manual"');
}
@@ -553,8 +556,10 @@ class App extends iron.Trait {
else {
Krom.sysCommand('open "https://armorpaint.org/manual"');
}
#end
}
if (ui.button("Report Bug", Left)) {
#if kha_krom
if (kha.System.systemId == "Windows") {
Krom.sysCommand('explorer "https://github.com/armory3d/armorpaint/issues"');
}
@@ -564,12 +569,13 @@ class App extends iron.Trait {
else {
Krom.sysCommand('open "https://github.com/armory3d/armorpaint/issues"');
}
#end
}
if (ui.button("Check for Updates...", Left)) {
// Retrieve latest version number
#if kha_krom
var outFile = Krom.getFilesLocation() + '/' + iron.data.Data.dataPath + "update.txt";
var uri = "'https://luboslenco.gitlab.io/armorpaint/index.html'";
#if kha_krom
if (kha.System.systemId == "Windows") {
Krom.sysCommand('powershell -c "Invoke-WebRequest -Uri ' + uri + " -OutFile '" + outFile + "'");
}
+2
View File
@@ -253,7 +253,9 @@ class Project {
var abs = base + file;
var exists = 1;
if (kha.System.systemId == "Windows") {
#if kha_krom
exists = Krom.sysCommand('IF EXIST "' + abs + '" EXIT /b 1');
#end
}
//else { test -e file && echo 1 || echo 0 }
if (exists == 0) {
+4 -1
View File
@@ -2128,7 +2128,9 @@ class UITrait extends iron.Trait {
var hscale = Id.handle({value: C.window_scale});
ui.slider(hscale, "UI Scale", 0.5, 4.0, true);
if (!hscale.changed && hscaleWasChanged) {
#if kha_krom
if (hscale.value == null || Math.isNaN(hscale.value)) hscale.value = 1.0;
#end
C.window_scale = hscale.value;
ui.setScale(hscale.value);
arm.App.uimodal.setScale(hscale.value);
@@ -2657,7 +2659,8 @@ class UITrait extends iron.Trait {
var light = iron.Scene.active.lights[0];
var sxhandle = Id.handle();
sxhandle.value = light.data.raw.size;
var f32:kha.FastFloat = light.data.raw.size; // hl fix
sxhandle.value = f32;
light.data.raw.size = ui.slider(sxhandle, "Light Size", 0.0, 4.0, true);
if (sxhandle.changed) ddirty = 2;
// var syhandle = Id.handle();
-1
View File
@@ -30,7 +30,6 @@ class ViewportUtil {
UITrait.inst.camHandle.position = 0;
cam.data.raw.ortho = null;
cam.buildProjection();
UITrait.inst.selectedObject.transform.reset();
UITrait.inst.ddirty = 2;
arm.trait.OrbitCamera.inst.reset();
break;