Remember tab positions

This commit is contained in:
luboslenco
2023-05-21 12:31:12 +02:00
parent b52b3513b5
commit 5533afced9
3 changed files with 34 additions and 12 deletions
+8
View File
@@ -942,6 +942,14 @@ class App {
Std.int(UIStatus.defaultStatusH * raw.window_scale)
];
raw.layout_tabs = [
#if (is_paint || is_sculpt)
0,
0,
#end
0
];
}
public static function initConfig() {
+2 -1
View File
@@ -41,7 +41,8 @@ package arm;
@:optional public var show_asset_names: Null<Bool>;
@:optional public var touch_ui: Null<Bool>;
@:optional public var splash_screen: Null<Bool>;
@:optional public var layout: Array<Int>;
@:optional public var layout: Array<Int>; // Sizes
@:optional public var layout_tabs: Array<Int>; // Active tabs
@:optional public var workspace: Null<Int>;
@:optional public var server: String;
+24 -11
View File
@@ -181,17 +181,6 @@ class UIBase {
var resources = ["cursor.k", "icons.k", "placeholder.k"];
#end
Res.load(resources, done);
Context.raw.projectObjects = [];
for (m in Scene.active.meshes) Context.raw.projectObjects.push(m);
Operator.register("view_top", view_top);
}
function done() {
if (ui.SCALE() > 1) setIconScale();
#if (is_paint || is_sculpt)
Context.raw.gizmo = Scene.active.getChild(".Gizmo");
Context.raw.gizmoTranslateX = Context.raw.gizmo.getChild(".TranslateX");
@@ -205,12 +194,21 @@ class UIBase {
Context.raw.gizmoRotateZ = Context.raw.gizmo.getChild(".RotateZ");
#end
Res.load(resources, function() {});
if (ui.SCALE() > 1) setIconScale();
Context.raw.paintObject = cast(Scene.active.getChild(".Cube"), MeshObject);
Project.paintObjects = [Context.raw.paintObject];
if (Project.filepath == "") {
iron.App.notifyOnInit(App.initLayers);
}
Context.raw.projectObjects = [];
for (m in Scene.active.meshes) Context.raw.projectObjects.push(m);
Operator.register("view_top", view_top);
}
public function update() {
@@ -1115,6 +1113,19 @@ class UIBase {
ui.inputEnabled = App.uiEnabled;
// Remember last tab positions
for (i in 0...htabs.length) {
if (htabs[i].changed) {
Config.raw.layout_tabs[i] = htabs[i].position;
Config.save();
}
}
// Set tab positions
for (i in 0...htabs.length) {
htabs[i].position = Config.raw.layout_tabs[i];
}
g.end();
ui.begin(g);
@@ -1153,6 +1164,8 @@ class UIBase {
Context.raw.lastHtab0Position = htabs[TabSidebar0].position;
#end
ui.end();
g.begin(false);
}