Faster init
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"FONT_SIZE": 13,
|
||||
"ELEMENT_W": 100,
|
||||
"ELEMENT_H": 22,
|
||||
"ELEMENT_OFFSET": 4,
|
||||
"ARROW_SIZE": 5,
|
||||
"BUTTON_H": 17,
|
||||
"CHECK_SIZE": 15,
|
||||
"CHECK_SELECT_SIZE": 8,
|
||||
"SCROLL_W": 6,
|
||||
"TEXT_OFFSET": 8,
|
||||
"TAB_W": 12,
|
||||
"LINE_STRENGTH": 1,
|
||||
"FILL_WINDOW_BG": true,
|
||||
"FILL_BUTTON_BG": true,
|
||||
"FILL_ACCENT_BG": false,
|
||||
|
||||
"WINDOW_BG_COL": "0xff333333",
|
||||
"WINDOW_TINT_COL": "0xffffffff",
|
||||
"ACCENT_COL": "0xff444444",
|
||||
"ACCENT_HOVER_COL": "0xff484848",
|
||||
"ACCENT_SELECT_COL": "0xff606060",
|
||||
"PANEL_BG_COL": "0xff333333",
|
||||
"PANEL_TEXT_COL": "0xffcac9c7",
|
||||
"BUTTON_COL": "0xff484848",
|
||||
"BUTTON_TEXT_COL": "0xffcac9c7",
|
||||
"BUTTON_HOVER_COL": "0xff3b3b3b",
|
||||
"BUTTON_PRESSED_COL": "0xff1b1b1b",
|
||||
"TEXT_COL": "0xffcac9c7",
|
||||
"LABEL_COL": "0xffaaaaaa",
|
||||
"ARROW_COL": "0xffcac9c7",
|
||||
"SEPARATOR_COL": "0xff272727",
|
||||
"HIGHLIGHT_COL": "0xff205d9c"
|
||||
}
|
||||
@@ -14,21 +14,20 @@
|
||||
"FILL_WINDOW_BG": true,
|
||||
"FILL_BUTTON_BG": true,
|
||||
"FILL_ACCENT_BG": false,
|
||||
|
||||
"WINDOW_BG_COL": "0xffefefef",
|
||||
"WINDOW_TINT_COL": "0xffffffff",
|
||||
"ACCENT_COL": "0xffaaaaaa",
|
||||
"ACCENT_HOVER_COL": "0xffbbbbbb",
|
||||
"ACCENT_SELECT_COL": "0xffaaaaaa",
|
||||
"PANEL_BG_COL": "0xffefefef",
|
||||
"PANEL_TEXT_COL": "0xff222222",
|
||||
"BUTTON_COL": "0xffcccccc",
|
||||
"BUTTON_TEXT_COL": "0xff222222",
|
||||
"BUTTON_HOVER_COL": "0xffb3b3b3",
|
||||
"BUTTON_PRESSED_COL": "0xffb1b1b1",
|
||||
"TEXT_COL": "0xff222222",
|
||||
"LABEL_COL": "0xff222222",
|
||||
"ARROW_COL": "0xff222222",
|
||||
"SEPARATOR_COL": "0xffdddddd",
|
||||
"HIGHLIGHT_COL": "0xff609ddc"
|
||||
"WINDOW_BG_COL": 4293914607,
|
||||
"WINDOW_TINT_COL": 4294967295,
|
||||
"ACCENT_COL": 4289374890,
|
||||
"ACCENT_HOVER_COL": 4290493371,
|
||||
"ACCENT_SELECT_COL": 4289374890,
|
||||
"PANEL_BG_COL": 4293914607,
|
||||
"PANEL_TEXT_COL": 4280427042,
|
||||
"BUTTON_COL": 4291611852,
|
||||
"BUTTON_TEXT_COL": 4280427042,
|
||||
"BUTTON_HOVER_COL": 4289967027,
|
||||
"BUTTON_PRESSED_COL": 4289835441,
|
||||
"TEXT_COL": 4280427042,
|
||||
"LABEL_COL": 4280427042,
|
||||
"ARROW_COL": 4280427042,
|
||||
"SEPARATOR_COL": 4292730333,
|
||||
"HIGHLIGHT_COL": 4284521948
|
||||
}
|
||||
|
||||
+74
-94
@@ -88,85 +88,84 @@ class App extends iron.Trait {
|
||||
#end
|
||||
|
||||
iron.data.Data.getFont("font_default.ttf", function(f:kha.Font) {
|
||||
iron.data.Data.getBlob("themes/theme_dark.arm", function(b:kha.Blob) {
|
||||
iron.data.Data.getImage('color_wheel.png', function(image:kha.Image) {
|
||||
font = f;
|
||||
iron.data.Data.getImage('color_wheel.png', function(image:kha.Image) {
|
||||
font = f;
|
||||
theme = zui.Themes.dark;
|
||||
theme.FILL_WINDOW_BG = true;
|
||||
|
||||
#if kha_krom // Pre-baked font texture
|
||||
var kimg:kha.Kravur.KravurImage = js.Object.create(untyped kha.Kravur.KravurImage.prototype);
|
||||
@:privateAccess kimg.mySize = 13;
|
||||
@:privateAccess kimg.width = 128;
|
||||
@:privateAccess kimg.height = 128;
|
||||
@:privateAccess kimg.baseline = 10;
|
||||
var chars = new haxe.ds.Vector(ConstData.font_x0.length);
|
||||
// kha.graphics2.Graphics.fontGlyphs = [for (i in 32...127) i];
|
||||
kha.graphics2.Graphics.fontGlyphs = [for (i in 32...206) i]; // Fix tiny font
|
||||
// for (i in 0...ConstData.font_x0.length) chars[i] = new Stbtt_bakedchar();
|
||||
for (i in 0...174) chars[i] = new Stbtt_bakedchar();
|
||||
for (i in 0...ConstData.font_x0.length) chars[i].x0 = ConstData.font_x0[i];
|
||||
for (i in 0...ConstData.font_y0.length) chars[i].y0 = ConstData.font_y0[i];
|
||||
for (i in 0...ConstData.font_x1.length) chars[i].x1 = ConstData.font_x1[i];
|
||||
for (i in 0...ConstData.font_y1.length) chars[i].y1 = ConstData.font_y1[i];
|
||||
for (i in 0...ConstData.font_xoff.length) chars[i].xoff = ConstData.font_xoff[i];
|
||||
for (i in 0...ConstData.font_yoff.length) chars[i].yoff = ConstData.font_yoff[i];
|
||||
for (i in 0...ConstData.font_xadvance.length) chars[i].xadvance = ConstData.font_xadvance[i];
|
||||
@:privateAccess kimg.chars = chars;
|
||||
iron.data.Data.getBlob("font13.bin", function(fontbin:kha.Blob) {
|
||||
@:privateAccess kimg.texture = kha.Image.fromBytes(fontbin.toBytes(), 128, 128, kha.graphics4.TextureFormat.L8);
|
||||
// @:privateAccess cast(font, kha.Kravur).images.set(130095, kimg);
|
||||
@:privateAccess cast(font, kha.Kravur).images.set(130174, kimg);
|
||||
});
|
||||
#if kha_krom // Pre-baked font texture
|
||||
var kimg:kha.Kravur.KravurImage = js.Object.create(untyped kha.Kravur.KravurImage.prototype);
|
||||
@:privateAccess kimg.mySize = 13;
|
||||
@:privateAccess kimg.width = 128;
|
||||
@:privateAccess kimg.height = 128;
|
||||
@:privateAccess kimg.baseline = 10;
|
||||
var chars = new haxe.ds.Vector(ConstData.font_x0.length);
|
||||
// kha.graphics2.Graphics.fontGlyphs = [for (i in 32...127) i];
|
||||
kha.graphics2.Graphics.fontGlyphs = [for (i in 32...206) i]; // Fix tiny font
|
||||
// for (i in 0...ConstData.font_x0.length) chars[i] = new Stbtt_bakedchar();
|
||||
for (i in 0...174) chars[i] = new Stbtt_bakedchar();
|
||||
for (i in 0...ConstData.font_x0.length) chars[i].x0 = ConstData.font_x0[i];
|
||||
for (i in 0...ConstData.font_y0.length) chars[i].y0 = ConstData.font_y0[i];
|
||||
for (i in 0...ConstData.font_x1.length) chars[i].x1 = ConstData.font_x1[i];
|
||||
for (i in 0...ConstData.font_y1.length) chars[i].y1 = ConstData.font_y1[i];
|
||||
for (i in 0...ConstData.font_xoff.length) chars[i].xoff = ConstData.font_xoff[i];
|
||||
for (i in 0...ConstData.font_yoff.length) chars[i].yoff = ConstData.font_yoff[i];
|
||||
for (i in 0...ConstData.font_xadvance.length) chars[i].xadvance = ConstData.font_xadvance[i];
|
||||
@:privateAccess kimg.chars = chars;
|
||||
iron.data.Data.getBlob("font13.bin", function(fontbin:kha.Blob) {
|
||||
@:privateAccess kimg.texture = kha.Image.fromBytes(fontbin.toBytes(), 128, 128, kha.graphics4.TextureFormat.L8);
|
||||
// @:privateAccess cast(font, kha.Kravur).images.set(130095, kimg);
|
||||
@:privateAccess cast(font, kha.Kravur).images.set(130174, kimg);
|
||||
});
|
||||
#end
|
||||
|
||||
color_wheel = image;
|
||||
zui.Nodes.getEnumTexts = getEnumTexts;
|
||||
zui.Nodes.mapEnum = mapEnum;
|
||||
uibox = new Zui({ font: f, scaleFactor: armory.data.Config.raw.window_scale });
|
||||
|
||||
iron.App.notifyOnInit(function() {
|
||||
// File to open passed as argument
|
||||
#if kha_krom
|
||||
if (Krom.getArgCount() > 1) {
|
||||
var path = Krom.getArg(1);
|
||||
if (Format.checkProjectFormat(path) ||
|
||||
Format.checkMeshFormat(path) ||
|
||||
Format.checkTextureFormat(path) ||
|
||||
Format.checkFontFormat(path)) {
|
||||
fileArg = path;
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
parseTheme(b);
|
||||
color_wheel = image;
|
||||
zui.Nodes.getEnumTexts = getEnumTexts;
|
||||
zui.Nodes.mapEnum = mapEnum;
|
||||
uibox = new Zui({ font: f, scaleFactor: armory.data.Config.raw.window_scale });
|
||||
|
||||
iron.App.notifyOnInit(function() {
|
||||
// File to open passed as argument
|
||||
#if kha_krom
|
||||
if (Krom.getArgCount() > 1) {
|
||||
var path = Krom.getArg(1);
|
||||
if (Format.checkProjectFormat(path) ||
|
||||
Format.checkMeshFormat(path) ||
|
||||
Format.checkTextureFormat(path) ||
|
||||
Format.checkFontFormat(path)) {
|
||||
fileArg = path;
|
||||
}
|
||||
iron.App.notifyOnUpdate(update);
|
||||
var root = iron.Scene.active.root;
|
||||
root.addTrait(new UITrait());
|
||||
root.addTrait(new UINodes());
|
||||
root.addTrait(new UIView2D());
|
||||
root.addTrait(new arm.trait.FlyCamera());
|
||||
root.addTrait(new arm.trait.OrbitCamera());
|
||||
root.addTrait(new arm.trait.RotateCamera());
|
||||
iron.App.notifyOnRender2D(@:privateAccess UITrait.inst.renderCursor);
|
||||
iron.App.notifyOnUpdate(@:privateAccess UINodes.inst.update);
|
||||
iron.App.notifyOnRender2D(@:privateAccess UINodes.inst.render);
|
||||
iron.App.notifyOnUpdate(@:privateAccess UITrait.inst.update);
|
||||
iron.App.notifyOnRender2D(@:privateAccess UITrait.inst.render);
|
||||
iron.App.notifyOnRender2D(render);
|
||||
appx = C.ui_layout == 0 ? UITrait.inst.toolbarw : UITrait.inst.windowW + UITrait.inst.toolbarw;
|
||||
appy = UITrait.inst.headerh * 2;
|
||||
var cam = iron.Scene.active.camera;
|
||||
cam.data.raw.fov = Std.int(cam.data.raw.fov * 100) / 100;
|
||||
cam.buildProjection();
|
||||
if (fileArg != "") {
|
||||
Importer.importFile(fileArg);
|
||||
if (Format.checkMeshFormat(fileArg)) {
|
||||
UITrait.inst.toggleDistractFree();
|
||||
}
|
||||
#end
|
||||
iron.App.notifyOnUpdate(update);
|
||||
var root = iron.Scene.active.root;
|
||||
root.addTrait(new UITrait());
|
||||
root.addTrait(new UINodes());
|
||||
root.addTrait(new UIView2D());
|
||||
root.addTrait(new arm.trait.FlyCamera());
|
||||
root.addTrait(new arm.trait.OrbitCamera());
|
||||
root.addTrait(new arm.trait.RotateCamera());
|
||||
iron.App.notifyOnRender2D(@:privateAccess UITrait.inst.renderCursor);
|
||||
iron.App.notifyOnUpdate(@:privateAccess UINodes.inst.update);
|
||||
iron.App.notifyOnRender2D(@:privateAccess UINodes.inst.render);
|
||||
iron.App.notifyOnUpdate(@:privateAccess UITrait.inst.update);
|
||||
iron.App.notifyOnRender2D(@:privateAccess UITrait.inst.render);
|
||||
iron.App.notifyOnRender2D(render);
|
||||
appx = C.ui_layout == 0 ? UITrait.inst.toolbarw : UITrait.inst.windowW + UITrait.inst.toolbarw;
|
||||
appy = UITrait.inst.headerh * 2;
|
||||
var cam = iron.Scene.active.camera;
|
||||
cam.data.raw.fov = Std.int(cam.data.raw.fov * 100) / 100;
|
||||
cam.buildProjection();
|
||||
if (fileArg != "") {
|
||||
Importer.importFile(fileArg);
|
||||
if (Format.checkMeshFormat(fileArg)) {
|
||||
UITrait.inst.toggleDistractFree();
|
||||
}
|
||||
else if (Format.checkTextureFormat(fileArg)) {
|
||||
UITrait.inst.show2DView(1);
|
||||
}
|
||||
// fileArg = "";
|
||||
else if (Format.checkTextureFormat(fileArg)) {
|
||||
UITrait.inst.show2DView(1);
|
||||
}
|
||||
});
|
||||
// fileArg = "";
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -177,25 +176,6 @@ class App extends iron.Trait {
|
||||
Project.projectSave();
|
||||
}
|
||||
|
||||
public static function parseTheme(b:kha.Blob) {
|
||||
theme = haxe.Json.parse(b.toString());
|
||||
theme.WINDOW_BG_COL = Std.parseInt(cast theme.WINDOW_BG_COL);
|
||||
theme.WINDOW_TINT_COL = Std.parseInt(cast theme.WINDOW_TINT_COL);
|
||||
theme.ACCENT_COL = Std.parseInt(cast theme.ACCENT_COL);
|
||||
theme.ACCENT_HOVER_COL = Std.parseInt(cast theme.ACCENT_HOVER_COL);
|
||||
theme.ACCENT_SELECT_COL = Std.parseInt(cast theme.ACCENT_SELECT_COL);
|
||||
theme.PANEL_BG_COL = Std.parseInt(cast theme.PANEL_BG_COL);
|
||||
theme.PANEL_TEXT_COL = Std.parseInt(cast theme.PANEL_TEXT_COL);
|
||||
theme.BUTTON_COL = Std.parseInt(cast theme.BUTTON_COL);
|
||||
theme.BUTTON_TEXT_COL = Std.parseInt(cast theme.BUTTON_TEXT_COL);
|
||||
theme.BUTTON_HOVER_COL = Std.parseInt(cast theme.BUTTON_HOVER_COL);
|
||||
theme.BUTTON_PRESSED_COL = Std.parseInt(cast theme.BUTTON_PRESSED_COL);
|
||||
theme.TEXT_COL = Std.parseInt(cast theme.TEXT_COL);
|
||||
theme.LABEL_COL = Std.parseInt(cast theme.LABEL_COL);
|
||||
theme.ARROW_COL = Std.parseInt(cast theme.ARROW_COL);
|
||||
theme.SEPARATOR_COL = Std.parseInt(cast theme.SEPARATOR_COL);
|
||||
}
|
||||
|
||||
public static function w():Int {
|
||||
// Draw material preview
|
||||
if (UITrait.inst != null && UITrait.inst.materialPreview) return arm.util.RenderUtil.matPreviewSize;
|
||||
|
||||
+19
-13
@@ -1758,19 +1758,25 @@ class UITrait extends iron.Trait {
|
||||
var themes = ["Dark", "Light"];
|
||||
ui.combo(themeHandle, themes, "Theme", true);
|
||||
if (themeHandle.changed) {
|
||||
iron.data.Data.getBlob("themes/theme_" + themes[themeHandle.position].toLowerCase() + ".arm", function(b:kha.Blob) {
|
||||
arm.App.parseTheme(b);
|
||||
ui.t = arm.App.theme;
|
||||
// UINodes.inst.applyTheme();
|
||||
headerHandle.redraws = 2;
|
||||
toolbarHandle.redraws = 2;
|
||||
statusHandle.redraws = 2;
|
||||
workspaceHandle.redraws = 2;
|
||||
menuHandle.redraws = 2;
|
||||
hwnd.redraws = 2;
|
||||
hwnd1.redraws = 2;
|
||||
hwnd2.redraws = 2;
|
||||
});
|
||||
var theme = themes[themeHandle.position].toLowerCase();
|
||||
if (theme == "dark") { // Built-in default
|
||||
arm.App.theme = zui.Themes.dark;
|
||||
}
|
||||
else {
|
||||
iron.data.Data.getBlob("themes/theme_" + theme + ".arm", function(b:kha.Blob) {
|
||||
arm.App.theme = haxe.Json.parse(b.toString());
|
||||
});
|
||||
}
|
||||
ui.t = arm.App.theme;
|
||||
// UINodes.inst.applyTheme();
|
||||
headerHandle.redraws = 2;
|
||||
toolbarHandle.redraws = 2;
|
||||
statusHandle.redraws = 2;
|
||||
workspaceHandle.redraws = 2;
|
||||
menuHandle.redraws = 2;
|
||||
hwnd.redraws = 2;
|
||||
hwnd1.redraws = 2;
|
||||
hwnd2.redraws = 2;
|
||||
}
|
||||
// var gridSnap = ui.check(Id.handle({selected: false}), "Node Grid Snap");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user