More fixes for ios and android

This commit is contained in:
Lubos Lenco
2021-10-13 21:00:58 +02:00
parent 3464e5bf61
commit 5d2841cfd7
9 changed files with 42 additions and 7 deletions
+8 -3
View File
@@ -66,6 +66,11 @@ class Layers {
public static inline var defaultBase = 0.5;
public static inline var defaultRough = 0.4;
#if (krom_android || krom_ios)
public static inline var maxLayers = 18;
#else
public static inline var maxLayers = 255;
#end
public static function initLayers() {
Project.layers[0].clear(kha.Color.fromFloats(defaultBase, defaultBase, defaultBase, 1.0));
@@ -851,7 +856,7 @@ class Layers {
}
public static function newLayer(clear = true): LayerSlot {
if (Project.layers.length > 255) return null;
if (Project.layers.length > maxLayers) return null;
var l = new LayerSlot();
l.objectMask = Context.layerFilter;
if (Context.layer.isMask()) Context.setLayer(Context.layer.parent);
@@ -870,7 +875,7 @@ class Layers {
}
public static function newMask(clear = true, parent: LayerSlot): LayerSlot {
if (Project.layers.length > 255) return null;
if (Project.layers.length > maxLayers) return null;
var l = new LayerSlot("", SlotMask, parent);
Project.layers.insert(Project.layers.indexOf(parent), l);
Context.setLayer(l);
@@ -880,7 +885,7 @@ class Layers {
}
public static function newGroup(): LayerSlot {
if (Project.layers.length > 255) return null;
if (Project.layers.length > maxLayers) return null;
var l = new LayerSlot("", SlotGroup);
Project.layers.push(l);
Context.setLayer(l);
+2 -2
View File
@@ -105,9 +105,9 @@ class Project {
#if krom_ios
var documentDirectory = Krom.saveDialog("", "");
documentDirectory = documentDirectory.substr(0, documentDirectory.length - 8); // Strip /'untitled'
filepath = documentDirectory + "/project" + Config.raw.recent_projects.length + ".arm";
filepath = documentDirectory + "/" + UIFiles.filename + ".arm";
#elseif krom_android
filepath = Krom.savePath() + "/project" + Config.raw.recent_projects.length + ".arm";
filepath = Krom.savePath() + "/" + UIFiles.filename + ".arm";
#else
projectSaveAs();
return;
+5 -1
View File
@@ -89,7 +89,11 @@ class ExportTexture {
trace("Textures exported in " + (iron.system.Time.realTime() - timer));
#end
Console.info("Textures exported.");
#if krom_ios
Console.info(tr("Textures exported.") + " ('Files/On My iPad/" + Main.title + "')");
#else
Console.info(tr("Textures exported."));
#end
}
static function runBakeMaterial(path: String) {
+4
View File
@@ -86,6 +86,10 @@ class ImportMesh {
#if (kha_direct3d12 || kha_vulkan)
arm.render.RenderPathRaytrace.ready = false;
#end
#if (krom_android || krom_ios)
arm.ui.UIFiles.filename = path.substring(path.lastIndexOf(Path.sep) + 1, path.lastIndexOf("."));
#end
}
public static function makeMesh(mesh: Dynamic, path: String) {
+8
View File
@@ -60,7 +60,11 @@ class BoxExport {
static function tabExportTextures(ui: Zui, title: String, bakeMaterial = false) {
if (ui.tab(htab, title)) {
ui.row([0.5, 0.5]);
#if (krom_android || krom_ios)
ui.combo(App.resHandle, ["128", "256", "512", "1K", "2K", "4K"], tr("Resolution"), true);
#else
ui.combo(App.resHandle, ["128", "256", "512", "1K", "2K", "4K", "8K", "16K"], tr("Resolution"), true);
#end
if (App.resHandle.changed) {
iron.App.notifyOnInit(Layers.resizeLayers);
UVUtil.uvmap = null;
@@ -72,7 +76,11 @@ class BoxExport {
arm.render.RenderPathRaytrace.ready = false;
#end
}
#if (krom_android || krom_ios)
ui.combo(App.bitsHandle, ["8bit"], tr("Color"), true);
#else
ui.combo(App.bitsHandle, ["8bit", "16bit", "32bit"], tr("Color"), true);
#end
if (App.bitsHandle.changed) {
iron.App.notifyOnInit(Layers.setLayerBits);
}
+4
View File
@@ -292,7 +292,11 @@ class BoxPreferences {
}
var layerResHandle = Id.handle({position: Config.raw.layer_res});
#if (krom_android || krom_ios)
ui.combo(layerResHandle, ["128", "256", "512", "1K", "2K", "4K"], tr("Default Layer Resolution"), true);
#else
ui.combo(layerResHandle, ["128", "256", "512", "1K", "2K", "4K", "8K"], tr("Default Layer Resolution"), true);
#end
if (layerResHandle.changed) {
Config.raw.layer_res = layerResHandle.position;
}
+9 -1
View File
@@ -701,9 +701,13 @@ class TabLayers {
if (!l.isGroup()) {
ui.row([7 / 10, 3 / 10]);
var resHandleChangedLast = App.resHandle.changed;
#if (krom_android || krom_ios)
var ar = ["128", "256", "512", "1K", "2K", "4K"];
#else
var ar = ["128", "256", "512", "1K", "2K", "4K", "8K", "16K"];
#end
App.resHandle.value = App.resHandle.position;
App.resHandle.position = Std.int(ui.slider(App.resHandle, ar[App.resHandle.position], 0, 7, false, 1, false, Left, false));
App.resHandle.position = Std.int(ui.slider(App.resHandle, ar[App.resHandle.position], 0, ar.length - 1, false, 1, false, Left, false));
if (App.resHandle.changed) {
UIMenu.keepOpen = true;
}
@@ -721,7 +725,11 @@ class TabLayers {
ui.text(tr("Res"));
ui.row([7 / 10, 3 / 10]);
#if (krom_android || krom_ios)
zui.Ext.inlineRadio(ui, App.bitsHandle, ["8bit"]);
#else
zui.Ext.inlineRadio(ui, App.bitsHandle, ["8bit", "16bit", "32bit"]);
#end
if (App.bitsHandle.changed) {
iron.App.notifyOnInit(Layers.setLayerBits);
UIMenu.keepOpen = true;
+1
View File
@@ -25,6 +25,7 @@ class TabTextures {
if (ui.button(tr("Import"))) {
UIFiles.show(Path.textureFormats.join(","), false, true, function(path: String) {
ImportAsset.run(path, -1.0, -1.0, true, false);
UIStatus.inst.statusHandle.redraws = 2;
});
}
if (ui.isHovered) ui.tooltip(tr("Import texture file") + ' (${Config.keymap.file_import_assets})');
+1
View File
@@ -203,6 +203,7 @@ class UIFiles {
icon.g2.pipeline = null;
icon.g2.end();
iconMap.set(handle.text + Path.sep + f, icon);
ui.currentWindow.redraws = 3;
});
});
}