diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index 3f8e8b09..e68b64cb 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -669,7 +669,7 @@ void ui_draw_tooltip() { if (current->slider_tooltip) { draw_begin(NULL, false, 0); draw_set_font(current->ops->font, current->font_size * 2); - sprintf(temp, "%f", round(current->scroll_handle->value * 100.0) / 100.0); + sprintf(temp, "%f", round(current->scroll_handle->f * 100.0) / 100.0); string_strip_trailing_zeros(temp); char *text = temp; float x_off = draw_string_width(current->ops->font, current->font_size * 2.0, text) / 2.0; @@ -835,14 +835,14 @@ void ui_draw_combo() { } if (reset_position) { // The search has changed, select first entry that matches - current->combo_to_submit = current->combo_selected_handle->position = i; + current->combo_to_submit = current->combo_selected_handle->i = i; current->submit_combo_handle = current->combo_selected_handle; reset_position = false; } if (unroll_up) { current->_y -= UI_ELEMENT_H() * 2.0; } - theme->BUTTON_COL = i == current->combo_selected_handle->position ? + theme->BUTTON_COL = i == current->combo_selected_handle->i ? theme->HIGHLIGHT_COL : theme->SEPARATOR_COL; ui_fill(0, 0, current->_w / UI_SCALE(), UI_ELEMENT_H() / UI_SCALE(), theme->SEPARATOR_COL); @@ -1253,16 +1253,16 @@ void ui_draw_tabs() { current->tab_handle->changed = false; if (current->is_ctrl_down && current->is_tab_down) { // Next tab - current->tab_handle->position++; - if (current->tab_handle->position >= current->tab_count) { - current->tab_handle->position = 0; + current->tab_handle->i++; + if (current->tab_handle->i >= current->tab_count) { + current->tab_handle->i = 0; } current->tab_handle->changed = true; current->is_tab_down = false; } - if (current->tab_handle->position >= current->tab_count) { - current->tab_handle->position = current->tab_count - 1; + if (current->tab_handle->i >= current->tab_count) { + current->tab_handle->i = current->tab_count - 1; } draw_set_color(theme->SEPARATOR_COL); // Tab background @@ -1305,19 +1305,19 @@ void ui_draw_tabs() { } if (current->drag_tab_handle != NULL && hover && current->input_released) { ui_on_tab_drop(current->tab_handle, i, current->drag_tab_handle, current->drag_tab_position); - current->tab_handle->position = i; + current->tab_handle->i = i; } } if (released) { - ui_handle_t *h = ui_nest(current->tab_handle, current->tab_handle->position); // Restore tab scroll + ui_handle_t *h = ui_nest(current->tab_handle, current->tab_handle->i); // Restore tab scroll h->scroll_offset = current->current_window->scroll_offset; h = ui_nest(current->tab_handle, i); current->tab_scroll = h->scroll_offset; - current->tab_handle->position = i; // Set new tab + current->tab_handle->i = i; // Set new tab current->current_window->redraws = 3; current->tab_handle->changed = true; } - bool selected = current->tab_handle->position == i; + bool selected = current->tab_handle->i == i; draw_set_color((pushed || hover) ? theme->HOVER_COL : (current->tab_colors[i] != -1 && current->tab_colors[i] != -2) ? current->tab_colors[i] : @@ -1372,7 +1372,7 @@ void ui_draw_tabs() { } current->enabled = _enabled; - ui_set_hovered_tab_name(current->tab_names[current->tab_handle->position]); + ui_set_hovered_tab_name(current->tab_names[current->tab_handle->i]); current->_x = 0; // Restore positions current->_y = orig_y; @@ -1855,31 +1855,31 @@ bool ui_tab(ui_handle_t *handle, char *text, bool vertical, uint32_t color, bool current->tab_colors[current->tab_count] = color; current->tab_enabled[current->tab_count] = current->enabled; current->tab_count++; - return handle->position == current->tab_count - 1; + return handle->i == current->tab_count - 1; } bool ui_panel(ui_handle_t *handle, char *text, bool is_tree, bool filled) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->selected; + return handle->b; } if (ui_get_released(UI_ELEMENT_H())) { - handle->selected = !handle->selected; + handle->b = !handle->b; handle->changed = current->changed = true; } if (is_tree) { - ui_draw_tree(handle->selected); + ui_draw_tree(handle->b); } else { - ui_draw_arrow(handle->selected); + ui_draw_arrow(handle->b); } draw_set_color(theme->LABEL_COL); // Title ui_draw_string(text, current->title_offset_x, 0, UI_ALIGN_LEFT, true); ui_end_element(); - return handle->selected; + return handle->b; } static int image_width(void *image) { @@ -2005,16 +2005,16 @@ char *ui_text_input(ui_handle_t *handle, char *label, int align, bool editable, bool ui_check(ui_handle_t *handle, char *text, char *label) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->selected; + return handle->b; } if (ui_get_released(UI_ELEMENT_H())) { - handle->selected = !handle->selected; + handle->b = !handle->b; handle->changed = current->changed = true; } else handle->changed = false; bool hover = ui_get_hover(UI_ELEMENT_H()); - ui_draw_check(handle->selected, hover); // Check + ui_draw_check(handle->b, hover); // Check draw_set_color(theme->TEXT_COL); // Text ui_draw_string(text, current->title_offset_x, 0, UI_ALIGN_LEFT, true); @@ -2026,24 +2026,24 @@ bool ui_check(ui_handle_t *handle, char *text, char *label) { ui_end_element(); - return handle->selected; + return handle->b; } bool ui_radio(ui_handle_t *handle, int position, char *text, char *label) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->position == position; + return handle->i == position; } if (position == 0) { handle->changed = false; } if (ui_get_released(UI_ELEMENT_H())) { - handle->position = position; + handle->i = position; handle->changed = current->changed = true; } bool hover = ui_get_hover(UI_ELEMENT_H()); - ui_draw_radio(handle->position == position, hover); // Radio + ui_draw_radio(handle->i == position, hover); // Radio draw_set_color(theme->TEXT_COL); // Text ui_draw_string(text, current->title_offset_x, 0, UI_ALIGN_LEFT, true); @@ -2055,13 +2055,13 @@ bool ui_radio(ui_handle_t *handle, int position, char *text, char *label) { ui_end_element(); - return handle->position == position; + return handle->i == position; } int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool show_label, int align, bool search_bar) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->position; + return handle->i; } if (ui_get_released(UI_ELEMENT_H())) { if (current->combo_selected_handle == NULL) { @@ -2087,17 +2087,17 @@ int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool sho if (current->combo_selected_w > current->_w) { current->combo_selected_w += UI_TEXT_OFFSET(); } - current->combo_to_submit = handle->position; - current->combo_initial_value = handle->position; + current->combo_to_submit = handle->i; + current->combo_initial_value = handle->i; } } if (handle == current->combo_selected_handle && (current->is_escape_down || current->input_released_r)) { - handle->position = current->combo_initial_value; + handle->i = current->combo_initial_value; handle->changed = current->changed = true; current->submit_combo_handle = NULL; } else if (handle == current->submit_combo_handle) { - handle->position = current->combo_to_submit; + handle->i = current->combo_to_submit; current->submit_combo_handle = NULL; handle->changed = current->changed = true; } @@ -2132,22 +2132,22 @@ int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool sho current->_x -= 15; } draw_set_color(theme->TEXT_COL); // Value - if (handle->position < texts->length) { - ui_draw_string(texts->buffer[handle->position], theme->TEXT_OFFSET, 0, align, true); + if (handle->i < texts->length) { + ui_draw_string(texts->buffer[handle->i], theme->TEXT_OFFSET, 0, align, true); } if (align == UI_ALIGN_RIGHT) { current->_x += 15; } ui_end_element(); - return handle->position; + return handle->i; } float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool filled, float precision, bool display_value, int align, bool text_edit) { static char temp[1024]; if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->value; + return handle->f; } if (ui_get_started(UI_ELEMENT_H())) { current->scroll_handle = handle; @@ -2174,24 +2174,24 @@ float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool fill float slider_w = current->_w - current->button_offset_y * 2; float step = range / slider_w; float value = from + (current->input_x - slider_x) * step; - handle->value = round(value * precision) / precision; - if (handle->value < from) { - handle->value = from; // Stay in bounds + handle->f = round(value * precision) / precision; + if (handle->f < from) { + handle->f = from; // Stay in bounds } - else if (handle->value > to) { - handle->value = to; + else if (handle->f > to) { + handle->f = to; } handle->changed = current->changed = true; } bool hover = ui_get_hover(UI_ELEMENT_H()); - ui_draw_slider(handle->value, from, to, filled, hover); // Slider + ui_draw_slider(handle->f, from, to, filled, hover); // Slider // Text edit bool start_edit = (ui_get_released(UI_ELEMENT_H()) || current->tab_pressed) && text_edit; if (start_edit) { // Mouse did not move char tmp[256]; - sprintf(tmp, "%.2f", handle->value); + sprintf(tmp, "%.2f", handle->f); handle->text = string_copy(tmp); string_strip_trailing_zeros(handle->text); ui_start_text_edit(handle, UI_ALIGN_LEFT); @@ -2204,9 +2204,9 @@ float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool fill if (current->submit_text_handle == handle) { ui_submit_text_edit(); #ifdef WITH_EVAL - handle->value = js_eval(handle->text); + handle->f = js_eval(handle->text); #else - handle->value = atof(handle->text); + handle->f = atof(handle->text); #endif handle->changed = current->changed = true; } @@ -2217,7 +2217,7 @@ float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool fill if (display_value) { draw_set_color(theme->TEXT_COL); // Value if (current->text_selected_handle != handle) { - sprintf(temp, "%.2f", round(handle->value * precision) / precision); + sprintf(temp, "%.2f", round(handle->f * precision) / precision); string_strip_trailing_zeros(temp); ui_draw_string(temp, theme->TEXT_OFFSET, 0, lalign, true); } @@ -2227,7 +2227,7 @@ float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool fill } ui_end_element(); - return handle->value; + return handle->f; } void ui_separator(int h, bool fill) { @@ -2604,10 +2604,10 @@ void ui_rgb_to_hsv(float cr, float cg, float cb, float *out) { float ui_float_input(ui_handle_t *handle, char *label, int align, float precision) { char tmp[256]; handle->text = tmp; - sprintf(handle->text, "%f", round(handle->value * precision) / precision); + sprintf(handle->text, "%f", round(handle->f * precision) / precision); char *text = ui_text_input(handle, label, align, true, false); - handle->value = atof(text); - return handle->value; + handle->f = atof(text); + return handle->f; } int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { @@ -2615,7 +2615,7 @@ int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); - return handle->position; + return handle->i; } float step = current->_w / texts->length; int hovered = -1; @@ -2629,7 +2629,7 @@ int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { } } if (ui_get_released(UI_ELEMENT_H())) { - handle->position = hovered; + handle->i = hovered; handle->changed = current->changed = true; } else { @@ -2637,7 +2637,7 @@ int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { } for (int i = 0; i < texts->length; ++i) { - if (handle->position == i) { + if (handle->i == i) { draw_set_color(current->ops->theme->HIGHLIGHT_COL); if (!current->enabled) { ui_fade_color(0.25); @@ -2660,7 +2660,7 @@ int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { current->_w = _w; } ui_end_element(); - return handle->position; + return handle->i; } uint8_t ui_color_r(uint32_t color) { @@ -2761,7 +2761,7 @@ int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color if (alpha) { ui_handle_t *alpha_handle = ui_nest(handle, 1); if (alpha_handle->init) { - alpha_handle->value = round(a * 100.0) / 100.0; + alpha_handle->f = round(a * 100.0) / 100.0; } a = ui_slider(alpha_handle, "Alpha", 0.0, 1.0, true, 100, true, UI_ALIGN_LEFT, true); if (alpha_handle->changed) { @@ -2820,9 +2820,9 @@ int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color ui_handle_t *h1 = ui_nest(ui_nest(handle, 0), 1); ui_handle_t *h2 = ui_nest(ui_nest(handle, 0), 2); if (pos == 0) { - h0->value = handle->red; - h1->value = handle->green; - h2->value = handle->blue; + h0->f = handle->red; + h1->f = handle->green; + h2->f = handle->blue; handle->red = ui_slider(h0, "R", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); handle->green = ui_slider(h1, "G", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); handle->blue = ui_slider(h2, "B", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); @@ -2830,9 +2830,9 @@ int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color handle->color = ui_color(round(handle->red * 255.0), round(handle->green * 255.0), round(handle->blue * 255.0), round(a * 255.0)); } else if (pos == 1) { - h0->value = handle->hue; - h1->value = handle->sat; - h2->value = handle->val; + h0->f = handle->hue; + h1->f = handle->sat; + h2->f = handle->val; handle->hue = ui_slider(h0, "H", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); handle->sat = ui_slider(h1, "S", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); handle->val = ui_slider(h2, "V", 0, 1, true, 100, true, UI_ALIGN_LEFT, true); @@ -2895,11 +2895,11 @@ int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color static void scroll_align(ui_t *current, ui_handle_t *handle) { // Scroll down - if ((handle->position + 1) * UI_ELEMENT_H() + current->current_window->scroll_offset > current->_h - current->window_header_h) { + if ((handle->i + 1) * UI_ELEMENT_H() + current->current_window->scroll_offset > current->_h - current->window_header_h) { current->current_window->scroll_offset -= UI_ELEMENT_H(); } // Scroll up - else if ((handle->position + 1) * UI_ELEMENT_H() + current->current_window->scroll_offset < current->window_header_h) { + else if ((handle->i + 1) * UI_ELEMENT_H() + current->current_window->scroll_offset < current->window_header_h) { current->current_window->scroll_offset += UI_ELEMENT_H(); } } @@ -2919,7 +2919,7 @@ static void handle_line_select(ui_t *current, ui_handle_t *handle) { if (current->is_shift_down) { current->highlight_anchor = 0; if (text_area_selection_start == -1) { - text_area_selection_start = handle->position; + text_area_selection_start = handle->i; } } else text_area_selection_start = -1; @@ -2991,7 +2991,7 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b if (word_wrap && handle->text[0] != '\0') { bool cursor_set = false; int cursor_pos = current->cursor_x; - for (int i = 0; i < handle->position; ++i) { + for (int i = 0; i < handle->i; ++i) { cursor_pos += strlen(ui_extract_line(lines, i)) + 1; // + '\n' } int word_count = ui_word_count(lines); @@ -3028,7 +3028,7 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b if (selected && !cursor_set && cursor_pos <= lines_len + strlen(line)) { cursor_set = true; - handle->position = new_line_count; + handle->i = new_line_count; current->cursor_x = current->highlight_anchor = cursor_pos - lines_len; } } @@ -3037,7 +3037,7 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b } strcat(new_lines, line); if (selected) { - strcpy(handle->text, ui_extract_line(new_lines, handle->position)); + strcpy(handle->text, ui_extract_line(new_lines, handle->i)); strcpy(current->text_selected, handle->text); } strcpy(lines, new_lines); @@ -3076,8 +3076,8 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b for (int i = 0; i < line_count; ++i) { // Draw lines char *line = ui_extract_line(lines, i); // Text input - if ((!selected && ui_get_hover(UI_ELEMENT_H())) || (selected && i == handle->position)) { - handle->position = i; // Set active line + if ((!selected && ui_get_hover(UI_ELEMENT_H())) || (selected && i == handle->i)) { + handle->i = i; // Set active line strcpy(handle->text, line); current->submit_text_handle = NULL; ui_text_input(handle, show_label ? label : "", align, editable, false); @@ -3099,8 +3099,8 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b else { // Multi-line selection highlight if (text_area_selection_start > -1 && - (i >= text_area_selection_start && i < handle->position) || - (i <= text_area_selection_start && i > handle->position)) { + (i >= text_area_selection_start && i < handle->i) || + (i <= text_area_selection_start && i > handle->i)) { int line_height = UI_ELEMENT_H(); int cursor_height = line_height - current->button_offset_y * 3.0; int linew = draw_string_width(current->ops->font, current->font_size, line); @@ -3121,32 +3121,32 @@ char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, b if (key_pressed) { // Move cursor vertically - if (current->key_code == IRON_KEY_DOWN && handle->position < line_count - 1) { + if (current->key_code == IRON_KEY_DOWN && handle->i < line_count - 1) { handle_line_select(current, handle); - handle->position++; + handle->i++; scroll_align(current, handle); } - if (current->key_code == IRON_KEY_UP && handle->position > 0) { + if (current->key_code == IRON_KEY_UP && handle->i > 0) { handle_line_select(current, handle); - handle->position--; + handle->i--; scroll_align(current, handle); } // New line if (editable && current->key_code == IRON_KEY_RETURN && !word_wrap) { - handle->position++; - ui_insert_char_at(lines, ui_line_pos(lines, handle->position - 1) + current->cursor_x, '\n'); + handle->i++; + ui_insert_char_at(lines, ui_line_pos(lines, handle->i - 1) + current->cursor_x, '\n'); ui_start_text_edit(handle, UI_ALIGN_LEFT); current->cursor_x = current->highlight_anchor = 0; scroll_align(current, handle); } // Delete line - if (editable && current->key_code == IRON_KEY_BACKSPACE && cursor_start_x == 0 && handle->position > 0) { - handle->position--; - current->cursor_x = current->highlight_anchor = strlen(ui_extract_line(lines, handle->position)); - ui_remove_chars_at(lines, ui_line_pos(lines, handle->position + 1) - 1, 1); // Remove '\n' of the previous line + if (editable && current->key_code == IRON_KEY_BACKSPACE && cursor_start_x == 0 && handle->i > 0) { + handle->i--; + current->cursor_x = current->highlight_anchor = strlen(ui_extract_line(lines, handle->i)); + ui_remove_chars_at(lines, ui_line_pos(lines, handle->i + 1) - 1, 1); // Remove '\n' of the previous line scroll_align(current, handle); } - strcpy(current->text_selected, ui_extract_line(lines, handle->position)); + strcpy(current->text_selected, ui_extract_line(lines, handle->i)); } current->highlight_on_select = true; diff --git a/base/sources/iron_ui.h b/base/sources/iron_ui.h index b2ab5f32..7fd5edfe 100644 --- a/base/sources/iron_ui.h +++ b/base/sources/iron_ui.h @@ -79,9 +79,9 @@ typedef struct ui_handle_array { typedef struct ui_handle { union { - float value; - int position; - bool selected; + float f; + int i; + bool b; }; union { struct { // window diff --git a/base/sources/iron_ui_nodes.c b/base/sources/iron_ui_nodes.c index f51a1b8b..16d66795 100644 --- a/base/sources/iron_ui_nodes.c +++ b/base/sources/iron_ui_nodes.c @@ -504,15 +504,15 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { ui_handle_t *h = ui_nest(nhandle, buti); ui_handle_t *h0 = ui_nest(h, 0); if (h0->init) { - h0->value = val[0]; + h0->f = val[0]; } ui_handle_t *h1 = ui_nest(h, 1); if (h1->init) { - h1->value = val[1]; + h1->f = val[1]; } ui_handle_t *h2 = ui_nest(h, 2); if (h2->init) { - h2->value = val[2]; + h2->f = val[2]; } val[0] = ui_slider(h0, "X", min, max, true, 100, true, UI_ALIGN_LEFT, true); @@ -537,7 +537,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { current->ops->theme->TEXT_OFFSET = 6; ui_handle_t *soc_handle = ui_nest(nhandle, buti); if (soc_handle->init) { - soc_handle->value = ((float *)soc->default_value->buffer)[0]; + soc_handle->f = ((float *)soc->default_value->buffer)[0]; } ((float *)soc->default_value->buffer)[0] = ui_slider(soc_handle, "Value", min, max, true, prec, true, UI_ALIGN_LEFT, true); current->ops->theme->TEXT_OFFSET = text_off; @@ -565,7 +565,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { current->_w = w; ui_handle_t *but_handle = ui_nest(nhandle, buti); - but_handle->position = ((float *)but->default_value->buffer)[0]; + but_handle->i = ((float *)but->default_value->buffer)[0]; bool combo_select = current->combo_selected_handle == NULL && ui_get_released(UI_ELEMENT_H()); char *label = combo_select ? temp_label : enum_label; @@ -617,7 +617,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { current->_w = w; ui_handle_t *h = ui_nest(nhandle, buti); if (h->init) { - h->selected = ((float *)but->default_value->buffer)[0]; + h->b = ((float *)but->default_value->buffer)[0]; } ((float *)but->default_value->buffer)[0] = ui_check(h, ui_tr(but->name), ""); } @@ -653,7 +653,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { ui_handle_t *_handle = ui_nest(nhandle, ui_max_buttons); ui_handle_t *soc_handle = ui_nest(_handle, i); if (soc_handle->init) { - soc_handle->value = ((float *)soc->default_value->buffer)[0]; + soc_handle->f = ((float *)soc->default_value->buffer)[0]; } ((float *)soc->default_value->buffer)[0] = ui_slider(soc_handle, ui_tr(inp->name), min, max, true, prec, true, UI_ALIGN_LEFT, true); current->ops->theme->TEXT_OFFSET = text_off; @@ -716,15 +716,15 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) { ui_handle_t *hi = ui_nest(h, i); ui_handle_t *h0 = ui_nest(hi, 0); if (h0->init) { - h0->value = val[0]; + h0->f = val[0]; } ui_handle_t *h1 = ui_nest(hi, 1); if (h1->init) { - h1->value = val[1]; + h1->f = val[1]; } ui_handle_t *h2 = ui_nest(hi, 2); if (h2->init) { - h2->value = val[2]; + h2->f = val[2]; } val[0] = ui_slider(h0, "X", min, max, true, 100, true, UI_ALIGN_LEFT, true); val[1] = ui_slider(h1, "Y", min, max, true, 100, true, UI_ALIGN_LEFT, true); diff --git a/base/sources/plugins/plugin_api.c b/base/sources/plugins/plugin_api.c index 60fab756..9b18f26a 100644 --- a/base/sources/plugins/plugin_api.c +++ b/base/sources/plugins/plugin_api.c @@ -429,7 +429,7 @@ FN(ui_handle_set_value) { ui_handle_t *h = (ui_handle_t *)p; double d; JS_ToFloat64(ctx, &d, argv[1]); - h->value = d; + h->f = d; return JS_UNDEFINED; } @@ -437,7 +437,7 @@ FN(ui_handle_get_value) { uint64_t p; JS_ToBigUint64(ctx, &p, argv[0]); ui_handle_t *h = (ui_handle_t *)p; - return JS_NewFloat64(ctx, h->value); + return JS_NewFloat64(ctx, h->f); } FN(ui_panel) { diff --git a/base/sources/ts/iron.ts b/base/sources/ts/iron.ts index 5a9384d9..324aebdd 100644 --- a/base/sources/ts/iron.ts +++ b/base/sources/ts/iron.ts @@ -813,9 +813,9 @@ declare type ui_t = { }; declare type ui_handle_t = { - value: f32; - position: i32; - selected: bool; + f: f32; + i: i32; + b: bool; color: u32; text: string; redraws: i32; diff --git a/paint/sources/args.ts b/paint/sources/args.ts index 6aa533bb..4544da6b 100644 --- a/paint/sources/args.ts +++ b/paint/sources/args.ts @@ -83,18 +83,18 @@ function args_run() { } if (args_export_textures_type == "png") { - base_bits_handle.position = texture_bits_t.BITS8; + base_bits_handle.i = texture_bits_t.BITS8; context_raw.format_type = texture_ldr_format_t.PNG; } else if (args_export_textures_type == "jpg") { - base_bits_handle.position = texture_bits_t.BITS8; + base_bits_handle.i = texture_bits_t.BITS8; context_raw.format_type = texture_ldr_format_t.JPG; } else if (args_export_textures_type == "exr16") { - base_bits_handle.position = texture_bits_t.BITS16; + base_bits_handle.i = texture_bits_t.BITS16; } else if (args_export_textures_type == "exr32") { - base_bits_handle.position = texture_bits_t.BITS32; + base_bits_handle.i = texture_bits_t.BITS32; } else { iron_log(tr("Invalid texture type")); diff --git a/paint/sources/base.ts b/paint/sources/base.ts index 77add84c..c6792b10 100644 --- a/paint/sources/base.ts +++ b/paint/sources/base.ts @@ -952,27 +952,27 @@ function ui_base_update() { context_raw.brush_opacity += mouse_movement_x / 500; context_raw.brush_opacity = math_max(0.0, math_min(1.0, context_raw.brush_opacity)); context_raw.brush_opacity = math_round(context_raw.brush_opacity * 100) / 100; - context_raw.brush_opacity_handle.value = context_raw.brush_opacity; + context_raw.brush_opacity_handle.f = context_raw.brush_opacity; } else if (operator_shortcut(map_get(config_keymap, "brush_angle"), shortcut_type_t.DOWN)) { context_raw.brush_angle += mouse_movement_x / 5; let i: i32 = math_floor(context_raw.brush_angle); context_raw.brush_angle = i % 360; if (context_raw.brush_angle < 0) context_raw.brush_angle += 360; - context_raw.brush_angle_handle.value = context_raw.brush_angle; + context_raw.brush_angle_handle.f = context_raw.brush_angle; make_material_parse_paint_material(); } else if (decal_mask && operator_shortcut(map_get(config_keymap, "decal_mask") + "+" + map_get(config_keymap, "brush_radius"), shortcut_type_t.DOWN)) { context_raw.brush_decal_mask_radius += mouse_movement_x / 150; context_raw.brush_decal_mask_radius = math_max(0.01, math_min(4.0, context_raw.brush_decal_mask_radius)); context_raw.brush_decal_mask_radius = math_round(context_raw.brush_decal_mask_radius * 100) / 100; - context_raw.brush_decal_mask_radius_handle.value = context_raw.brush_decal_mask_radius; + context_raw.brush_decal_mask_radius_handle.f = context_raw.brush_decal_mask_radius; } else { context_raw.brush_radius += mouse_movement_x / 150; context_raw.brush_radius = math_max(0.01, math_min(4.0, context_raw.brush_radius)); context_raw.brush_radius = math_round(context_raw.brush_radius * 100) / 100; - context_raw.brush_radius_handle.value = context_raw.brush_radius; + context_raw.brush_radius_handle.f = context_raw.brush_radius; } ui_header_handle.redraws = 2; } @@ -1071,26 +1071,26 @@ function ui_base_update() { else if (operator_shortcut(map_get(config_keymap, "brush_radius_decrease"), shortcut_type_t.REPEAT)) { context_raw.brush_radius -= ui_base_get_radius_increment(); context_raw.brush_radius = math_max(math_round(context_raw.brush_radius * 100) / 100, 0.01); - context_raw.brush_radius_handle.value = context_raw.brush_radius; + context_raw.brush_radius_handle.f = context_raw.brush_radius; ui_header_handle.redraws = 2; } else if (operator_shortcut(map_get(config_keymap, "brush_radius_increase"), shortcut_type_t.REPEAT)) { context_raw.brush_radius += ui_base_get_radius_increment(); context_raw.brush_radius = math_round(context_raw.brush_radius * 100) / 100; - context_raw.brush_radius_handle.value = context_raw.brush_radius; + context_raw.brush_radius_handle.f = context_raw.brush_radius; ui_header_handle.redraws = 2; } else if (decal_mask) { if (operator_shortcut(map_get(config_keymap, "decal_mask") + "+" + map_get(config_keymap, "brush_radius_decrease"), shortcut_type_t.REPEAT)) { context_raw.brush_decal_mask_radius -= ui_base_get_radius_increment(); context_raw.brush_decal_mask_radius = math_max(math_round(context_raw.brush_decal_mask_radius * 100) / 100, 0.01); - context_raw.brush_decal_mask_radius_handle.value = context_raw.brush_decal_mask_radius; + context_raw.brush_decal_mask_radius_handle.f = context_raw.brush_decal_mask_radius; ui_header_handle.redraws = 2; } else if (operator_shortcut(map_get(config_keymap, "decal_mask") + "+" + map_get(config_keymap, "brush_radius_increase"), shortcut_type_t.REPEAT)) { context_raw.brush_decal_mask_radius += ui_base_get_radius_increment(); context_raw.brush_decal_mask_radius = math_round(context_raw.brush_decal_mask_radius * 100) / 100; - context_raw.brush_decal_mask_radius_handle.value = context_raw.brush_decal_mask_radius; + context_raw.brush_decal_mask_radius_handle.f = context_raw.brush_decal_mask_radius; ui_header_handle.redraws = 2; } } @@ -1123,7 +1123,7 @@ function ui_base_update() { } else if (operator_shortcut(map_get(config_keymap, "view_camera_type"))) { context_raw.camera_type = context_raw.camera_type == camera_type_t.PERSPECTIVE ? camera_type_t.ORTHOGRAPHIC : camera_type_t.PERSPECTIVE; - context_raw.cam_handle.position = context_raw.camera_type; + context_raw.cam_handle.i = context_raw.camera_type; viewport_update_camera_type(context_raw.camera_type); } else if (operator_shortcut(map_get(config_keymap, "view_orbit_left"), shortcut_type_t.REPEAT)) { @@ -1151,7 +1151,7 @@ function ui_base_update() { 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; + mode_handle.i = context_raw.viewport_mode; ui_text(tr("Viewport Mode"), ui_align_t.RIGHT); let modes: string[] = [ tr("Lit"), @@ -1184,12 +1184,12 @@ function ui_base_update() { let index: i32 = array_index_of(shortcuts, keyboard_key_code(ui.key_code)); if (ui.is_key_pressed && index != -1) { - mode_handle.position = index; + mode_handle.i = index; ui.changed = true; - context_set_viewport_mode(mode_handle.position); + context_set_viewport_mode(mode_handle.i); } else if (mode_handle.changed) { - context_set_viewport_mode(mode_handle.position); + context_set_viewport_mode(mode_handle.i); ui.changed = true; } }); @@ -1589,7 +1589,7 @@ function ui_base_update_ui() { context_raw.clone_delta_y = (context_raw.clone_start_y - my) / sys_h(); context_raw.clone_start_x = -1; } - else if (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND) { + else if (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.i == fill_type_t.UV_ISLAND) { util_uv_uvislandmap_cached = false; } } @@ -1721,14 +1721,14 @@ function ui_base_render() { // Remember last tab positions for (let i: i32 = 0; i < ui_base_htabs.length; ++i) { if (ui_base_htabs[i].changed) { - config_raw.layout_tabs[i] = ui_base_htabs[i].position; + config_raw.layout_tabs[i] = ui_base_htabs[i].i; config_save(); } } // Set tab positions for (let i: i32 = 0; i < ui_base_htabs.length; ++i) { - ui_base_htabs[i].position = config_raw.layout_tabs[i]; + ui_base_htabs[i].i = config_raw.layout_tabs[i]; } // Nothing to display in the main area diff --git a/paint/sources/box_export.ts b/paint/sources/box_export.ts index c4ce7bfd..598106c0 100644 --- a/paint/sources/box_export.ts +++ b/paint/sources/box_export.ts @@ -39,7 +39,7 @@ function box_export_show_textures() { if (box_export_files == null) { box_export_fetch_presets(); - box_export_hpreset.position = array_index_of(box_export_files, "generic"); + box_export_hpreset.i = array_index_of(box_export_files, "generic"); } if (box_export_preset == null) { box_export_parse_preset(); @@ -62,7 +62,7 @@ function box_export_show_bake_material() { if (box_export_files == null) { box_export_fetch_presets(); - box_export_hpreset.position = array_index_of(box_export_files, "generic"); + box_export_hpreset.i = array_index_of(box_export_files, "generic"); } if (box_export_preset == null) { box_export_parse_preset(); @@ -104,10 +104,10 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal } ui_row2(); - if (base_bits_handle.position == texture_bits_t.BITS8) { + if (base_bits_handle.i == texture_bits_t.BITS8) { let h: ui_handle_t = ui_handle(__ID__); if (h.init) { - h.position = context_raw.format_type; + h.i = context_raw.format_type; } let format_combo: string[] = ["png", "jpg"]; context_raw.format_type = ui_combo(h, format_combo, tr("Format"), true); @@ -115,18 +115,18 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal else { let h: ui_handle_t = ui_handle(__ID__); if (h.init) { - h.position = context_raw.format_type; + h.i = context_raw.format_type; } let format_combo: string[] = ["exr"]; context_raw.format_type = ui_combo(h, format_combo, tr("Format"), true); } ui.enabled = context_raw.format_type == texture_ldr_format_t.JPG && - base_bits_handle.position == texture_bits_t.BITS8; + base_bits_handle.i == texture_bits_t.BITS8; let h_quality: ui_handle_t = ui_handle(__ID__); if (h_quality.init) { - h_quality.value = context_raw.format_quality; + h_quality.f = context_raw.format_quality; } context_raw.format_quality = ui_slider(h_quality, tr("Quality"), 0.0, 100.0, true, 1); @@ -135,7 +135,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal ui_row2(); ui.enabled = !bake_material; let layers_export_handle: ui_handle_t = ui_handle(__ID__); - layers_export_handle.position = context_raw.layers_export; + layers_export_handle.i = context_raw.layers_export; let layers_export_combo: string[] = [tr("Visible"), tr("Selected"), tr("Per Object"), tr("Per Udim Tile")]; context_raw.layers_export = ui_combo(layers_export_handle, layers_export_combo, tr("Layers"), true); ui.enabled = true; @@ -146,7 +146,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal } let layers_destination_handle: ui_handle_t = ui_handle(__ID__); - layers_destination_handle.position = context_raw.layers_destination; + layers_destination_handle.i = context_raw.layers_destination; let layers_destination_combo: string[] = [tr("Disk"), tr("Packed")]; context_raw.layers_destination = ui_combo(layers_destination_handle, layers_destination_combo, tr("Destination"), true); @@ -167,7 +167,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal }); } else { - let filters: string = base_bits_handle.position != texture_bits_t.BITS8 ? "exr" : context_raw.format_type == texture_ldr_format_t.PNG ? "png" : "jpg"; + let filters: string = base_bits_handle.i != texture_bits_t.BITS8 ? "exr" : context_raw.format_type == texture_ldr_format_t.PNG ? "png" : "jpg"; _box_export_bake_material = bake_material; ui_files_show(filters, true, false, function (path: string) { context_raw.texture_export_path = path; @@ -214,9 +214,9 @@ function box_export_tab_presets() { box_export_new_preset(preset_name); box_export_fetch_presets(); box_export_preset = null; - box_export_hpreset.position = array_index_of(box_export_files, preset_name); + box_export_hpreset.i = array_index_of(box_export_files, preset_name); ui_box_hide(); - box_export_htab.position = 1; // Presets + box_export_htab.i = 1; // Presets box_export_show_textures(); } } @@ -232,7 +232,7 @@ function box_export_tab_presets() { file_copy(path, dst_path); // Copy to presets folder box_export_fetch_presets(); box_export_preset = null; - box_export_hpreset.position = array_index_of(box_export_files, substring(filename, 0, filename.length - 5)); // Strip .json + box_export_hpreset.i = array_index_of(box_export_files, substring(filename, 0, filename.length - 5)); // Strip .json console_info(tr("Preset imported:") + " " + filename); } else { @@ -274,36 +274,36 @@ function box_export_tab_presets() { } let hr: ui_handle_t = ui_nest(htex, 0); - hr.position = array_index_of(box_export_channels, t.channels[0]); + hr.i = array_index_of(box_export_channels, t.channels[0]); let hg: ui_handle_t = ui_nest(htex, 1); - hg.position = array_index_of(box_export_channels, t.channels[1]); + hg.i = array_index_of(box_export_channels, t.channels[1]); let hb: ui_handle_t = ui_nest(htex, 2); - hb.position = array_index_of(box_export_channels, t.channels[2]); + hb.i = array_index_of(box_export_channels, t.channels[2]); let ha: ui_handle_t = ui_nest(htex, 3); - ha.position = array_index_of(box_export_channels, t.channels[3]); + ha.i = array_index_of(box_export_channels, t.channels[3]); ui_combo(hr, box_export_channels, tr("R")); if (hr.changed) { - t.channels[0] = box_export_channels[hr.position]; + t.channels[0] = box_export_channels[hr.i]; } ui_combo(hg, box_export_channels, tr("G")); if (hg.changed) { - t.channels[1] = box_export_channels[hg.position]; + t.channels[1] = box_export_channels[hg.i]; } ui_combo(hb, box_export_channels, tr("B")); if (hb.changed) { - t.channels[2] = box_export_channels[hb.position]; + t.channels[2] = box_export_channels[hb.i]; } ui_combo(ha, box_export_channels, tr("A")); if (ha.changed) { - t.channels[3] = box_export_channels[ha.position]; + t.channels[3] = box_export_channels[ha.i]; } let hspace: ui_handle_t = ui_nest(htex, 4); - hspace.position = array_index_of(box_export_color_spaces, t.color_space); + hspace.i = array_index_of(box_export_color_spaces, t.color_space); ui_combo(hspace, box_export_color_spaces, tr("Color Space")); if (hspace.changed) { - t.color_space = box_export_color_spaces[hspace.position]; + t.color_space = box_export_color_spaces[hspace.i]; } } @@ -342,14 +342,14 @@ function box_export_tab_atlases() { ui_row2(); ui_text(project_paint_objects[i].base.name); let hatlas: ui_handle_t = ui_nest(ui_handle(__ID__), i); - hatlas.position = project_atlas_objects[i]; + hatlas.i = project_atlas_objects[i]; project_atlas_objects[i] = ui_combo(hatlas, project_atlas_names, tr("Atlas")); } } } function box_export_show_mesh() { - box_export_mesh_handle.position = context_raw.export_mesh_index; + box_export_mesh_handle.i = context_raw.export_mesh_index; ui_box_show_custom(function () { let htab: ui_handle_t = ui_handle(__ID__); box_export_tab_export_mesh(htab); @@ -364,7 +364,7 @@ function box_export_tab_export_mesh(htab: ui_handle_t) { let h_export_mesh_format: ui_handle_t = ui_handle(__ID__); if (h_export_mesh_format.init) { - h_export_mesh_format.position = context_raw.export_mesh_format; + h_export_mesh_format.i = context_raw.export_mesh_format; } let export_mesh_format_combo: string[] = ["obj", "arm"]; context_raw.export_mesh_format = ui_combo(h_export_mesh_format, export_mesh_format_combo, tr("Format"), true); @@ -380,12 +380,12 @@ function box_export_tab_export_mesh(htab: ui_handle_t) { let hmerge: ui_handle_t = ui_handle(__ID__); if (hmerge.init) { - hmerge.selected = true; + hmerge.b = true; } let merge_vertices: bool = ui_check(hmerge, tr("Merge Shared Vertices")); let tris: i32 = 0; - let pos: i32 = box_export_mesh_handle.position; + let pos: i32 = box_export_mesh_handle.i; let paint_objects: mesh_object_t[]; if (pos == 0) { paint_objects = project_paint_objects; @@ -422,11 +422,11 @@ function box_export_tab_export_mesh(htab: ui_handle_t) { ///end let paint_objects: mesh_object_t[]; - if (box_export_mesh_handle.position == 0) { + if (box_export_mesh_handle.i == 0) { paint_objects = null; } else { - let po: mesh_object_t = project_paint_objects[box_export_mesh_handle.position - 1]; + let po: mesh_object_t = project_paint_objects[box_export_mesh_handle.i - 1]; paint_objects = [po]; } @@ -443,8 +443,8 @@ function box_export_show_material() { if (ui_tab(htab, tr("Export Material"), tab_vertical)) { let h1: ui_handle_t = ui_handle(__ID__); let h2: ui_handle_t = ui_handle(__ID__); - h1.selected = context_raw.pack_assets_on_export; - h2.selected = context_raw.write_icon_on_export; + h1.b = context_raw.pack_assets_on_export; + h2.b = context_raw.write_icon_on_export; context_raw.pack_assets_on_export = ui_check(h1, tr("Pack Assets")); context_raw.write_icon_on_export = ui_check(h2, tr("Export Icon")); ui_row2(); @@ -474,8 +474,8 @@ function box_export_show_brush() { if (ui_tab(htab, tr("Export Brush"), tab_vertical)) { let h1: ui_handle_t = ui_handle(__ID__); let h2: ui_handle_t = ui_handle(__ID__); - h1.selected = context_raw.pack_assets_on_export; - h2.selected = context_raw.write_icon_on_export; + h1.b = context_raw.pack_assets_on_export; + h2.b = context_raw.write_icon_on_export; context_raw.pack_assets_on_export = ui_check(h1, tr("Pack Assets")); context_raw.write_icon_on_export = ui_check(h2, tr("Export Icon")); ui_row2(); @@ -505,7 +505,7 @@ function box_export_fetch_presets() { } function box_export_parse_preset() { - let file: string = "export_presets/" + box_export_files[box_export_hpreset.position] + ".json"; + let file: string = "export_presets/" + box_export_files[box_export_hpreset.i] + ".json"; let blob: buffer_t = data_get_blob(file); box_export_preset = json_parse(sys_buffer_to_string(blob)); data_delete_blob(file); @@ -527,7 +527,7 @@ function box_export_new_preset(name: string) { } function box_export_save_preset() { - let name: string = box_export_files[box_export_hpreset.position]; + let name: string = box_export_files[box_export_hpreset.i]; if (name == "generic") { return; // generic is const } diff --git a/paint/sources/box_preferences.ts b/paint/sources/box_preferences.ts index 17d511c2..5f554a8b 100644 --- a/paint/sources/box_preferences.ts +++ b/paint/sources/box_preferences.ts @@ -20,11 +20,11 @@ function box_preferences_show() { let locale_handle: ui_handle_t = ui_handle(__ID__); if (locale_handle.init) { - locale_handle.position = array_index_of(box_preferences_locales, config_raw.locale); + locale_handle.i = array_index_of(box_preferences_locales, config_raw.locale); } ui_combo(locale_handle, box_preferences_locales, tr("Language"), true); if (locale_handle.changed) { - let locale_code: string = box_preferences_locales[locale_handle.position]; + let locale_code: string = box_preferences_locales[locale_handle.i]; config_raw.locale = locale_code; translator_load_translations(locale_code); base_redraw_ui(); @@ -32,15 +32,15 @@ function box_preferences_show() { let hscale: ui_handle_t = ui_handle(__ID__); if (hscale.init) { - hscale.value = config_raw.window_scale; + hscale.f = config_raw.window_scale; } ui_slider(hscale, tr("UI Scale"), 1.0, 4.0, true, 10); if (context_raw.hscale_was_changed && !ui.input_down) { context_raw.hscale_was_changed = false; - if (hscale.value == 0.0) { - hscale.value = 1.0; + if (hscale.f == 0.0) { + hscale.f = 1.0; } - config_raw.window_scale = hscale.value; + config_raw.window_scale = hscale.f; box_preferences_set_scale(); } if (hscale.changed) { @@ -49,45 +49,45 @@ function box_preferences_show() { let hspeed: ui_handle_t = ui_handle(__ID__); if (hspeed.init) { - hspeed.value = config_raw.camera_zoom_speed; + hspeed.f = config_raw.camera_zoom_speed; } config_raw.camera_zoom_speed = ui_slider(hspeed, tr("Camera Zoom Speed"), 0.1, 4.0, true); hspeed = ui_handle(__ID__); if (hspeed.init) { - hspeed.value = config_raw.camera_rotation_speed; + hspeed.f = config_raw.camera_rotation_speed; } config_raw.camera_rotation_speed = ui_slider(hspeed, tr("Camera Rotation Speed"), 0.1, 4.0, true); hspeed = ui_handle(__ID__); if (hspeed.init) { - hspeed.value = config_raw.camera_pan_speed; + hspeed.f = config_raw.camera_pan_speed; } config_raw.camera_pan_speed = ui_slider(hspeed, tr("Camera Pan Speed"), 0.1, 4.0, true); let zoom_direction_handle: ui_handle_t = ui_handle(__ID__); if (zoom_direction_handle.init) { - zoom_direction_handle.position = config_raw.zoom_direction; + zoom_direction_handle.i = config_raw.zoom_direction; } let zoom_direction_combo: string[] = [tr("Vertical"), tr("Vertical Inverted"), tr("Horizontal"), tr("Horizontal Inverted"), tr("Vertical and Horizontal"), tr("Vertical and Horizontal Inverted")]; ui_combo(zoom_direction_handle, zoom_direction_combo, tr("Direction to Zoom"), true); if (zoom_direction_handle.changed) { - config_raw.zoom_direction = zoom_direction_handle.position; + config_raw.zoom_direction = zoom_direction_handle.i; } let h_node_preview: ui_handle_t = ui_handle(__ID__); if (h_node_preview.init) { - h_node_preview.position = config_raw.node_preview; + h_node_preview.i = config_raw.node_preview; } let node_preview_combo: string[] = [tr("Off"), tr("Selected Node")]; // , tr("All Nodes")]; ui_combo(h_node_preview, node_preview_combo, tr("Node Preview"), true); if (h_node_preview.changed) { - config_raw.node_preview = h_node_preview.position; + config_raw.node_preview = h_node_preview.i; } let h_wrap_mouse: ui_handle_t = ui_handle(__ID__); if (h_wrap_mouse.init) { - h_wrap_mouse.selected = config_raw.wrap_mouse; + h_wrap_mouse.b = config_raw.wrap_mouse; } config_raw.wrap_mouse = ui_check(h_wrap_mouse, tr("Wrap Mouse")); if (ui.is_hovered) { @@ -97,7 +97,7 @@ function box_preferences_show() { ui.changed = false; let h_show_asset_names: ui_handle_t = ui_handle(__ID__); if (h_show_asset_names.init) { - h_show_asset_names.selected = config_raw.show_asset_names; + h_show_asset_names.b = config_raw.show_asset_names; } config_raw.show_asset_names = ui_check(h_show_asset_names, tr("Show Asset Names")); if (ui.changed) { @@ -108,7 +108,7 @@ function box_preferences_show() { ui.changed = false; let h_touch_ui: ui_handle_t = ui_handle(__ID__); if (h_touch_ui.init) { - h_touch_ui.selected = config_raw.touch_ui; + h_touch_ui.b = config_raw.touch_ui; } config_raw.touch_ui = ui_check(h_touch_ui, tr("Touch UI")); if (ui.changed) { @@ -123,13 +123,13 @@ function box_preferences_show() { let h_splash_screen: ui_handle_t = ui_handle(__ID__); if (h_splash_screen.init) { - h_splash_screen.selected = config_raw.splash_screen; + h_splash_screen.b = config_raw.splash_screen; } config_raw.splash_screen = ui_check(h_splash_screen, tr("Splash Screen")); let h_grid_snap: ui_handle_t = ui_handle(__ID__); if (h_grid_snap.init) { - h_grid_snap.selected = config_raw.grid_snap; + h_grid_snap.b = config_raw.grid_snap; } config_raw.grid_snap = ui_check(h_grid_snap, tr("Grid Snap")); ui_nodes_grid_snap = config_raw.grid_snap; @@ -189,7 +189,7 @@ function box_preferences_show() { } box_preferences_theme_handle = ui_handle(__ID__); if (box_preferences_theme_handle.init) { - box_preferences_theme_handle.position = box_preferences_get_theme_index(); + box_preferences_theme_handle.i = box_preferences_get_theme_index(); } ui_begin_sticky(); @@ -197,7 +197,7 @@ function box_preferences_show() { ui_combo(box_preferences_theme_handle, box_preferences_themes, tr("Theme")); if (box_preferences_theme_handle.changed) { - config_raw.theme = box_preferences_themes[box_preferences_theme_handle.position] + ".json"; + config_raw.theme = box_preferences_themes[box_preferences_theme_handle.i] + ".json"; config_load_theme(config_raw.theme); } @@ -219,9 +219,9 @@ function box_preferences_show() { iron_file_save_bytes(path, sys_string_to_buffer(template), 0); box_preferences_fetch_themes(); // Refresh file list config_raw.theme = theme_name; - box_preferences_theme_handle.position = box_preferences_get_theme_index(); + box_preferences_theme_handle.i = box_preferences_get_theme_index(); ui_box_hide(); - box_preferences_htab.position = 1; // Themes + box_preferences_htab.i = 1; // Themes box_preferences_show(); } } @@ -288,13 +288,13 @@ function box_preferences_show() { key == "FULL_TABS" || key == "ROUND_CORNERS" || key == "SHADOWS") { - h.selected = val > 0; + h.b = val > 0; let b: bool = ui_check(h, key); DEREFERENCE(u32_theme + i) = b; } else if (key == "LINK_STYLE") { let styles: string[] = [tr("Straight"), tr("Curved")]; - h.position = val; + h.i = val; let pos: i32 = ui_combo(h, styles, key, true); DEREFERENCE(u32_theme + i) = pos; } @@ -319,11 +319,11 @@ function box_preferences_show() { if (ui_tab(box_preferences_htab, tr("Usage"), true)) { context_raw.undo_handle = ui_handle(__ID__); if (context_raw.undo_handle.init) { - context_raw.undo_handle.value = config_raw.undo_steps; + context_raw.undo_handle.f = config_raw.undo_steps; } config_raw.undo_steps = math_floor(ui_slider(context_raw.undo_handle, tr("Undo Steps"), 1, 64, false, 1)); if (config_raw.undo_steps < 1) { - config_raw.undo_steps = math_floor(context_raw.undo_handle.value = 1); + config_raw.undo_steps = context_raw.undo_handle.f = 1; } if (context_raw.undo_handle.changed) { let current: gpu_texture_t = _draw_current; @@ -347,7 +347,7 @@ function box_preferences_show() { let h_dilate_radius: ui_handle_t = ui_handle(__ID__); if (h_dilate_radius.init) { - h_dilate_radius.value = config_raw.dilate_radius; + h_dilate_radius.f = config_raw.dilate_radius; } config_raw.dilate_radius = math_floor(ui_slider(h_dilate_radius, tr("Dilate Radius"), 0.0, 16.0, true, 1)); if (ui.is_hovered) { @@ -356,17 +356,17 @@ function box_preferences_show() { let camera_controls_handle: ui_handle_t = ui_handle(__ID__); if (camera_controls_handle.init) { - camera_controls_handle.position = config_raw.camera_controls; + camera_controls_handle.i = config_raw.camera_controls; } let camera_controls_combo: string[] = [tr("Orbit"), tr("Rotate"), tr("Fly")]; ui_combo(camera_controls_handle, camera_controls_combo, tr("Default Camera Controls"), true); if (camera_controls_handle.changed) { - config_raw.camera_controls = camera_controls_handle.position; + config_raw.camera_controls = camera_controls_handle.i; } let layer_res_handle: ui_handle_t = ui_handle(__ID__); if (layer_res_handle.init) { - layer_res_handle.position = config_raw.layer_res; + layer_res_handle.i = config_raw.layer_res; } ///if (arm_android || arm_ios) @@ -377,17 +377,17 @@ function box_preferences_show() { ui_combo(layer_res_handle, res_combo, tr("Default Layer Resolution"), true); if (layer_res_handle.changed) { - config_raw.layer_res = layer_res_handle.position; + config_raw.layer_res = layer_res_handle.i; } let scene_atlas_res_handle: ui_handle_t = ui_handle(__ID__); if (scene_atlas_res_handle.init) { - scene_atlas_res_handle.position = config_raw.scene_atlas_res; + scene_atlas_res_handle.i = config_raw.scene_atlas_res; } ui_combo(scene_atlas_res_handle, res_combo, tr("Scene Atlas Resolution"), true); if (scene_atlas_res_handle.changed) { - config_raw.scene_atlas_res = scene_atlas_res_handle.position; + config_raw.scene_atlas_res = scene_atlas_res_handle.i; } let server_handle: ui_handle_t = ui_handle(__ID__); @@ -398,7 +398,7 @@ function box_preferences_show() { let material_live_handle: ui_handle_t = ui_handle(__ID__); if (material_live_handle.init) { - material_live_handle.selected = config_raw.material_live; + material_live_handle.b = config_raw.material_live; } config_raw.material_live = ui_check(material_live_handle, tr("Live Material Preview")); if (ui.is_hovered) { @@ -407,7 +407,7 @@ function box_preferences_show() { let brush_live_handle: ui_handle_t = ui_handle(__ID__); if (brush_live_handle.init) { - brush_live_handle.selected = config_raw.brush_live; + brush_live_handle.b = config_raw.brush_live; } config_raw.brush_live = ui_check(brush_live_handle, tr("Live Brush Preview")); if (ui.is_hovered) { @@ -419,7 +419,7 @@ function box_preferences_show() { let brush_depth_reject_handle: ui_handle_t = ui_handle(__ID__); if (brush_depth_reject_handle.init) { - brush_depth_reject_handle.selected = config_raw.brush_depth_reject; + brush_depth_reject_handle.b = config_raw.brush_depth_reject; } config_raw.brush_depth_reject = ui_check(brush_depth_reject_handle, tr("Depth Reject")); if (brush_depth_reject_handle.changed) { @@ -430,7 +430,7 @@ function box_preferences_show() { let brush_angle_reject_handle: ui_handle_t = ui_handle(__ID__); if (brush_angle_reject_handle.init) { - brush_angle_reject_handle.selected = config_raw.brush_angle_reject; + brush_angle_reject_handle.b = config_raw.brush_angle_reject; } config_raw.brush_angle_reject = ui_check(brush_angle_reject_handle, tr("Angle Reject")); if (brush_angle_reject_handle.changed) { @@ -442,7 +442,7 @@ function box_preferences_show() { } let angle_dot_handle: ui_handle_t = ui_handle(__ID__); if (angle_dot_handle.init) { - angle_dot_handle.value = context_raw.brush_angle_reject_dot; + angle_dot_handle.f = context_raw.brush_angle_reject_dot; } context_raw.brush_angle_reject_dot = ui_slider(angle_dot_handle, tr("Angle"), 0.0, 1.0, true); if (angle_dot_handle.changed) { @@ -452,7 +452,7 @@ function box_preferences_show() { let h_gpu_inference: ui_handle_t = ui_handle(__ID__); if (h_gpu_inference.init) { - h_gpu_inference.selected = config_raw.gpu_inference; + h_gpu_inference.b = config_raw.gpu_inference; } config_raw.gpu_inference = ui_check(h_gpu_inference, tr("GPU Inference")); if (ui.is_hovered) { @@ -471,31 +471,31 @@ function box_preferences_show() { ui_text(tr("Pressure controls")); let h_pressure_radius: ui_handle_t = ui_handle(__ID__); if (h_pressure_radius.init) { - h_pressure_radius.selected = config_raw.pressure_radius; + h_pressure_radius.b = config_raw.pressure_radius; } config_raw.pressure_radius = ui_check(h_pressure_radius, tr("Brush Radius")); let h_pressure_sensitivity: ui_handle_t = ui_handle(__ID__); if (h_pressure_sensitivity.init) { - h_pressure_sensitivity.value = config_raw.pressure_sensitivity; + h_pressure_sensitivity.f = config_raw.pressure_sensitivity; } config_raw.pressure_sensitivity = ui_slider(h_pressure_sensitivity, tr("Sensitivity"), 0.0, 10.0, true); let h_pressure_hardness: ui_handle_t = ui_handle(__ID__); if (h_pressure_hardness.init) { - h_pressure_hardness.selected = config_raw.pressure_hardness; + h_pressure_hardness.b = config_raw.pressure_hardness; } config_raw.pressure_hardness = ui_check(h_pressure_hardness, tr("Brush Hardness")); let h_pressure_opacity: ui_handle_t = ui_handle(__ID__); if (h_pressure_opacity.init) { - h_pressure_opacity.selected = config_raw.pressure_opacity; + h_pressure_opacity.b = config_raw.pressure_opacity; } config_raw.pressure_opacity = ui_check(h_pressure_opacity, tr("Brush Opacity")); let h_pressure_angle: ui_handle_t = ui_handle(__ID__); if (h_pressure_angle.init) { - h_pressure_angle.selected = config_raw.pressure_angle; + h_pressure_angle.b = config_raw.pressure_angle; } config_raw.pressure_angle = ui_check(h_pressure_angle, tr("Brush Angle")); @@ -513,34 +513,34 @@ function box_preferences_show() { context_raw.hssao = ui_handle(__ID__); if (context_raw.hssao.init) { - context_raw.hssao.selected = config_raw.rp_ssao; + context_raw.hssao.b = config_raw.rp_ssao; } context_raw.hbloom = ui_handle(__ID__); if (context_raw.hbloom.init) { - context_raw.hbloom.selected = config_raw.rp_bloom; + context_raw.hbloom.b = config_raw.rp_bloom; } context_raw.hsupersample = ui_handle(__ID__); if (context_raw.hsupersample.init) { - context_raw.hsupersample.position = config_get_super_sample_quality(config_raw.rp_supersample); + context_raw.hsupersample.i = config_get_super_sample_quality(config_raw.rp_supersample); } if (ui_tab(box_preferences_htab, tr("Viewport"), true)) { let mode_handle: ui_handle_t = ui_handle(__ID__); if (mode_handle.init) { - mode_handle.position = config_raw.viewport_mode; + mode_handle.i = config_raw.viewport_mode; } let mode_combo: string[] = [tr("Lit"), tr("Path Traced")]; ui_combo(mode_handle, mode_combo, tr("Default Mode"), true); if (mode_handle.changed) { - config_raw.viewport_mode = mode_handle.position; + config_raw.viewport_mode = mode_handle.i; } let hpathtrace_mode: ui_handle_t = ui_handle(__ID__); if (hpathtrace_mode.init) { - hpathtrace_mode.position = config_raw.pathtrace_mode; + hpathtrace_mode.i = config_raw.pathtrace_mode; } let pathtrace_mode_combo: string[] = [tr("Fast"), tr("Quality")]; config_raw.pathtrace_mode = ui_combo(hpathtrace_mode, pathtrace_mode_combo, tr("Path Tracer"), true); @@ -552,7 +552,7 @@ function box_preferences_show() { let hrender_mode: ui_handle_t = ui_handle(__ID__); if (hrender_mode.init) { - hrender_mode.position = context_raw.render_mode; + hrender_mode.i = context_raw.render_mode; } let render_mode_combo: string[] = [tr("Desktop"), tr("Mobile")]; context_raw.render_mode = ui_combo(hrender_mode, render_mode_combo, tr("Renderer"), true); @@ -579,7 +579,7 @@ function box_preferences_show() { let h: ui_handle_t = ui_handle(__ID__); if (h.init) { - h.value = config_raw.rp_vignette; + h.f = config_raw.rp_vignette; } config_raw.rp_vignette = ui_slider(h, tr("Vignette"), 0.0, 1.0, true); if (h.changed) { @@ -588,14 +588,14 @@ function box_preferences_show() { h = ui_handle(__ID__); if (h.init) { - h.value = config_raw.rp_grain; + h.f = config_raw.rp_grain; } config_raw.rp_grain = ui_slider(h, tr("Noise Grain"), 0.0, 1.0, true); if (h.changed) { context_raw.ddirty = 2; } - // let h: ui_handle_t = ui_handle("boxpreferences_46", { value: raw.auto_exposure_strength }); + // let h: ui_handle_t = ui_handle("boxpreferences_46", { f: raw.auto_exposure_strength }); // raw.auto_exposure_strength = ui_slider(h, "Auto Exposure", 0.0, 2.0, true); // if (h.changed) raw.ddirty = 2; @@ -603,8 +603,8 @@ function box_preferences_show() { let cam_raw: camera_data_t = cam.data; let near_handle: ui_handle_t = ui_handle(__ID__); let far_handle: ui_handle_t = ui_handle(__ID__); - near_handle.value = math_floor(cam_raw.near_plane * 1000) / 1000; - far_handle.value = math_floor(cam_raw.far_plane * 100) / 100; + near_handle.f = math_floor(cam_raw.near_plane * 1000) / 1000; + far_handle.f = math_floor(cam_raw.far_plane * 100) / 100; cam_raw.near_plane = ui_slider(near_handle, tr("Clip Start"), 0.001, 1.0, true); cam_raw.far_plane = ui_slider(far_handle, tr("Clip End"), 50.0, 100.0, true); if (near_handle.changed || far_handle.changed) { @@ -613,7 +613,7 @@ function box_preferences_show() { let disp_handle: ui_handle_t = ui_handle(__ID__); if (disp_handle.init) { - disp_handle.value = config_raw.displace_strength; + disp_handle.f = config_raw.displace_strength; } config_raw.displace_strength = ui_slider(disp_handle, tr("Displacement Strength"), 0.0, 10.0, true); if (disp_handle.changed) { @@ -632,11 +632,11 @@ function box_preferences_show() { box_preferences_preset_handle = ui_handle(__ID__); if (box_preferences_preset_handle.init) { - box_preferences_preset_handle.position = box_preferences_get_preset_index(); + box_preferences_preset_handle.i = box_preferences_get_preset_index(); } ui_combo(box_preferences_preset_handle, box_preferences_files_keymap, tr("Preset")); if (box_preferences_preset_handle.changed) { - config_raw.keymap = box_preferences_files_keymap[box_preferences_preset_handle.position] + ".json"; + config_raw.keymap = box_preferences_files_keymap[box_preferences_preset_handle.i] + ".json"; config_apply(); keymap_load(); } @@ -659,9 +659,9 @@ function box_preferences_show() { iron_file_save_bytes(path, sys_string_to_buffer(template), 0); box_preferences_fetch_keymaps(); // Refresh file list config_raw.keymap = keymap_name; - box_preferences_preset_handle.position = box_preferences_get_preset_index(); + box_preferences_preset_handle.i = box_preferences_get_preset_index(); ui_box_hide(); - box_preferences_htab.position = 5; // Keymap + box_preferences_htab.i = 5; // Keymap box_preferences_show(); } } @@ -735,7 +735,7 @@ plugin_notify_on_ui(plugin, function() {\ iron_file_save_bytes(path, sys_string_to_buffer(template), 0); box_preferences_files_plugin = null; // Refresh file list ui_box_hide(); - box_preferences_htab.position = 6; // Plugins + box_preferences_htab.i = 6; // Plugins box_preferences_show(); } } @@ -757,7 +757,7 @@ plugin_notify_on_ui(plugin, function() {\ } let h: ui_handle_t = ui_handle(__ID__); if (h.init) { - h.selected = false; + h.b = false; } for (let i: i32 = 0; i < box_preferences_files_plugin.length; ++i) { let f: string = box_preferences_files_plugin[i]; @@ -766,11 +766,11 @@ plugin_notify_on_ui(plugin, function() {\ continue; } let enabled: bool = array_index_of(config_raw.plugins, f) >= 0; - h.selected = enabled; + h.b = enabled; let tag: string = is_js ? string_split(f, ".")[0] : f; ui_check(h, tag); - if (h.changed && h.selected != enabled) { - h.selected ? config_enable_plugin(f) : config_disable_plugin(f); + if (h.changed && h.b != enabled) { + h.b ? config_enable_plugin(f) : config_disable_plugin(f); base_redraw_ui(); } if (ui.is_hovered && ui.input_released_r) { diff --git a/paint/sources/config.ts b/paint/sources/config.ts index c3572994..547df5b2 100644 --- a/paint/sources/config.ts +++ b/paint/sources/config.ts @@ -219,7 +219,7 @@ function config_init() { ui_touch_scroll = config_raw.touch_ui; ui_touch_hold = config_raw.touch_ui; ui_touch_tooltip = config_raw.touch_ui; - base_res_handle.position = config_raw.layer_res; + base_res_handle.i = config_raw.layer_res; keymap_load(); } @@ -295,9 +295,9 @@ function config_import_from(from: config_t) { } function config_apply() { - config_raw.rp_ssao = context_raw.hssao.selected; - config_raw.rp_bloom = context_raw.hbloom.selected; - config_raw.rp_supersample = config_get_super_sample_size(context_raw.hsupersample.position); + config_raw.rp_ssao = context_raw.hssao.b; + config_raw.rp_bloom = context_raw.hbloom.b; + config_raw.rp_supersample = config_get_super_sample_size(context_raw.hsupersample.i); config_save(); context_raw.ddirty = 2; @@ -336,7 +336,7 @@ function config_texture_res_size(pos: i32): i32 { } function config_get_texture_res(): i32 { - let res: i32 = base_res_handle.position; + let res: i32 = base_res_handle.i; return config_texture_res_size(res); } diff --git a/paint/sources/context.ts b/paint/sources/context.ts index 4550d463..6bb44b11 100644 --- a/paint/sources/context.ts +++ b/paint/sources/context.ts @@ -391,17 +391,17 @@ function context_create(): context_t { c.brush_scale_x = 1.0; c.brush_decal_mask_radius = 0.5; c.brush_decal_mask_radius_handle = ui_handle_create(); - c.brush_decal_mask_radius_handle.value = 0.5; + c.brush_decal_mask_radius_handle.f = 0.5; c.brush_scale_x_handle = ui_handle_create(); - c.brush_scale_x_handle.value = 1.0; + c.brush_scale_x_handle.f = 1.0; c.brush_blending = blend_type_t.MIX; c.brush_opacity = 1.0; c.brush_opacity_handle = ui_handle_create(); - c.brush_opacity_handle.value = 1.0; + c.brush_opacity_handle.f = 1.0; c.brush_scale = 1.0; c.brush_angle = 0.0; c.brush_angle_handle = ui_handle_create(); - c.brush_angle_handle.value = 0.0; + c.brush_angle_handle.f = 0.0; c.brush_lazy_radius = 0.0; c.brush_lazy_step = 0.0; c.brush_lazy_x = 0.0; @@ -760,7 +760,7 @@ function context_ext_init(c: context_t) { c.tool = tool_type_t.BRUSH; c.color_picker_previous_tool = tool_type_t.BRUSH; c.brush_radius = 0.5; - c.brush_radius_handle.value = 0.5; + c.brush_radius_handle.f = 0.5; c.brush_hardness = 0.8; } diff --git a/paint/sources/export_arm.ts b/paint/sources/export_arm.ts index 956196b1..225e7e6b 100644 --- a/paint/sources/export_arm.ts +++ b/paint/sources/export_arm.ts @@ -65,7 +65,7 @@ function export_arm_run_project() { let font_files: string[] = export_arm_fonts_to_files(project_filepath, project_fonts); let mesh_files: string[] = export_arm_meshes_to_files(project_filepath); - let bits_pos: i32 = base_bits_handle.position; + let bits_pos: i32 = base_bits_handle.i; let bpp: i32 = bits_pos == texture_bits_t.BITS8 ? 8 : bits_pos == texture_bits_t.BITS16 ? 16 : 32; let ld: layer_data_t[] = []; diff --git a/paint/sources/export_texture.ts b/paint/sources/export_texture.ts index 30800031..cf2f405c 100644 --- a/paint/sources/export_texture.ts +++ b/paint/sources/export_texture.ts @@ -156,7 +156,7 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ f = tr("untitled"); } let format_type: texture_ldr_format_t = context_raw.format_type; - let bits: i32 = base_bits_handle.position == texture_bits_t.BITS8 ? 8 : 16; + let bits: i32 = base_bits_handle.i == texture_bits_t.BITS8 ? 8 : 16; let ext: string = bits == 16 ? ".exr" : format_type == texture_ldr_format_t.PNG ? ".png" : ".jpg"; if (ends_with(f, ext)) { f = substring(f, 0, f.length - 4); @@ -417,7 +417,7 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ function export_texture_write_texture(file: string, pixels: buffer_t, type: i32 = 1, off: i32 = 0) { let res_x: i32 = config_get_texture_res_x(); let res_y: i32 = config_get_texture_res_y(); - let bits_handle: i32 = base_bits_handle.position; + let bits_handle: i32 = base_bits_handle.i; let bits: i32 = bits_handle == texture_bits_t.BITS8 ? 8 : bits_handle == texture_bits_t.BITS16 ? 16 : 32; let format: i32 = 0; // RGBA if (type == 1) { diff --git a/paint/sources/history.ts b/paint/sources/history.ts index b03a6f97..31948ace 100644 --- a/paint/sources/history.ts +++ b/paint/sources/history.ts @@ -676,8 +676,8 @@ function history_copy_to_undo(from_id: i32, to_id: i32, is_mask: bool) { render_path_bind_target("texpaint_pack" + from_id, "tex2"); let format: tex_format_t = - base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : - base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : + base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : + base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : tex_format_t.RGBA128; let pipe: string = format == tex_format_t.RGBA32 ? "copy_mrt3_pass" : diff --git a/paint/sources/import_arm.ts b/paint/sources/import_arm.ts index cf8186ae..c309d407 100644 --- a/paint/sources/import_arm.ts +++ b/paint/sources/import_arm.ts @@ -70,9 +70,9 @@ function import_arm_run_project(path: string) { project_raw = project; let l0: layer_data_t = project.layer_datas[0]; - base_res_handle.position = config_get_texture_res_pos(l0.res); + base_res_handle.i = config_get_texture_res_pos(l0.res); let bits_pos: texture_bits_t = l0.bpp == 8 ? texture_bits_t.BITS8 : l0.bpp == 16 ? texture_bits_t.BITS16 : texture_bits_t.BITS32; - base_bits_handle.position = bits_pos; + base_bits_handle.i = bits_pos; let bytes_per_pixel: i32 = math_floor(l0.bpp / 8); let format: tex_format_t = l0.bpp == 8 ? tex_format_t.RGBA32 : l0.bpp == 16 ? tex_format_t.RGBA64 : tex_format_t.RGBA128; diff --git a/paint/sources/import_keymap.ts b/paint/sources/import_keymap.ts index 86c39dba..51290891 100644 --- a/paint/sources/import_keymap.ts +++ b/paint/sources/import_keymap.ts @@ -9,6 +9,6 @@ function import_keymap_run(path: string) { let dst_path: string = path_data() + path_sep + "keymap_presets" + path_sep + filename; file_copy(path, dst_path); // Copy to preset folder box_preferences_fetch_keymaps(); // Refresh file list - box_preferences_preset_handle.position = box_preferences_get_preset_index(); + box_preferences_preset_handle.i = box_preferences_get_preset_index(); console_info(tr("Keymap imported:") + " " + filename); } diff --git a/paint/sources/import_theme.ts b/paint/sources/import_theme.ts index bbcd1eda..6185d597 100644 --- a/paint/sources/import_theme.ts +++ b/paint/sources/import_theme.ts @@ -10,7 +10,7 @@ function import_theme_run(path: string) { file_copy(path, dst_path); // Copy to preset folder box_preferences_fetch_themes(); // Refresh file list config_raw.theme = filename; - box_preferences_theme_handle.position = box_preferences_get_theme_index(); + box_preferences_theme_handle.i = box_preferences_get_theme_index(); config_load_theme(config_raw.theme); console_info(tr("Theme imported:") + " " + filename); } diff --git a/paint/sources/layers.ts b/paint/sources/layers.ts index 73b28410..c6e83b0e 100644 --- a/paint/sources/layers.ts +++ b/paint/sources/layers.ts @@ -26,10 +26,10 @@ function layers_init() { function layers_resize() { let conf: config_t = config_raw; - if (base_res_handle.position >= math_floor(texture_res_t.RES16384)) { // Save memory for >=16k + if (base_res_handle.i >= math_floor(texture_res_t.RES16384)) { // Save memory for >=16k conf.undo_steps = 1; if (context_raw.undo_handle != null) { - context_raw.undo_handle.value = conf.undo_steps; + context_raw.undo_handle.f = conf.undo_steps; } while (history_undo_layers.length > conf.undo_steps) { let l: slot_layer_t = array_pop(history_undo_layers); @@ -103,8 +103,8 @@ function layers_make_temp_img() { layers_temp_image = null; } if (layers_temp_image == null) { - let format: string = base_bits_handle.position == texture_bits_t.BITS8 ? "RGBA32" : - base_bits_handle.position == texture_bits_t.BITS16 ? "RGBA64" : + let format: string = base_bits_handle.i == texture_bits_t.BITS8 ? "RGBA32" : + base_bits_handle.i == texture_bits_t.BITS16 ? "RGBA64" : "RGBA128"; let t: render_target_t = render_target_create(); @@ -146,8 +146,8 @@ function layers_make_export_img() { map_delete(render_path_render_targets, "expc"); } if (layers_expa == null) { - let format: string = base_bits_handle.position == texture_bits_t.BITS8 ? "RGBA32" : - base_bits_handle.position == texture_bits_t.BITS16 ? "RGBA64" : + let format: string = base_bits_handle.i == texture_bits_t.BITS8 ? "RGBA32" : + base_bits_handle.i == texture_bits_t.BITS16 ? "RGBA64" : "RGBA128"; @@ -242,7 +242,7 @@ function layers_is_fill_material(): bool { function layers_update_fill_layers() { let _layer: slot_layer_t = context_raw.layer; let _tool: tool_type_t = context_raw.tool; - let _fill_type: i32 = context_raw.fill_type_handle.position; + let _fill_type: i32 = context_raw.fill_type_handle.i; let current: gpu_texture_t = null; if (context_raw.tool == tool_type_t.MATERIAL) { @@ -254,7 +254,7 @@ function layers_update_fill_layers() { if (current != null) draw_end(); context_raw.tool = tool_type_t.FILL; - context_raw.fill_type_handle.position = fill_type_t.OBJECT; + context_raw.fill_type_handle.i = fill_type_t.OBJECT; render_path_paint_set_plane_mesh(); make_material_parse_paint_material(false); context_raw.pdirty = 1; @@ -263,7 +263,7 @@ function layers_update_fill_layers() { render_path_paint_dilate(true, true); render_path_paint_use_live_layer(false); context_raw.tool = _tool; - context_raw.fill_type_handle.position = _fill_type; + context_raw.fill_type_handle.i = _fill_type; context_raw.pdirty = 0; context_raw.rdirty = 2; render_path_paint_restore_plane_mesh(); @@ -296,7 +296,7 @@ function layers_update_fill_layers() { } context_raw.pdirty = 1; context_raw.tool = tool_type_t.FILL; - context_raw.fill_type_handle.position = fill_type_t.OBJECT; + context_raw.fill_type_handle.i = fill_type_t.OBJECT; if (has_fill_layer) { let first: bool = true; @@ -341,7 +341,7 @@ function layers_update_fill_layers() { context_raw.layer = _layer; layers_set_object_mask(); context_raw.tool = _tool; - context_raw.fill_type_handle.position = _fill_type; + context_raw.fill_type_handle.i = _fill_type; make_material_parse_paint_material(false); } } @@ -352,9 +352,9 @@ function layers_update_fill_layer(parse_paint: bool = true) { if (in_use) draw_end(); let _tool: tool_type_t = context_raw.tool; - let _fill_type: i32 = context_raw.fill_type_handle.position; + let _fill_type: i32 = context_raw.fill_type_handle.i; context_raw.tool = tool_type_t.FILL; - context_raw.fill_type_handle.position = fill_type_t.OBJECT; + context_raw.fill_type_handle.i = fill_type_t.OBJECT; context_raw.pdirty = 1; slot_layer_clear(context_raw.layer); @@ -367,7 +367,7 @@ function layers_update_fill_layer(parse_paint: bool = true) { context_raw.rdirty = 2; context_raw.tool = _tool; - context_raw.fill_type_handle.position = _fill_type; + context_raw.fill_type_handle.i = _fill_type; if (in_use) draw_begin(current); } diff --git a/paint/sources/make_paint.ts b/paint/sources/make_paint.ts index 0b435bd6..07067a53 100644 --- a/paint/sources/make_paint.ts +++ b/paint/sources/make_paint.ts @@ -22,8 +22,8 @@ function make_paint_color_attachments(): string[] { } let format: tex_format_t = - base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : - base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : + base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : + base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : tex_format_t.RGBA128; if (format == tex_format_t.RGBA64) { @@ -91,8 +91,8 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad return con_paint; } - let face_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE; - let uv_island_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND; + let face_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.i == fill_type_t.FACE; + let uv_island_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.i == fill_type_t.UV_ISLAND; let decal: bool = context_is_decal(); node_shader_write_vert(kong, "var tpos: float2 = float2(input.tex.x * 2.0 - 1.0, (1.0 - input.tex.y) * 2.0 - 1.0);"); @@ -165,7 +165,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } else { // Fill, Bake node_shader_write_frag(kong, "var dist: float = 0.0;"); - let angle_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.ANGLE; + let angle_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.i == fill_type_t.ANGLE; if (angle_fill) { node_shader_add_function(kong, str_octahedron_wrap); node_shader_add_texture(kong, "gbuffer0"); @@ -199,7 +199,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } } - if (context_raw.picker_mask_handle.position == picker_mask_t.MATERIAL) { + if (context_raw.picker_mask_handle.i == picker_mask_t.MATERIAL) { make_discard_material_id(kong); } @@ -371,7 +371,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_write_frag(kong, "var sample_undo: float4 = sample_lod(texpaint_undo, sampler_linear, sample_tc, 0.0);"); let matid: f32 = context_raw.material.id / 255; - if (context_raw.picker_mask_handle.position == picker_mask_t.MATERIAL) { + if (context_raw.picker_mask_handle.i == picker_mask_t.MATERIAL) { matid = context_raw.materialid_picked / 255; // Keep existing material id in place when mask is set } let matid_string: string = parser_material_vec1(matid * 3.0); diff --git a/paint/sources/neural_nodes/inpaint_node.ts b/paint/sources/neural_nodes/inpaint_node.ts index 97d99b63..e4956132 100644 --- a/paint/sources/neural_nodes/inpaint_node.ts +++ b/paint/sources/neural_nodes/inpaint_node.ts @@ -55,7 +55,7 @@ function inpaint_node_button(node_id: i32) { let inpaint_node_strength_handle: ui_handle_t = ui_handle(__ID__); if (inpaint_node_strength_handle.init) { - inpaint_node_strength_handle.value = inpaint_node_strength; + inpaint_node_strength_handle.f = inpaint_node_strength; } inpaint_node_strength = ui_slider(inpaint_node_strength_handle, tr("strength"), 0, 1, true); diff --git a/paint/sources/neural_nodes/tiling_node.ts b/paint/sources/neural_nodes/tiling_node.ts index 9f0f0606..5633bc4a 100644 --- a/paint/sources/neural_nodes/tiling_node.ts +++ b/paint/sources/neural_nodes/tiling_node.ts @@ -31,7 +31,7 @@ function tiling_node_button(node_id: i32) { if (!tiling_node_auto) { let tiling_node_strength_handle: ui_handle_t = ui_handle(__ID__); if (tiling_node_strength_handle.init) { - tiling_node_strength_handle.value = tiling_node_strength; + tiling_node_strength_handle.f = tiling_node_strength; } tiling_node_strength = ui_slider(tiling_node_strength_handle, tr("strength"), 0, 1, true); diff --git a/paint/sources/nodes_material.ts b/paint/sources/nodes_material.ts index 99ab057e..69c08bea 100644 --- a/paint/sources/nodes_material.ts +++ b/paint/sources/nodes_material.ts @@ -4368,7 +4368,7 @@ function nodes_material_vector_curves_button(node_id: i32) { ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 2, "Z"); // Preview - let axis: i32 = ui_nest(ui_nest(nhandle, 0), 1).position; + let axis: i32 = ui_nest(ui_nest(nhandle, 0), 1).i; let val: f32[] = but.default_value; ui._y += UI_LINE_H() * 5; @@ -4400,25 +4400,25 @@ function nodes_material_vector_curves_button(node_id: i32) { let ihandle: ui_handle_t = ui_nest(ui_nest(ui_nest(nhandle, 0), 2), axis); if (ihandle.init) { - ihandle.position = 0; + ihandle.i = 0; } let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, num - 1, false, 1, true, ui_align_t.LEFT)); if (i >= num || i < 0) { - ihandle.value = i = num - 1; // Stay in bounds + ihandle.f = i = num - 1; // Stay in bounds } ui_row2(); - ui_nest(ui_nest(nhandle, 0), 3).value = val[axis * 32 + i * 2 + 0]; - ui_nest(ui_nest(nhandle, 0), 4).value = val[axis * 32 + i * 2 + 1]; + ui_nest(ui_nest(nhandle, 0), 3).f = val[axis * 32 + i * 2 + 0]; + ui_nest(ui_nest(nhandle, 0), 4).f = val[axis * 32 + i * 2 + 1]; let h1: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 3); if (h1.init) { - h1.value = 0.0; + h1.f = 0.0; } let h2: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 4); if (h2.init) { - h2.value = 0.0; + h2.f = 0.0; } val[axis * 32 + i * 2 + 0] = ui_slider(h1, "X", -1, 1, true, 100, true, ui_align_t.LEFT); val[axis * 32 + i * 2 + 1] = ui_slider(h2, "Y", -1, 1, true, 100, true, ui_align_t.LEFT); @@ -4453,7 +4453,7 @@ function nodes_material_color_ramp_button(node_id: i32) { // array_push(vals, vals[vals.length - 5]); // b // array_push(vals, vals[vals.length - 5]); // a // array_push(vals, 1.0); // pos - // ihandle.value += 1; + // ihandle.f += 1; } if (ui_button("-") && vals.length > 5) { array_pop(vals); @@ -4461,12 +4461,12 @@ function nodes_material_color_ramp_button(node_id: i32) { array_pop(vals); array_pop(vals); array_pop(vals); - ihandle.value -= 1; + ihandle.f -= 1; } let h: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 1); if (h.init) { - h.position = but.data[0]; + h.i = but.data[0]; } let interpolate_combo: string[] = [tr("Linear"), tr("Constant")]; but.data[0] = ui_combo(h, interpolate_combo, tr("Interpolate")); @@ -4474,10 +4474,10 @@ function nodes_material_color_ramp_button(node_id: i32) { ui_row2(); let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, (vals.length / 5) - 1, false, 1, true, ui_align_t.LEFT)); if (i >= (vals.length * 5) || i < 0) { - ihandle.value = i = (vals.length / 5) - 1; // Stay in bounds + ihandle.f = i = (vals.length / 5) - 1; // Stay in bounds } - ui_nest(ui_nest(nhandle, 0), 3).value = vals[i * 5 + 4]; + ui_nest(ui_nest(nhandle, 0), 3).f = vals[i * 5 + 4]; vals[i * 5 + 4] = ui_slider(ui_nest(ui_nest(nhandle, 0), 3), "Pos", 0, 1, true, 100, true, ui_align_t.LEFT); if (vals[i * 5 + 4] > 1.0) { vals[i * 5 + 4] = 1.0; // Stay in bounds diff --git a/paint/sources/project.ts b/paint/sources/project.ts index a91935cb..7b92a2cb 100644 --- a/paint/sources/project.ts +++ b/paint/sources/project.ts @@ -112,13 +112,13 @@ function project_new_box() { ui_row2(); let h_project_type: ui_handle_t = ui_handle(__ID__); if (h_project_type.init) { - h_project_type.position = context_raw.project_type; + h_project_type.i = context_raw.project_type; } context_raw.project_type = ui_combo(h_project_type, project_mesh_list, tr("Template"), true); let h_project_aspect_ratio: ui_handle_t = ui_handle(__ID__); if (h_project_aspect_ratio.init) { - h_project_aspect_ratio.position = context_raw.project_aspect_ratio; + h_project_aspect_ratio.i = context_raw.project_aspect_ratio; } let project_aspect_ratio_combo: string[] = ["1:1", "2:1", "1:2"]; context_raw.project_aspect_ratio = ui_combo(h_project_aspect_ratio, project_aspect_ratio_combo, tr("Aspect Ratio"), true); @@ -242,7 +242,7 @@ function project_new(reset_layers: bool = true) { } array_push(project_materials, slot_material_create(m)); - context_raw.picker_mask_handle.position = picker_mask_t.NONE; + context_raw.picker_mask_handle.i = picker_mask_t.NONE; context_raw.material = project_materials[0]; ui_nodes_hwnd.redraws = 2; ui_nodes_group_stack = []; @@ -303,7 +303,7 @@ function project_set_default_envmap() { context_raw.envmap_loaded = false; scene_world._.envmap = context_raw.empty_envmap; scene_world.envmap = "World_radiance.k"; - context_raw.show_envmap_handle.selected = context_raw.show_envmap = false; + context_raw.show_envmap_handle.b = context_raw.show_envmap = false; scene_world._.radiance = context_raw.default_radiance; scene_world._.radiance_mipmaps = context_raw.default_radiance_mipmaps; scene_world._.irradiance = context_raw.default_irradiance; @@ -412,7 +412,7 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl if (ends_with(to_lower_case(path), ".fbx")) { let h: ui_handle_t = ui_handle(__ID__); - h.selected = context_raw.parse_vcols; + h.b = context_raw.parse_vcols; context_raw.parse_vcols = ui_check(h, tr("Parse Vertex Colors")); if (ui.is_hovered) { ui_tooltip(tr("Import vertex color data")); diff --git a/paint/sources/render_path_paint.ts b/paint/sources/render_path_paint.ts index 05b79d9c..e4953560 100644 --- a/paint/sources/render_path_paint.ts +++ b/paint/sources/render_path_paint.ts @@ -261,7 +261,7 @@ function render_path_paint_commands_paint(dilation: bool = true) { } // Read texcoords from gbuffer - let read_tc: bool = (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE) || + let read_tc: bool = (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.i == fill_type_t.FACE) || context_raw.tool == tool_type_t.CLONE || context_raw.tool == tool_type_t.BLUR || context_raw.tool == tool_type_t.SMUDGE; @@ -586,8 +586,8 @@ function render_path_paint_is_rt_bake(): bool { } function render_path_paint_update_bake_layer(bits: texture_bits_t) { - if (base_bits_handle.position != bits) { - base_bits_handle.position = bits; + if (base_bits_handle.i != bits) { + base_bits_handle.i = bits; layers_set_bits(); } } @@ -813,8 +813,8 @@ function render_path_paint_dilate(base: bool, nor_pack: bool) { layers_make_temp_img(); let tid: i32 = context_raw.layer.id; - let format: string = base_bits_handle.position == texture_bits_t.BITS8 ? "RGBA32" : - base_bits_handle.position == texture_bits_t.BITS16 ? "RGBA64" : + let format: string = base_bits_handle.i == texture_bits_t.BITS8 ? "RGBA32" : + base_bits_handle.i == texture_bits_t.BITS16 ? "RGBA64" : "RGBA128"; let copy_pass: string = format == "RGBA64" ? "copyRGBA64_pass" : diff --git a/paint/sources/slot_layer.ts b/paint/sources/slot_layer.ts index a6a32762..14d97d5e 100644 --- a/paint/sources/slot_layer.ts +++ b/paint/sources/slot_layer.ts @@ -76,8 +76,8 @@ function slot_layer_create(ext: string = "", type: layer_slot_type_t = layer_slo else if (type == layer_slot_type_t.LAYER) { let id: i32 = (raw.id + 1); raw.name = "Layer " + id; - let format: string = base_bits_handle.position == texture_bits_t.BITS8 ? "RGBA32" : - base_bits_handle.position == texture_bits_t.BITS16 ? "RGBA64" : + let format: string = base_bits_handle.i == texture_bits_t.BITS8 ? "RGBA32" : + base_bits_handle.i == texture_bits_t.BITS16 ? "RGBA64" : "RGBA128"; { @@ -359,8 +359,8 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { if (slot_layer_is_layer(raw)) { let format: tex_format_t = - base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : - base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : + base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : + base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : tex_format_t.RGBA128; let pipe: gpu_pipeline_t = format == tex_format_t.RGBA32 ? pipes_copy : diff --git a/paint/sources/tab_browser.ts b/paint/sources/tab_browser.ts index b79063e9..06ec9777 100644 --- a/paint/sources/tab_browser.ts +++ b/paint/sources/tab_browser.ts @@ -10,7 +10,7 @@ let tab_browser_refresh: bool = false; function tab_browser_show_directory(directory: string) { tab_browser_hpath.text = directory; tab_browser_hsearch.text = ""; - ui_base_htabs[tab_area_t.STATUS].position = 0; + ui_base_htabs[tab_area_t.STATUS].i = 0; } function tab_browser_draw(htab: ui_handle_t) { @@ -182,7 +182,7 @@ function tab_browser_draw(htab: ui_handle_t) { } } if (asset_index != -1) { - context_raw.colorid_handle.position = asset_index; + context_raw.colorid_handle.i = asset_index; context_raw.colorid_picked = false; ui_toolbar_handle.redraws = 1; if (context_raw.tool == tool_type_t.COLORID) { diff --git a/paint/sources/tab_layers.ts b/paint/sources/tab_layers.ts index 6c24ab37..06799e10 100644 --- a/paint/sources/tab_layers.ts +++ b/paint/sources/tab_layers.ts @@ -184,7 +184,7 @@ function tab_layers_combo_filter() { } } let filter_handle: ui_handle_t = ui_handle(__ID__); - filter_handle.position = context_raw.layer_filter; + filter_handle.i = context_raw.layer_filter; context_raw.layer_filter = ui_combo(filter_handle, ar, tr("Filter"), false, ui_align_t.LEFT); if (filter_handle.changed) { for (let i: i32 = 0; i < project_paint_objects.length; ++i) { @@ -451,7 +451,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { if (has_panel) { ui._y += center; let layer_panel: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - layer_panel.selected = l.show_panel; + layer_panel.b = l.show_panel; l.show_panel = ui_panel(layer_panel, "", true, false); ui._y -= center; } @@ -494,7 +494,7 @@ function tab_layers_combo_object(l: slot_layer_t, label: bool = false): ui_handl } } let object_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - object_handle.position = l.object_mask; + object_handle.i = l.object_mask; l.object_mask = ui_combo(object_handle, ar, tr("Object"), label, ui_align_t.LEFT); if (object_handle.changed) { context_set_layer(l); @@ -515,7 +515,7 @@ function tab_layers_combo_object(l: slot_layer_t, label: bool = false): ui_handl 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; + blending_handle.i = l.blending; let blending_combo: string[] = [ tr("Mix"), tr("Darken"), @@ -540,7 +540,7 @@ function tab_layers_combo_blending(l: slot_layer_t, label: bool = false): ui_han if (blending_handle.changed) { context_set_layer(l); history_layer_blending(); - l.blending = blending_handle.position; + l.blending = blending_handle.i; make_material_parse_mesh_material(); } return blending_handle; @@ -717,7 +717,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { if (mini) { let visible_handle: ui_handle_t = ui_handle(__ID__); - visible_handle.selected = l.visible; + visible_handle.b = l.visible; ui_check(visible_handle, tr("Visible")); if (visible_handle.changed) { tab_layers_layer_toggle_visible(l); @@ -851,13 +851,13 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_align(); let layer_opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - layer_opac_handle.value = l.mask_opacity; + layer_opac_handle.f = l.mask_opacity; ui_slider(layer_opac_handle, tr("Opacity"), 0.0, 1.0, true); if (layer_opac_handle.changed) { if (ui.input_started) { history_layer_opacity(); } - l.mask_opacity = layer_opac_handle.value; + l.mask_opacity = layer_opac_handle.f; make_material_parse_mesh_material(); ui_menu_keep_open = true; } @@ -873,8 +873,8 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { let h: ui_handle_t = ui_handle(__ID__); let changed_last: bool = h.changed; - h.value = base_res_handle.position; - base_res_handle.position = math_floor(ui_slider(h, ar[base_res_handle.position], 0, ar.length - 1, false, 1, false, ui_align_t.LEFT, false)); + h.f = base_res_handle.i; + base_res_handle.i = math_floor(ui_slider(h, ar[base_res_handle.i], 0, ar.length - 1, false, 1, false, ui_align_t.LEFT, false)); if (h.changed) { ui_menu_keep_open = true; } @@ -903,7 +903,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { if (l.fill_layer != null) { ui_menu_align(); let scale_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - scale_handle.value = l.scale; + scale_handle.f = l.scale; l.scale = ui_slider(scale_handle, tr("UV Scale"), 0.0, 5.0, true); if (scale_handle.changed) { context_set_material(l.fill_layer); @@ -916,7 +916,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_align(); let angle_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - angle_handle.value = l.angle; + angle_handle.f = l.angle; l.angle = ui_slider(angle_handle, tr("Angle"), 0.0, 360, true, 1); if (angle_handle.changed) { context_set_material(l.fill_layer); @@ -930,7 +930,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_menu_align(); let uv_type_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - uv_type_handle.position = l.uv_type; + uv_type_handle.i = l.uv_type; let uv_type_items: string[] = [tr("UV Map"), tr("Triplanar"), tr("Project")]; l.uv_type = ui_inline_radio(uv_type_handle, uv_type_items, ui_align_t.LEFT); if (uv_type_handle.changed) { @@ -956,17 +956,17 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { let height_blend_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); let emis_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); let subs_handle: ui_handle_t = ui_nest(ui_handle(__ID__), l.id); - base_handle.selected = l.paint_base; - opac_handle.selected = l.paint_opac; - nor_handle.selected = l.paint_nor; - nor_blend_handle.selected = l.paint_nor_blend; - occ_handle.selected = l.paint_occ; - rough_handle.selected = l.paint_rough; - met_handle.selected = l.paint_met; - height_handle.selected = l.paint_height; - height_blend_handle.selected = l.paint_height_blend; - emis_handle.selected = l.paint_emis; - subs_handle.selected = l.paint_subs; + base_handle.b = l.paint_base; + opac_handle.b = l.paint_opac; + nor_handle.b = l.paint_nor; + nor_blend_handle.b = l.paint_nor_blend; + occ_handle.b = l.paint_occ; + rough_handle.b = l.paint_rough; + met_handle.b = l.paint_met; + height_handle.b = l.paint_height; + height_blend_handle.b = l.paint_height_blend; + emis_handle.b = l.paint_emis; + subs_handle.b = l.paint_subs; l.paint_base = ui_check(base_handle, tr("Base Color")); l.paint_opac = ui_check(opac_handle, tr("Opacity")); l.paint_nor = ui_check(nor_handle, tr("Normal")); diff --git a/paint/sources/tab_materials.ts b/paint/sources/tab_materials.ts index c4e5f8a1..ce69dbe5 100644 --- a/paint/sources/tab_materials.ts +++ b/paint/sources/tab_materials.ts @@ -183,47 +183,47 @@ function tab_materials_draw_slots(mini: bool) { let base_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (base_handle.init) { - base_handle.selected = m.paint_base; + base_handle.b = m.paint_base; } let opac_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (opac_handle.init) { - opac_handle.selected = m.paint_opac; + opac_handle.b = m.paint_opac; } let nor_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (nor_handle.init) { - nor_handle.selected = m.paint_nor; + nor_handle.b = m.paint_nor; } let occ_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (occ_handle.init) { - occ_handle.selected = m.paint_occ; + occ_handle.b = m.paint_occ; } let rough_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (rough_handle.init) { - rough_handle.selected = m.paint_rough; + rough_handle.b = m.paint_rough; } let met_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (met_handle.init) { - met_handle.selected = m.paint_met; + met_handle.b = m.paint_met; } let height_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (height_handle.init) { - height_handle.selected = m.paint_height; + height_handle.b = m.paint_height; } let emis_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (emis_handle.init) { - emis_handle.selected = m.paint_emis; + emis_handle.b = m.paint_emis; } let subs_handle: ui_handle_t = ui_nest(ui_handle(__ID__), m.id); if (subs_handle.init) { - subs_handle.selected = m.paint_subs; + subs_handle.b = m.paint_subs; } m.paint_base = ui_check(base_handle, tr("Base Color")); diff --git a/paint/sources/tab_meshes.ts b/paint/sources/tab_meshes.ts index 7a925bf8..09fddbdc 100644 --- a/paint/sources/tab_meshes.ts +++ b/paint/sources/tab_meshes.ts @@ -108,7 +108,7 @@ function tab_meshes_draw(htab: ui_handle_t) { for (let i: i32 = 0; i < project_paint_objects.length; ++i) { let o: mesh_object_t = project_paint_objects[i]; let h: ui_handle_t = ui_handle(__ID__); - h.selected = o.base.visible; + h.b = o.base.visible; o.base.visible = ui_check(h, o.base.name); if (ui.is_hovered && ui.input_released_r) { @@ -145,7 +145,7 @@ function tab_meshes_draw(htab: ui_handle_t) { context_raw.selected_object = o.base; let h: ui_handle_t = ui_handle(__ID__); - // h.selected = context_raw.selected_object.visible; + // h.b = context_raw.selected_object.visible; // context_raw.selected_object.visible = ui_check(h, "Visible"); // if (h.changed) { // Rebuild full vb for path-tracing @@ -288,17 +288,17 @@ function tab_meshes_draw(htab: ui_handle_t) { tr("Terrain"), tr("Mesh"), ]; - hshape.position = pb != null ? pb.shape + 1 : 0; + hshape.i = pb != null ? pb.shape + 1 : 0; ui_combo(hshape, shape_combo, tr("Shape"), true); let hdynamic: ui_handle_t = ui_handle(__ID__); - hdynamic.selected = pb != null ? pb.mass > 0 : false; + hdynamic.b = pb != null ? pb.mass > 0 : false; ui_check(hdynamic, "Dynamic"); if (hshape.changed || hdynamic.changed) { sim_remove_body(context_raw.selected_object.uid); - if (hshape.position > 0) { - sim_add_body(context_raw.selected_object, hshape.position - 1, hdynamic.selected ? 1.0 : 0.0); + if (hshape.i > 0) { + sim_add_body(context_raw.selected_object, hshape.i - 1, hdynamic.b ? 1.0 : 0.0); } } @@ -438,7 +438,7 @@ function tab_scene_draw_list(list_handle: ui_handle_t, current_object: object_t) ui_row(row); let h: ui_handle_t = ui_nest(list_handle, tab_scene_line_counter); if (h.init) { - h.selected = true; + h.b = true; } b = ui_panel(h, "", true, false); ui_text(current_object.name); diff --git a/paint/sources/tab_plugins.ts b/paint/sources/tab_plugins.ts index 978dca3a..3d245bf9 100644 --- a/paint/sources/tab_plugins.ts +++ b/paint/sources/tab_plugins.ts @@ -8,7 +8,7 @@ function tab_plugins_draw(htab: ui_handle_t) { ui_row(row); if (ui_button(tr("Manager"))) { - box_preferences_htab.position = 6; // Plugins + box_preferences_htab.i = 6; // Plugins box_preferences_show(); } ui_end_sticky(); diff --git a/paint/sources/tab_swatches.ts b/paint/sources/tab_swatches.ts index 55925625..05b9ee89 100644 --- a/paint/sources/tab_swatches.ts +++ b/paint/sources/tab_swatches.ts @@ -155,19 +155,19 @@ function tab_swatches_draw(htab: ui_handle_t) { }); let hopacity: ui_handle_t = ui_handle(__ID__); - hopacity.value = context_raw.swatch.opacity; + hopacity.f = context_raw.swatch.opacity; context_raw.swatch.opacity = ui_slider(hopacity, "Opacity", 0, 1, true); let hocclusion: ui_handle_t = ui_handle(__ID__); - hocclusion.value = context_raw.swatch.occlusion; + hocclusion.f = context_raw.swatch.occlusion; context_raw.swatch.occlusion = ui_slider(hocclusion, "Occlusion", 0, 1, true); let hroughness: ui_handle_t = ui_handle(__ID__); - hroughness.value = context_raw.swatch.roughness; + hroughness.f = context_raw.swatch.roughness; context_raw.swatch.roughness = ui_slider(hroughness, "Roughness", 0, 1, true); let hmetallic: ui_handle_t = ui_handle(__ID__); - hmetallic.value = context_raw.swatch.metallic; + hmetallic.f = context_raw.swatch.metallic; context_raw.swatch.metallic = ui_slider(hmetallic, "Metallic", 0, 1, true); let hheight: ui_handle_t = ui_handle(__ID__); - hheight.value = context_raw.swatch.height; + hheight.f = context_raw.swatch.height; context_raw.swatch.height = ui_slider(hheight, "Height", 0, 1, true); if (ui.changed || ui.is_typing) { diff --git a/paint/sources/tab_textures.ts b/paint/sources/tab_textures.ts index fef1cb12..f3b0e2bf 100644 --- a/paint/sources/tab_textures.ts +++ b/paint/sources/tab_textures.ts @@ -173,7 +173,7 @@ function tab_textures_draw(htab: ui_handle_t) { } if (ui_menu_button(tr("Set as Color ID Map"))) { - context_raw.colorid_handle.position = _tab_textures_draw_i; + context_raw.colorid_handle.i = _tab_textures_draw_i; context_raw.colorid_picked = false; ui_toolbar_handle.redraws = 1; if (context_raw.tool == tool_type_t.COLORID) { @@ -248,7 +248,7 @@ function tab_textures_delete_texture(asset: asset_t) { } ui_base_hwnds[tab_area_t.STATUS].redraws = 2; - if (context_raw.tool == tool_type_t.COLORID && i == context_raw.colorid_handle.position) { + if (context_raw.tool == tool_type_t.COLORID && i == context_raw.colorid_handle.i) { ui_header_handle.redraws = 2; context_raw.ddirty = 2; context_raw.colorid_picked = false; diff --git a/paint/sources/ui_header.ts b/paint/sources/ui_header.ts index 3f741df6..f2df13d7 100644 --- a/paint/sources/ui_header.ts +++ b/paint/sources/ui_header.ts @@ -66,12 +66,12 @@ function ui_header_draw_tool_properties() { ui_files_show(string_array_join(path_texture_formats, ","), false, true, function (path: string) { import_asset_run(path, -1.0, -1.0, true, false); - context_raw.colorid_handle.position = project_asset_names.length - 1; + context_raw.colorid_handle.i = project_asset_names.length - 1; for (let i: i32 = 0; i < project_assets.length; ++i) { let a: asset_t = project_assets[i]; // Already imported if (a.file == path) { - context_raw.colorid_handle.position = array_index_of(project_assets, a); + context_raw.colorid_handle.i = array_index_of(project_assets, a); } } context_raw.ddirty = 2; @@ -91,7 +91,7 @@ function ui_header_draw_tool_properties() { gpu_set_pipeline(pipes_colorid_to_mask); let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); gpu_set_texture(pipes_texpaint_colorid, rt._image); - gpu_set_texture(pipes_tex_colorid, project_get_image(project_assets[context_raw.colorid_handle.position])); + gpu_set_texture(pipes_tex_colorid, project_get_image(project_assets[context_raw.colorid_handle.i])); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw(); @@ -160,28 +160,28 @@ function ui_header_draw_tool_properties() { ui._w = _w; let hocc: ui_handle_t = ui_handle(__ID__); - hocc.value = context_raw.picked_color.occlusion; + hocc.f = context_raw.picked_color.occlusion; ui_slider(hocc, tr("Occlusion"), 0.0, 1.0, true); let hrough: ui_handle_t = ui_handle(__ID__); - hrough.value = context_raw.picked_color.roughness; + hrough.f = context_raw.picked_color.roughness; ui_slider(hrough, tr("Roughness"), 0.0, 1.0, true); let hmet: ui_handle_t = ui_handle(__ID__); - hmet.value = context_raw.picked_color.metallic; + hmet.f = context_raw.picked_color.metallic; ui_slider(hmet, tr("Metallic"), 0.0, 1.0, true); let hheight: ui_handle_t = ui_handle(__ID__); - hheight.value = context_raw.picked_color.height; + hheight.f = context_raw.picked_color.height; ui_slider(hheight, tr("Height"), 0.0, 1.0, true); let hopac: ui_handle_t = ui_handle(__ID__); - hopac.value = context_raw.picked_color.opacity; + hopac.f = context_raw.picked_color.opacity; ui_slider(hopac, tr("Opacity"), 0.0, 1.0, true); let h_select_mat: ui_handle_t = ui_handle(__ID__); if (h_select_mat.init) { - h_select_mat.selected = context_raw.picker_select_material; + h_select_mat.b = context_raw.picker_select_material; } context_raw.picker_select_material = ui_check(h_select_mat, tr("Select Material")); let picker_mask_combo: string[] = [tr("None"), tr("Material")]; @@ -213,7 +213,7 @@ function ui_header_draw_tool_properties() { let bake_handle: ui_handle_t = ui_handle(__ID__); if (bake_handle.init) { - bake_handle.position = context_raw.bake_type; + bake_handle.i = context_raw.bake_type; } let bakes: string[] = [ tr("Curvature"), @@ -243,7 +243,7 @@ function ui_header_draw_tool_properties() { if (rt_bake) { let samples_handle: ui_handle_t = ui_handle(__ID__); if (samples_handle.init) { - samples_handle.value = context_raw.bake_samples; + samples_handle.f = context_raw.bake_samples; } context_raw.bake_samples = math_floor(ui_slider(samples_handle, tr("Samples"), 1, 512, true, 1)); } @@ -254,7 +254,7 @@ function ui_header_draw_tool_properties() { ) { let bake_up_axis_handle: ui_handle_t = ui_handle(__ID__); if (bake_up_axis_handle.init) { - bake_up_axis_handle.position = context_raw.bake_up_axis; + bake_up_axis_handle.i = context_raw.bake_up_axis; } let bake_up_axis_combo: string[] = [tr("Z"), tr("Y")]; context_raw.bake_up_axis = ui_combo(bake_up_axis_handle, bake_up_axis_combo, tr("Up Axis"), true); @@ -262,7 +262,7 @@ function ui_header_draw_tool_properties() { if (context_raw.bake_type == bake_type_t.AO || context_raw.bake_type == bake_type_t.CURVATURE) { let bake_axis_handle: ui_handle_t = ui_handle(__ID__); if (bake_axis_handle.init) { - bake_axis_handle.position = context_raw.bake_axis; + bake_axis_handle.i = context_raw.bake_axis; } let bake_axis_combo: string[] = [tr("XYZ"), tr("X"), tr("Y"), tr("Z"), tr("-X"), tr("-Y"), tr("-Z")]; context_raw.bake_axis = ui_combo(bake_axis_handle, bake_axis_combo, tr("Axis"), true); @@ -270,17 +270,17 @@ function ui_header_draw_tool_properties() { if (context_raw.bake_type == bake_type_t.AO) { let strength_handle: ui_handle_t = ui_handle(__ID__); if (strength_handle.init) { - strength_handle.value = context_raw.bake_ao_strength; + strength_handle.f = context_raw.bake_ao_strength; } context_raw.bake_ao_strength = ui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); let radius_handle: ui_handle_t = ui_handle(__ID__); if (radius_handle.init) { - radius_handle.value = context_raw.bake_ao_radius; + radius_handle.f = context_raw.bake_ao_radius; } context_raw.bake_ao_radius = ui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); let offset_handle: ui_handle_t = ui_handle(__ID__); if (offset_handle.init) { - offset_handle.value = context_raw.bake_ao_offset; + offset_handle.f = context_raw.bake_ao_offset; } context_raw.bake_ao_offset = ui_slider(offset_handle, tr("Offset"), 0.0, 2.0, true); } @@ -300,22 +300,22 @@ function ui_header_draw_tool_properties() { if (context_raw.bake_type == bake_type_t.CURVATURE) { let strength_handle: ui_handle_t = ui_handle(__ID__); if (strength_handle.init) { - strength_handle.value = context_raw.bake_curv_strength; + strength_handle.f = context_raw.bake_curv_strength; } context_raw.bake_curv_strength = ui_slider(strength_handle, tr("Strength"), 0.0, 2.0, true); let radius_handle: ui_handle_t = ui_handle(__ID__); if (radius_handle.init) { - radius_handle.value = context_raw.bake_curv_radius; + radius_handle.f = context_raw.bake_curv_radius; } context_raw.bake_curv_radius = ui_slider(radius_handle, tr("Radius"), 0.0, 2.0, true); let offset_handle: ui_handle_t = ui_handle(__ID__); if (offset_handle.init) { - offset_handle.value = context_raw.bake_curv_offset; + offset_handle.f = context_raw.bake_curv_offset; } context_raw.bake_curv_offset = ui_slider(offset_handle, tr("Offset"), -2.0, 2.0, true); let smooth_handle: ui_handle_t = ui_handle(__ID__); if (smooth_handle.init) { - smooth_handle.value = context_raw.bake_curv_smooth; + smooth_handle.f = context_raw.bake_curv_smooth; } context_raw.bake_curv_smooth = math_floor(ui_slider(smooth_handle, tr("Smooth"), 0, 5, false, 1)); } @@ -327,7 +327,7 @@ function ui_header_draw_tool_properties() { } let poly_handle: ui_handle_t = ui_handle(__ID__); if (poly_handle.init) { - poly_handle.position = context_raw.bake_high_poly; + poly_handle.i = context_raw.bake_high_poly; } context_raw.bake_high_poly = ui_combo(poly_handle, ar, tr("High Poly")); } @@ -380,7 +380,7 @@ function ui_header_draw_tool_properties() { context_raw.tool == tool_type_t.TEXT) { let brush_scale_handle: ui_handle_t = ui_handle(__ID__); if (brush_scale_handle.init) { - brush_scale_handle.value = context_raw.brush_scale; + brush_scale_handle.f = context_raw.brush_scale; } context_raw.brush_scale = ui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); if (brush_scale_handle.changed) { @@ -414,7 +414,7 @@ function ui_header_draw_tool_properties() { if (context_raw.tool == tool_type_t.BRUSH || context_raw.tool == tool_type_t.ERASER || context_raw.tool == tool_type_t.CLONE || decal_mask) { let h: ui_handle_t = ui_handle(__ID__); if (h.init) { - h.value = context_raw.brush_hardness; + h.f = context_raw.brush_hardness; } context_raw.brush_hardness = ui_slider(h, tr("Hardness"), 0.0, 1.0, true); } @@ -422,7 +422,7 @@ function ui_header_draw_tool_properties() { if (context_raw.tool != tool_type_t.ERASER) { let brush_blending_handle: ui_handle_t = ui_handle(__ID__); if (brush_blending_handle.init) { - brush_blending_handle.value = context_raw.brush_blending; + brush_blending_handle.f = context_raw.brush_blending; } let brush_blending_combo: string[] = [ tr("Mix"), @@ -482,13 +482,13 @@ function ui_header_draw_tool_properties() { let fill_mode_combo: string[] = [tr("Object"), tr("Face"), tr("Angle"), tr("UV Island")]; ui_combo(context_raw.fill_type_handle, fill_mode_combo, tr("Fill Mode")); if (context_raw.fill_type_handle.changed) { - if (context_raw.fill_type_handle.position == fill_type_t.FACE) { + if (context_raw.fill_type_handle.i == fill_type_t.FACE) { let current: gpu_texture_t = _draw_current; draw_end(); // cache_uv_map(); util_uv_cache_triangle_map(); draw_begin(current); - // wireframe_handle.selected = draw_wireframe = true; + // wireframe_handle.b = draw_wireframe = true; } make_material_parse_paint_material(); make_material_parse_mesh_material(); @@ -505,7 +505,7 @@ function ui_header_draw_tool_properties() { let xray_handle: ui_handle_t = ui_handle(__ID__); if (xray_handle.init) { - xray_handle.selected = context_raw.xray; + xray_handle.b = context_raw.xray; } context_raw.xray = ui_check(xray_handle, tr("X-Ray")); if (xray_handle.changed) { @@ -514,15 +514,15 @@ function ui_header_draw_tool_properties() { let sym_x_handle: ui_handle_t = ui_handle(__ID__); if (sym_x_handle.init) { - sym_x_handle.selected = false; + sym_x_handle.b = false; } let sym_y_handle: ui_handle_t = ui_handle(__ID__); if (sym_y_handle.init) { - sym_y_handle.selected = false; + sym_y_handle.b = false; } let sym_z_handle: ui_handle_t = ui_handle(__ID__); if (sym_z_handle.init) { - sym_z_handle.selected = false; + sym_z_handle.b = false; } if (config_raw.layout[layout_size_t.HEADER] == 1) { diff --git a/paint/sources/ui_menubar.ts b/paint/sources/ui_menubar.ts index 4756e3e5..1a407339 100644 --- a/paint/sources/ui_menubar.ts +++ b/paint/sources/ui_menubar.ts @@ -161,7 +161,7 @@ function ui_menubar_draw_tab_header() { let b: bool = ui_tab(ui_menubar_tab, base_view3d_show ? ">" : "<", false, -2); if ((a && !base_view3d_show) || b) { base_view3d_show = !base_view3d_show; - ui_menubar_tab.position = base_view3d_show ? 0 : -1; + ui_menubar_tab.i = base_view3d_show ? 0 : -1; base_resize(); } } @@ -287,7 +287,7 @@ function ui_menubar_draw_category_items() { let p: world_data_t = scene_world; let env_handle: ui_handle_t = ui_handle(__ID__); - env_handle.value = p.strength; + env_handle.f = p.strength; ui_menu_align(); p.strength = ui_slider(env_handle, tr("Environment"), 0.0, 8.0, true); if (env_handle.changed) { @@ -295,12 +295,12 @@ function ui_menubar_draw_category_items() { } let enva_handle: ui_handle_t = ui_handle(__ID__); - enva_handle.value = context_raw.envmap_angle / math_pi() * 180.0; - if (enva_handle.value < 0) { - enva_handle.value += (math_floor(-enva_handle.value / 360) + 1) * 360; + enva_handle.f = context_raw.envmap_angle / math_pi() * 180.0; + if (enva_handle.f < 0) { + enva_handle.f += (math_floor(-enva_handle.f / 360) + 1) * 360; } - else if (enva_handle.value > 360) { - enva_handle.value -= math_floor(enva_handle.value / 360) * 360; + else if (enva_handle.f > 360) { + enva_handle.f -= math_floor(enva_handle.f / 360) * 360; } ui_menu_align(); context_raw.envmap_angle = ui_slider(enva_handle, tr("Environment Angle"), 0.0, 360.0, true, 1) / 180.0 * math_pi(); @@ -315,7 +315,7 @@ function ui_menubar_draw_category_items() { let split_view_handle: ui_handle_t = ui_handle(__ID__); if (split_view_handle.init) { - split_view_handle.selected = context_raw.split_view; + split_view_handle.b = context_raw.split_view; } context_raw.split_view = ui_check(split_view_handle, " " + tr("Split View")); if (split_view_handle.changed) { @@ -324,7 +324,7 @@ function ui_menubar_draw_category_items() { let cull_handle: ui_handle_t = ui_handle(__ID__); if (cull_handle.init) { - cull_handle.selected = context_raw.cull_backfaces; + cull_handle.b = context_raw.cull_backfaces; } context_raw.cull_backfaces = ui_check(cull_handle, " " + tr("Cull Backfaces")); if (cull_handle.changed) { @@ -333,7 +333,7 @@ function ui_menubar_draw_category_items() { let filter_handle: ui_handle_t = ui_handle(__ID__); if (filter_handle.init) { - filter_handle.selected = context_raw.texture_filter; + filter_handle.b = context_raw.texture_filter; } context_raw.texture_filter = ui_check(filter_handle, " " + tr("Filter Textures")); if (filter_handle.changed) { @@ -356,14 +356,14 @@ function ui_menubar_draw_category_items() { let compass_handle: ui_handle_t = ui_handle(__ID__); if (compass_handle.init) { - compass_handle.selected = context_raw.show_compass; + compass_handle.b = context_raw.show_compass; } context_raw.show_compass = ui_check(compass_handle, " " + tr("Compass")); if (compass_handle.changed) { context_raw.ddirty = 2; } - context_raw.show_envmap_handle.selected = context_raw.show_envmap; + context_raw.show_envmap_handle.b = context_raw.show_envmap; context_raw.show_envmap = ui_check(context_raw.show_envmap_handle, " " + tr("Envmap")); if (context_raw.show_envmap_handle.changed) { context_load_envmap(); @@ -387,7 +387,7 @@ function ui_menubar_draw_category_items() { } else if (ui_menubar_category == menubar_category_t.MODE) { let mode_handle: ui_handle_t = ui_handle(__ID__); - mode_handle.position = context_raw.viewport_mode; + mode_handle.i = context_raw.viewport_mode; let modes: string[] = [ tr("Lit"), tr("Base Color"), @@ -418,7 +418,7 @@ function ui_menubar_draw_category_items() { } if (mode_handle.changed) { - context_set_viewport_mode(mode_handle.position); + context_set_viewport_mode(mode_handle.i); ui_menu_keep_open = true; } } @@ -475,7 +475,7 @@ function ui_menubar_draw_category_items() { let cam: camera_object_t = scene_camera; context_raw.fov_handle = ui_handle(__ID__); if (context_raw.fov_handle.init) { - context_raw.fov_handle.value = math_floor(cam.data.fov * 100) / 100; + context_raw.fov_handle.f = math_floor(cam.data.fov * 100) / 100; } ui_menu_align(); cam.data.fov = ui_slider(context_raw.fov_handle, tr("FoV"), 0.3, 1.4, true); @@ -485,7 +485,7 @@ function ui_menubar_draw_category_items() { ui_menu_align(); let camera_controls_handle: ui_handle_t = ui_handle(__ID__); - camera_controls_handle.position = context_raw.camera_controls; + camera_controls_handle.i = context_raw.camera_controls; let camera_controls_items: string[] = [tr("Orbit"), tr("Rotate"), tr("Fly")]; context_raw.camera_controls = ui_inline_radio(camera_controls_handle, camera_controls_items, ui_align_t.LEFT); diff --git a/paint/sources/ui_nodes.ts b/paint/sources/ui_nodes.ts index 9fefe3bf..4df66e5c 100644 --- a/paint/sources/ui_nodes.ts +++ b/paint/sources/ui_nodes.ts @@ -145,20 +145,20 @@ function ui_viewnodes_on_socket_released(socket_id: i32) { let node: ui_node_t = _ui_nodes_on_socket_released_node; if (ui_menu_button(tr("Edit"))) { - _ui_nodes_htype.position = socket.type == "RGBA" ? 0 : socket.type == "VECTOR" ? 1 : 2; + _ui_nodes_htype.i = socket.type == "RGBA" ? 0 : socket.type == "VECTOR" ? 1 : 2; _ui_nodes_hname.text = socket.name; - _ui_nodes_hmin.value = socket.min; - _ui_nodes_hmax.value = socket.max; + _ui_nodes_hmin.f = socket.min; + _ui_nodes_hmax.f = socket.max; if (socket.type == "RGBA" || socket.type == "VECTOR") { - _ui_nodes_hval0.value = socket.default_value[0]; - _ui_nodes_hval1.value = socket.default_value[1]; - _ui_nodes_hval2.value = socket.default_value[2]; + _ui_nodes_hval0.f = socket.default_value[0]; + _ui_nodes_hval1.f = socket.default_value[1]; + _ui_nodes_hval2.f = socket.default_value[2]; if (socket.type == "RGBA") { - _ui_nodes_hval3.value = socket.default_value[3]; + _ui_nodes_hval3.f = socket.default_value[3]; } } else { - _ui_nodes_hval0.value = socket.default_value[0]; + _ui_nodes_hval0.f = socket.default_value[0]; } sys_notify_on_next_frame(function () { @@ -186,15 +186,15 @@ function ui_viewnodes_on_socket_released(socket_id: i32) { ui_float_input(_ui_nodes_hval2, tr("B")); ui_float_input(_ui_nodes_hval3, tr("A")); default_value = f32_array_create_xyzw( - _ui_nodes_hval0.value, _ui_nodes_hval1.value, _ui_nodes_hval2.value, _ui_nodes_hval3.value); + _ui_nodes_hval0.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f, _ui_nodes_hval3.f); } else if (type == 1) { ui_row3(); - _ui_nodes_hval0.value = ui_float_input(_ui_nodes_hval0, tr("X")); - _ui_nodes_hval1.value = ui_float_input(_ui_nodes_hval1, tr("Y")); - _ui_nodes_hval2.value = ui_float_input(_ui_nodes_hval2, tr("Z")); + _ui_nodes_hval0.f = ui_float_input(_ui_nodes_hval0, tr("X")); + _ui_nodes_hval1.f = ui_float_input(_ui_nodes_hval1, tr("Y")); + _ui_nodes_hval2.f = ui_float_input(_ui_nodes_hval2, tr("Z")); default_value = f32_array_create_xyz( - _ui_nodes_hval0.value, _ui_nodes_hval1.value, _ui_nodes_hval2.value); + _ui_nodes_hval0.f, _ui_nodes_hval1.f, _ui_nodes_hval2.f); } else { let f: f32 = ui_float_input(_ui_nodes_hval0, tr("default_value")); @@ -447,13 +447,13 @@ function ui_nodes_get_zoom_delta(): f32 { } function ui_nodes_is_tab_selected(): bool { - return ui_nodes_htab.position > 0 && - ui_nodes_htab.position % 2 == 1 && // [tab0, tab1, x, tab2, x, +] - ui_nodes_tabs.length >= ui_nodes_htab.position / 2; + return ui_nodes_htab.i > 0 && + ui_nodes_htab.i % 2 == 1 && // [tab0, tab1, x, tab2, x, +] + ui_nodes_tabs.length >= ui_nodes_htab.i / 2; } function ui_nodes_tab_index(): i32 { - return (int)(ui_nodes_htab.position / 2); + return (int)(ui_nodes_htab.i / 2); } function ui_nodes_get_canvas(groups: bool = false): ui_node_canvas_t { @@ -872,7 +872,7 @@ function ui_nodes_render() { ui_tab(ui_nodes_htab, ui_nodes_tabs[i].canvas.name); if (ui_tab(ui_nodes_htab, tr("x"))) { array_splice(ui_nodes_tabs, i, 1); - ui_nodes_htab.position = 0; + ui_nodes_htab.i = 0; } } diff --git a/paint/sources/ui_sidebar.ts b/paint/sources/ui_sidebar.ts index f26dafde..59116865 100644 --- a/paint/sources/ui_sidebar.ts +++ b/paint/sources/ui_sidebar.ts @@ -54,13 +54,13 @@ function ui_sidebar_render_ui() { tabs[i].f(ui_base_htabs[tab_area_t.SIDEBAR0]); } - if (ui_base_htabs[tab_area_t.SIDEBAR0].position < tabs.length) { - ui_sidebar_last_tab = ui_base_htabs[tab_area_t.SIDEBAR0].position; + if (ui_base_htabs[tab_area_t.SIDEBAR0].i < tabs.length) { + ui_sidebar_last_tab = ui_base_htabs[tab_area_t.SIDEBAR0].i; } if (!config_raw.touch_ui) { if (ui_tab(ui_base_htabs[tab_area_t.SIDEBAR0], ">", false, -2)) { - ui_base_htabs[tab_area_t.SIDEBAR0].position = ui_sidebar_last_tab; + ui_base_htabs[tab_area_t.SIDEBAR0].i = ui_sidebar_last_tab; config_raw.layout_tabs[tab_area_t.SIDEBAR0] = ui_sidebar_last_tab; context_raw.maximized_sidebar_width = config_raw.layout[layout_size_t.SIDEBAR_W]; config_raw.layout[layout_size_t.SIDEBAR_W] = 0; diff --git a/paint/sources/ui_statusbar.ts b/paint/sources/ui_statusbar.ts index 42932aa1..dd695ddc 100644 --- a/paint/sources/ui_statusbar.ts +++ b/paint/sources/ui_statusbar.ts @@ -28,23 +28,23 @@ function ui_statusbar_render_ui() { draw.f(htab); } - if (ui_base_htabs[tab_area_t.STATUS].position < hwnd_draws.length) { - ui_statusbar_last_tab = ui_base_htabs[tab_area_t.STATUS].position; + if (ui_base_htabs[tab_area_t.STATUS].i < hwnd_draws.length) { + ui_statusbar_last_tab = ui_base_htabs[tab_area_t.STATUS].i; } if (!config_raw.touch_ui) { let minimized: bool = config_raw.layout[layout_size_t.STATUS_H] <= (ui_statusbar_default_h * config_raw.window_scale); if (ui_tab(ui_base_htabs[tab_area_t.STATUS], minimized ? "<" : ">", false, -2)) { - ui_base_htabs[tab_area_t.STATUS].position = ui_statusbar_last_tab; + ui_base_htabs[tab_area_t.STATUS].i = ui_statusbar_last_tab; config_raw.layout_tabs[tab_area_t.STATUS] = ui_statusbar_last_tab; } } let minimized: bool = statush <= ui_statusbar_default_h * config_raw.window_scale; - if (htab.changed && (htab.position == context_raw.last_status_position || minimized)) { + if (htab.changed && (htab.i == context_raw.last_status_position || minimized)) { ui_base_toggle_browser(); } - context_raw.last_status_position = htab.position; + context_raw.last_status_position = htab.i; } } diff --git a/paint/sources/ui_view2d.ts b/paint/sources/ui_view2d.ts index edbe5a5f..143c93d3 100644 --- a/paint/sources/ui_view2d.ts +++ b/paint/sources/ui_view2d.ts @@ -112,7 +112,7 @@ function ui_view2d_render() { ui_tab(ui_view2d_htab, tr("2D View"), false, -1, !base_view3d_show); if (ui_tab(ui_view2d_htab, tr("+"))) { - ui_view2d_htab.position = 0; + ui_view2d_htab.i = 0; } // Grid @@ -296,7 +296,7 @@ function ui_view2d_render() { if (ui_view2d_type == view_2d_type_t.LAYER) { let h_layer_mode: ui_handle_t = ui_handle(__ID__); if (h_layer_mode.init) { - h_layer_mode.position = ui_view2d_layer_mode; + h_layer_mode.i = ui_view2d_layer_mode; } let layer_mode_combo: string[] = [tr("Visible"), tr("Selected")]; ui_view2d_layer_mode = ui_combo(h_layer_mode, layer_mode_combo, tr("Layers")); @@ -306,7 +306,7 @@ function ui_view2d_render() { if (!slot_layer_is_mask(context_raw.layer)) { let h_tex_type: ui_handle_t = ui_handle(__ID__); if (h_tex_type.init) { - h_tex_type.position = ui_view2d_tex_type; + h_tex_type.i = ui_view2d_tex_type; } let tex_type_combo: string[] = [ tr("Base Color"), @@ -325,7 +325,7 @@ function ui_view2d_render() { 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; + h_uvmap_show.b = ui_view2d_uvmap_show; } ui_view2d_uvmap_show = ui_check(h_uvmap_show, tr("UV Map")); ui._x += ew * 0.7 + 3; @@ -334,7 +334,7 @@ function ui_view2d_render() { let h_tiled_show: ui_handle_t = ui_handle(__ID__); if (h_tiled_show.init) { - h_tiled_show.selected = ui_view2d_tiled_show; + h_tiled_show.b = ui_view2d_tiled_show; } ui_view2d_tiled_show = ui_check(h_tiled_show, tr("Tiled")); ui._x += ew * 0.7 + 3; diff --git a/paint/sources/uniforms_ext.ts b/paint/sources/uniforms_ext.ts index ecbcef53..678e0f89 100644 --- a/paint/sources/uniforms_ext.ts +++ b/paint/sources/uniforms_ext.ts @@ -328,7 +328,7 @@ function uniforms_ext_tex_link(object: object_t, mat: material_data_t, link: str return rt._image; } else { - return project_get_image(project_assets[context_raw.colorid_handle.position]); + return project_get_image(project_assets[context_raw.colorid_handle.i]); } } else if (link == "_textexttool") { // Opacity map for text diff --git a/paint/sources/viewport.ts b/paint/sources/viewport.ts index 60136b12..b69f801c 100644 --- a/paint/sources/viewport.ts +++ b/paint/sources/viewport.ts @@ -26,9 +26,9 @@ function viewport_reset() { cam.base.transform.local = mat4_from_f32_array(o.transform); transform_decompose(cam.base.transform); if (context_raw.fov_handle != null) { - context_raw.fov_handle.value = cam.data.fov = base_default_fov; + context_raw.fov_handle.f = cam.data.fov = base_default_fov; } - context_raw.cam_handle.position = 0; + context_raw.cam_handle.i = 0; cam.data.ortho = null; camera_object_build_proj(cam); context_raw.ddirty = 2;