Save additional preferences
This commit is contained in:
@@ -93,6 +93,17 @@ class Config {
|
||||
raw.brush_3d = true;
|
||||
raw.brush_live = false;
|
||||
raw.camera_speed = 1.0;
|
||||
raw.displace_strength = 1.0;
|
||||
#if krom_android
|
||||
raw.native_file_browser = false;
|
||||
#else
|
||||
raw.native_file_browser = true;
|
||||
#end
|
||||
raw.show_asset_names = false;
|
||||
#end
|
||||
|
||||
#if arm_creator
|
||||
// raw.displace_strength = 100.0;
|
||||
#end
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -40,5 +40,8 @@ typedef TConfig = {
|
||||
@:optional var brush_live: Null<Bool>;
|
||||
@:optional var brush_3d: Null<Bool>;
|
||||
@:optional var camera_speed: Null<Float>;
|
||||
@:optional var displace_strength: Null<Float>;
|
||||
@:optional var native_file_browser: Null<Bool>;
|
||||
@:optional var show_asset_names: Null<Bool>;
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -94,11 +94,6 @@ class Context {
|
||||
public static var parseVCols = false;
|
||||
|
||||
public static var selectTime = 0.0;
|
||||
#if arm_creator
|
||||
public static var displaceStrength = 100.0;
|
||||
#else
|
||||
public static var displaceStrength = 1.0;
|
||||
#end
|
||||
public static var decalImage: Image = null;
|
||||
public static var decalPreview = false;
|
||||
public static var viewportMode = ViewLit;
|
||||
@@ -109,13 +104,7 @@ class Context {
|
||||
#end
|
||||
public static var hscaleWasChanged = false;
|
||||
public static var exportMeshFormat = FormatObj;
|
||||
#if krom_android
|
||||
public static var nativeBrowser = false;
|
||||
#else
|
||||
public static var nativeBrowser = true;
|
||||
#end
|
||||
public static var cacheDraws = false;
|
||||
public static var showAssetNames = false;
|
||||
|
||||
public static var textToolImage: Image = null;
|
||||
public static var textToolText: String;
|
||||
|
||||
@@ -100,7 +100,7 @@ class MaterialBuilder {
|
||||
|
||||
public static inline function getDisplaceStrength():Float {
|
||||
var sc = Context.mainObject().transform.scale.x;
|
||||
return Context.displaceStrength * 0.02 * sc;
|
||||
return Config.raw.displace_strength * 0.02 * sc;
|
||||
}
|
||||
|
||||
public static inline function voxelgiHalfExtents():String {
|
||||
|
||||
@@ -42,7 +42,6 @@ class BoxPreferences {
|
||||
if (localeHandle.changed) {
|
||||
var localeCode = locales[localeHandle.position];
|
||||
Config.raw.locale = localeCode;
|
||||
Config.save();
|
||||
Translator.loadTranslations(localeCode);
|
||||
UISidebar.inst.tagUIRedraw();
|
||||
}
|
||||
@@ -52,7 +51,6 @@ class BoxPreferences {
|
||||
if (!hscale.changed && Context.hscaleWasChanged) {
|
||||
if (hscale.value == null || Math.isNaN(hscale.value)) hscale.value = 1.0;
|
||||
Config.raw.window_scale = hscale.value;
|
||||
Config.save();
|
||||
setScale();
|
||||
}
|
||||
Context.hscaleWasChanged = hscale.changed;
|
||||
@@ -61,7 +59,7 @@ class BoxPreferences {
|
||||
Config.raw.camera_speed = ui.slider(hspeed, tr("Camera Speed"), 0.1, 4.0, true);
|
||||
|
||||
#if (!krom_android && !krom_ios)
|
||||
Context.nativeBrowser = ui.check(Id.handle({selected: Context.nativeBrowser}), tr("Native File Browser"));
|
||||
Config.raw.native_file_browser = ui.check(Id.handle({selected: Config.raw.native_file_browser}), tr("Native File Browser"));
|
||||
#end
|
||||
|
||||
#if arm_debug
|
||||
@@ -70,7 +68,7 @@ class BoxPreferences {
|
||||
#end
|
||||
|
||||
ui.changed = false;
|
||||
Context.showAssetNames = ui.check(Id.handle({selected: Context.showAssetNames}), tr("Show Asset Names"));
|
||||
Config.raw.show_asset_names = ui.check(Id.handle({selected: Config.raw.show_asset_names}), tr("Show Asset Names"));
|
||||
if (ui.changed) {
|
||||
UISidebar.inst.tagUIRedraw();
|
||||
}
|
||||
@@ -107,7 +105,6 @@ class BoxPreferences {
|
||||
ui.combo(themeHandle, themes, tr("Theme"));
|
||||
if (themeHandle.changed) {
|
||||
Config.raw.theme = themes[themeHandle.position] + ".json";
|
||||
Config.save();
|
||||
loadTheme(Config.raw.theme);
|
||||
}
|
||||
|
||||
@@ -231,7 +228,6 @@ class BoxPreferences {
|
||||
}
|
||||
History.reset();
|
||||
ui.g.begin(false);
|
||||
Config.save();
|
||||
}
|
||||
|
||||
Context.brushBias = ui.slider(Id.handle({value: Context.brushBias}), tr("Paint Bleed"), 0.0, 2.0, true);
|
||||
@@ -311,7 +307,6 @@ class BoxPreferences {
|
||||
#if arm_debug
|
||||
var vsyncHandle = Id.handle({selected: Config.raw.window_vsync});
|
||||
Config.raw.window_vsync = ui.check(vsyncHandle, tr("VSync"));
|
||||
if (vsyncHandle.changed) Config.save();
|
||||
#end
|
||||
|
||||
if (Context.renderMode == RenderDeferred) {
|
||||
@@ -344,10 +339,7 @@ class BoxPreferences {
|
||||
|
||||
var h = Id.handle({value: Config.raw.rp_vignette});
|
||||
Config.raw.rp_vignette = ui.slider(h, tr("Vignette"), 0.0, 1.0, true);
|
||||
if (h.changed) {
|
||||
Context.ddirty = 2;
|
||||
Config.save();
|
||||
}
|
||||
if (h.changed) Context.ddirty = 2;
|
||||
|
||||
// var h = Id.handle({value: Context.autoExposureStrength});
|
||||
// Context.autoExposureStrength = ui.slider(h, "Auto Exposure", 0.0, 2.0, true);
|
||||
@@ -365,8 +357,8 @@ class BoxPreferences {
|
||||
cam.buildProjection();
|
||||
}
|
||||
|
||||
var dispHandle = Id.handle({value: Context.displaceStrength});
|
||||
Context.displaceStrength = ui.slider(dispHandle, tr("Displace"), 0.0, 10.0, true);
|
||||
var dispHandle = Id.handle({value: Config.raw.displace_strength});
|
||||
Config.raw.displace_strength = ui.slider(dispHandle, tr("Displacement Strength"), 0.0, 10.0, true);
|
||||
if (dispHandle.changed) {
|
||||
Context.ddirty = 2;
|
||||
MaterialParser.parseMeshMaterial();
|
||||
@@ -485,7 +477,6 @@ plugin.drawUI = function(ui) {
|
||||
Config.raw.plugins.remove(f);
|
||||
Plugin.stop(f);
|
||||
}
|
||||
Config.save();
|
||||
App.redrawUI();
|
||||
}
|
||||
if (ui.isHovered && ui.inputReleasedR) {
|
||||
@@ -521,7 +512,7 @@ plugin.drawUI = function(ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 600, 400);
|
||||
}, 600, 400, function() { Config.save(); });
|
||||
}
|
||||
|
||||
public static function fetchThemes() {
|
||||
|
||||
@@ -64,11 +64,11 @@ class TabMaterials {
|
||||
var num = Std.int(UISidebar.inst.windowW / slotw);
|
||||
|
||||
for (row in 0...Std.int(Math.ceil(materials.length / num))) {
|
||||
var mult = Context.showAssetNames ? 2 : 1;
|
||||
var mult = Config.raw.show_asset_names ? 2 : 1;
|
||||
ui.row([for (i in 0...num * mult) 1 / num]);
|
||||
|
||||
ui._x += 2;
|
||||
var off = Context.showAssetNames ? ui.ELEMENT_OFFSET() * 10.0 : 6;
|
||||
var off = Config.raw.show_asset_names ? ui.ELEMENT_OFFSET() * 10.0 : 6;
|
||||
if (row > 0) ui._y += off;
|
||||
|
||||
for (j in 0...num) {
|
||||
@@ -195,7 +195,7 @@ class TabMaterials {
|
||||
}
|
||||
if (ui.isHovered) ui.tooltipImage(imgFull);
|
||||
|
||||
if (Context.showAssetNames) {
|
||||
if (Config.raw.show_asset_names) {
|
||||
ui._x = uix;
|
||||
ui._y += slotw * 0.9;
|
||||
ui.text(materials[i].canvas.name, Center);
|
||||
|
||||
@@ -17,6 +17,7 @@ class UIBox {
|
||||
public static var clickToHide = true;
|
||||
static var modalW = 400;
|
||||
static var modalH = 170;
|
||||
static var modalOnHide: Void->Void = null;
|
||||
static var draws = 0;
|
||||
static var copyable = false;
|
||||
|
||||
@@ -82,6 +83,7 @@ class UIBox {
|
||||
var mx = mouse.x;
|
||||
var my = mouse.y;
|
||||
if ((clickToHide && (mx < left || mx > right || my < top || my > bottom)) || isEscape) {
|
||||
if (modalOnHide != null) modalOnHide();
|
||||
show = false;
|
||||
App.redrawUI();
|
||||
}
|
||||
@@ -98,10 +100,11 @@ class UIBox {
|
||||
UIBox.copyable = copyable;
|
||||
}
|
||||
|
||||
public static function showCustom(commands: Zui->Void = null, mw = 400, mh = 200) {
|
||||
public static function showCustom(commands: Zui->Void = null, mw = 400, mh = 200, onHide: Void->Void = null) {
|
||||
init();
|
||||
modalW = mw;
|
||||
modalH = mh;
|
||||
modalOnHide = onHide;
|
||||
boxCommands = commands;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class UIFiles {
|
||||
static var showExtensions = true;
|
||||
|
||||
public static function show(filters: String, isSave: Bool, filesDone: String->Void) {
|
||||
if (!Context.nativeBrowser) {
|
||||
if (!Config.raw.native_file_browser) {
|
||||
if (path == null) path = defaultPath;
|
||||
showCustom(filters, isSave, filesDone);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user