minits progress

This commit is contained in:
luboslenco
2024-05-08 21:17:02 +02:00
parent 8a9aa1c814
commit a18ff08453
32 changed files with 107 additions and 111 deletions
Binary file not shown.
Binary file not shown.
+2 -3
View File
@@ -237,9 +237,8 @@ function base_init() {
base_color_wheel = image_color_wheel;
base_color_wheel_gradient = image_color_wheel_gradient;
// zui_set_enum_texts(base_enum_texts);
zui_nodes_enum_texts = base_enum_texts;
zui_tr = tr;
// zui_tr = tr; ////
let ops: zui_options_t = {
theme: base_theme,
font: f.font_,
@@ -896,7 +895,7 @@ function base_enum_texts(node_type: string): string[] {
///if (is_paint || is_sculpt)
if (node_type == "TEX_IMAGE") {
if (project_asset_names.length > 0) {
project_asset_names;
return project_asset_names;
}
else {
let empty: string[] = [""];
+1 -1
View File
@@ -149,7 +149,7 @@ function box_export_tab_export_textures(ui: zui_t, title: string, bake_material:
let layers_destination_combo: string[] = [tr("Disk"), tr("Packed")];
context_raw.layers_destination = zui_combo(layers_destination_handle, layers_destination_combo, tr("Destination"), true);
zui_end_element();
_zui_end_element();
zui_row(row);
if (zui_button(tr("Cancel"))) {
+4 -11
View File
@@ -127,7 +127,7 @@ function box_preferences_show() {
// zui_text("Node Editor");
// let grid_snap: bool = Zui.check(Zui.handle("boxpreferences_11", { selected: false }), "Grid Snap");
zui_end_element();
_zui_end_element();
let row: f32[] = [0.5, 0.5];
zui_row(row);
if (zui_button(tr("Restore")) && !ui_menu_show) {
@@ -264,10 +264,7 @@ function box_preferences_show() {
}
}, 11);
}
let val: i32 = h.color;
if (val < 0) {
val += 4294967296;
}
let val: u32 = h.color;
h.text = i32_to_string_hex(val);
zui_text_input(h, "VIEWPORT_COL");
h.color = parse_int_hex(h.text);
@@ -291,12 +288,8 @@ function box_preferences_show() {
let key: string = zui_theme_keys[i];
let h: zui_handle_t = zui_nest(hlist, i);
let val: i32 = 0; //// theme[key];
let val: u32 = 0; //// theme[key];
let is_hex: bool = ends_with(key, "_COL");
if (is_hex && val < 0) {
val += 4294967296;
}
if (is_hex) {
let row: f32[] = [1 / 8, 7 / 8];
@@ -579,7 +572,7 @@ function box_preferences_show() {
config_raw.pressure_angle = zui_check(h_pressure_angle, tr("Brush Angle"));
///end
zui_end_element();
_zui_end_element();
let row: f32[] = [0.5];
zui_row(row);
if (zui_button(tr("Help"))) {
+6 -6
View File
@@ -91,9 +91,9 @@ function box_projects_tab(ui: zui_t) {
let imgw: i32 = math_floor(128 * zui_SCALE(ui));
let i: i32 = j + row * num;
if (i >= recent_projects.length) {
zui_end_element(imgw);
_zui_end_element(imgw);
if (show_asset_names) {
zui_end_element(0);
_zui_end_element(0);
}
continue;
}
@@ -171,9 +171,9 @@ function box_projects_tab(ui: zui_t) {
}
}
else {
zui_end_element(0);
_zui_end_element(0);
if (show_asset_names) {
zui_end_element(0);
_zui_end_element(0);
}
ui._x = uix;
}
@@ -229,7 +229,7 @@ function box_projects_recent_tab(ui: zui_t) {
}
ui.enabled = true;
zui_end_element();
_zui_end_element();
if (zui_button(tr("New .."), zui_align_t.LEFT)) {
project_new_box();
}
@@ -242,7 +242,7 @@ function box_projects_recent_tab(ui: zui_t) {
function box_projects_draw_badge(ui: zui_t) {
let img: image_t = data_get_image("badge.k");
_zui_image(img);
zui_end_element();
_zui_end_element();
}
function box_projects_get_started_tab(ui: zui_t) {
+15 -15
View File
@@ -270,21 +270,21 @@ function export_arm_export_node(n: zui_node_t, assets: asset_t[] = null) {
}
}
// Pack colors
if (n.color > 0) {
n.color -= 4294967296;
}
for (let i: i32 = 0; i < n.inputs.length; ++i) {
let inp: zui_node_socket_t = n.inputs[i];
if (inp.color > 0) {
inp.color -= 4294967296;
}
}
for (let i: i32 = 0; i < n.outputs.length; ++i) {
let out: zui_node_socket_t = n.outputs[i];
if (out.color > 0) {
out.color -= 4294967296;
}
}
// if (n.color > 0) {
// n.color -= 4294967296;
// }
// for (let i: i32 = 0; i < n.inputs.length; ++i) {
// let inp: zui_node_socket_t = n.inputs[i];
// if (inp.color > 0) {
// inp.color -= 4294967296;
// }
// }
// for (let i: i32 = 0; i < n.outputs.length; ++i) {
// let out: zui_node_socket_t = n.outputs[i];
// if (out.color > 0) {
// out.color -= 4294967296;
// }
// }
}
///if (is_paint || is_sculpt)
+2 -2
View File
@@ -289,9 +289,9 @@ function import_arm_run_project(path: string) {
l.paint_rough = ld.paint_rough;
l.paint_met = ld.paint_met;
l.paint_nor = ld.paint_nor;
l.paint_nor_blend = ld.paint_nor_blend != null ? ld.paint_nor_blend : true; // TODO: deprecated
l.paint_nor_blend = ld.paint_nor_blend;
l.paint_height = ld.paint_height;
l.paint_height_blend = ld.paint_height_blend != null ? ld.paint_height_blend : true; // TODO: deprecated
l.paint_height_blend = ld.paint_height_blend;
l.paint_emis = ld.paint_emis;
l.paint_subs = ld.paint_subs;
///end
+3 -1
View File
@@ -66,7 +66,9 @@ function import_obj_run(path: string, replace_existing: bool = true) {
for (let i: i32 = 0; i < parts.length; ++i) {
let j: i32 = i + 1;
while (j < parts.length) {
if (parts[i].name == parts[j].name) {
let iname: string = parts[i].name;
let jname: string = parts[j].name;
if (iname == jname) {
posa0 = parts[i].posa;
posa1 = parts[j].posa;
nora0 = parts[i].nora;
+2 -2
View File
@@ -5,13 +5,13 @@ type float_node_t = {
image?: image_t;
};
function float_node_create(args: f32): float_node_t {
function float_node_create(args: f32_array_t): float_node_t {
let n: float_node_t = {};
n.base = logic_node_create();
n.base.get = float_node_get;
n.base.get_as_image = float_node_get_as_image;
n.base.set = float_node_set;
n.value = args;
n.value = args[0];
return n;
}
+3 -3
View File
@@ -14,9 +14,9 @@ function vector_node_create(args: f32_array_t): vector_node_t {
n.value = vec4_create();
if (args != null) {
logic_node_add_input(n.base, float_node_create(args[0]).base, 0);
logic_node_add_input(n.base, float_node_create(args[1]).base, 0);
logic_node_add_input(n.base, float_node_create(args[2]).base, 0);
logic_node_add_input(n.base, float_node_create(f32_array_create_x(args[0])).base, 0);
logic_node_add_input(n.base, float_node_create(f32_array_create_x(args[1])).base, 0);
logic_node_add_input(n.base, float_node_create(f32_array_create_x(args[2])).base, 0);
}
return n;
+6 -2
View File
@@ -74,7 +74,9 @@ function parser_logic_safe_src(s: string): string {
}
function parser_logic_node_name(node: zui_node_t): string {
let s: string = parser_logic_safe_src(node.name) + node.id;
let safe: string = parser_logic_safe_src(node.name);
let nid: i32 = node.id;
let s: string = safe + nid;
return s;
}
@@ -131,7 +133,9 @@ function parser_logic_build_node(node: zui_node_t): string {
// Is linked - find node
let l: zui_node_link_t = parser_logic_get_input_link(inp);
if (l != null) {
inp_node = map_get(parser_logic_node_map, parser_logic_build_node(parser_logic_get_node(l.from_id)));
let n: zui_node_t = parser_logic_get_node(l.from_id);
let s: string = parser_logic_build_node(n);
inp_node = map_get(parser_logic_node_map, s);
inp_from = l.from_socket;
}
// Not linked - create node with default values
+13 -8
View File
@@ -118,7 +118,7 @@ function project_new_box() {
let project_aspect_ratio_combo: string[] = ["1:1", "2:1", "1:2"];
context_raw.project_aspect_ratio = zui_combo(h_project_aspect_ratio, project_aspect_ratio_combo, tr("Aspect Ratio"), true);
zui_end_element();
_zui_end_element();
zui_row(row);
if (zui_button(tr("Cancel"))) {
ui_box_hide();
@@ -349,6 +349,17 @@ function project_import_material() {
});
}
function project_create_node_link(links: zui_node_link_t[], from_id: i32, from_socket: i32, to_id: i32, to_socket: i32): zui_node_link_t {
let link: zui_node_link_t = {
id: zui_next_link_id(links.buffer, links.length),
from_id: from_id,
from_socket: from_socket,
to_id: to_id,
to_socket: to_socket
};
return link;
}
function project_import_brush() {
let formats: string = string_array_join(path_texture_formats, ",");
ui_files_show("arm," + formats, false, true, function (path: string) {
@@ -374,13 +385,7 @@ function project_import_brush() {
n.y = 340;
n.buttons[0].default_value = f32_array_create_x(asset_index);
let links: zui_node_link_t[] = context_raw.brush.canvas.links;
let link: zui_node_link_t = {
id: zui_next_link_id(links.buffer, links.length),
from_id: n.id,
from_socket: 0,
to_id: 0,
to_socket: 4
};
let link: zui_node_link_t = project_create_node_link(links, n.id, 0, 0, 4);
array_push(links, link);
// Parse brush
+4 -2
View File
@@ -45,8 +45,10 @@ function tab_brushes_draw(htab: zui_handle_t) {
let imgw: i32 = math_floor(50 * zui_SCALE(ui));
let i: i32 = j + row * num;
if (i >= project_brushes.length) {
zui_end_element(imgw);
if (config_raw.show_asset_names) zui_end_element(0);
_zui_end_element(imgw);
if (config_raw.show_asset_names) {
_zui_end_element(0);
}
continue;
}
let img: image_t = zui_SCALE(ui) > 1 ? project_brushes[i].image : project_brushes[i].image_icon;
+2 -2
View File
@@ -53,9 +53,9 @@ function tab_fonts_draw(htab: zui_handle_t) {
let imgw: i32 = math_floor(50 * zui_SCALE(ui));
let i: i32 = j + row * num;
if (i >= project_fonts.length) {
zui_end_element(imgw);
_zui_end_element(imgw);
if (config_raw.show_asset_names) {
zui_end_element(0);
_zui_end_element(0);
}
continue;
}
+2 -2
View File
@@ -73,9 +73,9 @@ function tab_materials_draw_slots(mini: bool) {
let imgw: i32 = math_floor(50 * zui_SCALE(ui));
let i: i32 = j + row * num;
if (i >= project_materials.length) {
zui_end_element(imgw);
_zui_end_element(imgw);
if (config_raw.show_asset_names) {
zui_end_element(0);
_zui_end_element(0);
}
continue;
}
+3 -9
View File
@@ -102,7 +102,7 @@ function tab_swatches_draw(htab: zui_handle_t) {
for (let j: i32 = 0; j < num; ++j) {
let i: i32 = j + row * num;
if (i >= project_raw.swatches.length) {
zui_end_element(slotw);
_zui_end_element(slotw);
continue;
}
@@ -207,10 +207,7 @@ function tab_swatches_draw(htab: zui_handle_t) {
else if (ui_menu_button(ui, tr("Copy Hex Code"))) {
let color: i32 = context_raw.swatch.base;
color = color_set_ab(color, context_raw.swatch.opacity * 255);
let val: i32 = color;
if (val < 0) {
val += 4294967296;
}
let val: u32 = color;
krom_copy_to_clipboard(i32_to_string(val));
}
///end
@@ -232,10 +229,7 @@ function tab_swatches_draw(htab: zui_handle_t) {
if (ui.is_hovered) {
let color: i32 = project_raw.swatches[i].base;
color = color_set_ab(color, project_raw.swatches[i].opacity * 255);
let val: i32 = color;
if (val < 0) {
val += 4294967296;
}
let val: u32 = color;
zui_tooltip("#" + i32_to_string_hex(val));
}
}
+2 -2
View File
@@ -67,9 +67,9 @@ function tab_textures_draw(htab: zui_handle_t) {
let imgw: i32 = math_floor(50 * zui_SCALE(ui));
let i: i32 = j + row * num;
if (i >= project_assets.length) {
zui_end_element(imgw);
_zui_end_element(imgw);
if (config_raw.show_asset_names) {
zui_end_element(0);
_zui_end_element(0);
}
continue;
}
+1 -1
View File
@@ -157,7 +157,7 @@ function translator_init_font(cjk: bool, font_path: string, font_scale: f32) {
let f: g2_font_t = data_get_font(font_path);
if (cjk) {
let font_index: i32 = map_get(translator_cjk_font_indices, config_raw.locale) != null ? map_get(translator_cjk_font_indices, config_raw.locale) : 0;
let font_index: i32 = map_get(translator_cjk_font_indices, config_raw.locale) != -1 ? map_get(translator_cjk_font_indices, config_raw.locale) : 0;
g2_font_set_font_index(f, font_index);
}
base_font = f;
+7 -4
View File
@@ -79,10 +79,13 @@ function ui_box_render() {
if (zui_tab(zui_handle(__ID__), ui_box_title, tab_vertical)) {
let htext: zui_handle_t = zui_handle(__ID__);
htext.text = ui_box_text;
ui_box_copyable ?
zui_text_area(htext, zui_align_t.LEFT, false) :
if (ui_box_copyable) {
zui_text_area(htext, zui_align_t.LEFT, false);
}
else {
zui_text(ui_box_text);
zui_end_element();
}
_zui_end_element();
///if (krom_windows || krom_linux || krom_darwin)
if (ui_box_copyable) {
@@ -98,7 +101,7 @@ function ui_box_render() {
zui_row(row);
///end
zui_end_element();
_zui_end_element();
///if (krom_windows || krom_linux || krom_darwin)
if (ui_box_copyable && zui_button(tr("Copy"))) {
+2 -2
View File
@@ -152,8 +152,8 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo
for (let j: i32 = 0; j < num; ++j) {
let i: i32 = j + row * num;
if (i >= ui_files_files.length) {
zui_end_element(slotw);
zui_end_element(slotw);
_zui_end_element(slotw);
_zui_end_element(slotw);
continue;
}
+3 -3
View File
@@ -593,7 +593,7 @@ function ui_menu_render() {
let img: image_t = data_get_image("badge.k");
_zui_image(img);
zui_end_element();
_zui_end_element();
let h: zui_handle_t = zui_handle(__ID__);
if (h.init) {
@@ -609,7 +609,7 @@ function ui_menu_render() {
krom_copy_to_clipboard(_ui_menu_render_msg);
}
///else
zui_end_element();
_zui_end_element();
///end
if (zui_button(tr("Contributors"))) {
@@ -713,7 +713,7 @@ function ui_menu_align(ui: zui_t) {
if (!config_raw.touch_ui) {
let row: f32[] = [12 / 100, 88 / 100];
zui_row(row);
zui_end_element();
_zui_end_element();
}
}
+2 -5
View File
@@ -200,11 +200,8 @@ function ui_menubar_show_menu(ui: zui_t, category: i32) {
}
function ui_menubar_icon_button(ui: zui_t, i: i32, j: i32): bool {
let col: i32 = ui.ops.theme.WINDOW_BG_COL;
if (col < 0) {
col += 4294967296;
}
let light: bool = col > (0xff666666 + 4294967296);
let col: u32 = ui.ops.theme.WINDOW_BG_COL;
let light: bool = col > 0xff666666 ;
let icon_accent: i32 = light ? 0xff666666 : 0xffaaaaaa;
let img: image_t = resource_get("icons.k");
let rect: rect_t = resource_tile50(img, i, j);
+1 -1
View File
@@ -943,7 +943,7 @@ function ui_nodes_render() {
}
if (!found) {
zui_remove_node(canvas_node, c);
array_remove(nodes.nodes_selected_id, canvas_node.id);
i32_array_remove(nodes.nodes_selected_id, canvas_node.id);
i--;
}
}
+2 -5
View File
@@ -84,11 +84,8 @@ function ui_toolbar_render_ui() {
ui.image_scroll_align = false;
let img: image_t = resource_get("icons.k");
let col: i32 = ui.ops.theme.WINDOW_BG_COL;
if (col < 0) {
col += 4294967296;
}
let light: bool = col > (0xff666666 + 4294967296);
let col: u32 = ui.ops.theme.WINDOW_BG_COL;
let light: bool = col > 0xff666666;
let icon_accent: i32 = light ? 0xff666666 : -1;
// Properties icon