diff --git a/armorforge/sources/tab_objects.ts b/armorforge/sources/tab_objects.ts index ea47fa1e..b137a368 100644 --- a/armorforge/sources/tab_objects.ts +++ b/armorforge/sources/tab_objects.ts @@ -13,7 +13,7 @@ function tab_objects_import_mesh_done() { object_set_parent(mo.base, null); } -function tab_objects_draw_menu(ui: zui_t) { +function tab_objects_draw_menu(ui: ui_t) { if (ui_menu_button(ui, "Assign Material")) { tab_objects_material_id++; @@ -45,7 +45,7 @@ function tab_objects_draw_menu(ui: zui_t) { } } -function tab_objects_draw_list(ui: zui_t, list_handle: zui_handle_t, current_object: object_t) { +function tab_objects_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object: object_t) { if (char_at(current_object.name, 0) == ".") { return; // Hidden } @@ -54,42 +54,42 @@ function tab_objects_draw_list(ui: zui_t, list_handle: zui_handle_t, current_obj // Highlight every other line if (tab_objects_line_counter % 2 == 0) { g2_set_color(ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, ui._y, ui._window_w, zui_ELEMENT_H(ui)); + g2_fill_rect(0, ui._y, ui._window_w, ui_ELEMENT_H(ui)); g2_set_color(0xffffffff); } // Highlight selected line if (current_object == context_raw.selected_object) { g2_set_color(0xff205d9c); - g2_fill_rect(0, ui._y, ui._window_w, zui_ELEMENT_H(ui)); + g2_fill_rect(0, ui._y, ui._window_w, ui_ELEMENT_H(ui)); g2_set_color(0xffffffff); } if (current_object.children.length > 0) { let row: f32[] = [1 / 13, 12 / 13]; - zui_row(row); - let h: zui_handle_t = zui_nest(list_handle, tab_objects_line_counter); + ui_row(row); + let h: ui_handle_t = ui_nest(list_handle, tab_objects_line_counter); if (h.init) { h.selected = true; } - b = zui_panel(h, "", true, false); - zui_text(current_object.name); + b = ui_panel(h, "", true, false); + ui_text(current_object.name); } else { ui._x += 18; // Sign offset // Draw line that shows parent relations g2_set_color(ui.ops.theme.ACCENT_COL); - g2_draw_line(ui._x - 10, ui._y + zui_ELEMENT_H(ui) / 2, ui._x, ui._y + zui_ELEMENT_H(ui) / 2); + g2_draw_line(ui._x - 10, ui._y + ui_ELEMENT_H(ui) / 2, ui._x, ui._y + ui_ELEMENT_H(ui) / 2); g2_set_color(0xffffffff); - zui_text(current_object.name); + ui_text(current_object.name); ui._x -= 18; } tab_objects_line_counter++; // Undo applied offset for row drawing caused by end_element() - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); if (ui.is_released) { context_raw.selected_object = current_object; @@ -111,48 +111,48 @@ function tab_objects_draw_list(ui: zui_t, list_handle: zui_handle_t, current_obj // Draw line that shows parent relations g2_set_color(ui.ops.theme.ACCENT_COL); - g2_draw_line(ui._x + 14, current_y, ui._x + 14, ui._y - zui_ELEMENT_H(ui) / 2); + g2_draw_line(ui._x + 14, current_y, ui._x + 14, ui._y - ui_ELEMENT_H(ui) / 2); g2_set_color(0xffffffff); } } -function tab_objects_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("Objects"))) { - zui_begin_sticky(); +function tab_objects_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("Objects"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4]; - zui_row(row); - if (zui_button("Import")) { + ui_row(row); + if (ui_button("Import")) { project_import_mesh(false, tab_objects_import_mesh_done); } - zui_end_sticky(); + ui_end_sticky(); - let outliner_handle: zui_handle_t = zui_handle(__ID__); + let outliner_handle: ui_handle_t = ui_handle(__ID__); if (outliner_handle.init) { outliner_handle.selected = true; } - if (zui_panel(outliner_handle, "Outliner", true, false)) { - ui._y -= zui_ELEMENT_OFFSET(ui); + if (ui_panel(outliner_handle, "Outliner", true, false)) { + ui._y -= ui_ELEMENT_OFFSET(ui); tab_objects_line_counter = 0; for (let i: i32 = 0; i < _scene_root.children.length; ++i) { let c: object_t = _scene_root.children[i]; - tab_objects_draw_list(ui, zui_handle(__ID__), c); + tab_objects_draw_list(ui, ui_handle(__ID__), c); } } - let properties_handle: zui_handle_t = zui_handle(__ID__); + let properties_handle: ui_handle_t = ui_handle(__ID__); if (properties_handle.init) { properties_handle.selected = true; } - if (zui_panel(properties_handle, "Properties", true, false)) { + if (ui_panel(properties_handle, "Properties", true, false)) { if (context_raw.selected_object != null) { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); h.selected = context_raw.selected_object.visible; - context_raw.selected_object.visible = zui_check(h, "Visible"); + context_raw.selected_object.visible = ui_check(h, "Visible"); let t: transform_t = context_raw.selected_object.transform; let local_pos: vec4_t = t.loc; @@ -163,53 +163,53 @@ function tab_objects_draw(htab: zui_handle_t) { let f: f32 = 0.0; let row: f32[] = [1 / 4, 1 / 4, 1 / 4, 1 / 4]; - zui_row(row); - zui_text("Loc"); + ui_row(row); + ui_text("Loc"); - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(local_pos.x); - f = parse_float(zui_text_input(h, "X")); + f = parse_float(ui_text_input(h, "X")); if (h.changed) { local_pos.x = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(local_pos.y); - f = parse_float(zui_text_input(h, "Y")); + f = parse_float(ui_text_input(h, "Y")); if (h.changed) { local_pos.y = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(local_pos.z); - f = parse_float(zui_text_input(h, "Z")); + f = parse_float(ui_text_input(h, "Z")); if (h.changed) { local_pos.z = f; } - zui_row(row); - zui_text("Rotation"); + ui_row(row); + ui_text("Rotation"); - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(rot.x); - f = parse_float(zui_text_input(h, "X")); + f = parse_float(ui_text_input(h, "X")); let changed: bool = false; if (h.changed) { changed = true; rot.x = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(rot.y); - f = parse_float(zui_text_input(h, "Y")); + f = parse_float(ui_text_input(h, "Y")); if (h.changed) { changed = true; rot.y = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(rot.z); - f = parse_float(zui_text_input(h, "Z")); + f = parse_float(ui_text_input(h, "Z")); if (h.changed) { changed = true; rot.z = f; @@ -224,50 +224,50 @@ function tab_objects_draw(htab: zui_handle_t) { // ///end } - zui_row(row); - zui_text("Scale"); + ui_row(row); + ui_text("Scale"); - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(scale.x); - f = parse_float(zui_text_input(h, "X")); + f = parse_float(ui_text_input(h, "X")); if (h.changed) { scale.x = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(scale.y); - f = parse_float(zui_text_input(h, "Y")); + f = parse_float(ui_text_input(h, "Y")); if (h.changed) { scale.y = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(scale.z); - f = parse_float(zui_text_input(h, "Z")); + f = parse_float(ui_text_input(h, "Z")); if (h.changed) { scale.z = f; } - zui_row(row); - zui_text("Dimensions"); + ui_row(row); + ui_text("Dimensions"); - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(dim.x); - f = parse_float(zui_text_input(h, "X")); + f = parse_float(ui_text_input(h, "X")); if (h.changed) { dim.x = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(dim.y); - f = parse_float(zui_text_input(h, "Y")); + f = parse_float(ui_text_input(h, "Y")); if (h.changed) { dim.y = f; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); h.text = f32_to_string_prec(dim.z); - f = parse_float(zui_text_input(h, "Z")); + f = parse_float(ui_text_input(h, "Z")); if (h.changed) { dim.z = f; } @@ -277,24 +277,24 @@ function tab_objects_draw(htab: zui_handle_t) { if (context_raw.selected_object.name == "Scene") { let p: world_data_t = scene_world; - let p_handle: zui_handle_t = zui_handle(__ID__); + let p_handle: ui_handle_t = ui_handle(__ID__); if (p_handle.init) { p_handle.value = p.strength; } - p.strength = zui_slider(p_handle, "Environment", 0.0, 5.0, true); + p.strength = ui_slider(p_handle, "Environment", 0.0, 5.0, true); } else if (context_raw.selected_object.ext_type == "light_object_t") { let light: light_object_t = context_raw.selected_object.ext; - let light_handle: zui_handle_t = zui_handle(__ID__); + let light_handle: ui_handle_t = ui_handle(__ID__); light_handle.value = light.data.strength / 10; - light.data.strength = zui_slider(light_handle, "Strength", 0.0, 5.0, true) * 10; + light.data.strength = ui_slider(light_handle, "Strength", 0.0, 5.0, true) * 10; } else if (context_raw.selected_object.ext_type == "camera_object_t") { let cam: camera_object_t = context_raw.selected_object.ext; - let fov_handle: zui_handle_t = zui_handle(__ID__); + let fov_handle: ui_handle_t = ui_handle(__ID__); fov_handle.value = math_floor(cam.data.fov * 100) / 100; - cam.data.fov = zui_slider(fov_handle, "FoV", 0.3, 2.0, true); + cam.data.fov = ui_slider(fov_handle, "FoV", 0.3, 2.0, true); if (fov_handle.changed) { camera_object_build_proj(cam); } diff --git a/armorlab/sources/nodes/image_texture_node.ts b/armorlab/sources/nodes/image_texture_node.ts index ff30322c..6bdc4a7e 100644 --- a/armorlab/sources/nodes/image_texture_node.ts +++ b/armorlab/sources/nodes/image_texture_node.ts @@ -24,7 +24,7 @@ function image_texture_node_get_cached_image(self: image_texture_node_t): image_ return image; } -let image_texture_node_def: zui_node_t = { +let image_texture_node_def: ui_node_t = { id: 0, name: _tr("Image Texture"), type: "image_texture_node", diff --git a/armorlab/sources/nodes/inpaint_node.ts b/armorlab/sources/nodes/inpaint_node.ts index 88c84930..1a167844 100644 --- a/armorlab/sources/nodes/inpaint_node.ts +++ b/armorlab/sources/nodes/inpaint_node.ts @@ -48,17 +48,17 @@ function inpaint_node_init() { } } -function inpaint_node_buttons(ui: zui_t, nodes: zui_nodes_t, node: zui_node_t) { +function inpaint_node_buttons(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t) { inpaint_node_auto = node.buttons[0].default_value == 0 ? false : true; if (!inpaint_node_auto) { - let inpaint_node_strength_handle: zui_handle_t = zui_handle(__ID__); + let inpaint_node_strength_handle: ui_handle_t = ui_handle(__ID__); if (inpaint_node_strength_handle.init) { inpaint_node_strength_handle.value = inpaint_node_strength; } - inpaint_node_strength = zui_slider(inpaint_node_strength_handle, tr("strength"), 0, 1, true); - inpaint_node_prompt = zui_text_area(zui_handle(__ID__), zui_align_t.LEFT, true, tr("prompt"), true); + inpaint_node_strength = ui_slider(inpaint_node_strength_handle, tr("strength"), 0, 1, true); + inpaint_node_prompt = ui_text_area(ui_handle(__ID__), ui_align_t.LEFT, true, tr("prompt"), true); node.buttons[1].height = 1 + string_split(inpaint_node_prompt, "\n").length; } else { @@ -194,7 +194,7 @@ function inpaint_node_sd_inpaint(image: image_t, mask: image_t): image_t { // } } -let inpaint_node_def: zui_node_t = { +let inpaint_node_def: ui_node_t = { id: 0, name: _tr("Inpaint"), type: "inpaint_node", diff --git a/armorlab/sources/nodes/photo_to_pbr_node.ts b/armorlab/sources/nodes/photo_to_pbr_node.ts index f635390e..f1733e7f 100644 --- a/armorlab/sources/nodes/photo_to_pbr_node.ts +++ b/armorlab/sources/nodes/photo_to_pbr_node.ts @@ -177,7 +177,7 @@ function photo_to_pbr_node_bgra_swap(buffer: buffer_t) { } ///end -let photo_to_pbr_node_def: zui_node_t = { +let photo_to_pbr_node_def: ui_node_t = { id: 0, name: _tr("Photo to PBR"), type: "photo_to_pbr_node", diff --git a/armorlab/sources/nodes/rgb_node.ts b/armorlab/sources/nodes/rgb_node.ts index b82b2ecc..7e76b846 100644 --- a/armorlab/sources/nodes/rgb_node.ts +++ b/armorlab/sources/nodes/rgb_node.ts @@ -20,7 +20,7 @@ function rgb_node_get_as_image(self: rgb_node_t, from: i32): image_t { } let f32a: f32_array_t = f32_array_create(4); - let raw: zui_node_t = parser_logic_get_raw_node(self.base); + let raw: ui_node_t = parser_logic_get_raw_node(self.base); let default_value: f32_array_t = raw.outputs[0].default_value; f32a[0] = default_value[0]; f32a[1] = default_value[1]; @@ -35,7 +35,7 @@ function rgb_node_get_cached_image(self: rgb_node_t): image_t { return self.image; } -let rgb_node_def: zui_node_t = { +let rgb_node_def: ui_node_t = { id: 0, name: _tr("RGB"), type: "rgb_node", diff --git a/armorlab/sources/nodes/text_to_photo_node.ts b/armorlab/sources/nodes/text_to_photo_node.ts index 53911c6d..06ed31ea 100644 --- a/armorlab/sources/nodes/text_to_photo_node.ts +++ b/armorlab/sources/nodes/text_to_photo_node.ts @@ -27,9 +27,9 @@ function text_to_photo_node_get_cached_image(self: text_to_photo_node_t): image_ return text_to_photo_node_image; } -function text_to_photo_node_buttons(ui: zui_t, nodes: zui_nodes_t, node: zui_node_t) { +function text_to_photo_node_buttons(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t) { text_to_photo_node_tiling = node.buttons[0].default_value == 0 ? false : true; - text_to_photo_node_prompt = zui_text_area(zui_handle(__ID__), zui_align_t.LEFT, true, tr("prompt"), true); + text_to_photo_node_prompt = ui_text_area(ui_handle(__ID__), ui_align_t.LEFT, true, tr("prompt"), true); node.buttons[1].height = string_split(text_to_photo_node_prompt, "\n").length; } @@ -255,7 +255,7 @@ function text_to_photo_node_vae_decoder(latents: f32_array_t, upscale: bool): im } } -let text_to_photo_node_def: zui_node_t = { +let text_to_photo_node_def: ui_node_t = { id: 0, name: _tr("Text to Photo"), type: "text_to_photo_node", diff --git a/armorlab/sources/nodes/tiling_node.ts b/armorlab/sources/nodes/tiling_node.ts index 76ef41d9..687011fa 100644 --- a/armorlab/sources/nodes/tiling_node.ts +++ b/armorlab/sources/nodes/tiling_node.ts @@ -24,16 +24,16 @@ function tiling_node_init() { } } -function tiling_node_buttons(ui: zui_t, nodes: zui_nodes_t, node: zui_node_t) { +function tiling_node_buttons(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t) { tiling_node_auto = node.buttons[0].default_value == 0 ? false : true; if (!tiling_node_auto) { - let tiling_node_strength_handle: zui_handle_t = zui_handle(__ID__); + let tiling_node_strength_handle: ui_handle_t = ui_handle(__ID__); if (tiling_node_strength_handle.init) { tiling_node_strength_handle.value = tiling_node_strength; } - tiling_node_strength = zui_slider(tiling_node_strength_handle, tr("strength"), 0, 1, true); - tiling_node_prompt = zui_text_area(zui_handle(__ID__), zui_align_t.LEFT, true, tr("prompt"), true); + tiling_node_strength = ui_slider(tiling_node_strength_handle, tr("strength"), 0, 1, true); + tiling_node_prompt = ui_text_area(ui_handle(__ID__), ui_align_t.LEFT, true, tr("prompt"), true); node.buttons[1].height = 1 + string_split(tiling_node_prompt, "\n").length; } else { @@ -101,7 +101,7 @@ function tiling_node_sd_tiling(image: image_t, seed: i32): image_t { return inpaint_node_sd_inpaint(tile, mask); } -let tiling_node_def: zui_node_t = { +let tiling_node_def: ui_node_t = { id: 0, name: _tr("Tiling"), type: "tiling_node", diff --git a/armorlab/sources/nodes/upscale_node.ts b/armorlab/sources/nodes/upscale_node.ts index 7099c778..69f826fb 100644 --- a/armorlab/sources/nodes/upscale_node.ts +++ b/armorlab/sources/nodes/upscale_node.ts @@ -125,7 +125,7 @@ function upscale_node_esrgan(source: image_t): image_t { return result; } -let upscale_node_def: zui_node_t = { +let upscale_node_def: ui_node_t = { id: 0, name: _tr("Upscale"), type: "upscale_node", diff --git a/armorlab/sources/nodes/variance_node.ts b/armorlab/sources/nodes/variance_node.ts index 7be0dc63..79426c3f 100644 --- a/armorlab/sources/nodes/variance_node.ts +++ b/armorlab/sources/nodes/variance_node.ts @@ -26,8 +26,8 @@ function variance_node_init() { } } -function variance_node_buttons(ui: zui_t, nodes: zui_nodes_t, node: zui_node_t) { - variance_node_prompt = zui_text_area(zui_handle(__ID__), zui_align_t.LEFT, true, tr("prompt"), true); +function variance_node_buttons(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t) { + variance_node_prompt = ui_text_area(ui_handle(__ID__), ui_align_t.LEFT, true, tr("prompt"), true); node.buttons[0].height = string_split(variance_node_prompt, "\n").length; } @@ -80,7 +80,7 @@ function variance_node_get_cached_image(self: variance_node_t): image_t { return variance_node_image; } -let variance_node_def: zui_node_t = { +let variance_node_def: ui_node_t = { id: 0, name: _tr("Variance"), type: "variance_node", diff --git a/armorlab/sources/nodes_brush.ts b/armorlab/sources/nodes_brush.ts index 176099b4..7db97601 100644 --- a/armorlab/sources/nodes_brush.ts +++ b/armorlab/sources/nodes_brush.ts @@ -1,12 +1,12 @@ let nodes_brush_categories: string[] = [_tr("Input"), _tr("Model")]; -let nodes_brush_input: zui_node_t[] = [ +let nodes_brush_input: ui_node_t[] = [ image_texture_node_def, rgb_node_def, ]; -let nodes_brush_model: zui_node_t[] = [ +let nodes_brush_model: ui_node_t[] = [ inpaint_node_def, photo_to_pbr_node_def, text_to_photo_node_def, @@ -35,15 +35,15 @@ function nodes_brush_init() { map_set(nodes_brush_creates, "variance_node", variance_node_create); } -function nodes_brush_create_node(node_type: string): zui_node_t { +function nodes_brush_create_node(node_type: string): ui_node_t { for (let i: i32 = 0; i < nodes_brush_list.length; ++i) { let c: node_list_t = nodes_brush_list[i]; for (let j: i32 = 0; j < c.length; ++j) { - let n: zui_node_t = c[j]; + let n: ui_node_t = c[j]; if (n.type == node_type) { - let canvas: zui_node_canvas_t = project_canvas; - let nodes: zui_nodes_t = project_nodes; - let node: zui_node_t = ui_nodes_make_node(n, nodes, canvas); + let canvas: ui_node_canvas_t = project_canvas; + let nodes: ui_nodes_t = project_nodes; + let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas); array_push(canvas.nodes, node); return node; } diff --git a/armorlab/sources/render_path_paint.ts b/armorlab/sources/render_path_paint.ts index 59eb0354..dd2aaf2c 100644 --- a/armorlab/sources/render_path_paint.ts +++ b/armorlab/sources/render_path_paint.ts @@ -161,9 +161,9 @@ function render_path_paint_commands_cursor() { return; } - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let inpaint: bool = nodes.nodes_selected_id.length > 0 && zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; if (!base_ui_enabled || base_is_dragging || !inpaint) { return; @@ -259,10 +259,10 @@ function render_path_paint_draw() { function render_path_paint_bind_layers() { let image: image_t = null; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); if (nodes.nodes_selected_id.length > 0) { - let node: zui_node_t = zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); + let node: ui_node_t = ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); let brush_node: logic_node_t = parser_logic_get_logic_node(node); if (brush_node != null) { image = logic_node_get_cached_image(brush_node); @@ -290,9 +290,9 @@ function render_path_paint_bind_layers() { render_path_bind_target("texpaint_nor_empty", "texpaint_nor"); render_path_bind_target("texpaint_pack_empty", "texpaint_pack"); - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let node: zui_node_t = zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let node: ui_node_t = ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); let inpaint: bool = node.type == "InpaintNode"; if (inpaint) { map_get(render_path_render_targets, "texpaint_node_target")._image = inpaint_node_get_target(); diff --git a/armorlab/sources/ui_nodes_ext.ts b/armorlab/sources/ui_nodes_ext.ts index 23058053..00ae870b 100644 --- a/armorlab/sources/ui_nodes_ext.ts +++ b/armorlab/sources/ui_nodes_ext.ts @@ -6,8 +6,8 @@ function ui_nodes_ext_delay_idle_sleep() { } function ui_nodes_ext_draw_buttons(ew: f32, start_y: f32) { - let ui: zui_t = ui_nodes_ui; - if (zui_button(tr("Run"))) { + let ui: ui_t = ui_nodes_ui; + if (ui_button(tr("Run"))) { app_notify_on_render_2d(ui_nodes_ext_delay_idle_sleep); @@ -123,10 +123,10 @@ function ui_nodes_ext_draw_buttons(ew: f32, start_y: f32) { ///if (krom_android || krom_ios) let base_res_combo: string[] = ["2K", "4K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution")); + ui_combo(base_res_handle, base_res_combo, tr("Resolution")); ///else let base_res_combo: string[] = ["2K", "4K", "8K", "16K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution")); + ui_combo(base_res_handle, base_res_combo, tr("Resolution")); ///end if (base_res_handle.changed) { base_on_layers_resized(); diff --git a/armorpaint/assets/plugins/converter.js b/armorpaint/assets/plugins/converter.js index 4d856b2f..d1f9bc83 100644 --- a/armorpaint/assets/plugins/converter.js +++ b/armorpaint/assets/plugins/converter.js @@ -1,11 +1,11 @@ let plugin = plugin_create(); -let h1 = zui_handle_create(); +let h1 = ui_handle_create(); plugin_notify_on_ui(plugin, function() { - if (zui_panel(h1, "Converter")) { - zui_row([1 / 2, 1 / 2]); - if (zui_button(".arm to .json")) { + if (ui_panel(h1, "Converter")) { + ui_row([1 / 2, 1 / 2]); + if (ui_button(".arm to .json")) { ui_files_show("arm", false, true, function(path) { let b = data_get_blob(path); let parsed = armpack_decode(b); @@ -13,7 +13,7 @@ plugin_notify_on_ui(plugin, function() { krom_file_save_bytes(path.substr(0, path.length - 3) + "json", out); }); } - if (zui_button(".json to .arm")) { + if (ui_button(".json to .arm")) { ui_files_show("json", false, true, function(path) { let b = data_get_blob(path); let parsed = JSON.parse(buffer_to_string(b)); diff --git a/armorpaint/assets/plugins/hello_world.js b/armorpaint/assets/plugins/hello_world.js index d90514fb..a9847e27 100644 --- a/armorpaint/assets/plugins/hello_world.js +++ b/armorpaint/assets/plugins/hello_world.js @@ -1,31 +1,31 @@ let plugin = plugin_create(); -let h0 = zui_handle_create(); -let h1 = zui_handle_create(); -let h2 = zui_handle_create(); -let h3 = zui_handle_create(); -let h4 = zui_handle_create(); -let h5 = zui_handle_create(); -let h6 = zui_handle_create(); +let h0 = ui_handle_create(); +let h1 = ui_handle_create(); +let h2 = ui_handle_create(); +let h3 = ui_handle_create(); +let h4 = ui_handle_create(); +let h5 = ui_handle_create(); +let h6 = ui_handle_create(); plugin_notify_on_ui(plugin, function() { - if (zui_panel(h0, "My Plugin")) { - zui_text("Label"); - zui_text_input(h1, "Text Input"); - if (zui_button("Button")) { + if (ui_panel(h0, "My Plugin")) { + ui_text("Label"); + ui_text_input(h1, "Text Input"); + if (ui_button("Button")) { console_info("Hello"); } - zui_row([1 / 2, 1 / 2]); - zui_button("Button A"); - zui_button("Button B"); - zui_combo(h2, ["Item 1", "Item 2"], "Combo"); - zui_row([1 / 2, 1 / 2]); - zui_slider(h3, "Slider", 0, 1, true); - zui_slider(h4, "Slider", 0, 1, true); - zui_check(h5, "Check"); - zui_radio(h6, 0, "Radio 1"); - zui_radio(h6, 1, "Radio 2"); - zui_radio(h6, 2, "Radio 3"); + ui_row([1 / 2, 1 / 2]); + ui_button("Button A"); + ui_button("Button B"); + ui_combo(h2, ["Item 1", "Item 2"], "Combo"); + ui_row([1 / 2, 1 / 2]); + ui_slider(h3, "Slider", 0, 1, true); + ui_slider(h4, "Slider", 0, 1, true); + ui_check(h5, "Check"); + ui_radio(h6, 0, "Radio 1"); + ui_radio(h6, 1, "Radio 2"); + ui_radio(h6, 2, "Radio 3"); } }); diff --git a/armorpaint/assets/plugins/uv_unwrap.js b/armorpaint/assets/plugins/uv_unwrap.js index 175e1b44..d2811674 100644 --- a/armorpaint/assets/plugins/uv_unwrap.js +++ b/armorpaint/assets/plugins/uv_unwrap.js @@ -5,10 +5,10 @@ function unwrap_mesh(mesh) { proc_xatlas_unwrap(mesh); } -// let h1 = zui_handle_create(); +// let h1 = ui_handle_create(); // plugin_notify_on_ui(plugin, function() { -// if (zui_panel(h1, "UV Unwrap")) { -// if (zui_button("Unwrap Mesh")) { +// if (ui_panel(h1, "UV Unwrap")) { +// if (ui_button("Unwrap Mesh")) { // for (let po of project_paint_objects) { // unwrap_mesh(mesh); // mesh_data_build(); diff --git a/armorpaint/plugins/io_fbx/io_fbx.c b/armorpaint/plugins/io_fbx/io_fbx.c index 6b770e9b..62384eff 100644 --- a/armorpaint/plugins/io_fbx/io_fbx.c +++ b/armorpaint/plugins/io_fbx/io_fbx.c @@ -2,7 +2,7 @@ #include #include #include "iron_array.h" -#include "io_obj.h" +#include "iron_obj.h" static bool has_next = false; static int current_node = 0; diff --git a/armorpaint/plugins/io_gltf/cgltf.c b/armorpaint/plugins/io_gltf/cgltf.c index bab283cc..66b2bd9f 100644 --- a/armorpaint/plugins/io_gltf/cgltf.c +++ b/armorpaint/plugins/io_gltf/cgltf.c @@ -3,7 +3,7 @@ #include "cgltf.h" #include #include "iron_array.h" -#include "io_obj.h" +#include "iron_obj.h" uint32_t *io_gltf_read_u8_array(cgltf_accessor *a) { cgltf_buffer_view *v = a->buffer_view; diff --git a/armorpaint/plugins/io_usd/io_usd.cc b/armorpaint/plugins/io_usd/io_usd.cc index b4a10c99..275ee257 100644 --- a/armorpaint/plugins/io_usd/io_usd.cc +++ b/armorpaint/plugins/io_usd/io_usd.cc @@ -1,7 +1,7 @@ #include #include #include "tinyusdz/tinyusdz.hh" -#include "io_obj.h" +#include "iron_obj.h" #include "iron_array.h" extern "C" void *io_usd_parse(uint8_t *buf, size_t size) { diff --git a/armorpaint/plugins/proc_xatlas/xatlas.cpp b/armorpaint/plugins/proc_xatlas/xatlas.cpp index 8038e806..55a5e0a7 100644 --- a/armorpaint/plugins/proc_xatlas/xatlas.cpp +++ b/armorpaint/plugins/proc_xatlas/xatlas.cpp @@ -10055,7 +10055,7 @@ void xatlasPackOptionsInit(xatlasPackOptions *packOptions) extern "C" { #endif -#include +#include void proc_xatlas_unwrap(raw_mesh_t *mesh) { int vertex_count = mesh->posa->length / 4; @@ -10113,7 +10113,7 @@ void proc_xatlas_unwrap(raw_mesh_t *mesh) { mesh->posa->length = vertex_count_out * 4; mesh->nora->buffer = na_out; mesh->nora->length = vertex_count_out * 2; - mesh->texa = (i16_array_t*)malloc(sizeof(i16_array_t)); + mesh->texa = (i16_array_t *)malloc(sizeof(i16_array_t)); mesh->texa->buffer = ta_out; mesh->texa->length = vertex_count_out * 2; mesh->inda->buffer = ia_out; diff --git a/armorpaint/sources/import_folder.ts b/armorpaint/sources/import_folder.ts index 36da10d9..09521e31 100644 --- a/armorpaint/sources/import_folder.ts +++ b/armorpaint/sources/import_folder.ts @@ -64,22 +64,22 @@ function import_folder_run(path: string) { // Create material context_raw.material = slot_material_create(project_materials[0].data); array_push(project_materials, context_raw.material); - let nodes: zui_nodes_t = context_raw.material.nodes; - let canvas: zui_node_canvas_t = context_raw.material.canvas; + let nodes: ui_nodes_t = context_raw.material.nodes; + let canvas: ui_node_canvas_t = context_raw.material.canvas; let dirs: string[] = string_split(path, path_sep); canvas.name = dirs[dirs.length - 1]; - let nout: zui_node_t = null; + let nout: ui_node_t = null; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.type == "OUTPUT_MATERIAL_PBR") { nout = n; break; } } for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.name == "RGB") { - zui_remove_node(n, canvas); + ui_remove_node(n, canvas); break; } } @@ -123,13 +123,13 @@ function import_folder_run(path: string) { history_new_material(); } -function import_folder_place_image_node(nodes: zui_nodes_t, canvas: zui_node_canvas_t, asset: string, ny: i32, to_id: i32, to_socket: i32) { - let n: zui_node_t = nodes_material_create_node("TEX_IMAGE"); +function import_folder_place_image_node(nodes: ui_nodes_t, canvas: ui_node_canvas_t, asset: string, ny: i32, to_id: i32, to_socket: i32) { + let n: ui_node_t = nodes_material_create_node("TEX_IMAGE"); n.buttons[0].default_value = f32_array_create_x(base_get_asset_index(asset)); n.x = 72; n.y = ny; - let l: zui_node_link_t = { - id: zui_next_link_id(canvas.links), + let l: ui_node_link_t = { + id: ui_next_link_id(canvas.links), from_id: n.id, from_socket: 0, to_id: to_id, diff --git a/armorpaint/sources/make_material.ts b/armorpaint/sources/make_material.ts index 22cd8ce0..b71ba184 100644 --- a/armorpaint/sources/make_material.ts +++ b/armorpaint/sources/make_material.ts @@ -8,7 +8,7 @@ let make_material_subs_used: bool = false; function make_material_get_mout(): bool { for (let i: i32 = 0; i < ui_nodes_get_canvas_material().nodes.length; ++i) { - let n: zui_node_t = ui_nodes_get_canvas_material().nodes[i]; + let n: ui_node_t = ui_nodes_get_canvas_material().nodes[i]; if (n.type == "OUTPUT_MATERIAL_PBR") { return true; } @@ -273,7 +273,7 @@ function make_material_bake_node_previews() { if (context_raw.node_previews == null) { context_raw.node_previews = map_create(); } - let empty: zui_node_t[] = []; + let empty: ui_node_t[] = []; make_material_traverse_nodes(ui_nodes_get_canvas_material().nodes, null, empty); let keys: string[] = map_keys(context_raw.node_previews); @@ -289,9 +289,9 @@ function make_material_bake_node_previews() { } } -function make_material_traverse_nodes(nodes: zui_node_t[], group: zui_node_canvas_t, parents: zui_node_t[]) { +function make_material_traverse_nodes(nodes: ui_node_t[], group: ui_node_canvas_t, parents: ui_node_t[]) { for (let i: i32 = 0; i < nodes.length; ++i) { - let node: zui_node_t = nodes[i]; + let node: ui_node_t = nodes[i]; make_material_bake_node_preview(node, group, parents); if (node.type == "GROUP") { for (let j: i32 = 0; j < project_material_groups.length; ++j) { @@ -307,7 +307,7 @@ function make_material_traverse_nodes(nodes: zui_node_t[], group: zui_node_canva } } -function make_material_bake_node_preview(node: zui_node_t, group: zui_node_canvas_t, parents: zui_node_t[]) { +function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_t, parents: ui_node_t[]) { if (node.type == "BLUR") { let id: string = parser_material_node_name(node, parents); let image: image_t = map_get(context_raw.node_previews, id); @@ -400,7 +400,7 @@ type parse_node_preview_result_t = { mcon: material_context_t; }; -function make_material_parse_node_preview_material(node: zui_node_t, group: zui_node_canvas_t = null, parents: zui_node_t[] = null): parse_node_preview_result_t { +function make_material_parse_node_preview_material(node: ui_node_t, group: ui_node_canvas_t = null, parents: ui_node_t[] = null): parse_node_preview_result_t { if (node.outputs.length == 0) { return null; } diff --git a/armorpaint/sources/make_node_preview.ts b/armorpaint/sources/make_node_preview.ts index b054b2bf..eb40ea55 100644 --- a/armorpaint/sources/make_node_preview.ts +++ b/armorpaint/sources/make_node_preview.ts @@ -1,5 +1,5 @@ -function make_node_preview_run(data: material_t, matcon: material_context_t, node: zui_node_t, group: zui_node_canvas_t, parents: zui_node_t[]): node_shader_context_t { +function make_node_preview_run(data: material_t, matcon: material_context_t, node: ui_node_t, group: ui_node_canvas_t, parents: ui_node_t[]): node_shader_context_t { let context_id: string = "mesh"; let props: shader_context_t = { name: context_id, @@ -49,9 +49,9 @@ function make_node_preview_run(data: material_t, matcon: material_context_t, nod parser_material_push_group(group); parser_material_parents = parents; } - let links: zui_node_link_t[] = parser_material_links; - let link: zui_node_link_t = { - id: zui_next_link_id(links), + let links: ui_node_link_t[] = parser_material_links; + let link: ui_node_link_t = { + id: ui_next_link_id(links), from_id: node.id, from_socket: context_raw.node_preview_socket, to_id: -1, diff --git a/armorpaint/sources/make_paint.ts b/armorpaint/sources/make_paint.ts index 4010c7e5..7de93275 100644 --- a/armorpaint/sources/make_paint.ts +++ b/armorpaint/sources/make_paint.ts @@ -361,6 +361,8 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } else { // Brush cursor mask node_shader_write(frag, "float str = clamp((brush_radius - dist) * brush_hardness * 400.0, 0.0, 1.0) * opacity;"); + // node_shader_write(frag, "float str = pow(clamp(1.0 - (dist / brush_radius), 0.0, 1.0), 1.0 - brush_hardness) * opacity;"); + // node_shader_write(frag, "float t = clamp(dist / brush_radius, 0.0, 1.0); float falloff = 1.0 - smoothstep(0.0, 1.0, t); float str = pow(falloff, 1.0 / max(brush_hardness, 0.01)) * opacity;"); } // Manual blending to preserve memory diff --git a/armorpaint/sources/nodes/input_node.ts b/armorpaint/sources/nodes/input_node.ts index eaf2dc99..bc92336a 100644 --- a/armorpaint/sources/nodes/input_node.ts +++ b/armorpaint/sources/nodes/input_node.ts @@ -132,7 +132,7 @@ function input_node_get(self: input_node_t, from: i32): logic_node_value_t { return v; } -let input_node_def: zui_node_t = { +let input_node_def: ui_node_t = { id: 0, name: _tr("Input"), type: "input_node", diff --git a/armorpaint/sources/nodes/tex_image_node.ts b/armorpaint/sources/nodes/tex_image_node.ts index 452013e1..fd10283e 100644 --- a/armorpaint/sources/nodes/tex_image_node.ts +++ b/armorpaint/sources/nodes/tex_image_node.ts @@ -23,7 +23,7 @@ function tex_image_node_get(self: tex_image_node_t, from: i32): logic_node_value } } -let tex_image_node_def: zui_node_t = { +let tex_image_node_def: ui_node_t = { id: 0, name: _tr("Image Texture"), type: "tex_image_node", diff --git a/armorpaint/sources/nodes_brush.ts b/armorpaint/sources/nodes_brush.ts index 57dba265..d5679e81 100644 --- a/armorpaint/sources/nodes_brush.ts +++ b/armorpaint/sources/nodes_brush.ts @@ -3,7 +3,7 @@ let nodes_brush_categories: string[] = [ _tr("Nodes") ]; -let nodes_brush_category0: zui_node_t[]; +let nodes_brush_category0: ui_node_t[]; let nodes_brush_list: node_list_t[]; let nodes_brush_creates: map_tlogic_node_ext_t>; @@ -37,15 +37,15 @@ function nodes_brush_init() { ]; } -function nodes_brush_create_node(node_type: string): zui_node_t { +function nodes_brush_create_node(node_type: string): ui_node_t { for (let i: i32 = 0; i < nodes_brush_list.length; ++i) { - let c: zui_node_t[] = nodes_brush_list[i]; + let c: ui_node_t[] = nodes_brush_list[i]; for (let i: i32 = 0; i < c.length; ++i) { - let n: zui_node_t = c[i]; + let n: ui_node_t = c[i]; if (n.type == node_type) { - let canvas: zui_node_canvas_t = context_raw.brush.canvas; - let nodes: zui_nodes_t = context_raw.brush.nodes; - let node: zui_node_t = ui_nodes_make_node(n, nodes, canvas); + let canvas: ui_node_canvas_t = context_raw.brush.canvas; + let nodes: ui_nodes_t = context_raw.brush.nodes; + let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas); array_push(canvas.nodes, node); return node; } diff --git a/armorpaint/sources/slot_brush.ts b/armorpaint/sources/slot_brush.ts index 95ab5564..bd51fd69 100644 --- a/armorpaint/sources/slot_brush.ts +++ b/armorpaint/sources/slot_brush.ts @@ -1,7 +1,7 @@ type slot_brush_t = { - nodes?: zui_nodes_t; - canvas?: zui_node_canvas_t; + nodes?: ui_nodes_t; + canvas?: ui_node_canvas_t; image?: image_t; // 200px image_icon?: image_t; // 50px preview_ready?: bool; @@ -10,9 +10,9 @@ type slot_brush_t = { let slot_brush_default_canvas: buffer_t = null; -function slot_brush_create(c: zui_node_canvas_t = null): slot_brush_t { +function slot_brush_create(c: ui_node_canvas_t = null): slot_brush_t { let raw: slot_brush_t = {}; - raw.nodes = zui_nodes_create(); + raw.nodes = ui_nodes_create(); raw.preview_ready = false; raw.id = 0; diff --git a/armorpaint/sources/slot_material.ts b/armorpaint/sources/slot_material.ts index d4bb817a..a1f3723f 100644 --- a/armorpaint/sources/slot_material.ts +++ b/armorpaint/sources/slot_material.ts @@ -1,7 +1,7 @@ type slot_material_t = { - nodes?: zui_nodes_t; - canvas?: zui_node_canvas_t; + nodes?: ui_nodes_t; + canvas?: ui_node_canvas_t; image?: image_t; image_icon?: image_t; preview_ready?: bool; @@ -20,9 +20,9 @@ type slot_material_t = { let slot_material_default_canvas: buffer_t = null; -function slot_material_create(m: material_data_t = null, c: zui_node_canvas_t = null): slot_material_t { +function slot_material_create(m: material_data_t = null, c: ui_node_canvas_t = null): slot_material_t { let raw: slot_material_t = {}; - raw.nodes = zui_nodes_create(); + raw.nodes = ui_nodes_create(); raw.preview_ready = false; raw.id = 0; raw.paint_base = true; diff --git a/armorpaint/sources/tab_layers.ts b/armorpaint/sources/tab_layers.ts index 08809d6f..ef2171ef 100644 --- a/armorpaint/sources/tab_layers.ts +++ b/armorpaint/sources/tab_layers.ts @@ -1,28 +1,28 @@ let tab_layers_layer_name_edit: i32 = -1; -let tab_layers_layer_name_handle: zui_handle_t = zui_handle_create(); +let tab_layers_layer_name_handle: ui_handle_t = ui_handle_create(); let tab_layers_show_context_menu: bool = false; -function tab_layers_draw(htab: zui_handle_t) { +function tab_layers_draw(htab: ui_handle_t) { let mini: bool = config_raw.layout[layout_size_t.SIDEBAR_W] <= ui_base_sidebar_mini_w; mini ? tab_layers_draw_mini(htab) : tab_layers_draw_full(htab); } -function tab_layers_draw_mini(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - zui_set_hovered_tab_name(tr("Layers")); +function tab_layers_draw_mini(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + ui_set_hovered_tab_name(tr("Layers")); let _ELEMENT_H: i32 = ui.ops.theme.ELEMENT_H; - ui.ops.theme.ELEMENT_H = math_floor(ui_base_sidebar_mini_w / 2 / zui_SCALE(ui)); + ui.ops.theme.ELEMENT_H = math_floor(ui_base_sidebar_mini_w / 2 / ui_SCALE(ui)); - zui_begin_sticky(); - zui_separator(5); + ui_begin_sticky(); + ui_separator(5); tab_layers_combo_filter(); tab_layers_button_2d_view(); tab_layers_button_new("+"); - zui_end_sticky(); + ui_end_sticky(); ui._y += 2; tab_layers_highlight_odd_lines(); @@ -31,18 +31,18 @@ function tab_layers_draw_mini(htab: zui_handle_t) { ui.ops.theme.ELEMENT_H = _ELEMENT_H; } -function tab_layers_draw_full(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("Layers"))) { - zui_begin_sticky(); +function tab_layers_draw_full(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("Layers"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 2]; - zui_row(row); + ui_row(row); tab_layers_button_new(tr("New")); tab_layers_button_2d_view(); tab_layers_combo_filter(); - zui_end_sticky(); + ui_end_sticky(); ui._y += 2; tab_layers_highlight_odd_lines(); @@ -51,12 +51,12 @@ function tab_layers_draw_full(htab: zui_handle_t) { } function tab_layers_button_2d_view() { - let ui: zui_t = ui_base_ui; - if (zui_button(tr("2D View"))) { + let ui: ui_t = ui_base_ui; + if (ui_button(tr("2D View"))) { ui_base_show_2d_view(view_2d_type_t.LAYER); } else if (ui.is_hovered) { - zui_tooltip(tr("Show 2D View") + " (" + map_get(config_keymap, "toggle_2d_view") + ")"); + ui_tooltip(tr("Show 2D View") + " (" + map_get(config_keymap, "toggle_2d_view") + ")"); } } @@ -72,19 +72,19 @@ function tab_layers_draw_slots(mini: bool) { } function tab_layers_highlight_odd_lines() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H * 2; let full_h: i32 = ui._window_h - ui_base_hwnds[0].scroll_offset; for (let i: i32 = 0; i < math_floor(full_h / step); ++i) { if (i % 2 == 0) { - zui_fill(0, i * step, (ui._w / zui_SCALE(ui) - 2), step, ui.ops.theme.WINDOW_BG_COL - 0x00040404); + ui_fill(0, i * step, (ui._w / ui_SCALE(ui) - 2), step, ui.ops.theme.WINDOW_BG_COL - 0x00040404); } } } function tab_layers_button_new(text: string) { - if (zui_button(text)) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(text)) { + ui_menu_draw(function (ui: ui_t) { let l: slot_layer_t = context_raw.layer; if (ui_menu_button(ui, tr("Paint Layer"))) { base_new_layer(); @@ -179,9 +179,9 @@ function tab_layers_combo_filter() { array_push(ar, a); } } - let filter_handle: zui_handle_t = zui_handle(__ID__); + let filter_handle: ui_handle_t = ui_handle(__ID__); filter_handle.position = context_raw.layer_filter; - context_raw.layer_filter = zui_combo(filter_handle, ar, tr("Filter"), false, zui_align_t.LEFT); + context_raw.layer_filter = ui_combo(filter_handle, ar, tr("Filter"), false, ui_align_t.LEFT); if (filter_handle.changed) { for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let p: mesh_object_t = project_paint_objects[i]; @@ -209,9 +209,9 @@ function tab_layers_combo_filter() { } } -function tab_layers_remap_layer_pointers(nodes: zui_node_t[], pointer_map: map_t) { +function tab_layers_remap_layer_pointers(nodes: ui_node_t[], pointer_map: map_t) { for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = nodes[i]; + let n: ui_node_t = nodes[i]; if (n.type == "LAYER" || n.type == "LAYER_MASK") { let i: i32 = n.buttons[0].default_value[0]; if (map_get(pointer_map, i) != -1) { @@ -247,7 +247,7 @@ function tab_layers_set_drag_layer(layer: slot_layer_t, off_x: f32, off_y: f32) } function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; if (context_raw.layer_filter > 0 && slot_layer_get_object_mask(l) > 0 && @@ -263,7 +263,7 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { } let step: i32 = ui.ops.theme.ELEMENT_H; - let checkw: f32 = (ui._window_w / 100 * 8) / zui_SCALE(ui); + let checkw: f32 = (ui._window_w / 100 * 8) / ui_SCALE(ui); // Highlight drag destination let absy: f32 = ui._window_y + ui._y; @@ -278,14 +278,14 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { let nested_group: bool = slot_layer_is_group(base_drag_layer) && to_group; if (!nested_group) { if (slot_layer_can_move(context_raw.layer, context_raw.drag_dest)) { - zui_fill(checkw, step * 2, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, step * 2, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } else if (i == project_layers.length - 1 && mouse_y < absy + step) { context_raw.drag_dest = project_layers.length - 1; if (slot_layer_can_move(context_raw.layer, context_raw.drag_dest)) { - zui_fill(checkw, 0, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 0, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } @@ -293,13 +293,13 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { if (mouse_y > absy + step && mouse_y < absy + step * 3) { context_raw.drag_dest = i; if (tab_layers_can_drop_new_layer(i)) { - zui_fill(checkw, 2 * step, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 2 * step, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } else if (i == project_layers.length - 1 && mouse_y < absy + step) { context_raw.drag_dest = project_layers.length; if (tab_layers_can_drop_new_layer(project_layers.length)) { - zui_fill(checkw, 0, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 0, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } @@ -314,39 +314,39 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { } function tab_layers_draw_layer_slot_mini(l: slot_layer_t, i: i32) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let row: f32[] = [1, 1]; - zui_row(row); + ui_row(row); let uix: f32 = ui._x; let uiy: f32 = ui._y; - let state: zui_state_t = tab_layers_draw_layer_icon(l, i, uix, uiy, true); + let state: ui_state_t = tab_layers_draw_layer_icon(l, i, uix, uiy, true); tab_layers_handle_layer_icon_state(l, i, state, uix, uiy); - _zui_end_element(); + _ui_end_element(); - ui._y += zui_ELEMENT_H(ui); - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y += ui_ELEMENT_H(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); } function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H; let has_panel: bool = slot_layer_is_group(l) || (slot_layer_is_layer(l) && slot_layer_get_masks(l, false) != null); if (has_panel) { let row: f32[] = [8 / 100, 16 / 100, 36 / 100, 30 / 100, 10 / 100]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [8 / 100, 16 / 100, 36 / 100, 30 / 100]; - zui_row(row); + ui_row(row); } // Draw eye icon let icons: image_t = resource_get("icons.k"); let r: rect_t = resource_tile18(icons, l.visible ? 0 : 1, 0); - let center: f32 = (step / 2) * zui_SCALE(ui); + let center: f32 = (step / 2) * ui_SCALE(ui); ui._x += 2; ui._y += 3; ui._y += center; @@ -356,7 +356,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { col -= 0x99000000; } - if (_zui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == zui_state_t.RELEASED) { + if (_ui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { tab_layers_layer_toggle_visible(l); } ui._x -= 2; @@ -372,17 +372,17 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui._x += 2; ui._y += 3; if (l.parent != null) { - ui._x += 10 * zui_SCALE(ui); - if (l.parent.parent != null) ui._x += 10 * zui_SCALE(ui); + ui._x += 10 * ui_SCALE(ui); + if (l.parent.parent != null) ui._x += 10 * ui_SCALE(ui); } - let state: zui_state_t = tab_layers_draw_layer_icon(l, i, uix, uiy, false); + let state: ui_state_t = tab_layers_draw_layer_icon(l, i, uix, uiy, false); ui._x -= 2; ui._y -= 3; if (config_raw.touch_ui) { - ui._x += 12 * zui_SCALE(ui); + ui._x += 12 * ui_SCALE(ui); } ///if krom_opengl @@ -395,13 +395,13 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui._y += center; if (tab_layers_layer_name_edit == l.id) { tab_layers_layer_name_handle.text = l.name; - l.name = zui_text_input(tab_layers_layer_name_handle); + l.name = ui_text_input(tab_layers_layer_name_handle); if (ui.text_selected_handle != tab_layers_layer_name_handle) tab_layers_layer_name_edit = -1; } else { if (ui.enabled && ui.input_enabled && ui.combo_selected_handle == null && ui.input_x > ui._window_x + ui._x && ui.input_x < ui._window_x + ui._window_w && - ui.input_y > ui._window_y + ui._y - center && ui.input_y < ui._window_y + ui._y - center + (step * zui_SCALE(ui)) * 2) { + ui.input_y > ui._window_y + ui._y - center && ui.input_y < ui._window_y + ui._y - center + (step * ui_SCALE(ui)) * 2) { if (ui.input_started) { context_set_layer(l); tab_layers_set_drag_layer(context_raw.layer, -(mouse_x - uix - ui._window_x - 3), -(mouse_y - uiy - ui._window_y + 1)); @@ -412,12 +412,12 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { } } - let state: zui_state_t = zui_text(l.name); - if (state == zui_state_t.RELEASED) { + let state: ui_state_t = ui_text(l.name); + if (state == ui_state_t.RELEASED) { if (time_time() - context_raw.select_time < 0.25) { tab_layers_layer_name_edit = l.id; tab_layers_layer_name_handle.text = l.name; - zui_start_text_edit(tab_layers_layer_name_handle); + ui_start_text_edit(tab_layers_layer_name_handle); } context_raw.select_time = time_time(); } @@ -434,12 +434,12 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui._y -= center; if (l.parent != null) { - ui._x -= 10 * zui_SCALE(ui); - if (l.parent.parent != null) ui._x -= 10 * zui_SCALE(ui); + ui._x -= 10 * ui_SCALE(ui); + if (l.parent.parent != null) ui._x -= 10 * ui_SCALE(ui); } if (slot_layer_is_group(l)) { - _zui_end_element(); + _ui_end_element(); } else { if (slot_layer_is_mask(l)) { @@ -455,37 +455,37 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { if (has_panel) { ui._y += center; - let layer_panel: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let layer_panel: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); layer_panel.selected = l.show_panel; - l.show_panel = zui_panel(layer_panel, "", true, false); + l.show_panel = ui_panel(layer_panel, "", true, false); ui._y -= center; } if (slot_layer_is_group(l) || slot_layer_is_mask(l)) { - ui._y -= zui_ELEMENT_OFFSET(ui); - _zui_end_element(); + ui._y -= ui_ELEMENT_OFFSET(ui); + _ui_end_element(); } else { - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); let row: f32[] = [8 / 100, 16 / 100, 36 / 100, 30 / 100, 10 / 100]; - zui_row(row); - _zui_end_element(); - _zui_end_element(); - _zui_end_element(); + ui_row(row); + _ui_end_element(); + _ui_end_element(); + _ui_end_element(); if (config_raw.touch_ui) { - ui._x += 12 * zui_SCALE(ui); + ui._x += 12 * ui_SCALE(ui); } tab_layers_combo_object(ui, l); - _zui_end_element(); + _ui_end_element(); } - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); } -function tab_layers_combo_object(ui: zui_t, l: slot_layer_t, label: bool = false): zui_handle_t { +function tab_layers_combo_object(ui: ui_t, l: slot_layer_t, label: bool = false): ui_handle_t { let ar: string[] = [tr("Shared")]; for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let p: mesh_object_t = project_paint_objects[i]; @@ -498,9 +498,9 @@ function tab_layers_combo_object(ui: zui_t, l: slot_layer_t, label: bool = false array_push(ar, a); } } - let object_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let object_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); object_handle.position = l.object_mask; - l.object_mask = zui_combo(object_handle, ar, tr("Object"), label, zui_align_t.LEFT); + l.object_mask = ui_combo(object_handle, ar, tr("Object"), label, ui_align_t.LEFT); if (object_handle.changed) { context_set_layer(l); make_material_parse_mesh_material(); @@ -518,8 +518,8 @@ function tab_layers_combo_object(ui: zui_t, l: slot_layer_t, label: bool = false return object_handle; } -function tab_layers_combo_blending(ui: zui_t, l: slot_layer_t, label: bool = false): zui_handle_t { - let blending_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); +function tab_layers_combo_blending(ui: ui_t, l: slot_layer_t, label: bool = false): ui_handle_t { + let blending_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); blending_handle.position = l.blending; let blending_combo: string[] = [ tr("Mix"), @@ -541,7 +541,7 @@ function tab_layers_combo_blending(ui: zui_t, l: slot_layer_t, label: bool = fal tr("Color"), tr("Value"), ]; - zui_combo(blending_handle, blending_combo, tr("Blending"), label); + ui_combo(blending_handle, blending_combo, tr("Blending"), label); if (blending_handle.changed) { context_set_layer(l); history_layer_blending(); @@ -558,25 +558,25 @@ function tab_layers_layer_toggle_visible(l: slot_layer_t) { } function tab_layers_draw_layer_highlight(l: slot_layer_t, mini: bool) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H; // Separator line - zui_fill(0, 0, (ui._w / zui_SCALE(ui) - 2), 1 * zui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 0, (ui._w / ui_SCALE(ui) - 2), 1 * ui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); // Highlight selected if (context_raw.layer == l) { if (mini) { - zui_rect(1, -step * 2, ui._w / zui_SCALE(ui) - 1, step * 2 + (mini ? -1 : 1), ui.ops.theme.HIGHLIGHT_COL, 3); + ui_rect(1, -step * 2, ui._w / ui_SCALE(ui) - 1, step * 2 + (mini ? -1 : 1), ui.ops.theme.HIGHLIGHT_COL, 3); } else { - zui_rect(1, -step * 2 - 1, ui._w / zui_SCALE(ui) - 2, step * 2 + (mini ? -2 : 1), ui.ops.theme.HIGHLIGHT_COL, 2); + ui_rect(1, -step * 2 - 1, ui._w / ui_SCALE(ui) - 2, step * 2 + (mini ? -2 : 1), ui.ops.theme.HIGHLIGHT_COL, 2); } } } -function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: zui_state_t, uix: f32, uiy: f32) { - let ui: zui_t = ui_base_ui; +function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: ui_state_t, uix: f32, uiy: f32) { + let ui: ui_t = ui_base_ui; ///if is_paint let texpaint_preview: image_t = l.texpaint_preview; @@ -591,17 +591,17 @@ function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: zui_ if (ui.is_hovered && texpaint_preview != null) { if (slot_layer_is_mask(l)) { tab_layers_make_mask_preview_rgba32(l); - _zui_tooltip_image(context_raw.mask_preview_rgba32); + _ui_tooltip_image(context_raw.mask_preview_rgba32); } else { - _zui_tooltip_image(texpaint_preview); + _ui_tooltip_image(texpaint_preview); } if (i < 9) { let i1: i32 = (i + 1); - zui_tooltip(l.name + " - (" + map_get(config_keymap, "select_layer") + " " + i1 + ")"); + ui_tooltip(l.name + " - (" + map_get(config_keymap, "select_layer") + " " + i1 + ")"); } else { - zui_tooltip(l.name); + ui_tooltip(l.name); } } @@ -611,11 +611,11 @@ function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: zui_ tab_layers_show_context_menu = true; } - if (state == zui_state_t.STARTED) { + if (state == ui_state_t.STARTED) { context_set_layer(l); tab_layers_set_drag_layer(context_raw.layer, -(mouse_x - uix - ui._window_x - 3), -(mouse_y - uiy - ui._window_y + 1)); } - else if (state == zui_state_t.RELEASED) { + else if (state == ui_state_t.RELEASED) { if (time_time() - context_raw.select_time < 0.2) { ui_base_show_2d_view(view_2d_type_t.LAYER); } @@ -628,13 +628,13 @@ function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: zui_ } } -function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, mini: bool): zui_state_t { - let ui: zui_t = ui_base_ui; +function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, mini: bool): ui_state_t { + let ui: ui_t = ui_base_ui; let icons: image_t = resource_get("icons.k"); - let icon_h: i32 = (zui_ELEMENT_H(ui) - (mini ? 2 : 3)) * 2; + let icon_h: i32 = (ui_ELEMENT_H(ui) - (mini ? 2 : 3)) * 2; - if (mini && zui_SCALE(ui) > 1) { - ui._x -= 1 * zui_SCALE(ui); + if (mini && ui_SCALE(ui) > 1) { + ui._x -= 1 * ui_SCALE(ui); } if (l.parent != null) { @@ -661,7 +661,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, let _x: f32 = ui._x; let _y: f32 = ui._y; let _w: f32 = ui._w; - _zui_image(icons, 0xffffffff, icon_h, r.x, r.y, r.w, r.h); + _ui_image(icons, 0xffffffff, icon_h, r.x, r.y, r.w, r.h); ui.current_ratio--; ui._x = _x; ui._y = _y; @@ -675,7 +675,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, krom_g4_set_int(ui_view2d_channel_loc, 1); } - let state: zui_state_t = _zui_image(icon, 0xffffffff, icon_h); + let state: ui_state_t = _ui_image(icon, 0xffffffff, icon_h); if (l.fill_layer == null && slot_layer_is_mask(l)) { g2_set_pipeline(null); @@ -701,7 +701,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, let folder_closed: rect_t = resource_tile50(icons, 2, 1); let folder_open: rect_t = resource_tile50(icons, 8, 1); let folder: rect_t = l.show_panel ? folder_open : folder_closed; - return _zui_image(icons, ui.ops.theme.LABEL_COL - 0x00202020, icon_h, folder.x, folder.y, folder.w, folder.h); + return _ui_image(icons, ui.ops.theme.LABEL_COL - 0x00202020, icon_h, folder.x, folder.y, folder.w, folder.h); } } @@ -758,16 +758,16 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { tab_layers_l = l; tab_layers_mini = mini; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let l: slot_layer_t = tab_layers_l; let mini: bool = tab_layers_mini; if (mini) { - let visible_handle: zui_handle_t = zui_handle(__ID__); + let visible_handle: ui_handle_t = ui_handle(__ID__); visible_handle.selected = l.visible; ui_menu_fill(ui); - zui_check(visible_handle, tr("Visible")); + ui_check(visible_handle, tr("Visible")); if (visible_handle.changed) { tab_layers_layer_toggle_visible(l); ui_menu_keep_open = true; @@ -904,9 +904,9 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_fill(ui); ui_menu_align(ui); - let layer_opac_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let layer_opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); layer_opac_handle.value = l.mask_opacity; - zui_slider(layer_opac_handle, tr("Opacity"), 0.0, 1.0, true); + ui_slider(layer_opac_handle, tr("Opacity"), 0.0, 1.0, true); if (layer_opac_handle.changed) { if (ui.input_started) { history_layer_opacity(); @@ -927,7 +927,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ///end let _y: i32 = ui._y; base_res_handle.value = base_res_handle.position; - base_res_handle.position = math_floor(zui_slider(base_res_handle, ar[base_res_handle.position], 0, ar.length - 1, false, 1, false, zui_align_t.LEFT, false)); + base_res_handle.position = math_floor(ui_slider(base_res_handle, ar[base_res_handle.position], 0, ar.length - 1, false, 1, false, ui_align_t.LEFT, false)); if (base_res_handle.changed) { ui_menu_keep_open = true; } @@ -935,17 +935,17 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { base_on_layers_resized(); } ui._y = _y; - zui_draw_string(tr("Res"), -1, 0, zui_align_t.RIGHT, true); - _zui_end_element(); + ui_draw_string(tr("Res"), -1, 0, ui_align_t.RIGHT, true); + _ui_end_element(); ui_menu_fill(ui); ui_menu_align(ui); ///if (krom_android || krom_ios) let bits_items: string[] = ["8bit"]; - zui_inline_radio(base_bits_handle, bits_items, zui_align_t.LEFT); + ui_inline_radio(base_bits_handle, bits_items, ui_align_t.LEFT); ///else let bits_items: string[] = ["8bit", "16bit", "32bit"]; - zui_inline_radio(base_bits_handle, bits_items, zui_align_t.LEFT); + ui_inline_radio(base_bits_handle, bits_items, ui_align_t.LEFT); ///end if (base_bits_handle.changed) { app_notify_on_init(base_set_layer_bits); @@ -956,9 +956,9 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { if (l.fill_layer != null) { ui_menu_fill(ui); ui_menu_align(ui); - let scale_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let scale_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); scale_handle.value = l.scale; - l.scale = zui_slider(scale_handle, tr("UV Scale"), 0.0, 5.0, true); + l.scale = ui_slider(scale_handle, tr("UV Scale"), 0.0, 5.0, true); if (scale_handle.changed) { context_set_material(l.fill_layer); context_set_layer(l); @@ -970,9 +970,9 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_fill(ui); ui_menu_align(ui); - let angle_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let angle_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); angle_handle.value = l.angle; - l.angle = zui_slider(angle_handle, tr("Angle"), 0.0, 360, true, 1); + l.angle = ui_slider(angle_handle, tr("Angle"), 0.0, 360, true, 1); if (angle_handle.changed) { context_set_material(l.fill_layer); context_set_layer(l); @@ -985,10 +985,10 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_fill(ui); ui_menu_align(ui); - let uv_type_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let uv_type_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); uv_type_handle.position = l.uv_type; let uv_type_items: string[] = [tr("UV Map"), tr("Triplanar"), tr("Project")]; - l.uv_type = zui_inline_radio(uv_type_handle, uv_type_items, zui_align_t.LEFT); + l.uv_type = ui_inline_radio(uv_type_handle, uv_type_items, ui_align_t.LEFT); if (uv_type_handle.changed) { context_set_material(l.fill_layer); context_set_layer(l); @@ -1001,17 +1001,17 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { } if (!slot_layer_is_group(l)) { - let base_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let opac_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let nor_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let nor_blend_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let occ_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let rough_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let met_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let height_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let height_blend_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let emis_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); - let subs_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let base_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let nor_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let nor_blend_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let occ_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let rough_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let met_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let height_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let height_blend_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let emis_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); + let subs_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); base_handle.selected = l.paint_base; opac_handle.selected = l.paint_opac; nor_handle.selected = l.paint_nor; @@ -1024,27 +1024,27 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { emis_handle.selected = l.paint_emis; subs_handle.selected = l.paint_subs; ui_menu_fill(ui); - l.paint_base = zui_check(base_handle, tr("Base Color")); + l.paint_base = ui_check(base_handle, tr("Base Color")); ui_menu_fill(ui); - l.paint_opac = zui_check(opac_handle, tr("Opacity")); + l.paint_opac = ui_check(opac_handle, tr("Opacity")); ui_menu_fill(ui); - l.paint_nor = zui_check(nor_handle, tr("Normal")); + l.paint_nor = ui_check(nor_handle, tr("Normal")); ui_menu_fill(ui); - l.paint_nor_blend = zui_check(nor_blend_handle, tr("Normal Blending")); + l.paint_nor_blend = ui_check(nor_blend_handle, tr("Normal Blending")); ui_menu_fill(ui); - l.paint_occ = zui_check(occ_handle, tr("Occlusion")); + l.paint_occ = ui_check(occ_handle, tr("Occlusion")); ui_menu_fill(ui); - l.paint_rough = zui_check(rough_handle, tr("Roughness")); + l.paint_rough = ui_check(rough_handle, tr("Roughness")); ui_menu_fill(ui); - l.paint_met = zui_check(met_handle, tr("Metallic")); + l.paint_met = ui_check(met_handle, tr("Metallic")); ui_menu_fill(ui); - l.paint_height = zui_check(height_handle, tr("Height")); + l.paint_height = ui_check(height_handle, tr("Height")); ui_menu_fill(ui); - l.paint_height_blend = zui_check(height_blend_handle, tr("Height Blending")); + l.paint_height_blend = ui_check(height_blend_handle, tr("Height Blending")); ui_menu_fill(ui); - l.paint_emis = zui_check(emis_handle, tr("Emission")); + l.paint_emis = ui_check(emis_handle, tr("Emission")); ui_menu_fill(ui); - l.paint_subs = zui_check(subs_handle, tr("Subsurface")); + l.paint_subs = ui_check(subs_handle, tr("Subsurface")); if (base_handle.changed || opac_handle.changed || nor_handle.changed || diff --git a/armorsculpt/sources/make_material.ts b/armorsculpt/sources/make_material.ts index 15439162..df3f5d2c 100644 --- a/armorsculpt/sources/make_material.ts +++ b/armorsculpt/sources/make_material.ts @@ -8,7 +8,7 @@ let make_material_subs_used: bool = false; function make_material_get_mout(): bool { for (let i: i32 = 0; i < ui_nodes_get_canvas_material().nodes.length; ++i) { - let n: zui_node_t = ui_nodes_get_canvas_material().nodes[i]; + let n: ui_node_t = ui_nodes_get_canvas_material().nodes[i]; if (n.type == "OUTPUT_MATERIAL_PBR") { return true; } @@ -270,7 +270,7 @@ function make_material_bake_node_previews() { if (context_raw.node_previews == null) { context_raw.node_previews = map_create(); } - let empty: zui_node_t[] = []; + let empty: ui_node_t[] = []; make_material_traverse_nodes(ui_nodes_get_canvas_material().nodes, null, empty); let keys: string[] = map_keys(context_raw.node_previews); @@ -286,9 +286,9 @@ function make_material_bake_node_previews() { } } -function make_material_traverse_nodes(nodes: zui_node_t[], group: zui_node_canvas_t, parents: zui_node_t[]) { +function make_material_traverse_nodes(nodes: ui_node_t[], group: ui_node_canvas_t, parents: ui_node_t[]) { for (let i: i32 = 0; i < nodes.length; ++i) { - let node: zui_node_t = nodes[i]; + let node: ui_node_t = nodes[i]; make_material_bake_node_preview(node, group, parents); if (node.type == "GROUP") { for (let j: i32 = 0; j < project_material_groups.length; ++j) { @@ -304,7 +304,7 @@ function make_material_traverse_nodes(nodes: zui_node_t[], group: zui_node_canva } } -function make_material_bake_node_preview(node: zui_node_t, group: zui_node_canvas_t, parents: zui_node_t[]) { +function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_t, parents: ui_node_t[]) { if (node.type == "BLUR") { let id: string = parser_material_node_name(node, parents); let image: image_t = map_get(context_raw.node_previews, id); @@ -348,7 +348,7 @@ type parse_node_preview_result_t = { mcon: material_context_t; }; -function make_material_parse_node_preview_material(node: zui_node_t, group: zui_node_canvas_t = null, parents: zui_node_t[] = null): parse_node_preview_result_t { +function make_material_parse_node_preview_material(node: ui_node_t, group: ui_node_canvas_t = null, parents: ui_node_t[] = null): parse_node_preview_result_t { if (node.outputs.length == 0) { return null; } diff --git a/armorsculpt/sources/tab_layers.ts b/armorsculpt/sources/tab_layers.ts index 9effd020..d7dc449d 100644 --- a/armorsculpt/sources/tab_layers.ts +++ b/armorsculpt/sources/tab_layers.ts @@ -1,27 +1,27 @@ let tab_layers_layer_name_edit: i32 = -1; -let tab_layers_layer_name_handle: zui_handle_t = zui_handle_create(); +let tab_layers_layer_name_handle: ui_handle_t = ui_handle_create(); let tab_layers_show_context_menu: bool = false; -function tab_layers_draw(htab: zui_handle_t) { +function tab_layers_draw(htab: ui_handle_t) { let mini: bool = config_raw.layout[layout_size_t.SIDEBAR_W] <= ui_base_sidebar_mini_w; mini ? tab_layers_draw_mini(htab) : tab_layers_draw_full(htab); } -function tab_layers_draw_mini(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - zui_set_hovered_tab_name(tr("Layers")); +function tab_layers_draw_mini(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + ui_set_hovered_tab_name(tr("Layers")); let _ELEMENT_H: i32 = ui.ops.theme.ELEMENT_H; - ui.ops.theme.ELEMENT_H = math_floor(ui_base_sidebar_mini_w / 2 / zui_SCALE(ui)); + ui.ops.theme.ELEMENT_H = math_floor(ui_base_sidebar_mini_w / 2 / ui_SCALE(ui)); - zui_begin_sticky(); - zui_separator(5); + ui_begin_sticky(); + ui_separator(5); tab_layers_combo_filter(); tab_layers_button_new("+"); - zui_end_sticky(); + ui_end_sticky(); ui._y += 2; tab_layers_highlight_odd_lines(); @@ -30,17 +30,17 @@ function tab_layers_draw_mini(htab: zui_handle_t) { ui.ops.theme.ELEMENT_H = _ELEMENT_H; } -function tab_layers_draw_full(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("Layers"))) { - zui_begin_sticky(); +function tab_layers_draw_full(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("Layers"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 3 / 4]; - zui_row(row); + ui_row(row); tab_layers_button_new(tr("New")); tab_layers_combo_filter(); - zui_end_sticky(); + ui_end_sticky(); ui._y += 2; tab_layers_highlight_odd_lines(); @@ -60,20 +60,20 @@ function tab_layers_draw_slots(mini: bool) { } function tab_layers_highlight_odd_lines() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H * 2; let full_h: i32 = ui._window_h - ui_base_hwnds[0].scroll_offset; for (let i: i32 = 0; i < math_floor(full_h / step); ++i) { if (i % 2 == 0) { - zui_fill(0, i * step, (ui._w / zui_SCALE(ui) - 2), step, ui.ops.theme.WINDOW_BG_COL - 0x00040404); + ui_fill(0, i * step, (ui._w / ui_SCALE(ui) - 2), step, ui.ops.theme.WINDOW_BG_COL - 0x00040404); } } } function tab_layers_button_new(text: string) { - let ui: zui_t = ui_base_ui; - if (zui_button(text)) { - ui_menu_draw(function (ui: zui_t) { + let ui: ui_t = ui_base_ui; + if (ui_button(text)) { + ui_menu_draw(function (ui: ui_t) { let l: slot_layer_t = context_raw.layer; if (ui_menu_button(ui, tr("Paint Layer"))) { base_new_layer(); @@ -84,16 +84,16 @@ function tab_layers_button_new(text: string) { } function tab_layers_combo_filter() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let ar: string[] = [tr("All")]; - let filter_handle: zui_handle_t = zui_handle(__ID__); + let filter_handle: ui_handle_t = ui_handle(__ID__); filter_handle.position = context_raw.layer_filter; - context_raw.layer_filter = zui_combo(filter_handle, ar, tr("Filter"), false, zui_align_t.LEFT); + context_raw.layer_filter = ui_combo(filter_handle, ar, tr("Filter"), false, ui_align_t.LEFT); } -function tab_layers_remap_layer_pointers(nodes: zui_node_t[], pointer_map: map_t) { +function tab_layers_remap_layer_pointers(nodes: ui_node_t[], pointer_map: map_t) { for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = nodes[i]; + let n: ui_node_t = nodes[i]; if (n.type == "LAYER" || n.type == "LAYER_MASK") { let i: i32 = n.buttons[0].default_value[0]; if (map_get(pointer_map, i) != -1) { @@ -129,7 +129,7 @@ function tab_layers_set_drag_layer(layer: slot_layer_t, off_x: f32, off_y: f32) } function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; if (context_raw.layer_filter > 0 && slot_layer_get_object_mask(l) > 0 && @@ -145,7 +145,7 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { } let step: i32 = ui.ops.theme.ELEMENT_H; - let checkw: i32 = (ui._window_w / 100 * 8) / zui_SCALE(ui); + let checkw: i32 = (ui._window_w / 100 * 8) / ui_SCALE(ui); // Highlight drag destination let absy: i32 = ui._window_y + ui._y; @@ -160,14 +160,14 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { let nested_group: bool = slot_layer_is_group(base_drag_layer) && to_group; if (!nested_group) { if (slot_layer_can_move(context_raw.layer, context_raw.drag_dest)) { - zui_fill(checkw, step * 2, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, step * 2, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } else if (i == project_layers.length - 1 && mouse_y < absy + step) { context_raw.drag_dest = project_layers.length - 1; if (slot_layer_can_move(context_raw.layer, context_raw.drag_dest)) { - zui_fill(checkw, 0, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 0, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } @@ -175,13 +175,13 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { if (mouse_y > absy + step && mouse_y < absy + step * 3) { context_raw.drag_dest = i; if (tab_layers_can_drop_new_layer(i)) { - zui_fill(checkw, 2 * step, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 2 * step, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } else if (i == project_layers.length - 1 && mouse_y < absy + step) { context_raw.drag_dest = project_layers.length; if (tab_layers_can_drop_new_layer(project_layers.length)) { - zui_fill(checkw, 0, (ui._window_w / zui_SCALE(ui) - 2) - checkw, 2 * zui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); + ui_fill(checkw, 0, (ui._window_w / ui_SCALE(ui) - 2) - checkw, 2 * ui_SCALE(ui), ui.ops.theme.HIGHLIGHT_COL); } } } @@ -196,38 +196,38 @@ function tab_layers_draw_layer_slot(l: slot_layer_t, i: i32, mini: bool) { } function tab_layers_draw_layer_slot_mini(l: slot_layer_t, i: i32) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let row: f32[] = [1, 1]; - zui_row(row); + ui_row(row); let uix: i32 = ui._x; let uiy: i32 = ui._y; - _zui_end_element(); - _zui_end_element(); + _ui_end_element(); + _ui_end_element(); - ui._y += zui_ELEMENT_H(ui); - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y += ui_ELEMENT_H(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); } function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H; let has_panel: bool = slot_layer_is_group(l) || (slot_layer_is_layer(l) && slot_layer_get_masks(l, false) != null); if (has_panel) { let row: f32[] = [8 / 100, 52 / 100, 30 / 100, 10 / 100]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [8 / 100, 52 / 100, 30 / 100]; - zui_row(row); + ui_row(row); } // Draw eye icon let icons: image_t = resource_get("icons.k"); let r: rect_t = resource_tile18(icons, l.visible ? 0 : 1, 0); - let center: i32 = (step / 2) * zui_SCALE(ui); + let center: i32 = (step / 2) * ui_SCALE(ui); ui._x += 2; ui._y += 3; ui._y += center; @@ -237,7 +237,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { col -= 0x99000000; } - if (_zui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == zui_state_t.RELEASED) { + if (_ui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { tab_layers_layer_toggle_visible(l); } ui._x -= 2; @@ -251,7 +251,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui._y += center; if (tab_layers_layer_name_edit == l.id) { tab_layers_layer_name_handle.text = l.name; - l.name = zui_text_input(tab_layers_layer_name_handle); + l.name = ui_text_input(tab_layers_layer_name_handle); if (ui.text_selected_handle != tab_layers_layer_name_handle) { tab_layers_layer_name_edit = -1; } @@ -259,7 +259,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { else { if (ui.enabled && ui.input_enabled && ui.combo_selected_handle == 0 && ui.input_x > ui._window_x + ui._x && ui.input_x < ui._window_x + ui._window_w && - ui.input_y > ui._window_y + ui._y - center && ui.input_y < ui._window_y + ui._y - center + (step * zui_SCALE(ui)) * 2) { + ui.input_y > ui._window_y + ui._y - center && ui.input_y < ui._window_y + ui._y - center + (step * ui_SCALE(ui)) * 2) { if (ui.input_started) { context_set_layer(l); tab_layers_set_drag_layer(context_raw.layer, -(mouse_x - uix - ui._window_x - 3), -(mouse_y - uiy - ui._window_y + 1)); @@ -275,13 +275,13 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { } } - let state: zui_state_t = zui_text(l.name); - if (state == zui_state_t.RELEASED) { + let state: ui_state_t = ui_text(l.name); + if (state == ui_state_t.RELEASED) { let td: f32 = time_time() - context_raw.select_time; if (td < 0.2 && td > 0.0) { tab_layers_layer_name_edit = l.id; tab_layers_layer_name_handle.text = l.name; - zui_start_text_edit(tab_layers_layer_name_handle); + ui_start_text_edit(tab_layers_layer_name_handle); } } @@ -298,14 +298,14 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui._y -= center; if (l.parent != null) { - ui._x -= 10 * zui_SCALE(ui); + ui._x -= 10 * ui_SCALE(ui); if (l.parent.parent != null) { - ui._x -= 10 * zui_SCALE(ui); + ui._x -= 10 * ui_SCALE(ui); } } if (slot_layer_is_group(l)) { - _zui_end_element(); + _ui_end_element(); } else { if (slot_layer_is_mask(l)) { @@ -313,7 +313,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { } // comboBlending(ui, l); - _zui_end_element(); + _ui_end_element(); if (slot_layer_is_mask(l)) { ui._y -= center; @@ -322,44 +322,44 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { if (has_panel) { ui._y += center; - let layer_panel: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let layer_panel: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); layer_panel.selected = l.show_panel; - l.show_panel = zui_panel(layer_panel, "", true, false); + l.show_panel = ui_panel(layer_panel, "", true, false); ui._y -= center; } if (slot_layer_is_group(l) || slot_layer_is_mask(l)) { - ui._y -= zui_ELEMENT_OFFSET(ui); - _zui_end_element(); + ui._y -= ui_ELEMENT_OFFSET(ui); + _ui_end_element(); } else { - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); let row: f32[] = [8 / 100, 16 / 100, 36 / 100, 30 / 100, 10 / 100]; - zui_row(row); - _zui_end_element(); - _zui_end_element(); - _zui_end_element(); + ui_row(row); + _ui_end_element(); + _ui_end_element(); + _ui_end_element(); if (config_raw.touch_ui) { - ui._x += 12 * zui_SCALE(ui); + ui._x += 12 * ui_SCALE(ui); } ui._y -= center; tab_layers_combo_object(ui, l); ui._y += center; - _zui_end_element(); + _ui_end_element(); } - ui._y -= zui_ELEMENT_OFFSET(ui); + ui._y -= ui_ELEMENT_OFFSET(ui); } -function tab_layers_combo_object(ui: zui_t, l: slot_layer_t, label: bool = false): zui_handle_t { +function tab_layers_combo_object(ui: ui_t, l: slot_layer_t, label: bool = false): ui_handle_t { let ar: string[] = [tr("Shared")]; - let object_handle: zui_handle_t = zui_nest(zui_handle(__ID__), l.id); + let object_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); object_handle.position = l.object_mask; - l.object_mask = zui_combo(object_handle, ar, tr("Object"), label, zui_align_t.LEFT); + l.object_mask = ui_combo(object_handle, ar, tr("Object"), label, ui_align_t.LEFT); return object_handle; } @@ -370,19 +370,19 @@ function tab_layers_layer_toggle_visible(l: slot_layer_t) { } function tab_layers_draw_layer_highlight(l: slot_layer_t, mini: bool) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let step: i32 = ui.ops.theme.ELEMENT_H; // Separator line - zui_fill(0, 0, (ui._w / zui_SCALE(ui) - 2), 1 * zui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 0, (ui._w / ui_SCALE(ui) - 2), 1 * ui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); // Highlight selected if (context_raw.layer == l) { if (mini) { - zui_rect(1, -step * 2, ui._w / zui_SCALE(ui) - 1, step * 2 + (mini ? -1 : 1), ui.ops.theme.HIGHLIGHT_COL, 3); + ui_rect(1, -step * 2, ui._w / ui_SCALE(ui) - 1, step * 2 + (mini ? -1 : 1), ui.ops.theme.HIGHLIGHT_COL, 3); } else { - zui_rect(1, -step * 2 - 1, ui._w / zui_SCALE(ui) - 2, step * 2 + (mini ? -2 : 1), ui.ops.theme.HIGHLIGHT_COL, 2); + ui_rect(1, -step * 2 - 1, ui._w / ui_SCALE(ui) - 2, step * 2 + (mini ? -2 : 1), ui.ops.theme.HIGHLIGHT_COL, 2); } } } diff --git a/base/assets/plugins/autosave.js b/base/assets/plugins/autosave.js index ddc16528..bd58499a 100644 --- a/base/assets/plugins/autosave.js +++ b/base/assets/plugins/autosave.js @@ -1,14 +1,14 @@ let plugin = plugin_create(); -let h1 = zui_handle_create(); -let h2 = zui_handle_create(); -zui_handle_set_value(h2, 5.0); +let h1 = ui_handle_create(); +let h2 = ui_handle_create(); +ui_handle_set_value(h2, 5.0); let timer = 0.0; plugin_notify_on_ui(plugin, function() { - if (zui_panel(h1, "Auto Save")) { - zui_slider(h2, "min", 1, 15, false, 1); + if (ui_panel(h1, "Auto Save")) { + ui_slider(h2, "min", 1, 15, false, 1); } }); @@ -17,7 +17,7 @@ plugin_notify_on_update(plugin, function() { return; } timer += 1 / 60; - if (timer >= zui_handle_get_value(h2) * 60) { + if (timer >= ui_handle_get_value(h2) * 60) { timer = 0.0; project_save(); } diff --git a/base/assets/themes/light.json b/base/assets/themes/light.json index 8ebc7b33..bba1d91f 100644 --- a/base/assets/themes/light.json +++ b/base/assets/themes/light.json @@ -31,5 +31,6 @@ "FILL_ACCENT_BG": 0, "LINK_STYLE": 0, "FULL_TABS": 0, - "ROUND_CORNERS": 0 + "ROUND_CORNERS": 1, + "SHADOWS": 1 } diff --git a/base/project.js b/base/project.js index 6b4105e8..5142fde0 100644 --- a/base/project.js +++ b/base/project.js @@ -17,7 +17,7 @@ flags.with_zlib = true; flags.with_stb_image_write = true; flags.with_g2 = true; flags.with_iron = true; -flags.with_zui = true; +flags.with_ui = true; flags.with_eval = true; let project = new Project("Base"); diff --git a/base/sources/base.ts b/base/sources/base.ts index 9fcabff0..2f972f9b 100644 --- a/base/sources/base.ts +++ b/base/sources/base.ts @@ -15,16 +15,16 @@ let base_drag_start: f32 = 0.0; let base_drop_x: f32 = 0.0; let base_drop_y: f32 = 0.0; let base_font: g2_font_t = null; -let base_theme: zui_theme_t; +let base_theme: ui_theme_t; let base_color_wheel: image_t; let base_color_wheel_gradient: image_t; -let base_ui_box: zui_t; -let base_ui_menu: zui_t; +let base_ui_box: ui_t; +let base_ui_menu: ui_t; let base_default_element_w: i32 = 100; let base_default_element_h: i32 = 28; let base_default_font_size: i32 = 13; -let base_res_handle: zui_handle_t = zui_handle_create(); -let base_bits_handle: zui_handle_t = zui_handle_create(); +let base_res_handle: ui_handle_t = ui_handle_create(); +let base_bits_handle: ui_handle_t = ui_handle_create(); let base_drop_paths: string[] = []; let base_appx: i32 = 0; let base_appy: i32 = 0; @@ -237,17 +237,17 @@ function base_init() { base_color_wheel = image_color_wheel; base_color_wheel_gradient = image_color_wheel_gradient; - zui_nodes_enum_texts = base_enum_texts; - // zui_tr = tr; //// - let ops: zui_options_t = { + ui_nodes_enum_texts = base_enum_texts; + // ui_tr = tr; //// + let ops: ui_options_t = { theme: base_theme, font: f, scale_factor: config_raw.window_scale, color_wheel: base_color_wheel.texture_, black_white_gradient: base_color_wheel_gradient.texture_ }; - base_ui_box = zui_create(ops); - base_ui_menu = zui_create(ops); + base_ui_box = ui_create(ops); + base_ui_menu = ui_create(ops); base_default_element_h = base_ui_menu.ops.theme.ELEMENT_H; // Init plugins @@ -262,7 +262,7 @@ function base_init() { camera_init(); ui_base_init(); - ui_nodes_init(); + ui_viewnodes_init(); ui_view2d_init(); ///if is_lab @@ -567,7 +567,7 @@ function base_update() { ///end } // Disable touch scrolling while dragging is active - zui_touch_scroll = !base_is_dragging; + ui_touch_scroll = !base_is_dragging; } if (has_drag && (mouse_movement_x != 0 || mouse_movement_y != 0)) { @@ -669,7 +669,7 @@ function base_update() { ///if krom_windows let is_picker: bool = context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL; let decal: bool = context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT; - zui_always_redraw_window = !context_raw.cache_draws || + ui_always_redraw_window = !context_raw.cache_draws || ui_menu_show || ui_box_show || base_is_dragging || @@ -681,7 +681,7 @@ function base_update() { ///end ///end - if (zui_always_redraw_window && context_raw.ddirty < 0) context_raw.ddirty = 0; + if (ui_always_redraw_window && context_raw.ddirty < 0) context_raw.ddirty = 0; } ///if (is_paint || is_sculpt) @@ -838,10 +838,10 @@ function base_render() { let img: image_t = base_get_drag_image(); ///if (is_paint || is_sculpt) - let scale_factor: f32 = zui_SCALE(ui_base_ui); + let scale_factor: f32 = ui_SCALE(ui_base_ui); ///end ///if is_lab - let scale_factor: f32 = zui_SCALE(base_ui_box); + let scale_factor: f32 = ui_SCALE(base_ui_box); ///end let size: f32 = (base_drag_size == -1 ? 50 : base_drag_size) * scale_factor; @@ -959,7 +959,7 @@ function base_toggle_fullscreen() { function base_is_scrolling(): bool { for (let i: i32 = 0; i < base_get_uis().length; ++i) { - let ui: zui_t = base_get_uis()[i]; + let ui: ui_t = base_get_uis()[i]; if (ui.is_scrolling) { return true; } @@ -969,7 +969,7 @@ function base_is_scrolling(): bool { function base_is_combo_selected(): bool { for (let i: i32 = 0; i < base_get_uis().length; ++i) { - let ui: zui_t = base_get_uis()[i]; + let ui: ui_t = base_get_uis()[i]; if (ui.combo_selected_handle != null) { return true; } @@ -977,8 +977,8 @@ function base_is_combo_selected(): bool { return false; } -function base_get_uis(): zui_t[] { - let uis: zui_t[] = [base_ui_box, base_ui_menu, ui_base_ui, ui_nodes_ui, ui_view2d_ui]; +function base_get_uis(): ui_t[] { + let uis: ui_t[] = [base_ui_box, base_ui_menu, ui_base_ui, ui_nodes_ui, ui_view2d_ui]; return uis; } @@ -999,7 +999,7 @@ function base_redraw_status() { function base_redraw_console() { let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (ui_base_ui != null && statush > ui_status_default_status_h * zui_SCALE(ui_base_ui)) { + if (ui_base_ui != null && statush > ui_status_default_status_h * ui_SCALE(ui_base_ui)) { ui_base_hwnds[tab_area_t.STATUS].redraws = 2; } } @@ -2394,10 +2394,10 @@ function base_flatten(height_to_normal: bool = false): any { let texpaint_nor: image_t = brush_output_node_inst.texpaint_nor; let texpaint_pack: image_t = brush_output_node_inst.texpaint_pack; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); if (nodes.nodes_selected_id.length > 0) { - let node: zui_node_t = zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); + let node: ui_node_t = ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]); let brush_node: logic_node_t = parser_logic_get_logic_node(node); if (brush_node != null && logic_node_get_cached_image(brush_node) != null) { texpaint = logic_node_get_cached_image(brush_node); diff --git a/base/sources/box_export.ts b/base/sources/box_export.ts index f14cecfd..73f7e50f 100644 --- a/base/sources/box_export.ts +++ b/base/sources/box_export.ts @@ -1,10 +1,10 @@ -let box_export_htab: zui_handle_t = zui_handle_create(); +let box_export_htab: ui_handle_t = ui_handle_create(); let box_export_files: string[] = null; -let box_export_mesh_handle: zui_handle_t = zui_handle_create(); +let box_export_mesh_handle: ui_handle_t = ui_handle_create(); ///if (is_paint || is_lab) -let box_export_hpreset: zui_handle_t = zui_handle_create(); +let box_export_hpreset: ui_handle_t = ui_handle_create(); let box_export_preset: export_preset_t = null; let box_export_channels: string[] = ["base_r", "base_g", "base_b", "height", "metal", "nor_r", "nor_g", "nor_g_directx", "nor_b", "occ", "opac", "rough", "smooth", "emis", "subs", "0.0", "1.0"]; let box_export_color_spaces: string[] = ["linear", "srgb"]; @@ -12,7 +12,7 @@ let box_export_color_spaces: string[] = ["linear", "srgb"]; ///if (is_paint || is_lab) function box_export_show_textures() { - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { if (box_export_files == null) { box_export_fetch_presets(); @@ -39,7 +39,7 @@ function box_export_show_textures() { ///if is_paint function box_export_show_bake_material() { - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { if (box_export_files == null) { box_export_fetch_presets(); @@ -60,30 +60,30 @@ function box_export_show_bake_material() { let _box_export_bake_material: bool; ///if (is_paint || is_lab) -function box_export_tab_export_textures(ui: zui_t, title: string, bake_material: bool = false) { +function box_export_tab_export_textures(ui: ui_t, title: string, bake_material: bool = false) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(box_export_htab, title, tab_vertical)) { + if (ui_tab(box_export_htab, title, tab_vertical)) { let row: f32[] = [0.5, 0.5]; - zui_row(row); + ui_row(row); ///if is_paint ///if (krom_android || krom_ios) let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); + ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); ///else let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K", "8K", "16K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); + ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); ///end ///end ///if is_lab ///if (krom_android || krom_ios) let base_res_combo: string[] = ["2K", "4K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); + ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); ///else let base_res_combo: string[] = ["2K", "4K", "8K", "16K"]; - zui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); + ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true); ///end ///end @@ -93,10 +93,10 @@ function box_export_tab_export_textures(ui: zui_t, title: string, bake_material: ///if (is_lab || krom_android || krom_ios) let base_bits_combo: string[] = ["8bit"]; - zui_combo(base_bits_handle, base_bits_combo, tr("Color"), true); + ui_combo(base_bits_handle, base_bits_combo, tr("Color"), true); ///else let base_bits_combo: string[] = ["8bit", "16bit", "32bit"]; - zui_combo(base_bits_handle, base_bits_combo, tr("Color"), true); + ui_combo(base_bits_handle, base_bits_combo, tr("Color"), true); ///end ///if is_paint @@ -105,59 +105,59 @@ function box_export_tab_export_textures(ui: zui_t, title: string, bake_material: } ///end - zui_row(row); + ui_row(row); if (base_bits_handle.position == texture_bits_t.BITS8) { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.position = context_raw.format_type; } let format_combo: string[] = ["png", "jpg"]; - context_raw.format_type = zui_combo(h, format_combo, tr("Format"), true); + context_raw.format_type = ui_combo(h, format_combo, tr("Format"), true); } else { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.position = context_raw.format_type; } let format_combo: string[] = ["exr"]; - context_raw.format_type = zui_combo(h, format_combo, tr("Format"), true); + context_raw.format_type = ui_combo(h, format_combo, tr("Format"), true); } ui.enabled = context_raw.format_type == texture_ldr_format_t.JPG && base_bits_handle.position == texture_bits_t.BITS8; - let h_quality: zui_handle_t = zui_handle(__ID__); + let h_quality: ui_handle_t = ui_handle(__ID__); if (h_quality.init) { h_quality.value = context_raw.format_quality; } - context_raw.format_quality = zui_slider(h_quality, tr("Quality"), 0.0, 100.0, true, 1); + context_raw.format_quality = ui_slider(h_quality, tr("Quality"), 0.0, 100.0, true, 1); ui.enabled = true; ///if is_paint - zui_row(row); + ui_row(row); ui.enabled = !bake_material; - let layers_export_handle: zui_handle_t = zui_handle(__ID__); + let layers_export_handle: ui_handle_t = ui_handle(__ID__); layers_export_handle.position = context_raw.layers_export; let layers_export_combo: string[] = [tr("Visible"), tr("Selected"), tr("Per Object"), tr("Per Udim Tile")]; - context_raw.layers_export = zui_combo(layers_export_handle, layers_export_combo, tr("Layers"), true); + context_raw.layers_export = ui_combo(layers_export_handle, layers_export_combo, tr("Layers"), true); ui.enabled = true; ///end - zui_combo(box_export_hpreset, box_export_files, tr("Preset"), true); + ui_combo(box_export_hpreset, box_export_files, tr("Preset"), true); if (box_export_hpreset.changed) { box_export_preset = null; } - let layers_destination_handle: zui_handle_t = zui_handle(__ID__); + let layers_destination_handle: ui_handle_t = ui_handle(__ID__); layers_destination_handle.position = context_raw.layers_destination; let layers_destination_combo: string[] = [tr("Disk"), tr("Packed")]; - context_raw.layers_destination = zui_combo(layers_destination_handle, layers_destination_combo, tr("Destination"), true); + context_raw.layers_destination = ui_combo(layers_destination_handle, layers_destination_combo, tr("Destination"), true); - _zui_end_element(); + _ui_end_element(); - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_box_hide(); if (context_raw.layers_destination == export_destination_t.PACKED) { _box_export_bake_material = bake_material; @@ -194,37 +194,37 @@ function box_export_tab_export_textures(ui: zui_t, title: string, bake_material: if (ui.is_hovered) { let key: string = map_get(config_keymap, "file_export_textures"); let tip: string = tr("Export texture files") + " (" + key + ")"; - zui_tooltip(tip); + ui_tooltip(tip); } } } let _box_export_t: export_preset_texture_t; -function box_export_tab_presets(ui: zui_t) { +function box_export_tab_presets(ui: ui_t) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(box_export_htab, tr("Presets"), tab_vertical)) { + if (ui_tab(box_export_htab, tr("Presets"), tab_vertical)) { let row: f32[] = [3 / 5, 1 / 5, 1 / 5]; - zui_row(row); + ui_row(row); - zui_combo(box_export_hpreset, box_export_files, tr("Preset")); + ui_combo(box_export_hpreset, box_export_files, tr("Preset")); if (box_export_hpreset.changed) { box_export_preset = null; } - if (zui_button(tr("New"))) { - ui_box_show_custom(function (ui: zui_t) { + if (ui_button(tr("New"))) { + ui_box_show_custom(function (ui: ui_t) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(zui_handle(__ID__), tr("New Preset"), tab_vertical)) { + if (ui_tab(ui_handle(__ID__), tr("New Preset"), tab_vertical)) { let row: f32[] = [0.5, 0.5]; - zui_row(row); - let h_preset: zui_handle_t = zui_handle(__ID__); + ui_row(row); + let h_preset: ui_handle_t = ui_handle(__ID__); if (h_preset.init) { h_preset.text = "new_preset"; } - let preset_name: string = zui_text_input(h_preset, tr("Name")); - if (zui_button(tr("OK")) || ui.is_return_down) { + let preset_name: string = ui_text_input(h_preset, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { box_export_new_preset(preset_name); box_export_fetch_presets(); box_export_preset = null; @@ -237,7 +237,7 @@ function box_export_tab_presets(ui: zui_t) { }); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show("json", false, false, function (path: string) { path = to_lower_case(path); if (ends_with(path, ".json")) { @@ -261,26 +261,26 @@ function box_export_tab_presets(ui: zui_t) { } // Texture list - zui_separator(10, false); + ui_separator(10, false); row = [1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6]; - zui_row(row); - zui_text(tr("Texture")); - zui_text(tr("R")); - zui_text(tr("G")); - zui_text(tr("B")); - zui_text(tr("A")); - zui_text(tr("Color Space")); + ui_row(row); + ui_text(tr("Texture")); + ui_text(tr("R")); + ui_text(tr("G")); + ui_text(tr("B")); + ui_text(tr("A")); + ui_text(tr("Color Space")); ui.changed = false; for (let i: i32 = 0; i < box_export_preset.textures.length; ++i) { let t: export_preset_texture_t = box_export_preset.textures[i]; - zui_row(row); - let htex: zui_handle_t = zui_nest(box_export_hpreset, i); + ui_row(row); + let htex: ui_handle_t = ui_nest(box_export_hpreset, i); htex.text = t.name; - t.name = zui_text_input(htex); + t.name = ui_text_input(htex); if (ui.is_hovered && ui.input_released_r) { _box_export_t = t; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Delete"))) { array_remove(box_export_preset.textures, _box_export_t); box_export_save_preset(); @@ -288,35 +288,35 @@ function box_export_tab_presets(ui: zui_t) { }, 1); } - let hr: zui_handle_t = zui_nest(htex, 0); + let hr: ui_handle_t = ui_nest(htex, 0); hr.position = array_index_of(box_export_channels, t.channels[0]); - let hg: zui_handle_t = zui_nest(htex, 1); + let hg: ui_handle_t = ui_nest(htex, 1); hg.position = array_index_of(box_export_channels, t.channels[1]); - let hb: zui_handle_t = zui_nest(htex, 2); + let hb: ui_handle_t = ui_nest(htex, 2); hb.position = array_index_of(box_export_channels, t.channels[2]); - let ha: zui_handle_t = zui_nest(htex, 3); + let ha: ui_handle_t = ui_nest(htex, 3); ha.position = array_index_of(box_export_channels, t.channels[3]); - zui_combo(hr, box_export_channels, tr("R")); + ui_combo(hr, box_export_channels, tr("R")); if (hr.changed) { t.channels[0] = box_export_channels[hr.position]; } - zui_combo(hg, box_export_channels, tr("G")); + ui_combo(hg, box_export_channels, tr("G")); if (hg.changed) { t.channels[1] = box_export_channels[hg.position]; } - zui_combo(hb, box_export_channels, tr("B")); + ui_combo(hb, box_export_channels, tr("B")); if (hb.changed) { t.channels[2] = box_export_channels[hb.position]; } - zui_combo(ha, box_export_channels, tr("A")); + ui_combo(ha, box_export_channels, tr("A")); if (ha.changed) { t.channels[3] = box_export_channels[ha.position]; } - let hspace: zui_handle_t = zui_nest(htex, 4); + let hspace: ui_handle_t = ui_nest(htex, 4); hspace.position = array_index_of(box_export_color_spaces, t.color_space); - zui_combo(hspace, box_export_color_spaces, tr("Color Space")); + ui_combo(hspace, box_export_color_spaces, tr("Color Space")); if (hspace.changed) { t.color_space = box_export_color_spaces[hspace.position]; } @@ -327,8 +327,8 @@ function box_export_tab_presets(ui: zui_t) { } row = [1 / 8]; - zui_row(row); - if (zui_button(tr("Add"))) { + ui_row(row); + if (ui_button(tr("Add"))) { let tex: export_preset_texture_t = { name: "base", channels: ["base_r", "base_g", "base_b", "1.0"], @@ -343,9 +343,9 @@ function box_export_tab_presets(ui: zui_t) { ///end ///if is_paint -function box_export_tab_atlases(ui: zui_t) { +function box_export_tab_atlases(ui: ui_t) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(box_export_htab, tr("Atlases"), tab_vertical)) { + if (ui_tab(box_export_htab, tr("Atlases"), tab_vertical)) { if (project_atlas_objects == null || project_atlas_objects.length != project_paint_objects.length) { project_atlas_objects = []; project_atlas_names = []; @@ -357,11 +357,11 @@ function box_export_tab_atlases(ui: zui_t) { } for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let row: f32[] = [1 / 2, 1 / 2]; - zui_row(row); - zui_text(project_paint_objects[i].base.name); - let hatlas: zui_handle_t = zui_nest(zui_handle(__ID__), i); + ui_row(row); + ui_text(project_paint_objects[i].base.name); + let hatlas: ui_handle_t = ui_nest(ui_handle(__ID__), i); hatlas.position = project_atlas_objects[i]; - project_atlas_objects[i] = zui_combo(hatlas, project_atlas_names, tr("Atlas")); + project_atlas_objects[i] = ui_combo(hatlas, project_atlas_names, tr("Atlas")); } } } @@ -369,36 +369,36 @@ function box_export_tab_atlases(ui: zui_t) { function box_export_show_mesh() { box_export_mesh_handle.position = context_raw.export_mesh_index; - ui_box_show_custom(function (ui: zui_t) { - let htab: zui_handle_t = zui_handle(__ID__); + ui_box_show_custom(function (ui: ui_t) { + let htab: ui_handle_t = ui_handle(__ID__); box_export_tab_export_mesh(ui, htab); }); } let _box_export_apply_displacement: bool; -function box_export_tab_export_mesh(ui: zui_t, htab: zui_handle_t) { +function box_export_tab_export_mesh(ui: ui_t, htab: ui_handle_t) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(htab, tr("Export Mesh"), tab_vertical)) { + if (ui_tab(htab, tr("Export Mesh"), tab_vertical)) { let row: f32[] = [1 / 2, 1 / 2]; - zui_row(row); + ui_row(row); - let h_export_mesh_format: zui_handle_t = zui_handle(__ID__); + let h_export_mesh_format: ui_handle_t = ui_handle(__ID__); if (h_export_mesh_format.init) { h_export_mesh_format.position = context_raw.export_mesh_format; } let export_mesh_format_combo: string[] = ["obj", "arm"]; - context_raw.export_mesh_format = zui_combo(h_export_mesh_format, export_mesh_format_combo, tr("Format"), true); + context_raw.export_mesh_format = ui_combo(h_export_mesh_format, export_mesh_format_combo, tr("Format"), true); let ar: string[] = [tr("All")]; for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let p: mesh_object_t = project_paint_objects[i]; array_push(ar, p.base.name); } - zui_combo(box_export_mesh_handle, ar, tr("Meshes"), true); + ui_combo(box_export_mesh_handle, ar, tr("Meshes"), true); - let apply_displacement: bool = zui_check(zui_handle(__ID__), tr("Apply Displacement")); + let apply_displacement: bool = ui_check(ui_handle(__ID__), tr("Apply Displacement")); let tris: i32 = 0; let pos: i32 = box_export_mesh_handle.position; @@ -417,13 +417,13 @@ function box_export_tab_export_mesh(ui: zui_t, htab: zui_handle_t) { tris += math_floor(inda.values.length / 3); } } - zui_text(tris + " " + tr("triangles")); + ui_text(tris + " " + tr("triangles")); - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_box_hide(); _box_export_apply_displacement = apply_displacement; ui_files_show(context_raw.export_mesh_format == mesh_format_t.OBJ ? "obj" : "arm", true, false, function (path: string) { @@ -457,22 +457,22 @@ function box_export_tab_export_mesh(ui: zui_t, htab: zui_handle_t) { ///if (is_paint || is_sculpt) function box_export_show_material() { - ui_box_show_custom(function (ui: zui_t) { - let htab: zui_handle_t = zui_handle(__ID__); + ui_box_show_custom(function (ui: ui_t) { + let htab: ui_handle_t = ui_handle(__ID__); let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(htab, tr("Export Material"), tab_vertical)) { - let h1: zui_handle_t = zui_handle(__ID__); - let h2: zui_handle_t = zui_handle(__ID__); + if (ui_tab(htab, tr("Export Material"), tab_vertical)) { + let h1: ui_handle_t = ui_handle(__ID__); + let h2: ui_handle_t = ui_handle(__ID__); h1.selected = context_raw.pack_assets_on_export; h2.selected = context_raw.write_icon_on_export; - context_raw.pack_assets_on_export = zui_check(h1, tr("Pack Assets")); - context_raw.write_icon_on_export = zui_check(h2, tr("Export Icon")); + context_raw.pack_assets_on_export = ui_check(h1, tr("Pack Assets")); + context_raw.write_icon_on_export = ui_check(h2, tr("Export Icon")); let row: f32[] = [0.5, 0.5]; - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_box_hide(); ui_files_show("arm", true, false, function (path: string) { let f: string = ui_files_filename; @@ -489,22 +489,22 @@ function box_export_show_material() { } function box_export_show_brush() { - ui_box_show_custom(function (ui: zui_t) { - let htab: zui_handle_t = zui_handle(__ID__); + ui_box_show_custom(function (ui: ui_t) { + let htab: ui_handle_t = ui_handle(__ID__); let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(htab, tr("Export Brush"), tab_vertical)) { - let h1: zui_handle_t = zui_handle(__ID__); - let h2: zui_handle_t = zui_handle(__ID__); + if (ui_tab(htab, tr("Export Brush"), tab_vertical)) { + let h1: ui_handle_t = ui_handle(__ID__); + let h2: ui_handle_t = ui_handle(__ID__); h1.selected = context_raw.pack_assets_on_export; h2.selected = context_raw.write_icon_on_export; - context_raw.pack_assets_on_export = zui_check(h1, tr("Pack Assets")); - context_raw.write_icon_on_export = zui_check(h2, tr("Export Icon")); + context_raw.pack_assets_on_export = ui_check(h1, tr("Pack Assets")); + context_raw.write_icon_on_export = ui_check(h2, tr("Export Icon")); let row: f32[] = [0.5, 0.5]; - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_box_hide(); ui_files_show("arm", true, false, function (path: string) { let f: string = ui_files_filename; diff --git a/base/sources/box_preferences.ts b/base/sources/box_preferences.ts index b9a981da..a16cbddb 100644 --- a/base/sources/box_preferences.ts +++ b/base/sources/box_preferences.ts @@ -1,30 +1,30 @@ -let box_preferences_htab: zui_handle_t = zui_handle_create(); +let box_preferences_htab: ui_handle_t = ui_handle_create(); let box_preferences_files_plugin: string[] = null; let box_preferences_files_keymap: string[] = null; -let box_preferences_theme_handle: zui_handle_t; -let box_preferences_preset_handle: zui_handle_t; +let box_preferences_theme_handle: ui_handle_t; +let box_preferences_preset_handle: ui_handle_t; let box_preferences_locales: string[] = null; let box_preferences_themes: string[] = null; let box_preferences_world_color: i32 = 0xff080808; let _box_preferences_f: string; -let _box_preferences_h: zui_handle_t; +let _box_preferences_h: ui_handle_t; let _box_preferences_i: i32; -let _box_preferences_ui: zui_t; +let _box_preferences_ui: ui_t; function box_preferences_show() { - ui_box_show_custom(function (ui: zui_t) { - if (zui_tab(box_preferences_htab, tr("Interface"), true)) { + ui_box_show_custom(function (ui: ui_t) { + if (ui_tab(box_preferences_htab, tr("Interface"), true)) { if (box_preferences_locales == null) { box_preferences_locales = translator_get_supported_locales(); } - let locale_handle: zui_handle_t = zui_handle(__ID__); + let locale_handle: ui_handle_t = ui_handle(__ID__); if (locale_handle.init) { locale_handle.position = array_index_of(box_preferences_locales, config_raw.locale); } - zui_combo(locale_handle, box_preferences_locales, tr("Language"), true); + ui_combo(locale_handle, box_preferences_locales, tr("Language"), true); if (locale_handle.changed) { let locale_code: string = box_preferences_locales[locale_handle.position]; config_raw.locale = locale_code; @@ -32,11 +32,11 @@ function box_preferences_show() { ui_base_tag_ui_redraw(); } - let hscale: zui_handle_t = zui_handle(__ID__); + let hscale: ui_handle_t = ui_handle(__ID__); if (hscale.init) { hscale.value = config_raw.window_scale; } - zui_slider(hscale, tr("UI Scale"), 1.0, 4.0, true, 10); + ui_slider(hscale, tr("UI Scale"), 1.0, 4.0, true, 10); if (context_raw.hscale_was_changed && !ui.input_down) { context_raw.hscale_was_changed = false; if (hscale.value == 0.0) { @@ -49,92 +49,92 @@ function box_preferences_show() { context_raw.hscale_was_changed = true; } - let hspeed: zui_handle_t = zui_handle(__ID__); + let hspeed: ui_handle_t = ui_handle(__ID__); if (hspeed.init) { hspeed.value = config_raw.camera_zoom_speed; } - config_raw.camera_zoom_speed = zui_slider(hspeed, tr("Camera Zoom Speed"), 0.1, 4.0, true); + config_raw.camera_zoom_speed = ui_slider(hspeed, tr("Camera Zoom Speed"), 0.1, 4.0, true); - hspeed = zui_handle(__ID__); + hspeed = ui_handle(__ID__); if (hspeed.init) { hspeed.value = config_raw.camera_rotation_speed; } - config_raw.camera_rotation_speed = zui_slider(hspeed, tr("Camera Rotation Speed"), 0.1, 4.0, true); + config_raw.camera_rotation_speed = ui_slider(hspeed, tr("Camera Rotation Speed"), 0.1, 4.0, true); - hspeed = zui_handle(__ID__); + hspeed = ui_handle(__ID__); if (hspeed.init) { hspeed.value = config_raw.camera_pan_speed; } - config_raw.camera_pan_speed = zui_slider(hspeed, tr("Camera Pan Speed"), 0.1, 4.0, true); + config_raw.camera_pan_speed = ui_slider(hspeed, tr("Camera Pan Speed"), 0.1, 4.0, true); - let zoom_direction_handle: zui_handle_t = zui_handle(__ID__); + let zoom_direction_handle: ui_handle_t = ui_handle(__ID__); if (zoom_direction_handle.init) { zoom_direction_handle.position = config_raw.zoom_direction; } let zoom_direction_combo: string[] = [tr("Vertical"), tr("Vertical Inverted"), tr("Horizontal"), tr("Horizontal Inverted"), tr("Vertical and Horizontal"), tr("Vertical and Horizontal Inverted")]; - zui_combo(zoom_direction_handle, zoom_direction_combo, tr("Direction to Zoom"), true); + ui_combo(zoom_direction_handle, zoom_direction_combo, tr("Direction to Zoom"), true); if (zoom_direction_handle.changed) { config_raw.zoom_direction = zoom_direction_handle.position; } - let h_wrap_mouse: zui_handle_t = zui_handle(__ID__); + let h_wrap_mouse: ui_handle_t = ui_handle(__ID__); if (h_wrap_mouse.init) { h_wrap_mouse.selected = config_raw.wrap_mouse; } - config_raw.wrap_mouse = zui_check(h_wrap_mouse, tr("Wrap Mouse")); + config_raw.wrap_mouse = ui_check(h_wrap_mouse, tr("Wrap Mouse")); if (ui.is_hovered) { - zui_tooltip(tr("Wrap mouse around view boundaries during camera control")); + ui_tooltip(tr("Wrap mouse around view boundaries during camera control")); } - let h_node_preview: zui_handle_t = zui_handle(__ID__); + let h_node_preview: ui_handle_t = ui_handle(__ID__); if (h_node_preview.init) { h_node_preview.selected = config_raw.node_preview; } - config_raw.node_preview = zui_check(h_node_preview, tr("Show Node Preview")); + config_raw.node_preview = ui_check(h_node_preview, tr("Show Node Preview")); ui.changed = false; - let h_show_asset_names: zui_handle_t = zui_handle(__ID__); + let h_show_asset_names: ui_handle_t = ui_handle(__ID__); if (h_show_asset_names.init) { h_show_asset_names.selected = config_raw.show_asset_names; } - config_raw.show_asset_names = zui_check(h_show_asset_names, tr("Show Asset Names")); + config_raw.show_asset_names = ui_check(h_show_asset_names, tr("Show Asset Names")); if (ui.changed) { ui_base_tag_ui_redraw(); } ///if !(krom_android || krom_ios) ui.changed = false; - let h_touch_ui: zui_handle_t = zui_handle(__ID__); + let h_touch_ui: ui_handle_t = ui_handle(__ID__); if (h_touch_ui.init) { h_touch_ui.selected = config_raw.touch_ui; } - config_raw.touch_ui = zui_check(h_touch_ui, tr("Touch UI")); + config_raw.touch_ui = ui_check(h_touch_ui, tr("Touch UI")); if (ui.changed) { - zui_touch_scroll = config_raw.touch_ui; - zui_touch_hold = config_raw.touch_ui; - zui_touch_tooltip = config_raw.touch_ui; + ui_touch_scroll = config_raw.touch_ui; + ui_touch_hold = config_raw.touch_ui; + ui_touch_tooltip = config_raw.touch_ui; config_load_theme(config_raw.theme); box_preferences_set_scale(); ui_base_tag_ui_redraw(); } ///end - let h_splash_screen: zui_handle_t = zui_handle(__ID__); + let h_splash_screen: ui_handle_t = ui_handle(__ID__); if (h_splash_screen.init) { h_splash_screen.selected = config_raw.splash_screen; } - config_raw.splash_screen = zui_check(h_splash_screen, tr("Splash Screen")); + config_raw.splash_screen = ui_check(h_splash_screen, tr("Splash Screen")); - // zui_text("Node Editor"); - // let grid_snap: bool = Zui.check(Zui.handle("boxpreferences_11", { selected: false }), "Grid Snap"); + // ui_text("Node Editor"); + // let grid_snap: bool = ui_check(ui_handle("boxpreferences_11", { selected: false }), "Grid Snap"); - _zui_end_element(); + _ui_end_element(); let row: f32[] = [0.5, 0.5]; - zui_row(row); - if (zui_button(tr("Restore")) && !ui_menu_show) { - ui_menu_draw(function (ui: zui_t) { + ui_row(row); + if (ui_button(tr("Restore")) && !ui_menu_show) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Confirm"))) { - app_notify_on_init(function (ui: zui_t) { + app_notify_on_init(function (ui: ui_t) { ui.ops.theme.ELEMENT_H = base_default_element_h; config_restore(); box_preferences_set_scale(); @@ -166,8 +166,8 @@ function box_preferences_show() { } }, 2); } - if (zui_button(tr("Reset Layout")) && !ui_menu_show) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Reset Layout")) && !ui_menu_show) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Confirm"))) { base_init_layout(); config_save(); @@ -176,37 +176,37 @@ function box_preferences_show() { } } - if (zui_tab(box_preferences_htab, tr("Theme"), true)) { + if (ui_tab(box_preferences_htab, tr("Theme"), true)) { if (box_preferences_themes == null) { box_preferences_fetch_themes(); } - box_preferences_theme_handle = zui_handle(__ID__); + box_preferences_theme_handle = ui_handle(__ID__); if (box_preferences_theme_handle.init) { box_preferences_theme_handle.position = box_preferences_get_theme_index(); } - zui_begin_sticky(); + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); - zui_combo(box_preferences_theme_handle, box_preferences_themes, tr("Theme")); + ui_combo(box_preferences_theme_handle, box_preferences_themes, tr("Theme")); if (box_preferences_theme_handle.changed) { config_raw.theme = box_preferences_themes[box_preferences_theme_handle.position] + ".json"; config_load_theme(config_raw.theme); } - if (zui_button(tr("New"))) { - ui_box_show_custom(function (ui: zui_t) { - if (zui_tab(zui_handle(__ID__), tr("New Theme"))) { + if (ui_button(tr("New"))) { + ui_box_show_custom(function (ui: ui_t) { + if (ui_tab(ui_handle(__ID__), tr("New Theme"))) { let row: f32[] = [0.5, 0.5]; - zui_row(row); - let h: zui_handle_t = zui_handle(__ID__); + ui_row(row); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.text = "new_theme"; } - let theme_name: string = zui_text_input(h, tr("Name")); - if (zui_button(tr("OK")) || ui.is_return_down) { + let theme_name: string = ui_text_input(h, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { let template: string = box_preferences_theme_to_json(base_theme); if (!ends_with(theme_name, ".json")) { theme_name += ".json"; @@ -224,13 +224,13 @@ function box_preferences_show() { }); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show("json", false, false, function (path: string) { import_theme_run(path); }); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_files_show("json", true, false, function (path: string) { path += path_sep; path += ui_files_filename; @@ -241,24 +241,24 @@ function box_preferences_show() { }); } - zui_end_sticky(); + ui_end_sticky(); let i: i32 = 0; - let hlist: zui_handle_t = zui_handle(__ID__); + let hlist: ui_handle_t = ui_handle(__ID__); // Viewport color - let h: zui_handle_t = zui_nest(hlist, i++); + let h: ui_handle_t = ui_nest(hlist, i++); if (h.init) { h.color = box_preferences_world_color; } row = [1 / 8, 7 / 8]; - zui_row(row); - zui_text("", 0, h.color); + ui_row(row); + ui_text("", 0, h.color); if (ui.is_hovered && ui.input_released) { _box_preferences_h = h; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { ui.changed = false; - zui_color_wheel(_box_preferences_h, false, -1, 11 * ui.ops.theme.ELEMENT_H * zui_SCALE(ui), true); + ui_color_wheel(_box_preferences_h, false, -1, 11 * ui.ops.theme.ELEMENT_H * ui_SCALE(ui), true); if (ui.changed) { ui_menu_keep_open = true; } @@ -266,7 +266,7 @@ function box_preferences_show() { } let val: u32 = h.color; h.text = i32_to_string_hex(val); - zui_text_input(h, "VIEWPORT_COL"); + ui_text_input(h, "VIEWPORT_COL"); h.color = parse_int_hex(h.text); if (box_preferences_world_color != h.color) { @@ -285,23 +285,23 @@ function box_preferences_show() { // Theme fields let u32_theme: u32_ptr = base_theme; - for (let i: i32 = 0; i < zui_theme_keys.length; ++i) { - let key: string = zui_theme_keys[i]; - let h: zui_handle_t = zui_nest(hlist, i); + for (let i: i32 = 0; i < ui_theme_keys.length; ++i) { + let key: string = ui_theme_keys[i]; + let h: ui_handle_t = ui_nest(hlist, i); let val: u32 = DEREFERENCE(u32_theme + i); let is_hex: bool = ends_with(key, "_COL"); if (is_hex) { let row: f32[] = [1 / 8, 7 / 8]; - zui_row(row); - zui_text("", 0, val); + ui_row(row); + ui_text("", 0, val); if (ui.is_hovered && ui.input_released) { h.color = val; _box_preferences_h = h; _box_preferences_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { ui.changed = false; - let color: i32 = zui_color_wheel(_box_preferences_h, false, -1, 11 * ui.ops.theme.ELEMENT_H * zui_SCALE(ui), true); + let color: i32 = ui_color_wheel(_box_preferences_h, false, -1, 11 * ui.ops.theme.ELEMENT_H * ui_SCALE(ui), true); let u32_theme: u32_ptr = base_theme; DEREFERENCE(u32_theme + _box_preferences_i) = color; if (ui.changed) { @@ -317,20 +317,21 @@ function box_preferences_show() { key == "FILL_BUTTON_BG" || key == "FILL_ACCENT_BG" || key == "FULL_TABS" || - key == "ROUND_CORNERS") { + key == "ROUND_CORNERS" || + key == "SHADOWS") { h.selected = val > 0; - let b: bool = zui_check(h, key); + let b: bool = ui_check(h, key); DEREFERENCE(u32_theme + i) = b; } else if (key == "LINK_STYLE") { let styles: string[] = [tr("Straight"), tr("Curved")]; h.position = val; - let pos: i32 = zui_combo(h, styles, key, true); + let pos: i32 = ui_combo(h, styles, key, true); DEREFERENCE(u32_theme + i) = pos; } else { h.text = is_hex ? i32_to_string_hex(val) : i32_to_string(val); - zui_text_input(h, key); + ui_text_input(h, key); if (is_hex) { DEREFERENCE(u32_theme + i) = parse_int_hex(h.text); } @@ -341,19 +342,19 @@ function box_preferences_show() { if (ui.changed) { for (let i: i32 = 0; i < base_get_uis().length; ++i) { - let ui: zui_t = base_get_uis()[i]; + let ui: ui_t = base_get_uis()[i]; ui.elements_baked = false; } } } } - if (zui_tab(box_preferences_htab, tr("Usage"), true)) { - context_raw.undo_handle = zui_handle(__ID__); + if (ui_tab(box_preferences_htab, tr("Usage"), true)) { + context_raw.undo_handle = ui_handle(__ID__); if (context_raw.undo_handle.init) { context_raw.undo_handle.value = config_raw.undo_steps; } - config_raw.undo_steps = math_floor(zui_slider(context_raw.undo_handle, tr("Undo Steps"), 1, 64, false, 1)); + config_raw.undo_steps = math_floor(ui_slider(context_raw.undo_handle, tr("Undo Steps"), 1, 64, false, 1)); if (config_raw.undo_steps < 1) { config_raw.undo_steps = math_floor(context_raw.undo_handle.value = 1); } @@ -378,49 +379,49 @@ function box_preferences_show() { } ///if is_paint - let h_dilate_radius: zui_handle_t = zui_handle(__ID__); + let h_dilate_radius: ui_handle_t = ui_handle(__ID__); if (h_dilate_radius.init) { h_dilate_radius.value = config_raw.dilate_radius; } - config_raw.dilate_radius = math_floor(zui_slider(h_dilate_radius, tr("Dilate Radius"), 0.0, 16.0, true, 1)); + config_raw.dilate_radius = math_floor(ui_slider(h_dilate_radius, tr("Dilate Radius"), 0.0, 16.0, true, 1)); if (ui.is_hovered) { - zui_tooltip(tr("Dilate painted textures to prevent seams")); + ui_tooltip(tr("Dilate painted textures to prevent seams")); } - let dilate_handle: zui_handle_t = zui_handle(__ID__); + let dilate_handle: ui_handle_t = ui_handle(__ID__); if (dilate_handle.init) { dilate_handle.position = config_raw.dilate; } let dilate_combo: string[] = [tr("Instant"), tr("Delayed")]; - zui_combo(dilate_handle, dilate_combo, tr("Dilate"), true); + ui_combo(dilate_handle, dilate_combo, tr("Dilate"), true); if (dilate_handle.changed) { config_raw.dilate = dilate_handle.position; } ///end ///if is_lab - let workspace_handle: zui_handle_t = zui_handle(__ID__); + let workspace_handle: ui_handle_t = ui_handle(__ID__); if (workspace_handle.init) { workspace_handle.position = config_raw.workspace; } let workspace_combo: string[] = [tr("3D View"), tr("2D View")]; - zui_combo(workspace_handle, workspace_combo, tr("Default Workspace"), true); + ui_combo(workspace_handle, workspace_combo, tr("Default Workspace"), true); if (workspace_handle.changed) { config_raw.workspace = workspace_handle.position; } ///end - let camera_controls_handle: zui_handle_t = zui_handle(__ID__); + let camera_controls_handle: ui_handle_t = ui_handle(__ID__); if (camera_controls_handle.init) { camera_controls_handle.position = config_raw.camera_controls; } let camera_controls_combo: string[] = [tr("Orbit"), tr("Rotate"), tr("Fly")]; - zui_combo(camera_controls_handle, camera_controls_combo, tr("Default Camera Controls"), true); + ui_combo(camera_controls_handle, camera_controls_combo, tr("Default Camera Controls"), true); if (camera_controls_handle.changed) { config_raw.camera_controls = camera_controls_handle.position; } - let layer_res_handle: zui_handle_t = zui_handle(__ID__); + let layer_res_handle: ui_handle_t = ui_handle(__ID__); if (layer_res_handle.init) { layer_res_handle.position = config_raw.layer_res; } @@ -428,20 +429,20 @@ function box_preferences_show() { ///if is_paint ///if (krom_android || krom_ios) let layer_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K"]; - zui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); + ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); ///else let layer_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K", "8K"]; - zui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); + ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); ///end ///end ///if is_lab ///if (krom_android || krom_ios) let layer_res_combo: string[] = ["2K", "4K"]; - zui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); + ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); ///else let layer_res_combo: string[] = ["2K", "4K", "8K", "16K"]; - zui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); + ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true); ///end ///end @@ -449,71 +450,71 @@ function box_preferences_show() { config_raw.layer_res = layer_res_handle.position; } - let server_handle: zui_handle_t = zui_handle(__ID__); + let server_handle: ui_handle_t = ui_handle(__ID__); if (server_handle.init) { server_handle.text = config_raw.server; } - config_raw.server = zui_text_input(server_handle, tr("Cloud Server")); + config_raw.server = ui_text_input(server_handle, tr("Cloud Server")); ///if (is_paint || is_sculpt) - let material_live_handle: zui_handle_t = zui_handle(__ID__); + let material_live_handle: ui_handle_t = ui_handle(__ID__); if (material_live_handle.init) { material_live_handle.selected = config_raw.material_live; } - config_raw.material_live = zui_check(material_live_handle, tr("Live Material Preview")); + config_raw.material_live = ui_check(material_live_handle, tr("Live Material Preview")); if (ui.is_hovered) { - zui_tooltip(tr("Instantly update material preview on node change")); + ui_tooltip(tr("Instantly update material preview on node change")); } - let brush_live_handle: zui_handle_t = zui_handle(__ID__); + let brush_live_handle: ui_handle_t = ui_handle(__ID__); if (brush_live_handle.init) { brush_live_handle.selected = config_raw.brush_live; } - config_raw.brush_live = zui_check(brush_live_handle, tr("Live Brush Preview")); + config_raw.brush_live = ui_check(brush_live_handle, tr("Live Brush Preview")); if (ui.is_hovered) { - zui_tooltip(tr("Draw live brush preview in viewport")); + ui_tooltip(tr("Draw live brush preview in viewport")); } if (brush_live_handle.changed) { context_raw.ddirty = 2; } - let brush_3d_handle: zui_handle_t = zui_handle(__ID__); + let brush_3d_handle: ui_handle_t = ui_handle(__ID__); if (brush_3d_handle.init) { brush_3d_handle.selected = config_raw.brush_3d; } - config_raw.brush_3d = zui_check(brush_3d_handle, tr("3D Cursor")); + config_raw.brush_3d = ui_check(brush_3d_handle, tr("3D Cursor")); if (brush_3d_handle.changed) { make_material_parse_paint_material(); } ui.enabled = config_raw.brush_3d; - let brush_depth_reject_handle: zui_handle_t = zui_handle(__ID__); + let brush_depth_reject_handle: ui_handle_t = ui_handle(__ID__); if (brush_depth_reject_handle.init) { brush_depth_reject_handle.selected = config_raw.brush_depth_reject; } - config_raw.brush_depth_reject = zui_check(brush_depth_reject_handle, tr("Depth Reject")); + config_raw.brush_depth_reject = ui_check(brush_depth_reject_handle, tr("Depth Reject")); if (brush_depth_reject_handle.changed) { make_material_parse_paint_material(); } let row: f32[] = [0.5, 0.5]; - zui_row(row); + ui_row(row); - let brush_angle_reject_handle: zui_handle_t = zui_handle(__ID__); + let brush_angle_reject_handle: ui_handle_t = ui_handle(__ID__); if (brush_angle_reject_handle.init) { brush_angle_reject_handle.selected = config_raw.brush_angle_reject; } - config_raw.brush_angle_reject = zui_check(brush_angle_reject_handle, tr("Angle Reject")); + config_raw.brush_angle_reject = ui_check(brush_angle_reject_handle, tr("Angle Reject")); if (brush_angle_reject_handle.changed) { make_material_parse_paint_material(); } if (!config_raw.brush_angle_reject) ui.enabled = false; - let angle_dot_handle: zui_handle_t = zui_handle(__ID__); + let angle_dot_handle: ui_handle_t = ui_handle(__ID__); if (angle_dot_handle.init) { angle_dot_handle.value = context_raw.brush_angle_reject_dot; } - context_raw.brush_angle_reject_dot = zui_slider(angle_dot_handle, tr("Angle"), 0.0, 1.0, true); + context_raw.brush_angle_reject_dot = ui_slider(angle_dot_handle, tr("Angle"), 0.0, 1.0, true); if (angle_dot_handle.changed) { make_material_parse_paint_material(); } @@ -521,13 +522,13 @@ function box_preferences_show() { ///end ///if is_lab - let h_gpu_inference: zui_handle_t = zui_handle(__ID__); + let h_gpu_inference: ui_handle_t = ui_handle(__ID__); if (h_gpu_inference.init) { h_gpu_inference.selected = config_raw.gpu_inference; } - config_raw.gpu_inference = zui_check(h_gpu_inference, tr("Use GPU")); + config_raw.gpu_inference = ui_check(h_gpu_inference, tr("Use GPU")); if (ui.is_hovered) { - zui_tooltip(tr("Use GPU to accelerate node graph processing")); + ui_tooltip(tr("Use GPU to accelerate node graph processing")); } ///end } @@ -539,44 +540,44 @@ function box_preferences_show() { pen_name = tr("Pen"); ///end - if (zui_tab(box_preferences_htab, pen_name, true)) { - zui_text(tr("Pressure controls")); - let h_pressure_radius: zui_handle_t = zui_handle(__ID__); + if (ui_tab(box_preferences_htab, pen_name, true)) { + ui_text(tr("Pressure controls")); + let h_pressure_radius: ui_handle_t = ui_handle(__ID__); if (h_pressure_radius.init) { h_pressure_radius.selected = config_raw.pressure_radius; } - config_raw.pressure_radius = zui_check(h_pressure_radius, tr("Brush Radius")); + config_raw.pressure_radius = ui_check(h_pressure_radius, tr("Brush Radius")); - let h_pressure_sensitivity: zui_handle_t = zui_handle(__ID__); + let h_pressure_sensitivity: ui_handle_t = ui_handle(__ID__); if (h_pressure_sensitivity.init) { h_pressure_sensitivity.value = config_raw.pressure_sensitivity; } - config_raw.pressure_sensitivity = zui_slider(h_pressure_sensitivity, tr("Sensitivity"), 0.0, 10.0, true); + config_raw.pressure_sensitivity = ui_slider(h_pressure_sensitivity, tr("Sensitivity"), 0.0, 10.0, true); ///if (is_paint || is_sculpt) - let h_pressure_hardness: zui_handle_t = zui_handle(__ID__); + let h_pressure_hardness: ui_handle_t = ui_handle(__ID__); if (h_pressure_hardness.init) { h_pressure_hardness.selected = config_raw.pressure_hardness; } - config_raw.pressure_hardness = zui_check(h_pressure_hardness, tr("Brush Hardness")); + config_raw.pressure_hardness = ui_check(h_pressure_hardness, tr("Brush Hardness")); - let h_pressure_opacity: zui_handle_t = zui_handle(__ID__); + let h_pressure_opacity: ui_handle_t = ui_handle(__ID__); if (h_pressure_opacity.init) { h_pressure_opacity.selected = config_raw.pressure_opacity; } - config_raw.pressure_opacity = zui_check(h_pressure_opacity, tr("Brush Opacity")); + config_raw.pressure_opacity = ui_check(h_pressure_opacity, tr("Brush Opacity")); - let h_pressure_angle: zui_handle_t = zui_handle(__ID__); + let h_pressure_angle: ui_handle_t = ui_handle(__ID__); if (h_pressure_angle.init) { h_pressure_angle.selected = config_raw.pressure_angle; } - config_raw.pressure_angle = zui_check(h_pressure_angle, tr("Brush Angle")); + config_raw.pressure_angle = ui_check(h_pressure_angle, tr("Brush Angle")); ///end - _zui_end_element(); + _ui_end_element(); let row: f32[] = [0.5]; - zui_row(row); - if (zui_button(tr("Help"))) { + ui_row(row); + if (ui_button(tr("Help"))) { ///if (is_paint || is_sculpt) file_load_url("https://github.com/armory3d/armorpaint_docs///pen"); ///end @@ -586,182 +587,182 @@ function box_preferences_show() { } } - context_raw.hssao = zui_handle(__ID__); + context_raw.hssao = ui_handle(__ID__); if (context_raw.hssao.init) { context_raw.hssao.selected = config_raw.rp_ssao; } - context_raw.hssr = zui_handle(__ID__); + context_raw.hssr = ui_handle(__ID__); if (context_raw.hssr.init) { context_raw.hssr.selected = config_raw.rp_ssr; } - context_raw.hbloom = zui_handle(__ID__); + context_raw.hbloom = ui_handle(__ID__); if (context_raw.hbloom.init) { context_raw.hbloom.selected = config_raw.rp_bloom; } - context_raw.hsupersample = zui_handle(__ID__); + context_raw.hsupersample = ui_handle(__ID__); if (context_raw.hsupersample.init) { context_raw.hsupersample.position = config_get_super_sample_quality(config_raw.rp_supersample); } - context_raw.hvxao = zui_handle(__ID__); + context_raw.hvxao = ui_handle(__ID__); if (context_raw.hvxao.init) { context_raw.hvxao.selected = config_raw.rp_gi; } - if (zui_tab(box_preferences_htab, tr("Viewport"), true)) { + if (ui_tab(box_preferences_htab, tr("Viewport"), true)) { ///if (krom_direct3d12 || krom_vulkan || krom_metal) - let hpathtrace_mode: zui_handle_t = zui_handle(__ID__); + let hpathtrace_mode: ui_handle_t = ui_handle(__ID__); if (hpathtrace_mode.init) { hpathtrace_mode.position = context_raw.pathtrace_mode; } let pathtrace_mode_combo: string[] = [tr("Core"), tr("Full")]; - context_raw.pathtrace_mode = zui_combo(hpathtrace_mode, pathtrace_mode_combo, tr("Path Tracer"), true); + context_raw.pathtrace_mode = ui_combo(hpathtrace_mode, pathtrace_mode_combo, tr("Path Tracer"), true); if (hpathtrace_mode.changed) { render_path_raytrace_ready = false; } ///end - let hrender_mode: zui_handle_t = zui_handle(__ID__); + let hrender_mode: ui_handle_t = ui_handle(__ID__); if (hrender_mode.init) { hrender_mode.position = context_raw.render_mode; } let render_mode_combo: string[] = [tr("Full"), tr("Mobile")]; - context_raw.render_mode = zui_combo(hrender_mode, render_mode_combo, tr("Renderer"), true); + context_raw.render_mode = ui_combo(hrender_mode, render_mode_combo, tr("Renderer"), true); if (hrender_mode.changed) { context_set_render_path(); } let supersample_combo: string[] = ["0.25x", "0.5x", "1.0x", "1.5x", "2.0x", "4.0x"]; - zui_combo(context_raw.hsupersample, supersample_combo, tr("Super Sample"), true); + ui_combo(context_raw.hsupersample, supersample_combo, tr("Super Sample"), true); if (context_raw.hsupersample.changed) { config_apply(); } if (context_raw.render_mode == render_mode_t.DEFERRED) { ///if arm_voxels - zui_check(context_raw.hvxao, tr("Voxel AO")); + ui_check(context_raw.hvxao, tr("Voxel AO")); if (ui.is_hovered) { - zui_tooltip(tr("Cone-traced AO and shadows")); + ui_tooltip(tr("Cone-traced AO and shadows")); } if (context_raw.hvxao.changed) { config_apply(); } ui.enabled = context_raw.hvxao.selected; - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.value = context_raw.vxao_offset; } - context_raw.vxao_offset = zui_slider(h, tr("Cone Offset"), 1.0, 4.0, true); + context_raw.vxao_offset = ui_slider(h, tr("Cone Offset"), 1.0, 4.0, true); if (h.changed) { context_raw.ddirty = 2; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); if (h.init) { h.value = context_raw.vxao_aperture; } - context_raw.vxao_aperture = zui_slider(h, tr("Aperture"), 1.0, 4.0, true); + context_raw.vxao_aperture = ui_slider(h, tr("Aperture"), 1.0, 4.0, true); if (h.changed) { context_raw.ddirty = 2; } ui.enabled = true; ///end - zui_check(context_raw.hssao, tr("SSAO")); + ui_check(context_raw.hssao, tr("SSAO")); if (context_raw.hssao.changed) { config_apply(); } - zui_check(context_raw.hssr, tr("SSR")); + ui_check(context_raw.hssr, tr("SSR")); if (context_raw.hssr.changed) { config_apply(); } - zui_check(context_raw.hbloom, tr("Bloom")); + ui_check(context_raw.hbloom, tr("Bloom")); if (context_raw.hbloom.changed) { config_apply(); } } - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.value = config_raw.rp_vignette; } - config_raw.rp_vignette = zui_slider(h, tr("Vignette"), 0.0, 1.0, true); + config_raw.rp_vignette = ui_slider(h, tr("Vignette"), 0.0, 1.0, true); if (h.changed) { context_raw.ddirty = 2; } - h = zui_handle(__ID__); + h = ui_handle(__ID__); if (h.init) { h.value = config_raw.rp_grain; } - config_raw.rp_grain = zui_slider(h, tr("Noise Grain"), 0.0, 1.0, true); + config_raw.rp_grain = ui_slider(h, tr("Noise Grain"), 0.0, 1.0, true); if (h.changed) { context_raw.ddirty = 2; } - // let h: zui_handle_t = Zui.handle("boxpreferences_46", { value: raw.autoExposureStrength }); - // raw.autoExposureStrength = Zui.slider(h, "Auto Exposure", 0.0, 2.0, true); + // let h: ui_handle_t = ui_handle("boxpreferences_46", { value: raw.autoExposureStrength }); + // raw.autoExposureStrength = ui_slider(h, "Auto Exposure", 0.0, 2.0, true); // if (h.changed) raw.ddirty = 2; let cam: camera_object_t = scene_camera; let cam_raw: camera_data_t = cam.data; - let near_handle: zui_handle_t = zui_handle(__ID__); - let far_handle: zui_handle_t = zui_handle(__ID__); + let near_handle: ui_handle_t = ui_handle(__ID__); + let far_handle: ui_handle_t = ui_handle(__ID__); near_handle.value = math_floor(cam_raw.near_plane * 1000) / 1000; far_handle.value = math_floor(cam_raw.far_plane * 100) / 100; - cam_raw.near_plane = zui_slider(near_handle, tr("Clip Start"), 0.001, 1.0, true); - cam_raw.far_plane = zui_slider(far_handle, tr("Clip End"), 50.0, 100.0, true); + cam_raw.near_plane = ui_slider(near_handle, tr("Clip Start"), 0.001, 1.0, true); + cam_raw.far_plane = ui_slider(far_handle, tr("Clip End"), 50.0, 100.0, true); if (near_handle.changed || far_handle.changed) { camera_object_build_proj(cam); } - let disp_handle: zui_handle_t = zui_handle(__ID__); + let disp_handle: ui_handle_t = ui_handle(__ID__); if (disp_handle.init) { disp_handle.value = config_raw.displace_strength; } - config_raw.displace_strength = zui_slider(disp_handle, tr("Displacement Strength"), 0.0, 10.0, true); + config_raw.displace_strength = ui_slider(disp_handle, tr("Displacement Strength"), 0.0, 10.0, true); if (disp_handle.changed) { context_raw.ddirty = 2; make_material_parse_mesh_material(); } } - if (zui_tab(box_preferences_htab, tr("Keymap"), true)) { + if (ui_tab(box_preferences_htab, tr("Keymap"), true)) { if (box_preferences_files_keymap == null) { box_preferences_fetch_keymaps(); } - zui_begin_sticky(); + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); - box_preferences_preset_handle = zui_handle(__ID__); + box_preferences_preset_handle = ui_handle(__ID__); if (box_preferences_preset_handle.init) { box_preferences_preset_handle.position = box_preferences_get_preset_index(); } - zui_combo(box_preferences_preset_handle, box_preferences_files_keymap, tr("Preset")); + ui_combo(box_preferences_preset_handle, box_preferences_files_keymap, tr("Preset")); if (box_preferences_preset_handle.changed) { config_raw.keymap = box_preferences_files_keymap[box_preferences_preset_handle.position] + ".json"; config_apply(); config_load_keymap(); } - if (zui_button(tr("New"))) { - ui_box_show_custom(function (ui: zui_t) { - if (zui_tab(zui_handle(__ID__), tr("New Keymap"))) { + if (ui_button(tr("New"))) { + ui_box_show_custom(function (ui: ui_t) { + if (ui_tab(ui_handle(__ID__), tr("New Keymap"))) { let row: f32[] = [0.5, 0.5]; - zui_row(row); - let h: zui_handle_t = zui_handle(__ID__); + ui_row(row); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.text = "new_keymap"; } - let keymap_name: string = zui_text_input(h, tr("Name")); - if (zui_button(tr("OK")) || ui.is_return_down) { + let keymap_name: string = ui_text_input(h, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { let template: string = config_keymap_to_json(base_get_default_keymap()); if (!ends_with(keymap_name, ".json")) { keymap_name += ".json"; @@ -779,12 +780,12 @@ function box_preferences_show() { }); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show("json", false, false, function (path: string) { import_keymap_run(path); }); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_files_show("json", true, false, function (dest: string) { if (!ends_with(ui_files_filename, ".json")) { ui_files_filename += ".json"; @@ -794,9 +795,9 @@ function box_preferences_show() { }); } - zui_end_sticky(); + ui_end_sticky(); - zui_separator(8, false); + ui_separator(8, false); let index: i32 = 0; ui.changed = false; @@ -806,9 +807,9 @@ function box_preferences_show() { }); for (let i: i32 = 0; i < keys.length; ++i) { let key: string = keys[i]; - let h: zui_handle_t = zui_nest(zui_handle(__ID__), index++); + let h: ui_handle_t = ui_nest(ui_handle(__ID__), index++); h.text = map_get(config_keymap, key); - let text: string = zui_text_input(h, key, zui_align_t.LEFT); + let text: string = ui_text_input(h, key, ui_align_t.LEFT); map_set(config_keymap, key, text); } if (ui.changed) { @@ -816,27 +817,27 @@ function box_preferences_show() { config_save_keymap(); } } - if (zui_tab(box_preferences_htab, tr("Plugins"), true)) { - zui_begin_sticky(); + if (ui_tab(box_preferences_htab, tr("Plugins"), true)) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4]; - zui_row(row); - if (zui_button(tr("New"))) { - ui_box_show_custom(function (ui: zui_t) { - if (zui_tab(zui_handle(__ID__), tr("New Plugin"))) { + ui_row(row); + if (ui_button(tr("New"))) { + ui_box_show_custom(function (ui: ui_t) { + if (ui_tab(ui_handle(__ID__), tr("New Plugin"))) { let row: f32[] = [0.5, 0.5]; - zui_row(row); - let h: zui_handle_t = zui_handle(__ID__); + ui_row(row); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.text = "new_plugin"; } - let plugin_name: string = zui_text_input(h, tr("Name")); - if (zui_button(tr("OK")) || ui.is_return_down) { + let plugin_name: string = ui_text_input(h, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { let template: string = "let plugin = create();\ -let h1 = zui_handle_create();\ +let h1 = ui_handle_create();\ plugin.draw_ui = function (ui) {\ - if (zui_panel(h1, \"New Plugin\")) {\ - if (zui_button(\"Button\")) {\ + if (ui_panel(h1, \"New Plugin\")) {\ + if (ui_button(\"Button\")) {\ console.error(\"Hello\");\ }\ }\ @@ -855,12 +856,12 @@ plugin.draw_ui = function (ui) {\ } }); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show("js,zip", false, false, function (path: string) { import_plugin_run(path); }); } - zui_end_sticky(); + ui_end_sticky(); if (box_preferences_files_plugin == null) { box_preferences_fetch_plugins(); @@ -869,7 +870,7 @@ plugin.draw_ui = function (ui) {\ if (config_raw.plugins == null) { config_raw.plugins = []; } - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.selected = false; } @@ -882,14 +883,14 @@ plugin.draw_ui = function (ui) {\ let enabled: bool = array_index_of(config_raw.plugins, f) >= 0; h.selected = enabled; let tag: string = is_js ? string_split(f, ".")[0] : f; - zui_check(h, tag); + ui_check(h, tag); if (h.changed && h.selected != enabled) { h.selected ? config_enable_plugin(f) : config_disable_plugin(f); base_redraw_ui(); } if (ui.is_hovered && ui.input_released_r) { _box_preferences_f = f; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let path: string = path_data() + path_sep + "plugins" + path_sep + _box_preferences_f; if (ui_menu_button(ui, tr("Edit in Text Editor"))) { file_start(path); @@ -959,15 +960,15 @@ function box_preferences_get_preset_index(): i32 { function box_preferences_set_scale() { let scale: f32 = config_raw.window_scale; - _zui_set_scale(ui_base_ui, scale); + _ui_set_scale(ui_base_ui, scale); ui_header_h = math_floor(ui_header_default_h * scale); config_raw.layout[layout_size_t.STATUS_H] = math_floor(ui_status_default_status_h * scale); ui_menubar_w = math_floor(ui_menubar_default_w * scale); ui_base_set_icon_scale(); - _zui_set_scale(ui_nodes_ui, scale); - _zui_set_scale(ui_view2d_ui, scale); - _zui_set_scale(base_ui_box, scale); - _zui_set_scale(base_ui_menu, scale); + _ui_set_scale(ui_nodes_ui, scale); + _ui_set_scale(ui_view2d_ui, scale); + _ui_set_scale(base_ui_box, scale); + _ui_set_scale(base_ui_menu, scale); base_resize(); ///if (is_paint || is_sculpt) config_raw.layout[layout_size_t.SIDEBAR_W] = math_floor(ui_base_default_sidebar_w * scale); @@ -975,11 +976,11 @@ function box_preferences_set_scale() { ///end } -function box_preferences_theme_to_json(theme: zui_theme_t): string { +function box_preferences_theme_to_json(theme: ui_theme_t): string { json_encode_begin(); let u32_theme: u32_ptr = theme; - for (let i: i32 = 0; i < zui_theme_keys.length; ++i) { - let key: string = zui_theme_keys[i]; + for (let i: i32 = 0; i < ui_theme_keys.length; ++i) { + let key: string = ui_theme_keys[i]; let val: u32 = DEREFERENCE(u32_theme + i); json_encode_i32(key, val); } diff --git a/base/sources/box_projects.ts b/base/sources/box_projects.ts index 2af9da1c..ee0e7efb 100644 --- a/base/sources/box_projects.ts +++ b/base/sources/box_projects.ts @@ -1,6 +1,6 @@ -let box_projects_htab: zui_handle_t = zui_handle_create(); -let box_projects_hsearch: zui_handle_t = zui_handle_create(); +let box_projects_htab: ui_handle_t = ui_handle_create(); +let box_projects_hsearch: ui_handle_t = ui_handle_create(); let box_projects_icon_map: map_t = null; function box_projects_show() { @@ -20,7 +20,7 @@ function box_projects_show() { draggable = true; ///end - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { ///if (krom_android || krom_ios) box_projects_align_to_fullscreen(); ///end @@ -39,13 +39,13 @@ let _box_projects_path: string; let _box_projects_icon_path: string; let _box_projects_i: i32; -function box_projects_tab(ui: zui_t) { - if (zui_tab(box_projects_htab, tr("Projects"), true)) { - zui_begin_sticky(); +function box_projects_tab(ui: ui_t) { + if (ui_tab(box_projects_htab, tr("Projects"), true)) { + ui_begin_sticky(); box_projects_draw_badge(ui); - if (zui_button(tr("New"))) { + if (ui_button(tr("New"))) { project_new(); viewport_scale_to_bounds(); ui_box_hide(); @@ -65,10 +65,10 @@ function box_projects_tab(ui: zui_t) { } sys_title_set(title); } - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); - let slotw: i32 = math_floor(150 * zui_SCALE(ui)); + let slotw: i32 = math_floor(150 * ui_SCALE(ui)); let num: i32 = math_floor(sys_width() / slotw); let recent_projects: string[] = config_raw.recent_projects; let show_asset_names: bool = true; @@ -79,21 +79,21 @@ function box_projects_tab(ui: zui_t) { for (let i: i32 = 0; i < num * mult; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; - let off: f32 = show_asset_names ? zui_ELEMENT_OFFSET(ui) * 16.0 : 6; + let off: f32 = show_asset_names ? ui_ELEMENT_OFFSET(ui) * 16.0 : 6; if (row > 0) { ui._y += off; } for (let j: i32 = 0; j < num; ++j) { - let imgw: i32 = math_floor(128 * zui_SCALE(ui)); + let imgw: i32 = math_floor(128 * ui_SCALE(ui)); let i: i32 = j + row * num; if (i >= recent_projects.length) { - _zui_end_element(imgw); + _ui_end_element(imgw); if (show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } continue; } @@ -119,13 +119,13 @@ function box_projects_tab(ui: zui_t) { let uix: i32 = ui._x; if (icon != null) { - zui_fill(0, 0, 128, 128, ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 0, 128, 128, ui.ops.theme.SEPARATOR_COL); - let state: i32 = _zui_image(icon, 0xffffffff, 128 * zui_SCALE(ui)); - if (state == zui_state_t.RELEASED) { + let state: i32 = _ui_image(icon, 0xffffffff, 128 * ui_SCALE(ui)); + if (state == ui_state_t.RELEASED) { let _uix: i32 = ui._x; ui._x = uix; - zui_fill(0, 0, 128, 128, 0x66000000); + ui_fill(0, 0, 128, 128, 0x66000000); ui._x = _uix; ///if (krom_android || krom_ios) console_toast(tr("Opening project")); @@ -142,7 +142,7 @@ function box_projects_tab(ui: zui_t) { _box_projects_path = path; _box_projects_icon_path = icon_path; _box_projects_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { // if (menuButton(ui, tr("Duplicate"))) {} if (ui_menu_button(ui, tr("Delete"))) { app_notify_on_init(function () { @@ -160,20 +160,20 @@ function box_projects_tab(ui: zui_t) { if (show_asset_names) { ui._x = uix - (150 - 128) / 2; ui._y += slotw * 0.9; - zui_text(name, zui_align_t.CENTER); + ui_text(name, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(name); + ui_tooltip(name); } ui._y -= slotw * 0.9; if (i == recent_projects.length - 1) { - ui._y += j == num - 1 ? imgw : imgw + zui_ELEMENT_H(ui) + zui_ELEMENT_OFFSET(ui); + ui._y += j == num - 1 ? imgw : imgw + ui_ELEMENT_H(ui) + ui_ELEMENT_OFFSET(ui); } } } else { - _zui_end_element(0); + _ui_end_element(0); if (show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } ui._x = uix; } @@ -184,13 +184,13 @@ function box_projects_tab(ui: zui_t) { } } -function box_projects_recent_tab(ui: zui_t) { - if (zui_tab(box_projects_htab, tr("Recent"), true)) { +function box_projects_recent_tab(ui: ui_t) { + if (ui_tab(box_projects_htab, tr("Recent"), true)) { box_projects_draw_badge(ui); ui.enabled = config_raw.recent_projects.length > 0; - box_projects_hsearch.text = zui_text_input(box_projects_hsearch, tr("Search"), zui_align_t.LEFT, true, true); + box_projects_hsearch.text = ui_text_input(box_projects_hsearch, tr("Search"), ui_align_t.LEFT, true, true); ui.enabled = true; for (let i: i32 = 0; i < config_raw.recent_projects.length; ++i) { @@ -207,7 +207,7 @@ function box_projects_recent_tab(ui: zui_t) { continue; // Search filter } - if (zui_button(file, zui_align_t.LEFT) && file_exists(path)) { + if (ui_button(file, ui_align_t.LEFT) && file_exists(path)) { let current: image_t = _g2_current; let g2_in_use: bool = _g2_in_use; if (g2_in_use) g2_end(); @@ -218,50 +218,50 @@ function box_projects_recent_tab(ui: zui_t) { ui_box_hide(); } if (ui.is_hovered) { - zui_tooltip(path); + ui_tooltip(path); } } ui.enabled = config_raw.recent_projects.length > 0; - if (zui_button(tr("Clear"), zui_align_t.LEFT)) { + if (ui_button(tr("Clear"), ui_align_t.LEFT)) { config_raw.recent_projects = []; config_save(); } ui.enabled = true; - _zui_end_element(); - if (zui_button(tr("New .."), zui_align_t.LEFT)) { + _ui_end_element(); + if (ui_button(tr("New .."), ui_align_t.LEFT)) { project_new_box(); } - if (zui_button(tr("Open..."), zui_align_t.LEFT)) { + if (ui_button(tr("Open..."), ui_align_t.LEFT)) { project_open(); } } } -function box_projects_draw_badge(ui: zui_t) { +function box_projects_draw_badge(ui: ui_t) { let img: image_t = data_get_image("badge.k"); - _zui_image(img); - _zui_end_element(); + _ui_image(img); + _ui_end_element(); } -function box_projects_get_started_tab(ui: zui_t) { - if (zui_tab(box_projects_htab, tr("Get Started"), true)) { - if (zui_button(tr("Manual"))) { +function box_projects_get_started_tab(ui: ui_t) { + if (ui_tab(box_projects_htab, tr("Get Started"), true)) { + if (ui_button(tr("Manual"))) { file_load_url(manifest_url + "/manual"); } - if (zui_button(tr("How To"))) { + if (ui_button(tr("How To"))) { file_load_url(manifest_url + "/howto"); } - if (zui_button(tr("What's New"))) { + if (ui_button(tr("What's New"))) { file_load_url(manifest_url + "/notes"); } } } function box_projects_align_to_fullscreen() { - ui_box_modalw = math_floor(sys_width() / zui_SCALE(base_ui_box)); - ui_box_modalh = math_floor(sys_height() / zui_SCALE(base_ui_box)); + ui_box_modalw = math_floor(sys_width() / ui_SCALE(base_ui_box)); + ui_box_modalh = math_floor(sys_height() / ui_SCALE(base_ui_box)); let appw: i32 = sys_width(); let apph: i32 = sys_height(); let mw: i32 = appw; diff --git a/base/sources/config.ts b/base/sources/config.ts index bb2dd7f5..66dc4ba2 100644 --- a/base/sources/config.ts +++ b/base/sources/config.ts @@ -2,7 +2,7 @@ let config_raw: config_t = null; let config_keymap: map_t; let config_loaded: bool = false; -let config_button_align: zui_align_t = zui_align_t.LEFT; +let config_button_align: ui_align_t = ui_align_t.LEFT; let config_default_button_spacing: string = " "; let config_button_spacing: string = config_default_button_spacing; @@ -165,9 +165,9 @@ function config_init() { } } - zui_touch_scroll = config_raw.touch_ui; - zui_touch_hold = config_raw.touch_ui; - zui_touch_tooltip = config_raw.touch_ui; + ui_touch_scroll = config_raw.touch_ui; + ui_touch_hold = config_raw.touch_ui; + ui_touch_tooltip = config_raw.touch_ui; base_res_handle.position = config_raw.layer_res; config_load_keymap(); } @@ -217,7 +217,7 @@ function config_get_options(): kinc_sys_ops_t { } function config_restore() { - zui_children = map_create(); // Reset ui handles + ui_children = map_create(); // Reset ui handles config_loaded = false; let _layout: i32[] = config_raw.layout; config_init(); @@ -234,7 +234,7 @@ function config_import_from(from: config_t) { config_raw = from; config_raw.sha = _sha; config_raw.version = _version; - zui_children = map_create(); // Reset ui handles + ui_children = map_create(); // Reset ui handles config_load_keymap(); base_init_layout(); translator_load_translations(config_raw.locale); @@ -334,11 +334,11 @@ function config_get_texture_res_pos(i: i32): i32 { } function config_load_theme(theme: string, tag_redraw: bool = true) { - base_theme = zui_theme_create(); + base_theme = ui_theme_create(); if (theme != "default.json") { let b: buffer_t = data_get_blob("themes/" + theme); - let parsed: zui_theme_t = json_parse(sys_buffer_to_string(b)); + let parsed: ui_theme_t = json_parse(sys_buffer_to_string(b)); base_theme = parsed; } @@ -346,7 +346,7 @@ function config_load_theme(theme: string, tag_redraw: bool = true) { if (tag_redraw) { for (let i: i32 = 0; i < base_get_uis().length; ++i) { - let ui: zui_t = base_get_uis()[i]; + let ui: ui_t = base_get_uis()[i]; ui.ops.theme = base_theme; } ui_base_tag_ui_redraw(); @@ -361,12 +361,12 @@ function config_load_theme(theme: string, tag_redraw: bool = true) { base_theme.ARROW_SIZE = 5 + 2; base_theme.CHECK_SIZE = 15 + 4; base_theme.CHECK_SELECT_SIZE = 8 + 2; - config_button_align = zui_align_t.LEFT; + config_button_align = ui_align_t.LEFT; config_button_spacing = ""; } else { base_theme.FULL_TABS = false; - config_button_align = zui_align_t.LEFT; + config_button_align = ui_align_t.LEFT; config_button_spacing = config_default_button_spacing; } } diff --git a/base/sources/console.ts b/base/sources/console.ts index 4291d7d8..04da6c40 100644 --- a/base/sources/console.ts +++ b/base/sources/console.ts @@ -8,7 +8,7 @@ let console_progress_text: string = null; function console_draw_toast(s: string) { g2_set_color(0x55000000); g2_fill_rect(0, 0, sys_width(), sys_height()); - let scale: f32 = zui_SCALE(base_get_uis()[0]); + let scale: f32 = ui_SCALE(base_get_uis()[0]); let x: f32 = sys_width() / 2; let y: f32 = sys_height() - 200 * scale; g2_fill_rect(x - 200 * scale, y, 400 * scale, 80 * scale); diff --git a/base/sources/context.ts b/base/sources/context.ts index ee4e3fa3..5c78fed0 100644 --- a/base/sources/context.ts +++ b/base/sources/context.ts @@ -27,9 +27,9 @@ type context_t = { preview_envmap?: image_t; envmap_loaded?: bool; show_envmap?: bool; - show_envmap_handle?: zui_handle_t; + show_envmap_handle?: ui_handle_t; show_envmap_blur?: bool; - show_envmap_blur_handle?: zui_handle_t; + show_envmap_blur_handle?: ui_handle_t; envmap_angle?: f32; light_angle?: f32; cull_backfaces?: bool; @@ -92,14 +92,14 @@ type context_t = { brush_can_lock?: bool; brush_can_unlock?: bool; camera_type?: camera_type_t; - cam_handle?: zui_handle_t; - fov_handle?: zui_handle_t; - undo_handle?: zui_handle_t; - hssao?: zui_handle_t; - hssr?: zui_handle_t; - hbloom?: zui_handle_t; - hsupersample?: zui_handle_t; - hvxao?: zui_handle_t; + cam_handle?: ui_handle_t; + fov_handle?: ui_handle_t; + undo_handle?: ui_handle_t; + hssao?: ui_handle_t; + hssr?: ui_handle_t; + hbloom?: ui_handle_t; + hsupersample?: ui_handle_t; + hvxao?: ui_handle_t; ///if is_forge vxao_ext?: f32; ///else @@ -138,7 +138,7 @@ type context_t = { uvx_picked?: f32; uvy_picked?: f32; picker_select_material?: bool; - picker_mask_handle?: zui_handle_t; + picker_mask_handle?: ui_handle_t; pick_pos_nor_tex?: bool; posx_picked?: f32; posy_picked?: f32; @@ -148,11 +148,11 @@ type context_t = { norz_picked?: f32; draw_wireframe?: bool; - wireframe_handle?: zui_handle_t; + wireframe_handle?: ui_handle_t; draw_texels?: bool; - texels_handle?: zui_handle_t; + texels_handle?: ui_handle_t; - colorid_handle?: zui_handle_t; + colorid_handle?: ui_handle_t; layers_export?: export_mode_t; decal_image?: image_t; @@ -225,17 +225,17 @@ type context_t = { brush_directional?: bool; brush_radius?: f32; - brush_radius_handle?: zui_handle_t; + brush_radius_handle?: ui_handle_t; brush_scale_x?: f32; brush_decal_mask_radius?: f32; - brush_decal_mask_radius_handle?: zui_handle_t; - brush_scale_x_handle?: zui_handle_t; + brush_decal_mask_radius_handle?: ui_handle_t; + brush_scale_x_handle?: ui_handle_t; brush_blending?: blend_type_t; brush_opacity?: f32; - brush_opacity_handle?: zui_handle_t; + brush_opacity_handle?: ui_handle_t; brush_scale?: f32; brush_angle?: f32; - brush_angle_handle?: zui_handle_t; + brush_angle_handle?: ui_handle_t; ///if is_paint brush_hardness?: f32; ///end @@ -265,7 +265,7 @@ type context_t = { sym_x?: bool; sym_y?: bool; sym_z?: bool; - fill_type_handle?: zui_handle_t; + fill_type_handle?: ui_handle_t; paint2d?: bool; @@ -282,7 +282,7 @@ type context_t = { color_picker_previous_tool?: workspace_tool_t; brush_radius?: f32; - brush_radius_handle?: zui_handle_t; + brush_radius_handle?: ui_handle_t; brush_scale?: f32; coords?: vec4_t; @@ -317,9 +317,9 @@ function context_create(): context_t { c.picked_color = make_swatch(); c.envmap_loaded = false; c.show_envmap = false; - c.show_envmap_handle = zui_handle_create(); + c.show_envmap_handle = ui_handle_create(); c.show_envmap_blur = false; - c.show_envmap_blur_handle = zui_handle_create(); + c.show_envmap_blur_handle = ui_handle_create(); c.envmap_angle = 0.0; c.light_angle = 0.0; c.cull_backfaces = true; @@ -373,7 +373,7 @@ function context_create(): context_t { c.brush_can_lock = false; c.brush_can_unlock = false; c.camera_type = camera_type_t.PERSPECTIVE; - c.cam_handle = zui_handle_create(); + c.cam_handle = ui_handle_create(); ///if is_forge c.vxao_ext = 2.0; ///else @@ -400,7 +400,7 @@ function context_create(): context_t { c.uvx_picked = 0.0; c.uvy_picked = 0.0; c.picker_select_material = true; - c.picker_mask_handle = zui_handle_create(); + c.picker_mask_handle = ui_handle_create(); c.pick_pos_nor_tex = false; c.posx_picked = 0.0; c.posy_picked = 0.0; @@ -409,10 +409,10 @@ function context_create(): context_t { c.nory_picked = 0.0; c.norz_picked = 0.0; c.draw_wireframe = false; - c.wireframe_handle = zui_handle_create(); + c.wireframe_handle = ui_handle_create(); c.draw_texels = false; - c.texels_handle = zui_handle_create(); - c.colorid_handle = zui_handle_create(); + c.texels_handle = ui_handle_create(); + c.colorid_handle = ui_handle_create(); c.layers_export = export_mode_t.VISIBLE; c.decal_preview = false; c.decal_x = 0.0; @@ -457,21 +457,21 @@ function context_create(): context_t { c.brush_nodes_hardness = 1.0; c.brush_directional = false; c.brush_radius = 0.5; - c.brush_radius_handle = zui_handle_create(); + c.brush_radius_handle = ui_handle_create(); c.brush_radius_handle.value = 0.5; c.brush_scale_x = 1.0; c.brush_decal_mask_radius = 0.5; - c.brush_decal_mask_radius_handle = zui_handle_create(); + c.brush_decal_mask_radius_handle = ui_handle_create(); c.brush_decal_mask_radius_handle.value = 0.5; - c.brush_scale_x_handle = zui_handle_create(); + c.brush_scale_x_handle = ui_handle_create(); c.brush_scale_x_handle.value = 1.0; c.brush_blending = blend_type_t.MIX; c.brush_opacity = 1.0; - c.brush_opacity_handle = zui_handle_create(); + c.brush_opacity_handle = ui_handle_create(); c.brush_opacity_handle.value = 1.0; c.brush_scale = 1.0; c.brush_angle = 0.0; - c.brush_angle_handle = zui_handle_create(); + c.brush_angle_handle = ui_handle_create(); c.brush_angle_handle.value = 0.0; ///if is_paint c.brush_hardness = 0.8; @@ -501,7 +501,7 @@ function context_create(): context_t { c.sym_x = false; c.sym_y = false; c.sym_z = false; - c.fill_type_handle = zui_handle_create(); + c.fill_type_handle = ui_handle_create(); c.paint2d = false; c.last_htab0_pos = 0; c.maximized_sidebar_width = 0; @@ -512,7 +512,7 @@ function context_create(): context_t { c.tool = workspace_tool_t.ERASER; c.color_picker_previous_tool = workspace_tool_t.ERASER; c.brush_radius = 0.25; - c.brush_radius_handle = zui_handle_create(); + c.brush_radius_handle = ui_handle_create(); c.brush_radius_handle.value = 0.25; c.brush_scale = 1.0; c.coords = vec4_create(); @@ -770,12 +770,12 @@ function context_in_paint_area(): bool { } function context_in_layers(): bool { - let tab: string = zui_hovered_tab_name(); + let tab: string = ui_hovered_tab_name(); return tab == tr("Layers"); } function context_in_materials(): bool { - let tab: string = zui_hovered_tab_name(); + let tab: string = ui_hovered_tab_name(); return tab == tr("Materials"); } @@ -794,12 +794,12 @@ function context_in_nodes(): bool { } function context_in_swatches(): bool { - let tab: string = zui_hovered_tab_name(); + let tab: string = ui_hovered_tab_name(); return tab == tr("Swatches"); } function context_in_browser(): bool { - let tab: string = zui_hovered_tab_name(); + let tab: string = ui_hovered_tab_name(); return tab == tr("Browser"); } @@ -913,9 +913,9 @@ function context_run_brush(from: i32) { context_raw.last_paint_vec_y = context_raw.paint_vec.y; } - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let inpaint: bool = nodes.nodes_selected_id.length > 0 && zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; // Paint bounds if (inpaint && diff --git a/base/sources/export_arm.ts b/base/sources/export_arm.ts index 2be1d9fd..e996f91d 100644 --- a/base/sources/export_arm.ts +++ b/base/sources/export_arm.ts @@ -19,18 +19,18 @@ function export_arm_run_mesh(path: string, paint_objects: mesh_object_t[]) { function export_arm_run_project() { ///if (is_paint || is_sculpt) - let mnodes: zui_node_canvas_t[] = []; + let mnodes: ui_node_canvas_t[] = []; for (let i: i32 = 0; i < project_materials.length; ++i) { let m: slot_material_t = project_materials[i]; - let c: zui_node_canvas_t = util_clone_canvas(m.canvas); + let c: ui_node_canvas_t = util_clone_canvas(m.canvas); for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; export_arm_export_node(n); } array_push(mnodes, c); } - let bnodes: zui_node_canvas_t[] = []; + let bnodes: ui_node_canvas_t[] = []; for (let i: i32 = 0; i < project_brushes.length; ++i) { let b: slot_brush_t = project_brushes[i]; array_push(bnodes, b.canvas); @@ -38,21 +38,21 @@ function export_arm_run_project() { ///end ///if is_lab - let c: zui_node_canvas_t = util_clone_canvas(project_canvas); + let c: ui_node_canvas_t = util_clone_canvas(project_canvas); for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; export_arm_export_node(n); } ///end - let mgroups: zui_node_canvas_t[] = null; + let mgroups: ui_node_canvas_t[] = null; if (project_material_groups.length > 0) { mgroups = []; for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; - let c: zui_node_canvas_t = util_clone_canvas(g.canvas); + let c: ui_node_canvas_t = util_clone_canvas(g.canvas); for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; export_arm_export_node(n); } array_push(mgroups, c); @@ -232,7 +232,7 @@ function export_arm_texture_node_name(): string { ///end } -function export_arm_export_node(n: zui_node_t, assets: asset_t[] = null) { +function export_arm_export_node(n: ui_node_t, assets: asset_t[] = null) { if (n.type == export_arm_texture_node_name()) { let index: i32 = n.buttons[0].default_value[0]; n.buttons[0].data = u8_array_create_from_string(base_enum_texts(n.type)[index]); @@ -249,13 +249,13 @@ function export_arm_export_node(n: zui_node_t, assets: asset_t[] = null) { // n.color -= 4294967296; // } // for (let i: i32 = 0; i < n.inputs.length; ++i) { - // let inp: zui_node_socket_t = n.inputs[i]; + // let inp: ui_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]; + // let out: ui_node_socket_t = n.outputs[i]; // if (out.color > 0) { // out.color -= 4294967296; // } @@ -265,24 +265,24 @@ function export_arm_export_node(n: zui_node_t, assets: asset_t[] = null) { ///if (is_paint || is_sculpt) function export_arm_run_material(path: string) { if (!ends_with(path, ".arm")) path += ".arm"; - let mnodes: zui_node_canvas_t[] = []; - let mgroups: zui_node_canvas_t[] = null; + let mnodes: ui_node_canvas_t[] = []; + let mgroups: ui_node_canvas_t[] = null; let m: slot_material_t = context_raw.material; - let c: zui_node_canvas_t = util_clone_canvas(m.canvas); + let c: ui_node_canvas_t = util_clone_canvas(m.canvas); let assets: asset_t[] = []; if (ui_nodes_has_group(c)) { mgroups = []; ui_nodes_traverse_group(mgroups, c); for (let i: i32 = 0; i < mgroups.length; ++i) { - let gc: zui_node_canvas_t = mgroups[i]; + let gc: ui_node_canvas_t = mgroups[i]; for (let i: i32 = 0; i < gc.nodes.length; ++i) { - let n: zui_node_t = gc.nodes[i]; + let n: ui_node_t = gc.nodes[i]; export_arm_export_node(n, assets); } } } for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; export_arm_export_node(n, assets); } array_push(mnodes, c); @@ -348,12 +348,12 @@ function export_arm_run_brush(path: string) { if (!ends_with(path, ".arm")) { path += ".arm"; } - let bnodes: zui_node_canvas_t[] = []; + let bnodes: ui_node_canvas_t[] = []; let b: slot_brush_t = context_raw.brush; - let c: zui_node_canvas_t = util_clone_canvas(b.canvas); + let c: ui_node_canvas_t = util_clone_canvas(b.canvas); let assets: asset_t[] = []; for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; export_arm_export_node(n, assets); } array_push(bnodes, c); diff --git a/base/sources/history.ts b/base/sources/history.ts index a5f2c28c..a04dd047 100644 --- a/base/sources/history.ts +++ b/base/sources/history.ts @@ -191,7 +191,7 @@ function history_undo() { else if (step.name == tr("Delete Node Group")) { let ng: node_group_t = { canvas: null, - nodes: zui_nodes_create() + nodes: ui_nodes_create() }; array_insert(project_material_groups, step.canvas_group, ng); history_swap_canvas(step); @@ -466,10 +466,10 @@ function history_reset() { } ///if (is_paint || is_sculpt) -function history_edit_nodes(canvas: zui_node_canvas_t, canvas_type: i32, canvas_group: i32 = -1) { +function history_edit_nodes(canvas: ui_node_canvas_t, canvas_type: i32, canvas_group: i32 = -1) { ///end ///if is_lab -function history_edit_nodes(canvas: zui_node_canvas_t, canvas_group: i32 = -1) { +function history_edit_nodes(canvas: ui_node_canvas_t, canvas_group: i32 = -1) { ///end let step: step_t = history_push(tr("Edit Nodes")); step.canvas_group = canvas_group; @@ -729,7 +729,7 @@ function history_copy_to_undo(from_id: i32, to_id: i32, is_mask: bool) { } ///end -function history_get_canvas(step: step_t): zui_node_canvas_t { +function history_get_canvas(step: step_t): ui_node_canvas_t { ///if (is_paint || is_sculpt) if (step.canvas_group == -1) { return project_materials[step.material].canvas; @@ -744,7 +744,7 @@ function history_get_canvas(step: step_t): zui_node_canvas_t { ///end } -function history_set_canvas(step: step_t, canvas: zui_node_canvas_t) { +function history_set_canvas(step: step_t, canvas: ui_node_canvas_t) { ///if (is_paint || is_sculpt) if (step.canvas_group == -1) { project_materials[step.material].canvas = canvas; @@ -758,13 +758,13 @@ function history_set_canvas(step: step_t, canvas: zui_node_canvas_t) { function history_swap_canvas(step: step_t) { ///if (is_paint || is_sculpt) if (step.canvas_type == 0) { - let _canvas: zui_node_canvas_t = history_get_canvas(step); + let _canvas: ui_node_canvas_t = history_get_canvas(step); history_set_canvas(step, step.canvas); step.canvas = _canvas; context_raw.material = project_materials[step.material]; } else { - let _canvas: zui_node_canvas_t = project_brushes[step.brush].canvas; + let _canvas: ui_node_canvas_t = project_brushes[step.brush].canvas; project_brushes[step.brush].canvas = step.canvas; step.canvas = _canvas; context_raw.brush = project_brushes[step.brush]; @@ -772,7 +772,7 @@ function history_swap_canvas(step: step_t) { ///end ///if is_lab - let _canvas: zui_node_canvas_t = history_get_canvas(step); + let _canvas: ui_node_canvas_t = history_get_canvas(step); history_set_canvas(step, step.canvas); step.canvas = _canvas; ///end @@ -783,7 +783,7 @@ function history_swap_canvas(step: step_t) { type step_t = { name?: string; - canvas?: zui_node_canvas_t; // Node history + canvas?: ui_node_canvas_t; // Node history canvas_group?: i32; ///if (is_paint || is_sculpt) layer?: i32; diff --git a/base/sources/import_arm.ts b/base/sources/import_arm.ts index 6567b44d..665a4fbf 100644 --- a/base/sources/import_arm.ts +++ b/base/sources/import_arm.ts @@ -330,7 +330,7 @@ function import_arm_run_project(path: string) { project_materials = []; for (let i: i32 = 0; i < project.material_nodes.length; ++i) { - let n: zui_node_canvas_t = project.material_nodes[i]; + let n: ui_node_canvas_t = project.material_nodes[i]; import_arm_init_nodes(n.nodes); context_raw.material = slot_material_create(m0, n); array_push(project_materials, context_raw.material); @@ -342,10 +342,10 @@ function import_arm_run_project(path: string) { project_material_groups = []; if (project.material_groups != null) { for (let i: i32 = 0; i < project.material_groups.length; ++i) { - let g: zui_node_canvas_t = project.material_groups[i]; + let g: ui_node_canvas_t = project.material_groups[i]; let ng: node_group_t = { canvas: g, - nodes: zui_nodes_create() + nodes: ui_nodes_create() }; array_push(project_material_groups, ng); } @@ -361,7 +361,7 @@ function import_arm_run_project(path: string) { project_brushes = []; for (let i: i32 = 0; i < project.brush_nodes.length; ++i) { - let n: zui_node_canvas_t = project.brush_nodes[i]; + let n: ui_node_canvas_t = project.brush_nodes[i]; import_arm_init_nodes(n.nodes); context_raw.brush = slot_brush_create(n); array_push(project_brushes, context_raw.brush); @@ -457,7 +457,7 @@ function import_arm_run_material_from_project(project: project_format_t, path: s let imported: slot_material_t[] = []; for (let i: i32 = 0; i < project.material_nodes.length; ++i) { - let c: zui_node_canvas_t = project.material_nodes[i]; + let c: ui_node_canvas_t = project.material_nodes[i]; import_arm_init_nodes(c.nodes); context_raw.material = slot_material_create(m0, c); array_push(project_materials, context_raw.material); @@ -467,14 +467,14 @@ function import_arm_run_material_from_project(project: project_format_t, path: s if (project.material_groups != null) { for (let i: i32 = 0; i < project.material_groups.length; ++i) { - let c: zui_node_canvas_t = project.material_groups[i]; + let c: ui_node_canvas_t = project.material_groups[i]; while (import_arm_group_exists(c)) { import_arm_rename_group(c.name, imported, project.material_groups); // Ensure unique group name } import_arm_init_nodes(c.nodes); let ng: node_group_t = { canvas: c, - nodes: zui_nodes_create() + nodes: ui_nodes_create() }; array_push(project_material_groups, ng); } @@ -494,7 +494,7 @@ function import_arm_run_material_from_project(project: project_format_t, path: s data_delete_blob(path); } -function import_arm_group_exists(c: zui_node_canvas_t): bool { +function import_arm_group_exists(c: ui_node_canvas_t): bool { for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; if (g.canvas.name == c.name) { @@ -504,23 +504,23 @@ function import_arm_group_exists(c: zui_node_canvas_t): bool { return false; } -function import_arm_rename_group(name: string, materials: slot_material_t[], groups: zui_node_canvas_t[]) { +function import_arm_rename_group(name: string, materials: slot_material_t[], groups: ui_node_canvas_t[]) { for (let i: i32 = 0; i < materials.length; ++i) { let m: slot_material_t = materials[i]; for (let i: i32 = 0; i < m.canvas.nodes.length; ++i) { - let n: zui_node_t = m.canvas.nodes[i]; + let n: ui_node_t = m.canvas.nodes[i]; if (n.type == "GROUP" && n.name == name) { n.name += ".1"; } } } for (let i: i32 = 0; i < groups.length; ++i) { - let c: zui_node_canvas_t = groups[i]; + let c: ui_node_canvas_t = groups[i]; if (c.name == name) { c.name += ".1"; } for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; if (n.type == "GROUP" && n.name == name) { n.name += ".1"; } @@ -562,7 +562,7 @@ function import_arm_run_brush_from_project(project: project_format_t, path: stri let imported: slot_brush_t[] = []; for (let i: i32 = 0; i < project.brush_nodes.length; ++i) { - let n: zui_node_canvas_t = project.brush_nodes[i]; + let n: ui_node_canvas_t = project.brush_nodes[i]; import_arm_init_nodes(n.nodes); context_raw.brush = slot_brush_create(n); array_push(project_brushes, context_raw.brush); @@ -630,9 +630,9 @@ function import_arm_texture_node_name(): string { ///end } -function import_arm_init_nodes(nodes: zui_node_t[]) { +function import_arm_init_nodes(nodes: ui_node_t[]) { for (let i: i32 = 0; i < nodes.length; ++i) { - let node: zui_node_t = nodes[i]; + let node: ui_node_t = nodes[i]; if (node.type == import_arm_texture_node_name()) { node.buttons[0].default_value = f32_array_create_x(base_get_asset_index(u8_array_to_string(node.buttons[0].data))); node.buttons[0].data = u8_array_create_from_string(""); diff --git a/base/sources/import_blend_material.ts b/base/sources/import_blend_material.ts index a4d2c496..f6dccfb5 100644 --- a/base/sources/import_blend_material.ts +++ b/base/sources/import_blend_material.ts @@ -23,23 +23,23 @@ function import_blend_material_run(path: string) { context_raw.material = slot_material_create(project_materials[0].data); array_push(project_materials, context_raw.material); array_push(imported, context_raw.material); - let nodes: zui_nodes_t = context_raw.material.nodes; - let canvas: zui_node_canvas_t = context_raw.material.canvas; + let nodes: ui_nodes_t = context_raw.material.nodes; + let canvas: ui_node_canvas_t = context_raw.material.canvas; let id: bl_handle_t = bl_handle_get(mat, "id"); canvas.name = bl_handle_get(id, "name"); // MAWood canvas.name = substring(canvas.name, 2, canvas.name.length); - let nout: zui_node_t = null; + let nout: ui_node_t = null; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.type == "OUTPUT_MATERIAL_PBR") { nout = n; break; } } for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.name == "RGB") { - zui_remove_node(n, canvas); + ui_remove_node(n, canvas); break; } } @@ -79,12 +79,12 @@ function import_blend_material_run(path: string) { // Search for node in list let search: string = bl_handle_get(node, "idname"); search = to_lower_case(substring(search, 10, search.length)); - let base: zui_node_t = null; + let base: ui_node_t = null; for (let i: i32 = 0; i < nodes_material_list.length; ++i) { - let list: zui_node_t[] = nodes_material_list[i]; + let list: ui_node_t[] = nodes_material_list[i]; let found: bool = false; for (let i: i32 = 0; i < list.length; ++i) { - let n: zui_node_t = list[i]; + let n: ui_node_t = list[i]; let s: string = to_lower_case(string_replace_all(n.type, "_", "")); if (search == s) { base = n; @@ -98,7 +98,7 @@ function import_blend_material_run(path: string) { } if (base != null) { - let n: zui_node_t = ui_nodes_make_node(base, nodes, canvas); + let n: ui_node_t = ui_nodes_make_node(base, nodes, canvas); n.x = bl_handle_get_i(node, "locx") + 400; n.y = -bl_handle_get_i(node, "locy") + 400; n.name = bl_handle_get(node, "name"); @@ -221,14 +221,14 @@ function import_blend_material_run(path: string) { let from_id: i32 = -1; let to_id: i32 = -1; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.name == fromnode) { from_id = n.id; break; } } for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.name == tonode) { to_id = n.id; break; @@ -289,8 +289,8 @@ function import_blend_material_run(path: string) { } if (valid) { - let raw: zui_node_link_t = { - id: zui_next_link_id(canvas.links), + let raw: ui_node_link_t = { + id: ui_next_link_id(canvas.links), from_id: from_id, from_socket: from_socket, to_id: to_id, diff --git a/base/sources/import_obj.ts b/base/sources/import_obj.ts index 59ed168a..1edcaed8 100644 --- a/base/sources/import_obj.ts +++ b/base/sources/import_obj.ts @@ -10,7 +10,7 @@ function import_obj_run(path: string, replace_existing: bool = true) { let b: buffer_t = data_get_blob(path); if (is_udim) { - let part: raw_mesh_t = krom_io_obj_parse(b, split_code, 0, is_udim); + let part: raw_mesh_t = krom_obj_parse(b, split_code, 0, is_udim); let name: string = part.name; for (let i: i32 = 0; i < part.udims.length; ++i) { let a: u32_array_t = part.udims[i]; @@ -37,10 +37,10 @@ function import_obj_run(path: string, replace_existing: bool = true) { } else { let parts: raw_mesh_t[] = []; - let part: raw_mesh_t = krom_io_obj_parse(b, split_code, 0, false); + let part: raw_mesh_t = krom_obj_parse(b, split_code, 0, false); array_push(parts, part); while (part.has_next) { - part = krom_io_obj_parse(b, split_code, part.pos, false); + part = krom_obj_parse(b, split_code, part.pos, false); // This part does not contain faces (may contain lines only) if (part.inda.length == 0) { continue; diff --git a/base/sources/node_shader_context.ts b/base/sources/node_shader_context.ts index 574b57b0..135e542b 100644 --- a/base/sources/node_shader_context.ts +++ b/base/sources/node_shader_context.ts @@ -138,5 +138,5 @@ function node_shader_context_make_frag(raw: node_shader_context_t): node_shader_ type material_t = { name?: string; - canvas?: zui_node_canvas_t; + canvas?: ui_node_canvas_t; }; diff --git a/base/sources/nodes/float_node.ts b/base/sources/nodes/float_node.ts index 62380344..346bd606 100644 --- a/base/sources/nodes/float_node.ts +++ b/base/sources/nodes/float_node.ts @@ -50,7 +50,7 @@ function float_node_set(self: float_node_t, value: f32_array_t) { } } -let float_node_def: zui_node_t = { +let float_node_def: ui_node_t = { id: 0, name: _tr("Value"), type: "float_node", diff --git a/base/sources/nodes/math_node.ts b/base/sources/nodes/math_node.ts index b9e036b3..e71d26c3 100644 --- a/base/sources/nodes/math_node.ts +++ b/base/sources/nodes/math_node.ts @@ -133,7 +133,7 @@ function math_node_get(self: math_node_t, from: i32): logic_node_value_t { return v; } -let math_node_def: zui_node_t = { +let math_node_def: ui_node_t = { id: 0, name: _tr("Math"), type: "math_node", diff --git a/base/sources/nodes/random_node.ts b/base/sources/nodes/random_node.ts index f932dbbe..03f3dd32 100644 --- a/base/sources/nodes/random_node.ts +++ b/base/sources/nodes/random_node.ts @@ -58,7 +58,7 @@ function random_node_get_float(): f32 { return random_node_get_int() / 0x7fffffff; } -let random_node_def: zui_node_t = { +let random_node_def: ui_node_t = { id: 0, name: _tr("Random"), type: "random_node", diff --git a/base/sources/nodes/separate_vector_node.ts b/base/sources/nodes/separate_vector_node.ts index 6676b788..fa16c0cc 100644 --- a/base/sources/nodes/separate_vector_node.ts +++ b/base/sources/nodes/separate_vector_node.ts @@ -26,7 +26,7 @@ function separate_vector_node_get(self: separate_vector_node_t, from: i32): logi } } -let separate_vector_node_def: zui_node_t = { +let separate_vector_node_def: ui_node_t = { id: 0, name: _tr("Separate Vector"), type: "separate_vector_node", diff --git a/base/sources/nodes/time_node.ts b/base/sources/nodes/time_node.ts index 31195e17..6b55fc81 100644 --- a/base/sources/nodes/time_node.ts +++ b/base/sources/nodes/time_node.ts @@ -25,7 +25,7 @@ function time_node_get(self: time_node_t, from: i32): logic_node_value_t { } } -let time_node_def: zui_node_t = { +let time_node_def: ui_node_t = { id: 0, name: _tr("Time"), type: "time_node", diff --git a/base/sources/nodes/vector_math_node.ts b/base/sources/nodes/vector_math_node.ts index 46b4fa68..ad1da94b 100644 --- a/base/sources/nodes/vector_math_node.ts +++ b/base/sources/nodes/vector_math_node.ts @@ -140,7 +140,7 @@ function vector_math_node_get(self: vector_math_node_t, from: i32): logic_node_v } } -let vector_math_node_def: zui_node_t = { +let vector_math_node_def: ui_node_t = { id: 0, name: _tr("Vector Math"), type: "vector_math_node", diff --git a/base/sources/nodes/vector_node.ts b/base/sources/nodes/vector_node.ts index 77207cc4..4794626d 100644 --- a/base/sources/nodes/vector_node.ts +++ b/base/sources/nodes/vector_node.ts @@ -58,7 +58,7 @@ function vector_node_set(self: vector_node_t, value: f32_array_t) { logic_node_input_set(self.base.inputs[2], f32_array_create_x(value[2])); } -let vector_node_def: zui_node_t = { +let vector_node_def: ui_node_t = { id: 0, name: _tr("Vector"), type: "vector_node", diff --git a/base/sources/nodes_material.ts b/base/sources/nodes_material.ts index 58fbc7cb..c03efd02 100644 --- a/base/sources/nodes_material.ts +++ b/base/sources/nodes_material.ts @@ -8,7 +8,7 @@ let nodes_material_categories: string[] = [ _tr("Group") ]; -let nodes_material_input: zui_node_t[] = [ +let nodes_material_input: ui_node_t[] = [ { id: 0, name: _tr("Attribute"), @@ -1232,7 +1232,7 @@ let nodes_material_input: zui_node_t[] = [ }, ]; -// let nodes_material_output: zui_node_t[] = [ +// let nodes_material_output: ui_node_t[] = [ // { // id: 0, // name: _tr("Material Output"), @@ -1356,7 +1356,7 @@ let nodes_material_input: zui_node_t[] = [ // } // ]; -let nodes_material_texture: zui_node_t[] = [ +let nodes_material_texture: ui_node_t[] = [ { id: 0, name: _tr("Brick Texture"), @@ -2050,7 +2050,7 @@ let nodes_material_texture: zui_node_t[] = [ } ]; -let nodes_material_color: zui_node_t[] = [ +let nodes_material_color: ui_node_t[] = [ { id: 0, name: _tr("Blur"), @@ -2548,7 +2548,7 @@ let nodes_material_color: zui_node_t[] = [ } ]; -let nodes_material_vector: zui_node_t[] = [ +let nodes_material_vector: ui_node_t[] = [ { id: 0, name: _tr("Bump"), @@ -2935,7 +2935,7 @@ let nodes_material_vector: zui_node_t[] = [ } ]; -let nodes_material_converter: zui_node_t[] = [ +let nodes_material_converter: ui_node_t[] = [ { id: 0, name: _tr("Clamp"), @@ -3803,7 +3803,7 @@ let nodes_material_converter: zui_node_t[] = [ } ]; -let nodes_material_group: zui_node_t[] = [ +let nodes_material_group: ui_node_t[] = [ { id: 0, name: _tr("New Group"), @@ -3830,7 +3830,7 @@ let nodes_material_group: zui_node_t[] = [ } ]; -type node_list_t = zui_node_t[]; +type node_list_t = ui_node_t[]; let nodes_material_list: node_list_t[] = [ nodes_material_input, @@ -3842,31 +3842,31 @@ let nodes_material_list: node_list_t[] = [ ]; function nodes_material_init() { - zui_nodes_custom_buttons = map_create(); - map_set(zui_nodes_custom_buttons, "nodes_material_vector_curves_button", nodes_material_vector_curves_button); - map_set(zui_nodes_custom_buttons, "nodes_material_color_ramp_button", nodes_material_color_ramp_button); - map_set(zui_nodes_custom_buttons, "nodes_material_new_group_button", nodes_material_new_group_button); - map_set(zui_nodes_custom_buttons, "nodes_material_group_input_button", nodes_material_group_input_button); - map_set(zui_nodes_custom_buttons, "nodes_material_group_output_button", nodes_material_group_output_button); + ui_nodes_custom_buttons = map_create(); + map_set(ui_nodes_custom_buttons, "nodes_material_vector_curves_button", nodes_material_vector_curves_button); + map_set(ui_nodes_custom_buttons, "nodes_material_color_ramp_button", nodes_material_color_ramp_button); + map_set(ui_nodes_custom_buttons, "nodes_material_new_group_button", nodes_material_new_group_button); + map_set(ui_nodes_custom_buttons, "nodes_material_group_input_button", nodes_material_group_input_button); + map_set(ui_nodes_custom_buttons, "nodes_material_group_output_button", nodes_material_group_output_button); } function nodes_material_vector_curves_button(node_id: i32) { - let ui: zui_t = ui_nodes_ui; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, node_id); + let ui: ui_t = ui_nodes_ui; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id); - let but: zui_node_button_t = node.buttons[0]; - let nhandle: zui_handle_t = zui_nest(zui_handle(__ID__), node.id); + let but: ui_node_button_t = node.buttons[0]; + let nhandle: ui_handle_t = ui_nest(ui_handle(__ID__), node.id); let row: f32[] = [1 / 3, 1 / 3, 1 / 3]; - zui_row(row); - zui_radio(zui_nest(zui_nest(nhandle, 0), 1), 0, "X"); - zui_radio(zui_nest(zui_nest(nhandle, 0), 1), 1, "Y"); - zui_radio(zui_nest(zui_nest(nhandle, 0), 1), 2, "Z"); + ui_row(row); + ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 0, "X"); + ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 1, "Y"); + ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 2, "Z"); // Preview - let axis: i32 = zui_nest(zui_nest(nhandle, 0), 1).position; + let axis: i32 = ui_nest(ui_nest(nhandle, 0), 1).position; let val: f32[] = but.default_value; - ui._y += zui_nodes_LINE_H() * 5; + ui._y += ui_nodes_LINE_H() * 5; let num: i32 = val[96 + axis]; @@ -3879,71 +3879,71 @@ function nodes_material_vector_curves_button(node_id: i32) { // Edit row = [1 / 5, 1 / 5, 3 / 5]; - zui_row(row); - if (zui_button("+")) { + ui_row(row); + if (ui_button("+")) { val[axis * 32 + num * 2 + 0] = 0.0; val[axis * 32 + num * 2 + 1] = 0.0; num++; val[96 + axis] = num; } - if (zui_button("-")) { + if (ui_button("-")) { if (num > 1) { num--; val[96 + axis] = num; } } - let ihandle: zui_handle_t = zui_nest(zui_nest(zui_nest(nhandle, 0), 2), axis); + let ihandle: ui_handle_t = ui_nest(ui_nest(ui_nest(nhandle, 0), 2), axis); if (ihandle.init) { ihandle.position = 0; } - let i: i32 = math_floor(zui_slider(ihandle, "Index", 0, num - 1, false, 1, true, zui_align_t.LEFT)); + let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, num - 1, false, 1, true, ui_align_t.LEFT)); if (i >= num || i < 0) { ihandle.value = i = num - 1; // Stay in bounds } row = [1 / 2, 1 / 2]; - zui_row(row); - zui_nest(zui_nest(nhandle, 0), 3).value = val[axis * 32 + i * 2 + 0]; - zui_nest(zui_nest(nhandle, 0), 4).value = val[axis * 32 + i * 2 + 1]; + ui_row(row); + ui_nest(ui_nest(nhandle, 0), 3).value = val[axis * 32 + i * 2 + 0]; + ui_nest(ui_nest(nhandle, 0), 4).value = val[axis * 32 + i * 2 + 1]; - let h1: zui_handle_t = zui_nest(zui_nest(nhandle, 0), 3); + let h1: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 3); if (h1.init) { h1.value = 0.0; } - let h2: zui_handle_t = zui_nest(zui_nest(nhandle, 0), 4); + let h2: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 4); if (h2.init) { h2.value = 0.0; } - val[axis * 32 + i * 2 + 0] = zui_slider(h1, "X", -1, 1, true, 100, true, zui_align_t.LEFT); - val[axis * 32 + i * 2 + 1] = zui_slider(h2, "Y", -1, 1, true, 100, true, zui_align_t.LEFT); + val[axis * 32 + i * 2 + 0] = ui_slider(h1, "X", -1, 1, true, 100, true, ui_align_t.LEFT); + val[axis * 32 + i * 2 + 1] = ui_slider(h2, "Y", -1, 1, true, 100, true, ui_align_t.LEFT); } function nodes_material_color_ramp_button(node_id: i32) { - let ui: zui_t = ui_nodes_ui; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, node_id); + let ui: ui_t = ui_nodes_ui; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id); - let but: zui_node_button_t = node.buttons[0]; - let nhandle: zui_handle_t = zui_nest(zui_handle(__ID__), node.id); + let but: ui_node_button_t = node.buttons[0]; + let nhandle: ui_handle_t = ui_nest(ui_handle(__ID__), node.id); let nx: f32 = ui._x; let ny: f32 = ui._y; // Preview let vals: f32[] = but.default_value; // [r, g, b, a, pos, r, g, b, a, pos, ..] - let sw: f32 = ui._w / zui_nodes_SCALE(); + let sw: f32 = ui._w / ui_nodes_SCALE(); for (let i: i32 = 0; i < vals.length / 5; ++i) { let pos: f32 = vals[i * 5 + 4]; let col: i32 = color_from_floats(vals[i * 5 + 0], vals[i * 5 + 1], vals[i * 5 + 2], 1.0); - zui_fill(pos * sw, 0, (1.0 - pos) * sw, zui_nodes_LINE_H() - 2 * zui_nodes_SCALE(), col); + ui_fill(pos * sw, 0, (1.0 - pos) * sw, ui_nodes_LINE_H() - 2 * ui_nodes_SCALE(), col); } - ui._y += zui_nodes_LINE_H(); + ui._y += ui_nodes_LINE_H(); // Edit - let ihandle: zui_handle_t = zui_nest(zui_nest(nhandle, 0), 2); + let ihandle: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 2); let row: f32[] = [1 / 4, 1 / 4, 2 / 4]; - zui_row(row); - if (zui_button("+")) { + ui_row(row); + if (ui_button("+")) { array_push(vals, vals[vals.length - 5]); // r array_push(vals, vals[vals.length - 5]); // g array_push(vals, vals[vals.length - 5]); // b @@ -3951,7 +3951,7 @@ function nodes_material_color_ramp_button(node_id: i32) { array_push(vals, 1.0); // pos ihandle.value += 1; } - if (zui_button("-") && vals.length > 5) { + if (ui_button("-") && vals.length > 5) { array_pop(vals); array_pop(vals); array_pop(vals); @@ -3960,22 +3960,22 @@ function nodes_material_color_ramp_button(node_id: i32) { ihandle.value -= 1; } - let h: zui_handle_t = zui_nest(zui_nest(nhandle, 0), 1); + let h: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 1); if (h.init) { h.position = but.data[0]; } let interpolate_combo: string[] = [tr("Linear"), tr("Constant")]; - but.data[0] = zui_combo(h, interpolate_combo, tr("Interpolate")); + but.data[0] = ui_combo(h, interpolate_combo, tr("Interpolate")); row = [1 / 2, 1 / 2]; - zui_row(row); - let i: i32 = math_floor(zui_slider(ihandle, "Index", 0, (vals.length / 5) - 1, false, 1, true, zui_align_t.LEFT)); + ui_row(row); + let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, (vals.length / 5) - 1, false, 1, true, ui_align_t.LEFT)); if (i >= (vals.length * 5) || i < 0) { ihandle.value = i = (vals.length / 5) - 1; // Stay in bounds } - zui_nest(zui_nest(nhandle, 0), 3).value = vals[i * 5 + 4]; - vals[i * 5 + 4] = zui_slider(zui_nest(zui_nest(nhandle, 0), 3), "Pos", 0, 1, true, 100, true, zui_align_t.LEFT); + ui_nest(ui_nest(nhandle, 0), 3).value = vals[i * 5 + 4]; + vals[i * 5 + 4] = ui_slider(ui_nest(ui_nest(nhandle, 0), 3), "Pos", 0, 1, true, 100, true, ui_align_t.LEFT); if (vals[i * 5 + 4] > 1.0) { vals[i * 5 + 4] = 1.0; // Stay in bounds } @@ -3983,13 +3983,13 @@ function nodes_material_color_ramp_button(node_id: i32) { vals[i * 5 + 4] = 0.0; } - let chandle: zui_handle_t = zui_nest(zui_nest(nhandle, 0), 4); + let chandle: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 4); chandle.color = color_from_floats(vals[i * 5 + 0], vals[i * 5 + 1], vals[i * 5 + 2], 1.0); - if (zui_text("", zui_align_t.RIGHT, chandle.color) == zui_state_t.STARTED) { - let rx: f32 = nx + ui._w - zui_nodes_p(37); - let ry: f32 = ny - zui_nodes_p(5); + if (ui_text("", ui_align_t.RIGHT, chandle.color) == ui_state_t.STARTED) { + let rx: f32 = nx + ui._w - ui_nodes_p(37); + let ry: f32 = ny - ui_nodes_p(5); nodes._input_started = ui.input_started = false; - zui_nodes_rgba_popup(chandle, vals.buffer + i * 5, math_floor(rx), math_floor(ry + zui_ELEMENT_H(ui))); + ui_nodes_rgba_popup(chandle, vals.buffer + i * 5, math_floor(rx), math_floor(ry + ui_ELEMENT_H(ui))); } vals[i * 5 + 0] = color_get_rb(chandle.color) / 255; vals[i * 5 + 1] = color_get_gb(chandle.color) / 255; @@ -3997,9 +3997,9 @@ function nodes_material_color_ramp_button(node_id: i32) { } function nodes_material_new_group_button(node_id: i32) { - let ui: zui_t = ui_nodes_ui; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, node_id); + let ui: ui_t = ui_nodes_ui; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id); if (node.name == "New Group") { for (let i: i32 = 1; i < 999; ++i) { @@ -4019,7 +4019,7 @@ function nodes_material_new_group_button(node_id: i32) { } } - let canvas: zui_node_canvas_t = { + let canvas: ui_node_canvas_t = { name: node.name, nodes: [ { @@ -4061,7 +4061,7 @@ function nodes_material_new_group_button(node_id: i32) { }; let ng: node_group_t = { canvas: canvas, - nodes: zui_nodes_create() + nodes: ui_nodes_create() }; array_push(project_material_groups, ng); } @@ -4075,43 +4075,43 @@ function nodes_material_new_group_button(node_id: i32) { } } - if (zui_button(tr("Nodes"))) { + if (ui_button(tr("Nodes"))) { array_push(ui_nodes_group_stack, group); } } function nodes_material_group_input_button(node_id: i32) { - let ui: zui_t = ui_nodes_ui; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, node_id); + let ui: ui_t = ui_nodes_ui; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id); nodes_material_add_socket_button(ui, nodes, node, node.outputs); } function nodes_material_group_output_button(node_id: i32) { - let ui: zui_t = ui_nodes_ui; - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, node_id); + let ui: ui_t = ui_nodes_ui; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id); nodes_material_add_socket_button(ui, nodes, node, node.inputs); } -let _nodes_material_nodes: zui_nodes_t; -let _nodes_material_node: zui_node_t; -let _nodes_material_sockets: zui_node_socket_t[]; +let _nodes_material_nodes: ui_nodes_t; +let _nodes_material_node: ui_node_t; +let _nodes_material_sockets: ui_node_socket_t[]; -function nodes_material_add_socket_button(ui: zui_t, nodes: zui_nodes_t, node: zui_node_t, sockets: zui_node_socket_t[]) { - if (zui_button(tr("Add"))) { +function nodes_material_add_socket_button(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t, sockets: ui_node_socket_t[]) { + if (ui_button(tr("Add"))) { _nodes_material_nodes = nodes; _nodes_material_node = node; _nodes_material_sockets = sockets; - ui_menu_draw(function (ui: zui_t) { - let nodes: zui_nodes_t = _nodes_material_nodes; - let node: zui_node_t = _nodes_material_node; - let sockets: zui_node_socket_t[] = _nodes_material_sockets; + ui_menu_draw(function (ui: ui_t) { + let nodes: ui_nodes_t = _nodes_material_nodes; + let node: ui_node_t = _nodes_material_node; + let sockets: ui_node_socket_t[] = _nodes_material_sockets; let group_stack: node_group_t[] = ui_nodes_group_stack; - let c: zui_node_canvas_t = group_stack[group_stack.length - 1].canvas; + let c: ui_node_canvas_t = group_stack[group_stack.length - 1].canvas; if (ui_menu_button(ui, tr("RGBA"))) { array_push(sockets, nodes_material_create_socket(nodes, node, null, "RGBA", c)); nodes_material_sync_sockets(node); @@ -4128,9 +4128,9 @@ function nodes_material_add_socket_button(ui: zui_t, nodes: zui_nodes_t, node: z } } -function nodes_material_sync_sockets(node: zui_node_t) { +function nodes_material_sync_sockets(node: ui_node_t) { let group_stack: node_group_t[] = ui_nodes_group_stack; - let c: zui_node_canvas_t = group_stack[group_stack.length - 1].canvas; + let c: ui_node_canvas_t = group_stack[group_stack.length - 1].canvas; for (let i: i32 = 0; i < project_materials.length; ++i) { let m: slot_material_t = project_materials[i]; nodes_material_sync_group_sockets(m.canvas, c.name, node); @@ -4141,13 +4141,13 @@ function nodes_material_sync_sockets(node: zui_node_t) { } } -function nodes_material_sync_group_sockets(canvas: zui_node_canvas_t, group_name: string, node: zui_node_t) { +function nodes_material_sync_group_sockets(canvas: ui_node_canvas_t, group_name: string, node: ui_node_t) { for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.type == "GROUP" && n.name == group_name) { let is_inputs: bool = node.name == "Group Input"; - let old_sockets: zui_node_socket_t[] = is_inputs ? n.inputs : n.outputs; - let sockets: zui_node_socket_t[] = util_clone_canvas_sockets(is_inputs ? node.outputs : node.inputs); + let old_sockets: ui_node_socket_t[] = is_inputs ? n.inputs : n.outputs; + let sockets: ui_node_socket_t[] = util_clone_canvas_sockets(is_inputs ? node.outputs : node.inputs); if (is_inputs) { n.inputs = sockets; } @@ -4155,7 +4155,7 @@ function nodes_material_sync_group_sockets(canvas: zui_node_canvas_t, group_name n.outputs = sockets; } for (let i: i32 = 0; i < sockets.length; ++i) { - let s: zui_node_socket_t = sockets[i]; + let s: ui_node_socket_t = sockets[i]; s.node_id = n.id; } let num_sockets: i32 = sockets.length < old_sockets.length ? sockets.length : old_sockets.length; @@ -4180,9 +4180,9 @@ function nodes_material_get_socket_name(type: string): string { return type == "RGBA" ? _tr("Color") : type == "VECTOR" ? _tr("Vector") : _tr("Value"); } -function nodes_material_create_socket(nodes: zui_nodes_t, node: zui_node_t, name: string, type: string, canvas: zui_node_canvas_t, min: f32 = 0.0, max: f32 = 1.0, default_value: any = null): zui_node_socket_t { - let soc: zui_node_socket_t = { - id: zui_get_socket_id(canvas.nodes), +function nodes_material_create_socket(nodes: ui_nodes_t, node: ui_node_t, name: string, type: string, canvas: ui_node_canvas_t, min: f32 = 0.0, max: f32 = 1.0, default_value: any = null): ui_node_socket_t { + let soc: ui_node_socket_t = { + id: ui_get_socket_id(canvas.nodes), node_id: node.id, name: name == null ? nodes_material_get_socket_name(type) : name, type: type, @@ -4194,11 +4194,11 @@ function nodes_material_create_socket(nodes: zui_nodes_t, node: zui_node_t, name return soc; } -function nodes_material_get_node_t(node_type: string): zui_node_t { +function nodes_material_get_node_t(node_type: string): ui_node_t { for (let i: i32 = 0; i < nodes_material_list.length; ++i) { - let c: zui_node_t[] = nodes_material_list[i]; + let c: ui_node_t[] = nodes_material_list[i]; for (let i: i32 = 0; i < c.length; ++i) { - let n: zui_node_t = c[i]; + let n: ui_node_t = c[i]; if (n.type == node_type) { return n; } @@ -4207,14 +4207,14 @@ function nodes_material_get_node_t(node_type: string): zui_node_t { return null; } -function nodes_material_create_node(node_type: string, group: node_group_t = null): zui_node_t { - let n: zui_node_t = nodes_material_get_node_t(node_type); +function nodes_material_create_node(node_type: string, group: node_group_t = null): ui_node_t { + let n: ui_node_t = nodes_material_get_node_t(node_type); if (n == null) { return null; } - let canvas: zui_node_canvas_t = group != null ? group.canvas : context_raw.material.canvas; - let nodes: zui_nodes_t = group != null ? group.nodes : context_raw.material.nodes; - let node: zui_node_t = ui_nodes_make_node(n, nodes, canvas); + let canvas: ui_node_canvas_t = group != null ? group.canvas : context_raw.material.canvas; + let nodes: ui_nodes_t = group != null ? group.nodes : context_raw.material.nodes; + let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas); array_push(canvas.nodes, node); return node; } diff --git a/base/sources/parser_logic.ts b/base/sources/parser_logic.ts index 75b9df1b..ec338e90 100644 --- a/base/sources/parser_logic.ts +++ b/base/sources/parser_logic.ts @@ -1,24 +1,24 @@ let parser_logic_custom_nodes: map_t = map_create(); -let parser_logic_nodes: zui_node_t[]; -let parser_logic_links: zui_node_link_t[]; +let parser_logic_nodes: ui_node_t[]; +let parser_logic_links: ui_node_link_t[]; let parser_logic_parsed_nodes: string[] = null; let parser_logic_parsed_labels: map_t = null; let parser_logic_node_map: map_t; -let parser_logic_raw_map: map_t; +let parser_logic_raw_map: map_t; -function parser_logic_get_logic_node(node: zui_node_t): logic_node_ext_t { +function parser_logic_get_logic_node(node: ui_node_t): logic_node_ext_t { return map_get(parser_logic_node_map, parser_logic_node_name(node)); } -function parser_logic_get_raw_node(node: logic_node_ext_t): zui_node_t { +function parser_logic_get_raw_node(node: logic_node_ext_t): ui_node_t { return map_get(parser_logic_raw_map, node); } -function parser_logic_get_node(id: i32): zui_node_t { +function parser_logic_get_node(id: i32): ui_node_t { for (let i: i32 = 0; i < parser_logic_nodes.length; ++i) { - let n: zui_node_t = parser_logic_nodes[i]; + let n: ui_node_t = parser_logic_nodes[i]; if (n.id == id) { return n; } @@ -26,9 +26,9 @@ function parser_logic_get_node(id: i32): zui_node_t { return null; } -function parser_logic_get_link(id: i32): zui_node_link_t { +function parser_logic_get_link(id: i32): ui_node_link_t { for (let i: i32 = 0; i < parser_logic_links.length; ++i) { - let l: zui_node_link_t = parser_logic_links[i]; + let l: ui_node_link_t = parser_logic_links[i]; if (l.id == id) { return l; } @@ -36,11 +36,11 @@ function parser_logic_get_link(id: i32): zui_node_link_t { return null; } -function parser_logic_get_input_link(inp: zui_node_socket_t): zui_node_link_t { +function parser_logic_get_input_link(inp: ui_node_socket_t): ui_node_link_t { for (let i: i32 = 0; i < parser_logic_links.length; ++i) { - let l: zui_node_link_t = parser_logic_links[i]; + let l: ui_node_link_t = parser_logic_links[i]; if (l.to_id == inp.node_id) { - let node: zui_node_t = parser_logic_get_node(inp.node_id); + let node: ui_node_t = parser_logic_get_node(inp.node_id); if (node.inputs.length <= l.to_socket) { return null; } @@ -52,12 +52,12 @@ function parser_logic_get_input_link(inp: zui_node_socket_t): zui_node_link_t { return null; } -function parser_logic_get_output_links(out: zui_node_socket_t): zui_node_link_t[] { - let res: zui_node_link_t[] = []; +function parser_logic_get_output_links(out: ui_node_socket_t): ui_node_link_t[] { + let res: ui_node_link_t[] = []; for (let i: i32 = 0; i < parser_logic_links.length; ++i) { - let l: zui_node_link_t = parser_logic_links[i]; + let l: ui_node_link_t = parser_logic_links[i]; if (l.from_id == out.node_id) { - let node: zui_node_t = parser_logic_get_node(out.node_id); + let node: ui_node_t = parser_logic_get_node(out.node_id); if (node.outputs.length <= l.from_socket) { continue; } @@ -73,14 +73,14 @@ function parser_logic_safe_src(s: string): string { return string_replace_all(s, " ", ""); } -function parser_logic_node_name(node: zui_node_t): string { +function parser_logic_node_name(node: ui_node_t): string { let safe: string = parser_logic_safe_src(node.name); let nid: i32 = node.id; let s: string = safe + nid; return s; } -function parser_logic_parse(canvas: zui_node_canvas_t) { +function parser_logic_parse(canvas: ui_node_canvas_t) { parser_logic_nodes = canvas.nodes; parser_logic_links = canvas.links; @@ -88,15 +88,15 @@ function parser_logic_parse(canvas: zui_node_canvas_t) { parser_logic_parsed_labels = map_create(); parser_logic_node_map = map_create(); parser_logic_raw_map = map_create(); - let root_nodes: zui_node_t[] = parser_logic_get_root_nodes(canvas); + let root_nodes: ui_node_t[] = parser_logic_get_root_nodes(canvas); for (let i: i32 = 0; i < root_nodes.length; ++i) { - let node: zui_node_t = root_nodes[i]; + let node: ui_node_t = root_nodes[i]; parser_logic_build_node(node); } } -function parser_logic_build_node(node: zui_node_t): string { +function parser_logic_build_node(node: ui_node_t): string { // Get node name let name: string = parser_logic_node_name(node); @@ -114,10 +114,10 @@ function parser_logic_build_node(node: zui_node_t): string { // Expose button values in node // for (let i: i32 = 0; i < node.buttons.length; ++i) { - // let b: zui_node_button_t = node.buttons[i]; + // let b: ui_node_button_t = node.buttons[i]; // if (b.type == "ENUM") { // let array_data: bool = b.data.length > 1; - // let texts: string[] = array_data ? b.data : zui_enum_texts_js(node.type); + // let texts: string[] = array_data ? b.data : ui_enum_texts_js(node.type); // v[b.name] = texts[b.default_value]; // } // else { @@ -129,11 +129,11 @@ function parser_logic_build_node(node: zui_node_t): string { let inp_node: logic_node_ext_t = null; let inp_from: i32 = 0; for (let i: i32 = 0; i < node.inputs.length; ++i) { - let inp: zui_node_socket_t = node.inputs[i]; + let inp: ui_node_socket_t = node.inputs[i]; // Is linked - find node - let l: zui_node_link_t = parser_logic_get_input_link(inp); + let l: ui_node_link_t = parser_logic_get_input_link(inp); if (l != null) { - let n: zui_node_t = parser_logic_get_node(l.from_id); + let n: ui_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; @@ -149,13 +149,13 @@ function parser_logic_build_node(node: zui_node_t): string { // Create outputss for (let i: i32 = 0; i < node.outputs.length; ++i) { - let out: zui_node_socket_t = node.outputs[i]; + let out: ui_node_socket_t = node.outputs[i]; let out_nodes: logic_node_t[] = []; - let ls: zui_node_link_t[] = parser_logic_get_output_links(out); + let ls: ui_node_link_t[] = parser_logic_get_output_links(out); if (ls != null && ls.length > 0) { for (let i: i32 = 0; i < ls.length; ++i) { - let l: zui_node_link_t = ls[i]; - let n: zui_node_t = parser_logic_get_node(l.to_id); + let l: ui_node_link_t = ls[i]; + let n: ui_node_t = parser_logic_get_node(l.to_id); let out_name: string = parser_logic_build_node(n); array_push(out_nodes, map_get(parser_logic_node_map, out_name)); } @@ -171,14 +171,14 @@ function parser_logic_build_node(node: zui_node_t): string { return name; } -function parser_logic_get_root_nodes(node_group: zui_node_canvas_t): zui_node_t[] { - let roots: zui_node_t[] = []; +function parser_logic_get_root_nodes(node_group: ui_node_canvas_t): ui_node_t[] { + let roots: ui_node_t[] = []; for (let i: i32 = 0; i < node_group.nodes.length; ++i) { - let node: zui_node_t = node_group.nodes[i]; + let node: ui_node_t = node_group.nodes[i]; let linked: bool = false; for (let i: i32 = 0; i < node.outputs.length; ++i) { - let out: zui_node_socket_t = node.outputs[i]; - let ls: zui_node_link_t[] = parser_logic_get_output_links(out); + let out: ui_node_socket_t = node.outputs[i]; + let ls: ui_node_link_t[] = parser_logic_get_output_links(out); if (ls != null && ls.length > 0) { linked = true; break; @@ -191,7 +191,7 @@ function parser_logic_get_root_nodes(node_group: zui_node_canvas_t): zui_node_t[ return roots; } -function parser_logic_build_default_node(inp: zui_node_socket_t): logic_node_ext_t { +function parser_logic_build_default_node(inp: ui_node_socket_t): logic_node_ext_t { let v: logic_node_ext_t = null; if (inp.type == "VECTOR") { diff --git a/base/sources/parser_material.ts b/base/sources/parser_material.ts index f8d6171c..afdd50cf 100644 --- a/base/sources/parser_material.ts +++ b/base/sources/parser_material.ts @@ -21,17 +21,17 @@ let parser_material_frag: node_shader_t; let parser_material_curshader: node_shader_t; let parser_material_matcon: material_context_t; let parser_material_parsed: string[]; -let parser_material_parents: zui_node_t[]; +let parser_material_parents: ui_node_t[]; -let parser_material_canvases: zui_node_canvas_t[]; -let parser_material_nodes: zui_node_t[]; -let parser_material_links: zui_node_link_t[]; +let parser_material_canvases: ui_node_canvas_t[]; +let parser_material_nodes: ui_node_t[]; +let parser_material_links: ui_node_link_t[]; let parser_material_cotangent_frame_written: bool; let parser_material_tex_coord: string = "tex_coord"; let parser_material_eps: f32 = 0.000001; -let parser_material_custom_nodes: map_t = map_create(); // JSValue -> (n: zui_node_t, s: string)=>string +let parser_material_custom_nodes: map_t = map_create(); // JSValue -> (n: ui_node_t, s: string)=>string let parser_material_parse_surface: bool = true; let parser_material_parse_opacity: bool = true; let parser_material_parse_height: bool = false; @@ -50,9 +50,9 @@ let parser_material_bake_passthrough: bool = false; let parser_material_bake_passthrough_strength: string = "0.0"; let parser_material_bake_passthrough_radius: string = "0.0"; let parser_material_bake_passthrough_offset: string = "0.0"; -let parser_material_start_group: zui_node_canvas_t = null; -let parser_material_start_parents: zui_node_t[] = null; -let parser_material_start_node: zui_node_t = null; +let parser_material_start_group: ui_node_canvas_t = null; +let parser_material_start_parents: ui_node_t[] = null; +let parser_material_start_node: ui_node_t = null; let parser_material_arm_export_tangents: bool = true; let parser_material_out_normaltan: string; // Raw tangent space normal parsed from normal map @@ -62,9 +62,9 @@ let parser_material_script_links: map_t = null; let parser_material_parsed_map: map_t = map_create(); let parser_material_texture_map: map_t = map_create(); -function parser_material_get_node(id: i32): zui_node_t { +function parser_material_get_node(id: i32): ui_node_t { for (let i: i32 = 0; i < parser_material_nodes.length; ++i) { - let n: zui_node_t = parser_material_nodes[i]; + let n: ui_node_t = parser_material_nodes[i]; if (n.id == id) { return n; } @@ -72,9 +72,9 @@ function parser_material_get_node(id: i32): zui_node_t { return null; } -function parser_material_get_link(id: i32): zui_node_link_t { +function parser_material_get_link(id: i32): ui_node_link_t { for (let i: i32 = 0; i < parser_material_links.length; ++i) { - let l: zui_node_link_t = parser_material_links[i]; + let l: ui_node_link_t = parser_material_links[i]; if (l.id == id) { return l; } @@ -82,11 +82,11 @@ function parser_material_get_link(id: i32): zui_node_link_t { return null; } -function parser_material_get_input_link(inp: zui_node_socket_t): zui_node_link_t { +function parser_material_get_input_link(inp: ui_node_socket_t): ui_node_link_t { for (let i: i32 = 0; i < parser_material_links.length; ++i) { - let l: zui_node_link_t = parser_material_links[i]; + let l: ui_node_link_t = parser_material_links[i]; if (l.to_id == inp.node_id) { - let node: zui_node_t = parser_material_get_node(inp.node_id); + let node: ui_node_t = parser_material_get_node(inp.node_id); if (node.inputs.length <= l.to_socket) { return null; } @@ -98,12 +98,12 @@ function parser_material_get_input_link(inp: zui_node_socket_t): zui_node_link_t return null; } -function parser_material_get_output_links(out: zui_node_socket_t): zui_node_link_t[] { - let ls: zui_node_link_t[] = null; +function parser_material_get_output_links(out: ui_node_socket_t): ui_node_link_t[] { + let ls: ui_node_link_t[] = null; for (let i: i32 = 0; i < parser_material_links.length; ++i) { - let l: zui_node_link_t = parser_material_links[i]; + let l: ui_node_link_t = parser_material_links[i]; if (l.from_id == out.node_id) { - let node: zui_node_t = parser_material_get_node(out.node_id); + let node: ui_node_t = parser_material_get_node(out.node_id); if (node.outputs.length <= l.from_socket) { continue; } @@ -127,7 +127,7 @@ function parser_material_init() { parser_material_parsing_basecolor = false; } -function parser_material_parse(canvas: zui_node_canvas_t, _con: node_shader_context_t, _vert: node_shader_t, _frag: node_shader_t, _matcon: material_context_t): shader_out_t { +function parser_material_parse(canvas: ui_node_canvas_t, _con: node_shader_context_t, _vert: node_shader_t, _frag: node_shader_t, _matcon: material_context_t): shader_out_t { parser_material_init(); parser_material_canvases = [canvas]; parser_material_nodes = canvas.nodes; @@ -144,7 +144,7 @@ function parser_material_parse(canvas: zui_node_canvas_t, _con: node_shader_cont } if (parser_material_start_node != null) { - let link: zui_node_link_t = { + let link: ui_node_link_t = { id: 99999, from_id: parser_material_start_node.id, from_socket: 0, @@ -165,7 +165,7 @@ function parser_material_parse(canvas: zui_node_canvas_t, _con: node_shader_cont return sout; } - let output_node: zui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL"); + let output_node: ui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL"); if (output_node != null) { return parser_material_parse_output(output_node); } @@ -275,7 +275,7 @@ function parser_material_finalize(con: node_shader_context_t) { } } -function parser_material_parse_output(node: zui_node_t): shader_out_t { +function parser_material_parse_output(node: ui_node_t): shader_out_t { if (parser_material_parse_surface || parser_material_parse_opacity) { return parser_material_parse_shader_input(node.inputs[0]); } @@ -283,7 +283,7 @@ function parser_material_parse_output(node: zui_node_t): shader_out_t { // Parse volume, displacement.. } -function parser_material_parse_output_pbr(node: zui_node_t): shader_out_t { +function parser_material_parse_output_pbr(node: ui_node_t): shader_out_t { if (parser_material_parse_surface || parser_material_parse_opacity) { return parser_material_parse_shader(node, null); } @@ -291,7 +291,7 @@ function parser_material_parse_output_pbr(node: zui_node_t): shader_out_t { // Parse volume, displacement.. } -function parser_material_get_group(name: string): zui_node_canvas_t { +function parser_material_get_group(name: string): ui_node_canvas_t { for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; if (g.canvas.name == name) { @@ -301,7 +301,7 @@ function parser_material_get_group(name: string): zui_node_canvas_t { return null; } -function parser_material_push_group(g: zui_node_canvas_t) { +function parser_material_push_group(g: ui_node_canvas_t) { array_push(parser_material_canvases, g); parser_material_nodes = g.nodes; parser_material_links = g.links; @@ -309,38 +309,38 @@ function parser_material_push_group(g: zui_node_canvas_t) { function parser_material_pop_group() { array_pop(parser_material_canvases); - let g: zui_node_canvas_t = parser_material_canvases[parser_material_canvases.length - 1]; + let g: ui_node_canvas_t = parser_material_canvases[parser_material_canvases.length - 1]; parser_material_nodes = g.nodes; parser_material_links = g.links; } -function parser_material_parse_group(node: zui_node_t, socket: zui_node_socket_t): string { +function parser_material_parse_group(node: ui_node_t, socket: ui_node_socket_t): string { array_push(parser_material_parents, node); // Entering group parser_material_push_group(parser_material_get_group(node.name)); - let output_node: zui_node_t = parser_material_node_by_type(parser_material_nodes, "GROUP_OUTPUT"); + let output_node: ui_node_t = parser_material_node_by_type(parser_material_nodes, "GROUP_OUTPUT"); if (output_node == null) { return null; } let index: i32 = parser_material_socket_index(node, socket); - let inp: zui_node_socket_t = output_node.inputs[index]; + let inp: ui_node_socket_t = output_node.inputs[index]; let out_group: string = parser_material_parse_input(inp); array_pop(parser_material_parents); parser_material_pop_group(); return out_group; } -function parser_material_parse_group_input(node: zui_node_t, socket: zui_node_socket_t): string { - let parent: zui_node_t = array_pop(parser_material_parents); // Leaving group +function parser_material_parse_group_input(node: ui_node_t, socket: ui_node_socket_t): string { + let parent: ui_node_t = array_pop(parser_material_parents); // Leaving group parser_material_pop_group(); let index: i32 = parser_material_socket_index(node, socket); - let inp: zui_node_socket_t = parent.inputs[index]; + let inp: ui_node_socket_t = parent.inputs[index]; let res: string = parser_material_parse_input(inp); array_push(parser_material_parents, parent); // Return to group parser_material_push_group(parser_material_get_group(parent.name)); return res; } -function parser_material_parse_input(inp: zui_node_socket_t): string { +function parser_material_parse_input(inp: ui_node_socket_t): string { if (inp.type == "RGB") { return parser_material_parse_vector_input(inp); } @@ -356,9 +356,9 @@ function parser_material_parse_input(inp: zui_node_socket_t): string { return null; } -function parser_material_parse_shader_input(inp: zui_node_socket_t): shader_out_t { - let l: zui_node_link_t = parser_material_get_input_link(inp); - let from_node: zui_node_t = l != null ? parser_material_get_node(l.from_id) : null; +function parser_material_parse_shader_input(inp: ui_node_socket_t): shader_out_t { + let l: ui_node_link_t = parser_material_get_input_link(inp); + let from_node: ui_node_t = l != null ? parser_material_get_node(l.from_id) : null; if (from_node != null) { if (from_node.type == "REROUTE") { return parser_material_parse_shader_input(from_node.inputs[0]); @@ -380,7 +380,7 @@ function parser_material_parse_shader_input(inp: zui_node_socket_t): shader_out_ } } -function parser_material_parse_shader(node: zui_node_t, socket: zui_node_socket_t): shader_out_t { +function parser_material_parse_shader(node: ui_node_t, socket: ui_node_socket_t): shader_out_t { let sout: shader_out_t = { out_basecol: "vec3(0.8, 0.8, 0.8)", out_roughness: "0.0", @@ -435,9 +435,9 @@ function parser_material_parse_shader(node: zui_node_t, socket: zui_node_socket_ return sout; } -function parser_material_parse_vector_input(inp: zui_node_socket_t): string { - let l: zui_node_link_t = parser_material_get_input_link(inp); - let from_node: zui_node_t = l != null ? parser_material_get_node(l.from_id) : null; +function parser_material_parse_vector_input(inp: ui_node_socket_t): string { + let l: ui_node_link_t = parser_material_get_input_link(inp); + let from_node: ui_node_t = l != null ? parser_material_get_node(l.from_id) : null; if (from_node != null) { if (from_node.type == "REROUTE") { return parser_material_parse_vector_input(from_node.inputs[0]); @@ -462,7 +462,7 @@ function parser_material_parse_vector_input(inp: zui_node_socket_t): string { } } -function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_t): string { +function parser_material_parse_vector(node: ui_node_t, socket: ui_node_socket_t): string { if (node.type == "GROUP") { return parser_material_parse_group(node, socket); } @@ -518,7 +518,7 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ } else if (node.type == "TEX_GRADIENT") { let co: string = parser_material_get_coord(node); - let but: zui_node_button_t = node.buttons[0]; //gradient_type; + let but: ui_node_button_t = node.buttons[0]; //gradient_type; let grad: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); grad = string_replace_all(grad, " ", "_"); let f: string = parser_material_get_gradient(grad, co); @@ -563,7 +563,7 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ node_shader_add_uniform(parser_material_curshader, "sampler2D snoise256", "$noise256.k"); let co: string = parser_material_get_coord(node); let scale: string = parser_material_parse_value_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; //coloring; + let but: ui_node_button_t = node.buttons[0]; //coloring; let coloring: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); coloring = string_replace_all(coloring, " ", "_"); let res: string = ""; @@ -651,7 +651,7 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ node_shader_write(parser_material_curshader, "float " + fac_var + " = " + fac + ";"); let col1: string = parser_material_parse_vector_input(node.inputs[1]); let col2: string = parser_material_parse_vector_input(node.inputs[2]); - let but: zui_node_button_t = node.buttons[0]; // blend_type + let but: ui_node_button_t = node.buttons[0]; // blend_type let blend: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); blend = string_replace_all(blend, " ", "_"); let use_clamp: bool = node.buttons[1].default_value[0] > 0; @@ -849,12 +849,12 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ return result; } let m: slot_material_t = project_materials[mi]; - let _nodes: zui_node_t[] = parser_material_nodes; - let _links: zui_node_link_t[] = parser_material_links; + let _nodes: ui_node_t[] = parser_material_nodes; + let _links: ui_node_link_t[] = parser_material_links; parser_material_nodes = m.canvas.nodes; parser_material_links = m.canvas.links; array_push(parser_material_parents, node); - let output_node: zui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL_PBR"); + let output_node: ui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL_PBR"); if (socket == node.outputs[0]) { // Base result = parser_material_parse_vector_input(output_node.inputs[0]); } @@ -1023,7 +1023,7 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ else if (node.type == "MIX_NORMAL_MAP") { let nm1: string = parser_material_parse_vector_input(node.inputs[0]); let nm2: string = parser_material_parse_vector_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; + let but: ui_node_button_t = node.buttons[0]; let blend: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); // blend_type blend = string_replace_all(blend, " ", "_"); let store: string = parser_material_store_var_name(node); @@ -1062,7 +1062,7 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ else if (node.type == "VECT_MATH") { let vec1: string = parser_material_parse_vector_input(node.inputs[0]); let vec2: string = parser_material_parse_vector_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; //operation; + let but: ui_node_button_t = node.buttons[0]; //operation; let op: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); op = string_replace_all(op, " ", "_"); if (op == "ADD") { @@ -1143,13 +1143,13 @@ function parser_material_parse_vector(node: zui_node_t, socket: zui_node_socket_ return parser_material_to_vec3(height); } else if (map_get(parser_material_custom_nodes, node.type) != null) { - let cb: any = map_get(parser_material_custom_nodes, node.type); // JSValue -> (n: zui_node_t, s: string)=>string + let cb: any = map_get(parser_material_custom_nodes, node.type); // JSValue -> (n: ui_node_t, s: string)=>string return js_call_ptr_str(cb, node, socket.name); } return "vec3(0.0, 0.0, 0.0)"; } -function parse_normal_map_color_input(inp: zui_node_socket_t) { +function parse_normal_map_color_input(inp: ui_node_socket_t) { parser_material_frag.write_normal++; parser_material_out_normaltan = parser_material_parse_vector_input(inp); if (!parser_material_arm_export_tangents) { @@ -1171,9 +1171,9 @@ function parse_normal_map_color_input(inp: zui_node_socket_t) { parser_material_frag.write_normal--; } -function parser_material_parse_value_input(inp: zui_node_socket_t, vector_as_grayscale: bool = false): string { - let l: zui_node_link_t = parser_material_get_input_link(inp); - let from_node: zui_node_t = l != null ? parser_material_get_node(l.from_id) : null; +function parser_material_parse_value_input(inp: ui_node_socket_t, vector_as_grayscale: bool = false): string { + let l: ui_node_link_t = parser_material_get_input_link(inp); + let from_node: ui_node_t = l != null ? parser_material_get_node(l.from_id) : null; if (from_node != null) { if (from_node.type == "REROUTE") { return parser_material_parse_value_input(from_node.inputs[0]); @@ -1198,7 +1198,7 @@ function parser_material_parse_value_input(inp: zui_node_socket_t, vector_as_gra } } -function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t): string { +function parser_material_parse_value(node: ui_node_t, socket: ui_node_socket_t): string { if (node.type == "GROUP") { return parser_material_parse_group(node, socket); } @@ -1269,12 +1269,12 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t let mi: i32 = node.buttons[0].default_value[0]; if (mi >= project_materials.length) return result; let m: slot_material_t = project_materials[mi]; - let _nodes: zui_node_t[] = parser_material_nodes; - let _links: zui_node_link_t[] = parser_material_links; + let _nodes: ui_node_t[] = parser_material_nodes; + let _links: ui_node_link_t[] = parser_material_links; parser_material_nodes = m.canvas.nodes; parser_material_links = m.canvas.links; array_push(parser_material_parents, node); - let output_node: zui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL_PBR"); + let output_node: ui_node_t = parser_material_node_by_type(parser_material_nodes, "OUTPUT_MATERIAL_PBR"); if (socket == node.outputs[1]) { // Opac result = parser_material_parse_value_input(output_node.inputs[1]); } @@ -1393,7 +1393,7 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t } else if (node.type == "TEX_GRADIENT") { let co: string = parser_material_get_coord(node); - let but: zui_node_button_t = node.buttons[0]; //gradient_type; + let but: ui_node_button_t = node.buttons[0]; //gradient_type; let grad: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); grad = string_replace_all(grad, " ", "_"); let f: string = parser_material_get_gradient(grad, co); @@ -1440,7 +1440,7 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t node_shader_add_uniform(parser_material_curshader, "sampler2D snoise256", "$noise256.k"); let co: string = parser_material_get_coord(node); let scale: string = parser_material_parse_value_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; // coloring + let but: ui_node_button_t = node.buttons[0]; // coloring let coloring: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); coloring = string_replace_all(coloring, " ", "_"); let res: string = ""; @@ -1487,7 +1487,7 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t else if (node.type == "MATH") { let val1: string = parser_material_parse_value_input(node.inputs[0]); let val2: string = parser_material_parse_value_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; // operation + let but: ui_node_button_t = node.buttons[0]; // operation let op: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); op = string_replace_all(op, " ", "_"); let use_clamp: bool = node.buttons[1].default_value[0] > 0; @@ -1664,7 +1664,7 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t else if (node.type == "VECT_MATH") { let vec1: string = parser_material_parse_vector_input(node.inputs[0]); let vec2: string = parser_material_parse_vector_input(node.inputs[1]); - let but: zui_node_button_t = node.buttons[0]; //operation; + let but: ui_node_button_t = node.buttons[0]; //operation; let op: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); op = string_replace_all(op, " ", "_"); if (op == "DOT_PRODUCT") { @@ -1684,7 +1684,7 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t let val: string = parser_material_parse_value_input(node.inputs[0]); let min: string = parser_material_parse_value_input(node.inputs[1]); let max: string = parser_material_parse_value_input(node.inputs[2]); - let but: zui_node_button_t = node.buttons[0]; //operation; + let but: ui_node_button_t = node.buttons[0]; //operation; let op: string = to_upper_case(u8_array_string_at(but.data, but.default_value[0])); op = string_replace_all(op, " ", "_"); @@ -1714,13 +1714,13 @@ function parser_material_parse_value(node: zui_node_t, socket: zui_node_socket_t } } else if (map_get(parser_material_custom_nodes, node.type) != null) { - let cb: (n: zui_node_t, s: zui_node_socket_t)=>string = map_get(parser_material_custom_nodes, node.type); + let cb: (n: ui_node_t, s: ui_node_socket_t)=>string = map_get(parser_material_custom_nodes, node.type); return cb(node, socket); } return "0.0"; } -function parser_material_get_coord(node: zui_node_t): string { +function parser_material_get_coord(node: ui_node_t): string { if (parser_material_get_input_link(node.inputs[0]) != null) { return parser_material_parse_vector_input(node.inputs[0]); } @@ -1787,13 +1787,13 @@ function parser_material_vector_curve(name: string, fac: string, points: f32_ptr facs_var + "[" + index_var + "]) * (1.0 / (" + facs_var + "[" + index_var + " + 1] - " + facs_var + "[" + index_var + "])))"; } -function parser_material_res_var_name(node: zui_node_t, socket: zui_node_socket_t): string { +function parser_material_res_var_name(node: ui_node_t, socket: ui_node_socket_t): string { return parser_material_node_name(node) + "_" + parser_material_safesrc(socket.name) + "_res"; } -function parser_material_write_result(l: zui_node_link_t): string { - let from_node: zui_node_t = parser_material_get_node(l.from_id); - let from_socket: zui_node_socket_t = from_node.outputs[l.from_socket]; +function parser_material_write_result(l: ui_node_link_t): string { + let from_node: ui_node_t = parser_material_get_node(l.from_id); + let from_socket: ui_node_socket_t = from_node.outputs[l.from_socket]; let res_var: string = parser_material_res_var_name(from_node, from_socket); let st: string = from_socket.type; if (array_index_of(parser_material_parsed, res_var) < 0) { @@ -1818,11 +1818,11 @@ function parser_material_write_result(l: zui_node_link_t): string { return res_var; } -function parser_material_store_var_name(node: zui_node_t): string { +function parser_material_store_var_name(node: ui_node_t): string { return parser_material_node_name(node) + "_store"; } -function parser_material_texture_store(node: zui_node_t, tex: bind_tex_t, tex_name: string, color_space: i32): string { +function parser_material_texture_store(node: ui_node_t, tex: bind_tex_t, tex_name: string, color_space: i32): string { array_push(parser_material_matcon.bind_textures, tex); node_shader_context_add_elem(parser_material_curshader.context, "tex", "short2norm"); node_shader_add_uniform(parser_material_curshader, "sampler2D " + tex_name); @@ -1907,9 +1907,9 @@ function parser_material_to_vec3(s: string): string { ///end } -function parser_material_node_by_type(nodes: zui_node_t[], ntype: string): zui_node_t { +function parser_material_node_by_type(nodes: ui_node_t[], ntype: string): ui_node_t { for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = nodes[i]; + let n: ui_node_t = nodes[i]; if (n.type == ntype) { return n; } @@ -1917,7 +1917,7 @@ function parser_material_node_by_type(nodes: zui_node_t[], ntype: string): zui_n return null; } -function parser_material_socket_index(node: zui_node_t, socket: zui_node_socket_t): i32 { +function parser_material_socket_index(node: ui_node_t, socket: ui_node_socket_t): i32 { for (let i: i32 = 0; i < node.outputs.length; ++i) { if (node.outputs[i] == socket) { return i; @@ -1926,13 +1926,13 @@ function parser_material_socket_index(node: zui_node_t, socket: zui_node_socket_ return -1; } -function parser_material_node_name(node: zui_node_t, _parents: zui_node_t[] = null): string { +function parser_material_node_name(node: ui_node_t, _parents: ui_node_t[] = null): string { if (_parents == null) { _parents = parser_material_parents; } let s: string = node.name; for (let i: i32 = 0; i < _parents.length; ++i) { - let p: zui_node_t = _parents[i]; + let p: ui_node_t = _parents[i]; s = p.name + p.id + "_" + s; } s = parser_material_safesrc(s); @@ -1971,7 +1971,7 @@ function parser_material_enum_data(s: string): string { return ""; } -function parser_material_make_texture(image_node: zui_node_t, tex_name: string, matname: string = null): bind_tex_t { +function parser_material_make_texture(image_node: ui_node_t, tex_name: string, matname: string = null): bind_tex_t { let i: i32 = image_node.buttons[0].default_value[0]; let filepath: string = parser_material_enum_data(base_enum_texts(image_node.type)[i]); if (filepath == "" || string_index_of(filepath, ".") == -1) { diff --git a/base/sources/plugin_api.c b/base/sources/plugin_api.c index 4770b009..0f2cc609 100644 --- a/base/sources/plugin_api.c +++ b/base/sources/plugin_api.c @@ -1,11 +1,11 @@ #include "plugin_api.h" -#include "zui.h" -#include "zui_nodes.h" +#include "iron_ui.h" +#include "iron_ui_nodes.h" #include "iron_array.h" #include "iron_map.h" #include "iron_armpack.h" -#include "io_obj.h" +#include "iron_obj.h" void plugin_embed(); @@ -465,57 +465,57 @@ FN(project_save) { return JS_UNDEFINED; } -FN(zui_handle_create) { - int64_t result = (int64_t)zui_handle_create(); +FN(ui_handle_create) { + int64_t result = (int64_t)ui_handle_create(); return JS_NewInt64(ctx, result); } -FN(zui_handle_set_value) { +FN(ui_handle_set_value) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); - zui_handle_t *h = (zui_handle_t *)p; + ui_handle_t *h = (ui_handle_t *)p; double d; JS_ToFloat64(ctx, &d, argv[1]); h->value = d; return JS_UNDEFINED; } -FN(zui_handle_get_value) { +FN(ui_handle_get_value) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); - zui_handle_t *h = (zui_handle_t *)p; + ui_handle_t *h = (ui_handle_t *)p; return JS_NewFloat64(ctx, h->value); } -FN(zui_panel) { +FN(ui_panel) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); char *s = (char *)JS_ToCString(ctx, argv[1]); - bool result = zui_panel((void *)p, s, false, false); + bool result = ui_panel((void *)p, s, false, false); return JS_NewBool(ctx, result); } -FN(zui_button) { +FN(ui_button) { char *s = (char *)JS_ToCString(ctx, argv[0]); - bool result = zui_button(s, ZUI_ALIGN_CENTER, ""); + bool result = ui_button(s, UI_ALIGN_CENTER, ""); return JS_NewBool(ctx, result); } -FN(zui_text) { +FN(ui_text) { char *s = (char *)JS_ToCString(ctx, argv[0]); - zui_text(s, ZUI_ALIGN_LEFT, 0); + ui_text(s, UI_ALIGN_LEFT, 0); return JS_UNDEFINED; } -FN(zui_text_input) { +FN(ui_text_input) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); char *s = (char *)JS_ToCString(ctx, argv[1]); - zui_text_input((void *)p, s, ZUI_ALIGN_LEFT, true, false); + ui_text_input((void *)p, s, UI_ALIGN_LEFT, true, false); return JS_UNDEFINED; } -FN(zui_slider) { +FN(ui_slider) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); char *s = (char *)JS_ToCString(ctx, argv[1]); @@ -535,29 +535,29 @@ FN(zui_slider) { if (argc > 5) { JS_ToFloat64(ctx, &prec, argv[5]); } - zui_slider((void *)p, s, from, to, filled, prec, true, ZUI_ALIGN_LEFT, true); + ui_slider((void *)p, s, from, to, filled, prec, true, UI_ALIGN_LEFT, true); return JS_UNDEFINED; } -FN(zui_check) { +FN(ui_check) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); char *s = (char *)JS_ToCString(ctx, argv[1]); - zui_check((void *)p, s, ""); + ui_check((void *)p, s, ""); return JS_UNDEFINED; } -FN(zui_radio) { +FN(ui_radio) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); int32_t pos; JS_ToInt32(ctx, &pos, argv[1]); char *s = (char *)JS_ToCString(ctx, argv[2]); - zui_radio((void *)p, pos, s, ""); + ui_radio((void *)p, pos, s, ""); return JS_UNDEFINED; } -FN(zui_row) { +FN(ui_row) { JSValue val_len = JS_GetPropertyStr(ctx, argv[0], "length"); int len; JS_ToInt32(ctx, &len, val_len); @@ -568,11 +568,11 @@ FN(zui_row) { JS_ToFloat64(ctx, &f, val); ratios->buffer[i] = f; } - zui_row(ratios); + ui_row(ratios); return JS_UNDEFINED; } -FN(zui_combo) { +FN(ui_combo) { int64_t p; JS_ToInt64(ctx, &p, argv[0]); @@ -588,7 +588,7 @@ FN(zui_combo) { char *label = (char *)JS_ToCString(ctx, argv[2]); - zui_combo((void *)p, texts, label, true, ZUI_ALIGN_LEFT, true); + ui_combo((void *)p, texts, label, true, UI_ALIGN_LEFT, true); return JS_UNDEFINED; } @@ -639,7 +639,7 @@ FN(parser_material_parse_value_input) { JS_ToInt64(ctx, &node, argv[0]); int64_t i; JS_ToInt64(ctx, &i, argv[1]); - char *s = parser_material_parse_value_input(((zui_node_t *)node)->inputs->buffer[i], false); + char *s = parser_material_parse_value_input(((ui_node_t *)node)->inputs->buffer[i], false); return JS_NewString(ctx, s); } @@ -786,18 +786,18 @@ void plugin_api_init() { BIND(project_filepath_get, 0); BIND(project_save, 0); - BIND(zui_handle_create, 0); - BIND(zui_handle_set_value, 2); - BIND(zui_handle_get_value, 1); - BIND(zui_panel, 2); - BIND(zui_button, 1); - BIND(zui_text, 1); - BIND(zui_text_input, 2); - BIND(zui_slider, 5); - BIND(zui_check, 2); - BIND(zui_radio, 3); - BIND(zui_row, 1); - BIND(zui_combo, 3); + BIND(ui_handle_create, 0); + BIND(ui_handle_set_value, 2); + BIND(ui_handle_get_value, 1); + BIND(ui_panel, 2); + BIND(ui_button, 1); + BIND(ui_text, 1); + BIND(ui_text_input, 2); + BIND(ui_slider, 5); + BIND(ui_check, 2); + BIND(ui_radio, 3); + BIND(ui_row, 1); + BIND(ui_combo, 3); BIND(nodes_material_category_add, 2); BIND(nodes_material_category_remove, 1); diff --git a/base/sources/project.ts b/base/sources/project.ts index 98ba6408..f4806bf9 100644 --- a/base/sources/project.ts +++ b/base/sources/project.ts @@ -20,8 +20,8 @@ let project_atlas_names: string[] = null; ///if is_lab let project_material_data: material_data_t = null; //// let project_materials: any[] = null; //// -let project_nodes: zui_nodes_t; -let project_canvas: zui_node_canvas_t; +let project_nodes: ui_nodes_t; +let project_canvas: ui_node_canvas_t; let project_default_canvas: buffer_t = null; ///end @@ -90,8 +90,8 @@ function project_save_as(save_and_quit: bool = false) { function project_new_box() { ///if (is_paint || is_sculpt) - ui_box_show_custom(function (ui: zui_t) { - if (zui_tab(zui_handle(__ID__), tr("New Project"))) { + ui_box_show_custom(function (ui: ui_t) { + if (ui_tab(ui_handle(__ID__), tr("New Project"))) { if (project_mesh_list == null) { project_mesh_list = file_read_directory(path_data() + path_sep + "meshes"); for (let i: i32 = 0; i < project_mesh_list.length; ++i) { @@ -104,26 +104,26 @@ function project_new_box() { } let row: f32[] = [0.5, 0.5]; - zui_row(row); - let h_project_type: zui_handle_t = zui_handle(__ID__); + ui_row(row); + let h_project_type: ui_handle_t = ui_handle(__ID__); if (h_project_type.init) { h_project_type.position = context_raw.project_type; } - context_raw.project_type = zui_combo(h_project_type, project_mesh_list, tr("Template"), true); + context_raw.project_type = ui_combo(h_project_type, project_mesh_list, tr("Template"), true); - let h_project_aspect_ratio: zui_handle_t = zui_handle(__ID__); + let h_project_aspect_ratio: ui_handle_t = ui_handle(__ID__); if (h_project_aspect_ratio.init) { h_project_aspect_ratio.position = context_raw.project_aspect_ratio; } 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); + context_raw.project_aspect_ratio = ui_combo(h_project_aspect_ratio, project_aspect_ratio_combo, tr("Aspect Ratio"), true); - _zui_end_element(); - zui_row(row); - if (zui_button(tr("Cancel"))) { + _ui_end_element(); + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("OK")) || ui.is_return_down) { + if (ui_button(tr("OK")) || ui.is_return_down) { project_new(); viewport_scale_to_bounds(); ui_box_hide(); @@ -349,9 +349,9 @@ 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), +function project_create_node_link(links: ui_node_link_t[], from_id: i32, from_socket: i32, to_id: i32, to_socket: i32): ui_node_link_t { + let link: ui_node_link_t = { + id: ui_next_link_id(links), from_id: from_id, from_socket: from_socket, to_id: to_id, @@ -380,12 +380,12 @@ function project_import_brush() { array_push(project_brushes, context_raw.brush); // Create and link image node - let n: zui_node_t = nodes_brush_create_node("TEX_IMAGE"); + let n: ui_node_t = nodes_brush_create_node("TEX_IMAGE"); n.x = 83; 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 = project_create_node_link(links, n.id, 0, 0, 4); + let links: ui_node_link_t[] = context_raw.brush.canvas.links; + let link: ui_node_link_t = project_create_node_link(links, n.id, 0, 0, 4); array_push(links, link); // Parse brush @@ -429,7 +429,7 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl // data_get_blob(path); ///end - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { let path: string = _project_import_mesh_box_path; let replace_existing: bool = _project_import_mesh_box_replace_existing; @@ -437,41 +437,36 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl let done: ()=>void = _project_import_mesh_box_done; let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(zui_handle(__ID__), tr("Import Mesh"), tab_vertical)) { + if (ui_tab(ui_handle(__ID__), tr("Import Mesh"), tab_vertical)) { if (ends_with(to_lower_case(path), ".obj")) { let split_by_combo: string[] = [tr("Object"), tr("Group"), tr("Material"), tr("UDIM Tile")]; - context_raw.split_by = zui_combo(zui_handle(__ID__), split_by_combo, tr("Split By"), true); + context_raw.split_by = ui_combo(ui_handle(__ID__), split_by_combo, tr("Split By"), true); if (ui.is_hovered) { - zui_tooltip(tr("Split .obj mesh into objects")); + ui_tooltip(tr("Split .obj mesh into objects")); } } - // if (ends_with(to_lower_case(path), ".fbx")) { - // raw.parseTransform = Zui.check(Zui.handle("project_5", { selected: raw.parseTransform }), tr("Parse Transforms")); - // if (ui.isHovered) Zui.tooltip(tr("Load per-object transforms from .fbx")); - // } - ///if (is_paint || is_sculpt) // if (ends_with(to_lower_case(path), ".fbx") || ends_with(to_lower_case(path), ".blend")) { if (ends_with(to_lower_case(path), ".blend")) { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.selected = context_raw.parse_vcols; } - context_raw.parse_vcols = zui_check(h, tr("Parse Vertex Colors")); + context_raw.parse_vcols = ui_check(h, tr("Parse Vertex Colors")); if (ui.is_hovered) { - zui_tooltip(tr("Import vertex color data")); + ui_tooltip(tr("Import vertex color data")); } } ///end let row: f32 [] = [0.45, 0.45, 0.1]; - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Import")) || ui.is_return_down) { + if (ui_button(tr("Import")) || ui.is_return_down) { ui_box_hide(); ///if (krom_android || krom_ios) @@ -489,7 +484,7 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl done(); } } - if (zui_button(tr("?"))) { + if (ui_button(tr("?"))) { file_load_url("https://github.com/armory3d/armorpaint_docs/blob/master/faq.md"); } } @@ -517,14 +512,14 @@ function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t)=>void, _project_unwrap_mesh_box_done = done; _project_unwrap_mesh_box_skip_ui = skip_ui; - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { let mesh: raw_mesh_t = _project_unwrap_mesh_box_mesh; let done: (a: raw_mesh_t)=>void = _project_unwrap_mesh_box_done; let skip_ui: bool = _project_unwrap_mesh_box_skip_ui; let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(zui_handle(__ID__), tr("Unwrap Mesh"), tab_vertical)) { + if (ui_tab(ui_handle(__ID__), tr("Unwrap Mesh"), tab_vertical)) { let unwrap_plugins: string[] = []; if (box_preferences_files_plugin == null) { @@ -538,14 +533,14 @@ function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t)=>void, } array_push(unwrap_plugins, "equirect"); - let unwrap_by: i32 = zui_combo(zui_handle(__ID__), unwrap_plugins, tr("Plugin"), true); + let unwrap_by: i32 = ui_combo(ui_handle(__ID__), unwrap_plugins, tr("Plugin"), true); let row: f32[] = [0.5, 0.5]; - zui_row(row); - if (zui_button(tr("Cancel"))) { + ui_row(row); + if (ui_button(tr("Cancel"))) { ui_box_hide(); } - if (zui_button(tr("Unwrap")) || ui.is_return_down || skip_ui) { + if (ui_button(tr("Unwrap")) || ui.is_return_down || skip_ui) { ui_box_hide(); ///if (krom_android || krom_ios) @@ -756,7 +751,7 @@ function project_get_material_group_by_name(group_name: string): node_group_t { ///if (is_paint || is_sculpt) function project_is_material_group_in_use(group: node_group_t): bool { - let canvases: zui_node_canvas_t[] = []; + let canvases: ui_node_canvas_t[] = []; for (let i: i32 = 0; i < project_materials.length; ++i) { let m: slot_material_t = project_materials[i]; array_push(canvases, m.canvas); @@ -766,9 +761,9 @@ function project_is_material_group_in_use(group: node_group_t): bool { array_push(canvases, m.canvas); } for (let i: i32 = 0; i < canvases.length; ++i) { - let canvas: zui_node_canvas_t = canvases[i]; + let canvas: ui_node_canvas_t = canvases[i]; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.type == "GROUP" && n.name == group.canvas.name) { return true; } @@ -779,8 +774,8 @@ function project_is_material_group_in_use(group: node_group_t): bool { ///end type node_group_t = { - nodes?: zui_nodes_t; - canvas?: zui_node_canvas_t; + nodes?: ui_nodes_t; + canvas?: ui_node_canvas_t; }; type project_format_t = { @@ -796,10 +791,10 @@ type project_format_t = { swatches?: swatch_color_t[]; ///if (is_paint || is_sculpt) - brush_nodes?: zui_node_canvas_t[]; + brush_nodes?: ui_node_canvas_t[]; brush_icons?: buffer_t[]; - material_nodes?: zui_node_canvas_t[]; - material_groups?: zui_node_canvas_t[]; + material_nodes?: ui_node_canvas_t[]; + material_groups?: ui_node_canvas_t[]; material_icons?: buffer_t[]; font_assets?: string[]; layer_datas?: layer_data_t[]; @@ -814,8 +809,8 @@ type project_format_t = { ///end ///if is_lab - material?: zui_node_canvas_t; - material_groups?: zui_node_canvas_t[]; + material?: ui_node_canvas_t; + material_groups?: ui_node_canvas_t[]; mesh_data?: mesh_data_t; mesh_icon?: buffer_t; ///end diff --git a/base/sources/tab_browser.ts b/base/sources/tab_browser.ts index 631836c7..0e0a4146 100644 --- a/base/sources/tab_browser.ts +++ b/base/sources/tab_browser.ts @@ -1,6 +1,6 @@ -let tab_browser_hpath: zui_handle_t = zui_handle_create(); -let tab_browser_hsearch: zui_handle_t = zui_handle_create(); +let tab_browser_hpath: ui_handle_t = ui_handle_create(); +let tab_browser_hsearch: ui_handle_t = ui_handle_create(); let tab_browser_known: bool = false; let tab_browser_last_path: string = ""; @@ -13,38 +13,38 @@ function tab_browser_show_directory(directory: string) { let _tab_browser_draw_file: string; let _tab_browser_draw_b: string; -function tab_browser_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_browser_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Browser")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Browser")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { if (config_raw.bookmarks == null) { config_raw.bookmarks = []; } - let bookmarks_w: i32 = math_floor(100 * zui_SCALE(ui)); + let bookmarks_w: i32 = math_floor(100 * ui_SCALE(ui)); if (tab_browser_hpath.text == "" && config_raw.bookmarks.length > 0) { // Init to first bookmark tab_browser_hpath.text = config_raw.bookmarks[0]; } - zui_begin_sticky(); + ui_begin_sticky(); let step: f32 = (1.0 - bookmarks_w / ui._w); if (tab_browser_hsearch.text != "") { let row: f32[] = [bookmarks_w / ui._w, step * 0.73, step * 0.07, step * 0.17, step * 0.03]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [bookmarks_w / ui._w, step * 0.73, step * 0.07, step * 0.2]; - zui_row(row); + ui_row(row); } - if (zui_button("+")) { + if (ui_button("+")) { array_push(config_raw.bookmarks, tab_browser_hpath.text); config_save(); } if (ui.is_hovered) { - zui_tooltip(tr("Add bookmark")); + ui_tooltip(tr("Add bookmark")); } ///if krom_android @@ -56,7 +56,7 @@ function tab_browser_draw(htab: zui_handle_t) { } ///end - tab_browser_hpath.text = zui_text_input(tab_browser_hpath, tr("Path")); + tab_browser_hpath.text = ui_text_input(tab_browser_hpath, tr("Path")); ///if krom_android if (stripped) { @@ -67,20 +67,20 @@ function tab_browser_draw(htab: zui_handle_t) { let refresh: bool = false; let in_focus: bool = ui.input_x > ui._window_x && ui.input_x < ui._window_x + ui._window_w && ui.input_y > ui._window_y && ui.input_y < ui._window_y + ui._window_h; - if (zui_button(tr("Refresh")) || (in_focus && ui.is_key_pressed && ui.key_code == key_code_t.F5)) { + if (ui_button(tr("Refresh")) || (in_focus && ui.is_key_pressed && ui.key_code == key_code_t.F5)) { refresh = true; } - tab_browser_hsearch.text = zui_text_input(tab_browser_hsearch, tr("Search"), zui_align_t.LEFT, true, true); + tab_browser_hsearch.text = ui_text_input(tab_browser_hsearch, tr("Search"), ui_align_t.LEFT, true, true); if (ui.is_hovered) { - zui_tooltip(tr("ctrl+f to search") + "\n" + tr("esc to cancel")); + ui_tooltip(tr("ctrl+f to search") + "\n" + tr("esc to cancel")); } if (ui.is_ctrl_down && ui.is_key_pressed && ui.key_code == key_code_t.F) { // Start searching via ctrl+f - zui_start_text_edit(tab_browser_hsearch); + ui_start_text_edit(tab_browser_hsearch); } - if (tab_browser_hsearch.text != "" && (zui_button(tr("X")) || ui.is_escape_down)) { + if (tab_browser_hsearch.text != "" && (ui_button(tr("X")) || ui.is_escape_down)) { tab_browser_hsearch.text = ""; } - zui_end_sticky(); + ui_end_sticky(); if (tab_browser_last_path != tab_browser_hpath.text) { tab_browser_hsearch.text = ""; @@ -101,7 +101,7 @@ function tab_browser_draw(htab: zui_handle_t) { _tab_browser_draw_file = file; // Context menu - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let file: string = _tab_browser_draw_file; if (ui_menu_button(ui, tr("Import"))) { @@ -202,13 +202,13 @@ function tab_browser_draw(htab: zui_handle_t) { ui._y = _y; ui._w = bookmarks_w; - if (zui_button(tr("Cloud"), zui_align_t.LEFT)) { + if (ui_button(tr("Cloud"), ui_align_t.LEFT)) { tab_browser_hpath.text = "cloud"; } - if (zui_button(tr("Disk"), zui_align_t.LEFT)) { + if (ui_button(tr("Disk"), ui_align_t.LEFT)) { ///if krom_android - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Download"))) { tab_browser_hpath.text = ui_files_default_path; } @@ -231,13 +231,13 @@ function tab_browser_draw(htab: zui_handle_t) { let b: string = config_raw.bookmarks[i]; let folder: string = substring(b, string_last_index_of(b, path_sep) + 1, b.length); - if (zui_button(folder, zui_align_t.LEFT)) { + if (ui_button(folder, ui_align_t.LEFT)) { tab_browser_hpath.text = b; } if (ui.is_hovered && ui.input_released_r) { _tab_browser_draw_b = b; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Delete"))) { array_remove(config_raw.bookmarks, _tab_browser_draw_b); config_save(); diff --git a/base/sources/tab_brushes.ts b/base/sources/tab_brushes.ts index 125ddb70..b4c62910 100644 --- a/base/sources/tab_brushes.ts +++ b/base/sources/tab_brushes.ts @@ -3,28 +3,28 @@ let _tab_brushes_draw_i: i32; -function tab_brushes_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("Brushes"))) { - zui_begin_sticky(); +function tab_brushes_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("Brushes"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 4]; - zui_row(row); - if (zui_button(tr("New"))) { + ui_row(row); + if (ui_button(tr("New"))) { context_raw.brush = slot_brush_create(); array_push(project_brushes, context_raw.brush); make_material_parse_brush(); ui_nodes_hwnd.redraws = 2; } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { project_import_brush(); } - if (zui_button(tr("Nodes"))) { + if (ui_button(tr("Nodes"))) { ui_base_show_brush_nodes(); } - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); - let slotw: i32 = math_floor(51 * zui_SCALE(ui)); + let slotw: i32 = math_floor(51 * ui_SCALE(ui)); let num: i32 = math_floor(config_raw.layout[layout_size_t.SIDEBAR_W] / slotw); for (let row: i32 = 0; row < math_floor(math_ceil(project_brushes.length / num)); ++row) { @@ -33,45 +33,45 @@ function tab_brushes_draw(htab: zui_handle_t) { for (let i: i32 = 0; i < num * mult; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; - let off: f32 = config_raw.show_asset_names ? zui_ELEMENT_OFFSET(ui) * 10.0 : 6; + let off: f32 = config_raw.show_asset_names ? ui_ELEMENT_OFFSET(ui) * 10.0 : 6; if (row > 0) { ui._y += off; } for (let j: i32 = 0; j < num; ++j) { - let imgw: i32 = math_floor(50 * zui_SCALE(ui)); + let imgw: i32 = math_floor(50 * ui_SCALE(ui)); let i: i32 = j + row * num; if (i >= project_brushes.length) { - _zui_end_element(imgw); + _ui_end_element(imgw); if (config_raw.show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } continue; } - let img: image_t = zui_SCALE(ui) > 1 ? project_brushes[i].image : project_brushes[i].image_icon; + let img: image_t = ui_SCALE(ui) > 1 ? project_brushes[i].image : project_brushes[i].image_icon; let img_full: image_t = project_brushes[i].image; if (context_raw.brush == project_brushes[i]) { - // Zui.fill(1, -2, img.width + 3, img.height + 3, ui.ops.theme.HIGHLIGHT_COL); // TODO + // ui_fill(1, -2, img.width + 3, img.height + 3, ui.ops.theme.HIGHLIGHT_COL); // TODO let off: i32 = row % 2 == 1 ? 1 : 0; let w: i32 = 50; if (config_raw.window_scale > 1) { w += math_floor(config_raw.window_scale * 2); } - zui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); } let uix: f32 = ui._x; //let uiy: f32 = ui._y; - let tile: i32 = zui_SCALE(ui) > 1 ? 100 : 50; - let state: zui_state_t = project_brushes[i].preview_ready ? _zui_image(img) : _zui_image(resource_get("icons.k"), -1, -1.0, tile * 5, tile, tile, tile); - if (state == zui_state_t.STARTED) { + let tile: i32 = ui_SCALE(ui) > 1 ? 100 : 50; + let state: ui_state_t = project_brushes[i].preview_ready ? _ui_image(img) : _ui_image(resource_get("icons.k"), -1, -1.0, tile * 5, tile, tile, tile); + if (state == ui_state_t.STARTED) { if (context_raw.brush != project_brushes[i]) { context_select_brush(i); } @@ -89,7 +89,7 @@ function tab_brushes_draw(htab: zui_handle_t) { _tab_brushes_draw_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let i: i32 = _tab_brushes_draw_i; //let b: slot_brush_t = brushes[i]; @@ -133,21 +133,21 @@ function tab_brushes_draw(htab: zui_handle_t) { }); } else { - _zui_tooltip_image(img_full); - zui_tooltip(project_brushes[i].canvas.name); + _ui_tooltip_image(img_full); + ui_tooltip(project_brushes[i].canvas.name); } } if (config_raw.show_asset_names) { ui._x = uix; ui._y += slotw * 0.9; - zui_text(project_brushes[i].canvas.name, zui_align_t.CENTER); + ui_text(project_brushes[i].canvas.name, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(project_brushes[i].canvas.name); + ui_tooltip(project_brushes[i].canvas.name); } ui._y -= slotw * 0.9; if (i == project_brushes.length - 1) { - ui._y += j == num - 1 ? imgw : imgw + zui_ELEMENT_H(ui) + zui_ELEMENT_OFFSET(ui); + ui._y += j == num - 1 ? imgw : imgw + ui_ELEMENT_H(ui) + ui_ELEMENT_OFFSET(ui); } } } diff --git a/base/sources/tab_console.ts b/base/sources/tab_console.ts index 72446c36..27985dfb 100644 --- a/base/sources/tab_console.ts +++ b/base/sources/tab_console.ts @@ -1,38 +1,38 @@ -function tab_console_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_console_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let title: string = console_message_timer > 0 ? console_message + " " : tr("Console"); let color: i32 = console_message_timer > 0 ? console_message_color : -1; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, title, false, color) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, title, false, color) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); ///if (krom_windows || krom_linux || krom_macos) // Copy if (config_raw.touch_ui) { let row: f32[] = [1 / 4, 1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } ///else if (config_raw.touch_ui) { let row: f32[] = [1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } ///end - if (zui_button(tr("Clear"))) { + if (ui_button(tr("Clear"))) { console_last_traces = []; } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_files_show("txt", true, false, function (path: string) { let str: string = string_array_join(console_last_traces, "\n"); let f: string = ui_files_filename; @@ -47,24 +47,24 @@ function tab_console_draw(htab: zui_handle_t) { }); } ///if (krom_windows || krom_linux || krom_macos) - if (zui_button(tr("Copy"))) { + if (ui_button(tr("Copy"))) { let str: string = string_array_join(console_last_traces, "\n"); krom_copy_to_clipboard(str); } ///end - zui_end_sticky(); + ui_end_sticky(); let _font: g2_font_t = ui.ops.font; let _fontSize: i32 = ui.font_size; let f: g2_font_t = data_get_font("font_mono.ttf"); - zui_set_font(ui, f); - ui.font_size = math_floor(15 * zui_SCALE(ui)); + ui_set_font(ui, f); + ui.font_size = math_floor(15 * ui_SCALE(ui)); for (let i: i32 = 0; i < console_last_traces.length; ++i) { let t: string = console_last_traces[i]; - zui_text(t); + ui_text(t); } - zui_set_font(ui, _font); + ui_set_font(ui, _font); ui.font_size = _fontSize; } } diff --git a/base/sources/tab_fonts.ts b/base/sources/tab_fonts.ts index aaa52a42..151abb96 100644 --- a/base/sources/tab_fonts.ts +++ b/base/sources/tab_fonts.ts @@ -3,36 +3,36 @@ let _tab_fonts_draw_i: i32; -function tab_fonts_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_fonts_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Fonts")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Fonts")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); if (config_raw.touch_ui) { let row: f32[] = [1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { project_import_asset("ttf,ttc,otf"); } if (ui.is_hovered) { - zui_tooltip(tr("Import font file")); + ui_tooltip(tr("Import font file")); } - if (zui_button(tr("2D View"))) { + if (ui_button(tr("2D View"))) { ui_base_show_2d_view(view_2d_type_t.FONT); } - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); let statusw: i32 = sys_width() - ui_toolbar_w - config_raw.layout[layout_size_t.SIDEBAR_W]; - let slotw: i32 = math_floor(51 * zui_SCALE(ui)); + let slotw: i32 = math_floor(51 * ui_SCALE(ui)); let num: i32 = math_floor(statusw / slotw); for (let row: i32 = 0; row < math_floor(math_ceil(project_fonts.length / num)); ++row) { @@ -41,56 +41,56 @@ function tab_fonts_draw(htab: zui_handle_t) { for (let i: i32 = 0; i < num * mult; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; - let off: f32 = config_raw.show_asset_names ? zui_ELEMENT_OFFSET(ui) * 10.0 : 6; + let off: f32 = config_raw.show_asset_names ? ui_ELEMENT_OFFSET(ui) * 10.0 : 6; if (row > 0) { ui._y += off; } for (let j: i32 = 0; j < num; ++j) { - let imgw: i32 = math_floor(50 * zui_SCALE(ui)); + let imgw: i32 = math_floor(50 * ui_SCALE(ui)); let i: i32 = j + row * num; if (i >= project_fonts.length) { - _zui_end_element(imgw); + _ui_end_element(imgw); if (config_raw.show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } continue; } let img: image_t = project_fonts[i].image; if (context_raw.font == project_fonts[i]) { - // Zui.fill(1, -2, img.width + 3, img.height + 3, ui.ops.theme.HIGHLIGHT_COL); // TODO + // ui_fill(1, -2, img.width + 3, img.height + 3, ui.ops.theme.HIGHLIGHT_COL); // TODO let off: i32 = row % 2 == 1 ? 1 : 0; let w: i32 = 50; if (config_raw.window_scale > 1) { w += math_floor(config_raw.window_scale * 2); } - zui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); } let uix: f32 = ui._x; - let tile: i32 = zui_SCALE(ui) > 1 ? 100 : 50; - let state: zui_state_t = zui_state_t.IDLE; + let tile: i32 = ui_SCALE(ui) > 1 ? 100 : 50; + let state: ui_state_t = ui_state_t.IDLE; if (project_fonts[i].preview_ready) { // g2_set_pipeline(pipe); // L8 // ///if krom_opengl // g4_set_pipeline(pipe); // ///end // g4_set_int(channelLocation, 1); - state = _zui_image(img); + state = _ui_image(img); // g2_set_pipeline(null); } else { - state = _zui_image(resource_get("icons.k"), -1, -1.0, tile * 6, tile, tile, tile); + state = _ui_image(resource_get("icons.k"), -1, -1.0, tile * 6, tile, tile, tile); } - if (state == zui_state_t.STARTED) { + if (state == ui_state_t.STARTED) { if (context_raw.font != project_fonts[i]) { _tab_fonts_draw_i = i; @@ -110,7 +110,7 @@ function tab_fonts_draw(htab: zui_handle_t) { let add: i32 = project_fonts.length > 1 ? 1 : 0; _tab_fonts_draw_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let i: i32 = _tab_fonts_draw_i; if (project_fonts.length > 1 && ui_menu_button(ui, tr("Delete"), "delete") && project_fonts[i].file != "") { @@ -132,21 +132,21 @@ function tab_fonts_draw(htab: zui_handle_t) { }); } else { - _zui_tooltip_image(img); - zui_tooltip(project_fonts[i].name); + _ui_tooltip_image(img); + ui_tooltip(project_fonts[i].name); } } if (config_raw.show_asset_names) { ui._x = uix; ui._y += slotw * 0.9; - zui_text(project_fonts[i].name, zui_align_t.CENTER); + ui_text(project_fonts[i].name, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(project_fonts[i].name); + ui_tooltip(project_fonts[i].name); } ui._y -= slotw * 0.9; if (i == project_fonts.length - 1) { - ui._y += j == num - 1 ? imgw : imgw + zui_ELEMENT_H(ui) + zui_ELEMENT_OFFSET(ui); + ui._y += j == num - 1 ? imgw : imgw + ui_ELEMENT_H(ui) + ui_ELEMENT_OFFSET(ui); } } } diff --git a/base/sources/tab_history.ts b/base/sources/tab_history.ts index f32d5de5..45384014 100644 --- a/base/sources/tab_history.ts +++ b/base/sources/tab_history.ts @@ -1,15 +1,15 @@ ///if (is_paint || is_sculpt) -function tab_history_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("History"))) { +function tab_history_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("History"))) { for (let i: i32 = 0; i < history_steps.length; ++i) { let active: i32 = history_steps.length - 1 - history_redos; if (i == active) { - zui_fill(0, 0, ui._window_w, ui.ops.theme.ELEMENT_H, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, 0, ui._window_w, ui.ops.theme.ELEMENT_H, ui.ops.theme.HIGHLIGHT_COL); } - zui_text(history_steps[i].name); + ui_text(history_steps[i].name); if (ui.is_released) { // Jump to undo step let diff: i32 = i - active; while (diff > 0) { @@ -21,7 +21,7 @@ function tab_history_draw(htab: zui_handle_t) { history_undo(); } } - zui_fill(0, 0, (ui._window_w / zui_SCALE(ui) - 2), 1 * zui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 0, (ui._window_w / ui_SCALE(ui) - 2), 1 * ui_SCALE(ui), ui.ops.theme.SEPARATOR_COL); } } } diff --git a/base/sources/tab_materials.ts b/base/sources/tab_materials.ts index 94601eb0..34c40479 100644 --- a/base/sources/tab_materials.ts +++ b/base/sources/tab_materials.ts @@ -1,58 +1,58 @@ ///if (is_paint || is_sculpt) -function tab_materials_draw(htab: zui_handle_t) { +function tab_materials_draw(htab: ui_handle_t) { let mini: bool = config_raw.layout[layout_size_t.SIDEBAR_W] <= ui_base_sidebar_mini_w; mini ? tab_materials_draw_mini(htab) : tab_materials_draw_full(htab); } -function tab_materials_draw_mini(htab: zui_handle_t) { - zui_set_hovered_tab_name(tr("Materials")); +function tab_materials_draw_mini(htab: ui_handle_t) { + ui_set_hovered_tab_name(tr("Materials")); - zui_begin_sticky(); - zui_separator(5); + ui_begin_sticky(); + ui_separator(5); tab_materials_button_nodes(); tab_materials_button_new("+"); - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); tab_materials_draw_slots(true); } -function tab_materials_draw_full(htab: zui_handle_t) { - if (zui_tab(htab, tr("Materials"))) { - zui_begin_sticky(); +function tab_materials_draw_full(htab: ui_handle_t) { + if (ui_tab(htab, tr("Materials"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); tab_materials_button_new(tr("New")); - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { project_import_material(); } tab_materials_button_nodes(); - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); tab_materials_draw_slots(false); } } function tab_materials_button_nodes() { - let ui: zui_t = ui_base_ui; - if (zui_button(tr("Nodes"))) { + let ui: ui_t = ui_base_ui; + if (ui_button(tr("Nodes"))) { ui_base_show_material_nodes(); } else if (ui.is_hovered) { - zui_tooltip(tr("Show Node Editor") + " (" + map_get(config_keymap, "toggle_node_editor") + ")"); + ui_tooltip(tr("Show Node Editor") + " (" + map_get(config_keymap, "toggle_node_editor") + ")"); } } let _tab_materials_draw_slots: i32; function tab_materials_draw_slots(mini: bool) { - let ui: zui_t = ui_base_ui; - let slotw: i32 = math_floor(51 * zui_SCALE(ui)); + let ui: ui_t = ui_base_ui; + let slotw: i32 = math_floor(51 * ui_SCALE(ui)); let num: i32 = math_floor(config_raw.layout[layout_size_t.SIDEBAR_W] / slotw); for (let row: i32 = 0; row < math_floor(math_ceil(project_materials.length / num)); ++row) { @@ -61,32 +61,32 @@ function tab_materials_draw_slots(mini: bool) { for (let i: i32 = 0; i < num * mult; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; - let off: f32 = config_raw.show_asset_names ? zui_ELEMENT_OFFSET(ui) * 10.0 : 6; + let off: f32 = config_raw.show_asset_names ? ui_ELEMENT_OFFSET(ui) * 10.0 : 6; if (row > 0) { ui._y += off; } for (let j: i32 = 0; j < num; ++j) { - let imgw: i32 = math_floor(50 * zui_SCALE(ui)); + let imgw: i32 = math_floor(50 * ui_SCALE(ui)); let i: i32 = j + row * num; if (i >= project_materials.length) { - _zui_end_element(imgw); + _ui_end_element(imgw); if (config_raw.show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } continue; } - let img: image_t = zui_SCALE(ui) > 1 ? project_materials[i].image : project_materials[i].image_icon; + let img: image_t = ui_SCALE(ui) > 1 ? project_materials[i].image : project_materials[i].image_icon; let imgFull: image_t = project_materials[i].image; // Highligh selected if (context_raw.material == project_materials[i]) { if (mini) { - let w: f32 = ui._w / zui_SCALE(ui); - zui_rect(0, -2, w - 2, w - 4, ui.ops.theme.HIGHLIGHT_COL, 3); + let w: f32 = ui._w / ui_SCALE(ui); + ui_rect(0, -2, w - 2, w - 4, ui.ops.theme.HIGHLIGHT_COL, 3); } else { let off: i32 = row % 2 == 1 ? 1 : 0; @@ -94,10 +94,10 @@ function tab_materials_draw_slots(mini: bool) { if (config_raw.window_scale > 1) { w += math_floor(config_raw.window_scale * 2); } - zui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, w - off, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 1, -2, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); } } @@ -108,11 +108,11 @@ function tab_materials_draw_slots(mini: bool) { // Draw material icon let uix: f32 = ui._x; let uiy: f32 = ui._y; - let tile: i32 = zui_SCALE(ui) > 1 ? 100 : 50; - let imgh: f32 = mini ? ui_base_default_sidebar_mini_w * 0.85 * zui_SCALE(ui) : -1.0; - let state: zui_state_t = project_materials[i].preview_ready ? - _zui_image(img, 0xffffffff, imgh) : - _zui_image(resource_get("icons.k"), 0xffffffff, -1.0, tile, tile, tile, tile); + let tile: i32 = ui_SCALE(ui) > 1 ? 100 : 50; + let imgh: f32 = mini ? ui_base_default_sidebar_mini_w * 0.85 * ui_SCALE(ui) : -1.0; + let state: ui_state_t = project_materials[i].preview_ready ? + _ui_image(img, 0xffffffff, imgh) : + _ui_image(resource_get("icons.k"), 0xffffffff, -1.0, tile, tile, tile, tile); // Draw material numbers when selecting a material via keyboard shortcut let is_typing: bool = ui.is_typing || ui_view2d_ui.is_typing || ui_nodes_ui.is_typing; @@ -129,7 +129,7 @@ function tab_materials_draw_slots(mini: bool) { } // Select material - if (state == zui_state_t.STARTED && ui.input_y > ui._window_y) { + if (state == ui_state_t.STARTED && ui.input_y > ui._window_y) { if (context_raw.material != project_materials[i]) { context_select_material(i); ///if is_paint @@ -156,7 +156,7 @@ function tab_materials_draw_slots(mini: bool) { let add: i32 = project_materials.length > 1 ? 1 : 0; _tab_materials_draw_slots = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let i: i32 = _tab_materials_draw_slots; let m: slot_material_t = project_materials[i]; @@ -183,7 +183,7 @@ function tab_materials_draw_slots(mini: bool) { context_raw.material = slot_material_create(project_materials[0].data); array_push(project_materials, context_raw.material); - let cloned: zui_node_canvas_t = util_clone_canvas(project_materials[i].canvas); + let cloned: ui_node_canvas_t = util_clone_canvas(project_materials[i].canvas); context_raw.material.canvas = cloned; tab_materials_update_material(); history_duplicate_material(); @@ -194,69 +194,69 @@ function tab_materials_draw_slots(mini: bool) { tab_materials_delete_material(m); } - let base_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let base_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (base_handle.init) { base_handle.selected = m.paint_base; } - let opac_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (opac_handle.init) { opac_handle.selected = m.paint_opac; } - let nor_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let nor_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (nor_handle.init) { nor_handle.selected = m.paint_nor; } - let occ_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let occ_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (occ_handle.init) { occ_handle.selected = m.paint_occ; } - let rough_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let rough_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (rough_handle.init) { rough_handle.selected = m.paint_rough; } - let met_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let met_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (met_handle.init) { met_handle.selected = m.paint_met; } - let height_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let height_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (height_handle.init) { height_handle.selected = m.paint_height; } - let emis_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let emis_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (emis_handle.init) { emis_handle.selected = m.paint_emis; } - let subs_handle: zui_handle_t = zui_nest(zui_handle(__ID__), m.id); + let subs_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (subs_handle.init) { subs_handle.selected = m.paint_subs; } ui_menu_fill(ui); - m.paint_base = zui_check(base_handle, tr("Base Color")); + m.paint_base = ui_check(base_handle, tr("Base Color")); ui_menu_fill(ui); - m.paint_opac = zui_check(opac_handle, tr("Opacity")); + m.paint_opac = ui_check(opac_handle, tr("Opacity")); ui_menu_fill(ui); - m.paint_nor = zui_check(nor_handle, tr("Normal")); + m.paint_nor = ui_check(nor_handle, tr("Normal")); ui_menu_fill(ui); - m.paint_occ = zui_check(occ_handle, tr("Occlusion")); + m.paint_occ = ui_check(occ_handle, tr("Occlusion")); ui_menu_fill(ui); - m.paint_rough = zui_check(rough_handle, tr("Roughness")); + m.paint_rough = ui_check(rough_handle, tr("Roughness")); ui_menu_fill(ui); - m.paint_met = zui_check(met_handle, tr("Metallic")); + m.paint_met = ui_check(met_handle, tr("Metallic")); ui_menu_fill(ui); - m.paint_height = zui_check(height_handle, tr("Height")); + m.paint_height = ui_check(height_handle, tr("Height")); ui_menu_fill(ui); - m.paint_emis = zui_check(emis_handle, tr("Emission")); + m.paint_emis = ui_check(emis_handle, tr("Emission")); ui_menu_fill(ui); - m.paint_subs = zui_check(subs_handle, tr("Subsurface")); + m.paint_subs = ui_check(subs_handle, tr("Subsurface")); if (base_handle.changed || opac_handle.changed || nor_handle.changed || @@ -272,32 +272,32 @@ function tab_materials_draw_slots(mini: bool) { }, 13 + add); } if (ui.is_hovered) { - _zui_tooltip_image(imgFull); + _ui_tooltip_image(imgFull); if (i < 9) { let i1: i32 = i + 1; - zui_tooltip(project_materials[i].canvas.name + " - (" + map_get(config_keymap, "select_material") + " " + i1 + ")"); + ui_tooltip(project_materials[i].canvas.name + " - (" + map_get(config_keymap, "select_material") + " " + i1 + ")"); } else { - zui_tooltip(project_materials[i].canvas.name); + ui_tooltip(project_materials[i].canvas.name); } } if (config_raw.show_asset_names) { ui._x = uix; ui._y += slotw * 0.9; - zui_text(project_materials[i].canvas.name, zui_align_t.CENTER); + ui_text(project_materials[i].canvas.name, ui_align_t.CENTER); if (ui.is_hovered) { if (i < 9) { let i1: i32 = i + 1; - zui_tooltip(project_materials[i].canvas.name + " - (" + map_get(config_keymap, "select_material") + " " + i1 + ")"); + ui_tooltip(project_materials[i].canvas.name + " - (" + map_get(config_keymap, "select_material") + " " + i1 + ")"); } else { - zui_tooltip(project_materials[i].canvas.name); + ui_tooltip(project_materials[i].canvas.name); } } ui._y -= slotw * 0.9; if (i == project_materials.length - 1) { - ui._y += j == num - 1 ? imgw : imgw + zui_ELEMENT_H(ui) + zui_ELEMENT_OFFSET(ui); + ui._y += j == num - 1 ? imgw : imgw + ui_ELEMENT_H(ui) + ui_ELEMENT_OFFSET(ui); } } } @@ -318,7 +318,7 @@ function tab_materials_draw_slots(mini: bool) { } function tab_materials_button_new(text: string) { - if (zui_button(text)) { + if (ui_button(text)) { app_notify_on_init(function() { context_raw.material = slot_material_create(project_materials[0].data); array_push(project_materials, context_raw.material); @@ -340,9 +340,9 @@ function tab_materials_update_material() { } } -function tab_materials_update_material_pointers(nodes: zui_node_t[], i: i32) { +function tab_materials_update_material_pointers(nodes: ui_node_t[], i: i32) { for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = nodes[i]; + let n: ui_node_t = nodes[i]; if (n.type == "MATERIAL") { if (n.buttons[0].default_value[0] == i) { n.buttons[0].default_value[0] = 9999; // Material deleted @@ -357,7 +357,7 @@ function tab_materials_update_material_pointers(nodes: zui_node_t[], i: i32) { function tab_materials_accept_swatch_drag(swatch: swatch_color_t) { context_raw.material = slot_material_create(project_materials[0].data); for (let i: i32 = 0; i < context_raw.material.canvas.nodes.length; ++i) { - let node: zui_node_t = context_raw.material.canvas.nodes[i]; + let node: ui_node_t = context_raw.material.canvas.nodes[i]; if (node.type == "RGB" ) { node.outputs[0].default_value = f32_array_create_xyzw( color_get_rb(swatch.base) / 255, diff --git a/base/sources/tab_meshes.ts b/base/sources/tab_meshes.ts index 9677e9d6..543b3a9d 100644 --- a/base/sources/tab_meshes.ts +++ b/base/sources/tab_meshes.ts @@ -1,37 +1,37 @@ let _tab_meshes_draw_i: i32; -function tab_meshes_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_meshes_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Meshes")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Meshes")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); ///if (is_paint || is_sculpt) if (config_raw.touch_ui) { let row: f32[] = [1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 14]; - zui_row(row); + ui_row(row); } ///end ///if is_lab if (config_raw.touch_ui) { let row: f32[] = [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 14]; - zui_row(row); + ui_row(row); } ///end - if (zui_button(tr("Import"))) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Import"))) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Replace Existing"), map_get(config_keymap, "file_import_assets"))) { project_import_mesh(true); } @@ -40,11 +40,11 @@ function tab_meshes_draw(htab: zui_handle_t) { } }, 2); } - if (ui.is_hovered) zui_tooltip(tr("Import mesh file")); + if (ui.is_hovered) ui_tooltip(tr("Import mesh file")); ///if is_lab - if (zui_button(tr("Set Default"))) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Set Default"))) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Cube"))) { tab_meshes_set_default_mesh(".Cube"); } @@ -61,13 +61,13 @@ function tab_meshes_draw(htab: zui_handle_t) { } ///end - if (zui_button(tr("Flip Normals"))) { + if (ui_button(tr("Flip Normals"))) { util_mesh_flip_normals(); context_raw.ddirty = 2; } - if (zui_button(tr("Calculate Normals"))) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Calculate Normals"))) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Smooth"))) { util_mesh_calc_normals(true); context_raw.ddirty = 2; @@ -79,12 +79,12 @@ function tab_meshes_draw(htab: zui_handle_t) { }, 2); } - if (zui_button(tr("Geometry to Origin"))) { + if (ui_button(tr("Geometry to Origin"))) { util_mesh_to_origin(); context_raw.ddirty = 2; } - if (zui_button(tr("Apply Displacement"))) { + if (ui_button(tr("Apply Displacement"))) { ///if is_paint util_mesh_apply_displacement(project_layers[0].texpaint_pack); ///end @@ -98,8 +98,8 @@ function tab_meshes_draw(htab: zui_handle_t) { context_raw.ddirty = 2; } - if (zui_button(tr("Rotate"))) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Rotate"))) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Rotate X"))) { util_mesh_swap_axis(1, 2); context_raw.ddirty = 2; @@ -117,18 +117,18 @@ function tab_meshes_draw(htab: zui_handle_t) { }, 3); } - zui_end_sticky(); + ui_end_sticky(); for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let o: mesh_object_t = project_paint_objects[i]; - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); h.selected = o.base.visible; - o.base.visible = zui_check(h, o.base.name); + o.base.visible = ui_check(h, o.base.name); if (ui.is_hovered && ui.input_released_r) { _tab_meshes_draw_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let i: i32 = _tab_meshes_draw_i; let o: mesh_object_t = project_paint_objects[i]; diff --git a/base/sources/tab_particles.ts b/base/sources/tab_particles.ts index 40cd75bc..0552b23f 100644 --- a/base/sources/tab_particles.ts +++ b/base/sources/tab_particles.ts @@ -1,21 +1,21 @@ ///if (is_paint || is_sculpt) -function tab_particles_draw(htab: zui_handle_t) { - if (zui_tab(htab, tr("Particles"))) { - zui_begin_sticky(); +function tab_particles_draw(htab: ui_handle_t) { + if (ui_tab(htab, tr("Particles"))) { + ui_begin_sticky(); let row: f32[] = [1 / 4, 1 / 4, 1 / 4]; - zui_row(row); - if (zui_button(tr("New"))) { + ui_row(row); + if (ui_button(tr("New"))) { } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { } - if (zui_button(tr("Nodes"))) { + if (ui_button(tr("Nodes"))) { } - zui_end_sticky(); + ui_end_sticky(); } } diff --git a/base/sources/tab_plugins.ts b/base/sources/tab_plugins.ts index 5a1f8b0f..356d5e2a 100644 --- a/base/sources/tab_plugins.ts +++ b/base/sources/tab_plugins.ts @@ -1,24 +1,24 @@ -function tab_plugins_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; - if (zui_tab(htab, tr("Plugins"))) { +function tab_plugins_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; + if (ui_tab(htab, tr("Plugins"))) { - zui_begin_sticky(); + ui_begin_sticky(); ///if (is_paint || is_sculpt) let row: f32[] = [1 / 4]; - zui_row(row); + ui_row(row); ///end ///if is_lab let row: f32[] = [1 / 14]; - zui_row(row); + ui_row(row); ///end - if (zui_button(tr("Manager"))) { + if (ui_button(tr("Manager"))) { box_preferences_htab.position = 6; // Plugins box_preferences_show(); } - zui_end_sticky(); + ui_end_sticky(); // Draw plugins let keys: string[] = map_keys(plugin_map); diff --git a/base/sources/tab_script.ts b/base/sources/tab_script.ts index df4fe945..262cce2d 100644 --- a/base/sources/tab_script.ts +++ b/base/sources/tab_script.ts @@ -1,35 +1,35 @@ -let tab_script_hscript: zui_handle_t = zui_handle_create(); -let tab_script_text_coloring: zui_text_coloring_t = null; +let tab_script_hscript: ui_handle_t = ui_handle_create(); +let tab_script_text_coloring: ui_text_coloring_t = null; -function tab_script_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_script_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Script")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Script")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); if (config_raw.touch_ui) { let row: f32[] = [1 / 4, 1 / 4, 1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14, 1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } - if (zui_button(tr("Run"))) { + if (ui_button(tr("Run"))) { js_eval(tab_script_hscript.text); } - if (zui_button(tr("Clear"))) { + if (ui_button(tr("Clear"))) { tab_script_hscript.text = ""; } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show("js", false, false, function (path: string) { let b: buffer_t = data_get_blob(path); tab_script_hscript.text = sys_buffer_to_string(b); data_delete_blob(path); }); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { ui_files_show("js", true, false, function (path: string) { let str: string = tab_script_hscript.text; let f: string = ui_files_filename; @@ -43,26 +43,26 @@ function tab_script_draw(htab: zui_handle_t) { krom_file_save_bytes(path, sys_string_to_buffer(str), 0); }); } - zui_end_sticky(); + ui_end_sticky(); let _font: g2_font_t = ui.ops.font; let _font_size: i32 = ui.font_size; let f: g2_font_t = data_get_font("font_mono.ttf"); - zui_set_font(ui, f); - ui.font_size = math_floor(15 * zui_SCALE(ui)); - zui_text_area_line_numbers = true; - zui_text_area_scroll_past_end = true; - zui_text_area_coloring = tab_script_get_text_coloring(); - zui_text_area(tab_script_hscript); - zui_text_area_line_numbers = false; - zui_text_area_scroll_past_end = false; - zui_text_area_coloring = null; - zui_set_font(ui, _font); + ui_set_font(ui, f); + ui.font_size = math_floor(15 * ui_SCALE(ui)); + ui_text_area_line_numbers = true; + ui_text_area_scroll_past_end = true; + ui_text_area_coloring = tab_script_get_text_coloring(); + ui_text_area(tab_script_hscript); + ui_text_area_line_numbers = false; + ui_text_area_scroll_past_end = false; + ui_text_area_coloring = null; + ui_set_font(ui, _font); ui.font_size = _font_size; } } -function tab_script_get_text_coloring(): zui_text_coloring_t { +function tab_script_get_text_coloring(): ui_text_coloring_t { if (tab_script_text_coloring == null) { let blob: buffer_t = data_get_blob("text_coloring.json"); tab_script_text_coloring = json_parse(sys_buffer_to_string(blob)); diff --git a/base/sources/tab_swatches.ts b/base/sources/tab_swatches.ts index cfb0fa82..75d5d3d0 100644 --- a/base/sources/tab_swatches.ts +++ b/base/sources/tab_swatches.ts @@ -20,31 +20,31 @@ function tab_swatches_empty_get(): image_t { let _tab_swatches_draw_i: i32; -function tab_swatches_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_swatches_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Swatches")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Swatches")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); if (config_raw.touch_ui) { let row: f32[] = [1 / 5, 1 / 5, 1 / 5, 1 / 5, 1 / 5]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14, 1 / 14, 1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } - if (zui_button(tr("New"))) { + if (ui_button(tr("New"))) { context_set_swatch(make_swatch()); array_push(project_raw.swatches, context_raw.swatch); } if (ui.is_hovered) { - zui_tooltip(tr("Add new swatch")); + ui_tooltip(tr("Add new swatch")); } - if (zui_button(tr("Import"))) { - ui_menu_draw(function (ui: zui_t) { + if (ui_button(tr("Import"))) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Replace Existing"))) { project_import_swatches(true); context_set_swatch(project_raw.swatches[0]); @@ -55,33 +55,33 @@ function tab_swatches_draw(htab: zui_handle_t) { }, 2); } if (ui.is_hovered) { - zui_tooltip(tr("Import swatches")); + ui_tooltip(tr("Import swatches")); } - if (zui_button(tr("Export"))) { + if (ui_button(tr("Export"))) { project_export_swatches(); } if (ui.is_hovered) { - zui_tooltip(tr("Export swatches")); + ui_tooltip(tr("Export swatches")); } - if (zui_button(tr("Clear"))) { + if (ui_button(tr("Clear"))) { context_set_swatch(make_swatch()); project_raw.swatches = [context_raw.swatch]; } - if (zui_button(tr("Restore"))) { + if (ui_button(tr("Restore"))) { project_set_default_swatches(); context_set_swatch(project_raw.swatches[0]); } if (ui.is_hovered) { - zui_tooltip(tr("Restore default swatches")); + ui_tooltip(tr("Restore default swatches")); } - zui_end_sticky(); - zui_separator(3, false); + ui_end_sticky(); + ui_separator(3, false); - let slotw: i32 = math_floor(26 * zui_SCALE(ui)); + let slotw: i32 = math_floor(26 * ui_SCALE(ui)); let num: i32 = math_floor(ui._w / (slotw + 3)); let drag_pos_set: bool = false; @@ -92,7 +92,7 @@ function tab_swatches_draw(htab: zui_handle_t) { for (let i: i32 = 0; i < num; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; if (row > 0) { @@ -102,13 +102,13 @@ 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); + _ui_end_element(slotw); continue; } if (context_raw.swatch == project_raw.swatches[i]) { let w: i32 = 32; - zui_fill(-2, -2, w, w, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, -2, w, w, ui.ops.theme.HIGHLIGHT_COL); } uix = ui._x; @@ -116,33 +116,33 @@ function tab_swatches_draw(htab: zui_handle_t) { // Draw the drag position indicator if (base_drag_swatch != null && tab_swatches_drag_pos == i) { - zui_fill(-1, -2 , 2, 32, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-1, -2 , 2, 32, ui.ops.theme.HIGHLIGHT_COL); } - let state: zui_state_t = _zui_image(tab_swatches_empty_get(), project_raw.swatches[i].base, slotw); + let state: ui_state_t = _ui_image(tab_swatches_empty_get(), project_raw.swatches[i].base, slotw); - if (state == zui_state_t.STARTED) { + if (state == ui_state_t.STARTED) { context_set_swatch(project_raw.swatches[i]); base_drag_off_x = -(mouse_x - uix - ui._window_x - 2 * slotw); base_drag_off_y = -(mouse_y - uiy - ui._window_y + 1); base_drag_swatch = context_raw.swatch; } - else if (state == zui_state_t.HOVERED) { + else if (state == ui_state_t.HOVERED) { tab_swatches_drag_pos = (mouse_x > uix + ui._window_x + slotw / 2) ? i + 1 : i; // Switch to the next position if the mouse crosses the swatch rectangle center drag_pos_set = true; } - else if (state == zui_state_t.RELEASED) { + else if (state == ui_state_t.RELEASED) { if (time_time() - context_raw.select_time < 0.25) { _tab_swatches_draw_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { ui.changed = false; - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); h.color = context_raw.swatch.base; - context_raw.swatch.base = zui_color_wheel(h, false, -1, 11 * ui.ops.theme.ELEMENT_H * zui_SCALE(ui), true, function () { + context_raw.swatch.base = ui_color_wheel(h, false, -1, 11 * ui.ops.theme.ELEMENT_H * ui_SCALE(ui), true, function () { context_raw.color_picker_previous_tool = context_raw.tool; context_select_tool(workspace_tool_t.PICKER); @@ -153,21 +153,21 @@ function tab_swatches_draw(htab: zui_handle_t) { }; }); - let hopacity: zui_handle_t = zui_handle(__ID__); + let hopacity: ui_handle_t = ui_handle(__ID__); hopacity.value = context_raw.swatch.opacity; - context_raw.swatch.opacity = zui_slider(hopacity, "Opacity", 0, 1, true); - let hocclusion: zui_handle_t = zui_handle(__ID__); + context_raw.swatch.opacity = ui_slider(hopacity, "Opacity", 0, 1, true); + let hocclusion: ui_handle_t = ui_handle(__ID__); hocclusion.value = context_raw.swatch.occlusion; - context_raw.swatch.occlusion = zui_slider(hocclusion, "Occlusion", 0, 1, true); - let hroughness: zui_handle_t = zui_handle(__ID__); + context_raw.swatch.occlusion = ui_slider(hocclusion, "Occlusion", 0, 1, true); + let hroughness: ui_handle_t = ui_handle(__ID__); hroughness.value = context_raw.swatch.roughness; - context_raw.swatch.roughness = zui_slider(hroughness, "Roughness", 0, 1, true); - let hmetallic: zui_handle_t = zui_handle(__ID__); + context_raw.swatch.roughness = ui_slider(hroughness, "Roughness", 0, 1, true); + let hmetallic: ui_handle_t = ui_handle(__ID__); hmetallic.value = context_raw.swatch.metallic; - context_raw.swatch.metallic = zui_slider(hmetallic, "Metallic", 0, 1, true); - let hheight: zui_handle_t = zui_handle(__ID__); + context_raw.swatch.metallic = ui_slider(hmetallic, "Metallic", 0, 1, true); + let hheight: ui_handle_t = ui_handle(__ID__); hheight.value = context_raw.swatch.height; - context_raw.swatch.height = zui_slider(hheight, "Height", 0, 1, true); + context_raw.swatch.height = ui_slider(hheight, "Height", 0, 1, true); if (ui.changed || ui.is_typing) { ui_menu_keep_open = true; @@ -175,7 +175,7 @@ function tab_swatches_draw(htab: zui_handle_t) { if (ui.input_released) { context_set_swatch(context_raw.swatch); // Trigger material preview update } - }, 16, math_floor(mouse_x - 200 * zui_SCALE(ui)), math_floor(mouse_y - 250 * zui_SCALE(ui))); + }, 16, math_floor(mouse_x - 200 * ui_SCALE(ui)), math_floor(mouse_y - 250 * ui_SCALE(ui))); } context_raw.select_time = time_time(); @@ -196,7 +196,7 @@ function tab_swatches_draw(htab: zui_handle_t) { _tab_swatches_draw_i = i; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let i: i32 = _tab_swatches_draw_i; if (ui_menu_button(ui, tr("Duplicate"))) { @@ -230,7 +230,7 @@ function tab_swatches_draw(htab: zui_handle_t) { let color: i32 = project_raw.swatches[i].base; color = color_set_ab(color, project_raw.swatches[i].opacity * 255); let val: u32 = color; - zui_tooltip("#" + i32_to_string_hex(val)); + ui_tooltip("#" + i32_to_string_hex(val)); } } } @@ -239,7 +239,7 @@ function tab_swatches_draw(htab: zui_handle_t) { if (base_drag_swatch != null && tab_swatches_drag_pos == project_raw.swatches.length) { ui._x = uix; // Reset the position because otherwise it would start in the row below ui._y = uiy; - zui_fill(28, -2, 2, 32, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(28, -2, 2, 32, ui.ops.theme.HIGHLIGHT_COL); } // Currently there is no valid dragPosition so reset it diff --git a/base/sources/tab_textures.ts b/base/sources/tab_textures.ts index 47741441..5600e1cd 100644 --- a/base/sources/tab_textures.ts +++ b/base/sources/tab_textures.ts @@ -5,37 +5,37 @@ let _tab_textures_draw_asset: asset_t; let _tab_textures_draw_i: i32; let _tab_textures_draw_is_packed: bool; -function tab_textures_draw(htab: zui_handle_t) { - let ui: zui_t = ui_base_ui; +function tab_textures_draw(htab: ui_handle_t) { + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_tab(htab, tr("Textures")) && statush > ui_status_default_status_h * zui_SCALE(ui)) { + if (ui_tab(htab, tr("Textures")) && statush > ui_status_default_status_h * ui_SCALE(ui)) { - zui_begin_sticky(); + ui_begin_sticky(); if (config_raw.touch_ui) { let row: f32[] = [1 / 4, 1 / 4]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [1 / 14, 1 / 14]; - zui_row(row); + ui_row(row); } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show(string_array_join(path_texture_formats, ","), false, true, function (path: string) { import_asset_run(path, -1.0, -1.0, true, false); ui_base_hwnds[tab_area_t.STATUS].redraws = 2; }); } if (ui.is_hovered) { - zui_tooltip(tr("Import texture file") + " (" + map_get(config_keymap, "file_import_assets") + ")"); + ui_tooltip(tr("Import texture file") + " (" + map_get(config_keymap, "file_import_assets") + ")"); } - if (zui_button(tr("2D View"))) { + if (ui_button(tr("2D View"))) { ui_base_show_2d_view(view_2d_type_t.ASSET); } - zui_end_sticky(); + ui_end_sticky(); if (project_assets.length > 0) { @@ -46,7 +46,7 @@ function tab_textures_draw(htab: zui_handle_t) { let statusw: i32 = sys_width(); ///end - let slotw: i32 = math_floor(52 * zui_SCALE(ui)); + let slotw: i32 = math_floor(52 * ui_SCALE(ui)); let num: i32 = math_floor(statusw / slotw); for (let row: i32 = 0; row < math_floor(math_ceil(project_assets.length / num)); ++row) { @@ -55,21 +55,21 @@ function tab_textures_draw(htab: zui_handle_t) { for (let i: i32 = 0; i < num * mult; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); ui._x += 2; - let off: f32 = config_raw.show_asset_names ? zui_ELEMENT_OFFSET(ui) * 10.0 : 6; + let off: f32 = config_raw.show_asset_names ? ui_ELEMENT_OFFSET(ui) * 10.0 : 6; if (row > 0) { ui._y += off; } for (let j: i32 = 0; j < num; ++j) { - let imgw: i32 = math_floor(50 * zui_SCALE(ui)); + let imgw: i32 = math_floor(50 * ui_SCALE(ui)); let i: i32 = j + row * num; if (i >= project_assets.length) { - _zui_end_element(imgw); + _ui_end_element(imgw); if (config_raw.show_asset_names) { - _zui_end_element(0); + _ui_end_element(0); } continue; } @@ -79,7 +79,7 @@ function tab_textures_draw(htab: zui_handle_t) { let uix: f32 = ui._x; let uiy: f32 = ui._y; let sw: i32 = img.height < img.width ? img.height : 0; - if (_zui_image(img, 0xffffffff, slotw, 0, 0, sw, sw) == zui_state_t.STARTED && ui.input_y > ui._window_y) { + if (_ui_image(img, 0xffffffff, slotw, 0, 0, sw, sw) == ui_state_t.STARTED && ui.input_y > ui._window_y) { base_drag_off_x = -(mouse_x - uix - ui._window_x - 3); base_drag_off_y = -(mouse_y - uiy - ui._window_y + 1); base_drag_asset = asset; @@ -99,10 +99,10 @@ function tab_textures_draw(htab: zui_handle_t) { ui._y = uiy; let off: i32 = i % 2 == 1 ? 1 : 0; let w: i32 = 50; - zui_fill(0, 0, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(0, w - off + 2, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(0, 0, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, 0, w + 3, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, w - off + 2, w + 3, 2 + off, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, 0, 2, w + 3, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); ui._x = _uix; ui._y = _uiy; } @@ -110,12 +110,12 @@ function tab_textures_draw(htab: zui_handle_t) { let is_packed: bool = project_raw.packed_assets != null && project_packed_asset_exists(project_raw.packed_assets, asset.file); if (ui.is_hovered) { - _zui_tooltip_image(img, 256); + _ui_tooltip_image(img, 256); if (is_packed) { - zui_tooltip(asset.name + " " + tr("(packed)")); + ui_tooltip(asset.name + " " + tr("(packed)")); } else { - zui_tooltip(asset.name); + ui_tooltip(asset.name); } } @@ -136,7 +136,7 @@ function tab_textures_draw(htab: zui_handle_t) { _tab_textures_draw_i = i; _tab_textures_draw_is_packed = is_packed; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { if (ui_menu_button(ui, tr("Export"))) { ui_files_show("png", true, false, function (path: string) { _tab_textures_draw_path = path; @@ -217,13 +217,13 @@ function tab_textures_draw(htab: zui_handle_t) { if (config_raw.show_asset_names) { ui._x = uix; ui._y += slotw * 0.9; - zui_text(project_assets[i].name, zui_align_t.CENTER); + ui_text(project_assets[i].name, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(project_assets[i].name); + ui_tooltip(project_assets[i].name); } ui._y -= slotw * 0.9; if (i == project_assets.length - 1) { - ui._y += j == num - 1 ? imgw : imgw + zui_ELEMENT_H(ui) + zui_ELEMENT_OFFSET(ui); + ui._y += j == num - 1 ? imgw : imgw + ui_ELEMENT_H(ui) + ui_ELEMENT_OFFSET(ui); } } } @@ -232,9 +232,9 @@ function tab_textures_draw(htab: zui_handle_t) { else { let img: image_t = resource_get("icons.k"); let r: rect_t = resource_tile50(img, 0, 1); - _zui_image(img, ui.ops.theme.BUTTON_COL, r.h, r.x, r.y, r.w, r.h); + _ui_image(img, ui.ops.theme.BUTTON_COL, r.h, r.x, r.y, r.w, r.h); if (ui.is_hovered) { - zui_tooltip(tr("Drag and drop files here")); + ui_tooltip(tr("Drag and drop files here")); } } @@ -258,9 +258,9 @@ function tab_textures_to_pow2(i: i32): i32 { return i; } -function tab_textures_update_texture_pointers(nodes: zui_node_t[], i: i32) { +function tab_textures_update_texture_pointers(nodes: ui_node_t[], i: i32) { for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = nodes[i]; + let n: ui_node_t = nodes[i]; if (n.type == "TEX_IMAGE") { if (n.buttons[0].default_value[0] == i) { n.buttons[0].default_value[0] = 9999; // Texture deleted, use pink now diff --git a/base/sources/translator.ts b/base/sources/translator.ts index ebcda83f..55554fa3 100644 --- a/base/sources/translator.ts +++ b/base/sources/translator.ts @@ -166,11 +166,11 @@ function translator_init_font(cjk: bool, font_path: string, font_scale: f32) { // Scale up the font size and elements width a bit base_theme.FONT_SIZE = math_floor(base_default_font_size * font_scale); base_theme.ELEMENT_W = math_floor(base_default_element_w * (config_raw.locale != "en" ? 1.4 : 1.0)); - let uis: zui_t[] = base_get_uis(); + let uis: ui_t[] = base_get_uis(); for (let i: i32 = 0; i < uis.length; ++i) { - let ui: zui_t = uis[i]; - zui_set_font(ui, f); - _zui_set_scale(ui, zui_SCALE(ui)); + let ui: ui_t = uis[i]; + ui_set_font(ui, f); + _ui_set_scale(ui, ui_SCALE(ui)); } }); } diff --git a/base/sources/ui_base.ts b/base/sources/ui_base.ts index 1cb8f018..476c2315 100644 --- a/base/sources/ui_base.ts +++ b/base/sources/ui_base.ts @@ -1,18 +1,18 @@ let ui_base_show: bool = true; -let ui_base_ui: zui_t; +let ui_base_ui: ui_t; let ui_base_border_started: i32 = 0; -let ui_base_border_handle: zui_handle_t = null; +let ui_base_border_handle: ui_handle_t = null; let ui_base_action_paint_remap: string = ""; let ui_base_operator_search_offset: i32 = 0; let ui_base_undo_tap_time: f32 = 0.0; let ui_base_redo_tap_time: f32 = 0.0; -let ui_base_hwnds: zui_handle_t[] = ui_base_init_hwnds(); -let ui_base_htabs: zui_handle_t[] = ui_base_init_htabs(); +let ui_base_hwnds: ui_handle_t[] = ui_base_init_hwnds(); +let ui_base_htabs: ui_handle_t[] = ui_base_init_htabs(); type tab_draw_t = { - f: (h: zui_handle_t)=>void; + f: (h: ui_handle_t)=>void; }; type tab_draw_array_t = tab_draw_t[]; let ui_base_hwnd_tabs: tab_draw_array_t[] = ui_base_init_hwnd_tabs(); @@ -26,37 +26,37 @@ let ui_base_default_sidebar_w: i32 = ui_base_default_sidebar_mini_w; let ui_base_default_sidebar_w: i32 = ui_base_default_sidebar_full_w; ///end let ui_base_tabx: i32 = 0; -let ui_base_hminimized: zui_handle_t = zui_handle_create(); +let ui_base_hminimized: ui_handle_t = ui_handle_create(); let ui_base_sidebar_mini_w: i32 = ui_base_default_sidebar_mini_w; ///end -function ui_base_init_hwnds(): zui_handle_t[] { +function ui_base_init_hwnds(): ui_handle_t[] { ///if is_paint - let hwnds: zui_handle_t[] = [zui_handle_create(), zui_handle_create(), zui_handle_create()]; + let hwnds: ui_handle_t[] = [ui_handle_create(), ui_handle_create(), ui_handle_create()]; ///end ///if is_sculpt - let hwnds: zui_handle_t[] = [zui_handle_create(), zui_handle_create(), zui_handle_create()]; + let hwnds: ui_handle_t[] = [ui_handle_create(), ui_handle_create(), ui_handle_create()]; ///end ///if is_lab - let hwnds: zui_handle_t[] = [zui_handle_create()]; + let hwnds: ui_handle_t[] = [ui_handle_create()]; ///end return hwnds; } -function ui_base_init_htabs(): zui_handle_t[] { +function ui_base_init_htabs(): ui_handle_t[] { ///if is_paint - let htabs: zui_handle_t[] = [zui_handle_create(), zui_handle_create(), zui_handle_create()]; + let htabs: ui_handle_t[] = [ui_handle_create(), ui_handle_create(), ui_handle_create()]; ///end ///if is_sculpt - let htabs: zui_handle_t[] = [zui_handle_create(), zui_handle_create(), zui_handle_create()]; + let htabs: ui_handle_t[] = [ui_handle_create(), ui_handle_create(), ui_handle_create()]; ///end ///if is_lab - let htabs: zui_handle_t[] = [zui_handle_create()]; + let htabs: ui_handle_t[] = [ui_handle_create()]; ///end return htabs; } -function _draw_callback_create(f: (h: zui_handle_t)=>void): tab_draw_t { +function _draw_callback_create(f: (h: ui_handle_t)=>void): tab_draw_t { let cb: tab_draw_t = { f: f }; return cb; } @@ -191,7 +191,7 @@ function ui_base_init() { project_default_canvas = b; } - project_nodes = zui_nodes_create(); + project_nodes = ui_nodes_create(); project_canvas = armpack_decode(project_default_canvas); project_canvas.name = "Brush 1"; @@ -235,18 +235,18 @@ function ui_base_init() { history_reset(); let scale: f32 = config_raw.window_scale; - let ops: zui_options_t = { + let ops: ui_options_t = { theme: base_theme, font: base_font, scale_factor: scale, color_wheel: base_color_wheel.texture_, black_white_gradient: base_color_wheel_gradient.texture_ }; - ui_base_ui = zui_create(ops); - zui_on_border_hover = ui_base_on_border_hover; - zui_on_text_hover = ui_base_on_text_hover; - zui_on_deselect_text = ui_base_on_deselect_text; - zui_on_tab_drop = ui_base_on_tab_drop; + ui_base_ui = ui_create(ops); + ui_on_border_hover = ui_base_on_border_hover; + ui_on_text_hover = ui_base_on_text_hover; + ui_on_deselect_text = ui_base_on_deselect_text; + ui_on_tab_drop = ui_base_on_tab_drop; ///if (is_paint || is_sculpt) let resources: string[] = ["cursor.k", "icons.k"]; @@ -270,7 +270,7 @@ function ui_base_init() { resource_load(resources); - if (zui_SCALE(ui_base_ui) > 1) { + if (ui_SCALE(ui_base_ui) > 1) { ui_base_set_icon_scale(); } @@ -675,10 +675,10 @@ function ui_base_update() { ///end ///end - ui_menu_draw(function (ui: zui_t) { - let mode_handle: zui_handle_t = zui_handle(__ID__); + ui_menu_draw(function (ui: ui_t) { + let mode_handle: ui_handle_t = ui_handle(__ID__); mode_handle.position = context_raw.viewport_mode; - zui_text(tr("Viewport Mode"), zui_align_t.RIGHT, ui.ops.theme.HIGHLIGHT_COL); + ui_text(tr("Viewport Mode"), ui_align_t.RIGHT, ui.ops.theme.HIGHLIGHT_COL); let modes: string[] = [ tr("Lit"), tr("Base Color"), @@ -709,7 +709,7 @@ function ui_base_update() { ///end for (let i: i32 = 0; i < modes.length; ++i) { - zui_radio(mode_handle, i, modes[i], shortcuts[i]); + ui_radio(mode_handle, i, modes[i], shortcuts[i]); } let index: i32 = array_index_of(shortcuts, keyboard_key_code(ui.key_code)); @@ -923,16 +923,16 @@ let _ui_base_operator_search_first: bool; function ui_base_operator_search() { _ui_base_operator_search_first = true; - ui_menu_draw(function (ui: zui_t) { - let search_handle: zui_handle_t = zui_handle(__ID__); + ui_menu_draw(function (ui: ui_t) { + let search_handle: ui_handle_t = ui_handle(__ID__); - zui_fill(0, 0, ui._w / zui_SCALE(ui), ui.ops.theme.ELEMENT_H * 8, ui.ops.theme.SEPARATOR_COL); - let search: string = zui_text_input(search_handle, "", zui_align_t.LEFT, true, true); + ui_fill(0, 0, ui._w / ui_SCALE(ui), ui.ops.theme.ELEMENT_H * 8, ui.ops.theme.SEPARATOR_COL); + let search: string = ui_text_input(search_handle, "", ui_align_t.LEFT, true, true); ui.changed = false; if (_ui_base_operator_search_first) { _ui_base_operator_search_first = false; search_handle.text = ""; - zui_start_text_edit(search_handle); // Focus search bar + ui_start_text_edit(search_handle); // Focus search bar } if (search_handle.changed) { @@ -956,7 +956,7 @@ function ui_base_operator_search() { let n: string = keys[i]; if (string_index_of(n, search) >= 0) { ui.ops.theme.BUTTON_COL = count == ui_base_operator_search_offset ? ui.ops.theme.HIGHLIGHT_COL : ui.ops.theme.SEPARATOR_COL; - if (zui_button(n, zui_align_t.LEFT, map_get(config_keymap, n)) || (enter && count == ui_base_operator_search_offset)) { + if (ui_button(n, ui_align_t.LEFT, map_get(config_keymap, n)) || (enter && count == ui_base_operator_search_offset)) { if (enter) { ui.changed = true; count = 6; // Trigger break @@ -1015,7 +1015,7 @@ function ui_base_update_ui() { } ///if (is_paint || is_sculpt) - ui_base_sidebar_mini_w = math_floor(ui_base_default_sidebar_mini_w * zui_SCALE(ui_base_ui)); + ui_base_sidebar_mini_w = math_floor(ui_base_default_sidebar_mini_w * ui_SCALE(ui_base_ui)); ///end if (!base_ui_enabled) { @@ -1334,13 +1334,13 @@ function ui_base_render() { if (!ui_base_show && config_raw.touch_ui) { ui_base_ui.input_enabled = true; g2_end(); - zui_begin(ui_base_ui); - if (zui_window(zui_handle(__ID__), 0, 0, 150, math_floor(zui_ELEMENT_H(ui_base_ui) + zui_ELEMENT_OFFSET(ui_base_ui) + 1))) { - if (zui_button(tr("Close"))) { + ui_begin(ui_base_ui); + if (ui_window(ui_handle(__ID__), 0, 0, 150, math_floor(ui_ELEMENT_H(ui_base_ui) + ui_ELEMENT_OFFSET(ui_base_ui) + 1))) { + if (ui_button(tr("Close"))) { ui_base_toggle_distract_free(); } } - zui_end(); + ui_end(); g2_begin(null); } @@ -1364,7 +1364,7 @@ function ui_base_render() { } g2_end(); - zui_begin(ui_base_ui); + ui_begin(ui_base_ui); ///if (is_paint || is_sculpt) ui_toolbar_render_ui(); @@ -1377,7 +1377,7 @@ function ui_base_render() { ui_base_draw_sidebar(); ///end - zui_end(); + ui_end(); g2_begin(null); } @@ -1385,7 +1385,7 @@ function ui_base_render() { function ui_base_draw_sidebar() { // Tabs let mini: bool = config_raw.layout[layout_size_t.SIDEBAR_W] <= ui_base_sidebar_mini_w; - let expand_button_offset: i32 = config_raw.touch_ui ? math_floor(zui_ELEMENT_H(ui_base_ui) + zui_ELEMENT_OFFSET(ui_base_ui)) : 0; + let expand_button_offset: i32 = config_raw.touch_ui ? math_floor(ui_ELEMENT_H(ui_base_ui) + ui_ELEMENT_OFFSET(ui_base_ui)) : 0; ui_base_tabx = sys_width() - config_raw.layout[layout_size_t.SIDEBAR_W]; let _SCROLL_W: i32 = ui_base_ui.ops.theme.SCROLL_W; @@ -1393,35 +1393,35 @@ function ui_base_draw_sidebar() { ui_base_ui.ops.theme.SCROLL_W = ui_base_ui.ops.theme.SCROLL_MINI_W; } - if (zui_window(ui_base_hwnds[tab_area_t.SIDEBAR0], ui_base_tabx, 0, config_raw.layout[layout_size_t.SIDEBAR_W], config_raw.layout[layout_size_t.SIDEBAR_H0])) { + if (ui_window(ui_base_hwnds[tab_area_t.SIDEBAR0], ui_base_tabx, 0, config_raw.layout[layout_size_t.SIDEBAR_W], config_raw.layout[layout_size_t.SIDEBAR_H0])) { let tabs: tab_draw_t[] = ui_base_hwnd_tabs[tab_area_t.SIDEBAR0]; for (let i: i32 = 0; i < (mini ? 1 : tabs.length); ++i) { tabs[i].f(ui_base_htabs[tab_area_t.SIDEBAR0]); } } - if (zui_window(ui_base_hwnds[tab_area_t.SIDEBAR1], ui_base_tabx, config_raw.layout[layout_size_t.SIDEBAR_H0], config_raw.layout[layout_size_t.SIDEBAR_W], config_raw.layout[layout_size_t.SIDEBAR_H1] - expand_button_offset)) { + if (ui_window(ui_base_hwnds[tab_area_t.SIDEBAR1], ui_base_tabx, config_raw.layout[layout_size_t.SIDEBAR_H0], config_raw.layout[layout_size_t.SIDEBAR_W], config_raw.layout[layout_size_t.SIDEBAR_H1] - expand_button_offset)) { let tabs: tab_draw_t[] = ui_base_hwnd_tabs[tab_area_t.SIDEBAR1]; for (let i: i32 = 0; i < (mini ? 1 : tabs.length); ++i) { tabs[i].f(ui_base_htabs[tab_area_t.SIDEBAR1]); } } - zui_end_window(); + ui_end_window(); ui_base_ui.ops.theme.SCROLL_W = _SCROLL_W; // Collapse / expand button for mini sidebar if (config_raw.touch_ui) { let width: i32 = config_raw.layout[layout_size_t.SIDEBAR_W]; - let height: i32 = math_floor(zui_ELEMENT_H(ui_base_ui) + zui_ELEMENT_OFFSET(ui_base_ui)); - if (zui_window(zui_handle(__ID__), sys_width() - width, sys_height() - height, width, height + 1)) { + let height: i32 = math_floor(ui_ELEMENT_H(ui_base_ui) + ui_ELEMENT_OFFSET(ui_base_ui)); + if (ui_window(ui_handle(__ID__), sys_width() - width, sys_height() - height, width, height + 1)) { ui_base_ui._w = width; let _BUTTON_H: i32 = ui_base_ui.ops.theme.BUTTON_H; let _BUTTON_COL: i32 = ui_base_ui.ops.theme.BUTTON_COL; ui_base_ui.ops.theme.BUTTON_H = ui_base_ui.ops.theme.ELEMENT_H; ui_base_ui.ops.theme.BUTTON_COL = ui_base_ui.ops.theme.WINDOW_BG_COL; - if (zui_button(mini ? "<<" : ">>")) { + if (ui_button(mini ? "<<" : ">>")) { config_raw.layout[layout_size_t.SIDEBAR_W] = mini ? ui_base_default_sidebar_full_w : ui_base_default_sidebar_mini_w; - config_raw.layout[layout_size_t.SIDEBAR_W] = math_floor(config_raw.layout[layout_size_t.SIDEBAR_W] * zui_SCALE(ui_base_ui)); + config_raw.layout[layout_size_t.SIDEBAR_W] = math_floor(config_raw.layout[layout_size_t.SIDEBAR_W] * ui_SCALE(ui_base_ui)); } ui_base_ui.ops.theme.BUTTON_H = _BUTTON_H; ui_base_ui.ops.theme.BUTTON_COL = _BUTTON_COL; @@ -1430,15 +1430,15 @@ function ui_base_draw_sidebar() { // Expand button if (config_raw.layout[layout_size_t.SIDEBAR_W] == 0) { - let width: i32 = math_floor(g2_font_width(ui_base_ui.ops.font, ui_base_ui.font_size, "<<") + 25 * zui_SCALE(ui_base_ui)); - if (zui_window(ui_base_hminimized, sys_width() - width, 0, width, math_floor(zui_ELEMENT_H(ui_base_ui) + zui_ELEMENT_OFFSET(ui_base_ui) + 1))) { + let width: i32 = math_floor(g2_font_width(ui_base_ui.ops.font, ui_base_ui.font_size, "<<") + 25 * ui_SCALE(ui_base_ui)); + if (ui_window(ui_base_hminimized, sys_width() - width, 0, width, math_floor(ui_ELEMENT_H(ui_base_ui) + ui_ELEMENT_OFFSET(ui_base_ui) + 1))) { ui_base_ui._w = width; let _BUTTON_H: i32 = ui_base_ui.ops.theme.BUTTON_H; let _BUTTON_COL: i32 = ui_base_ui.ops.theme.BUTTON_COL; ui_base_ui.ops.theme.BUTTON_H = ui_base_ui.ops.theme.ELEMENT_H; ui_base_ui.ops.theme.BUTTON_COL = ui_base_ui.ops.theme.SEPARATOR_COL; - if (zui_button("<<")) { + if (ui_button("<<")) { config_raw.layout[layout_size_t.SIDEBAR_W] = context_raw.maximized_sidebar_width != 0 ? context_raw.maximized_sidebar_width : math_floor(ui_base_default_sidebar_w * config_raw.window_scale); } ui_base_ui.ops.theme.BUTTON_H = _BUTTON_H; @@ -1534,7 +1534,7 @@ function ui_base_render_cursor() { } let cursor_img: image_t = resource_get("cursor.k"); - let psize: i32 = math_floor(cursor_img.width * (context_raw.brush_radius * context_raw.brush_nodes_radius) * zui_SCALE(ui_base_ui)); + let psize: i32 = math_floor(cursor_img.width * (context_raw.brush_radius * context_raw.brush_nodes_radius) * ui_SCALE(ui_base_ui)); // Clone source cursor if (context_raw.tool == workspace_tool_t.CLONE && !keyboard_down("alt") && (mouse_down() || pen_down())) { @@ -1562,8 +1562,8 @@ function ui_base_render_cursor() { } if (!config_raw.brush_live) { - let psizex: i32 = math_floor(256 * zui_SCALE(ui_base_ui) * (context_raw.brush_radius * context_raw.brush_nodes_radius * context_raw.brush_scale_x)); - let psizey: i32 = math_floor(256 * zui_SCALE(ui_base_ui) * (context_raw.brush_radius * context_raw.brush_nodes_radius)); + let psizex: i32 = math_floor(256 * ui_SCALE(ui_base_ui) * (context_raw.brush_radius * context_raw.brush_nodes_radius * context_raw.brush_scale_x)); + let psizey: i32 = math_floor(256 * ui_SCALE(ui_base_ui) * (context_raw.brush_radius * context_raw.brush_nodes_radius)); context_raw.view_index = context_raw.view_index_last; let decalx: f32 = base_x() + context_raw.decal_x * base_w() - psizex / 2; @@ -1593,7 +1593,7 @@ function ui_base_render_cursor() { (decal_mask && !config_raw.brush_3d) || (decal_mask && context_in_2d_view())) { if (decal_mask) { - psize = math_floor(cursor_img.width * (context_raw.brush_decal_mask_radius * context_raw.brush_nodes_radius) * zui_SCALE(ui_base_ui)); + psize = math_floor(cursor_img.width * (context_raw.brush_decal_mask_radius * context_raw.brush_nodes_radius) * ui_SCALE(ui_base_ui)); } if (config_raw.brush_3d && context_in_2d_view()) { psize = math_floor(psize * ui_view2d_pan_scale); @@ -1624,7 +1624,7 @@ function ui_base_render_cursor() { function ui_base_show_material_nodes() { // Clear input state as ui receives input events even when not drawn - zui_end_input(); + ui_end_input(); ///if (is_paint || is_sculpt) ui_nodes_show = !ui_nodes_show || ui_nodes_canvas_type != canvas_type_t.MATERIAL; @@ -1640,7 +1640,7 @@ function ui_base_show_material_nodes() { ///if (is_paint || is_sculpt) function ui_base_show_brush_nodes() { // Clear input state as ui receives input events even when not drawn - zui_end_input(); + ui_end_input(); ui_nodes_show = !ui_nodes_show || ui_nodes_canvas_type != canvas_type_t.BRUSH; ui_nodes_canvas_type = canvas_type_t.BRUSH; base_resize(); @@ -1649,7 +1649,7 @@ function ui_base_show_brush_nodes() { function ui_base_show_2d_view(type: view_2d_type_t) { // Clear input state as ui receives input events even when not drawn - zui_end_input(); + ui_end_input(); if (ui_view2d_type != type) { ui_view2d_show = true; } @@ -1668,7 +1668,7 @@ function ui_base_toggle_browser() { } function ui_base_set_icon_scale() { - if (zui_SCALE(ui_base_ui) > 1) { + if (ui_SCALE(ui_base_ui) > 1) { let res: string[] = ["icons2x.k"]; resource_load(res); map_set(resource_bundled, "icons.k", resource_get("icons2x.k")); @@ -1679,7 +1679,7 @@ function ui_base_set_icon_scale() { } } -function ui_base_on_border_hover(handle: zui_handle_t, side: i32) { +function ui_base_on_border_hover(handle: ui_handle_t, side: i32) { if (!base_ui_enabled) return; ///if (is_paint || is_sculpt) @@ -1727,7 +1727,7 @@ function ui_base_on_border_hover(handle: zui_handle_t, side: i32) { krom_set_mouse_cursor(3) : // Horizontal krom_set_mouse_cursor(4); // Vertical - if (zui_get_current().input_started) { + if (ui_get_current().input_started) { ui_base_border_started = side; ui_base_border_handle = handle; base_is_resizing = true; @@ -1744,7 +1744,7 @@ function ui_base_on_deselect_text() { ///end } -function ui_base_on_tab_drop(to: zui_handle_t, to_position: i32, from: zui_handle_t, from_position: i32) { +function ui_base_on_tab_drop(to: ui_handle_t, to_position: i32, from: ui_handle_t, from_position: i32) { let i: i32 = -1; let j: i32 = -1; for (let k: i32 = 0; k < ui_base_htabs.length; ++k) { diff --git a/base/sources/ui_box.ts b/base/sources/ui_box.ts index 6c481f3c..4583f7d4 100644 --- a/base/sources/ui_box.ts +++ b/base/sources/ui_box.ts @@ -1,10 +1,10 @@ let ui_box_show: bool = false; let ui_box_draggable: bool = true; -let ui_box_hwnd: zui_handle_t = zui_handle_create(); +let ui_box_hwnd: ui_handle_t = ui_handle_create(); let ui_box_title: string = ""; let ui_box_text: string = ""; -let ui_box_commands: (ui: zui_t)=>void = null; +let ui_box_commands: (ui: ui_t)=>void = null; let ui_box_click_to_hide: bool = true; let ui_box_modalw: i32 = 400; let ui_box_modalh: i32 = 170; @@ -26,14 +26,14 @@ function ui_box_init() { function ui_box_render() { if (!ui_menu_show) { - let ui: zui_t = base_ui_box; + let ui: ui_t = base_ui_box; let in_use: bool = ui.combo_selected_handle != null; let is_escape: bool = keyboard_started("escape"); if (ui_box_draws > 2 && (ui.input_released || is_escape) && !in_use && !ui.is_typing) { let appw: i32 = sys_width(); let apph: i32 = sys_height(); - let mw: i32 = math_floor(ui_box_modalw * zui_SCALE(ui)); - let mh: i32 = math_floor(ui_box_modalh * zui_SCALE(ui)); + let mw: i32 = math_floor(ui_box_modalw * ui_SCALE(ui)); + let mh: i32 = math_floor(ui_box_modalh * ui_SCALE(ui)); let left: f32 = (appw / 2 - mw / 2) + ui_box_hwnd.drag_x; let right: f32 = (appw / 2 + mw / 2) + ui_box_hwnd.drag_x; let top: f32 = (apph / 2 - mh / 2) + ui_box_hwnd.drag_y; @@ -57,11 +57,11 @@ function ui_box_render() { g2_end(); - let ui: zui_t = base_ui_box; + let ui: ui_t = base_ui_box; let appw: i32 = sys_width(); let apph: i32 = sys_height(); - let mw: i32 = math_floor(ui_box_modalw * zui_SCALE(ui)); - let mh: i32 = math_floor(ui_box_modalh * zui_SCALE(ui)); + let mw: i32 = math_floor(ui_box_modalw * ui_SCALE(ui)); + let mh: i32 = math_floor(ui_box_modalh * ui_SCALE(ui)); if (mw > appw) { mw = appw; } @@ -72,58 +72,58 @@ function ui_box_render() { let top: i32 = math_floor(apph / 2 - mh / 2); if (ui_box_commands == null) { - zui_begin(ui); - if (zui_window(ui_box_hwnd, left, top, mw, mh, ui_box_draggable)) { + ui_begin(ui); + if (ui_window(ui_box_hwnd, left, top, mw, mh, ui_box_draggable)) { ui._y += 10; let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(zui_handle(__ID__), ui_box_title, tab_vertical)) { - let htext: zui_handle_t = zui_handle(__ID__); + if (ui_tab(ui_handle(__ID__), ui_box_title, tab_vertical)) { + let htext: ui_handle_t = ui_handle(__ID__); htext.text = ui_box_text; if (ui_box_copyable) { - zui_text_area(htext, zui_align_t.LEFT, false); + ui_text_area(htext, ui_align_t.LEFT, false); } else { - zui_text(ui_box_text); + ui_text(ui_box_text); } - _zui_end_element(); + _ui_end_element(); ///if (krom_windows || krom_linux || krom_macos) if (ui_box_copyable) { let row: f32[] = [1 / 3, 1 / 3, 1 / 3]; - zui_row(row); + ui_row(row); } else { let row: f32[] = [2 / 3, 1 / 3]; - zui_row(row); + ui_row(row); } ///else let row: f32[] = [2 / 3, 1 / 3]; - zui_row(row); + ui_row(row); ///end - _zui_end_element(); + _ui_end_element(); ///if (krom_windows || krom_linux || krom_macos) - if (ui_box_copyable && zui_button(tr("Copy"))) { + if (ui_box_copyable && ui_button(tr("Copy"))) { krom_copy_to_clipboard(ui_box_text); } ///end - if (zui_button(tr("OK"))) { + if (ui_button(tr("OK"))) { ui_box_hide(); } } ui_box_window_border(ui); } - zui_end(); + ui_end(); } else { - zui_begin(ui); - if (zui_window(ui_box_hwnd, left, top, mw, mh, ui_box_draggable)) { + ui_begin(ui); + if (ui_window(ui_box_hwnd, left, top, mw, mh, ui_box_draggable)) { ui._y += 10; ui_box_commands(ui); ui_box_window_border(ui); } - zui_end(); + ui_end(); } g2_begin(null); @@ -145,7 +145,7 @@ function ui_box_show_message(title: string, text: string, copyable: bool = false ///end } -function ui_box_show_custom(commands: (ui: zui_t)=>void = null, mw: i32 = 400, mh: i32 = 200, on_hide: ()=>void = null, draggable: bool = true) { +function ui_box_show_custom(commands: (ui: ui_t)=>void = null, mw: i32 = 400, mh: i32 = 200, on_hide: ()=>void = null, draggable: bool = true) { ui_box_init(); ui_box_modalw = mw; ui_box_modalh = mh; @@ -198,7 +198,7 @@ function ui_box_tween_tick() { } ///end -function ui_box_window_border(ui: zui_t) { +function ui_box_window_border(ui: ui_t) { if (ui.scissor) { ui.scissor = false; g2_disable_scissor(); diff --git a/base/sources/ui_files.ts b/base/sources/ui_files.ts index 63c35e32..229272cc 100644 --- a/base/sources/ui_files.ts +++ b/base/sources/ui_files.ts @@ -63,10 +63,10 @@ function ui_files_release_keys() { ///end } -let _ui_files_file_browser_handle: zui_handle_t; +let _ui_files_file_browser_handle: ui_handle_t; let _ui_files_file_browser_f: string; -function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bool = false, drag_files: bool = false, search: string = "", refresh: bool = false, context_menu: (s: string)=>void = null): string { +function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, folders_only: bool = false, drag_files: bool = false, search: string = "", refresh: bool = false, context_menu: (s: string)=>void = null): string { let icons: image_t = resource_get("icons.k"); let folder: rect_t = resource_tile50(icons, 2, 1); @@ -132,7 +132,7 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo ui_files_last_search = search; handle.changed = false; - let slotw: i32 = math_floor(70 * zui_SCALE(ui)); + let slotw: i32 = math_floor(70 * ui_SCALE(ui)); let num: i32 = math_floor(ui._w / slotw); ui._y += 4; // Don't cut off the border around selected materials @@ -142,16 +142,16 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo for (let i: i32 = 0; i < num * 2; ++i) { array_push(ar, 1 / num); } - zui_row(ar); + ui_row(ar); if (row > 0) { - ui._y += zui_ELEMENT_OFFSET(ui) * 14.0; + ui._y += ui_ELEMENT_OFFSET(ui) * 14.0; } 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); + _ui_end_element(slotw); + _ui_end_element(slotw); continue; } @@ -162,12 +162,12 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo let col: i32 = rect == file ? ui.ops.theme.LABEL_COL : ui.ops.theme.LABEL_COL - 0x00202020; if (ui_files_selected == i) col = ui.ops.theme.HIGHLIGHT_COL; - let off: f32 = ui._w / 2 - 25 * zui_SCALE(ui); + let off: f32 = ui._w / 2 - 25 * ui_SCALE(ui); ui._x += off; let uix: f32 = ui._x; let uiy: f32 = ui._y; - let state: zui_state_t = zui_state_t.IDLE; + let state: ui_state_t = ui_state_t.IDLE; let generic: bool = true; let icon: image_t = null; @@ -224,15 +224,15 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo if (icon != null) { let w: i32 = 50; if (i == ui_files_selected) { - zui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _zui_image(icon, 0xffffffff, w * zui_SCALE(ui)); + state = _ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); if (ui.is_hovered) { - _zui_tooltip_image(icon); - zui_tooltip(f); + _ui_tooltip_image(icon); + ui_tooltip(f); } generic = false; } @@ -282,15 +282,15 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo if (icon != null) { let w: i32 = 50; if (i == ui_files_selected) { - zui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _zui_image(icon, 0xffffffff, w * zui_SCALE(ui)); + state = _ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); if (ui.is_hovered) { - _zui_tooltip_image(icon); - zui_tooltip(f); + _ui_tooltip_image(icon); + ui_tooltip(f); } generic = false; } @@ -318,25 +318,25 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo } if (icon != null) { if (i == ui_files_selected) { - zui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); - zui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, -2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, w + 2, w + 4, 2, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _zui_image(icon, 0xffffffff, icon.height * zui_SCALE(ui)); + state = _ui_image(icon, 0xffffffff, icon.height * ui_SCALE(ui)); generic = false; } } if (generic) { - state = _zui_image(icons, col, 50 * zui_SCALE(ui), rect.x, rect.y, rect.w, rect.h); + state = _ui_image(icons, col, 50 * ui_SCALE(ui), rect.x, rect.y, rect.w, rect.h); } if (ui.is_hovered && ui.input_released_r && context_menu != null) { context_menu(handle.text + path_sep + f); } - if (state == zui_state_t.STARTED) { + if (state == ui_state_t.STARTED) { if (f != ".." && drag_files) { base_drag_off_x = -(mouse_x - uix - ui._window_x - 3); base_drag_off_y = -(mouse_y - uiy - ui._window_y + 1); @@ -389,16 +389,16 @@ function ui_files_file_browser(ui: zui_t, handle: zui_handle_t, folders_only: bo if (label1 != "") { ui.current_ratio--; } - zui_text(label0, zui_align_t.CENTER); + ui_text(label0, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(label0 + label1); + ui_tooltip(label0 + label1); } if (label1 != "") { // Second line ui._x = _x; ui._y += g2_font_height(ui.ops.font, ui.font_size); - zui_text(label1, zui_align_t.CENTER); + ui_text(label1, ui_align_t.CENTER); if (ui.is_hovered) { - zui_tooltip(label0 + label1); + ui_tooltip(label0 + label1); } ui._y -= g2_font_height(ui.ops.font, ui.font_size); } diff --git a/base/sources/ui_header.ts b/base/sources/ui_header.ts index 96ebb3a1..90ae0143 100644 --- a/base/sources/ui_header.ts +++ b/base/sources/ui_header.ts @@ -1,22 +1,22 @@ let ui_header_default_h: i32 = 28; let ui_header_h: i32 = ui_header_default_h; -let ui_header_handle: zui_handle_t = zui_handle_create(); -let ui_header_worktab: zui_handle_t = zui_handle_create(); +let ui_header_handle: ui_handle_t = ui_handle_create(); +let ui_header_worktab: ui_handle_t = ui_handle_create(); function ui_header_init() { - ui_header_handle.layout = zui_layout_t.HORIZONTAL; + ui_header_handle.layout = ui_layout_t.HORIZONTAL; } function ui_header_render_ui() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; if (config_raw.touch_ui) { ui_header_h = ui_header_default_h + 6; } else { ui_header_h = ui_header_default_h; } - ui_header_h = math_floor(ui_header_h * zui_SCALE(ui)); + ui_header_h = math_floor(ui_header_h * ui_SCALE(ui)); if (config_raw.layout[layout_size_t.HEADER] == 0) { return; @@ -29,7 +29,7 @@ function ui_header_render_ui() { let ww: i32 = sys_width() - ui_toolbar_w - config_raw.layout[layout_size_t.SIDEBAR_W] - nodesw; ///end - if (zui_window(ui_header_handle, app_x(), ui_header_h, ww, ui_header_h)) { + if (ui_window(ui_header_handle, app_x(), ui_header_h, ww, ui_header_h)) { ui._y += 2; ui_header_draw_tool_properties(ui); } @@ -37,35 +37,35 @@ function ui_header_render_ui() { ///if is_paint -let _ui_header_draw_tool_properties_h: zui_handle_t; +let _ui_header_draw_tool_properties_h: ui_handle_t; -function ui_header_draw_tool_properties(ui: zui_t) { +function ui_header_draw_tool_properties(ui: ui_t) { if (context_raw.tool == workspace_tool_t.COLORID) { - zui_text(tr("Picked Color")); + ui_text(tr("Picked Color")); if (context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); - _zui_image(rt._image, 0xffffffff, 64); + _ui_image(rt._image, 0xffffffff, 64); } ui.enabled = context_raw.colorid_picked; - if (zui_button(tr("Clear"))) { + if (ui_button(tr("Clear"))) { context_raw.colorid_picked = false; ui_toolbar_handle.redraws = 1; } ui.enabled = true; - zui_text(tr("Color ID Map")); + ui_text(tr("Color ID Map")); if (project_asset_names.length > 0) { - let cid: i32 = zui_combo(context_raw.colorid_handle, base_enum_texts("TEX_IMAGE"), tr("Color ID")); + let cid: i32 = ui_combo(context_raw.colorid_handle, base_enum_texts("TEX_IMAGE"), tr("Color ID")); if (context_raw.colorid_handle.changed) { context_raw.ddirty = 2; context_raw.colorid_picked = false; ui_toolbar_handle.redraws = 1; } - _zui_image(project_get_image(project_assets[cid])); + _ui_image(project_get_image(project_assets[cid])); if (ui.is_hovered) { - _zui_tooltip_image(project_get_image(project_assets[cid]), 256); + _ui_tooltip_image(project_get_image(project_assets[cid]), 256); } } - if (zui_button(tr("Import"))) { + if (ui_button(tr("Import"))) { ui_files_show(string_array_join(path_texture_formats, ","), false, true, function (path: string) { import_asset_run(path, -1.0, -1.0, true, false); @@ -84,7 +84,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { }); } ui.enabled = context_raw.colorid_picked; - if (zui_button(tr("To Mask"))) { + if (ui_button(tr("To Mask"))) { if (slot_layer_is_mask(context_raw.layer)) { context_set_layer(context_raw.layer.parent); } @@ -128,14 +128,14 @@ function ui_header_draw_tool_properties(ui: zui_t) { let height_picked: f32 = math_round(context_raw.picked_color.height * 100) / 100; let opacity_picked: f32 = math_round(context_raw.picked_color.opacity * 100) / 100; - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); let color: color_t = 0xffffffff; color = color_set_rb(color, base_r_picked * 255); color = color_set_gb(color, base_g_picked * 255); color = color_set_bb(color, base_b_picked * 255); h.color = color; - let state: zui_state_t = zui_text("", 0, h.color); - if (state == zui_state_t.STARTED) { + let state: ui_state_t = ui_text("", 0, h.color); + if (state == ui_state_t.STARTED) { let uix: i32 = ui._x; let uiy: i32 = ui._y; base_drag_off_x = -(mouse_x - uix - ui._window_x - 3); @@ -143,43 +143,43 @@ function ui_header_draw_tool_properties(ui: zui_t) { base_drag_swatch = project_clone_swatch(context_raw.picked_color); } if (ui.is_hovered) { - zui_tooltip(tr("Drag and drop picked color to swatches, materials, layers or to the node editor")); + ui_tooltip(tr("Drag and drop picked color to swatches, materials, layers or to the node editor")); } if (ui.is_hovered && ui.input_released) { _ui_header_draw_tool_properties_h = h; - ui_menu_draw(function (ui: zui_t) { - zui_fill(0, 0, ui._w / zui_SCALE(ui), ui.ops.theme.ELEMENT_H * 9, ui.ops.theme.SEPARATOR_COL); + ui_menu_draw(function (ui: ui_t) { + ui_fill(0, 0, ui._w / ui_SCALE(ui), ui.ops.theme.ELEMENT_H * 9, ui.ops.theme.SEPARATOR_COL); ui.changed = false; - zui_color_wheel(_ui_header_draw_tool_properties_h, false, -1, 10 * ui.ops.theme.ELEMENT_H * zui_SCALE(ui), false); + ui_color_wheel(_ui_header_draw_tool_properties_h, false, -1, 10 * ui.ops.theme.ELEMENT_H * ui_SCALE(ui), false); if (ui.changed) { ui_menu_keep_open = true; } }, 10); } - if (zui_button(tr("Add Swatch"))) { + if (ui_button(tr("Add Swatch"))) { let new_swatch: swatch_color_t = project_clone_swatch(context_raw.picked_color); context_set_swatch(new_swatch); array_push(project_raw.swatches, new_swatch); ui_base_hwnds[2].redraws = 1; } if (ui.is_hovered) { - zui_tooltip(tr("Add picked color to swatches")); + ui_tooltip(tr("Add picked color to swatches")); } - zui_text(tr("Base") + " (" + base_r_picked + "," + base_g_picked + "," + base_b_picked + ")"); - zui_text(tr("Normal") + " (" + normal_r_picked + "," + normal_g_picked + "," + normal_b_picked + ")"); - zui_text(tr("Occlusion") + " (" + occlusion_picked + ")"); - zui_text(tr("Roughness") + " (" + roughness_picked + ")"); - zui_text(tr("Metallic") + " (" + metallic_picked + ")"); - zui_text(tr("Height") + " (" + height_picked + ")"); - zui_text(tr("Opacity") + " (" + opacity_picked + ")"); - let h_select_mat: zui_handle_t = zui_handle(__ID__); + ui_text(tr("Base") + " (" + base_r_picked + "," + base_g_picked + "," + base_b_picked + ")"); + ui_text(tr("Normal") + " (" + normal_r_picked + "," + normal_g_picked + "," + normal_b_picked + ")"); + ui_text(tr("Occlusion") + " (" + occlusion_picked + ")"); + ui_text(tr("Roughness") + " (" + roughness_picked + ")"); + ui_text(tr("Metallic") + " (" + metallic_picked + ")"); + ui_text(tr("Height") + " (" + height_picked + ")"); + ui_text(tr("Opacity") + " (" + opacity_picked + ")"); + let h_select_mat: ui_handle_t = ui_handle(__ID__); if (h_select_mat.init) { h_select_mat.selected = context_raw.picker_select_material; } - context_raw.picker_select_material = zui_check(h_select_mat, tr("Select Material")); + context_raw.picker_select_material = ui_check(h_select_mat, tr("Select Material")); let picker_mask_combo: string[] = [tr("None"), tr("Material")]; - zui_combo(context_raw.picker_mask_handle, picker_mask_combo, tr("Mask"), true); + ui_combo(context_raw.picker_mask_handle, picker_mask_combo, tr("Mask"), true); if (context_raw.picker_mask_handle.changed) { make_material_parse_paint_material(); } @@ -190,7 +190,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { ///if (krom_direct3d12 || krom_vulkan || krom_metal) let baking: bool = context_raw.pdirty > 0; let rt_bake: bool = context_raw.bake_type == bake_type_t.AO || context_raw.bake_type == bake_type_t.LIGHTMAP || context_raw.bake_type == bake_type_t.BENT_NORMAL || context_raw.bake_type == bake_type_t.THICKNESS; - if (baking && zui_button(tr("Stop"))) { + if (baking && ui_button(tr("Stop"))) { context_raw.pdirty = 0; context_raw.rdirty = 2; } @@ -199,7 +199,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { let rt_bake: bool = false; ///end - if (!baking && zui_button(tr("Bake"))) { + if (!baking && ui_button(tr("Bake"))) { context_raw.pdirty = rt_bake ? context_raw.bake_samples : 1; context_raw.rdirty = 3; app_notify_on_next_frame(function () { @@ -212,7 +212,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { ///end } - let bake_handle: zui_handle_t = zui_handle(__ID__); + let bake_handle: ui_handle_t = ui_handle(__ID__); if (bake_handle.init) { bake_handle.position = context_raw.bake_type; } @@ -240,7 +240,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { } ///end - context_raw.bake_type = zui_combo(bake_handle, bakes, tr("Bake")); + context_raw.bake_type = ui_combo(bake_handle, bakes, tr("Bake")); ///if (krom_direct3d12 || krom_vulkan || krom_metal) if (!krom_raytrace_supported()) { @@ -250,46 +250,46 @@ function ui_header_draw_tool_properties(ui: zui_t) { ///if (krom_direct3d12 || krom_vulkan || krom_metal) if (rt_bake) { - let samples_handle: zui_handle_t = zui_handle(__ID__); + let samples_handle: ui_handle_t = ui_handle(__ID__); if (samples_handle.init) { samples_handle.value = context_raw.bake_samples; } - context_raw.bake_samples = math_floor(zui_slider(samples_handle, tr("Samples"), 1, 512, true, 1)); + context_raw.bake_samples = math_floor(ui_slider(samples_handle, tr("Samples"), 1, 512, true, 1)); } ///end if (context_raw.bake_type == bake_type_t.NORMAL_OBJECT || context_raw.bake_type == bake_type_t.POSITION || context_raw.bake_type == bake_type_t.BENT_NORMAL) { - let bake_up_axis_handle: zui_handle_t = zui_handle(__ID__); + let bake_up_axis_handle: ui_handle_t = ui_handle(__ID__); if (bake_up_axis_handle.init) { bake_up_axis_handle.position = context_raw.bake_up_axis; } let bake_up_axis_combo: string[] = [tr("Z"), tr("Y")]; - context_raw.bake_up_axis = zui_combo(bake_up_axis_handle, bake_up_axis_combo, tr("Up Axis"), true); + context_raw.bake_up_axis = ui_combo(bake_up_axis_handle, bake_up_axis_combo, tr("Up Axis"), true); } if (context_raw.bake_type == bake_type_t.AO || context_raw.bake_type == bake_type_t.CURVATURE) { - let bake_axis_handle: zui_handle_t = zui_handle(__ID__); + let bake_axis_handle: ui_handle_t = ui_handle(__ID__); if (bake_axis_handle.init) { bake_axis_handle.position = context_raw.bake_axis; } let bake_axis_combo: string[] = [tr("XYZ"), tr("X"), tr("Y"), tr("Z"), tr("-X"), tr("-Y"), tr("-Z")]; - context_raw.bake_axis = zui_combo(bake_axis_handle, bake_axis_combo, tr("Axis"), true); + context_raw.bake_axis = ui_combo(bake_axis_handle, bake_axis_combo, tr("Axis"), true); } if (context_raw.bake_type == bake_type_t.AO) { - let strength_handle: zui_handle_t = zui_handle(__ID__); + let strength_handle: ui_handle_t = ui_handle(__ID__); if (strength_handle.init) { strength_handle.value = context_raw.bake_ao_strength; } - context_raw.bake_ao_strength = zui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); - let radius_handle: zui_handle_t = zui_handle(__ID__); + context_raw.bake_ao_strength = ui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); + let radius_handle: ui_handle_t = ui_handle(__ID__); if (radius_handle.init) { radius_handle.value = context_raw.bake_ao_radius; } - context_raw.bake_ao_radius = zui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); - let offset_handle: zui_handle_t = zui_handle(__ID__); + context_raw.bake_ao_radius = ui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); + let offset_handle: ui_handle_t = ui_handle(__ID__); if (offset_handle.init) { offset_handle.value = context_raw.bake_ao_offset; } - context_raw.bake_ao_offset = zui_slider(offset_handle, tr("Offset"), 0.0, 2.0, true); + context_raw.bake_ao_offset = ui_slider(offset_handle, tr("Offset"), 0.0, 2.0, true); } ///if (krom_direct3d12 || krom_vulkan || krom_metal) if (rt_bake) { @@ -297,36 +297,36 @@ function ui_header_draw_tool_properties(ui: zui_t) { if (progress > 1.0) progress = 1.0; // Progress bar g2_set_color(ui.ops.theme.SEPARATOR_COL); - zui_draw_rect(true, ui._x + 1, ui._y, ui._w - 2, zui_ELEMENT_H(ui)); + ui_draw_rect(true, ui._x + 1, ui._y, ui._w - 2, ui_ELEMENT_H(ui)); g2_set_color(ui.ops.theme.HIGHLIGHT_COL); - zui_draw_rect(true, ui._x + 1, ui._y, (ui._w - 2) * progress, zui_ELEMENT_H(ui)); + ui_draw_rect(true, ui._x + 1, ui._y, (ui._w - 2) * progress, ui_ELEMENT_H(ui)); g2_set_color(0xffffffff); - zui_text(tr("Samples") + ": " + render_path_raytrace_bake_current_sample); - zui_text(tr("Rays/pixel") + ": " + render_path_raytrace_bake_rays_pix); - zui_text(tr("Rays/second") + ": " + render_path_raytrace_bake_rays_sec); + ui_text(tr("Samples") + ": " + render_path_raytrace_bake_current_sample); + ui_text(tr("Rays/pixel") + ": " + render_path_raytrace_bake_rays_pix); + ui_text(tr("Rays/second") + ": " + render_path_raytrace_bake_rays_sec); } ///end if (context_raw.bake_type == bake_type_t.CURVATURE) { - let strength_handle: zui_handle_t = zui_handle(__ID__); + let strength_handle: ui_handle_t = ui_handle(__ID__); if (strength_handle.init) { strength_handle.value = context_raw.bake_curv_strength; } - context_raw.bake_curv_strength = zui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); - let radius_handle: zui_handle_t = zui_handle(__ID__); + context_raw.bake_curv_strength = ui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); + let radius_handle: ui_handle_t = ui_handle(__ID__); if (radius_handle.init) { radius_handle.value = context_raw.bake_curv_radius; } - context_raw.bake_curv_radius = zui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); - let offset_handle: zui_handle_t = zui_handle(__ID__); + context_raw.bake_curv_radius = ui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); + let offset_handle: ui_handle_t = ui_handle(__ID__); if (offset_handle.init) { offset_handle.value = context_raw.bake_curv_offset; } - context_raw.bake_curv_offset = zui_slider(offset_handle, tr("Offset"), -2.0, 2.0, true); - let smooth_handle: zui_handle_t = zui_handle(__ID__); + context_raw.bake_curv_offset = ui_slider(offset_handle, tr("Offset"), -2.0, 2.0, true); + let smooth_handle: ui_handle_t = ui_handle(__ID__); if (smooth_handle.init) { smooth_handle.value = context_raw.bake_curv_smooth; } - context_raw.bake_curv_smooth = math_floor(zui_slider(smooth_handle, tr("Smooth"), 0, 5, false, 1)); + context_raw.bake_curv_smooth = math_floor(ui_slider(smooth_handle, tr("Smooth"), 0, 5, false, 1)); } if (context_raw.bake_type == bake_type_t.NORMAL || context_raw.bake_type == bake_type_t.HEIGHT || context_raw.bake_type == bake_type_t.DERIVATIVE) { let ar: string[] = []; @@ -334,11 +334,11 @@ function ui_header_draw_tool_properties(ui: zui_t) { let p: mesh_object_t = project_paint_objects[i]; array_push(ar, p.base.name); } - let poly_handle: zui_handle_t = zui_handle(__ID__); + let poly_handle: ui_handle_t = ui_handle(__ID__); if (poly_handle.init) { poly_handle.position = context_raw.bake_high_poly; } - context_raw.bake_high_poly = zui_combo(poly_handle, ar, tr("High Poly")); + context_raw.bake_high_poly = ui_combo(poly_handle, ar, tr("High Poly")); } if (ui.changed) { make_material_parse_paint_material(); @@ -358,40 +358,40 @@ function ui_header_draw_tool_properties(ui: zui_t) { let decal_mask: bool = decal && operator_shortcut(map_get(config_keymap, "decal_mask"), shortcut_type_t.DOWN); if (context_raw.tool != workspace_tool_t.FILL) { if (decal_mask) { - context_raw.brush_decal_mask_radius = zui_slider(context_raw.brush_decal_mask_radius_handle, tr("Radius"), 0.01, 2.0, true); + context_raw.brush_decal_mask_radius = ui_slider(context_raw.brush_decal_mask_radius_handle, tr("Radius"), 0.01, 2.0, true); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_radius", map_get(config_keymap, "brush_radius")); map_set(vars, "brush_radius_decrease", map_get(config_keymap, "brush_radius_decrease")); map_set(vars, "brush_radius_increase", map_get(config_keymap, "brush_radius_increase")); - zui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); + ui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); } } else { - context_raw.brush_radius = zui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); + context_raw.brush_radius = ui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_radius", map_get(config_keymap, "brush_radius")); map_set(vars, "brush_radius_decrease", map_get(config_keymap, "brush_radius_decrease")); map_set(vars, "brush_radius_increase", map_get(config_keymap, "brush_radius_increase")); - zui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); + ui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); } } } if (context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT) { - context_raw.brush_scale_x = zui_slider(context_raw.brush_scale_x_handle, tr("Scale X"), 0.01, 2.0, true); + context_raw.brush_scale_x = ui_slider(context_raw.brush_scale_x_handle, tr("Scale X"), 0.01, 2.0, true); } if (context_raw.tool == workspace_tool_t.BRUSH || context_raw.tool == workspace_tool_t.FILL || context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT) { - let brush_scale_handle: zui_handle_t = zui_handle(__ID__); + let brush_scale_handle: ui_handle_t = ui_handle(__ID__); if (brush_scale_handle.init) { brush_scale_handle.value = context_raw.brush_scale; } - context_raw.brush_scale = zui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); + context_raw.brush_scale = ui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); if (brush_scale_handle.changed) { if (context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT) { let current: image_t = _g2_current; @@ -401,11 +401,11 @@ function ui_header_draw_tool_properties(ui: zui_t) { } } - context_raw.brush_angle = zui_slider(context_raw.brush_angle_handle, tr("Angle"), 0.0, 360.0, true, 1); + context_raw.brush_angle = ui_slider(context_raw.brush_angle_handle, tr("Angle"), 0.0, 360.0, true, 1); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_angle", map_get(config_keymap, "brush_angle")); - zui_tooltip(tr("Hold {brush_angle} and move mouse to the left to decrease the angle\nHold {brush_angle} and move mouse to the right to increase the angle", vars)); + ui_tooltip(tr("Hold {brush_angle} and move mouse to the left to decrease the angle\nHold {brush_angle} and move mouse to the right to increase the angle", vars)); } if (context_raw.brush_angle_handle.changed) { @@ -413,23 +413,23 @@ function ui_header_draw_tool_properties(ui: zui_t) { } } - context_raw.brush_opacity = zui_slider(context_raw.brush_opacity_handle, tr("Opacity"), 0.0, 1.0, true); + context_raw.brush_opacity = ui_slider(context_raw.brush_opacity_handle, tr("Opacity"), 0.0, 1.0, true); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_opacity", map_get(config_keymap, "brush_opacity")); - zui_tooltip(tr("Hold {brush_opacity} and move mouse to the left to decrease the opacity\nHold {brush_opacity} and move mouse to the right to increase the opacity", vars)); + ui_tooltip(tr("Hold {brush_opacity} and move mouse to the left to decrease the opacity\nHold {brush_opacity} and move mouse to the right to increase the opacity", vars)); } if (context_raw.tool == workspace_tool_t.BRUSH || context_raw.tool == workspace_tool_t.ERASER || context_raw.tool == workspace_tool_t.CLONE || decal_mask) { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.value = context_raw.brush_hardness; } - context_raw.brush_hardness = zui_slider(h, tr("Hardness"), 0.0, 1.0, true); + context_raw.brush_hardness = ui_slider(h, tr("Hardness"), 0.0, 1.0, true); } if (context_raw.tool != workspace_tool_t.ERASER) { - let brush_blending_handle: zui_handle_t = zui_handle(__ID__); + let brush_blending_handle: ui_handle_t = ui_handle(__ID__); if (brush_blending_handle.init) { brush_blending_handle.value = context_raw.brush_blending; } @@ -453,29 +453,29 @@ function ui_header_draw_tool_properties(ui: zui_t) { tr("Color"), tr("Value"), ]; - context_raw.brush_blending = zui_combo(brush_blending_handle, brush_blending_combo, tr("Blending")); + context_raw.brush_blending = ui_combo(brush_blending_handle, brush_blending_combo, tr("Blending")); if (brush_blending_handle.changed) { make_material_parse_paint_material(); } } if (context_raw.tool == workspace_tool_t.BRUSH || context_raw.tool == workspace_tool_t.FILL) { - let paint_handle: zui_handle_t = zui_handle(__ID__); + let paint_handle: ui_handle_t = ui_handle(__ID__); let texcoord_combo: string[] = [tr("UV Map"), tr("Triplanar"), tr("Project")]; - context_raw.brush_paint = zui_combo(paint_handle, texcoord_combo, tr("TexCoord")); + context_raw.brush_paint = ui_combo(paint_handle, texcoord_combo, tr("TexCoord")); if (paint_handle.changed) { make_material_parse_paint_material(); } } if (context_raw.tool == workspace_tool_t.TEXT) { - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); h.text = context_raw.text_tool_text; let w: i32 = ui._w; if (ui.text_selected_handle == h || ui.submit_text_handle == h) { ui._w *= 3; } - context_raw.text_tool_text = zui_text_input(h, "", zui_align_t.LEFT, true, true); + context_raw.text_tool_text = ui_text_input(h, "", ui_align_t.LEFT, true, true); ui._w = w; if (h.changed) { @@ -489,7 +489,7 @@ function ui_header_draw_tool_properties(ui: zui_t) { if (context_raw.tool == workspace_tool_t.FILL) { let fill_mode_combo: string[] = [tr("Object"), tr("Face"), tr("Angle"), tr("UV Island")]; - zui_combo(context_raw.fill_type_handle, fill_mode_combo, tr("Fill Mode")); + ui_combo(context_raw.fill_type_handle, fill_mode_combo, tr("Fill Mode")); if (context_raw.fill_type_handle.changed) { if (context_raw.fill_type_handle.position == fill_type_t.FACE) { let current: image_t = _g2_current; @@ -505,31 +505,31 @@ function ui_header_draw_tool_properties(ui: zui_t) { } else { let _w: i32 = ui._w; - let sc: f32 = zui_SCALE(ui); + let sc: f32 = ui_SCALE(ui); let touch_header: bool = (config_raw.touch_ui && config_raw.layout[layout_size_t.HEADER] == 1); if (touch_header) { ui._x -= 4 * sc; } ui._w = math_floor((touch_header ? 54 : 60) * sc); - let xray_handle: zui_handle_t = zui_handle(__ID__); + let xray_handle: ui_handle_t = ui_handle(__ID__); if (xray_handle.init) { xray_handle.selected = context_raw.xray; } - context_raw.xray = zui_check(xray_handle, tr("X-Ray")); + context_raw.xray = ui_check(xray_handle, tr("X-Ray")); if (xray_handle.changed) { make_material_parse_paint_material(); } - let sym_x_handle: zui_handle_t = zui_handle(__ID__); + let sym_x_handle: ui_handle_t = ui_handle(__ID__); if (sym_x_handle.init) { sym_x_handle.selected = false; } - let sym_y_handle: zui_handle_t = zui_handle(__ID__); + let sym_y_handle: ui_handle_t = ui_handle(__ID__); if (sym_y_handle.init) { sym_y_handle.selected = false; } - let sym_z_handle: zui_handle_t = zui_handle(__ID__); + let sym_z_handle: ui_handle_t = ui_handle(__ID__); if (sym_z_handle.init) { sym_z_handle.selected = false; } @@ -537,34 +537,34 @@ function ui_header_draw_tool_properties(ui: zui_t) { if (config_raw.layout[layout_size_t.HEADER] == 1) { if (config_raw.touch_ui) { ui._w = math_floor(19 * sc); - context_raw.sym_x = zui_check(sym_x_handle, ""); + context_raw.sym_x = ui_check(sym_x_handle, ""); ui._x -= 4 * sc; - context_raw.sym_y = zui_check(sym_y_handle, ""); + context_raw.sym_y = ui_check(sym_y_handle, ""); ui._x -= 4 * sc; - context_raw.sym_z = zui_check(sym_z_handle, ""); + context_raw.sym_z = ui_check(sym_z_handle, ""); ui._x -= 4 * sc; ui._w = math_floor(40 * sc); let x: string = tr("X"); let y: string = tr("Y"); let z: string = tr("Z"); - zui_text(x + y + z); + ui_text(x + y + z); } else { ui._w = math_floor(56 * sc); - zui_text(tr("Symmetry")); + ui_text(tr("Symmetry")); ui._w = math_floor(25 * sc); - context_raw.sym_x = zui_check(sym_x_handle, tr("X")); - context_raw.sym_y = zui_check(sym_y_handle, tr("Y")); - context_raw.sym_z = zui_check(sym_z_handle, tr("Z")); + context_raw.sym_x = ui_check(sym_x_handle, tr("X")); + context_raw.sym_y = ui_check(sym_y_handle, tr("Y")); + context_raw.sym_z = ui_check(sym_z_handle, tr("Z")); } ui._w = _w; } else { // Popup ui._w = _w; - context_raw.sym_x = zui_check(sym_x_handle, tr("Symmetry") + " " + tr("X")); - context_raw.sym_y = zui_check(sym_y_handle, tr("Symmetry") + " " + tr("Y")); - context_raw.sym_z = zui_check(sym_z_handle, tr("Symmetry") + " " + tr("Z")); + context_raw.sym_x = ui_check(sym_x_handle, tr("Symmetry") + " " + tr("X")); + context_raw.sym_y = ui_check(sym_y_handle, tr("Symmetry") + " " + tr("Y")); + context_raw.sym_z = ui_check(sym_z_handle, tr("Symmetry") + " " + tr("Z")); } if (sym_x_handle.changed || sym_y_handle.changed || sym_z_handle.changed) { @@ -574,12 +574,12 @@ function ui_header_draw_tool_properties(ui: zui_t) { ///if arm_physics if (context_raw.tool == workspace_tool_t.PARTICLE) { - ui._x += 10 * zui_SCALE(ui); - let phys_handle: zui_handle_t = zui_handle(__ID__); + ui._x += 10 * ui_SCALE(ui); + let phys_handle: ui_handle_t = ui_handle(__ID__); if (phys_handle.init) { phys_handle.selected = false; } - context_raw.particle_physics = zui_check(phys_handle, tr("Physics")); + context_raw.particle_physics = ui_check(phys_handle, tr("Physics")); if (phys_handle.changed) { util_particle_init_physics(); make_material_parse_paint_material(); @@ -592,22 +592,22 @@ function ui_header_draw_tool_properties(ui: zui_t) { ///end ///if is_sculpt -function ui_header_draw_tool_properties(ui: zui_t) { +function ui_header_draw_tool_properties(ui: ui_t) { if (context_raw.tool == workspace_tool_t.BRUSH) { - context_raw.brush_radius = zui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); + context_raw.brush_radius = ui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_radius", map_get(config_keymap, "brush_radius")); map_set(vars, "brush_radius_decrease", map_get(config_keymap, "brush_radius_decrease")); map_set(vars, "brush_radius_increase", map_get(config_keymap, "brush_radius_increase")); - zui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); + ui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); } } } ///end ///if is_lab -function ui_header_draw_tool_properties(ui: zui_t) { +function ui_header_draw_tool_properties(ui: ui_t) { if (context_raw.tool == workspace_tool_t.PICKER) { } @@ -616,17 +616,17 @@ function ui_header_draw_tool_properties(ui: zui_t) { context_raw.tool == workspace_tool_t.BLUR || context_raw.tool == workspace_tool_t.SMUDGE) { - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let inpaint: bool = nodes.nodes_selected_id.length > 0 && zui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode"; if (inpaint) { - context_raw.brush_radius = zui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); + context_raw.brush_radius = ui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "brush_radius", map_get(config_keymap, "brush_radius")); map_set(vars, "brush_radius_decrease", map_get(config_keymap, "brush_radius_decrease")); map_set(vars, "brush_radius_increase", map_get(config_keymap, "brush_radius_increase")); - zui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); + ui_tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", vars)); } } } diff --git a/base/sources/ui_menu.ts b/base/sources/ui_menu.ts index f44bca3a..35e451d9 100644 --- a/base/sources/ui_menu.ts +++ b/base/sources/ui_menu.ts @@ -7,7 +7,7 @@ let ui_menu_x: i32 = 0; let ui_menu_y: i32 = 0; let ui_menu_elements: i32 = 0; let ui_menu_keep_open: bool = false; -let ui_menu_commands: (ui: zui_t)=>void = null; +let ui_menu_commands: (ui: ui_t)=>void = null; let ui_menu_show_first: bool = true; let ui_menu_hide_flag: bool = false; @@ -19,8 +19,8 @@ type update_info_t = { }; function ui_menu_render() { - let ui: zui_t = base_ui_menu; - let menu_w: i32 = ui_menu_commands != null ? math_floor(base_default_element_w * zui_SCALE(base_ui_menu) * 2.3) : math_floor(zui_ELEMENT_W(ui) * 2.3); + let ui: ui_t = base_ui_menu; + let menu_w: i32 = ui_menu_commands != null ? math_floor(base_default_element_w * ui_SCALE(base_ui_menu) * 2.3) : math_floor(ui_ELEMENT_W(ui) * 2.3); let _BUTTON_COL: i32 = ui.ops.theme.BUTTON_COL; ui.ops.theme.BUTTON_COL = ui.ops.theme.SEPARATOR_COL; let _ELEMENT_OFFSET: i32 = ui.ops.theme.ELEMENT_OFFSET; @@ -28,13 +28,13 @@ function ui_menu_render() { let _ELEMENT_H: i32 = ui.ops.theme.ELEMENT_H; ui.ops.theme.ELEMENT_H = config_raw.touch_ui ? (28 + 2) : 28; - zui_begin_region(ui, ui_menu_x, ui_menu_y, menu_w); + ui_begin_region(ui, ui_menu_x, ui_menu_y, menu_w); if (ui_menu_commands != null) { g2_set_color(ui.ops.theme.ACCENT_SELECT_COL); - zui_draw_rect(true, ui._x + -1, ui._y + -1, ui._w + 2, zui_ELEMENT_H(ui) * ui_menu_elements + 2); + ui_draw_rect(true, ui._x + -1, ui._y + -1, ui._w + 2, ui_ELEMENT_H(ui) * ui_menu_elements + 2); g2_set_color(ui.ops.theme.SEPARATOR_COL); - zui_draw_rect(true, ui._x + 0, ui._y + 0, ui._w, zui_ELEMENT_H(ui) * ui_menu_elements); + ui_draw_rect(true, ui._x + 0, ui._y + 0, ui._w, ui_ELEMENT_H(ui) * ui_menu_elements); g2_set_color(0xffffffff); ui_menu_commands(ui); @@ -170,16 +170,16 @@ function ui_menu_render() { ui_menu_fill(ui); let p: world_data_t = scene_world; - let env_handle: zui_handle_t = zui_handle(__ID__); + let env_handle: ui_handle_t = ui_handle(__ID__); env_handle.value = p.strength; ui_menu_align(ui); - p.strength = zui_slider(env_handle, tr("Environment"), 0.0, 8.0, true); + p.strength = ui_slider(env_handle, tr("Environment"), 0.0, 8.0, true); if (env_handle.changed) { context_raw.ddirty = 2; } ui_menu_fill(ui); - let enva_handle: zui_handle_t = zui_handle(__ID__); + let enva_handle: ui_handle_t = ui_handle(__ID__); enva_handle.value = context_raw.envmap_angle / math_pi() * 180.0; if (enva_handle.value < 0) { enva_handle.value += (math_floor(-enva_handle.value / 360) + 1) * 360; @@ -188,11 +188,11 @@ function ui_menu_render() { enva_handle.value -= math_floor(enva_handle.value / 360) * 360; } ui_menu_align(ui); - context_raw.envmap_angle = zui_slider(enva_handle, tr("Environment Angle"), 0.0, 360.0, true, 1) / 180.0 * math_pi(); + context_raw.envmap_angle = ui_slider(enva_handle, tr("Environment Angle"), 0.0, 360.0, true, 1) / 180.0 * math_pi(); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "shortcut", map_get(config_keymap, "rotate_envmap")); - zui_tooltip(tr("{shortcut} and move mouse", vars)); + ui_tooltip(tr("{shortcut} and move mouse", vars)); } if (enva_handle.changed) { context_raw.ddirty = 2; @@ -202,26 +202,26 @@ function ui_menu_render() { let light: light_object_t = scene_lights[0]; ui_menu_fill(ui); - let lhandle: zui_handle_t = zui_handle(__ID__); + let lhandle: ui_handle_t = ui_handle(__ID__); let scale: f32 = 1333; lhandle.value = light.data.strength / scale; lhandle.value = math_floor(lhandle.value * 100) / 100; ui_menu_align(ui); - light.data.strength = zui_slider(lhandle, tr("Light"), 0.0, 4.0, true) * scale; + light.data.strength = ui_slider(lhandle, tr("Light"), 0.0, 4.0, true) * scale; if (lhandle.changed) { context_raw.ddirty = 2; } ui_menu_fill(ui); light = scene_lights[0]; - let lahandle: zui_handle_t = zui_handle(__ID__); + let lahandle: ui_handle_t = ui_handle(__ID__); lahandle.value = context_raw.light_angle / math_pi() * 180; ui_menu_align(ui); - let new_angle: f32 = zui_slider(lahandle, tr("Light Angle"), 0.0, 360.0, true, 1) / 180 * math_pi(); + let new_angle: f32 = ui_slider(lahandle, tr("Light Angle"), 0.0, 360.0, true, 1) / 180 * math_pi(); if (ui.is_hovered) { let vars: map_t = map_create(); map_set(vars, "shortcut", map_get(config_keymap, "rotate_light")); - zui_tooltip(tr("{shortcut} and move mouse", vars)); + ui_tooltip(tr("{shortcut} and move mouse", vars)); } let ldiff: f32 = new_angle - context_raw.light_angle; if (math_abs(ldiff) > 0.005) { @@ -239,10 +239,10 @@ function ui_menu_render() { } ui_menu_fill(ui); - let sxhandle: zui_handle_t = zui_handle(__ID__); + let sxhandle: ui_handle_t = ui_handle(__ID__); sxhandle.value = light.data.size; ui_menu_align(ui); - light.data.size = zui_slider(sxhandle, tr("Light Size"), 0.0, 4.0, true); + light.data.size = ui_slider(sxhandle, tr("Light Size"), 0.0, 4.0, true); if (sxhandle.changed) { context_raw.ddirty = 2; } @@ -250,11 +250,11 @@ function ui_menu_render() { ///if (is_paint || is_sculpt) ui_menu_fill(ui); - let split_view_handle: zui_handle_t = zui_handle(__ID__); + let split_view_handle: ui_handle_t = ui_handle(__ID__); if (split_view_handle.init) { split_view_handle.selected = context_raw.split_view; } - context_raw.split_view = zui_check(split_view_handle, " " + tr("Split View")); + context_raw.split_view = ui_check(split_view_handle, " " + tr("Split View")); if (split_view_handle.changed) { base_resize(); } @@ -262,12 +262,12 @@ function ui_menu_render() { ///if is_lab ui_menu_fill(ui); - let brush_scale_handle: zui_handle_t = zui_handle(__ID__); + let brush_scale_handle: ui_handle_t = ui_handle(__ID__); if (brush_scale_handle.init) { brush_scale_handle.value = context_raw.brush_scale; } ui_menu_align(ui); - context_raw.brush_scale = zui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); + context_raw.brush_scale = ui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); if (brush_scale_handle.changed) { make_material_parse_mesh_material(); ///if (krom_direct3d12 || krom_vulkan || krom_metal) @@ -278,21 +278,21 @@ function ui_menu_render() { ///end ui_menu_fill(ui); - let cull_handle: zui_handle_t = zui_handle(__ID__); + let cull_handle: ui_handle_t = ui_handle(__ID__); if (cull_handle.init) { cull_handle.selected = context_raw.cull_backfaces; } - context_raw.cull_backfaces = zui_check(cull_handle, " " + tr("Cull Backfaces")); + context_raw.cull_backfaces = ui_check(cull_handle, " " + tr("Cull Backfaces")); if (cull_handle.changed) { make_material_parse_mesh_material(); } ui_menu_fill(ui); - let filter_handle: zui_handle_t = zui_handle(__ID__); + let filter_handle: ui_handle_t = ui_handle(__ID__); if (filter_handle.init) { filter_handle.selected = context_raw.texture_filter; } - context_raw.texture_filter = zui_check(filter_handle, " " + tr("Filter Textures")); + context_raw.texture_filter = ui_check(filter_handle, " " + tr("Filter Textures")); if (filter_handle.changed) { make_material_parse_paint_material(); make_material_parse_mesh_material(); @@ -300,7 +300,7 @@ function ui_menu_render() { ///if (is_paint || is_sculpt) ui_menu_fill(ui); - context_raw.draw_wireframe = zui_check(context_raw.wireframe_handle, " " + tr("Wireframe")); + context_raw.draw_wireframe = ui_check(context_raw.wireframe_handle, " " + tr("Wireframe")); if (context_raw.wireframe_handle.changed) { let current: image_t = _g2_current; g2_end(); @@ -312,31 +312,31 @@ function ui_menu_render() { ///if is_paint ui_menu_fill(ui); - context_raw.draw_texels = zui_check(context_raw.texels_handle, " " + tr("Texels")); + context_raw.draw_texels = ui_check(context_raw.texels_handle, " " + tr("Texels")); if (context_raw.texels_handle.changed) { make_material_parse_mesh_material(); } ///end ui_menu_fill(ui); - let compass_handle: zui_handle_t = zui_handle(__ID__); + let compass_handle: ui_handle_t = ui_handle(__ID__); if (compass_handle.init) { compass_handle.selected = context_raw.show_compass; } - context_raw.show_compass = zui_check(compass_handle, " " + tr("Compass")); + context_raw.show_compass = ui_check(compass_handle, " " + tr("Compass")); if (compass_handle.changed) { context_raw.ddirty = 2; } ui_menu_fill(ui); - context_raw.show_envmap = zui_check(context_raw.show_envmap_handle, " " + tr("Envmap")); + context_raw.show_envmap = ui_check(context_raw.show_envmap_handle, " " + tr("Envmap")); if (context_raw.show_envmap_handle.changed) { context_load_envmap(); context_raw.ddirty = 2; } ui_menu_fill(ui); - context_raw.show_envmap_blur = zui_check(context_raw.show_envmap_blur_handle, " " + tr("Blur Envmap")); + context_raw.show_envmap_blur = ui_check(context_raw.show_envmap_blur_handle, " " + tr("Blur Envmap")); if (context_raw.show_envmap_blur_handle.changed) { context_raw.ddirty = 2; } @@ -348,7 +348,7 @@ function ui_menu_render() { } } else if (ui_menu_category == menu_category_t.MODE) { - let mode_handle: zui_handle_t = zui_handle(__ID__); + let mode_handle: ui_handle_t = ui_handle(__ID__); mode_handle.position = context_raw.viewport_mode; let modes: string[] = [ tr("Lit"), @@ -385,7 +385,7 @@ function ui_menu_render() { for (let i: i32 = 0; i < modes.length; ++i) { ui_menu_fill(ui); let shortcut: string = config_raw.touch_ui ? "" : map_get(config_keymap, "viewport_mode") + ", " + shortcuts[i]; - zui_radio(mode_handle, i, modes[i], shortcut); + ui_radio(mode_handle, i, modes[i], shortcut); } if (mode_handle.changed) { @@ -450,22 +450,22 @@ function ui_menu_render() { ui_menu_fill(ui); let cam: camera_object_t = scene_camera; - context_raw.fov_handle = zui_handle(__ID__); + context_raw.fov_handle = ui_handle(__ID__); if (context_raw.fov_handle.init) { context_raw.fov_handle.value = math_floor(cam.data.fov * 100) / 100; } ui_menu_align(ui); - cam.data.fov = zui_slider(context_raw.fov_handle, tr("FoV"), 0.3, 1.4, true); + cam.data.fov = ui_slider(context_raw.fov_handle, tr("FoV"), 0.3, 1.4, true); if (context_raw.fov_handle.changed) { viewport_update_camera_type(context_raw.camera_type); } ui_menu_fill(ui); ui_menu_align(ui); - let camera_controls_handle: zui_handle_t = zui_handle(__ID__); + let camera_controls_handle: ui_handle_t = ui_handle(__ID__); camera_controls_handle.position = context_raw.camera_controls; let camera_controls_items: string[] = [tr("Orbit"), tr("Rotate"), tr("Fly")]; - context_raw.camera_controls = zui_inline_radio(camera_controls_handle, camera_controls_items, zui_align_t.LEFT); + context_raw.camera_controls = ui_inline_radio(camera_controls_handle, camera_controls_items, ui_align_t.LEFT); let vars: map_t = map_create(); map_set(vars, "rotate_shortcut", map_get(config_keymap, "action_rotate")); @@ -474,15 +474,15 @@ function ui_menu_render() { let orbit_and_rotate_tooltip: string = tr("Orbit and Rotate mode:\n{rotate_shortcut} or move right mouse button to rotate.\n{zoom_shortcut} or scroll to zoom.\n{pan_shortcut} or move middle mouse to pan.", vars); let fly_tooltip: string = tr("Fly mode:\nHold the right mouse button and one of the following commands:\nmove mouse to rotate.\nw, up or scroll up to move forward.\ns, down or scroll down to move backward.\na or left to move left.\nd or right to move right.\ne to move up.\nq to move down.\nHold shift to move faster or alt to move slower."); if (ui.is_hovered) { - zui_tooltip(orbit_and_rotate_tooltip + "\n\n" + fly_tooltip); + ui_tooltip(orbit_and_rotate_tooltip + "\n\n" + fly_tooltip); } ui_menu_fill(ui); ui_menu_align(ui); let camera_type_items: string[] = [tr("Perspective"), tr("Orthographic")]; - context_raw.camera_type = zui_inline_radio(context_raw.cam_handle, camera_type_items, zui_align_t.LEFT); + context_raw.camera_type = ui_inline_radio(context_raw.cam_handle, camera_type_items, ui_align_t.LEFT); if (ui.is_hovered) { - zui_tooltip(tr("Camera Type") + " (" + map_get(config_keymap, "view_camera_type") + ")"); + ui_tooltip(tr("Camera Type") + " (" + map_get(config_keymap, "view_camera_type") + ")"); } if (context_raw.cam_handle.changed) { viewport_update_camera_type(context_raw.camera_type); @@ -594,35 +594,35 @@ function ui_menu_render() { _ui_menu_render_msg = msg; - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { let tab_vertical: bool = config_raw.touch_ui; - if (zui_tab(zui_handle(__ID__), tr("About"), tab_vertical)) { + if (ui_tab(ui_handle(__ID__), tr("About"), tab_vertical)) { let img: image_t = data_get_image("badge.k"); - _zui_image(img); - _zui_end_element(); + _ui_image(img); + _ui_end_element(); - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.text = _ui_menu_render_msg; } - zui_text_area(h, zui_align_t.LEFT, false); + ui_text_area(h, ui_align_t.LEFT, false); let row: f32[] = [1 / 3, 1 / 3, 1 / 3]; - zui_row(row); + ui_row(row); ///if (krom_windows || krom_linux || krom_macos) - if (zui_button(tr("Copy"))) { + if (ui_button(tr("Copy"))) { krom_copy_to_clipboard(_ui_menu_render_msg); } ///else - _zui_end_element(); + _ui_end_element(); ///end - if (zui_button(tr("Contributors"))) { + if (ui_button(tr("Contributors"))) { file_load_url("https://github.com/armory3d/armortools/graphs/contributors"); } - if (zui_button(tr("OK"))) { + if (ui_button(tr("OK"))) { ui_box_hide(); } } @@ -638,7 +638,7 @@ function ui_menu_render() { ui.ops.theme.BUTTON_COL = _BUTTON_COL; ui.ops.theme.ELEMENT_OFFSET = _ELEMENT_OFFSET; ui.ops.theme.ELEMENT_H = _ELEMENT_H; - zui_end_region(); + ui_end_region(); if (ui_menu_hide_flag) { ui_menu_hide(); @@ -652,8 +652,8 @@ function ui_menu_hide() { base_redraw_ui(); } -function ui_menu_draw(commands: (ui: zui_t)=>void = null, elements: i32, x: i32 = -1, y: i32 = -1) { - zui_end_input(); +function ui_menu_draw(commands: (ui: ui_t)=>void = null, elements: i32, x: i32 = -1, y: i32 = -1) { + ui_end_input(); ui_menu_show = true; ui_menu_commands = commands; ui_menu_elements = elements; @@ -664,7 +664,7 @@ function ui_menu_draw(commands: (ui: zui_t)=>void = null, elements: i32, x: i32 function ui_menu_fit_to_screen() { // Prevent the menu going out of screen - let menu_w: f32 = base_default_element_w * zui_SCALE(base_ui_menu) * 2.3; + let menu_w: f32 = base_default_element_w * ui_SCALE(base_ui_menu) * 2.3; if (ui_menu_x + menu_w > sys_width()) { if (ui_menu_x - menu_w > 0) { ui_menu_x = math_floor(ui_menu_x - menu_w); @@ -673,7 +673,7 @@ function ui_menu_fit_to_screen() { ui_menu_x = math_floor(sys_width() - menu_w); } } - let menu_h: f32 = math_floor(ui_menu_elements * 30 * zui_SCALE(base_ui_menu)); // ui.ops.theme.ELEMENT_H + let menu_h: f32 = math_floor(ui_menu_elements * 30 * ui_SCALE(base_ui_menu)); // ui.ops.theme.ELEMENT_H if (ui_menu_y + menu_h > sys_height()) { if (ui_menu_y - menu_h > 0) { ui_menu_y = math_floor(ui_menu_y - menu_h); @@ -685,25 +685,25 @@ function ui_menu_fit_to_screen() { } } -function ui_menu_fill(ui: zui_t) { +function ui_menu_fill(ui: ui_t) { g2_set_color(ui.ops.theme.ACCENT_SELECT_COL); - g2_fill_rect(ui._x - 1, ui._y, ui._w + 2, zui_ELEMENT_H(ui) + 1 + 1); + g2_fill_rect(ui._x - 1, ui._y, ui._w + 2, ui_ELEMENT_H(ui) + 1 + 1); g2_set_color(ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(ui._x, ui._y, ui._w, zui_ELEMENT_H(ui) + 1); + g2_fill_rect(ui._x, ui._y, ui._w, ui_ELEMENT_H(ui) + 1); g2_set_color(0xffffffff); } -function ui_menu_separator(ui: zui_t) { +function ui_menu_separator(ui: ui_t) { ui._y++; if (config_raw.touch_ui) { - zui_fill(0, 0, ui._w / zui_SCALE(ui), 1, ui.ops.theme.ACCENT_SELECT_COL); + ui_fill(0, 0, ui._w / ui_SCALE(ui), 1, ui.ops.theme.ACCENT_SELECT_COL); } else { - zui_fill(26, 0, ui._w / zui_SCALE(ui) - 26, 1, ui.ops.theme.ACCENT_SELECT_COL); + ui_fill(26, 0, ui._w / ui_SCALE(ui) - 26, 1, ui.ops.theme.ACCENT_SELECT_COL); } } -function ui_menu_button(ui: zui_t, text: string, label: string = ""): bool { +function ui_menu_button(ui: ui_t, text: string, label: string = ""): bool { ui_menu_fill(ui); if (config_raw.touch_ui) { label = ""; @@ -711,20 +711,20 @@ function ui_menu_button(ui: zui_t, text: string, label: string = ""): bool { // let icons: image_t = icon > -1 ? get("icons.k") : null; // let r: rect_t = tile25(icons, icon, 8); - // return Zui.button(config_button_spacing + text, config_button_align, label, icons, r.x, r.y, r.w, r.h); + // return ui_button(config_button_spacing + text, config_button_align, label, icons, r.x, r.y, r.w, r.h); - return zui_button(config_button_spacing + text, config_button_align, label); + return ui_button(config_button_spacing + text, config_button_align, label); } -function ui_menu_align(ui: zui_t) { +function ui_menu_align(ui: ui_t) { if (!config_raw.touch_ui) { let row: f32[] = [12 / 100, 88 / 100]; - zui_row(row); - _zui_end_element(); + ui_row(row); + _ui_end_element(); } } -function ui_menu_start(ui: zui_t) { +function ui_menu_start(ui: ui_t) { // Draw top border g2_set_color(ui.ops.theme.ACCENT_SELECT_COL); if (config_raw.touch_ui) { diff --git a/base/sources/ui_menubar.ts b/base/sources/ui_menubar.ts index 134912c2..e8cedc7b 100644 --- a/base/sources/ui_menubar.ts +++ b/base/sources/ui_menubar.ts @@ -1,7 +1,7 @@ let ui_menubar_default_w: i32 = 330; -let ui_menubar_workspace_handle: zui_handle_t = zui_handle_create(); -let ui_menubar_menu_handle: zui_handle_t = zui_handle_create(); +let ui_menubar_workspace_handle: ui_handle_t = ui_handle_create(); +let ui_menubar_menu_handle: ui_handle_t = ui_handle_create(); let ui_menubar_w: i32 = ui_menubar_default_w; ///if is_lab @@ -10,12 +10,12 @@ let _ui_menubar_plane: mesh_object_t = null; ///end function ui_menubar_init() { - ui_menubar_workspace_handle.layout = zui_layout_t.HORIZONTAL; - ui_menubar_menu_handle.layout = zui_layout_t.HORIZONTAL; + ui_menubar_workspace_handle.layout = ui_layout_t.HORIZONTAL; + ui_menubar_menu_handle.layout = ui_layout_t.HORIZONTAL; } function ui_menubar_render_ui() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; ///if (is_paint || is_sculpt) let panelx: i32 = app_x() - ui_toolbar_w; @@ -24,10 +24,10 @@ function ui_menubar_render_ui() { let panelx: i32 = app_x(); ///end - if (zui_window(ui_menubar_menu_handle, panelx, 0, ui_menubar_w, ui_header_h)) { + if (ui_window(ui_menubar_menu_handle, panelx, 0, ui_menubar_w, ui_header_h)) { ui._x += 1; // Prevent "File" button highlight on startup - zui_begin_menu(); + ui_begin_menu(); if (config_raw.touch_ui) { @@ -56,27 +56,27 @@ function ui_menubar_render_ui() { box_export_show_textures(); } ///end - let size: i32 = math_floor(ui._w / zui_SCALE(ui)); + let size: i32 = math_floor(ui._w / ui_SCALE(ui)); if (ui_menu_show && ui_menu_category == menu_category_t.VIEWPORT) { - zui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); } if (ui_menubar_icon_button(ui, 8, 2)) { ui_menubar_show_menu(ui, menu_category_t.VIEWPORT); } if (ui_menu_show && ui_menu_category == menu_category_t.MODE) { - zui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); } if (ui_menubar_icon_button(ui, 9, 2)) { ui_menubar_show_menu(ui, menu_category_t.MODE); } if (ui_menu_show && ui_menu_category == menu_category_t.CAMERA) { - zui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); } if (ui_menubar_icon_button(ui, 10, 2)) { ui_menubar_show_menu(ui, menu_category_t.CAMERA); } if (ui_menu_show && ui_menu_category == menu_category_t.HELP) { - zui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); + ui_fill(0, -6, size, size - 4, ui.ops.theme.HIGHLIGHT_COL); } if (ui_menubar_icon_button(ui, 11, 2)) { ui_menubar_show_menu(ui, menu_category_t.HELP); @@ -94,7 +94,7 @@ function ui_menubar_render_ui() { else { let categories: string[] = [tr("File"), tr("Edit"), tr("Viewport"), tr("Mode"), tr("Camera"), tr("Help")]; for (let i: i32 = 0; i < categories.length; ++i) { - if (zui_menu_button(categories[i]) || (ui_menu_show && ui_menu_commands == null && ui.is_hovered)) { + if (_ui_menu_button(categories[i]) || (ui_menu_show && ui_menu_commands == null && ui.is_hovered)) { ui_menubar_show_menu(ui, i); } } @@ -108,7 +108,7 @@ function ui_menubar_render_ui() { ///end } - zui_end_menu(); + ui_end_menu(); } let nodesw: i32 = (ui_nodes_show || ui_view2d_show) ? config_raw.layout[layout_size_t.NODES_W] : 0; @@ -120,17 +120,17 @@ function ui_menubar_render_ui() { panelx = (app_x()) + ui_menubar_w; ///end - if (zui_window(ui_menubar_workspace_handle, panelx, 0, ww, ui_header_h)) { + if (ui_window(ui_menubar_workspace_handle, panelx, 0, ww, ui_header_h)) { if (!config_raw.touch_ui) { - zui_tab(ui_header_worktab, tr("3D View")); + ui_tab(ui_header_worktab, tr("3D View")); } else { - zui_fill(0, 0, ui._window_w, ui._window_h + 4, ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 0, ui._window_w, ui._window_h + 4, ui.ops.theme.SEPARATOR_COL); } ///if is_lab - zui_tab(ui_header_worktab, tr("2D View")); + ui_tab(ui_header_worktab, tr("2D View")); if (ui_header_worktab.changed) { context_raw.ddirty = 2; context_raw.brush_blend_dirty = true; @@ -197,28 +197,28 @@ function ui_menubar_render_ui() { } } -function ui_menubar_show_menu(ui: zui_t, category: i32) { +function ui_menubar_show_menu(ui: ui_t, category: i32) { ui_menu_show = true; ui_menu_commands = null; ui_menu_category = category; ui_menu_category_w = ui._w; - ui_menu_category_h = math_floor(zui_MENUBAR_H(ui)); + ui_menu_category_h = math_floor(ui_MENUBAR_H(ui)); ui_menu_x = math_floor(ui._x - ui._w); - ui_menu_y = math_floor(zui_MENUBAR_H(ui)); + ui_menu_y = math_floor(ui_MENUBAR_H(ui)); if (config_raw.touch_ui) { - let menuW: i32 = math_floor(base_default_element_w * zui_SCALE(base_ui_menu) * 2.0); + let menuW: i32 = math_floor(base_default_element_w * ui_SCALE(base_ui_menu) * 2.0); ui_menu_x -= math_floor((menuW - ui._w) / 2) + math_floor(ui_header_h / 2); - ui_menu_x += math_floor(2 * zui_SCALE(base_ui_menu)); - ui_menu_y -= math_floor(2 * zui_SCALE(base_ui_menu)); + ui_menu_x += math_floor(2 * ui_SCALE(base_ui_menu)); + ui_menu_y -= math_floor(2 * ui_SCALE(base_ui_menu)); ui_menu_keep_open = true; } } -function ui_menubar_icon_button(ui: zui_t, i: i32, j: i32): bool { +function ui_menubar_icon_button(ui: ui_t, i: i32, j: i32): bool { 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); - return _zui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h) == zui_state_t.RELEASED; + return _ui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED; } diff --git a/base/sources/ui_nodes.ts b/base/sources/ui_nodes.ts index e3eca8fa..2c799c2b 100644 --- a/base/sources/ui_nodes.ts +++ b/base/sources/ui_nodes.ts @@ -11,7 +11,7 @@ let ui_nodes_wy: i32; let ui_nodes_ww: i32; let ui_nodes_wh: i32; -let ui_nodes_ui: zui_t; +let ui_nodes_ui: ui_t; let ui_nodes_canvas_type: canvas_type_t = canvas_type_t.MATERIAL; let ui_nodes_show_menu: bool = false; let ui_nodes_show_menu_first: bool = true; @@ -23,59 +23,59 @@ let ui_nodes_popup_y: f32 = 0.0; let ui_nodes_uichanged_last: bool = false; let ui_nodes_recompile_mat: bool = false; // Mat preview let ui_nodes_recompile_mat_final: bool = false; -let ui_nodes_node_search_spawn: zui_node_t = null; +let ui_nodes_node_search_spawn: ui_node_t = null; let ui_nodes_node_search_offset: i32 = 0; -let ui_nodes_last_canvas: zui_node_canvas_t = null; +let ui_nodes_last_canvas: ui_node_canvas_t = null; let ui_nodes_last_node_selected_id: i32 = -1; let ui_nodes_release_link: bool = false; let ui_nodes_is_node_menu_op: bool = false; let ui_nodes_grid: image_t = null; -let ui_nodes_hwnd: zui_handle_t = zui_handle_create(); +let ui_nodes_hwnd: ui_handle_t = ui_handle_create(); let ui_nodes_group_stack: node_group_t[] = []; let ui_nodes_controls_down: bool = false; -function ui_nodes_init() { - zui_nodes_on_link_drag = ui_nodes_on_link_drag; - zui_nodes_on_socket_released = ui_nodes_on_socket_released; - zui_nodes_on_canvas_released = ui_nodes_on_canvas_released; - zui_nodes_on_canvas_control = ui_nodes_on_canvas_control; +function ui_viewnodes_init() { + ui_nodes_on_link_drag = ui_viewnodes_on_link_drag; + ui_nodes_on_socket_released = ui_viewnodes_on_socket_released; + ui_nodes_on_canvas_released = ui_viewnodes_on_canvas_released; + ui_nodes_on_canvas_control = ui_viewnodes_on_canvas_control; nodes_material_init(); let scale: f32 = config_raw.window_scale; - let ops: zui_options_t = { + let ops: ui_options_t = { theme: base_theme, font: base_font, color_wheel: base_color_wheel.texture_, black_white_gradient: base_color_wheel_gradient.texture_, scale_factor: scale }; - ui_nodes_ui = zui_create(ops); + ui_nodes_ui = ui_create(ops); ui_nodes_ui.scroll_enabled = false; } -let _ui_nodes_on_link_drag_link_drag: zui_node_link_t; -let _ui_nodes_on_link_drag_node: zui_node_t; +let _ui_nodes_on_link_drag_link_drag: ui_node_link_t; +let _ui_nodes_on_link_drag_node: ui_node_t; -function ui_nodes_on_link_drag(link_drag_id: i32, is_new_link: bool) { +function ui_viewnodes_on_link_drag(link_drag_id: i32, is_new_link: bool) { if (!is_new_link) { return; } - let ui_nodes: zui_nodes_t = ui_nodes_get_nodes(); - let links: zui_node_link_t[] = ui_nodes_get_canvas(true).links; - let link_drag: zui_node_link_t = zui_get_link(links, link_drag_id); - let nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - let node: zui_node_t = zui_get_node(nodes, link_drag.from_id > -1 ? link_drag.from_id : link_drag.to_id); - let link_x: i32 = ui_nodes_ui._window_x + zui_nodes_NODE_X(node); - let link_y: i32 = ui_nodes_ui._window_y + zui_nodes_NODE_Y(node); + let ui_nodes: ui_nodes_t = ui_nodes_get_nodes(); + let links: ui_node_link_t[] = ui_nodes_get_canvas(true).links; + let link_drag: ui_node_link_t = ui_get_link(links, link_drag_id); + let nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + let node: ui_node_t = ui_get_node(nodes, link_drag.from_id > -1 ? link_drag.from_id : link_drag.to_id); + let link_x: i32 = ui_nodes_ui._window_x + ui_nodes_NODE_X(node); + let link_y: i32 = ui_nodes_ui._window_y + ui_nodes_NODE_Y(node); if (link_drag.from_id > -1) { - link_x += zui_nodes_NODE_W(node); - link_y += zui_nodes_OUTPUT_Y(node.outputs.length, link_drag.from_socket); + link_x += ui_nodes_NODE_W(node); + link_y += ui_nodes_OUTPUT_Y(node.outputs.length, link_drag.from_socket); } else { - link_y += zui_nodes_INPUT_Y(ui_nodes_get_canvas(true), node.inputs, link_drag.to_socket) + - zui_nodes_OUTPUTS_H(node.outputs.length) + zui_nodes_BUTTONS_H(node); + link_y += ui_nodes_INPUT_Y(ui_nodes_get_canvas(true), node.inputs, link_drag.to_socket) + + ui_nodes_OUTPUTS_H(node.outputs.length) + ui_nodes_BUTTONS_H(node); } if (math_abs(mouse_x - link_x) > 5 || math_abs(mouse_y - link_y) > 5) { // Link length @@ -84,16 +84,16 @@ function ui_nodes_on_link_drag(link_drag_id: i32, is_new_link: bool) { _ui_nodes_on_link_drag_node = node; ui_nodes_node_search(-1, -1, function () { - let ui_nodes: zui_nodes_t = ui_nodes_get_nodes(); + let ui_nodes: ui_nodes_t = ui_nodes_get_nodes(); let node_selected_id: i32 = _ui_nodes_on_link_drag_node.id; if (ui_nodes.nodes_selected_id.length > 0) { node_selected_id = ui_nodes.nodes_selected_id[0]; } - let link_drag: zui_node_link_t = _ui_nodes_on_link_drag_link_drag; - let nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - let n: zui_node_t = zui_get_node(nodes, node_selected_id); + let link_drag: ui_node_link_t = _ui_nodes_on_link_drag_link_drag; + let nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + let n: ui_node_t = ui_get_node(nodes, node_selected_id); if (link_drag.to_id == -1 && n.inputs.length > 0) { link_drag.to_id = n.id; let from_type: string = _ui_nodes_on_link_drag_node.outputs[link_drag.from_socket].type; @@ -101,7 +101,7 @@ function ui_nodes_on_link_drag(link_drag_id: i32, is_new_link: bool) { link_drag.to_socket = 0; // Try to find the first type-matching socket and use it if present for (let i: i32 = 0; i < n.inputs.length; ++i) { - let socket: zui_node_socket_t = n.inputs[i]; + let socket: ui_node_socket_t = n.inputs[i]; if (socket.type == from_type) { link_drag.to_socket = array_index_of(n.inputs, socket); break; @@ -129,23 +129,23 @@ function ui_nodes_on_link_drag(link_drag_id: i32, is_new_link: bool) { } } -let _ui_nodes_on_socket_released_socket: zui_node_socket_t; -let _ui_nodes_on_socket_released_node: zui_node_t; +let _ui_nodes_on_socket_released_socket: ui_node_socket_t; +let _ui_nodes_on_socket_released_node: ui_node_t; -let _ui_nodes_htype: zui_handle_t = zui_handle_create(); -let _ui_nodes_hname: zui_handle_t = zui_handle_create(); -let _ui_nodes_hmin: zui_handle_t = zui_handle_create(); -let _ui_nodes_hmax: zui_handle_t = zui_handle_create(); -let _ui_nodes_hval0: zui_handle_t = zui_handle_create(); -let _ui_nodes_hval1: zui_handle_t = zui_handle_create(); -let _ui_nodes_hval2: zui_handle_t = zui_handle_create(); -let _ui_nodes_hval3: zui_handle_t = zui_handle_create(); +let _ui_nodes_htype: ui_handle_t = ui_handle_create(); +let _ui_nodes_hname: ui_handle_t = ui_handle_create(); +let _ui_nodes_hmin: ui_handle_t = ui_handle_create(); +let _ui_nodes_hmax: ui_handle_t = ui_handle_create(); +let _ui_nodes_hval0: ui_handle_t = ui_handle_create(); +let _ui_nodes_hval1: ui_handle_t = ui_handle_create(); +let _ui_nodes_hval2: ui_handle_t = ui_handle_create(); +let _ui_nodes_hval3: ui_handle_t = ui_handle_create(); -function ui_nodes_on_socket_released(socket_id: i32) { - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let socket: zui_node_socket_t = zui_get_socket(canvas.nodes, socket_id); - let node: zui_node_t = zui_get_node(canvas.nodes, socket.node_id); +function ui_viewnodes_on_socket_released(socket_id: i32) { + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let socket: ui_node_socket_t = ui_get_socket(canvas.nodes, socket_id); + let node: ui_node_t = ui_get_node(canvas.nodes, socket.node_id); if (ui_nodes_ui.input_released_r) { if (node.type == "GROUP_INPUT" || node.type == "GROUP_OUTPUT") { @@ -153,10 +153,10 @@ function ui_nodes_on_socket_released(socket_id: i32) { _ui_nodes_on_socket_released_node = node; app_notify_on_next_frame(function () { - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { - let socket: zui_node_socket_t = _ui_nodes_on_socket_released_socket; - let node: zui_node_t = _ui_nodes_on_socket_released_node; + let socket: ui_node_socket_t = _ui_nodes_on_socket_released_socket; + let node: ui_node_t = _ui_nodes_on_socket_released_node; if (ui_menu_button(ui, tr("Edit"))) { _ui_nodes_htype.position = socket.type == "RGBA" ? 0 : socket.type == "VECTOR" ? 1 : 2; @@ -176,47 +176,47 @@ function ui_nodes_on_socket_released(socket_id: i32) { } app_notify_on_next_frame(function () { - zui_end_input(); + ui_end_input(); - ui_box_show_custom(function (ui: zui_t) { + ui_box_show_custom(function (ui: ui_t) { - let socket: zui_node_socket_t = _ui_nodes_on_socket_released_socket; - let node: zui_node_t = _ui_nodes_on_socket_released_node; + let socket: ui_node_socket_t = _ui_nodes_on_socket_released_socket; + let node: ui_node_t = _ui_nodes_on_socket_released_node; - if (zui_tab(zui_handle(__ID__), tr("Socket"))) { + if (ui_tab(ui_handle(__ID__), tr("Socket"))) { let type_combo: string[] = [tr("Color"), tr("Vector"), tr("Value")]; - let type: i32 = zui_combo(_ui_nodes_htype, type_combo, tr("Type"), true); + let type: i32 = ui_combo(_ui_nodes_htype, type_combo, tr("Type"), true); if (_ui_nodes_htype.changed) { _ui_nodes_hname.text = type == 0 ? tr("Color") : type == 1 ? tr("Vector") : tr("Value"); } - let name: string = zui_text_input(_ui_nodes_hname, tr("Name")); - let min: f32 = zui_float_input(_ui_nodes_hmin, tr("Min")); - let max: f32 = zui_float_input(_ui_nodes_hmax, tr("Max")); + let name: string = ui_text_input(_ui_nodes_hname, tr("Name")); + let min: f32 = ui_float_input(_ui_nodes_hmin, tr("Min")); + let max: f32 = ui_float_input(_ui_nodes_hmax, tr("Max")); let default_value: f32_array_t = null; if (type == 0) { let row: f32[] = [1 / 4, 1 / 4, 1 / 4, 1 / 4]; - zui_row(row); - zui_float_input(_ui_nodes_hval0, tr("R")); - zui_float_input(_ui_nodes_hval1, tr("G")); - zui_float_input(_ui_nodes_hval2, tr("B")); - zui_float_input(_ui_nodes_hval3, tr("A")); + ui_row(row); + ui_float_input(_ui_nodes_hval0, tr("R")); + ui_float_input(_ui_nodes_hval1, tr("G")); + ui_float_input(_ui_nodes_hval2, tr("B")); + ui_float_input(_ui_nodes_hval3, tr("A")); default_value = f32_array_create_xyzw( _ui_nodes_hval0.value, _ui_nodes_hval1.value, _ui_nodes_hval2.value, _ui_nodes_hval3.value); } else if (type == 1) { let row: f32[] = [1 / 3, 1 / 3, 1 / 3]; - zui_row(row); - _ui_nodes_hval0.value = zui_float_input(_ui_nodes_hval0, tr("X")); - _ui_nodes_hval1.value = zui_float_input(_ui_nodes_hval1, tr("Y")); - _ui_nodes_hval2.value = zui_float_input(_ui_nodes_hval2, tr("Z")); + ui_row(row); + _ui_nodes_hval0.value = ui_float_input(_ui_nodes_hval0, tr("X")); + _ui_nodes_hval1.value = ui_float_input(_ui_nodes_hval1, tr("Y")); + _ui_nodes_hval2.value = ui_float_input(_ui_nodes_hval2, tr("Z")); default_value = f32_array_create_xyz( _ui_nodes_hval0.value, _ui_nodes_hval1.value, _ui_nodes_hval2.value); } else { - let f: f32 = zui_float_input(_ui_nodes_hval0, tr("default_value")); + let f: f32 = ui_float_input(_ui_nodes_hval0, tr("default_value")); default_value = f32_array_create_x(f); } - if (zui_button(tr("OK"))) { // || ui.isReturnDown + if (ui_button(tr("OK"))) { // || ui.isReturnDown socket.name = name; socket.type = type == 0 ? "RGBA" : type == 1 ? "VECTOR" : "VALUE"; socket.color = nodes_material_get_socket_color(socket.type); @@ -233,10 +233,10 @@ function ui_nodes_on_socket_released(socket_id: i32) { } if (ui_menu_button(ui, tr("Delete"))) { let i: i32 = 0; - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); // Remove links connected to the socket while (i < canvas.links.length) { - let l: zui_node_link_t = canvas.links[i]; + let l: ui_node_link_t = canvas.links[i]; if ((l.from_id == node.id && l.from_socket == array_index_of(node.outputs, socket)) || (l.to_id == node.id && l.to_socket == array_index_of(node.inputs, socket))) { array_splice(canvas.links, i, 1); @@ -253,7 +253,7 @@ function ui_nodes_on_socket_released(socket_id: i32) { }, 2); }); } - else ui_nodes_on_canvas_released(); + else ui_viewnodes_on_canvas_released(); } // Selecting which node socket to preview else if (nodes.nodes_selected_id.length > 0 && node.id == nodes.nodes_selected_id[0]) { @@ -267,17 +267,17 @@ function ui_nodes_on_socket_released(socket_id: i32) { } } -let _ui_nodes_on_canvas_released_selected: zui_node_t; +let _ui_nodes_on_canvas_released_selected: ui_node_t; -function ui_nodes_on_canvas_released() { +function ui_viewnodes_on_canvas_released() { if (ui_nodes_ui.input_released_r && math_abs(ui_nodes_ui.input_x - ui_nodes_ui.input_started_x) < 2 && math_abs(ui_nodes_ui.input_y - ui_nodes_ui.input_started_y) < 2) { // Node selection - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let selected: zui_node_t = null; + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let selected: ui_node_t = null; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let node: zui_node_t = canvas.nodes[i]; - if (zui_input_in_rect(ui_nodes_ui._window_x + zui_nodes_NODE_X(node), ui_nodes_ui._window_y + zui_nodes_NODE_Y(node), zui_nodes_NODE_W(node), zui_nodes_NODE_H(canvas, node))) { + let node: ui_node_t = canvas.nodes[i]; + if (ui_input_in_rect(ui_nodes_ui._window_x + ui_nodes_NODE_X(node), ui_nodes_ui._window_y + ui_nodes_NODE_Y(node), ui_nodes_NODE_W(node), ui_nodes_NODE_H(canvas, node))) { selected = node; break; } @@ -290,7 +290,7 @@ function ui_nodes_on_canvas_released() { } // Node context menu - if (!zui_nodes_socket_released) { + if (!ui_nodes_socket_released) { let number_of_entries: i32 = 5; if (ui_nodes_canvas_type == canvas_type_t.MATERIAL) { ++number_of_entries; @@ -301,9 +301,9 @@ function ui_nodes_on_canvas_released() { _ui_nodes_on_canvas_released_selected = selected; - ui_menu_draw(function (ui_menu: zui_t) { + ui_menu_draw(function (ui_menu: ui_t) { - let selected: zui_node_t = _ui_nodes_on_canvas_released_selected; + let selected: ui_node_t = _ui_nodes_on_canvas_released_selected; ui_menu._y += 1; let is_protected: bool = selected == null || @@ -317,22 +317,22 @@ function ui_nodes_on_canvas_released() { if (ui_menu_button(ui_menu, tr("Cut"), "ctrl+x")) { app_notify_on_next_frame(function () { ui_nodes_hwnd.redraws = 2; - zui_is_copy = true; - zui_is_cut = true; + ui_is_copy = true; + ui_is_cut = true; ui_nodes_is_node_menu_op = true; }); } if (ui_menu_button(ui_menu, tr("Copy"), "ctrl+c")) { app_notify_on_next_frame(function () { - zui_is_copy = true; + ui_is_copy = true; ui_nodes_is_node_menu_op = true; }); } - ui_menu.enabled = zui_clipboard != ""; + ui_menu.enabled = ui_clipboard != ""; if (ui_menu_button(ui_menu, tr("Paste"), "ctrl+v")) { app_notify_on_next_frame(function () { ui_nodes_hwnd.redraws = 2; - zui_is_paste = true; + ui_is_paste = true; ui_nodes_is_node_menu_op = true; }); } @@ -347,8 +347,8 @@ function ui_nodes_on_canvas_released() { if (ui_menu_button(ui_menu, tr("Duplicate"))) { app_notify_on_next_frame(function () { ui_nodes_hwnd.redraws = 2; - zui_is_copy = true; - zui_is_paste = true; + ui_is_copy = true; + ui_is_paste = true; ui_nodes_is_node_menu_op = true; }); } @@ -375,11 +375,11 @@ function ui_nodes_on_canvas_released() { } if (ui_nodes_ui.input_released) { - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let node: zui_node_t = canvas.nodes[i]; - if (zui_input_in_rect(ui_nodes_ui._window_x + zui_nodes_NODE_X(node), ui_nodes_ui._window_y + zui_nodes_NODE_Y(node), zui_nodes_NODE_W(node), zui_nodes_NODE_H(canvas, node))) { + let node: ui_node_t = canvas.nodes[i]; + if (ui_input_in_rect(ui_nodes_ui._window_x + ui_nodes_NODE_X(node), ui_nodes_ui._window_y + ui_nodes_NODE_Y(node), ui_nodes_NODE_W(node), ui_nodes_NODE_H(canvas, node))) { if (nodes.nodes_selected_id.length > 0 && node.id == nodes.nodes_selected_id[0]) { ui_view2d_hwnd.redraws = 2; if (time_time() - context_raw.select_time < 0.25) ui_base_show_2d_view(view_2d_type_t.NODE); @@ -391,13 +391,13 @@ function ui_nodes_on_canvas_released() { } } -function ui_nodes_on_canvas_control(): zui_canvas_control_t { - let control: zui_canvas_control_t = ui_nodes_get_canvas_control(ui_nodes_ui, ui_nodes_controls_down); +function ui_viewnodes_on_canvas_control(): ui_canvas_control_t { + let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_nodes_ui, ui_nodes_controls_down); ui_nodes_controls_down = control.controls_down; return control; } -function ui_nodes_get_canvas_control(ui: zui_t, controls_down: bool): zui_canvas_control_t { +function ui_nodes_get_canvas_control(ui: ui_t, controls_down: bool): ui_canvas_control_t { if (config_raw.wrap_mouse && controls_down) { if (ui.input_x < ui._window_x) { ui.input_x = ui._window_x + ui._window_w; @@ -430,7 +430,7 @@ function ui_nodes_get_canvas_control(ui: zui_t, controls_down: bool): zui_canvas controls_down = false; } if (!controls_down) { - let cc: zui_canvas_control_t = { + let cc: ui_canvas_control_t = { pan_x: 0, pan_y: 0, zoom: 0, @@ -441,7 +441,7 @@ function ui_nodes_get_canvas_control(ui: zui_t, controls_down: bool): zui_canvas let pan: bool = ui.input_down_r || operator_shortcut(map_get(config_keymap, "action_pan"), shortcut_type_t.DOWN); let zoom_delta: f32 = operator_shortcut(map_get(config_keymap, "action_zoom"), shortcut_type_t.DOWN) ? ui_nodes_get_zoom_delta(ui) / 100.0 : 0.0; - let control: zui_canvas_control_t = { + let control: ui_canvas_control_t = { pan_x: pan ? ui.input_dx : 0.0, pan_y: pan ? ui.input_dy : 0.0, zoom: ui.input_wheel_delta != 0.0 ? -ui.input_wheel_delta / 10 : zoom_delta, @@ -453,7 +453,7 @@ function ui_nodes_get_canvas_control(ui: zui_t, controls_down: bool): zui_canvas return control; } -function ui_nodes_get_zoom_delta(ui: zui_t): f32 { +function ui_nodes_get_zoom_delta(ui: ui_t): f32 { return config_raw.zoom_direction == zoom_direction_t.VERTICAL ? -ui.input_dy : config_raw.zoom_direction == zoom_direction_t.VERTICAL_INVERTED ? -ui.input_dy : config_raw.zoom_direction == zoom_direction_t.HORIZONTAL ? ui.input_dx : @@ -461,7 +461,7 @@ function ui_nodes_get_zoom_delta(ui: zui_t): f32 { -(ui.input_dy - ui.input_dx); } -function ui_nodes_get_canvas(groups: bool = false): zui_node_canvas_t { +function ui_nodes_get_canvas(groups: bool = false): ui_node_canvas_t { ///if (is_paint || is_sculpt) if (ui_nodes_canvas_type == canvas_type_t.MATERIAL) { if (groups && ui_nodes_group_stack.length > 0) { @@ -482,12 +482,12 @@ function ui_nodes_get_canvas(groups: bool = false): zui_node_canvas_t { } ///if (is_paint || is_sculpt) -function ui_nodes_get_canvas_material(): zui_node_canvas_t { +function ui_nodes_get_canvas_material(): ui_node_canvas_t { return context_raw.material.canvas; } ///end -function ui_nodes_get_nodes(): zui_nodes_t { +function ui_nodes_get_nodes(): ui_nodes_t { ///if (is_paint || is_sculpt) if (ui_nodes_canvas_type == canvas_type_t.MATERIAL) { if (ui_nodes_group_stack.length > 0) { @@ -547,34 +547,34 @@ function ui_nodes_update() { return; } - let nodes: zui_nodes_t = ui_nodes_get_nodes(); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); if (nodes.nodes_selected_id.length > 0 && ui_nodes_ui.is_key_pressed) { if (ui_nodes_ui.key_code == key_code_t.LEFT) { for (let i: i32 = 0; i < nodes.nodes_selected_id.length; ++i) { let n: i32 = nodes.nodes_selected_id[i]; - let _nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - zui_get_node(_nodes, n).x -= 1; + let _nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + ui_get_node(_nodes, n).x -= 1; } } else if (ui_nodes_ui.key_code == key_code_t.RIGHT) { for (let i: i32 = 0; i < nodes.nodes_selected_id.length; ++i) { let n: i32 = nodes.nodes_selected_id[i]; - let _nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - zui_get_node(_nodes, n).x += 1; + let _nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + ui_get_node(_nodes, n).x += 1; } } if (ui_nodes_ui.key_code == key_code_t.UP) { for (let i: i32 = 0; i < nodes.nodes_selected_id.length; ++i) { let n: i32 = nodes.nodes_selected_id[i]; - let _nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - zui_get_node(_nodes, n).y -= 1; + let _nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + ui_get_node(_nodes, n).y -= 1; } } else if (ui_nodes_ui.key_code == key_code_t.DOWN) { for (let i: i32 = 0; i < nodes.nodes_selected_id.length; ++i) { let n: i32 = nodes.nodes_selected_id[i]; - let _nodes: zui_node_t[] = ui_nodes_get_canvas(true).nodes; - zui_get_node(_nodes, n).y += 1; + let _nodes: ui_node_t[] = ui_nodes_get_canvas(true).nodes; + ui_get_node(_nodes, n).y += 1; } } } @@ -606,19 +606,19 @@ function ui_nodes_node_search(x: i32 = -1, y: i32 = -1, done: ()=>void = null) { _ui_nodes_node_search_first = true; _ui_nodes_node_search_done = done; - ui_menu_draw(function (ui: zui_t) { - let search_handle: zui_handle_t = zui_handle(__ID__); + ui_menu_draw(function (ui: ui_t) { + let search_handle: ui_handle_t = ui_handle(__ID__); g2_set_color(ui.ops.theme.SEPARATOR_COL); - zui_draw_rect(true, ui._x, ui._y, ui._w, zui_ELEMENT_H(ui) * 8); + ui_draw_rect(true, ui._x, ui._y, ui._w, ui_ELEMENT_H(ui) * 8); g2_set_color(0xffffffff); - let search: string = to_lower_case(zui_text_input(search_handle, "", zui_align_t.LEFT, true, true)); + let search: string = to_lower_case(ui_text_input(search_handle, "", ui_align_t.LEFT, true, true)); ui.changed = false; if (_ui_nodes_node_search_first) { _ui_nodes_node_search_first = false; search_handle.text = ""; - zui_start_text_edit(search_handle); // Focus search bar + ui_start_text_edit(search_handle); // Focus search bar } if (search_handle.changed) { @@ -645,15 +645,15 @@ function ui_nodes_node_search(x: i32 = -1, y: i32 = -1, done: ()=>void = null) { ///end for (let i: i32 = 0; i < node_list.length; ++i) { - let list: zui_node_t[] = node_list[i]; + let list: ui_node_t[] = node_list[i]; for (let i: i32 = 0; i < list.length; ++i) { - let n: zui_node_t = list[i]; + let n: ui_node_t = list[i]; if (string_index_of(to_lower_case(tr(n.name)), search) >= 0) { ui.ops.theme.BUTTON_COL = count == ui_nodes_node_search_offset ? ui.ops.theme.HIGHLIGHT_COL : ui.ops.theme.SEPARATOR_COL; - if (zui_button(tr(n.name), zui_align_t.LEFT) || (enter && count == ui_nodes_node_search_offset)) { + if (ui_button(tr(n.name), ui_align_t.LEFT) || (enter && count == ui_nodes_node_search_offset)) { ui_nodes_push_undo(); - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); ui_nodes_node_search_spawn = ui_nodes_make_node(n, nodes, canvas); // Spawn selected node array_push(canvas.nodes, ui_nodes_node_search_spawn); nodes.nodes_selected_id = [ui_nodes_node_search_spawn.id]; @@ -690,11 +690,11 @@ function ui_nodes_node_search(x: i32 = -1, y: i32 = -1, done: ()=>void = null) { } function ui_nodes_get_node_x(): i32 { - return math_floor((mouse_x - ui_nodes_wx - zui_nodes_PAN_X()) / zui_nodes_SCALE()); + return math_floor((mouse_x - ui_nodes_wx - ui_nodes_PAN_X()) / ui_nodes_SCALE()); } function ui_nodes_get_node_y(): i32 { - return math_floor((mouse_y - ui_nodes_wy - zui_nodes_PAN_Y()) / zui_nodes_SCALE()); + return math_floor((mouse_y - ui_nodes_wy - ui_nodes_PAN_Y()) / ui_nodes_SCALE()); } function ui_nodes_draw_grid() { @@ -707,7 +707,7 @@ function ui_nodes_draw_grid() { ///end let wh: i32 = app_h(); - let step: f32 = 100 * zui_SCALE(ui_nodes_ui); + let step: f32 = 100 * ui_SCALE(ui_nodes_ui); let w: i32 = math_floor(ww + step * 3); let h: i32 = math_floor(wh + step * 3); if (w < 1) { @@ -721,7 +721,7 @@ function ui_nodes_draw_grid() { g2_clear(ui_nodes_ui.ops.theme.SEPARATOR_COL); g2_set_color(ui_nodes_ui.ops.theme.SEPARATOR_COL - 0x00050505); - step = 20 * zui_SCALE(ui_nodes_ui); + step = 20 * ui_SCALE(ui_nodes_ui); for (let i: i32 = 0; i < math_floor(h / step) + 1; ++i) { g2_draw_line(0, i * step, w, i * step); } @@ -730,7 +730,7 @@ function ui_nodes_draw_grid() { } g2_set_color(ui_nodes_ui.ops.theme.SEPARATOR_COL - 0x00090909); - step = 100 * zui_SCALE(ui_nodes_ui); + step = 100 * ui_SCALE(ui_nodes_ui); for (let i: i32 = 0; i < math_floor(h / step) + 1; ++i) { g2_draw_line(0, i * step, w, i * step); } @@ -791,7 +791,7 @@ function ui_nodes_render() { ui_nodes_recompile_mat_final = false; } - let nodes: zui_nodes_t = ui_nodes_get_nodes(); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); if (nodes.nodes_selected_id.length > 0 && nodes.nodes_selected_id[0] != ui_nodes_last_node_selected_id) { ui_nodes_last_node_selected_id = nodes.nodes_selected_id[0]; ///if (is_paint || is_sculpt) @@ -807,9 +807,9 @@ function ui_nodes_render() { } // Remove dragged link when mouse is released out of the node viewport - let c: zui_node_canvas_t = ui_nodes_get_canvas(true); + let c: ui_node_canvas_t = ui_nodes_get_canvas(true); if (ui_nodes_release_link && nodes.link_drag_id != -1) { - array_remove(c.links, zui_get_link(c.links, nodes.link_drag_id)); + array_remove(c.links, ui_get_link(c.links, nodes.link_drag_id)); nodes.link_drag_id = -1; } ui_nodes_release_link = ui_nodes_ui.input_released; @@ -833,7 +833,7 @@ function ui_nodes_render() { ///end // Start with UI - zui_begin(ui_nodes_ui); + ui_begin(ui_nodes_ui); // Make window ui_nodes_ww = config_raw.layout[layout_size_t.NODES_W]; @@ -854,7 +854,7 @@ function ui_nodes_render() { } ///end - let ew: i32 = math_floor(zui_ELEMENT_W(ui_nodes_ui) * 0.7); + let ew: i32 = math_floor(ui_ELEMENT_W(ui_nodes_ui) * 0.7); ui_nodes_wh = app_h() + ui_header_h; if (config_raw.layout[layout_size_t.HEADER] == 1) { ui_nodes_wh += ui_header_h; @@ -871,15 +871,15 @@ function ui_nodes_render() { } } - if (zui_window(ui_nodes_hwnd, ui_nodes_wx, ui_nodes_wy, ui_nodes_ww, ui_nodes_wh)) { + if (ui_window(ui_nodes_hwnd, ui_nodes_wx, ui_nodes_wy, ui_nodes_ww, ui_nodes_wh)) { - zui_tab(zui_handle(__ID__), tr("Nodes")); + ui_tab(ui_handle(__ID__), tr("Nodes")); // Grid g2_set_color(0xffffffff); - let step: f32 = 100 * zui_SCALE(ui_nodes_ui); - let x: f32 = math_fmod(nodes.pan_x * zui_nodes_SCALE(), step) - step; - let y: f32 = math_fmod(nodes.pan_y * zui_nodes_SCALE(), step) - step; + let step: f32 = 100 * ui_SCALE(ui_nodes_ui); + let x: f32 = math_fmod(nodes.pan_x * ui_nodes_SCALE(), step) - step; + let y: f32 = math_fmod(nodes.pan_y * ui_nodes_SCALE(), step) - step; g2_draw_image(ui_nodes_grid, x, y); // Undo @@ -896,7 +896,7 @@ function ui_nodes_render() { ui_nodes_ui.window_border_top = ui_header_h * 2; ui_nodes_ui.window_border_bottom = config_raw.layout[layout_size_t.STATUS_H]; - zui_node_canvas(nodes, c); + ui_node_canvas(nodes, c); ui_nodes_ui.input_enabled = _input_enabled; if (nodes.color_picker_callback != null) { @@ -923,7 +923,7 @@ function ui_nodes_render() { } // Remove nodes with unknown id for this canvas type - if (zui_is_paste) { + if (ui_is_paste) { ///if (is_paint || is_sculpt) let node_list: node_list_t[] = ui_nodes_canvas_type == canvas_type_t.MATERIAL ? nodes_material_list : nodes_brush_list; ///end @@ -933,15 +933,15 @@ function ui_nodes_render() { let i: i32 = 0; while (i++ < c.nodes.length) { - let canvas_node: zui_node_t = c.nodes[i - 1]; - if (array_index_of(zui_nodes_exclude_remove, canvas_node.type) >= 0) { + let canvas_node: ui_node_t = c.nodes[i - 1]; + if (array_index_of(ui_nodes_exclude_remove, canvas_node.type) >= 0) { continue; } let found: bool = false; for (let i: i32 = 0; i < node_list.length; ++i) { - let list: zui_node_t[] = node_list[i]; + let list: ui_node_t[] = node_list[i]; for (let i: i32 = 0; i < list.length; ++i) { - let list_node: zui_node_t = list[i]; + let list_node: ui_node_t = list[i]; if (canvas_node.type == list_node.type) { found = true; break; @@ -955,7 +955,7 @@ function ui_nodes_render() { found = false; } if (!found) { - zui_remove_node(canvas_node, c); + ui_remove_node(canvas_node, c); array_remove(nodes.nodes_selected_id, canvas_node.id); i--; } @@ -963,9 +963,9 @@ function ui_nodes_render() { } if (ui_nodes_is_node_menu_op) { - zui_is_copy = false; - zui_is_cut = false; - zui_is_paste = false; + ui_is_copy = false; + ui_is_cut = false; + ui_is_paste = false; ui_nodes_ui.is_delete_down = false; } @@ -987,7 +987,7 @@ function ui_nodes_render() { // Node previews if (config_raw.node_preview && nodes.nodes_selected_id.length > 0) { let img: image_t = null; - let sel: zui_node_t = zui_get_node(c.nodes, nodes.nodes_selected_id[0]); + let sel: ui_node_t = ui_get_node(c.nodes, nodes.nodes_selected_id[0]); ///if (is_paint || is_sculpt) @@ -1026,10 +1026,10 @@ function ui_nodes_render() { ///end if (img != null) { - let tw: f32 = 128 * zui_SCALE(ui_nodes_ui); + let tw: f32 = 128 * ui_SCALE(ui_nodes_ui); let th: f32 = tw * (img.height / img.width); - let tx: f32 = ui_nodes_ww - tw - 8 * zui_SCALE(ui_nodes_ui); - let ty: f32 = ui_nodes_wh - th - 8 * zui_SCALE(ui_nodes_ui); + let tx: f32 = ui_nodes_ww - tw - 8 * ui_SCALE(ui_nodes_ui); + let ty: f32 = ui_nodes_wh - th - 8 * ui_SCALE(ui_nodes_ui); ///if krom_opengl let invert_y: bool = sel.type == "MATERIAL"; @@ -1062,20 +1062,20 @@ function ui_nodes_render() { // Menu g2_set_color(ui_nodes_ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, zui_ELEMENT_H(ui_nodes_ui), ui_nodes_ww, zui_ELEMENT_H(ui_nodes_ui) + zui_ELEMENT_OFFSET(ui_nodes_ui) * 2); + g2_fill_rect(0, ui_ELEMENT_H(ui_nodes_ui), ui_nodes_ww, ui_ELEMENT_H(ui_nodes_ui) + ui_ELEMENT_OFFSET(ui_nodes_ui) * 2); g2_set_color(0xffffffff); - let start_y: i32 = zui_ELEMENT_H(ui_nodes_ui) + zui_ELEMENT_OFFSET(ui_nodes_ui); + let start_y: i32 = ui_ELEMENT_H(ui_nodes_ui) + ui_ELEMENT_OFFSET(ui_nodes_ui); ui_nodes_ui._x = 0; ui_nodes_ui._y = 2 + start_y; ui_nodes_ui._w = ew; ///if (is_paint || is_sculpt) // Editable canvas name - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); h.text = c.name; - ui_nodes_ui._w = math_floor(math_min(g2_font_width(ui_nodes_ui.ops.font, ui_nodes_ui.font_size, h.text) + 15 * zui_SCALE(ui_nodes_ui), 100 * zui_SCALE(ui_nodes_ui))); - let new_name: string = zui_text_input(h, ""); + ui_nodes_ui._w = math_floor(math_min(g2_font_width(ui_nodes_ui.ops.font, ui_nodes_ui.font_size, h.text) + 15 * ui_SCALE(ui_nodes_ui), 100 * ui_SCALE(ui_nodes_ui))); + let new_name: string = ui_text_input(h, ""); ui_nodes_ui._x += ui_nodes_ui._w + 3; ui_nodes_ui._y = 2 + start_y; ui_nodes_ui._w = ew; @@ -1093,7 +1093,7 @@ function ui_nodes_render() { if (can_rename) { let old_name: string = c.name; c.name = new_name; - let canvases: zui_node_canvas_t[] = []; + let canvases: ui_node_canvas_t[] = []; for (let i: i32 = 0; i < project_materials.length; ++i) { let m: slot_material_t = project_materials[i]; array_push(canvases, m.canvas); @@ -1103,9 +1103,9 @@ function ui_nodes_render() { array_push(canvases, m.canvas); } for (let i: i32 = 0; i < canvases.length; ++i) { - let canvas: zui_node_canvas_t = canvases[i]; + let canvas: ui_node_canvas_t = canvases[i]; for (let i: i32 = 0; i < canvas.nodes.length; ++i) { - let n: zui_node_t = canvas.nodes[i]; + let n: ui_node_t = canvas.nodes[i]; if (n.type == "GROUP" && n.name == old_name) { n.name = c.name; } @@ -1135,7 +1135,7 @@ function ui_nodes_render() { ///end for (let i: i32 = 0; i < cats.length; ++i) { - if ((zui_menu_button(tr(cats[i]))) || (ui_nodes_ui.is_hovered && ui_nodes_show_menu)) { + if ((_ui_menu_button(tr(cats[i]))) || (ui_nodes_ui.is_hovered && ui_nodes_show_menu)) { ui_nodes_show_menu = true; ui_nodes_menu_category = i; ui_nodes_popup_x = ui_nodes_wx + ui_nodes_ui._x; @@ -1147,7 +1147,7 @@ function ui_nodes_render() { ui_nodes_popup_x += ui_nodes_ui._w / 2; } ui_menu_category_w = ui_nodes_ui._w; - ui_menu_category_h = math_floor(zui_MENUBAR_H(ui_nodes_ui)); + ui_menu_category_h = math_floor(ui_MENUBAR_H(ui_nodes_ui)); } ui_nodes_ui._x += ui_nodes_ui._w + 3; ui_nodes_ui._y = 2 + start_y; @@ -1155,20 +1155,20 @@ function ui_nodes_render() { if (config_raw.touch_ui) { let _w: i32 = ui_nodes_ui._w; - ui_nodes_ui._w = math_floor(36 * zui_SCALE(ui_nodes_ui)); - ui_nodes_ui._y = 4 * zui_SCALE(ui_nodes_ui) + start_y; + ui_nodes_ui._w = math_floor(36 * ui_SCALE(ui_nodes_ui)); + ui_nodes_ui._y = 4 * ui_SCALE(ui_nodes_ui) + start_y; if (ui_menubar_icon_button(ui_nodes_ui, 2, 3)) { ui_nodes_node_search(math_floor(ui_nodes_ui._window_x + ui_nodes_ui._x), math_floor(ui_nodes_ui._window_y + ui_nodes_ui._y)); } ui_nodes_ui._w = _w; } else { - if (zui_menu_button(tr("Search"))) { + if (_ui_menu_button(tr("Search"))) { ui_nodes_node_search(math_floor(ui_nodes_ui._window_x + ui_nodes_ui._x), math_floor(ui_nodes_ui._window_y + ui_nodes_ui._y)); } } if (ui_nodes_ui.is_hovered) { - zui_tooltip(tr("Search for nodes") + " (" + map_get(config_keymap, "node_search") + ")"); + ui_tooltip(tr("Search for nodes") + " (" + map_get(config_keymap, "node_search") + ")"); } ui_nodes_ui._x += ui_nodes_ui._w + 3; ui_nodes_ui._y = 2 + start_y; @@ -1176,12 +1176,12 @@ function ui_nodes_render() { ui_nodes_ui.ops.theme.BUTTON_COL = _BUTTON_COL; // Close node group - if (ui_nodes_group_stack.length > 0 && zui_menu_button(tr("Close"))) { + if (ui_nodes_group_stack.length > 0 && _ui_menu_button(tr("Close"))) { array_pop(ui_nodes_group_stack); } } - zui_end(!ui_nodes_show_menu); + ui_end(!ui_nodes_show_menu); g2_begin(null); @@ -1193,7 +1193,7 @@ function ui_nodes_render() { let list: node_list_t[] = nodes_brush_list; ///end - let category: zui_node_t[] = list[ui_nodes_menu_category]; + let category: ui_node_t[] = list[ui_nodes_menu_category]; let num_nodes: i32 = category.length; ///if (is_paint || is_sculpt) @@ -1209,7 +1209,7 @@ function ui_nodes_render() { let py: i32 = ui_nodes_popup_y; let menuw: i32 = math_floor(ew * 2.3); - zui_begin_region(ui_nodes_ui, math_floor(ui_nodes_popup_x), math_floor(py), menuw); + ui_begin_region(ui_nodes_ui, math_floor(ui_nodes_popup_x), math_floor(py), menuw); let _BUTTON_COL: i32 = ui_nodes_ui.ops.theme.BUTTON_COL; ui_nodes_ui.ops.theme.BUTTON_COL = ui_nodes_ui.ops.theme.SEPARATOR_COL; let _ELEMENT_OFFSET: i32 = ui_nodes_ui.ops.theme.ELEMENT_OFFSET; @@ -1220,12 +1220,12 @@ function ui_nodes_render() { ui_menu_start(ui_nodes_ui); for (let i: i32 = 0; i < category.length; ++i) { - let n: zui_node_t = category[i]; + let n: ui_node_t = category[i]; if (ui_menu_button(ui_nodes_ui, tr(n.name))) { ui_nodes_push_undo(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = ui_nodes_make_node(n, nodes, canvas); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas); array_push(canvas.nodes, node); nodes.nodes_selected_id = [node.id]; nodes.nodes_drag = true; @@ -1234,7 +1234,7 @@ function ui_nodes_render() { ///end } // Next column - if (ui_nodes_ui._y - ui_nodes_wy + zui_ELEMENT_H(ui_nodes_ui) / 2 > ui_nodes_wh) { + if (ui_nodes_ui._y - ui_nodes_wy + ui_ELEMENT_H(ui_nodes_ui) / 2 > ui_nodes_wh) { ui_nodes_ui._x += menuw; ui_nodes_ui._y = py; } @@ -1242,17 +1242,17 @@ function ui_nodes_render() { if (is_group_category) { for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; - zui_fill(0, 1, ui_nodes_ui._w / zui_SCALE(ui_nodes_ui), ui_nodes_ui.ops.theme.BUTTON_H + 2, ui_nodes_ui.ops.theme.ACCENT_SELECT_COL); - zui_fill(1, 1, ui_nodes_ui._w / zui_SCALE(ui_nodes_ui) - 2, ui_nodes_ui.ops.theme.BUTTON_H + 1, ui_nodes_ui.ops.theme.SEPARATOR_COL); + ui_fill(0, 1, ui_nodes_ui._w / ui_SCALE(ui_nodes_ui), ui_nodes_ui.ops.theme.BUTTON_H + 2, ui_nodes_ui.ops.theme.ACCENT_SELECT_COL); + ui_fill(1, 1, ui_nodes_ui._w / ui_SCALE(ui_nodes_ui) - 2, ui_nodes_ui.ops.theme.BUTTON_H + 1, ui_nodes_ui.ops.theme.SEPARATOR_COL); ui_nodes_ui.enabled = ui_nodes_can_place_group(g.canvas.name); ui_menu_fill(ui_nodes_ui); let row: f32[] = [5 / 6, 1 / 6]; - zui_row(row); - if (zui_button(config_button_spacing + g.canvas.name, zui_align_t.LEFT)) { + ui_row(row); + if (ui_button(config_button_spacing + g.canvas.name, ui_align_t.LEFT)) { ui_nodes_push_undo(); - let canvas: zui_node_canvas_t = ui_nodes_get_canvas(true); - let nodes: zui_nodes_t = ui_nodes_get_nodes(); - let node: zui_node_t = ui_nodes_make_group_node(g.canvas, nodes, canvas); + let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); + let node: ui_node_t = ui_nodes_make_group_node(g.canvas, nodes, canvas); array_push(canvas.nodes, node); nodes.nodes_selected_id = [node.id]; nodes.nodes_drag = true; @@ -1260,7 +1260,7 @@ function ui_nodes_render() { ///if (is_paint || is_sculpt) ui_nodes_ui.enabled = !project_is_material_group_in_use(g); - if (zui_button("x", zui_align_t.CENTER)) { + if (ui_button("x", ui_align_t.CENTER)) { history_delete_material_group(g); array_remove(project_material_groups, g); } @@ -1276,7 +1276,7 @@ function ui_nodes_render() { ui_nodes_ui.ops.theme.BUTTON_COL = _BUTTON_COL; ui_nodes_ui.ops.theme.ELEMENT_OFFSET = _ELEMENT_OFFSET; ui_nodes_ui.ops.theme.ELEMENT_H = _ELEMENT_H; - zui_end_region(); + ui_end_region(); } if (ui_nodes_hide_menu) { @@ -1290,7 +1290,7 @@ function ui_nodes_contains_node_group_recursive(group: node_group_t, group_name: return true; } for (let i: i32 = 0; i < group.canvas.nodes.length; ++i) { - let n: zui_node_t = group.canvas.nodes[i]; + let n: ui_node_t = group.canvas.nodes[i]; if (n.type == "GROUP") { let g: node_group_t = project_get_material_group_by_name(n.name); if (g != null && ui_nodes_contains_node_group_recursive(g, group_name)) { @@ -1324,7 +1324,7 @@ function ui_nodes_can_place_group(group_name: string): bool { return true; } -function ui_nodes_push_undo(last_canvas: zui_node_canvas_t = null) { +function ui_nodes_push_undo(last_canvas: ui_node_canvas_t = null) { if (last_canvas == null) { last_canvas = ui_nodes_get_canvas(true); } @@ -1346,10 +1346,10 @@ function ui_nodes_accept_asset_drag(index: i32) { ui_nodes_push_undo(); let g: node_group_t = ui_nodes_group_stack.length > 0 ? ui_nodes_group_stack[ui_nodes_group_stack.length - 1] : null; ///if (is_paint || is_sculpt) - let n: zui_node_t = ui_nodes_canvas_type == canvas_type_t.MATERIAL ? nodes_material_create_node("TEX_IMAGE", g) : nodes_brush_create_node("TEX_IMAGE"); + let n: ui_node_t = ui_nodes_canvas_type == canvas_type_t.MATERIAL ? nodes_material_create_node("TEX_IMAGE", g) : nodes_brush_create_node("TEX_IMAGE"); ///end ///if is_lab - let n: zui_node_t = nodes_brush_create_node("ImageTextureNode"); + let n: ui_node_t = nodes_brush_create_node("ImageTextureNode"); ///end n.buttons[0].default_value[0] = index; @@ -1367,7 +1367,7 @@ function ui_nodes_accept_layer_drag(index: i32) { return; } let g: node_group_t = ui_nodes_group_stack.length > 0 ? ui_nodes_group_stack[ui_nodes_group_stack.length - 1] : null; - let n: zui_node_t = nodes_material_create_node(slot_layer_is_mask(context_raw.layer) ? "LAYER_MASK" : "LAYER", g); + let n: ui_node_t = nodes_material_create_node(slot_layer_is_mask(context_raw.layer) ? "LAYER_MASK" : "LAYER", g); n.buttons[0].default_value[0] = index; ui_nodes_get_nodes().nodes_selected_id = [n.id]; } @@ -1375,7 +1375,7 @@ function ui_nodes_accept_layer_drag(index: i32) { function ui_nodes_accept_material_drag(index: i32) { ui_nodes_push_undo(); let g: node_group_t = ui_nodes_group_stack.length > 0 ? ui_nodes_group_stack[ui_nodes_group_stack.length - 1] : null; - let n: zui_node_t = nodes_material_create_node("MATERIAL", g); + let n: ui_node_t = nodes_material_create_node("MATERIAL", g); n.buttons[0].default_value[0] = index; ui_nodes_get_nodes().nodes_selected_id = [n.id]; } @@ -1385,7 +1385,7 @@ function ui_nodes_accept_swatch_drag(swatch: swatch_color_t) { ///if (is_paint || is_sculpt) ui_nodes_push_undo(); let g: node_group_t = ui_nodes_group_stack.length > 0 ? ui_nodes_group_stack[ui_nodes_group_stack.length - 1] : null; - let n: zui_node_t = nodes_material_create_node("RGB", g); + let n: ui_node_t = nodes_material_create_node("RGB", g); n.outputs[0].default_value = f32_array_create_xyzw( color_get_rb(swatch.base) / 255, color_get_gb(swatch.base) / 255, @@ -1396,9 +1396,9 @@ function ui_nodes_accept_swatch_drag(swatch: swatch_color_t) { ///end } -function ui_nodes_make_node(n: zui_node_t, nodes: zui_nodes_t, canvas: zui_node_canvas_t): zui_node_t { - let node: zui_node_t = {}; - node.id = zui_next_node_id(canvas.nodes); +function ui_nodes_make_node(n: ui_node_t, nodes: ui_nodes_t, canvas: ui_node_canvas_t): ui_node_t { + let node: ui_node_t = {}; + node.id = ui_next_node_id(canvas.nodes); node.name = n.name; node.type = n.type; node.x = ui_nodes_get_node_x(); @@ -1411,8 +1411,8 @@ function ui_nodes_make_node(n: zui_node_t, nodes: zui_nodes_t, canvas: zui_node_ let count: i32 = 0; for (let i: i32 = 0; i < n.inputs.length; ++i) { - let soc: zui_node_socket_t = {}; - soc.id = zui_get_socket_id(canvas.nodes) + count; + let soc: ui_node_socket_t = {}; + soc.id = ui_get_socket_id(canvas.nodes) + count; count++; soc.node_id = node.id; soc.name = n.inputs[i].name; @@ -1427,8 +1427,8 @@ function ui_nodes_make_node(n: zui_node_t, nodes: zui_nodes_t, canvas: zui_node_ } for (let i: i32 = 0; i < n.outputs.length; ++i) { - let soc: zui_node_socket_t = {}; - soc.id = zui_get_socket_id(canvas.nodes) + count; + let soc: ui_node_socket_t = {}; + soc.id = ui_get_socket_id(canvas.nodes) + count; count++; soc.node_id = node.id; soc.name = n.outputs[i].name; @@ -1443,7 +1443,7 @@ function ui_nodes_make_node(n: zui_node_t, nodes: zui_nodes_t, canvas: zui_node_ } for (let i: i32 = 0; i < n.buttons.length; ++i) { - let but: zui_node_button_t = {}; + let but: ui_node_button_t = {}; but.name = n.buttons[i].name; but.type = n.buttons[i].type; but.output = n.buttons[i].output; @@ -1459,21 +1459,21 @@ function ui_nodes_make_node(n: zui_node_t, nodes: zui_nodes_t, canvas: zui_node_ return node; } -function ui_nodes_make_group_node(group_canvas: zui_node_canvas_t, nodes: zui_nodes_t, canvas: zui_node_canvas_t): zui_node_t { - let category: zui_node_t[] = nodes_material_list[5]; - let n: zui_node_t = category[0]; - let node: zui_node_t = util_clone_canvas_node(n); +function ui_nodes_make_group_node(group_canvas: ui_node_canvas_t, nodes: ui_nodes_t, canvas: ui_node_canvas_t): ui_node_t { + let category: ui_node_t[] = nodes_material_list[5]; + let n: ui_node_t = category[0]; + let node: ui_node_t = util_clone_canvas_node(n); node.name = group_canvas.name; - node.id = zui_next_node_id(canvas.nodes); + node.id = ui_next_node_id(canvas.nodes); node.x = ui_nodes_get_node_x(); node.y = ui_nodes_get_node_y(); - let group_input: zui_node_t = null; - let group_output: zui_node_t = null; + let group_input: ui_node_t = null; + let group_output: ui_node_t = null; for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; if (g.canvas.name == node.name) { for (let i: i32 = 0; i < g.canvas.nodes.length; ++i) { - let n: zui_node_t = g.canvas.nodes[i]; + let n: ui_node_t = g.canvas.nodes[i]; if (n.type == "GROUP_INPUT") { group_input = n; } @@ -1486,11 +1486,11 @@ function ui_nodes_make_group_node(group_canvas: zui_node_canvas_t, nodes: zui_no } if (group_input != null && group_output != null) { for (let i: i32 = 0; i < group_input.outputs.length; ++i) { - let soc: zui_node_socket_t = group_input.outputs[i]; + let soc: ui_node_socket_t = group_input.outputs[i]; array_push(node.inputs, nodes_material_create_socket(nodes, node, soc.name, soc.type, canvas, soc.min, soc.max, soc.default_value)); } for (let i: i32 = 0; i < group_output.inputs.length; ++i) { - let soc: zui_node_socket_t = group_output.inputs[i]; + let soc: ui_node_socket_t = group_output.inputs[i]; array_push(node.outputs, nodes_material_create_socket(nodes, node, soc.name, soc.type, canvas, soc.min, soc.max, soc.default_value)); } } @@ -1499,13 +1499,13 @@ function ui_nodes_make_group_node(group_canvas: zui_node_canvas_t, nodes: zui_no ///if (is_paint || is_sculpt) function ui_nodes_make_node_preview() { - let ui_nodes: zui_nodes_t = context_raw.material.nodes; + let ui_nodes: ui_nodes_t = context_raw.material.nodes; if (ui_nodes.nodes_selected_id.length == 0) { return; } - let nodes: zui_node_t[] = context_raw.material.canvas.nodes; - let node: zui_node_t = zui_get_node(nodes, ui_nodes.nodes_selected_id[0]); + let nodes: ui_node_t[] = context_raw.material.canvas.nodes; + let node: ui_node_t = ui_get_node(nodes, ui_nodes.nodes_selected_id[0]); context_raw.node_preview_name = node.name; if (node.type == "LAYER" || @@ -1529,9 +1529,9 @@ function ui_nodes_make_node_preview() { } ///end -function ui_nodes_has_group(c: zui_node_canvas_t): bool { +function ui_nodes_has_group(c: ui_node_canvas_t): bool { for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; if (n.type == "GROUP") { return true; } @@ -1539,17 +1539,17 @@ function ui_nodes_has_group(c: zui_node_canvas_t): bool { return false; } -function ui_nodes_traverse_group(mgroups: zui_node_canvas_t[], c: zui_node_canvas_t) { +function ui_nodes_traverse_group(mgroups: ui_node_canvas_t[], c: ui_node_canvas_t) { for (let i: i32 = 0; i < c.nodes.length; ++i) { - let n: zui_node_t = c.nodes[i]; + let n: ui_node_t = c.nodes[i]; if (n.type == "GROUP") { if (ui_nodes_get_group(mgroups, n.name) == null) { - let canvases: zui_node_canvas_t[] = []; + let canvases: ui_node_canvas_t[] = []; for (let i: i32 = 0; i < project_material_groups.length; ++i) { let g: node_group_t = project_material_groups[i]; array_push(canvases, g.canvas); } - let group: zui_node_canvas_t = ui_nodes_get_group(canvases, n.name); + let group: ui_node_canvas_t = ui_nodes_get_group(canvases, n.name); array_push(mgroups, util_clone_canvas(group)); ui_nodes_traverse_group(mgroups, group); } @@ -1557,9 +1557,9 @@ function ui_nodes_traverse_group(mgroups: zui_node_canvas_t[], c: zui_node_canva } } -function ui_nodes_get_group(canvases: zui_node_canvas_t[], name: string): zui_node_canvas_t { +function ui_nodes_get_group(canvases: ui_node_canvas_t[], name: string): ui_node_canvas_t { for (let i: i32 = 0; i < canvases.length; ++i) { - let c: zui_node_canvas_t = canvases[i]; + let c: ui_node_canvas_t = canvases[i]; if (c.name == name) { return c; } diff --git a/base/sources/ui_status.ts b/base/sources/ui_status.ts index 598b34c8..c52b9753 100644 --- a/base/sources/ui_status.ts +++ b/base/sources/ui_status.ts @@ -14,11 +14,11 @@ function ui_status_width(): i32 { } function ui_status_render_ui() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let statush: i32 = config_raw.layout[layout_size_t.STATUS_H]; - if (zui_window(ui_base_hwnds[tab_area_t.STATUS], app_x(), sys_height() - statush, ui_status_width(), statush)) { + if (ui_window(ui_base_hwnds[tab_area_t.STATUS], app_x(), sys_height() - statush, ui_status_width(), statush)) { ui._y += 2; // Border @@ -28,7 +28,7 @@ function ui_status_render_ui() { // Draw tabs let hwnd_draws: tab_draw_t[] = ui_base_hwnd_tabs[tab_area_t.STATUS]; - let htab: zui_handle_t = ui_base_htabs[tab_area_t.STATUS]; + let htab: ui_handle_t = ui_base_htabs[tab_area_t.STATUS]; for (let i: i32 = 0; i < hwnd_draws.length; ++i) { let draw: tab_draw_t = hwnd_draws[i]; draw.f(htab); @@ -42,12 +42,12 @@ function ui_status_render_ui() { } } -function ui_status_draw_version_tab(htab: zui_handle_t) { +function ui_status_draw_version_tab(htab: ui_handle_t) { // Version label if (!config_raw.touch_ui) { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; ui.enabled = false; - zui_tab(ui_base_htabs[tab_area_t.STATUS], manifest_version); + ui_tab(ui_base_htabs[tab_area_t.STATUS], manifest_version); ui.enabled = true; } } diff --git a/base/sources/ui_toolbar.ts b/base/sources/ui_toolbar.ts index d4d2ae8f..33e46564 100644 --- a/base/sources/ui_toolbar.ts +++ b/base/sources/ui_toolbar.ts @@ -3,7 +3,7 @@ let ui_toolbar_default_w: i32 = 36; -let ui_toolbar_handle: zui_handle_t = zui_handle_create(); +let ui_toolbar_handle: ui_handle_t = ui_handle_create(); let ui_toolbar_w: i32 = ui_toolbar_default_w; let ui_toolbar_last_tool: i32 = 0; @@ -29,7 +29,7 @@ function ui_toolbar_init() { let _ui_toolbar_i: i32; -function ui_toolbar_draw_tool(i: i32, ui: zui_t, img: image_t, icon_accent: i32, keys: string[]) { +function ui_toolbar_draw_tool(i: i32, ui: ui_t, img: image_t, icon_accent: i32, keys: string[]) { ui._x += 2; if (context_raw.tool == i) { ui_toolbar_draw_highlight(); @@ -39,14 +39,14 @@ function ui_toolbar_draw_tool(i: i32, ui: zui_t, img: image_t, icon_accent: i32, let rect: rect_t = resource_tile50(img, tile_x, tile_y); let _y: i32 = ui._y; - let image_state: zui_state_t = _zui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h); - if (image_state == zui_state_t.STARTED) { + let image_state: ui_state_t = _ui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h); + if (image_state == ui_state_t.STARTED) { _ui_toolbar_i = i; app_notify_on_next_frame(function() { context_select_tool(_ui_toolbar_i); }); } - else if (image_state == zui_state_t.RELEASED && config_raw.layout[layout_size_t.HEADER] == 0) { + else if (image_state == ui_state_t.RELEASED && config_raw.layout[layout_size_t.HEADER] == 0) { if (ui_toolbar_last_tool == i) { ui_toolbar_tool_properties_menu(); } @@ -56,19 +56,19 @@ function ui_toolbar_draw_tool(i: i32, ui: zui_t, img: image_t, icon_accent: i32, ///if is_paint if (i == workspace_tool_t.COLORID && context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); - g2_draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * zui_SCALE(ui), 5 * zui_SCALE(ui), 34 * zui_SCALE(ui)); + g2_draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * ui_SCALE(ui), 5 * ui_SCALE(ui), 34 * ui_SCALE(ui)); } ///end if (ui.is_hovered) { - zui_tooltip(tr(ui_toolbar_tool_names[i]) + " " + keys[i]); + ui_tooltip(tr(ui_toolbar_tool_names[i]) + " " + keys[i]); } ui._x -= 2; ui._y += 2; } function ui_toolbar_render_ui() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; if (config_raw.touch_ui) { ui_toolbar_w = ui_toolbar_default_w + 6; @@ -76,10 +76,10 @@ function ui_toolbar_render_ui() { else { ui_toolbar_w = ui_toolbar_default_w; } - ui_toolbar_w = math_floor(ui_toolbar_w * zui_SCALE(ui)); + ui_toolbar_w = math_floor(ui_toolbar_w * ui_SCALE(ui)); - if (zui_window(ui_toolbar_handle, 0, ui_header_h, ui_toolbar_w, sys_height() - ui_header_h)) { - ui._y -= 4 * zui_SCALE(ui); + if (ui_window(ui_toolbar_handle, 0, ui_header_h, ui_toolbar_w, sys_height() - ui_header_h)) { + ui._y -= 4 * ui_SCALE(ui); ui.image_scroll_align = false; let img: image_t = resource_get("icons.k"); @@ -91,7 +91,7 @@ function ui_toolbar_render_ui() { // Properties icon if (config_raw.layout[layout_size_t.HEADER] == 1) { let rect: rect_t = resource_tile50(img, 7, 1); - if (_zui_image(img, light ? 0xff666666 : ui.ops.theme.BUTTON_COL, -1.0, rect.x, rect.y, rect.w, rect.h) == zui_state_t.RELEASED) { + if (_ui_image(img, light ? 0xff666666 : ui.ops.theme.BUTTON_COL, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED) { config_raw.layout[layout_size_t.HEADER] = 0; } } @@ -105,11 +105,11 @@ function ui_toolbar_render_ui() { ui.ops.theme.BUTTON_H = ui.ops.theme.ELEMENT_H; ui.ops.theme.BUTTON_COL = ui.ops.theme.WINDOW_BG_COL; let font_height: i32 = g2_font_height(ui.ops.font, ui.font_size); - ui.font_offset_y = (zui_ELEMENT_H(ui) - font_height) / 2; + ui.font_offset_y = (ui_ELEMENT_H(ui) - font_height) / 2; let _w: i32 = ui._w; ui._w = ui_toolbar_w; - if (zui_button(">>")) { + if (ui_button(">>")) { ui_toolbar_tool_properties_menu(); } @@ -120,9 +120,9 @@ function ui_toolbar_render_ui() { ui.font_offset_y = _fontOffsetY; } if (ui.is_hovered) { - zui_tooltip(tr("Toggle header")); + ui_tooltip(tr("Toggle header")); } - ui._y -= 4 * zui_SCALE(ui); + ui._y -= 4 * ui_SCALE(ui); let vars_brush: map_t = map_create(); map_set(vars_brush, "key", map_get(config_keymap, "brush_ruler")); @@ -208,7 +208,7 @@ function ui_toolbar_render_ui() { // Hide scrollbar let _SCROLL_W: i32 = ui.ops.theme.SCROLL_W; ui.ops.theme.SCROLL_W = 0; - zui_end_window(); + ui_end_window(); ui.ops.theme.SCROLL_W = _SCROLL_W; } } @@ -218,11 +218,11 @@ let _ui_toolbar_tool_properties_menu_y: i32; let _ui_toolbar_tool_properties_menu_w: i32; function ui_toolbar_tool_properties_menu() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; _ui_toolbar_tool_properties_menu_x = ui._x; _ui_toolbar_tool_properties_menu_y = ui._y; _ui_toolbar_tool_properties_menu_w = ui._w; - ui_menu_draw(function (ui: zui_t) { + ui_menu_draw(function (ui: ui_t) { let start_y: i32 = ui._y; ui.changed = false; @@ -232,14 +232,14 @@ function ui_toolbar_tool_properties_menu() { ui_menu_keep_open = true; } - if (zui_button(tr("Pin to Header"), zui_align_t.LEFT)) { + if (ui_button(tr("Pin to Header"), ui_align_t.LEFT)) { config_raw.layout[layout_size_t.HEADER] = 1; } let h: i32 = ui._y - start_y; - ui_menu_elements = math_floor(h / zui_ELEMENT_H(ui)); + ui_menu_elements = math_floor(h / ui_ELEMENT_H(ui)); ui_menu_x = math_floor(_ui_toolbar_tool_properties_menu_x + _ui_toolbar_tool_properties_menu_w + 2); - ui_menu_y = math_floor(_ui_toolbar_tool_properties_menu_y - 6 * zui_SCALE(ui)); + ui_menu_y = math_floor(_ui_toolbar_tool_properties_menu_y - 6 * ui_SCALE(ui)); ui_menu_fit_to_screen(); }, 0); @@ -250,10 +250,10 @@ function ui_toolbar_tool_properties_menu() { } function ui_toolbar_draw_highlight() { - let ui: zui_t = ui_base_ui; + let ui: ui_t = ui_base_ui; let size: i32 = ui_toolbar_w - 4; g2_set_color(ui.ops.theme.HIGHLIGHT_COL); - zui_draw_rect(true, ui._x + -1, ui._y + 2, size + 2, size + 2); + ui_draw_rect(true, ui._x + -1, ui._y + 2, size + 2, size + 2); } ///end diff --git a/base/sources/ui_view2d.ts b/base/sources/ui_view2d.ts index 04ac97a8..cc7995af 100644 --- a/base/sources/ui_view2d.ts +++ b/base/sources/ui_view2d.ts @@ -19,8 +19,8 @@ let ui_view2d_wx: i32; let ui_view2d_wy: i32; let ui_view2d_ww: i32; let ui_view2d_wh: i32; -let ui_view2d_ui: zui_t; -let ui_view2d_hwnd: zui_handle_t = zui_handle_create(); +let ui_view2d_ui: ui_t; +let ui_view2d_hwnd: ui_handle_t = ui_handle_create(); let ui_view2d_pan_x: f32 = 0.0; let ui_view2d_pan_y: f32 = 0.0; let ui_view2d_pan_scale: f32 = 1.0; @@ -45,14 +45,14 @@ function ui_view2d_init() { ///end let scale: f32 = config_raw.window_scale; - let ops: zui_options_t = { + let ops: ui_options_t = { theme: base_theme, font: base_font, color_wheel: base_color_wheel.texture_, black_white_gradient: base_color_wheel_gradient.texture_, scale_factor: scale }; - ui_view2d_ui = zui_create(ops); + ui_view2d_ui = ui_create(ops); ui_view2d_ui.scroll_enabled = false; } @@ -113,7 +113,7 @@ function ui_view2d_render() { } ///end - zui_begin(ui_view2d_ui); + ui_begin(ui_view2d_ui); let headerh: i32 = config_raw.layout[layout_size_t.HEADER] == 1 ? ui_header_h * 2 : ui_header_h; let apph: i32 = sys_height() - config_raw.layout[layout_size_t.STATUS_H] + headerh; @@ -124,9 +124,9 @@ function ui_view2d_render() { if (config_raw.touch_ui) ui_view2d_wh += ui_header_h; } - if (zui_window(ui_view2d_hwnd, ui_view2d_wx, ui_view2d_wy, ui_view2d_ww, ui_view2d_wh)) { + if (ui_window(ui_view2d_hwnd, ui_view2d_wx, ui_view2d_wy, ui_view2d_ww, ui_view2d_wh)) { - zui_tab(zui_handle(__ID__), tr("2D View")); + ui_tab(ui_handle(__ID__), tr("2D View")); // Grid g2_set_color(0xffffffff); @@ -158,9 +158,9 @@ function ui_view2d_render() { ///else - let nodes: zui_nodes_t = ui_nodes_get_nodes(); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); if (nodes.nodes_selected_id.length > 0) { - let sel: zui_node_t = zui_get_node(ui_nodes_get_canvas(true).nodes, nodes.nodes_selected_id[0]); + let sel: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, nodes.nodes_selected_id[0]); let brush_node: logic_node_t = parser_logic_get_logic_node(sel); if (brush_node != null) { tex = logic_node_get_cached_image(brush_node); @@ -297,18 +297,18 @@ function ui_view2d_render() { ///end // Menu - let ew: i32 = math_floor(zui_ELEMENT_W(ui_view2d_ui)); + let ew: i32 = math_floor(ui_ELEMENT_W(ui_view2d_ui)); g2_set_color(ui_view2d_ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, zui_ELEMENT_H(ui_view2d_ui), ui_view2d_ww, zui_ELEMENT_H(ui_view2d_ui) + zui_ELEMENT_OFFSET(ui_view2d_ui) * 2); + g2_fill_rect(0, ui_ELEMENT_H(ui_view2d_ui), ui_view2d_ww, ui_ELEMENT_H(ui_view2d_ui) + ui_ELEMENT_OFFSET(ui_view2d_ui) * 2); g2_set_color(0xffffffff); - let start_y: f32 = zui_ELEMENT_H(ui_view2d_ui) + zui_ELEMENT_OFFSET(ui_view2d_ui); + let start_y: f32 = ui_ELEMENT_H(ui_view2d_ui) + ui_ELEMENT_OFFSET(ui_view2d_ui); ui_view2d_ui._x = 2; ui_view2d_ui._y = 2 + start_y; ui_view2d_ui._w = ew; // Editable layer name - let h: zui_handle_t = zui_handle(__ID__); + let h: ui_handle_t = ui_handle(__ID__); ///if (is_paint || is_sculpt) let text: string = ui_view2d_type == view_2d_type_t.NODE ? context_raw.node_preview_name : h.text; @@ -316,7 +316,7 @@ function ui_view2d_render() { let text: string = h.text; ///end - ui_view2d_ui._w = math_floor(math_min(g2_font_width(ui_view2d_ui.ops.font, ui_view2d_ui.font_size, text) + 15 * zui_SCALE(ui_view2d_ui), 100 * zui_SCALE(ui_view2d_ui))); + ui_view2d_ui._w = math_floor(math_min(g2_font_width(ui_view2d_ui.ops.font, ui_view2d_ui.font_size, text) + 15 * ui_SCALE(ui_view2d_ui), 100 * ui_SCALE(ui_view2d_ui))); if (ui_view2d_type == view_2d_type_t.ASSET) { let asset: asset_t = context_raw.texture; @@ -324,20 +324,20 @@ function ui_view2d_render() { let asset_names: string[] = project_asset_names; let i: i32 = array_index_of(asset_names, asset.name); h.text = asset.name; - asset.name = zui_text_input(h, ""); + asset.name = ui_text_input(h, ""); asset_names[i] = asset.name; } } else if (ui_view2d_type == view_2d_type_t.NODE) { ///if (is_paint || is_sculpt) - zui_text(context_raw.node_preview_name); + ui_text(context_raw.node_preview_name); ///else - let nodes: zui_nodes_t = ui_nodes_get_nodes(); + let nodes: ui_nodes_t = ui_nodes_get_nodes(); if (nodes.nodes_selected_id.length > 0) { - zui_text(zui_get_node(ui_nodes_get_canvas(true).nodes, nodes.nodes_selected_id[0]).name); + ui_text(ui_get_node(ui_nodes_get_canvas(true).nodes, nodes.nodes_selected_id[0]).name); } ///end @@ -345,12 +345,12 @@ function ui_view2d_render() { ///if (is_paint || is_sculpt) else if (ui_view2d_type == view_2d_type_t.LAYER) { h.text = l.name; - l.name = zui_text_input(h, ""); + l.name = ui_text_input(h, ""); ui_view2d_text_input_hover = ui_view2d_ui.is_hovered; } else if (ui_view2d_type == view_2d_type_t.FONT) { h.text = context_raw.font.name; - context_raw.font.name = zui_text_input(h, ""); + context_raw.font.name = ui_text_input(h, ""); } ///end @@ -363,17 +363,17 @@ function ui_view2d_render() { ///if (is_paint || is_sculpt) if (ui_view2d_type == view_2d_type_t.LAYER) { - let h_layer_mode: zui_handle_t = zui_handle(__ID__); + let h_layer_mode: ui_handle_t = ui_handle(__ID__); if (h_layer_mode.init) { h_layer_mode.position = ui_view2d_layer_mode; } let layer_mode_combo: string[] = [tr("Visible"), tr("Selected")]; - ui_view2d_layer_mode = zui_combo(h_layer_mode, layer_mode_combo, tr("Layers")); + ui_view2d_layer_mode = ui_combo(h_layer_mode, layer_mode_combo, tr("Layers")); ui_view2d_ui._x += ew + 3; ui_view2d_ui._y = 2 + start_y; if (!slot_layer_is_mask(context_raw.layer)) { - let h_tex_type: zui_handle_t = zui_handle(__ID__); + let h_tex_type: ui_handle_t = ui_handle(__ID__); if (h_tex_type.init) { h_tex_type.position = ui_view2d_tex_type; } @@ -386,50 +386,50 @@ function ui_view2d_render() { tr("Opacity"), tr("Height"), ]; - ui_view2d_tex_type = zui_combo(h_tex_type, tex_type_combo, tr("Texture")); + ui_view2d_tex_type = ui_combo(h_tex_type, tex_type_combo, tr("Texture")); ui_view2d_ui._x += ew + 3; ui_view2d_ui._y = 2 + start_y; } ui_view2d_ui._w = math_floor(ew * 0.7 + 3); - let h_uvmap_show: zui_handle_t = zui_handle(__ID__); + let h_uvmap_show: ui_handle_t = ui_handle(__ID__); if (h_uvmap_show.init) { h_uvmap_show.selected = ui_view2d_uvmap_show; } - ui_view2d_uvmap_show = zui_check(h_uvmap_show, tr("UV Map")); + ui_view2d_uvmap_show = ui_check(h_uvmap_show, tr("UV Map")); ui_view2d_ui._x += ew * 0.7 + 3; ui_view2d_ui._y = 2 + start_y; } ///end - let h_tiled_show: zui_handle_t = zui_handle(__ID__); + let h_tiled_show: ui_handle_t = ui_handle(__ID__); if (h_tiled_show.init) { h_tiled_show.selected = ui_view2d_tiled_show; } - ui_view2d_tiled_show = zui_check(h_tiled_show, tr("Tiled")); + ui_view2d_tiled_show = ui_check(h_tiled_show, tr("Tiled")); ui_view2d_ui._x += ew * 0.7 + 3; ui_view2d_ui._y = 2 + start_y; if (ui_view2d_type == view_2d_type_t.ASSET && tex != null) { // Texture resolution - zui_text(tex.width + "x" + tex.height); + ui_text(tex.width + "x" + tex.height); } // Picked position ///if (is_paint || is_sculpt) if (context_raw.tool == workspace_tool_t.PICKER && (ui_view2d_type == view_2d_type_t.LAYER || ui_view2d_type == view_2d_type_t.ASSET)) { let cursor_img: image_t = resource_get("cursor.k"); - let hsize: f32 = 16 * zui_SCALE(ui_view2d_ui); + let hsize: f32 = 16 * ui_SCALE(ui_view2d_ui); let size: f32 = hsize * 2; g2_draw_scaled_image(cursor_img, tx + tw * context_raw.uvx_picked - hsize, ty + th * context_raw.uvy_picked - hsize, size, size); } ///end } - zui_end(); + ui_end(); g2_begin(null); } function ui_view2d_update() { - let headerh: f32 = zui_ELEMENT_H(ui_view2d_ui) * 1.4; + let headerh: f32 = ui_ELEMENT_H(ui_view2d_ui) * 1.4; ///if (is_paint || is_sculpt) context_raw.paint2d = false; @@ -442,13 +442,13 @@ function ui_view2d_update() { mouse_y < ui_view2d_wy + headerh || mouse_y > ui_view2d_wy + ui_view2d_wh) { if (ui_view2d_controls_down) { - let control: zui_canvas_control_t = ui_nodes_get_canvas_control(ui_view2d_ui, ui_view2d_controls_down); + let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_view2d_ui, ui_view2d_controls_down); ui_view2d_controls_down = control.controls_down; } return; } - let control: zui_canvas_control_t = ui_nodes_get_canvas_control(ui_view2d_ui, ui_view2d_controls_down); + let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_view2d_ui, ui_view2d_controls_down); ui_view2d_pan_x += control.pan_x; ui_view2d_pan_y += control.pan_y; ui_view2d_controls_down = control.controls_down; @@ -465,7 +465,7 @@ function ui_view2d_update() { ui_view2d_pan_x = _pan_x * ui_view2d_pan_scale; ui_view2d_pan_y = _pan_y * ui_view2d_pan_scale; - if (zui_touch_scroll) { + if (ui_touch_scroll) { // Zoom to finger location ui_view2d_pan_x -= (ui_view2d_ui.input_x - ui_view2d_ui._window_x - ui_view2d_ui._window_w / 2) * control.zoom; ui_view2d_pan_y -= (ui_view2d_ui.input_y - ui_view2d_ui._window_y - ui_view2d_ui._window_h / 2) * control.zoom; diff --git a/base/sources/util_clone.ts b/base/sources/util_clone.ts index 321f9cef..647a6609 100644 --- a/base/sources/util_clone.ts +++ b/base/sources/util_clone.ts @@ -44,13 +44,13 @@ function util_clone_bool_array(a: bool[]): bool[] { return r; } -function util_clone_canvas_sockets(sockets: zui_node_socket_t[]): zui_node_socket_t[] { +function util_clone_canvas_sockets(sockets: ui_node_socket_t[]): ui_node_socket_t[] { if (sockets == null) { return null; } - let r: zui_node_socket_t[] = []; + let r: ui_node_socket_t[] = []; for (let i: i32 = 0; i < sockets.length; ++i) { - let s: zui_node_socket_t = {}; + let s: ui_node_socket_t = {}; s.id = sockets[i].id;; s.node_id = sockets[i].node_id; s.name = sockets[i].name; @@ -66,13 +66,13 @@ function util_clone_canvas_sockets(sockets: zui_node_socket_t[]): zui_node_socke return r; } -function util_clone_canvas_buttons(buttons: zui_node_button_t[]): zui_node_button_t[] { +function util_clone_canvas_buttons(buttons: ui_node_button_t[]): ui_node_button_t[] { if (buttons == null) { return null; } - let r: zui_node_button_t[] = []; + let r: ui_node_button_t[] = []; for (let i: i32 = 0; i < buttons.length; ++i) { - let b: zui_node_button_t = {}; + let b: ui_node_button_t = {}; b.name = buttons[i].name; b.type = buttons[i].type; b.output = buttons[i].output; @@ -87,11 +87,11 @@ function util_clone_canvas_buttons(buttons: zui_node_button_t[]): zui_node_butto return r; } -function util_clone_canvas_node(n: zui_node_t): zui_node_t { +function util_clone_canvas_node(n: ui_node_t): ui_node_t { if (n == null) { return null; } - let r: zui_node_t = {}; + let r: ui_node_t = {}; r.id = n.id; r.name = n.name; r.type = n.type; @@ -105,25 +105,25 @@ function util_clone_canvas_node(n: zui_node_t): zui_node_t { return r; } -function util_clone_canvas_nodes(nodes: zui_node_t[]): zui_node_t[] { +function util_clone_canvas_nodes(nodes: ui_node_t[]): ui_node_t[] { if (nodes == null) { return null; } - let r: zui_node_t[] = []; + let r: ui_node_t[] = []; for (let i: i32 = 0; i < nodes.length; ++i) { - let n: zui_node_t = util_clone_canvas_node(nodes[i]); + let n: ui_node_t = util_clone_canvas_node(nodes[i]); array_push(r, n); } return r; } -function util_clone_canvas_links(links: zui_node_link_t[]): zui_node_link_t[] { +function util_clone_canvas_links(links: ui_node_link_t[]): ui_node_link_t[] { if (links == null) { return null; } - let r: zui_node_link_t[] = []; + let r: ui_node_link_t[] = []; for (let i: i32 = 0; i < links.length; ++i) { - let l: zui_node_link_t = {}; + let l: ui_node_link_t = {}; l.id = links[i].id; l.from_id = links[i].from_id; l.from_socket = links[i].from_socket; @@ -134,11 +134,11 @@ function util_clone_canvas_links(links: zui_node_link_t[]): zui_node_link_t[] { return r; } -function util_clone_canvas(c: zui_node_canvas_t): zui_node_canvas_t { +function util_clone_canvas(c: ui_node_canvas_t): ui_node_canvas_t { if (c == null) { return null; } - let r: zui_node_canvas_t = {}; + let r: ui_node_canvas_t = {}; r.name = c.name; r.nodes = util_clone_canvas_nodes(c.nodes); r.links = util_clone_canvas_links(c.links); diff --git a/base/sources/util_encode.ts b/base/sources/util_encode.ts index c3bd869e..f7bba53f 100644 --- a/base/sources/util_encode.ts +++ b/base/sources/util_encode.ts @@ -8,8 +8,8 @@ function util_encode_scene(raw: scene_t): buffer_t { // armpack_encode_string(canvas->name); } -function util_encode_node_canvas(c: zui_node_canvas_t) { - zui_node_canvas_encode(c); +function util_encode_node_canvas(c: ui_node_canvas_t) { + ui_node_canvas_encode(c); } function util_encode_project(raw: project_format_t): buffer_t { @@ -240,8 +240,8 @@ function util_encode_project(raw: project_format_t): buffer_t { ///end ///if is_lab - // material?: zui_node_canvas_t; - // material_groups?: zui_node_canvas_t[]; + // material?: ui_node_canvas_t; + // material_groups?: ui_node_canvas_t[]; // mesh_data?: mesh_data_t; // mesh_icon?: buffer_t; ///end diff --git a/base/sources/util_render.ts b/base/sources/util_render.ts index cbff90e2..2aac5119 100644 --- a/base/sources/util_render.ts +++ b/base/sources/util_render.ts @@ -373,7 +373,7 @@ function util_render_make_brush_preview() { if (g2_in_use) g2_begin(current); } -function util_render_make_node_preview(canvas: zui_node_canvas_t, node: zui_node_t, image: image_t, group: zui_node_canvas_t = null, parents: zui_node_t[] = null) { +function util_render_make_node_preview(canvas: ui_node_canvas_t, node: ui_node_t, image: image_t, group: ui_node_canvas_t = null, parents: ui_node_t[] = null) { let res: parse_node_preview_result_t = make_material_parse_node_preview_material(node, group, parents); if (res == null || res.scon == null) { return; diff --git a/base/tools/pad/project.js b/base/tools/pad/project.js index 30d63d3a..4e8db7df 100644 --- a/base/tools/pad/project.js +++ b/base/tools/pad/project.js @@ -6,7 +6,7 @@ flags.with_nfd = true; flags.with_tinydir = true; flags.with_g2 = true; flags.with_iron = true; -flags.with_zui = true; +flags.with_ui = true; let project = new Project("ArmorPad"); project.addSources("sources"); diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index a707758a..2a627c26 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -12,11 +12,11 @@ type storage_t = { sidebar_w?: i32; }; -let ui: zui_t; -let theme: zui_theme_t; -let text_handle: zui_handle_t = zui_handle_create(); -let sidebar_handle: zui_handle_t = zui_handle_create(); -let editor_handle: zui_handle_t = zui_handle_create(); +let ui: ui_t; +let theme: ui_theme_t; +let text_handle: ui_handle_t = ui_handle_create(); +let sidebar_handle: ui_handle_t = ui_handle_create(); +let editor_handle: ui_handle_t = ui_handle_create(); let storage: storage_t = null; let resizing_sidebar: bool = false; let minimap_w: i32 = 150; @@ -82,22 +82,22 @@ function main() { g2_font_init(font); theme = {}; - zui_theme_default(theme); + ui_theme_default(theme); - let zui_ops: zui_options_t = { + let ui_ops: ui_options_t = { scale_factor: 1.0, theme: theme, font: font }; - ui = zui_create(zui_ops); + ui = ui_create(ui_ops); let blob_coloring: buffer_t = data_get_blob("text_coloring.json"); - let text_coloring: zui_text_coloring_t = json_parse(sys_buffer_to_string(blob_coloring)); - zui_text_area_coloring = text_coloring; - zui_on_border_hover = on_border_hover; - zui_on_text_hover = on_text_hover; - zui_text_area_line_numbers = true; - zui_text_area_scroll_past_end = true; + let text_coloring: ui_text_coloring_t = json_parse(sys_buffer_to_string(blob_coloring)); + ui_text_area_coloring = text_coloring; + ui_on_border_hover = on_border_hover; + ui_on_text_hover = on_text_hover; + ui_text_area_line_numbers = true; + ui_text_area_scroll_past_end = true; sys_notify_on_frames(render); krom_set_drop_files_callback(drop_files); @@ -118,7 +118,7 @@ function list_folder(path: string) { // Active file if (abs == storage.file) { - zui_fill(0, 1, ui._w - 1, ZUI_ELEMENT_H() - 1, theme.BUTTON_PRESSED_COL); + ui_fill(0, 1, ui._w - 1, UI_ELEMENT_H() - 1, theme.BUTTON_PRESSED_COL); } let prefix: string = ""; @@ -126,7 +126,7 @@ function list_folder(path: string) { prefix = is_expanded ? "- " : "+ "; } - if (zui_button(prefix + f, ZUI_ALIGN_LEFT, "")) { + if (ui_button(prefix + f, UI_ALIGN_LEFT, "")) { // Open file if (is_file) { storage.file = abs; @@ -158,28 +158,28 @@ function render() { krom_set_mouse_cursor(0); // Arrow } - zui_begin(ui); + ui_begin(ui); - if (zui_window(sidebar_handle, 0, 0, storage.sidebar_w, sys_height(), false)) { + if (ui_window(sidebar_handle, 0, 0, storage.sidebar_w, sys_height(), false)) { let _BUTTON_TEXT_COL: i32 = theme.BUTTON_TEXT_COL; theme.BUTTON_TEXT_COL = theme.ACCENT_COL; if (storage.project != "") { list_folder(storage.project); } else { - zui_button("Drop folder here", ZUI_ALIGN_LEFT, ""); + ui_button("Drop folder here", UI_ALIGN_LEFT, ""); } theme.BUTTON_TEXT_COL = _BUTTON_TEXT_COL; } - zui_fill(sys_width() - minimap_w, 0, minimap_w, ZUI_ELEMENT_H() + ZUI_ELEMENT_OFFSET() + 1, theme.SEPARATOR_COL); - zui_fill(storage.sidebar_w, 0, 1, sys_height(), theme.SEPARATOR_COL); + ui_fill(sys_width() - minimap_w, 0, minimap_w, UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 1, theme.SEPARATOR_COL); + ui_fill(storage.sidebar_w, 0, 1, sys_height(), theme.SEPARATOR_COL); let editor_updated: bool = false; - if (zui_window(editor_handle, storage.sidebar_w + 1, 0, sys_width() - storage.sidebar_w - minimap_w, sys_height(), false)) { + if (ui_window(editor_handle, storage.sidebar_w + 1, 0, sys_width() - storage.sidebar_w - minimap_w, sys_height(), false)) { editor_updated = true; - let htab: zui_handle_t = zui_handle(__ID__); + let htab: ui_handle_t = ui_handle(__ID__); let file_name: string = substring(storage.file, string_last_index_of(storage.file, "/") + 1, storage.file.length); let file_names: string[] = [file_name]; @@ -188,7 +188,7 @@ function render() { if (storage.modified) { tab_name += "*"; } - if (zui_tab(htab, tab_name, false, -1)) { + if (ui_tab(htab, tab_name, false, -1)) { // File modified if (ui.is_key_pressed) { storage.modified = true; @@ -199,8 +199,8 @@ function render() { save_file(); } - // storage.text = zui_text_area(text_handle, ZUI_ALIGN_LEFT, true, "", false); - zui_text_area(text_handle, ZUI_ALIGN_LEFT, true, "", false); + // storage.text = ui_text_area(text_handle, UI_ALIGN_LEFT, true, "", false); + ui_text_area(text_handle, UI_ALIGN_LEFT, true, "", false); } } @@ -234,7 +234,7 @@ function render() { build_project(); } - zui_end(false); + ui_end(false); if (redraw) { editor_handle.redraws = 2; @@ -293,7 +293,7 @@ function draw_minimap() { g2_set_color(0xff333333); let lines: string[] = string_split(storage.text, "\n"); let minimap_full_h: i32 = lines.length * 2; - let scroll_progress: f32 = -editor_handle.scroll_offset / (lines.length * ZUI_ELEMENT_H()); + let scroll_progress: f32 = -editor_handle.scroll_offset / (lines.length * UI_ELEMENT_H()); let out_of_screen: i32 = minimap_full_h - minimap_h; if (out_of_screen < 0) { out_of_screen = 0; @@ -317,7 +317,7 @@ function draw_minimap() { // Current position let visible_area: i32 = out_of_screen > 0 ? minimap_h : minimap_full_h; g2_set_color(0x11ffffff); - minimap_box_h = math_floor((sys_height() - window_header_h) / ZUI_ELEMENT_H() * 2); + minimap_box_h = math_floor((sys_height() - window_header_h) / UI_ELEMENT_H() * 2); g2_fill_rect(0, scroll_progress * visible_area, minimap_w, minimap_box_h); g2_end(); } @@ -326,7 +326,7 @@ function hit_test(mx: f32, my: f32, x: f32, y: f32, w: f32, h: f32): bool { return mx > x && mx < x + w && my > y && my < y + h; } -function on_border_hover(handle: zui_handle_t, side: i32) { +function on_border_hover(handle: ui_handle_t, side: i32) { if (handle != sidebar_handle) { return; } @@ -336,7 +336,7 @@ function on_border_hover(handle: zui_handle_t, side: i32) { krom_set_mouse_cursor(3); // Horizontal - if (zui_get_current().input_started) { + if (ui_get_current().input_started) { resizing_sidebar = true; } }