luboslenco 1 lună în urmă
părinte
comite
e9bc7dfecb
40 a modificat fișierele cu 343 adăugiri și 389 ștergeri
  1. 3 1
      base/sources/iron_ui.c
  2. 5 5
      base/sources/ts/base.ts
  3. 18 18
      base/sources/ts/box_export.ts
  4. 12 12
      base/sources/ts/box_preferences.ts
  5. 11 11
      base/sources/ts/box_projects.ts
  6. 1 1
      base/sources/ts/config.ts
  7. 1 1
      base/sources/ts/import_blend_material.ts
  8. 3 4
      base/sources/ts/iron/iron.ts
  9. 4 13
      base/sources/ts/nodes_material.ts
  10. 3 3
      base/sources/ts/project.ts
  11. 4 5
      base/sources/ts/tab_browser.ts
  12. 1 2
      base/sources/ts/tab_brushes.ts
  13. 2 4
      base/sources/ts/tab_console.ts
  14. 1 2
      base/sources/ts/tab_fonts.ts
  15. 0 1
      base/sources/ts/tab_history.ts
  16. 14 24
      base/sources/ts/tab_layers.ts
  17. 1 3
      base/sources/ts/tab_materials.ts
  18. 13 15
      base/sources/ts/tab_meshes.ts
  19. 0 1
      base/sources/ts/tab_plugins.ts
  20. 3 4
      base/sources/ts/tab_scripts.ts
  21. 3 4
      base/sources/ts/tab_swatches.ts
  22. 1 2
      base/sources/ts/tab_textures.ts
  23. 1 1
      base/sources/ts/translator.ts
  24. 32 32
      base/sources/ts/ui_base.ts
  25. 8 8
      base/sources/ts/ui_box.ts
  26. 1 1
      base/sources/ts/ui_files.ts
  27. 1 2
      base/sources/ts/ui_header.ts
  28. 9 10
      base/sources/ts/ui_menu.ts
  29. 34 38
      base/sources/ts/ui_menubar.ts
  30. 100 100
      base/sources/ts/ui_nodes.ts
  31. 0 3
      base/sources/ts/ui_status.ts
  32. 4 8
      base/sources/ts/ui_toolbar.ts
  33. 28 28
      base/sources/ts/ui_view2d.ts
  34. 1 1
      base/tools/pad/sources/main.ts
  35. 1 1
      lab/sources/ui_header_ext.ts
  36. 0 1
      lab/sources/ui_nodes_ext.ts
  37. 1 1
      lab/sources/ui_toolbar_ext.ts
  38. 1 1
      paint/sources/nodes/brush_output_node_ext.ts
  39. 2 2
      paint/sources/ui_header_ext.ts
  40. 15 15
      paint/sources/ui_toolbar_ext.ts

+ 3 - 1
base/sources/iron_ui.c

@@ -1706,7 +1706,9 @@ bool ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag) {
 		current->_x = handle->scroll_offset;
 		current->_y = 0;
 	}
-	if (handle->layout == UI_LAYOUT_HORIZONTAL) w = UI_ELEMENT_W();
+	if (handle->layout == UI_LAYOUT_HORIZONTAL) {
+		w = UI_ELEMENT_W();
+	}
 	current->_w = !handle->scroll_enabled ? w : w - UI_SCROLL_W(); // Exclude scrollbar if present
 	current->_h = h;
 	current->tooltip_text[0] = 0;

+ 5 - 5
base/sources/ts/base.ts

@@ -505,7 +505,7 @@ function base_get_drag_image(): gpu_texture_t {
 		}
 		let icons: gpu_texture_t = resource_get("icons.k");
 		base_drag_rect = string_index_of(base_drag_file, ".") > 0 ? resource_tile50(icons, 3, 1) : resource_tile50(icons, 2, 1);
-		base_drag_tint = ui_base_ui.ops.theme.HIGHLIGHT_COL;
+		base_drag_tint = ui.ops.theme.HIGHLIGHT_COL;
 		return icons;
 	}
 
@@ -517,7 +517,7 @@ function base_get_drag_image(): gpu_texture_t {
 		let folder_closed: rect_t = resource_tile50(icons, 2, 1);
 		let folder_open: rect_t = resource_tile50(icons, 8, 1);
 		base_drag_rect = base_drag_layer.show_panel ? folder_open : folder_closed;
-		base_drag_tint = ui_base_ui.ops.theme.LABEL_COL - 0x00202020;
+		base_drag_tint = ui.ops.theme.LABEL_COL - 0x00202020;
 		return icons;
 	}
 	if (base_drag_layer != null && slot_layer_is_mask(base_drag_layer) && base_drag_layer.fill_layer == null) {
@@ -668,11 +668,11 @@ function base_toggle_fullscreen() {
 }
 
 function base_is_scrolling(): bool {
-	return ui_base_ui.is_scrolling;
+	return ui.is_scrolling;
 }
 
 function base_is_combo_selected(): bool {
-	return ui_base_ui.combo_selected_handle != null;
+	return ui.combo_selected_handle != null;
 }
 
 function base_is_decal_layer(): bool {
@@ -690,7 +690,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 * UI_SCALE()) {
+	if (ui != null && statush > ui_status_default_status_h * UI_SCALE()) {
 		ui_base_hwnds[tab_area_t.STATUS].redraws = 2;
 	}
 }

+ 18 - 18
base/sources/ts/box_export.ts

@@ -35,7 +35,7 @@ let _box_export_apply_displacement: bool;
 let _box_export_merge_vertices: bool;
 
 function box_export_show_textures() {
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 
 		if (box_export_files == null) {
 			box_export_fetch_presets();
@@ -46,13 +46,13 @@ function box_export_show_textures() {
 			box_export_hpreset.children = null;
 		}
 
-		box_export_tab_export_textures(ui, tr("Export Textures"));
-		box_export_tab_presets(ui);
+		box_export_tab_export_textures(tr("Export Textures"));
+		box_export_tab_presets();
 
 		///if is_paint
-		box_export_tab_atlases(ui);
+		box_export_tab_atlases();
 		///if (arm_android || arm_ios)
-		box_export_tab_export_mesh(ui, box_export_htab);
+		box_export_tab_export_mesh(box_export_htab);
 		///end
 		///end
 
@@ -60,7 +60,7 @@ function box_export_show_textures() {
 }
 
 function box_export_show_bake_material() {
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 
 		if (box_export_files == null) {
 			box_export_fetch_presets();
@@ -71,13 +71,13 @@ function box_export_show_bake_material() {
 			box_export_hpreset.children = null;
 		}
 
-		box_export_tab_export_textures(ui, tr("Bake to Textures"), true);
-		box_export_tab_presets(ui);
+		box_export_tab_export_textures(tr("Bake to Textures"), true);
+		box_export_tab_presets();
 
 	}, 540, 310);
 }
 
-function box_export_tab_export_textures(ui: ui_t, title: string, bake_material: bool = false) {
+function box_export_tab_export_textures(title: string, bake_material: bool = false) {
 	let tab_vertical: bool = config_raw.touch_ui;
 	if (ui_tab(box_export_htab, title, tab_vertical)) {
 
@@ -192,7 +192,7 @@ function box_export_tab_export_textures(ui: ui_t, title: string, bake_material:
 	}
 }
 
-function box_export_tab_presets(ui: ui_t) {
+function box_export_tab_presets() {
 	let tab_vertical: bool = config_raw.touch_ui;
 	if (ui_tab(box_export_htab, tr("Presets"), tab_vertical)) {
 
@@ -205,7 +205,7 @@ function box_export_tab_presets(ui: ui_t) {
 		}
 
 		if (ui_button(tr("New"))) {
-			ui_box_show_custom(function (ui: ui_t) {
+			ui_box_show_custom(function () {
 				let tab_vertical: bool = config_raw.touch_ui;
 				if (ui_tab(ui_handle(__ID__), tr("New Preset"), tab_vertical)) {
 					ui_row2();
@@ -269,7 +269,7 @@ function box_export_tab_presets(ui: ui_t) {
 
 			if (ui.is_hovered && ui.input_released_r) {
 				_box_export_t = t;
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					if (ui_menu_button(tr("Delete"))) {
 						array_remove(box_export_preset.textures, _box_export_t);
 						box_export_save_preset();
@@ -330,7 +330,7 @@ function box_export_tab_presets(ui: ui_t) {
 	}
 }
 
-function box_export_tab_atlases(ui: ui_t) {
+function box_export_tab_atlases() {
 	let tab_vertical: bool = config_raw.touch_ui;
 	if (ui_tab(box_export_htab, tr("Atlases"), tab_vertical)) {
 		if (project_atlas_objects == null || project_atlas_objects.length != project_paint_objects.length) {
@@ -354,13 +354,13 @@ function box_export_tab_atlases(ui: ui_t) {
 
 function box_export_show_mesh() {
 	box_export_mesh_handle.position = context_raw.export_mesh_index;
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		let htab: ui_handle_t = ui_handle(__ID__);
-		box_export_tab_export_mesh(ui, htab);
+		box_export_tab_export_mesh(htab);
 	}, 400, 240);
 }
 
-function box_export_tab_export_mesh(ui: ui_t, htab: ui_handle_t) {
+function box_export_tab_export_mesh(htab: ui_handle_t) {
 	let tab_vertical: bool = config_raw.touch_ui;
 	if (ui_tab(htab, tr("Export Mesh"), tab_vertical)) {
 
@@ -441,7 +441,7 @@ function box_export_tab_export_mesh(ui: ui_t, htab: ui_handle_t) {
 }
 
 function box_export_show_material() {
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		let htab: ui_handle_t = ui_handle(__ID__);
 		let tab_vertical: bool = config_raw.touch_ui;
 		if (ui_tab(htab, tr("Export Material"), tab_vertical)) {
@@ -472,7 +472,7 @@ function box_export_show_material() {
 }
 
 function box_export_show_brush() {
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		let htab: ui_handle_t = ui_handle(__ID__);
 		let tab_vertical: bool = config_raw.touch_ui;
 		if (ui_tab(htab, tr("Export Brush"), tab_vertical)) {

+ 12 - 12
base/sources/ts/box_preferences.ts

@@ -11,7 +11,7 @@ let _box_preferences_h: ui_handle_t;
 let _box_preferences_i: i32;
 
 function box_preferences_show() {
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		if (ui_tab(box_preferences_htab, tr("Interface"), true)) {
 
 			if (box_preferences_locales == null) {
@@ -134,9 +134,9 @@ function box_preferences_show() {
 
 			ui_row2();
 			if (ui_button(tr("Restore")) && !ui_menu_show) {
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					if (ui_menu_button(tr("Confirm"))) {
-						sys_notify_on_init(function (ui: ui_t) {
+						sys_notify_on_init(function () {
 							ui.ops.theme.ELEMENT_H = base_default_element_h;
 							config_restore();
 							box_preferences_set_scale();
@@ -151,14 +151,14 @@ function box_preferences_show() {
 							make_material_parse_mesh_material();
 							make_material_parse_paint_material();
 							ui_base_set_viewport_col(ui.ops.theme.VIEWPORT_COL);
-						}, ui);
+						});
 					}
 					if (ui_menu_button(tr("Import..."))) {
 						ui_files_show("json", false, false, function (path: string) {
 							let b: buffer_t = data_get_blob(path);
 							let raw: config_t = json_parse(sys_buffer_to_string(b));
 							sys_notify_on_init(function (raw: config_t) {
-								ui_base_ui.ops.theme.ELEMENT_H = base_default_element_h;
+								ui.ops.theme.ELEMENT_H = base_default_element_h;
 								config_import_from(raw);
 								box_preferences_set_scale();
 								make_material_parse_mesh_material();
@@ -169,7 +169,7 @@ function box_preferences_show() {
 				});
 			}
 			if (ui_button(tr("Reset Layout")) && !ui_menu_show) {
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					if (ui_menu_button(tr("Confirm"))) {
 						base_init_layout();
 						config_save();
@@ -198,7 +198,7 @@ function box_preferences_show() {
 			}
 
 			if (ui_button(tr("New"))) {
-				ui_box_show_custom(function (ui: ui_t) {
+				ui_box_show_custom(function () {
 					if (ui_tab(ui_handle(__ID__), tr("New Theme"))) {
 						ui_row2();
 						let h: ui_handle_t = ui_handle(__ID__);
@@ -261,7 +261,7 @@ function box_preferences_show() {
 						h.color = val;
 						_box_preferences_h = h;
 						_box_preferences_i = i;
-						ui_menu_draw(function (ui: ui_t) {
+						ui_menu_draw(function () {
 							ui.changed = false;
 							let color: i32 = ui_color_wheel(_box_preferences_h, false, -1, 11 * ui.ops.theme.ELEMENT_H * UI_SCALE(), true);
 							let u32_theme: u32_ptr = base_theme;
@@ -306,7 +306,7 @@ function box_preferences_show() {
 				}
 
 				if (ui.changed) {
-					ui_base_ui.elements_baked = false;
+					ui.elements_baked = false;
 				}
 			}
 			ui.input_enabled = true;
@@ -681,7 +681,7 @@ function box_preferences_show() {
 			}
 
 			if (ui_button(tr("New"))) {
-				ui_box_show_custom(function (ui: ui_t) {
+				ui_box_show_custom(function () {
 					if (ui_tab(ui_handle(__ID__), tr("New Keymap"))) {
 						ui_row2();
 						let h: ui_handle_t = ui_handle(__ID__);
@@ -747,7 +747,7 @@ function box_preferences_show() {
 			let row: f32[] = [1 / 4, 1 / 4];
 			ui_row(row);
 			if (ui_button(tr("New"))) {
-				ui_box_show_custom(function (ui: ui_t) {
+				ui_box_show_custom(function () {
 					if (ui_tab(ui_handle(__ID__), tr("New Plugin"))) {
 						ui_row2();
 						let h: ui_handle_t = ui_handle(__ID__);
@@ -814,7 +814,7 @@ plugin_notify_on_ui(plugin, function() {\
 				}
 				if (ui.is_hovered && ui.input_released_r) {
 					_box_preferences_f = f;
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						let path: string = path_data() + path_sep + "plugins" + path_sep + _box_preferences_f;
 						if (ui_menu_button(tr("Edit in Text Editor"))) {
 							file_start(path);

+ 11 - 11
base/sources/ts/box_projects.ts

@@ -24,26 +24,26 @@ function box_projects_show() {
 	draggable = true;
 	///end
 
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		///if (arm_android || arm_ios)
 		box_projects_align_to_fullscreen();
 		///end
 
 		///if (arm_android || arm_ios)
-		box_projects_tab(ui);
-		box_projects_get_started_tab(ui);
+		box_projects_tab();
+		box_projects_get_started_tab();
 		///else
-		box_projects_recent_tab(ui);
+		box_projects_recent_tab();
 		///end
 
 	}, 600, 400, null, draggable);
 }
 
-function box_projects_tab(ui: ui_t) {
+function box_projects_tab() {
 	if (ui_tab(box_projects_htab, tr("Projects"), true)) {
 		ui_begin_sticky();
 
-		box_projects_draw_badge(ui);
+		box_projects_draw_badge();
 
 		if (ui_button(tr("New"))) {
 			project_new();
@@ -144,7 +144,7 @@ function box_projects_tab(ui: ui_t) {
 						_box_projects_path = path;
 						_box_projects_icon_path = icon_path;
 						_box_projects_i = i;
-						ui_menu_draw(function (ui: ui_t) {
+						ui_menu_draw(function () {
 							// if (ui_menu_button(tr("Duplicate"))) {}
 							if (ui_menu_button(tr("Delete"))) {
 								sys_notify_on_init(function () {
@@ -186,10 +186,10 @@ function box_projects_tab(ui: ui_t) {
 	}
 }
 
-function box_projects_recent_tab(ui: ui_t) {
+function box_projects_recent_tab() {
 	if (ui_tab(box_projects_htab, tr("Recent"), true)) {
 
-		box_projects_draw_badge(ui);
+		box_projects_draw_badge();
 
 		ui.enabled = config_raw.recent_projects.length > 0;
 		box_projects_hsearch.text = ui_text_input(box_projects_hsearch, tr("Search"), ui_align_t.LEFT, true, true);
@@ -240,13 +240,13 @@ function box_projects_recent_tab(ui: ui_t) {
 	}
 }
 
-function box_projects_draw_badge(ui: ui_t) {
+function box_projects_draw_badge() {
 	let img: gpu_texture_t = data_get_image("badge.k");
 	ui_image(img);
 	ui_end_element();
 }
 
-function box_projects_get_started_tab(ui: ui_t) {
+function box_projects_get_started_tab() {
 	if (ui_tab(box_projects_htab, tr("Get Started"), true)) {
 		if (ui_button(tr("Manual"))) {
 			file_load_url(manifest_url + "/manual");

+ 1 - 1
base/sources/ts/config.ts

@@ -330,7 +330,7 @@ function config_load_theme(theme: string, tag_redraw: bool = true) {
 	base_theme.FILL_WINDOW_BG = true;
 
 	if (tag_redraw) {
-		ui_base_ui.ops.theme = base_theme;
+		ui.ops.theme = base_theme;
 		ui_base_tag_ui_redraw();
 	}
 

+ 1 - 1
base/sources/ts/import_blend_material.ts

@@ -5,7 +5,7 @@ function import_blend_material_run(path: string) {
 
 	_import_blend_material_path = path;
 
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		if (ui_tab(ui_handle(__ID__), tr("Import Material"))) {
 			import_blend_mesh_ui();
 

+ 3 - 4
base/sources/ts/iron/iron.ts

@@ -715,7 +715,6 @@ declare function ui_begin(ui: ui_t): void;
 declare function ui_end_window(): void;
 declare function ui_end_region(): void;
 declare function ui_float_input(handle: ui_handle_t, label: string = "", align: ui_align_t = ui_align_t.LEFT, precision: f32 = 1000.0): f32;
-declare function ui_get_current(): ui_t;
 declare function ui_remove_node(n: ui_node_t, canvas: ui_node_canvas_t): void;
 declare function ui_next_link_id(links: ui_node_link_t[]): i32;
 declare function ui_set_hovered_tab_name(s: string): void;
@@ -952,7 +951,7 @@ declare function UI_ELEMENT_W(): f32;
 declare function UI_ELEMENT_H(): f32;
 declare function UI_OUTPUTS_H(sockets_count: i32, length: i32 = -1): f32;
 
-function ui_MENUBAR_H(ui: ui_t): f32 {
+function ui_MENUBAR_H(): f32 {
 	let button_offset_y: f32 = (ui.ops.theme.ELEMENT_H * UI_SCALE() - ui.ops.theme.BUTTON_H * UI_SCALE()) / 2;
 	return ui.ops.theme.BUTTON_H * UI_SCALE() * 1.1 + 2 + button_offset_y;
 }
@@ -1024,7 +1023,7 @@ function ui_get_socket(nodes: ui_node_t[], id: i32): ui_node_socket_t {
 	return null;
 }
 
-function ui_set_font(raw: ui_t, font: draw_font_t) {
+function ui_set_font(font: draw_font_t) {
 	draw_font_init(font); // Make sure font is ready
-	raw.ops.font = font;
+	ui.ops.font = font;
 }

+ 4 - 13
base/sources/ts/nodes_material.ts

@@ -3985,8 +3985,6 @@ function nodes_material_init() {
 }
 
 function nodes_material_vector_curves_button(node_id: i32) {
-	let ui: ui_t = ui_base_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: ui_node_button_t = node.buttons[0];
@@ -4053,7 +4051,6 @@ function nodes_material_vector_curves_button(node_id: i32) {
 }
 
 function nodes_material_color_ramp_button(node_id: i32) {
-	let ui: ui_t = ui_base_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);
 
@@ -4128,8 +4125,6 @@ function nodes_material_color_ramp_button(node_id: i32) {
 }
 
 function nodes_material_new_group_button(node_id: i32) {
-	let ui: ui_t = ui_base_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") {
@@ -4213,27 +4208,23 @@ function nodes_material_new_group_button(node_id: i32) {
 }
 
 function nodes_material_group_input_button(node_id: i32) {
-	let ui: ui_t = ui_base_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);
+	nodes_material_add_socket_button(nodes, node, node.outputs);
 }
 
 function nodes_material_group_output_button(node_id: i32) {
-	let ui: ui_t = ui_base_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);
+	nodes_material_add_socket_button(nodes, node, node.inputs);
 }
 
-function nodes_material_add_socket_button(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t, sockets: ui_node_socket_t[]) {
+function nodes_material_add_socket_button(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: ui_t) {
+		ui_menu_draw(function () {
 			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;

+ 3 - 3
base/sources/ts/project.ts

@@ -101,7 +101,7 @@ function project_save_as(save_and_quit: bool = false) {
 
 function project_new_box() {
 	///if is_paint
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		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");
@@ -419,7 +419,7 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl
 	// data_get_blob(path);
 	///end
 
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 
 		let path: string = _project_import_mesh_box_path;
 		let replace_existing: bool = _project_import_mesh_box_replace_existing;
@@ -519,7 +519,7 @@ function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t)=>void,
 		return;
 	}
 
-	ui_box_show_custom(function (ui: ui_t) {
+	ui_box_show_custom(function () {
 		let mesh: raw_mesh_t = _project_unwrap_mesh_box_mesh;
 		let done: (a: raw_mesh_t)=>void = _project_unwrap_mesh_box_done;
 

+ 4 - 5
base/sources/ts/tab_browser.ts

@@ -13,7 +13,6 @@ function tab_browser_show_directory(directory: string) {
 }
 
 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 (ui_tab(htab, tr("Browser")) && statush > ui_status_default_status_h * UI_SCALE()) {
 
@@ -118,7 +117,7 @@ function tab_browser_draw(htab: ui_handle_t) {
 		ui._x = bookmarks_w;
 		ui._w -= bookmarks_w;
 
-		ui_files_file_browser(ui, tab_browser_hpath, true, tab_browser_hsearch.text, refresh, function (file: string) {
+		ui_files_file_browser(tab_browser_hpath, true, tab_browser_hsearch.text, refresh, function (file: string) {
 
 			let file_name: string = substring(file, string_last_index_of(file, path_sep) + 1, file.length);
 			if (file_name == "..") {
@@ -128,7 +127,7 @@ function tab_browser_draw(htab: ui_handle_t) {
 			_tab_browser_draw_file = file;
 
 			// Context menu
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				let file: string = _tab_browser_draw_file;
 
 				if (ui_menu_button(tr("Import"))) {
@@ -235,7 +234,7 @@ function tab_browser_draw(htab: ui_handle_t) {
 
 		if (ui_button(tr("Disk"), ui_align_t.LEFT)) {
 			///if arm_android
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				if (ui_menu_button(tr("Download"))) {
 					tab_browser_hpath.text = ui_files_default_path;
 				}
@@ -267,7 +266,7 @@ function tab_browser_draw(htab: ui_handle_t) {
 
 			if (ui.is_hovered && ui.input_released_r) {
 				_tab_browser_draw_b = b;
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					if (ui_menu_button(tr("Delete"))) {
 						array_remove(config_raw.bookmarks, _tab_browser_draw_b);
 						config_save();

+ 1 - 2
base/sources/ts/tab_brushes.ts

@@ -2,7 +2,6 @@
 let _tab_brushes_draw_i: i32;
 
 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];
@@ -89,7 +88,7 @@ function tab_brushes_draw(htab: ui_handle_t) {
 
 					_tab_brushes_draw_i = i;
 
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						let i: i32 = _tab_brushes_draw_i;
 
 						//let b: slot_brush_t = brushes[i];

+ 2 - 4
base/sources/ts/tab_console.ts

@@ -1,7 +1,5 @@
 
 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;
 
@@ -58,13 +56,13 @@ function tab_console_draw(htab: ui_handle_t) {
 		let _font: draw_font_t = ui.ops.font;
 		let _font_size: i32 = ui.font_size;
 		let f: draw_font_t = data_get_font("font_mono.ttf");
-		ui_set_font(ui, f);
+		ui_set_font(f);
 		ui.font_size = math_floor(15 * UI_SCALE());
 		for (let i: i32 = 0; i < console_last_traces.length; ++i) {
 			let t: string = console_last_traces[i];
 			ui_text(t);
 		}
-		ui_set_font(ui, _font);
+		ui_set_font(_font);
 		ui.font_size = _font_size;
 	}
 }

+ 1 - 2
base/sources/ts/tab_fonts.ts

@@ -2,7 +2,6 @@
 let _tab_fonts_draw_i: i32;
 
 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 (ui_tab(htab, tr("Fonts")) && statush > ui_status_default_status_h * UI_SCALE()) {
 
@@ -107,7 +106,7 @@ function tab_fonts_draw(htab: ui_handle_t) {
 					context_select_font(i);
 					_tab_fonts_draw_i = i;
 
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						let i: i32 = _tab_fonts_draw_i;
 
 						if (project_fonts.length > 1 && ui_menu_button(tr("Delete"), "delete") && project_fonts[i].file != "") {

+ 0 - 1
base/sources/ts/tab_history.ts

@@ -1,6 +1,5 @@
 
 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;

+ 14 - 24
base/sources/ts/tab_layers.ts

@@ -11,7 +11,6 @@ function tab_layers_draw(htab: ui_handle_t) {
 }
 
 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;
@@ -34,7 +33,6 @@ function tab_layers_draw_mini(htab: ui_handle_t) {
 }
 
 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];
@@ -53,7 +51,6 @@ function tab_layers_draw_full(htab: ui_handle_t) {
 }
 
 function tab_layers_button_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);
 	}
@@ -74,7 +71,6 @@ function tab_layers_draw_slots(mini: bool) {
 }
 
 function tab_layers_highlight_odd_lines() {
-	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) {
@@ -86,7 +82,7 @@ function tab_layers_highlight_odd_lines() {
 
 function tab_layers_button_new(text: string) {
 	if (ui_button(text)) {
-		ui_menu_draw(function (ui: ui_t) {
+		ui_menu_draw(function () {
 			let l: slot_layer_t = context_raw.layer;
 			if (ui_menu_button(tr("Paint Layer"))) {
 				layers_new_layer();
@@ -254,7 +250,6 @@ 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: ui_t = ui_base_ui;
 
 	if (context_raw.layer_filter > 0 &&
 		slot_layer_get_object_mask(l) > 0 &&
@@ -321,7 +316,6 @@ 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: ui_t = ui_base_ui;
 
 	let row: f32[] = [1, 1];
 	ui_row(row);
@@ -336,7 +330,6 @@ function tab_layers_draw_layer_slot_mini(l: slot_layer_t, i: i32) {
 }
 
 function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) {
-	let ui: ui_t = ui_base_ui;
 
 	let step: i32 = ui.ops.theme.ELEMENT_H;
 	let uiw: f32 = ui._w;
@@ -448,7 +441,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) {
 			ui._y += center;
 		}
 
-		tab_layers_combo_blending(ui, l);
+		tab_layers_combo_blending(l);
 
 		if (slot_layer_is_mask(l)) {
 			ui._y -= center;
@@ -480,14 +473,14 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) {
 			ui._x += 12 * UI_SCALE();
 		}
 
-		tab_layers_combo_object(ui, l);
+		tab_layers_combo_object(l);
 		ui_end_element();
 	}
 
 	ui._y -= UI_ELEMENT_OFFSET();
 }
 
-function tab_layers_combo_object(ui: ui_t, l: slot_layer_t, label: bool = false): ui_handle_t {
+function tab_layers_combo_object(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];
@@ -520,7 +513,7 @@ function tab_layers_combo_object(ui: ui_t, l: slot_layer_t, label: bool = false)
 	return object_handle;
 }
 
-function tab_layers_combo_blending(ui: ui_t, l: slot_layer_t, label: bool = false): ui_handle_t {
+function tab_layers_combo_blending(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[] = [
@@ -560,7 +553,6 @@ function tab_layers_layer_toggle_visible(l: slot_layer_t) {
 }
 
 function tab_layers_draw_layer_highlight(l: slot_layer_t, mini: bool) {
-	let ui: ui_t = ui_base_ui;
 	let step: i32 = ui.ops.theme.ELEMENT_H;
 
 	// Separator line
@@ -578,7 +570,6 @@ function tab_layers_draw_layer_highlight(l: slot_layer_t, mini: bool) {
 }
 
 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;
 
 	let texpaint_preview: gpu_texture_t = l.texpaint_preview;
 
@@ -626,7 +617,6 @@ function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: ui_s
 }
 
 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: gpu_texture_t = resource_get("icons.k");
 	let icon_h: i32 = (UI_ELEMENT_H() - (mini ? 2 : 3)) * 2;
 
@@ -720,7 +710,7 @@ 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: ui_t) {
+	ui_menu_draw(function () {
 
 		let l: slot_layer_t = tab_layers_l;
 		let mini: bool = tab_layers_mini;
@@ -735,12 +725,12 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 			}
 
 			if (!slot_layer_is_group(l)) {
-				if (tab_layers_combo_blending(ui, l, true).changed) {
+				if (tab_layers_combo_blending(l, true).changed) {
 					ui_menu_keep_open = true;
 				}
 			}
 			if (slot_layer_is_layer(l)) {
-				if (tab_layers_combo_object(ui, l, true).changed) {
+				if (tab_layers_combo_object(l, true).changed) {
 					ui_menu_keep_open = true;
 				}
 			}
@@ -859,7 +849,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 			});
 		}
 
-		ui_menu_align(ui);
+		ui_menu_align();
 		let layer_opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id);
 		layer_opac_handle.value = l.mask_opacity;
 		ui_slider(layer_opac_handle, tr("Opacity"), 0.0, 1.0, true);
@@ -873,7 +863,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 		}
 
 		if (!slot_layer_is_group(l)) {
-			ui_menu_align(ui);
+			ui_menu_align();
 			let res_handle_changed_last: bool = base_res_handle.changed;
 			///if (arm_android || arm_ios)
 			let ar: string[] = ["128", "256", "512", "1K", "2K", "4K"];
@@ -893,7 +883,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 			ui_draw_string(tr("Res"), -1, 0, ui_align_t.RIGHT, true);
 			ui_end_element();
 
-			ui_menu_align(ui);
+			ui_menu_align();
 			///if (arm_android || arm_ios)
 			let bits_items: string[] = ["8bit"];
 			ui_inline_radio(base_bits_handle, bits_items, ui_align_t.LEFT);
@@ -909,7 +899,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 		}
 
 		if (l.fill_layer != null) {
-			ui_menu_align(ui);
+			ui_menu_align();
 			let scale_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id);
 			scale_handle.value = l.scale;
 			l.scale = ui_slider(scale_handle, tr("UV Scale"), 0.0, 5.0, true);
@@ -922,7 +912,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 				ui_menu_keep_open = true;
 			}
 
-			ui_menu_align(ui);
+			ui_menu_align();
 			let angle_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id);
 			angle_handle.value = l.angle;
 			l.angle = ui_slider(angle_handle, tr("Angle"), 0.0, 360, true, 1);
@@ -936,7 +926,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) {
 				ui_menu_keep_open = true;
 			}
 
-			ui_menu_align(ui);
+			ui_menu_align();
 			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")];

+ 1 - 3
base/sources/ts/tab_materials.ts

@@ -39,7 +39,6 @@ function tab_materials_draw_full(htab: ui_handle_t) {
 }
 
 function tab_materials_button_nodes() {
-	let ui: ui_t = ui_base_ui;
 	if (ui_button(tr("Nodes"))) {
 		ui_base_show_material_nodes();
 	}
@@ -49,7 +48,6 @@ function tab_materials_button_nodes() {
 }
 
 function tab_materials_draw_slots(mini: bool) {
-	let ui: ui_t = ui_base_ui;
 	let slotw: i32 = math_floor(51 * UI_SCALE());
 	let num: i32 = math_floor(config_raw.layout[layout_size_t.SIDEBAR_W] / slotw);
 	if (num == 0) {
@@ -152,7 +150,7 @@ function tab_materials_draw_slots(mini: bool) {
 				context_select_material(i);
 				_tab_materials_draw_slots = i;
 
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					let i: i32 = _tab_materials_draw_slots;
 					let m: slot_material_t = project_materials[i];
 

+ 13 - 15
base/sources/ts/tab_meshes.ts

@@ -2,7 +2,6 @@
 let _tab_meshes_draw_i: i32;
 
 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 (ui_tab(htab, tr("Meshes")) && statush > ui_status_default_status_h * UI_SCALE()) {
 
@@ -17,7 +16,7 @@ function tab_meshes_draw(htab: ui_handle_t) {
 		}
 
 		if (ui_button(tr("Import"))) {
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				if (ui_menu_button(tr("Replace Existing"), map_get(config_keymap, "file_import_assets"))) {
 					project_import_mesh(true);
 				}
@@ -31,11 +30,11 @@ function tab_meshes_draw(htab: ui_handle_t) {
 
 		if (ui_button(tr("Edit"))) {
 
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 
 				///if is_lab
 				if (ui_menu_button(tr("Set Default"))) {
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						if (ui_menu_button(tr("Cube"))) {
 							tab_meshes_set_default_mesh(".Cube");
 						}
@@ -58,7 +57,7 @@ function tab_meshes_draw(htab: ui_handle_t) {
 				}
 
 				if (ui_menu_button(tr("Calculate Normals"))) {
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						if (ui_menu_button(tr("Smooth"))) {
 							util_mesh_calc_normals(true);
 							context_raw.ddirty = 2;
@@ -90,7 +89,7 @@ function tab_meshes_draw(htab: ui_handle_t) {
 				}
 
 				if (ui_menu_button(tr("Rotate"))) {
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						if (ui_menu_button(tr("Rotate X"))) {
 							util_mesh_swap_axis(1, 2);
 							context_raw.ddirty = 2;
@@ -129,7 +128,7 @@ function tab_meshes_draw(htab: ui_handle_t) {
 			if (ui.is_hovered && ui.input_released_r) {
 				_tab_meshes_draw_i = i;
 
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 					let i: i32 = _tab_meshes_draw_i;
 					let o: mesh_object_t = project_paint_objects[i];
 
@@ -330,12 +329,12 @@ function tab_meshes_draw(htab: ui_handle_t) {
 					let _font: draw_font_t = ui.ops.font;
 					let _font_size: i32 = ui.font_size;
 					let fmono: draw_font_t = data_get_font("font_mono.ttf");
-					ui_set_font(ui, fmono);
+					ui_set_font(fmono);
 					ui.font_size = math_floor(15 * UI_SCALE());
 					ui_text_area_coloring = tab_scripts_get_text_coloring();
 					ui_text_area(hscript);
 					ui_text_area_coloring = null;
-					ui_set_font(ui, _font);
+					ui_set_font(_font);
 					ui.font_size = _font_size;
 
 					script = hscript.text;
@@ -445,7 +444,7 @@ function tab_scene_import_mesh_done() {
 	});
 }
 
-function tab_scene_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object: object_t) {
+function tab_scene_draw_list(list_handle: ui_handle_t, current_object: object_t) {
 	if (char_at(current_object.name, 0) == ".") {
 		return; // Hidden
 	}
@@ -499,7 +498,7 @@ function tab_scene_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object:
 	if (ui.is_hovered && ui.input_released_r) {
 		tab_scene_select_object(current_object.ext);
 
-		ui_menu_draw(function (ui: ui_t) {
+		ui_menu_draw(function () {
 			if (ui_menu_button(tr("Duplicate"))) {
 				sim_duplicate();
 			}
@@ -514,7 +513,7 @@ function tab_scene_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object:
 		for (let i: i32 = 0; i < current_object.children.length; ++i) {
 			let child: object_t = current_object.children[i];
 			ui._x += 8;
-			tab_scene_draw_list(ui, list_handle, child);
+			tab_scene_draw_list(list_handle, child);
 			ui._x -= 8;
 		}
 
@@ -544,7 +543,7 @@ function tab_scene_new_object(mesh_name: string) {
 	}, mo);
 }
 
-function tab_scene_new_menu(ui: ui_t) {
+function tab_scene_new_menu() {
 	for (let i: i32 = 0; i < tab_scene_new_meshes.length; ++i) {
 		let mesh_name: string = tab_scene_new_meshes[i];
 		if (ui_menu_button(mesh_name)) {
@@ -554,7 +553,6 @@ function tab_scene_new_menu(ui: ui_t) {
 }
 
 function tab_scene_draw(htab: ui_handle_t) {
-	let ui: ui_t = ui_base_ui;
 	if (ui_tab(htab, tr("Scene"))) {
 
 		ui_begin_sticky();
@@ -584,7 +582,7 @@ function tab_scene_draw(htab: ui_handle_t) {
 			let scene: object_t = _scene_root.children[0];
 			for (let i: i32 = 0; i < scene.children.length; ++i) {
 				let c: object_t = scene.children[i];
-				tab_scene_draw_list(ui, ui_handle(__ID__), c);
+				tab_scene_draw_list(ui_handle(__ID__), c);
 			}
 
 			// Select object with arrow keys

+ 0 - 1
base/sources/ts/tab_plugins.ts

@@ -1,6 +1,5 @@
 
 function tab_plugins_draw(htab: ui_handle_t) {
-	let ui: ui_t = ui_base_ui;
 	if (ui_tab(htab, tr("Plugins"))) {
 
 		ui_begin_sticky();

+ 3 - 4
base/sources/ts/tab_scripts.ts

@@ -3,7 +3,6 @@ let tab_scripts_hscript: ui_handle_t = ui_handle_create();
 let tab_scripts_text_coloring: ui_text_coloring_t = null;
 
 function tab_scripts_draw(htab: ui_handle_t) {
-	let ui: ui_t = ui_base_ui;
 	if (ui_tab(htab, tr("Scripts"))) {
 
 		ui_begin_sticky();
@@ -16,7 +15,7 @@ function tab_scripts_draw(htab: ui_handle_t) {
 
 		if (ui_button(tr("Edit"))) {
 
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				if (ui_menu_button(tr("Clear"))) {
 					tab_scripts_hscript.text = "";
 				}
@@ -54,7 +53,7 @@ function tab_scripts_draw(htab: ui_handle_t) {
 		let _font: draw_font_t = ui.ops.font;
 		let _font_size: i32 = ui.font_size;
 		let f: draw_font_t = data_get_font("font_mono.ttf");
-		ui_set_font(ui, f);
+		ui_set_font(f);
 		ui.font_size = math_floor(15 * UI_SCALE());
 		ui_text_area_line_numbers = true;
 		ui_text_area_scroll_past_end = true;
@@ -63,7 +62,7 @@ function tab_scripts_draw(htab: ui_handle_t) {
 		ui_text_area_line_numbers = false;
 		ui_text_area_scroll_past_end = false;
 		ui_text_area_coloring = null;
-		ui_set_font(ui, _font);
+		ui_set_font(_font);
 		ui.font_size = _font_size;
 	}
 }

+ 3 - 4
base/sources/ts/tab_swatches.ts

@@ -20,7 +20,6 @@ function tab_swatches_empty_get(): gpu_texture_t {
 }
 
 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 (ui_tab(htab, tr("Swatches")) && statush > ui_status_default_status_h * UI_SCALE()) {
 
@@ -43,7 +42,7 @@ function tab_swatches_draw(htab: ui_handle_t) {
 		}
 
 		if (ui_button(tr("Import"))) {
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				if (ui_menu_button(tr("Replace Existing"))) {
 					project_import_swatches(true);
 					context_set_swatch(project_raw.swatches[0]);
@@ -139,7 +138,7 @@ function tab_swatches_draw(htab: ui_handle_t) {
 
 						_tab_swatches_draw_i = i;
 
-						ui_menu_draw(function (ui: ui_t) {
+						ui_menu_draw(function () {
 							ui.changed = false;
 							let h: ui_handle_t = ui_handle(__ID__);
 							h.color = context_raw.swatch.base;
@@ -187,7 +186,7 @@ function tab_swatches_draw(htab: ui_handle_t) {
 
 					_tab_swatches_draw_i = i;
 
-					ui_menu_draw(function (ui: ui_t) {
+					ui_menu_draw(function () {
 						let i: i32 = _tab_swatches_draw_i;
 
 						if (ui_menu_button(tr("Duplicate"))) {

+ 1 - 2
base/sources/ts/tab_textures.ts

@@ -6,7 +6,6 @@ let _tab_textures_draw_i: i32;
 let _tab_textures_draw_is_packed: bool;
 
 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 (ui_tab(htab, tr("Textures")) && statush > ui_status_default_status_h * UI_SCALE()) {
 
@@ -134,7 +133,7 @@ function tab_textures_draw(htab: ui_handle_t) {
 						_tab_textures_draw_i = i;
 						_tab_textures_draw_is_packed = is_packed;
 
-						ui_menu_draw(function (ui: ui_t) {
+						ui_menu_draw(function () {
 							if (ui_menu_button(tr("Export"))) {
 								ui_files_show("png", true, false, function (path: string) {
 									_tab_textures_draw_path = path;

+ 1 - 1
base/sources/ts/translator.ts

@@ -167,7 +167,7 @@ function translator_init_font(cjk: bool, font_path: string, font_scale: f32) {
 		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));
 
-		ui_set_font(ui_base_ui, f);
+		ui_set_font(f);
 		ui_set_scale(UI_SCALE());
 	});
 }

+ 32 - 32
base/sources/ts/ui_base.ts

@@ -4,7 +4,7 @@ type tab_draw_t = {
 };
 type tab_draw_array_t = tab_draw_t[];
 
-let ui_base_ui: ui_t;
+let ui: ui_t;
 let ui_base_show: bool = true;
 let ui_base_border_started: i32 = 0;
 let ui_base_border_handle: ui_handle_t = null;
@@ -153,7 +153,7 @@ function ui_base_init() {
 		color_wheel: base_color_wheel,
 		black_white_gradient: base_color_wheel_gradient
 	};
-	ui_base_ui = ui_create(ops);
+	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;
@@ -217,7 +217,7 @@ function ui_base_update() {
 		return;
 	}
 
-	if (!ui_base_ui.is_typing) {
+	if (!ui.is_typing) {
 		if (operator_shortcut(map_get(config_keymap, "toggle_node_editor"))) {
 			///if is_paint
 			ui_nodes_canvas_type == canvas_type_t.MATERIAL ? ui_base_show_material_nodes() : ui_base_show_brush_nodes();
@@ -356,7 +356,7 @@ function ui_base_update() {
 	}
 	///end
 
-	let is_typing: bool = ui_base_ui.is_typing;
+	let is_typing: bool = ui.is_typing;
 
 	///if is_paint
 	if (!is_typing) {
@@ -563,8 +563,8 @@ function ui_base_update() {
 				viewport_zoom(-0.2);
 			}
 			else if (operator_shortcut(map_get(config_keymap, "viewport_mode"))) {
-				ui_base_ui.is_key_pressed = false;
-				ui_menu_draw(function (ui: ui_t) {
+				ui.is_key_pressed = false;
+				ui_menu_draw(function () {
 					let mode_handle: ui_handle_t = ui_handle(__ID__);
 					mode_handle.position = context_raw.viewport_mode;
 					ui_text(tr("Viewport Mode"), ui_align_t.RIGHT);
@@ -762,7 +762,7 @@ function ui_base_update() {
 }
 
 function ui_base_view_top() {
-	let is_typing: bool = ui_base_ui.is_typing;
+	let is_typing: bool = ui.is_typing;
 
 	if (context_in_paint_area() && !is_typing) {
 		if (mouse_view_x() < sys_w()) {
@@ -774,7 +774,7 @@ function ui_base_view_top() {
 function ui_base_operator_search() {
 	_ui_base_operator_search_first = true;
 
-	ui_menu_draw(function (ui: ui_t) {
+	ui_menu_draw(function () {
 		ui_menu_h = UI_ELEMENT_H() * 8;
 		let search_handle: ui_handle_t = ui_handle(__ID__);
 		let search: string = ui_text_input(search_handle, "", ui_align_t.LEFT, true, true);
@@ -1148,8 +1148,8 @@ function ui_base_update_ui() {
 
 function ui_base_render() {
 	if (!ui_base_show && config_raw.touch_ui) {
-		ui_base_ui.input_enabled = true;
-		ui_begin(ui_base_ui);
+		ui.input_enabled = true;
+		ui_begin(ui);
 		if (ui_window(ui_handle(__ID__), 0, 0, 150, math_floor(UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 1))) {
 			if (ui_button(tr("Close"))) {
 				ui_base_toggle_distract_free();
@@ -1162,7 +1162,7 @@ function ui_base_render() {
 		return;
 	}
 
-	ui_base_ui.input_enabled = base_ui_enabled;
+	ui.input_enabled = base_ui_enabled;
 
 	// Remember last tab positions
 	for (let i: i32 = 0; i < ui_base_htabs.length; ++i) {
@@ -1177,7 +1177,7 @@ function ui_base_render() {
 		ui_base_htabs[i].position = config_raw.layout_tabs[i];
 	}
 
-	ui_begin(ui_base_ui);
+	ui_begin(ui);
 
 	///if is_paint
 	ui_toolbar_render_ui();
@@ -1192,7 +1192,7 @@ function ui_base_render() {
 
 	ui_end();
 
-	ui_base_ui.input_enabled = true;
+	ui.input_enabled = true;
 }
 
 function ui_base_draw_sidebar() {
@@ -1201,9 +1201,9 @@ function ui_base_draw_sidebar() {
 	let expand_button_offset: i32 = config_raw.touch_ui ? math_floor(UI_ELEMENT_H() + UI_ELEMENT_OFFSET()) : 0;
 	ui_base_tabx = iron_window_width() - config_raw.layout[layout_size_t.SIDEBAR_W];
 
-	let _SCROLL_W: i32 = ui_base_ui.ops.theme.SCROLL_W;
+	let _SCROLL_W: i32 = ui.ops.theme.SCROLL_W;
 	if (mini) {
-		ui_base_ui.ops.theme.SCROLL_W = ui_base_ui.ops.theme.SCROLL_MINI_W;
+		ui.ops.theme.SCROLL_W = ui.ops.theme.SCROLL_MINI_W;
 	}
 
 	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])) {
@@ -1220,42 +1220,42 @@ function ui_base_draw_sidebar() {
 	}
 
 	ui_end_window();
-	ui_base_ui.ops.theme.SCROLL_W = _SCROLL_W;
+	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(UI_ELEMENT_H() + UI_ELEMENT_OFFSET());
 		if (ui_window(ui_handle(__ID__), iron_window_width() - width, iron_window_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;
+			ui._w = width;
+			let _BUTTON_H: i32 = ui.ops.theme.BUTTON_H;
+			let _BUTTON_COL: i32 = ui.ops.theme.BUTTON_COL;
+			ui.ops.theme.BUTTON_H = ui.ops.theme.ELEMENT_H;
+			ui.ops.theme.BUTTON_COL = ui.ops.theme.WINDOW_BG_COL;
 			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] * UI_SCALE());
 			}
-			ui_base_ui.ops.theme.BUTTON_H = _BUTTON_H;
-			ui_base_ui.ops.theme.BUTTON_COL = _BUTTON_COL;
+			ui.ops.theme.BUTTON_H = _BUTTON_H;
+			ui.ops.theme.BUTTON_COL = _BUTTON_COL;
 		}
 	}
 
 	// Expand button
 	if (config_raw.layout[layout_size_t.SIDEBAR_W] == 0) {
-		let width: i32 = math_floor(draw_string_width(ui_base_ui.ops.font, ui_base_ui.font_size, "<<") + 25 * UI_SCALE());
+		let width: i32 = math_floor(draw_string_width(ui.ops.font, ui.font_size, "<<") + 25 * UI_SCALE());
 		if (ui_window(ui_base_hminimized, iron_window_width() - width, 0, width, math_floor(UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 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;
+			ui._w = width;
+			let _BUTTON_H: i32 = ui.ops.theme.BUTTON_H;
+			let _BUTTON_COL: i32 = ui.ops.theme.BUTTON_COL;
+			ui.ops.theme.BUTTON_H = ui.ops.theme.ELEMENT_H;
+			ui.ops.theme.BUTTON_COL = ui.ops.theme.SEPARATOR_COL;
 
 			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;
-			ui_base_ui.ops.theme.BUTTON_COL = _BUTTON_COL;
+			ui.ops.theme.BUTTON_H = _BUTTON_H;
+			ui.ops.theme.BUTTON_COL = _BUTTON_COL;
 		}
 	}
 	else if (ui_base_htabs[tab_area_t.SIDEBAR0].changed && ui_base_htabs[tab_area_t.SIDEBAR0].position == context_raw.last_htab0_pos) {
@@ -1512,7 +1512,7 @@ function ui_base_on_border_hover(handle: ui_handle_t, side: i32) {
 		iron_set_mouse_cursor(3) : // Horizontal
 		iron_set_mouse_cursor(4);  // Vertical
 
-	if (ui_get_current().input_started) {
+	if (ui.input_started) {
 		ui_base_border_started = side;
 		ui_base_border_handle = handle;
 		base_is_resizing = true;

+ 8 - 8
base/sources/ts/ui_box.ts

@@ -4,7 +4,7 @@ let ui_box_draggable: bool = true;
 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: ui_t)=>void = null;
+let ui_box_commands: ()=>void = null;
 let ui_box_click_to_hide: bool = true;
 let ui_box_modalw: i32 = 400;
 let ui_box_modalh: i32 = 170;
@@ -24,7 +24,6 @@ function ui_box_init() {
 
 function ui_box_render() {
 	if (!ui_menu_show) {
-		let ui: ui_t = ui_base_ui;
 		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) {
@@ -55,7 +54,6 @@ function ui_box_render() {
 		draw_end();
 	}
 
-	let ui: ui_t = ui_base_ui;
 	let appw: i32 = iron_window_width();
 	let apph: i32 = iron_window_height();
 	let mw: i32 = math_floor(ui_box_modalw * UI_SCALE());
@@ -109,17 +107,19 @@ function ui_box_render() {
 					ui_box_hide();
 				}
 			}
-			ui_box_window_border(ui);
+			ui_box_window_border();
 		}
 		ui_end();
 	}
 	else {
 		ui_begin(ui);
+		ui.input_enabled = !ui_menu_show && ui.combo_selected_handle == null;
 		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);
+			ui_box_commands();
+			ui_box_window_border();
 		}
+		ui.input_enabled = true;
 		ui_end();
 	}
 
@@ -140,7 +140,7 @@ function ui_box_show_message(title: string, text: string, copyable: bool = false
 	///end
 }
 
-function ui_box_show_custom(commands: (ui: ui_t)=>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) {
 	ui_box_init();
 	ui_box_modalw = mw;
 	ui_box_modalh = mh;
@@ -191,7 +191,7 @@ function ui_box_tween_tick() {
 	base_redraw_ui();
 }
 
-function ui_box_window_border(ui: ui_t) {
+function ui_box_window_border() {
 	if (ui.scissor) {
 		ui.scissor = false;
 		gpu_disable_scissor();

+ 1 - 1
base/sources/ts/ui_files.ts

@@ -76,7 +76,7 @@ function make_draw_cloud_icon_data(f: string, image: gpu_texture_t): draw_cloud_
 	return data;
 }
 
-function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = false, search: string = "", refresh: bool = false, context_menu: (s: string)=>void = null): string {
+function ui_files_file_browser(handle: ui_handle_t, drag_files: bool = false, search: string = "", refresh: bool = false, context_menu: (s: string)=>void = null): string {
 
 	let icons: gpu_texture_t = resource_get("icons.k");
 	let folder: rect_t = resource_tile50(icons, 2, 1);

+ 1 - 2
base/sources/ts/ui_header.ts

@@ -9,7 +9,6 @@ function ui_header_init() {
 }
 
 function ui_header_render_ui() {
-	let ui: ui_t = ui_base_ui;
 	if (config_raw.touch_ui) {
 		ui_header_h = ui_header_default_h + 6;
 	}
@@ -31,6 +30,6 @@ function ui_header_render_ui() {
 
 	if (ui_window(ui_header_handle, sys_x(), ui_header_h, ww, ui_header_h)) {
 		ui._y += 2;
-		ui_header_draw_tool_properties(ui);
+		ui_header_draw_tool_properties();
 	}
 }

+ 9 - 10
base/sources/ts/ui_menu.ts

@@ -5,14 +5,13 @@ let ui_menu_x: i32 = 0;
 let ui_menu_y: i32 = 0;
 let ui_menu_h: i32 = 0;
 let ui_menu_keep_open: bool = false;
-let ui_menu_commands: (ui: ui_t)=>void = null;
+let ui_menu_commands: ()=>void = null;
 let ui_menu_show_first: bool = true;
 let ui_menu_hide_flag: bool = false;
 
 let _ui_menu_render_msg: string;
 
 function ui_menu_render() {
-	let ui: ui_t = ui_base_ui;
 	let menu_w: i32 = ui_menu_commands != null ?
 		math_floor(base_default_element_w * UI_SCALE() * 2.3) :
 		math_floor(UI_ELEMENT_W() * 2.3);
@@ -37,10 +36,10 @@ function ui_menu_render() {
 
 	draw_begin();
 	ui_begin_region(ui, ui_menu_x, ui_menu_y, menu_w);
-	ui_menu_start(ui);
+	ui_menu_start();
 
 	if (ui_menu_commands != null) {
-		ui_menu_commands(ui);
+		ui_menu_commands();
 	}
 
 	ui_menu_hide_flag = ui.combo_selected_handle == null && !ui_menu_keep_open && !ui_menu_show_first && (ui.changed || ui.input_released || ui.input_released_r || ui.is_escape_down);
@@ -49,7 +48,7 @@ function ui_menu_render() {
 	ui.ops.theme.FILL_BUTTON_BG = _FILL_BUTTON_BG;
 	ui.ops.theme.ELEMENT_OFFSET = _ELEMENT_OFFSET;
 	ui.ops.theme.ELEMENT_H = _ELEMENT_H;
-	ui_menu_end(ui);
+	ui_menu_end();
 	ui_end_region();
 	draw_end();
 
@@ -75,7 +74,7 @@ function ui_menu_hide() {
 	base_redraw_ui();
 }
 
-function ui_menu_draw(commands: (ui: ui_t)=>void = null, x: i32 = -1, y: i32 = -1) {
+function ui_menu_draw(commands: ()=>void = null, x: i32 = -1, y: i32 = -1) {
 	ui_end_input();
 	if (ui_menu_show) {
 		ui_menu_nested = true;
@@ -110,7 +109,7 @@ function ui_menu_fit_to_screen() {
 	}
 }
 
-function ui_menu_separator(ui: ui_t) {
+function ui_menu_separator() {
 	ui._y++;
 	if (config_raw.touch_ui) {
 		ui_fill(0, 0, ui._w / UI_SCALE(), 1, ui.ops.theme.BUTTON_COL);
@@ -127,7 +126,7 @@ function ui_menu_button(text: string, label: string = ""): bool {
 	return ui_button(config_button_spacing + text, config_button_align, label);
 }
 
-function ui_menu_align(ui: ui_t) {
+function ui_menu_align() {
 	if (!config_raw.touch_ui) {
 		let row: f32[] = [12 / 100, 88 / 100];
 		ui_row(row);
@@ -135,7 +134,7 @@ function ui_menu_align(ui: ui_t) {
 	}
 }
 
-function ui_menu_start(ui: ui_t) {
+function ui_menu_start() {
 	ui_draw_shadow(ui._x, ui._y, ui._w, ui_menu_h);
 
 	draw_set_color(ui.ops.theme.SEPARATOR_COL);
@@ -143,5 +142,5 @@ function ui_menu_start(ui: ui_t) {
 	draw_set_color(0xffffffff);
 }
 
-function ui_menu_end(ui: ui_t) {
+function ui_menu_end() {
 }

+ 34 - 38
base/sources/ts/ui_menubar.ts

@@ -19,8 +19,6 @@ function ui_menubar_init() {
 }
 
 function ui_menubar_render_ui() {
-	let ui: ui_t = ui_base_ui;
-
 	let item_w: i32 = ui_toolbar_w();
 	let panel_x: i32 = sys_x();
 
@@ -44,8 +42,8 @@ function ui_menubar_render_ui() {
 			ui._w = 36;
 			///end
 
-			if (ui_menubar_icon_button(ui, 0, 2)) box_preferences_show();
-			if (ui_menubar_icon_button(ui, 0, 3)) {
+			if (ui_menubar_icon_button(0, 2)) box_preferences_show();
+			if (ui_menubar_icon_button(0, 3)) {
 				///if (arm_android || arm_ios)
 				console_toast(tr("Saving project"));
 				project_save();
@@ -54,11 +52,11 @@ function ui_menubar_render_ui() {
 					box_projects_show();
 				});
 			}
-			if (ui_menubar_icon_button(ui, 4, 2)) {
+			if (ui_menubar_icon_button(4, 2)) {
 				project_import_asset();
 			}
 			///if (is_paint || is_lab)
-			if (ui_menubar_icon_button(ui, 5, 2)) {
+			if (ui_menubar_icon_button(5, 2)) {
 				box_export_show_textures();
 			}
 			///end
@@ -66,33 +64,33 @@ function ui_menubar_render_ui() {
 			if (ui_menu_show && ui_menubar_category == menubar_category_t.VIEWPORT) {
 				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, menubar_category_t.VIEWPORT);
+			if (ui_menubar_icon_button(8, 2)) {
+				ui_menubar_show_menu(menubar_category_t.VIEWPORT);
 			}
 			if (ui_menu_show && ui_menubar_category == menubar_category_t.MODE) {
 				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, menubar_category_t.MODE);
+			if (ui_menubar_icon_button(9, 2)) {
+				ui_menubar_show_menu(menubar_category_t.MODE);
 			}
 			if (ui_menu_show && ui_menubar_category == menubar_category_t.CAMERA) {
 				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, menubar_category_t.CAMERA);
+			if (ui_menubar_icon_button(10, 2)) {
+				ui_menubar_show_menu(menubar_category_t.CAMERA);
 			}
 			if (ui_menu_show && ui_menubar_category == menubar_category_t.HELP) {
 				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, menubar_category_t.HELP);
+			if (ui_menubar_icon_button(11, 2)) {
+				ui_menubar_show_menu(menubar_category_t.HELP);
 			}
 			ui.enabled = history_undos > 0;
-			if (ui_menubar_icon_button(ui, 6, 2)) {
+			if (ui_menubar_icon_button(6, 2)) {
 				history_undo();
 			}
 			ui.enabled = history_redos > 0;
-			if (ui_menubar_icon_button(ui, 7, 2)) {
+			if (ui_menubar_icon_button(7, 2)) {
 				history_redo();
 			}
 			ui.enabled = true;
@@ -101,7 +99,7 @@ function ui_menubar_render_ui() {
 			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 (_ui_menu_button(categories[i]) || (ui_menu_show && ui_menu_commands == ui_menubar_draw_category_items && ui.is_hovered)) {
-					ui_menubar_show_menu(ui, i);
+					ui_menubar_show_menu(i);
 				}
 			}
 		}
@@ -124,8 +122,6 @@ function ui_menubar_render_ui() {
 }
 
 function ui_menubar_draw_tab_header() {
-	let ui: ui_t = ui_base_ui;
-
 	let item_w: i32 = ui_toolbar_w();
 	let panel_x: i32 = sys_x();
 
@@ -208,7 +204,7 @@ function ui_menubar_draw_tab_header() {
 	}
 }
 
-function ui_menubar_draw_category_items(ui: ui_t) {
+function ui_menubar_draw_category_items() {
 	if (ui_menubar_category == menubar_category_t.FILE) {
 		if (ui_menu_button(tr("New Project..."), map_get(config_keymap, "file_new"))) {
 			project_new_box();
@@ -225,7 +221,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		if (ui_menu_button(tr("Save As..."), map_get(config_keymap, "file_save_as"))) {
 			project_save_as();
 		}
-		ui_menu_separator(ui);
+		ui_menu_separator();
 		if (ui_menu_button(tr("Import Texture..."), map_get(config_keymap, "file_import_assets"))) {
 			project_import_asset(string_array_join(path_texture_formats, ","), false);
 		}
@@ -265,7 +261,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		if (ui_menu_button(tr("Reimport Textures"), map_get(config_keymap, "file_reimport_textures"))) {
 			project_reimport_textures();
 		}
-		ui_menu_separator(ui);
+		ui_menu_separator();
 		///if (is_paint || is_lab)
 		if (ui_menu_button(tr("Export Textures..."), map_get(config_keymap, "file_export_textures_as"))) {
 			context_raw.layers_export = export_mode_t.VISIBLE;
@@ -286,7 +282,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		}
 		///end
 
-		ui_menu_separator(ui);
+		ui_menu_separator();
 		if (ui_menu_button(tr("Exit"))) {
 			iron_stop();
 		}
@@ -315,7 +311,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 			history_redo();
 		}
 		ui.enabled = true;
-		ui_menu_separator(ui);
+		ui_menu_separator();
 		if (ui_menu_button(tr("Preferences..."), map_get(config_keymap, "edit_prefs"))) {
 			box_preferences_show();
 		}
@@ -323,7 +319,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 	else if (ui_menubar_category == menubar_category_t.VIEWPORT) {
 		if (ui_menu_button(tr("Distract Free"), map_get(config_keymap, "view_distract_free"))) {
 			ui_base_toggle_distract_free();
-			ui_base_ui.is_hovered = false;
+			ui.is_hovered = false;
 		}
 
 		///if !(arm_android || arm_ios)
@@ -337,7 +333,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		let p: world_data_t = scene_world;
 		let env_handle: ui_handle_t = ui_handle(__ID__);
 		env_handle.value = p.strength;
-		ui_menu_align(ui);
+		ui_menu_align();
 		p.strength = ui_slider(env_handle, tr("Environment"), 0.0, 8.0, true);
 		if (env_handle.changed) {
 			context_raw.ddirty = 2;
@@ -351,7 +347,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		else if (enva_handle.value > 360) {
 			enva_handle.value -= math_floor(enva_handle.value / 360) * 360;
 		}
-		ui_menu_align(ui);
+		ui_menu_align();
 		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<string, string> = map_create();
@@ -378,7 +374,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		if (brush_scale_handle.init) {
 			brush_scale_handle.value = context_raw.brush_scale;
 		}
-		ui_menu_align(ui);
+		ui_menu_align();
 		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();
@@ -502,7 +498,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 			viewport_reset();
 			viewport_scale_to_bounds();
 		}
-		ui_menu_separator(ui);
+		ui_menu_separator();
 		if (ui_menu_button(tr("Front"), map_get(config_keymap, "view_front"))) {
 			viewport_set_view(0, -1, 0, math_pi() / 2, 0, 0);
 		}
@@ -521,7 +517,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		if (ui_menu_button(tr("Bottom"), map_get(config_keymap, "view_bottom"))) {
 			viewport_set_view(0, 0, -1, math_pi(), 0, math_pi());
 		}
-		ui_menu_separator(ui);
+		ui_menu_separator();
 
 		ui.changed = false;
 
@@ -552,13 +548,13 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 		if (context_raw.fov_handle.init) {
 			context_raw.fov_handle.value = math_floor(cam.data.fov * 100) / 100;
 		}
-		ui_menu_align(ui);
+		ui_menu_align();
 		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_align(ui);
+		ui_menu_align();
 		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")];
@@ -574,7 +570,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 			ui_tooltip(orbit_and_rotate_tooltip + "\n\n" + fly_tooltip);
 		}
 
-		ui_menu_align(ui);
+		ui_menu_align();
 		let camera_type_items: string[] = [tr("Perspective"), tr("Orthographic")];
 		context_raw.camera_type = ui_inline_radio(context_raw.cam_handle, camera_type_items, ui_align_t.LEFT);
 		if (ui.is_hovered) {
@@ -615,7 +611,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 			file_load_url("https://github.com/armory3d/armortools/issues/new?labels=feature%20request&template=feature_request.md&body=*" + manifest_title + "%20" + manifest_version + "-" + config_get_sha() + ",%20" + iron_system_id() + "*%0A%0A**Feature description:**%0A%0A");
 			///end
 		}
-		ui_menu_separator(ui);
+		ui_menu_separator();
 
 		if (ui_menu_button(tr("Check for Updates..."))) {
 			///if arm_android
@@ -690,7 +686,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 
 			_ui_menu_render_msg = msg;
 
-			ui_box_show_custom(function (ui: ui_t) {
+			ui_box_show_custom(function () {
 				let tab_vertical: bool = config_raw.touch_ui;
 				if (ui_tab(ui_handle(__ID__), tr("About"), tab_vertical)) {
 
@@ -726,7 +722,7 @@ function ui_menubar_draw_category_items(ui: ui_t) {
 	}
 }
 
-function ui_menubar_show_menu(ui: ui_t, category: i32) {
+function ui_menubar_show_menu(category: i32) {
 	if (ui_menu_show && ui_menubar_category == category) {
 		return;
 	}
@@ -737,7 +733,7 @@ function ui_menubar_show_menu(ui: ui_t, category: i32) {
 	ui_menubar_category = category;
 
 	ui_menu_x = math_floor(ui._x - ui._w);
-	ui_menu_y = math_floor(ui_MENUBAR_H(ui));
+	ui_menu_y = math_floor(ui_MENUBAR_H());
 	if (config_raw.touch_ui) {
 		let menu_w: i32 = math_floor(base_default_element_w * UI_SCALE() * 2.0);
 		ui_menu_x -= math_floor((menu_w - ui._w) / 2) + math_floor(ui_header_h / 2);
@@ -747,7 +743,7 @@ function ui_menubar_show_menu(ui: ui_t, category: i32) {
 	}
 }
 
-function ui_menubar_icon_button(ui: ui_t, i: i32, j: i32): bool {
+function ui_menubar_icon_button(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;

+ 100 - 100
base/sources/ts/ui_nodes.ts

@@ -65,7 +65,7 @@ function ui_viewnodes_init() {
 	ui_nodes_grid_snap = config_raw.grid_snap;
 	nodes_material_init();
 
-	// ui_base_ui.scroll_enabled = false;
+	// ui.scroll_enabled = false;
 }
 
 function ui_viewnodes_on_link_drag(link_drag_id: i32, is_new_link: bool) {
@@ -78,8 +78,8 @@ function ui_viewnodes_on_link_drag(link_drag_id: i32, is_new_link: bool) {
 	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_base_ui._window_x + UI_NODE_X(node);
-	let link_y: i32 = ui_base_ui._window_y + UI_NODE_Y(node);
+	let link_x: i32 = ui._window_x + UI_NODE_X(node);
+	let link_y: i32 = ui._window_y + UI_NODE_Y(node);
 	if (link_drag.from_id > -1) {
 		link_x += UI_NODE_W(node);
 		link_y += UI_OUTPUT_Y(node.outputs.length, link_drag.from_socket);
@@ -145,14 +145,14 @@ function ui_viewnodes_on_socket_released(socket_id: i32) {
 	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_base_ui.input_released_r) {
+	if (ui.input_released_r) {
 		if (node.type == "GROUP_INPUT" || node.type == "GROUP_OUTPUT") {
 
 			_ui_nodes_on_socket_released_socket = socket;
 			_ui_nodes_on_socket_released_node = node;
 
 			sys_notify_on_next_frame(function () {
-				ui_menu_draw(function (ui: ui_t) {
+				ui_menu_draw(function () {
 
 					let socket: ui_node_socket_t = _ui_nodes_on_socket_released_socket;
 					let node: ui_node_t = _ui_nodes_on_socket_released_node;
@@ -177,7 +177,7 @@ function ui_viewnodes_on_socket_released(socket_id: i32) {
 						sys_notify_on_next_frame(function () {
 							ui_end_input();
 
-							ui_box_show_custom(function (ui: ui_t) {
+							ui_box_show_custom(function () {
 
 								let socket: ui_node_socket_t = _ui_nodes_on_socket_released_socket;
 								let node: ui_node_t = _ui_nodes_on_socket_released_node;
@@ -265,10 +265,10 @@ function ui_viewnodes_on_socket_released(socket_id: i32) {
 }
 
 function ui_viewnodes_on_canvas_released() {
-	if (ui_base_ui.input_released_r &&
+	if (ui.input_released_r &&
 		context_in_nodes() &&
-		math_abs(ui_base_ui.input_x - ui_base_ui.input_started_x) < 2 &&
-		math_abs(ui_base_ui.input_y - ui_base_ui.input_started_y) < 2) {
+		math_abs(ui.input_x - ui.input_started_x) < 2 &&
+		math_abs(ui.input_y - ui.input_started_y) < 2) {
 
 		// Node selection
 		let nodes: ui_nodes_t = ui_nodes_get_nodes();
@@ -277,8 +277,8 @@ function ui_viewnodes_on_canvas_released() {
 		for (let i: i32 = 0; i < canvas.nodes.length; ++i) {
 			let node: ui_node_t = canvas.nodes[i];
 			if (ui_input_in_rect(
-					ui_base_ui._window_x + UI_NODE_X(node),
-					ui_base_ui._window_y + UI_NODE_Y(node),
+					ui._window_x + UI_NODE_X(node),
+					ui._window_y + UI_NODE_Y(node),
 					UI_NODE_W(node),
 					UI_NODE_H(canvas, node))) {
 				selected = node;
@@ -297,11 +297,11 @@ function ui_viewnodes_on_canvas_released() {
 
 			_ui_nodes_on_canvas_released_selected = selected;
 
-			ui_menu_draw(function (ui_menu: ui_t) {
+			ui_menu_draw(function () {
 
 				let selected: ui_node_t = _ui_nodes_on_canvas_released_selected;
 
-				ui_menu._y += 1;
+				ui._y += 1;
 				let is_protected: bool = selected == null ||
 					///if is_paint
 					selected.type == "OUTPUT_MATERIAL_PBR" ||
@@ -309,7 +309,7 @@ function ui_viewnodes_on_canvas_released() {
 					selected.type == "GROUP_INPUT" ||
 					selected.type == "GROUP_OUTPUT" ||
 					selected.type == "brush_output_node";
-				ui_menu.enabled = !is_protected;
+				ui.enabled = !is_protected;
 				if (ui_menu_button(tr("Cut"), "ctrl+x")) {
 					sys_notify_on_next_frame(function () {
 						ui_nodes_hwnd.redraws = 2;
@@ -324,7 +324,7 @@ function ui_viewnodes_on_canvas_released() {
 						ui_nodes_is_node_menu_op = true;
 					});
 				}
-				ui_menu.enabled = ui_clipboard != "";
+				ui.enabled = ui_clipboard != "";
 				if (ui_menu_button(tr("Paste"), "ctrl+v")) {
 					sys_notify_on_next_frame(function () {
 						ui_nodes_hwnd.redraws = 2;
@@ -332,11 +332,11 @@ function ui_viewnodes_on_canvas_released() {
 						ui_nodes_is_node_menu_op = true;
 					});
 				}
-				ui_menu.enabled = !is_protected;
+				ui.enabled = !is_protected;
 				if (ui_menu_button(tr("Delete"), "delete")) {
 					sys_notify_on_next_frame(function () {
 						ui_nodes_hwnd.redraws = 2;
-						ui_base_ui.is_delete_down = true;
+						ui.is_delete_down = true;
 						ui_nodes_is_node_menu_op = true;
 					});
 				}
@@ -359,23 +359,23 @@ function ui_viewnodes_on_canvas_released() {
 				}
 
 				if (ui_nodes_canvas_type == canvas_type_t.MATERIAL) {
-					ui_menu_separator(ui_menu);
+					ui_menu_separator();
 					if (ui_menu_button(tr("2D View"))) {
 						ui_base_show_2d_view(view_2d_type_t.NODE);
 					}
 				}
 
-				ui_menu.enabled = true;
+				ui.enabled = true;
 			});
 		}
 	}
 
-	if (ui_base_ui.input_released) {
+	if (ui.input_released) {
 		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: ui_node_t = canvas.nodes[i];
-			if (ui_input_in_rect(ui_base_ui._window_x + UI_NODE_X(node), ui_base_ui._window_y + UI_NODE_Y(node), UI_NODE_W(node), UI_NODE_H(canvas, node))) {
+			if (ui_input_in_rect(ui._window_x + UI_NODE_X(node), ui._window_y + UI_NODE_Y(node), UI_NODE_W(node), UI_NODE_H(canvas, node))) {
 				if (nodes.nodes_selected_id.length > 0 && node.id == nodes.nodes_selected_id[0]) {
 					ui_view2d_hwnd.redraws = 2;
 					if (sys_time() - context_raw.select_time < 0.25) ui_base_show_2d_view(view_2d_type_t.NODE);
@@ -388,12 +388,12 @@ function ui_viewnodes_on_canvas_released() {
 }
 
 function ui_viewnodes_on_canvas_control(): ui_canvas_control_t {
-	let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_base_ui, ui_nodes_controls_down);
+	let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_nodes_controls_down);
 	ui_nodes_controls_down = control.controls_down;
 	return control;
 }
 
-function ui_nodes_get_canvas_control(ui: ui_t, controls_down: bool): ui_canvas_control_t {
+function ui_nodes_get_canvas_control(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;
@@ -436,7 +436,7 @@ function ui_nodes_get_canvas_control(ui: ui_t, controls_down: bool): ui_canvas_c
 	}
 
 	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 zoom_delta: f32 = operator_shortcut(map_get(config_keymap, "action_zoom"), shortcut_type_t.DOWN) ? ui_nodes_get_zoom_delta() / 100.0 : 0.0;
 	let control: ui_canvas_control_t = {
 		pan_x: pan ? ui.input_dx : 0.0,
 		pan_y: pan ? ui.input_dy : 0.0,
@@ -453,7 +453,7 @@ function ui_nodes_get_canvas_control(ui: ui_t, controls_down: bool): ui_canvas_c
 	return control;
 }
 
-function ui_nodes_get_zoom_delta(ui: ui_t): f32 {
+function ui_nodes_get_zoom_delta(): 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 :
@@ -557,34 +557,34 @@ function ui_nodes_update() {
 	if (mx < ui_nodes_wx || mx > ui_nodes_wx + ww || my < ui_nodes_wy) {
 		return;
 	}
-	if (ui_base_ui.is_typing || !ui_base_ui.input_enabled) {
+	if (ui.is_typing || !ui.input_enabled) {
 		return;
 	}
 
 	let nodes: ui_nodes_t = ui_nodes_get_nodes();
-	if (nodes.nodes_selected_id.length > 0 && ui_base_ui.is_key_pressed) {
-		if (ui_base_ui.key_code == key_code_t.LEFT) {
+	if (nodes.nodes_selected_id.length > 0 && ui.is_key_pressed) {
+		if (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: ui_node_t[] = ui_nodes_get_canvas(true).nodes;
 				ui_get_node(_nodes, n).x -= 1;
 			}
 		}
-		else if (ui_base_ui.key_code == key_code_t.RIGHT) {
+		else if (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: ui_node_t[] = ui_nodes_get_canvas(true).nodes;
 				ui_get_node(_nodes, n).x += 1;
 			}
 		}
-		if (ui_base_ui.key_code == key_code_t.UP) {
+		if (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: ui_node_t[] = ui_nodes_get_canvas(true).nodes;
 				ui_get_node(_nodes, n).y -= 1;
 			}
 		}
-		else if (ui_base_ui.key_code == key_code_t.DOWN) {
+		else if (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: ui_node_t[] = ui_nodes_get_canvas(true).nodes;
@@ -598,8 +598,8 @@ function ui_nodes_update() {
 		ui_nodes_node_search();
 	}
 	if (ui_nodes_node_search_spawn != null) {
-		ui_base_ui.input_x = mouse_x; // Fix inputDX after popup removal
-		ui_base_ui.input_y = mouse_y;
+		ui.input_x = mouse_x; // Fix inputDX after popup removal
+		ui.input_y = mouse_y;
 		ui_nodes_node_search_spawn = null;
 	}
 
@@ -619,7 +619,7 @@ 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: ui_t) {
+	ui_menu_draw(function () {
 		ui_menu_h = UI_ELEMENT_H() * 8;
 		let search_handle: ui_handle_t = ui_handle(__ID__);
 		let search: string = to_lower_case(ui_text_input(search_handle, "", ui_align_t.LEFT, true, true));
@@ -731,9 +731,9 @@ function ui_nodes_draw_grid(zoom: f32): gpu_texture_t {
 	}
 
 	let grid: gpu_texture_t = gpu_create_render_target(w, h);
-	draw_begin(grid, true, ui_base_ui.ops.theme.SEPARATOR_COL);
+	draw_begin(grid, true, ui.ops.theme.SEPARATOR_COL);
 
-	let sep_col: i32 = ui_base_ui.ops.theme.SEPARATOR_COL;
+	let sep_col: i32 = ui.ops.theme.SEPARATOR_COL;
 	let line_primary: i32 = sep_col - 0x00050505;
 	if (line_primary < 0xff000000) {
 		line_primary = sep_col + 0x00050505;
@@ -849,13 +849,13 @@ function ui_nodes_render() {
 		array_remove(c.links, ui_get_link(c.links, nodes.link_drag_id));
 		nodes.link_drag_id = -1;
 	}
-	ui_nodes_release_link = ui_base_ui.input_released;
+	ui_nodes_release_link = ui.input_released;
 
 	if (!ui_nodes_show || iron_window_width() == 0 || iron_window_height() == 0) {
 		return;
 	}
 
-	ui_base_ui.input_enabled = base_ui_enabled;
+	ui.input_enabled = base_ui_enabled;
 
 	if (ui_nodes_grid_redraw) {
 		if (ui_nodes_grid != null) {
@@ -873,7 +873,7 @@ function ui_nodes_render() {
 	///end
 
 	// Start with UI
-	ui_begin(ui_base_ui);
+	ui_begin(ui);
 
 	// Make window
 	ui_nodes_ww = config_raw.layout[layout_size_t.NODES_W];
@@ -944,21 +944,21 @@ function ui_nodes_render() {
 		draw_image(ui_nodes_grid, x, y);
 
 		// Undo
-		if (ui_base_ui.input_started || ui_base_ui.is_key_pressed) {
+		if (ui.input_started || ui.is_key_pressed) {
 			ui_nodes_last_canvas = util_clone_canvas(ui_nodes_get_canvas(true));
 		}
 
 		// Nodes
-		let _input_enabled: bool = ui_base_ui.input_enabled;
-		ui_base_ui.input_enabled = _input_enabled && !ui_nodes_show_menu;
+		let _input_enabled: bool = ui.input_enabled;
+		ui.input_enabled = _input_enabled && !ui_nodes_show_menu;
 		///if is_paint
-		ui_base_ui.window_border_right = config_raw.layout[layout_size_t.SIDEBAR_W];
+		ui.window_border_right = config_raw.layout[layout_size_t.SIDEBAR_W];
 		///end
-		ui_base_ui.window_border_top = ui_header_h * 2;
-		ui_base_ui.window_border_bottom = config_raw.layout[layout_size_t.STATUS_H];
+		ui.window_border_top = ui_header_h * 2;
+		ui.window_border_bottom = config_raw.layout[layout_size_t.STATUS_H];
 
 		ui_node_canvas(nodes, c);
-		ui_base_ui.input_enabled = _input_enabled;
+		ui.input_enabled = _input_enabled;
 
 		if (nodes.color_picker_callback != null) {
 			context_raw.color_picker_previous_tool = context_raw.tool;
@@ -1027,23 +1027,23 @@ function ui_nodes_render() {
 			ui_is_copy = false;
 			ui_is_cut = false;
 			ui_is_paste = false;
-			ui_base_ui.is_delete_down = false;
+			ui.is_delete_down = false;
 		}
 
 		// Recompile material on change
-		if (ui_base_ui.changed) {
+		if (ui.changed) {
 			///if is_paint
-			ui_nodes_recompile_mat = (ui_base_ui.input_dx != 0 || ui_base_ui.input_dy != 0 || !ui_nodes_uichanged_last) && config_raw.material_live; // Instant preview
+			ui_nodes_recompile_mat = (ui.input_dx != 0 || ui.input_dy != 0 || !ui_nodes_uichanged_last) && config_raw.material_live; // Instant preview
 			///end
 			///if is_lab
-			ui_nodes_recompile_mat = (ui_base_ui.input_dx != 0 || ui_base_ui.input_dy != 0 || !ui_nodes_uichanged_last); // Instant preview
+			ui_nodes_recompile_mat = (ui.input_dx != 0 || ui.input_dy != 0 || !ui_nodes_uichanged_last); // Instant preview
 			///end
 		}
 		else if (ui_nodes_uichanged_last) {
 			ui_nodes_canvas_changed();
 			ui_nodes_push_undo(ui_nodes_last_canvas);
 		}
-		ui_nodes_uichanged_last = ui_base_ui.changed;
+		ui_nodes_uichanged_last = ui.changed;
 
 		// Node previews
 		if (config_raw.node_preview && nodes.nodes_selected_id.length > 0) {
@@ -1115,24 +1115,24 @@ function ui_nodes_render() {
 		}
 
 		// Menu
-		draw_set_color(ui_base_ui.ops.theme.SEPARATOR_COL);
+		draw_set_color(ui.ops.theme.SEPARATOR_COL);
 		draw_filled_rect(0, UI_ELEMENT_H(), ui_nodes_ww, UI_ELEMENT_H() + UI_ELEMENT_OFFSET() * 2);
 		draw_set_color(0xffffffff);
 
 		let start_y: i32 = UI_ELEMENT_H() + UI_ELEMENT_OFFSET();
-		ui_base_ui._x = 0;
-		ui_base_ui._y = 2 + start_y;
-		ui_base_ui._w = ew;
+		ui._x = 0;
+		ui._y = 2 + start_y;
+		ui._w = ew;
 
 		///if is_paint
 		// Editable canvas name
 		let h: ui_handle_t = ui_handle(__ID__);
 		h.text = c.name;
-		ui_base_ui._w = math_floor(math_min(draw_string_width(ui_base_ui.ops.font, ui_base_ui.font_size, h.text) + 15 * UI_SCALE(), 100 * UI_SCALE()));
+		ui._w = math_floor(math_min(draw_string_width(ui.ops.font, ui.font_size, h.text) + 15 * UI_SCALE(), 100 * UI_SCALE()));
 		let new_name: string = ui_text_input(h, "");
-		ui_base_ui._x += ui_base_ui._w + 3;
-		ui_base_ui._y = 2 + start_y;
-		ui_base_ui._w = ew;
+		ui._x += ui._w + 3;
+		ui._y = 2 + start_y;
+		ui._w = ew;
 
 		if (h.changed) { // Check whether renaming is possible and update group links
 			if (ui_nodes_group_stack.length > 0) {
@@ -1178,12 +1178,12 @@ function ui_nodes_render() {
 		// let type: i32 = ui_combo(type_handle, type_combo, tr("Type"), true);
 
 		///if is_lab
-		ui_base_ui.window_border_top = 0;
+		ui.window_border_top = 0;
 		ui_nodes_ext_draw_buttons(ew, start_y);
 		///end
 
-		let _BUTTON_COL: i32 = ui_base_ui.ops.theme.BUTTON_COL;
-		ui_base_ui.ops.theme.BUTTON_COL = ui_base_ui.ops.theme.SEPARATOR_COL;
+		let _BUTTON_COL: i32 = ui.ops.theme.BUTTON_COL;
+		ui.ops.theme.BUTTON_COL = ui.ops.theme.SEPARATOR_COL;
 
 		///if is_paint
 		let cats: string[] = ui_nodes_canvas_type == canvas_type_t.MATERIAL ? nodes_material_categories : nodes_brush_categories;
@@ -1193,48 +1193,48 @@ function ui_nodes_render() {
 		///end
 
 		for (let i: i32 = 0; i < cats.length; ++i) {
-			if ((_ui_menu_button(tr(cats[i]))) || (ui_base_ui.is_hovered && ui_nodes_show_menu)) {
+			if ((_ui_menu_button(tr(cats[i]))) || (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_base_ui._x;
-				ui_nodes_popup_y = ui_nodes_wy + ui_base_ui._y;
+				ui_nodes_popup_x = ui_nodes_wx + ui._x;
+				ui_nodes_popup_y = ui_nodes_wy + ui._y;
 				if (config_raw.touch_ui) {
 					ui_nodes_show_menu_first = true;
 					let menuw: i32 = math_floor(ew * 2.3);
 					ui_nodes_popup_x -= menuw / 2;
-					ui_nodes_popup_x += ui_base_ui._w / 2;
+					ui_nodes_popup_x += ui._w / 2;
 				}
 			}
-			ui_base_ui._x += ui_base_ui._w + 3;
-			ui_base_ui._y = 2 + start_y;
+			ui._x += ui._w + 3;
+			ui._y = 2 + start_y;
 		}
 
 		if (config_raw.touch_ui) {
-			let _w: i32 = ui_base_ui._w;
-			ui_base_ui._w = math_floor(36 * UI_SCALE());
-			ui_base_ui._y = 4 * UI_SCALE() + start_y;
-			if (ui_menubar_icon_button(ui_base_ui, 2, 3)) {
-				ui_nodes_node_search(math_floor(ui_base_ui._window_x + ui_base_ui._x), math_floor(ui_base_ui._window_y + ui_base_ui._y));
+			let _w: i32 = ui._w;
+			ui._w = math_floor(36 * UI_SCALE());
+			ui._y = 4 * UI_SCALE() + start_y;
+			if (ui_menubar_icon_button(2, 3)) {
+				ui_nodes_node_search(math_floor(ui._window_x + ui._x), math_floor(ui._window_y + ui._y));
 			}
-			ui_base_ui._w = _w;
+			ui._w = _w;
 		}
 		else {
 			if (_ui_menu_button(tr("Search"))) {
-				ui_nodes_node_search_x = ui_base_ui._window_x + ui_base_ui._x;
-				ui_nodes_node_search_y = ui_base_ui._window_y + ui_base_ui._y;
+				ui_nodes_node_search_x = ui._window_x + ui._x;
+				ui_nodes_node_search_y = ui._window_y + ui._y;
 				// Allow for node menu to be closed first
 				sys_notify_on_init(function() {
 					ui_nodes_node_search(math_floor(ui_nodes_node_search_x), math_floor(ui_nodes_node_search_y));
 				});
 			}
 		}
-		if (ui_base_ui.is_hovered) {
+		if (ui.is_hovered) {
 			ui_tooltip(tr("Search for nodes") + " (" + map_get(config_keymap, "node_search") + ")");
 		}
-		ui_base_ui._x += ui_base_ui._w + 3;
-		ui_base_ui._y = 2 + start_y;
+		ui._x += ui._w + 3;
+		ui._y = 2 + start_y;
 
-		ui_base_ui.ops.theme.BUTTON_COL = _BUTTON_COL;
+		ui.ops.theme.BUTTON_COL = _BUTTON_COL;
 
 		// Close node group
 		if (ui_nodes_group_stack.length > 0 && _ui_menu_button(tr("Close"))) {
@@ -1269,20 +1269,20 @@ function ui_nodes_render() {
 		let py: i32 = ui_nodes_popup_y;
 		let menuw: i32 = math_floor(ew * 2.3);
 		draw_begin(null);
-		ui_begin_region(ui_base_ui, math_floor(ui_nodes_popup_x), math_floor(py), menuw);
-		let _FILL_BUTTON_BG: i32 = ui_base_ui.ops.theme.FILL_BUTTON_BG;
-		ui_base_ui.ops.theme.FILL_BUTTON_BG = false;
-		let _ELEMENT_OFFSET: i32 = ui_base_ui.ops.theme.ELEMENT_OFFSET;
-		ui_base_ui.ops.theme.ELEMENT_OFFSET = 0;
-		let _ELEMENT_H: i32 = ui_base_ui.ops.theme.ELEMENT_H;
-		ui_base_ui.ops.theme.ELEMENT_H = config_raw.touch_ui ? (28 + 2) : 28;
+		ui_begin_region(ui, math_floor(ui_nodes_popup_x), math_floor(py), menuw);
+		let _FILL_BUTTON_BG: i32 = ui.ops.theme.FILL_BUTTON_BG;
+		ui.ops.theme.FILL_BUTTON_BG = false;
+		let _ELEMENT_OFFSET: i32 = ui.ops.theme.ELEMENT_OFFSET;
+		ui.ops.theme.ELEMENT_OFFSET = 0;
+		let _ELEMENT_H: i32 = ui.ops.theme.ELEMENT_H;
+		ui.ops.theme.ELEMENT_H = config_raw.touch_ui ? (28 + 2) : 28;
 
 		ui_menu_h = category.length * UI_ELEMENT_H();
 		if (is_group_category) {
 			ui_menu_h += project_material_groups.length * UI_ELEMENT_H();
 		}
 
-		ui_menu_start(ui_base_ui);
+		ui_menu_start();
 
 		for (let i: i32 = 0; i < category.length; ++i) {
 			let n: ui_node_t = category[i];
@@ -1299,15 +1299,15 @@ function ui_nodes_render() {
 				///end
 			}
 			// Next column
-			if (ui_base_ui._y - ui_nodes_wy + UI_ELEMENT_H() / 2 > ui_nodes_wh) {
-				ui_base_ui._x += menuw;
-				ui_base_ui._y = py;
+			if (ui._y - ui_nodes_wy + UI_ELEMENT_H() / 2 > ui_nodes_wh) {
+				ui._x += menuw;
+				ui._y = py;
 			}
 		}
 		if (is_group_category) {
 			for (let i: i32 = 0; i < project_material_groups.length; ++i) {
 				let g: node_group_t = project_material_groups[i];
-				ui_base_ui.enabled = ui_nodes_can_place_group(g.canvas.name);
+				ui.enabled = ui_nodes_can_place_group(g.canvas.name);
 				let row: f32[] = [5 / 6, 1 / 6];
 				ui_row(row);
 				if (ui_button(config_button_spacing + g.canvas.name, ui_align_t.LEFT)) {
@@ -1321,24 +1321,24 @@ function ui_nodes_render() {
 				}
 
 				///if is_paint
-				ui_base_ui.enabled = !project_is_material_group_in_use(g);
+				ui.enabled = !project_is_material_group_in_use(g);
 				if (ui_button("x", ui_align_t.CENTER)) {
 					history_delete_material_group(g);
 					array_remove(project_material_groups, g);
 				}
 				///end
 
-				ui_base_ui.enabled = true;
+				ui.enabled = true;
 			}
 		}
 
-		ui_nodes_hide_menu = ui_base_ui.combo_selected_handle == null && !ui_nodes_show_menu_first && (ui_base_ui.changed || ui_base_ui.input_released || ui_base_ui.input_released_r || ui_base_ui.is_escape_down);
+		ui_nodes_hide_menu = ui.combo_selected_handle == null && !ui_nodes_show_menu_first && (ui.changed || ui.input_released || ui.input_released_r || ui.is_escape_down);
 		ui_nodes_show_menu_first = false;
 
-		ui_base_ui.ops.theme.FILL_BUTTON_BG = _FILL_BUTTON_BG;
-		ui_base_ui.ops.theme.ELEMENT_OFFSET = _ELEMENT_OFFSET;
-		ui_base_ui.ops.theme.ELEMENT_H = _ELEMENT_H;
-		ui_menu_end(ui_base_ui);
+		ui.ops.theme.FILL_BUTTON_BG = _FILL_BUTTON_BG;
+		ui.ops.theme.ELEMENT_OFFSET = _ELEMENT_OFFSET;
+		ui.ops.theme.ELEMENT_H = _ELEMENT_H;
+		ui_menu_end();
 		ui_end_region();
 		draw_end();
 	}
@@ -1348,7 +1348,7 @@ function ui_nodes_render() {
 		ui_nodes_show_menu_first = true;
 	}
 
-	ui_base_ui.input_enabled = true;
+	ui.input_enabled = true;
 }
 
 function ui_nodes_contains_node_group_recursive(group: node_group_t, group_name: string): bool {

+ 0 - 3
base/sources/ts/ui_status.ts

@@ -14,8 +14,6 @@ function ui_status_width(): i32 {
 }
 
 function ui_status_render_ui() {
-	let ui: ui_t = ui_base_ui;
-
 	let statush: i32 = config_raw.layout[layout_size_t.STATUS_H];
 
 	if (ui_window(ui_base_hwnds[tab_area_t.STATUS], sys_x(), iron_window_height() - statush, ui_status_width(), statush)) {
@@ -45,7 +43,6 @@ function ui_status_render_ui() {
 function ui_status_draw_version_tab(htab: ui_handle_t) {
 	// Version label
 	if (!config_raw.touch_ui) {
-		let ui: ui_t = ui_base_ui;
 		ui.enabled = false;
 		ui_tab(ui_base_htabs[tab_area_t.STATUS], manifest_version);
 		ui.enabled = true;

+ 4 - 8
base/sources/ts/ui_toolbar.ts

@@ -29,7 +29,7 @@ let _ui_toolbar_i: i32;
 function ui_toolbar_init() {
 }
 
-function ui_toolbar_draw_tool(i: i32, ui: ui_t, img: gpu_texture_t, icon_accent: i32, keys: string[]) {
+function ui_toolbar_draw_tool(i: i32, img: gpu_texture_t, icon_accent: i32, keys: string[]) {
 	ui._x += 2;
 	if (context_raw.tool == i) {
 		ui_toolbar_draw_highlight();
@@ -84,12 +84,10 @@ function ui_toolbar_w(screen_size_request: bool = false): i32 {
 }
 
 function ui_toolbar_x(): i32 {
-	let ui: ui_t = ui_base_ui;
 	return 5 * UI_SCALE();
 }
 
 function ui_toolbar_render_ui() {
-	let ui: ui_t = ui_base_ui;
 	let x: i32 = 0;
 	let y: i32 = ui_header_h;
 	let h: i32 = iron_window_height() - ui_header_h;
@@ -205,7 +203,7 @@ function ui_toolbar_render_ui() {
 			key_tool_material
 		];
 
-		ui_toolbar_ext_draw_tools(ui, img, icon_accent, keys);
+		ui_toolbar_ext_draw_tools(img, icon_accent, keys);
 
 		ui.image_scroll_align = true;
 	}
@@ -224,11 +222,10 @@ function ui_toolbar_render_ui() {
 }
 
 function ui_toolbar_tool_properties_menu() {
-	let ui: ui_t = ui_base_ui;
-	ui_menu_draw(function (ui: ui_t) {
+	ui_menu_draw(function () {
 		ui.changed = false;
 
-		ui_header_draw_tool_properties(ui);
+		ui_header_draw_tool_properties();
 
 		if (ui.changed) {
 			ui_menu_keep_open = true;
@@ -241,7 +238,6 @@ function ui_toolbar_tool_properties_menu() {
 }
 
 function ui_toolbar_draw_highlight() {
-	let ui: ui_t = ui_base_ui;
 	let size: i32 = ui_toolbar_w() - 4;
 	draw_set_color(ui.ops.theme.HIGHLIGHT_COL);
 	ui_draw_rect(true, ui._x + -1,  ui._y + 2, size + 2, size + 2);

+ 28 - 28
base/sources/ts/ui_view2d.ts

@@ -49,7 +49,7 @@ function ui_view2d_init() {
 	ui_view2d_channel_loc = pipes_get_constant_location("int");
 	///end
 
-	// ui_base_ui.scroll_enabled = false;
+	// ui.scroll_enabled = false;
 }
 
 function ui_view2d_render() {
@@ -105,7 +105,7 @@ function ui_view2d_render() {
 	}
 	///end
 
-	ui_begin(ui_base_ui);
+	ui_begin(ui);
 
 	let headerh: i32 = config_raw.layout[layout_size_t.HEADER] == 1 ? ui_header_h * 2 : ui_header_h;
 	let apph: i32 = iron_window_height() - config_raw.layout[layout_size_t.STATUS_H] + headerh;
@@ -240,10 +240,10 @@ function ui_view2d_render() {
 			}
 
 			// Texture and node preview color picking
-			if ((context_in_2d_view(view_2d_type_t.ASSET) || context_in_2d_view(view_2d_type_t.NODE)) && context_raw.tool == tool_type_t.PICKER && ui_base_ui.input_down) {
+			if ((context_in_2d_view(view_2d_type_t.ASSET) || context_in_2d_view(view_2d_type_t.NODE)) && context_raw.tool == tool_type_t.PICKER && ui.input_down) {
 				_ui_view2d_render_tex = tex;
-				_ui_view2d_render_x = ui_base_ui.input_x - tx - ui_view2d_wx;;
-				_ui_view2d_render_y = ui_base_ui.input_y - ty - ui_view2d_wy;
+				_ui_view2d_render_x = ui.input_x - tx - ui_view2d_wx;;
+				_ui_view2d_render_y = ui.input_y - ty - ui_view2d_wy;
 				_ui_view2d_render_tw = tw;
 				_ui_view2d_render_th = th;
 
@@ -282,14 +282,14 @@ function ui_view2d_render() {
 
 		// Menu
 		let ew: i32 = math_floor(UI_ELEMENT_W());
-		draw_set_color(ui_base_ui.ops.theme.SEPARATOR_COL);
+		draw_set_color(ui.ops.theme.SEPARATOR_COL);
 		draw_filled_rect(0, UI_ELEMENT_H(), ui_view2d_ww, UI_ELEMENT_H() + UI_ELEMENT_OFFSET() * 2);
 		draw_set_color(0xffffffff);
 
 		let start_y: f32 = UI_ELEMENT_H() + UI_ELEMENT_OFFSET();
-		ui_base_ui._x = 2;
-		ui_base_ui._y = 2 + start_y;
-		ui_base_ui._w = ew;
+		ui._x = 2;
+		ui._y = 2 + start_y;
+		ui._w = ew;
 
 		// Editable layer name
 		let h: ui_handle_t = ui_handle(__ID__);
@@ -300,7 +300,7 @@ function ui_view2d_render() {
 		let text: string = h.text;
 		///end
 
-		ui_base_ui._w = math_floor(math_min(draw_string_width(ui_base_ui.ops.font, ui_base_ui.font_size, text) + 15 * UI_SCALE(), 100 * UI_SCALE()));
+		ui._w = math_floor(math_min(draw_string_width(ui.ops.font, ui.font_size, text) + 15 * UI_SCALE(), 100 * UI_SCALE()));
 
 		if (ui_view2d_type == view_2d_type_t.ASSET) {
 			let asset: asset_t = context_raw.texture;
@@ -330,7 +330,7 @@ function ui_view2d_render() {
 		else if (ui_view2d_type == view_2d_type_t.LAYER) {
 			h.text = l.name;
 			l.name = ui_text_input(h, "");
-			ui_view2d_text_input_hover = ui_base_ui.is_hovered;
+			ui_view2d_text_input_hover = ui.is_hovered;
 		}
 		else if (ui_view2d_type == view_2d_type_t.FONT) {
 			h.text = context_raw.font.name;
@@ -341,9 +341,9 @@ function ui_view2d_render() {
 		if (h.changed) {
 			ui_base_hwnds[0].redraws = 2;
 		}
-		ui_base_ui._x += ui_base_ui._w + 3;
-		ui_base_ui._y = 2 + start_y;
-		ui_base_ui._w = ew;
+		ui._x += ui._w + 3;
+		ui._y = 2 + start_y;
+		ui._w = ew;
 
 		///if is_paint
 		if (ui_view2d_type == view_2d_type_t.LAYER) {
@@ -353,8 +353,8 @@ function ui_view2d_render() {
 			}
 			let layer_mode_combo: string[] = [tr("Visible"), tr("Selected")];
 			ui_view2d_layer_mode = ui_combo(h_layer_mode, layer_mode_combo, tr("Layers"));
-			ui_base_ui._x += ew + 3;
-			ui_base_ui._y = 2 + start_y;
+			ui._x += ew + 3;
+			ui._y = 2 + start_y;
 
 			if (!slot_layer_is_mask(context_raw.layer)) {
 				let h_tex_type: ui_handle_t = ui_handle(__ID__);
@@ -371,18 +371,18 @@ function ui_view2d_render() {
 					tr("Height"),
 				];
 				ui_view2d_tex_type = ui_combo(h_tex_type, tex_type_combo, tr("Texture"));
-				ui_base_ui._x += ew + 3;
-				ui_base_ui._y = 2 + start_y;
+				ui._x += ew + 3;
+				ui._y = 2 + start_y;
 			}
 
-			ui_base_ui._w = math_floor(ew * 0.7 + 3);
+			ui._w = math_floor(ew * 0.7 + 3);
 			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 = ui_check(h_uvmap_show, tr("UV Map"));
-			ui_base_ui._x += ew * 0.7 + 3;
-			ui_base_ui._y = 2 + start_y;
+			ui._x += ew * 0.7 + 3;
+			ui._y = 2 + start_y;
 		}
 		///end
 
@@ -391,8 +391,8 @@ function ui_view2d_render() {
 			h_tiled_show.selected = ui_view2d_tiled_show;
 		}
 		ui_view2d_tiled_show = ui_check(h_tiled_show, tr("Tiled"));
-		ui_base_ui._x += ew * 0.7 + 3;
-		ui_base_ui._y = 2 + start_y;
+		ui._x += ew * 0.7 + 3;
+		ui._y = 2 + start_y;
 
 		if (ui_view2d_type == view_2d_type_t.ASSET && tex != null) { // Texture resolution
 			ui_text(tex.width + "x" + tex.height);
@@ -425,13 +425,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: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_base_ui, ui_view2d_controls_down);
+			let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_view2d_controls_down);
 			ui_view2d_controls_down = control.controls_down;
 		}
 		return;
 	}
 
-	let control: ui_canvas_control_t = ui_nodes_get_canvas_control(ui_base_ui, ui_view2d_controls_down);
+	let control: ui_canvas_control_t = ui_nodes_get_canvas_control(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;
@@ -450,8 +450,8 @@ function ui_view2d_update() {
 
 		if (ui_touch_scroll) {
 			// Zoom to finger location
-			ui_view2d_pan_x -= (ui_base_ui.input_x - ui_base_ui._window_x - ui_base_ui._window_w / 2) * control.zoom;
-			ui_view2d_pan_y -= (ui_base_ui.input_y - ui_base_ui._window_y - ui_base_ui._window_h / 2) * control.zoom;
+			ui_view2d_pan_x -= (ui.input_x - ui._window_x - ui._window_w / 2) * control.zoom;
+			ui_view2d_pan_y -= (ui.input_y - ui._window_y - ui._window_h / 2) * control.zoom;
 		}
 		ui_view2d_grid_redraw = true;
 	}
@@ -474,7 +474,7 @@ function ui_view2d_update() {
 	}
 	///end
 
-	if (ui_base_ui.is_typing) {
+	if (ui.is_typing) {
 		return;
 	}
 

+ 1 - 1
base/tools/pad/sources/main.ts

@@ -367,7 +367,7 @@ function on_border_hover(handle: ui_handle_t, side: i32) {
 
 	iron_set_mouse_cursor(3); // Horizontal
 
-	if (ui_get_current().input_started) {
+	if (ui.input_started) {
 		resizing_sidebar = true;
 	}
 }

+ 1 - 1
lab/sources/ui_header_ext.ts

@@ -1,5 +1,5 @@
 
-function ui_header_draw_tool_properties(ui: ui_t) {
+function ui_header_draw_tool_properties() {
 	if (context_raw.tool == tool_type_t.PICKER) {
 
 	}

+ 0 - 1
lab/sources/ui_nodes_ext.ts

@@ -6,7 +6,6 @@ function ui_nodes_ext_delay_idle_sleep() {
 }
 
 function ui_nodes_ext_draw_buttons(ew: f32, start_y: f32) {
-	let ui: ui_t = ui_base_ui;
 	if (ui_button(tr("Run"))) {
 		// sys_notify_on_init(function() {
 			ui_nodes_ext_run();

+ 1 - 1
lab/sources/ui_toolbar_ext.ts

@@ -1,4 +1,4 @@
 
-function ui_toolbar_ext_draw_tools(ui: ui_t, img: gpu_texture_t, icon_accent: i32, keys: string[]) {
+function ui_toolbar_ext_draw_tools(img: gpu_texture_t, icon_accent: i32, keys: string[]) {
 
 }

+ 1 - 1
paint/sources/nodes/brush_output_node_ext.ts

@@ -122,7 +122,7 @@ function brush_output_node_run(self: brush_output_node_t, from: i32) {
 		return;
 	}
 
-	if (ui_base_ui.is_hovered ||
+	if (ui.is_hovered ||
 		base_is_dragging ||
 		base_is_resizing ||
 		base_is_scrolling() ||

+ 2 - 2
paint/sources/ui_header_ext.ts

@@ -1,7 +1,7 @@
 
 let _ui_header_draw_tool_properties_h: ui_handle_t;
 
-function ui_header_draw_tool_properties(ui: ui_t) {
+function ui_header_draw_tool_properties() {
 	if (context_raw.tool == tool_type_t.COLORID) {
 		ui_text(tr("Picked Color"));
 		if (context_raw.colorid_picked) {
@@ -103,7 +103,7 @@ function ui_header_draw_tool_properties(ui: ui_t) {
 		}
 		if (ui.is_hovered && ui.input_released) {
 			_ui_header_draw_tool_properties_h = h;
-			ui_menu_draw(function (ui: ui_t) {
+			ui_menu_draw(function () {
 				ui_fill(0, 0, ui._w / UI_SCALE(), ui.ops.theme.ELEMENT_H * 9, ui.ops.theme.SEPARATOR_COL);
 				ui.changed = false;
 				ui_color_wheel(_ui_header_draw_tool_properties_h, false, -1, 10 * ui.ops.theme.ELEMENT_H * UI_SCALE(), false);

+ 15 - 15
paint/sources/ui_toolbar_ext.ts

@@ -1,17 +1,17 @@
 
-function ui_toolbar_ext_draw_tools(ui: ui_t, img: gpu_texture_t, icon_accent: i32, keys: string[]) {
-	ui_toolbar_draw_tool(tool_type_t.BRUSH, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.ERASER, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.FILL, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.DECAL, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.TEXT, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.CLONE, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.BLUR, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.SMUDGE, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.PARTICLE, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.COLORID, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.PICKER, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.BAKE, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.MATERIAL, ui, img, icon_accent, keys);
-	ui_toolbar_draw_tool(tool_type_t.GIZMO, ui, img, icon_accent, keys);
+function ui_toolbar_ext_draw_tools(img: gpu_texture_t, icon_accent: i32, keys: string[]) {
+	ui_toolbar_draw_tool(tool_type_t.BRUSH, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.ERASER, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.FILL, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.DECAL, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.TEXT, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.CLONE, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.BLUR, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.SMUDGE, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.PARTICLE, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.COLORID, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.PICKER, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.BAKE, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.MATERIAL, img, icon_accent, keys);
+	ui_toolbar_draw_tool(tool_type_t.GIZMO, img, icon_accent, keys);
 }