From 19f215457e858bf54036ad2df0c38e183cb0c53b Mon Sep 17 00:00:00 2001 From: luboslenco Date: Fri, 21 Nov 2025 00:44:08 +0100 Subject: [PATCH] Use ui_window title --- base/sources/iron_ui.c | 6 +- paint/sources/box_preferences.ts | 123 +++++++++++----------- paint/sources/project.ts | 168 +++++++++++++++---------------- paint/sources/ui_box.ts | 63 ++++++------ paint/sources/ui_menubar.ts | 54 +++++----- paint/sources/ui_nodes.ts | 80 +++++++-------- 6 files changed, 238 insertions(+), 256 deletions(-) diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index 6c89814a..4708e025 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -97,7 +97,7 @@ float UI_TAB_W() { } float UI_HEADER_DRAG_H() { - return 15.0 * UI_SCALE(); + return 30.0 * UI_SCALE(); } float UI_TOOLTIP_DELAY() { @@ -1598,6 +1598,10 @@ void ui_end_window() { if (handle->drag_enabled) { // Draggable header draw_set_color(theme->SEPARATOR_COL); draw_filled_rect(0, 0, current->_window_w, UI_HEADER_DRAG_H()); + if (handle->text != NULL) { // Window title + draw_set_color(theme->TEXT_COL); + draw_string(handle->text, current->_window_w / 2 - draw_string_width(current->ops->font, current->font_size, handle->text) / 2, 10 * UI_SCALE()); + } } float window_size = handle->layout == UI_LAYOUT_VERTICAL ? current->_window_h - current->window_header_h diff --git a/paint/sources/box_preferences.ts b/paint/sources/box_preferences.ts index c92124a4..c1789483 100644 --- a/paint/sources/box_preferences.ts +++ b/paint/sources/box_preferences.ts @@ -202,29 +202,27 @@ function box_preferences_theme_tab() { if (ui_button(tr("New"))) { ui_box_show_custom(function() { - if (ui_tab(ui_handle(__ID__), tr("New Theme"))) { - ui_row2(); - let h: ui_handle_t = ui_handle(__ID__); - if (h.init) { - h.text = "new_theme"; - } - 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"; - } - let path: string = path_data() + path_sep + "themes" + path_sep + theme_name; - iron_file_save_bytes(path, sys_string_to_buffer(template), 0); - box_preferences_fetch_themes(); // Refresh file list - config_raw.theme = theme_name; - box_preferences_theme_handle.i = box_preferences_get_theme_index(); - ui_box_hide(); - box_preferences_htab.i = 1; // Themes - box_preferences_show(); - } + ui_row2(); + let h: ui_handle_t = ui_handle(__ID__); + if (h.init) { + h.text = "new_theme"; } - }); + 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"; + } + let path: string = path_data() + path_sep + "themes" + path_sep + theme_name; + iron_file_save_bytes(path, sys_string_to_buffer(template), 0); + box_preferences_fetch_themes(); // Refresh file list + config_raw.theme = theme_name; + box_preferences_theme_handle.i = box_preferences_get_theme_index(); + ui_box_hide(); + box_preferences_htab.i = 1; // Themes + box_preferences_show(); + } + }, 400, 200, null, true, tr("New Theme")); } if (ui_button(tr("Import"))) { @@ -637,29 +635,27 @@ function box_preferences_keymap_tab() { if (ui_button(tr("New"))) { ui_box_show_custom(function() { - if (ui_tab(ui_handle(__ID__), tr("New Keymap"))) { - ui_row2(); - let h: ui_handle_t = ui_handle(__ID__); - if (h.init) { - h.text = "new_keymap"; - } - let keymap_name: string = ui_text_input(h, tr("Name")); - if (ui_button(tr("OK")) || ui.is_return_down) { - let template: string = keymap_to_json(keymap_get_default()); - if (!ends_with(keymap_name, ".json")) { - keymap_name += ".json"; - } - let path: string = path_data() + path_sep + "keymap_presets" + path_sep + keymap_name; - iron_file_save_bytes(path, sys_string_to_buffer(template), 0); - box_preferences_fetch_keymaps(); // Refresh file list - config_raw.keymap = keymap_name; - box_preferences_preset_handle.i = box_preferences_get_preset_index(); - ui_box_hide(); - box_preferences_htab.i = 5; // Keymap - box_preferences_show(); - } + ui_row2(); + let h: ui_handle_t = ui_handle(__ID__); + if (h.init) { + h.text = "new_keymap"; } - }); + let keymap_name: string = ui_text_input(h, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { + let template: string = keymap_to_json(keymap_get_default()); + if (!ends_with(keymap_name, ".json")) { + keymap_name += ".json"; + } + let path: string = path_data() + path_sep + "keymap_presets" + path_sep + keymap_name; + iron_file_save_bytes(path, sys_string_to_buffer(template), 0); + box_preferences_fetch_keymaps(); // Refresh file list + config_raw.keymap = keymap_name; + box_preferences_preset_handle.i = box_preferences_get_preset_index(); + ui_box_hide(); + box_preferences_htab.i = 5; // Keymap + box_preferences_show(); + } + }, 400, 200, null, true, tr("New Keymap")); } if (ui_button(tr("Import"))) { @@ -888,15 +884,14 @@ function box_preferences_plugins_tab() { ui_row(row); if (ui_button(tr("New"))) { ui_box_show_custom(function() { - if (ui_tab(ui_handle(__ID__), tr("New Plugin"))) { - ui_row2(); - let h: ui_handle_t = ui_handle(__ID__); - if (h.init) { - h.text = "new_plugin"; - } - let plugin_name: string = ui_text_input(h, tr("Name")); - if (ui_button(tr("OK")) || ui.is_return_down) { - let template: string = "let plugin = plugin_create();\ + ui_row2(); + let h: ui_handle_t = ui_handle(__ID__); + if (h.init) { + h.text = "new_plugin"; + } + let plugin_name: string = ui_text_input(h, tr("Name")); + if (ui_button(tr("OK")) || ui.is_return_down) { + let template: string = "let plugin = plugin_create();\ let h1 = ui_handle_create();\ plugin_notify_on_ui(plugin, function() {\ if (ui_panel(h1, \"New Plugin\")) {\ @@ -906,18 +901,17 @@ plugin_notify_on_ui(plugin, function() {\ }\ });\ "; - if (!ends_with(plugin_name, ".js")) { - plugin_name += ".js"; - } - let path: string = path_data() + path_sep + "plugins" + path_sep + plugin_name; - iron_file_save_bytes(path, sys_string_to_buffer(template), 0); - box_preferences_files_plugin = null; // Refresh file list - ui_box_hide(); - box_preferences_htab.i = 6; // Plugins - box_preferences_show(); + if (!ends_with(plugin_name, ".js")) { + plugin_name += ".js"; } + let path: string = path_data() + path_sep + "plugins" + path_sep + plugin_name; + iron_file_save_bytes(path, sys_string_to_buffer(template), 0); + box_preferences_files_plugin = null; // Refresh file list + ui_box_hide(); + box_preferences_htab.i = 6; // Plugins + box_preferences_show(); } - }); + }, 400, 200, null, true, tr("New Plugin")); } if (ui_button(tr("Import"))) { ui_files_show("js,zip", false, false, function(path: string) { @@ -1026,7 +1020,8 @@ function box_preferences_show() { 720, 520, function() { config_save(); - }); + }, true, tr("Preferences") + ); } function box_preferences_fetch_themes() { diff --git a/paint/sources/project.ts b/paint/sources/project.ts index f3b0f67a..1b3f530e 100644 --- a/paint/sources/project.ts +++ b/paint/sources/project.ts @@ -107,33 +107,31 @@ function project_fetch_default_meshes() { function project_new_box() { ui_box_show_custom(function() { - if (ui_tab(ui_handle(__ID__), tr("New Project"))) { - project_fetch_default_meshes(); - ui_row2(); - let h_project_type: ui_handle_t = ui_handle(__ID__); - if (h_project_type.init) { - h_project_type.i = context_raw.project_type; - } - context_raw.project_type = ui_combo(h_project_type, project_mesh_list, tr("Template"), true); - - let h_project_aspect_ratio: ui_handle_t = ui_handle(__ID__); - if (h_project_aspect_ratio.init) { - h_project_aspect_ratio.i = context_raw.project_aspect_ratio; - } - let project_aspect_ratio_combo: string[] = [ "1:1", "2:1", "1:2" ]; - context_raw.project_aspect_ratio = ui_combo(h_project_aspect_ratio, project_aspect_ratio_combo, tr("Aspect Ratio"), true); - - ui_end_element(); - ui_row2(); - if (ui_button(tr("Cancel"))) { - ui_box_hide(); - } - if (ui_button(tr("OK")) || ui.is_return_down) { - project_new(); - ui_box_hide(); - } + project_fetch_default_meshes(); + ui_row2(); + let h_project_type: ui_handle_t = ui_handle(__ID__); + if (h_project_type.init) { + h_project_type.i = context_raw.project_type; } - }); + context_raw.project_type = ui_combo(h_project_type, project_mesh_list, tr("Template"), true); + + let h_project_aspect_ratio: ui_handle_t = ui_handle(__ID__); + if (h_project_aspect_ratio.init) { + h_project_aspect_ratio.i = context_raw.project_aspect_ratio; + } + let project_aspect_ratio_combo: string[] = [ "1:1", "2:1", "1:2" ]; + context_raw.project_aspect_ratio = ui_combo(h_project_aspect_ratio, project_aspect_ratio_combo, tr("Aspect Ratio"), true); + + ui_end_element(); + ui_row2(); + if (ui_button(tr("Cancel"))) { + ui_box_hide(); + } + if (ui_button(tr("OK")) || ui.is_return_down) { + project_new(); + ui_box_hide(); + } + }, 400, 200, null, true, tr("New Project")); } function project_cleanup() { @@ -391,52 +389,48 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl let clear_layers: bool = _project_import_mesh_box_clear_layers; let done: () => void = _project_import_mesh_box_done; - let tab_vertical: bool = config_raw.touch_ui; - 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 = ui_combo(ui_handle(__ID__), split_by_combo, tr("Split By"), true); - if (ui.is_hovered) { - ui_tooltip(tr("Split .obj mesh into objects")); - } - } - - if (ends_with(to_lower_case(path), ".fbx")) { - let h: ui_handle_t = ui_handle(__ID__); - h.b = context_raw.parse_vcols; - context_raw.parse_vcols = ui_check(h, tr("Parse Vertex Colors")); - if (ui.is_hovered) { - ui_tooltip(tr("Import vertex color data")); - } - } - - if (ends_with(to_lower_case(path), ".blend")) { - import_blend_mesh_ui(); - } - - let row: f32[] = [ 0.45, 0.45, 0.1 ]; - ui_row(row); - if (ui_button(tr("Cancel"))) { - ui_box_hide(); - } - if (ui_button(tr("Import")) || ui.is_return_down) { - ui_box_hide(); - - /// if (arm_android || arm_ios) - console_toast(tr("Importing mesh")); - /// end - - import_mesh_run(path, clear_layers, replace_existing); - if (done != null) { - done(); - } - } - if (ui_button(tr("?"))) { - iron_load_url("https://github.com/armory3d/armorpaint_web/blob/main/manual.md#faq"); + 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 = ui_combo(ui_handle(__ID__), split_by_combo, tr("Split By"), true); + if (ui.is_hovered) { + ui_tooltip(tr("Split .obj mesh into objects")); } } - }); + + if (ends_with(to_lower_case(path), ".fbx")) { + let h: ui_handle_t = ui_handle(__ID__); + h.b = context_raw.parse_vcols; + context_raw.parse_vcols = ui_check(h, tr("Parse Vertex Colors")); + if (ui.is_hovered) { + ui_tooltip(tr("Import vertex color data")); + } + } + + if (ends_with(to_lower_case(path), ".blend")) { + import_blend_mesh_ui(); + } + + let row: f32[] = [ 0.45, 0.45, 0.1 ]; + ui_row(row); + if (ui_button(tr("Cancel"))) { + ui_box_hide(); + } + if (ui_button(tr("Import")) || ui.is_return_down) { + ui_box_hide(); + + /// if (arm_android || arm_ios) + console_toast(tr("Importing mesh")); + /// end + + import_mesh_run(path, clear_layers, replace_existing); + if (done != null) { + done(); + } + } + if (ui_button(tr("?"))) { + iron_load_url("https://github.com/armory3d/armorpaint_web/blob/main/manual.md#faq"); + } + }, 400, 200, null, true, tr("Import Mesh")); ui_box_click_to_hide = false; // Prevent closing when going back to window from file browser } @@ -480,27 +474,23 @@ function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t) => void let mesh: raw_mesh_t = _project_unwrap_mesh_box_mesh; let done: (a: raw_mesh_t) => void = _project_unwrap_mesh_box_done; - let tab_vertical: bool = config_raw.touch_ui; - if (ui_tab(ui_handle(__ID__), tr("Unwrap Mesh"), tab_vertical)) { + let unwrap_plugins: string[] = project_get_unwrap_plugins(); + _project_unwrap_by = ui_combo(ui_handle(__ID__), unwrap_plugins, tr("Plugin"), true); - let unwrap_plugins: string[] = project_get_unwrap_plugins(); - _project_unwrap_by = ui_combo(ui_handle(__ID__), unwrap_plugins, tr("Plugin"), true); - - ui_row2(); - if (ui_button(tr("Cancel"))) { - ui_box_hide(); - } - if (ui_button(tr("Unwrap")) || ui.is_return_down) { - ui_box_hide(); - - /// if (arm_android || arm_ios) - console_toast(tr("Unwrapping mesh")); - /// end - - project_unwrap_mesh(mesh, done); - } + ui_row2(); + if (ui_button(tr("Cancel"))) { + ui_box_hide(); } - }); + if (ui_button(tr("Unwrap")) || ui.is_return_down) { + ui_box_hide(); + + /// if (arm_android || arm_ios) + console_toast(tr("Unwrapping mesh")); + /// end + + project_unwrap_mesh(mesh, done); + } + }, 400, 200, null, true, tr("Unwrap Mesh")); } function project_unwrap_mesh(mesh: raw_mesh_t, done: (a: raw_mesh_t) => void) { diff --git a/paint/sources/ui_box.ts b/paint/sources/ui_box.ts index 301c1f48..216591d3 100644 --- a/paint/sources/ui_box.ts +++ b/paint/sources/ui_box.ts @@ -66,46 +66,44 @@ function ui_box_render() { } let left: i32 = math_floor(appw / 2 - mw / 2); let top: i32 = math_floor(apph / 2 - mh / 2); + ui_box_hwnd.text = ui_box_title; if (ui_box_commands == null) { 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 (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) { - ui_text_area(htext, ui_align_t.LEFT, false); - } - else { - ui_text(ui_box_text); - } - ui_end_element(); + let htext: ui_handle_t = ui_handle(__ID__); + htext.text = ui_box_text; + if (ui_box_copyable) { + ui_text_area(htext, ui_align_t.LEFT, false); + } + else { + ui_text(ui_box_text); + } + ui_end_element(); - /// if (arm_windows || arm_linux || arm_macos) - if (ui_box_copyable) { - ui_row3(); - } - else { - let row: f32[] = [ 2 / 3, 1 / 3 ]; - ui_row(row); - } - /// else + /// if (arm_windows || arm_linux || arm_macos) + if (ui_box_copyable) { + ui_row3(); + } + else { let row: f32[] = [ 2 / 3, 1 / 3 ]; ui_row(row); - /// end + } + /// else + let row: f32[] = [ 2 / 3, 1 / 3 ]; + ui_row(row); + /// end - ui_end_element(); + ui_end_element(); - /// if (arm_windows || arm_linux || arm_macos) - if (ui_box_copyable && ui_button(tr("Copy"))) { - iron_copy_to_clipboard(ui_box_text); - } - /// end - if (ui_button(tr("OK"))) { - ui_box_hide(); - } + /// if (arm_windows || arm_linux || arm_macos) + if (ui_box_copyable && ui_button(tr("Copy"))) { + iron_copy_to_clipboard(ui_box_text); + } + /// end + if (ui_button(tr("OK"))) { + ui_box_hide(); } ui_box_window_border(); } @@ -129,7 +127,7 @@ function ui_box_render() { function ui_box_show_message(title: string, text: string, copyable: bool = false) { ui_box_init(); ui_box_modalw = 400; - ui_box_modalh = 210; + ui_box_modalh = 180; ui_box_title = title; ui_box_text = text; ui_box_commands = null; @@ -140,13 +138,14 @@ function ui_box_show_message(title: string, text: string, copyable: bool = false /// end } -function ui_box_show_custom(commands: () => void = null, mw: i32 = 400, mh: i32 = 200, on_hide: () => void = null, draggable: bool = true) { +function ui_box_show_custom(commands: () => void = null, mw: i32 = 400, mh: i32 = 200, on_hide: () => void = null, draggable: bool = true, title: string = "") { ui_box_init(); ui_box_modalw = mw; ui_box_modalh = mh; ui_box_modal_on_hide = on_hide; ui_box_commands = commands; ui_box_draggable = draggable; + ui_box_title = title; /// if (arm_android || arm_ios) ui_box_tween_in(); /// end diff --git a/paint/sources/ui_menubar.ts b/paint/sources/ui_menubar.ts index e1695234..3abca3ca 100644 --- a/paint/sources/ui_menubar.ts +++ b/paint/sources/ui_menubar.ts @@ -597,37 +597,33 @@ function ui_menubar_draw_category_items() { _ui_menu_render_msg = msg; ui_box_show_custom(function() { - let tab_vertical: bool = config_raw.touch_ui; - if (ui_tab(ui_handle(__ID__), tr("About"), tab_vertical)) { + let img: gpu_texture_t = data_get_image("badge.k"); + ui_image(img); + ui_end_element(); - let img: gpu_texture_t = data_get_image("badge.k"); - ui_image(img); - ui_end_element(); - - let h: ui_handle_t = ui_handle(__ID__); - if (h.init) { - h.text = _ui_menu_render_msg; - } - ui_text_area(h, ui_align_t.LEFT, false); - - ui_row3(); - - /// if (arm_windows || arm_linux || arm_macos) - if (ui_button(tr("Copy"))) { - iron_copy_to_clipboard(_ui_menu_render_msg); - } - /// else - ui_end_element(); - /// end - - if (ui_button(tr("Contributors"))) { - iron_load_url("https://github.com/armory3d/armortools/graphs/contributors"); - } - if (ui_button(tr("OK"))) { - ui_box_hide(); - } + let h: ui_handle_t = ui_handle(__ID__); + if (h.init) { + h.text = _ui_menu_render_msg; } - }, 400, 320); + ui_text_area(h, ui_align_t.LEFT, false); + + ui_row3(); + + /// if (arm_windows || arm_linux || arm_macos) + if (ui_button(tr("Copy"))) { + iron_copy_to_clipboard(_ui_menu_render_msg); + } + /// else + ui_end_element(); + /// end + + if (ui_button(tr("Contributors"))) { + iron_load_url("https://github.com/armory3d/armortools/graphs/contributors"); + } + if (ui_button(tr("OK"))) { + ui_box_hide(); + } + }, 400, 320, null, true, tr("About")); } } } diff --git a/paint/sources/ui_nodes.ts b/paint/sources/ui_nodes.ts index eeab21cf..5b281aad 100644 --- a/paint/sources/ui_nodes.ts +++ b/paint/sources/ui_nodes.ts @@ -180,48 +180,46 @@ function ui_viewnodes_on_socket_released(socket_id: i32) { 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_tab(ui_handle(__ID__), tr("Socket"))) { - let type_combo: string[] = [ tr("Color"), tr("Vector"), tr("Value") ]; - 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 = 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) { - ui_row4(); - 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.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f, _ui_nodes_hval3.f); - } - else if (type == 1) { - ui_row3(); - _ui_nodes_hval0.f = ui_float_input(_ui_nodes_hval0, tr("X")); - _ui_nodes_hval1.f = ui_float_input(_ui_nodes_hval1, tr("Y")); - _ui_nodes_hval2.f = ui_float_input(_ui_nodes_hval2, tr("Z")); - default_value = f32_array_create_xyz(_ui_nodes_hval0.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f); - } - else { - let f: f32 = ui_float_input(_ui_nodes_hval0, tr("default_value")); - default_value = f32_array_create_x(f); - } - 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); - socket.min = min; - socket.max = max; - socket.default_value = default_value; - ui_box_hide(); - nodes_material_sync_sockets(node); - ui_nodes_hwnd.redraws = 2; - } + let type_combo: string[] = [ tr("Color"), tr("Vector"), tr("Value") ]; + 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"); } - }, 400, 250); + 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) { + ui_row4(); + 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.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f, _ui_nodes_hval3.f); + } + else if (type == 1) { + ui_row3(); + _ui_nodes_hval0.f = ui_float_input(_ui_nodes_hval0, tr("X")); + _ui_nodes_hval1.f = ui_float_input(_ui_nodes_hval1, tr("Y")); + _ui_nodes_hval2.f = ui_float_input(_ui_nodes_hval2, tr("Z")); + default_value = f32_array_create_xyz(_ui_nodes_hval0.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f); + } + else { + let f: f32 = ui_float_input(_ui_nodes_hval0, tr("default_value")); + default_value = f32_array_create_x(f); + } + 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); + socket.min = min; + socket.max = max; + socket.default_value = default_value; + ui_box_hide(); + nodes_material_sync_sockets(node); + ui_nodes_hwnd.redraws = 2; + } + }, 400, 250, null, true, tr("Socket")); }); } if (ui_menu_button(tr("Delete"))) {