From be111dc3141d5aacf91e632eca995b5b490396ea Mon Sep 17 00:00:00 2001 From: Tanasart Date: Wed, 1 May 2024 08:40:54 +0700 Subject: [PATCH] ui --- .../o_dialog_color_picker.yy.backup0 | 34 ++ .../color_selector/color_selector.gml.backup0 | 363 ++++++++++++++++++ .../color_selector/color_selector.gml.backup1 | 363 ++++++++++++++++++ #backups/scripts/globals/globals.gml.backup0 | 6 +- #backups/scripts/globals/globals.gml.backup1 | 6 +- .../node_color_hsv/node_color_hsv.gml.backup0 | 87 +++++ .../node_color_hsv/node_color_hsv.gml.backup1 | 87 +++++ .../scripts/node_math/node_math.gml.backup0 | 247 ++++++++++++ scripts/color_selector/color_selector.gml | 8 +- scripts/globals/globals.gml | 4 +- scripts/node_color_hsv/node_color_hsv.gml | 7 +- scripts/node_math/node_math.gml | 30 +- 12 files changed, 1213 insertions(+), 29 deletions(-) create mode 100644 #backups/objects/o_dialog_color_picker/o_dialog_color_picker.yy.backup0 create mode 100644 #backups/scripts/color_selector/color_selector.gml.backup0 create mode 100644 #backups/scripts/color_selector/color_selector.gml.backup1 create mode 100644 #backups/scripts/node_color_hsv/node_color_hsv.gml.backup0 create mode 100644 #backups/scripts/node_color_hsv/node_color_hsv.gml.backup1 create mode 100644 #backups/scripts/node_math/node_math.gml.backup0 diff --git a/#backups/objects/o_dialog_color_picker/o_dialog_color_picker.yy.backup0 b/#backups/objects/o_dialog_color_picker/o_dialog_color_picker.yy.backup0 new file mode 100644 index 000000000..1e6e12451 --- /dev/null +++ b/#backups/objects/o_dialog_color_picker/o_dialog_color_picker.yy.backup0 @@ -0,0 +1,34 @@ +// 2024-05-01 08:40:45 +#event properties (no comments/etc. here are saved) +parent_index = -1; +uses_physics = false; + +#event create Insert description here +onApply = noone; +def_c = noone; +cur_c = c_black; + +depth = -32000; + +#event draw_gui Insert description here +MOUSE_BLOCK = true; + +var dx = mouse_mx + ui(36); +var dy = mouse_my + ui(36); +draw_sprite_stretched(THEME.color_picker_sample, 0, dx - ui(20), dy - ui(20), ui(40), ui(40)); +draw_sprite_stretched_ext(THEME.color_picker_sample, 0, dx - ui(18), dy - ui(18), ui(36), ui(36), cur_c, 1); + +#event draw_gui_end Insert description here +cur_c = int64(cola(draw_getpixel(mouse_mx, mouse_my))); + +MOUSE_BLOCK = true; + +if(mouse_check_button_pressed(mb_right) || keyboard_check_released(ALT)) { + if(def_c != noone) onApply(def_c); + instance_destroy(); +} + +if(mouse_check_button_pressed(mb_left)) { + onApply(cur_c); + instance_destroy(); +} \ No newline at end of file diff --git a/#backups/scripts/color_selector/color_selector.gml.backup0 b/#backups/scripts/color_selector/color_selector.gml.backup0 new file mode 100644 index 000000000..524b92041 --- /dev/null +++ b/#backups/scripts/color_selector/color_selector.gml.backup0 @@ -0,0 +1,363 @@ +// 2024-05-01 08:40:49 +function colorSelector(onApply = noone) constructor { + self.onApply = onApply; + + current_color = c_white; + + hue = 1; + sat = 0; + val = 0; + + area_dragging = false; + side_dragging = false; + + dropper_active = false; + dropper_close = true; + dropper_color = c_white; + interactable = true; + + disp_mode = 0; + + palette = []; + discretize_pal = true; + + color_surface = surface_create_valid(ui(256), ui(256)); + + tb_hue = slider(0, 255, 1, function(_val) { + if(!interactable) return; + hue = clamp(_val, 0, 255); + setHSV(); + }); + + tb_sat = slider(0, 255, 1, function(_val) { + if(!interactable) return; + sat = clamp(_val, 0, 255); + setHSV(); + }); + + tb_val= slider(0, 255, 1, function(_val) { + if(!interactable) return; + val = clamp(_val, 0, 255); + setHSV(); + }); + + tb_red = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = clamp(_val, 0, 255); + var g = color_get_green(current_color); + var b = color_get_blue(current_color); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_green = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = color_get_red(current_color); + var g = clamp(_val, 0, 255); + var b = color_get_blue(current_color); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_blue = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = color_get_red(current_color); + var g = color_get_green(current_color); + var b = clamp(_val, 0, 255); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_alpha = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var alp = clamp(_val, 0, 255); + + current_color = _cola(current_color, alp); + resetHSV(); + }); + + tb_hue.hdw = ui(16); + tb_sat.hdw = ui(16); + tb_val.hdw = ui(16); + tb_red.hdw = ui(16); + tb_green.hdw = ui(16); + tb_blue.hdw = ui(16); + tb_alpha.hdw = ui(16); + + tb_hue.font = f_p1; + tb_sat.font = f_p1; + tb_val.font = f_p1; + tb_red.font = f_p1; + tb_green.font = f_p1; + tb_blue.font = f_p1; + tb_alpha.font = f_p1; + + tb_hex = new textBox(TEXTBOX_INPUT.text, function(str) { + if(!interactable) return; + if(str == "") return; + if(string_char_at(str, 1) == "#") str = string_replace(str, "#", ""); + + var _r = string_hexadecimal(string_copy(str, 1, 2)); + var _g = string_hexadecimal(string_copy(str, 3, 2)); + var _b = string_hexadecimal(string_copy(str, 5, 2)); + var _a = string_length(str) > 6? string_hexadecimal(string_copy(str, 7, 2)) : 255; + + current_color = make_color_rgba(_r, _g, _b, _a); + resetHSV(); + }); + + scr_disp = new buttonGroup(["Hue", "Value"], function(mode) { disp_mode = mode; } ); + + function resetHSV(_apply = true) { + hue = round(color_get_hue(current_color)); + sat = round(color_get_saturation(current_color)); + val = round(color_get_value(current_color)); + + if(_apply && onApply != noone) onApply(int64(current_color)); + } + + function setHSV(_apply = true) { + if(!interactable) return; + var alp = color_get_alpha(current_color); + current_color = make_color_hsva(hue, sat, val, alp); + + if(_apply && onApply != noone) onApply(int64(current_color)); + } + + function setColor(color, _apply = true) { + current_color = color; + + resetHSV(_apply); + } + + function colorPicker() { + if(!dropper_active) return; + dropper_color = int64(cola(draw_getpixel(mouse_mx, mouse_my))); + MOUSE_BLOCK = true; + } + + static drawDropper = function(instance) { + if(mouse_check_button_pressed(mb_left)) { + setColor(dropper_color); + if(dropper_close) + instance_destroy(instance); + dropper_active = false; + MOUSE_BLOCK = true; + + return; + } + + if(dropper_active && mouse_check_button_pressed(mb_right)) + instance_destroy(instance); + if(keyboard_check_released(vk_alt)) + instance_destroy(instance); + + var dx = mouse_mx + ui(36); + var dy = mouse_my + ui(36); + draw_sprite_stretched(THEME.color_picker_sample, 0, dx - ui(20), dy - ui(20), ui(40), ui(40)); + draw_sprite_stretched_ext(THEME.color_picker_sample, 0, dx - ui(18), dy - ui(18), ui(36), ui(36), dropper_color, 1); + } + + static draw = function(_x, _y, focus, hover) { + var col_x = _x + ui(8); + var col_y = _y + ui(8); + + draw_sprite_stretched(THEME.ui_panel_bg, 1, col_x - ui(8), col_y - ui(8), ui(256 + 16), ui(256 + 16)); + + color_surface = surface_verify(color_surface, ui(256), ui(256)); + surface_set_target(color_surface); + if(disp_mode == 0) { + shader_set(sh_color_picker_hue); + shader_set_f("hue", hue / 256); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + } else if(disp_mode == 1) { + shader_set(sh_color_picker_value); + shader_set_f("value", val / 256); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + } + + draw_sprite_uniform(s_fx_pixel, 0, 0, 0, ui(256)); + shader_reset(); + surface_reset_target(); + + draw_surface_ext_safe(color_surface, col_x, col_y,,,,, interactable * 0.5 + 0.5); + + #region side control + var hue_x = col_x + ui(280); + var hue_y = col_y; + + draw_sprite_stretched(THEME.ui_panel_bg, 1, hue_x - ui(8), hue_y - ui(8), ui(32), ui(256 + 16)); + + if(disp_mode == 0) { + shader_set(sh_color_picker_side_hue); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + shader_set_f("sat", sat / 256); + shader_set_f("value", val / 256); + + draw_sprite_stretched_ext(s_fx_pixel, 0, hue_x, hue_y, ui(16), ui(256), c_white, interactable * 0.5 + 0.5); + shader_reset(); + } else if(disp_mode == 1) { + shader_set(sh_color_picker_side_value); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + shader_set_f("hue", hue / 256); + shader_set_f("sat", sat / 256); + + draw_sprite_stretched_ext(s_fx_pixel, 0, hue_x, hue_y, ui(16), ui(256), c_white, interactable * 0.5 + 0.5) + shader_reset(); + } + + var _sy = disp_mode == 0? hue_y + ui(hue) : hue_y + ui(256 - val); + + if(NODE_COLOR_SHOW_PALETTE) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), current_color, 1); + + if(disp_mode == 0) + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(sat - 6), col_y + ui(256 - val - 6), ui(12), ui(12), current_color, 1); + else if(disp_mode == 1) + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(hue - 6), col_y + ui(256 - sat - 6), ui(12), ui(12), current_color, 1); + } else { + if(disp_mode == 0) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), make_color_hsv(hue, 255, 255), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(sat - 6), col_y + ui(256 - val - 6), ui(12), ui(12), current_color, 1); + } else if(disp_mode == 1) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), make_color_hsv(hue, 255, val), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(hue - 6), col_y + ui(256 - sat - 6), ui(12), ui(12), current_color, 1); + } + } + + if(mouse_press(mb_left, interactable && focus)) { + if(point_in_rectangle(mouse_mx, mouse_my, hue_x, hue_y, hue_x + ui(16), hue_y + ui(256))) + side_dragging = true; + else if(point_in_rectangle(mouse_mx, mouse_my, col_x, col_y, col_x + ui(256), col_y + ui(256))) + area_dragging = true; + } + + if(side_dragging) { + if(disp_mode == 0) { + hue = clamp((mouse_my - hue_y) / UI_SCALE, 0, 256); + } else if(disp_mode == 1) { + val = 256 - clamp((mouse_my - hue_y) / UI_SCALE, 0, 256); + } + + setHSV(); + + if(NODE_COLOR_SHOW_PALETTE) { + current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) : + surface_getpixel(color_surface, hue, 256 - sat); + if(onApply != noone) onApply(current_color); + } + + if(mouse_release(mb_left)) + side_dragging = false; + } + + if(area_dragging) { + if(disp_mode == 0) { + sat = clamp((mouse_mx - col_x) / UI_SCALE, 0, 256); + val = 256 - clamp((mouse_my - col_y) / UI_SCALE, 0, 256); + } else if(disp_mode == 1) { + hue = clamp((mouse_mx - col_x) / UI_SCALE, 0, 256); + sat = 256 - clamp((mouse_my - col_y) / UI_SCALE, 0, 256); + } + + setHSV(); + + if(NODE_COLOR_SHOW_PALETTE) { + current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) : + surface_getpixel(color_surface, hue, 256 - sat); + if(onApply != noone) onApply(current_color); + } + + if(mouse_release(mb_left)) + area_dragging = false; + } + #endregion + + #region type + var tx = hue_x + ui(36); + var ty = _y + ui(4); + + scr_disp.setFocusHover(focus, hover); + scr_disp.draw(tx, ty, ui(190), ui(32), disp_mode, mouse_ui); + #endregion + + #region register + scr_disp.register(); + + tb_hue.register(); + tb_sat.register(); + tb_val.register(); + + tb_red.register(); + tb_green.register(); + tb_blue.register(); + + tb_hex.register(); + #endregion + + #region data + var data_x = hue_x + ui(40); + var data_y = col_y + ui(40); + var wdw = ui(160); + var wdh = ui( 27); + var txh = wdh + ui(4); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); + draw_text(data_x, data_y + txh * 0 + ui(15), "H"); + draw_text(data_x, data_y + txh * 1 + ui(15), "S") + draw_text(data_x, data_y + txh * 2 + ui(15), "V"); + + tb_hue.setFocusHover(focus, hover); + tb_sat.setFocusHover(focus, hover); + tb_val.setFocusHover(focus, hover); + + tb_hue.draw(data_x + ui(28), data_y + txh * 0, wdw, wdh, round(color_get_hue(current_color)), mouse_ui); + tb_sat.draw(data_x + ui(28), data_y + txh * 1, wdw, wdh, round(color_get_saturation(current_color)), mouse_ui); + tb_val.draw(data_x + ui(28), data_y + txh * 2, wdw, wdh, round(color_get_value(current_color)), mouse_ui); + + data_y = data_y + txh * 3 + ui(8); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); + draw_text(data_x, data_y + txh * 0 + ui(15), "R"); + draw_text(data_x, data_y + txh * 1 + ui(15), "G"); + draw_text(data_x, data_y + txh * 2 + ui(15), "B"); + draw_text(data_x, data_y + txh * 3 + ui(15), "A"); + + tb_red.setFocusHover (focus, hover); + tb_green.setFocusHover(focus, hover); + tb_blue.setFocusHover (focus, hover); + tb_alpha.setFocusHover(focus, hover); + + tb_red.draw (data_x + ui(28), data_y + txh * 0, wdw, wdh, round(color_get_red(current_color)), mouse_ui); + tb_green.draw(data_x + ui(28), data_y + txh * 1, wdw, wdh, round(color_get_green(current_color)), mouse_ui); + tb_blue.draw (data_x + ui(28), data_y + txh * 2, wdw, wdh, round(color_get_blue(current_color)), mouse_ui); + tb_alpha.draw(data_x + ui(28), data_y + txh * 3, wdw, wdh, round(color_get_alpha(current_color)), mouse_ui); + + ////////////////////////////////////////////////////////////////// + + tb_hex.active = focus; tb_hex.hover = hover; + tb_hex.draw(hue_x - ui(128), col_y + ui(256 + 24), ui(108), TEXTBOX_HEIGHT, color_get_hex(current_color), mouse_ui); + #endregion + + var cx = col_x + ui(16); + var cy = col_y + ui(296); + var aa = _color_get_alpha(current_color); + + draw_sprite_stretched_ext(THEME.color_picker_box, 0, cx - ui(20), cy - ui(20), ui(40), ui(40), COLORS._main_icon_dark, 1); + draw_sprite_stretched_ext(THEME.color_picker_box, 1, cx - ui(18), cy - ui(18), ui(36), ui(36), current_color, aa); + + cx += ui(48); + if(buttonInstant(THEME.button_hide, cx - ui(18), cy - ui(18), ui(36), ui(36), mouse_ui, focus, hover, "", THEME.color_picker_dropper, 0, c_white) == 2) + dropper_active = true; + } +} \ No newline at end of file diff --git a/#backups/scripts/color_selector/color_selector.gml.backup1 b/#backups/scripts/color_selector/color_selector.gml.backup1 new file mode 100644 index 000000000..79c6c16c5 --- /dev/null +++ b/#backups/scripts/color_selector/color_selector.gml.backup1 @@ -0,0 +1,363 @@ +// 2024-05-01 08:40:09 +function colorSelector(onApply = noone) constructor { + self.onApply = onApply; + + current_color = c_white; + + hue = 1; + sat = 0; + val = 0; + + area_dragging = false; + side_dragging = false; + + dropper_active = false; + dropper_close = true; + dropper_color = c_white; + interactable = true; + + disp_mode = 0; + + palette = []; + discretize_pal = true; + + color_surface = surface_create_valid(ui(256), ui(256)); + + tb_hue = slider(0, 255, 1, function(_val) { + if(!interactable) return; + hue = clamp(_val, 0, 255); + setHSV(); + }); + + tb_sat = slider(0, 255, 1, function(_val) { + if(!interactable) return; + sat = clamp(_val, 0, 255); + setHSV(); + }); + + tb_val= slider(0, 255, 1, function(_val) { + if(!interactable) return; + val = clamp(_val, 0, 255); + setHSV(); + }); + + tb_red = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = clamp(_val, 0, 255); + var g = color_get_green(current_color); + var b = color_get_blue(current_color); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_green = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = color_get_red(current_color); + var g = clamp(_val, 0, 255); + var b = color_get_blue(current_color); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_blue = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var r = color_get_red(current_color); + var g = color_get_green(current_color); + var b = clamp(_val, 0, 255); + var a = color_get_alpha(current_color); + + current_color = make_color_rgba(r, g, b, a); + resetHSV(); + }); + + tb_alpha = slider(0, 255, 1, function(_val) { + if(!interactable) return; + var alp = clamp(_val, 0, 255); + + current_color = _cola(current_color, alp); + resetHSV(); + }); + + tb_hue.hdw = ui(16); + tb_sat.hdw = ui(16); + tb_val.hdw = ui(16); + tb_red.hdw = ui(16); + tb_green.hdw = ui(16); + tb_blue.hdw = ui(16); + tb_alpha.hdw = ui(16); + + tb_hue.font = f_p1; + tb_sat.font = f_p1; + tb_val.font = f_p1; + tb_red.font = f_p1; + tb_green.font = f_p1; + tb_blue.font = f_p1; + tb_alpha.font = f_p1; + + tb_hex = new textBox(TEXTBOX_INPUT.text, function(str) { + if(!interactable) return; + if(str == "") return; + if(string_char_at(str, 1) == "#") str = string_replace(str, "#", ""); + + var _r = string_hexadecimal(string_copy(str, 1, 2)); + var _g = string_hexadecimal(string_copy(str, 3, 2)); + var _b = string_hexadecimal(string_copy(str, 5, 2)); + var _a = string_length(str) > 6? string_hexadecimal(string_copy(str, 7, 2)) : 255; + + current_color = make_color_rgba(_r, _g, _b, _a); + resetHSV(); + }); + + scr_disp = new buttonGroup(["Hue", "Value"], function(mode) { disp_mode = mode; } ); + + function resetHSV(_apply = true) { + hue = round(color_get_hue(current_color)); + sat = round(color_get_saturation(current_color)); + val = round(color_get_value(current_color)); + + if(_apply && onApply != noone) onApply(int64(current_color)); + } + + function setHSV(_apply = true) { + if(!interactable) return; + var alp = color_get_alpha(current_color); + current_color = make_color_hsva(hue, sat, val, alp); + + if(_apply && onApply != noone) onApply(int64(current_color)); + } + + function setColor(color, _apply = true) { + current_color = color; + + resetHSV(_apply); + } + + function colorPicker() { + if(!dropper_active) return; + dropper_color = int64(cola(draw_getpixel(mouse_mx, mouse_my))); + MOUSE_BLOCK = true; + } + + static drawDropper = function(instance) { + if(mouse_check_button_pressed(mb_left)) { + setColor(dropper_color); + if(dropper_close) + instance_destroy(instance); + dropper_active = false; + MOUSE_BLOCK = true; + + return; + } + + if(dropper_active && mouse_check_button_pressed(mb_right)) + instance_destroy(instance); + if(keyboard_check_released(vk_alt)) + instance_destroy(instance); + + var dx = mouse_mx + ui(36); + var dy = mouse_my + ui(36); + draw_sprite_stretched(THEME.color_picker_sample, 0, dx - ui(20), dy - ui(20), ui(40), ui(40)); + draw_sprite_stretched_ext(THEME.color_picker_sample, 0, dx - ui(18), dy - ui(18), ui(36), ui(36), dropper_color, 1); + } + + static draw = function(_x, _y, focus, hover) { + var col_x = _x + ui(8); + var col_y = _y + ui(8); + + draw_sprite_stretched(THEME.ui_panel_bg, 1, col_x - ui(8), col_y - ui(8), ui(256 + 16), ui(256 + 16)); + + color_surface = surface_verify(color_surface, ui(256), ui(256)); + surface_set_target(color_surface); + if(disp_mode == 0) { + shader_set(sh_color_picker_hue); + shader_set_f("hue", hue / 256); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + } else if(disp_mode == 1) { + shader_set(sh_color_picker_value); + shader_set_f("value", val / 256); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + } + + draw_sprite_uniform(s_fx_pixel, 0, 0, 0, ui(256)); + shader_reset(); + surface_reset_target(); + + draw_surface_ext_safe(color_surface, col_x, col_y,,,,, interactable * 0.5 + 0.5); + + #region side control + var hue_x = col_x + ui(280); + var hue_y = col_y; + + draw_sprite_stretched(THEME.ui_panel_bg, 1, hue_x - ui(8), hue_y - ui(8), ui(32), ui(256 + 16)); + + if(disp_mode == 0) { + shader_set(sh_color_picker_side_hue); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + shader_set_f("sat", sat / 256); + shader_set_f("value", val / 256); + + draw_sprite_stretched_ext(s_fx_pixel, 0, hue_x, hue_y, ui(16), ui(256), c_white, interactable * 0.5 + 0.5); + shader_reset(); + } else if(disp_mode == 1) { + shader_set(sh_color_picker_side_value); + shader_set_i("usePalette", NODE_COLOR_SHOW_PALETTE && discretize_pal); + shader_set_palette(palette); + shader_set_f("hue", hue / 256); + shader_set_f("sat", sat / 256); + + draw_sprite_stretched_ext(s_fx_pixel, 0, hue_x, hue_y, ui(16), ui(256), c_white, interactable * 0.5 + 0.5) + shader_reset(); + } + + var _sy = disp_mode == 0? hue_y + ui(hue) : hue_y + ui(256 - val); + + if(NODE_COLOR_SHOW_PALETTE) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), current_color, 1); + + if(disp_mode == 0) + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(sat - 6), col_y + ui(256 - val - 6), ui(12), ui(12), current_color, 1); + else if(disp_mode == 1) + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(hue - 6), col_y + ui(256 - sat - 6), ui(12), ui(12), current_color, 1); + } else { + if(disp_mode == 0) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), make_color_hsv(hue, 255, 255), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(sat - 6), col_y + ui(256 - val - 6), ui(12), ui(12), current_color, 1); + } else if(disp_mode == 1) { + draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), make_color_hsv(hue, 255, val), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(hue - 6), col_y + ui(256 - sat - 6), ui(12), ui(12), current_color, 1); + } + } + + if(mouse_press(mb_left, interactable && focus)) { + if(point_in_rectangle(mouse_mx, mouse_my, hue_x, hue_y, hue_x + ui(16), hue_y + ui(256))) + side_dragging = true; + else if(point_in_rectangle(mouse_mx, mouse_my, col_x, col_y, col_x + ui(256), col_y + ui(256))) + area_dragging = true; + } + + if(side_dragging) { + if(disp_mode == 0) { + hue = clamp((mouse_my - hue_y) / UI_SCALE, 0, 256); + } else if(disp_mode == 1) { + val = 256 - clamp((mouse_my - hue_y) / UI_SCALE, 0, 256); + } + + setHSV(); + + if(NODE_COLOR_SHOW_PALETTE) { + current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) : + surface_getpixel(color_surface, hue, 256 - sat); + if(onApply != noone) onApply(current_color); + } + + if(mouse_release(mb_left)) + side_dragging = false; + } + + if(area_dragging) { + if(disp_mode == 0) { + sat = clamp((mouse_mx - col_x) / UI_SCALE, 0, 256); + val = 256 - clamp((mouse_my - col_y) / UI_SCALE, 0, 256); + } else if(disp_mode == 1) { + hue = clamp((mouse_mx - col_x) / UI_SCALE, 0, 256); + sat = 256 - clamp((mouse_my - col_y) / UI_SCALE, 0, 256); + } + + setHSV(); + + if(NODE_COLOR_SHOW_PALETTE) { + current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) : + surface_getpixel(color_surface, hue, 256 - sat); + if(onApply != noone) onApply(current_color); + } + + if(mouse_release(mb_left)) + area_dragging = false; + } + #endregion + + #region type + var tx = hue_x + ui(36); + var ty = _y + ui(4); + + scr_disp.setFocusHover(focus, hover); + scr_disp.draw(tx, ty, ui(190), ui(32), disp_mode, mouse_ui); + #endregion + + #region register + scr_disp.register(); + + tb_hue.register(); + tb_sat.register(); + tb_val.register(); + + tb_red.register(); + tb_green.register(); + tb_blue.register(); + + tb_hex.register(); + #endregion + + #region data + var data_x = hue_x + ui(40); + var data_y = col_y + ui(40); + var wdw = ui(160); + var wdh = ui( 27); + var txh = wdh + ui(4); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); + draw_text(data_x, data_y + txh * 0 + ui(15), "H"); + draw_text(data_x, data_y + txh * 1 + ui(15), "S") + draw_text(data_x, data_y + txh * 2 + ui(15), "V"); + + tb_hue.setFocusHover(focus, hover); + tb_sat.setFocusHover(focus, hover); + tb_val.setFocusHover(focus, hover); + + tb_hue.draw(data_x + ui(28), data_y + txh * 0, wdw, wdh, round(color_get_hue(current_color)), mouse_ui); + tb_sat.draw(data_x + ui(28), data_y + txh * 1, wdw, wdh, round(color_get_saturation(current_color)), mouse_ui); + tb_val.draw(data_x + ui(28), data_y + txh * 2, wdw, wdh, round(color_get_value(current_color)), mouse_ui); + + data_y = data_y + txh * 3 + ui(8); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); + draw_text(data_x, data_y + txh * 0 + ui(15), "R"); + draw_text(data_x, data_y + txh * 1 + ui(15), "G"); + draw_text(data_x, data_y + txh * 2 + ui(15), "B"); + draw_text(data_x, data_y + txh * 3 + ui(15), "A"); + + tb_red.setFocusHover (focus, hover); + tb_green.setFocusHover(focus, hover); + tb_blue.setFocusHover (focus, hover); + tb_alpha.setFocusHover(focus, hover); + + tb_red.draw (data_x + ui(28), data_y + txh * 0, wdw, wdh, round(color_get_red(current_color)), mouse_ui); + tb_green.draw(data_x + ui(28), data_y + txh * 1, wdw, wdh, round(color_get_green(current_color)), mouse_ui); + tb_blue.draw (data_x + ui(28), data_y + txh * 2, wdw, wdh, round(color_get_blue(current_color)), mouse_ui); + tb_alpha.draw(data_x + ui(28), data_y + txh * 3, wdw, wdh, round(color_get_alpha(current_color)), mouse_ui); + + ////////////////////////////////////////////////////////////////// + + tb_hex.active = focus; tb_hex.hover = hover; + tb_hex.draw(hue_x - ui(128), col_y + ui(256 + 24), ui(108), TEXTBOX_HEIGHT, color_get_hex(current_color), mouse_ui); + #endregion + + var cx = col_x + ui(16); + var cy = col_y + ui(296); + var aa = _color_get_alpha(current_color); + + draw_sprite_stretched_ext(THEME.color_picker_box, 0, cx - ui(20), cy - ui(20), ui(40), ui(40), COLORS._main_icon_dark, 1); + draw_sprite_stretched_ext(THEME.color_picker_box, 1, cx - ui(18), cy - ui(18), ui(36), ui(36), current_color, aa); + + cx += ui(48); + if(buttonInstant(THEME.button_hide, cx - ui(18), cy - ui(18), ui(36), ui(36), mouse_ui, focus, hover, "", THEME.color_picker_dropper, 0, c_white) == 2) + dropper_active = true; + } +} \ No newline at end of file diff --git a/#backups/scripts/globals/globals.gml.backup0 b/#backups/scripts/globals/globals.gml.backup0 index 72ba5e5ad..42aa957fb 100644 --- a/#backups/scripts/globals/globals.gml.backup0 +++ b/#backups/scripts/globals/globals.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-29 18:33:19 +// 2024-05-01 08:11:39 #region save globalvar LOADING, CLONING, CLONING_GROUP; globalvar CONNECTION_CONFLICT, LOADING_VERSION; @@ -39,8 +39,8 @@ LATEST_VERSION = 11600; VERSION = 11700; SAVE_VERSION = 11690; - VERSION_STRING = "1.17.rc5"; - BUILD_NUMBER = 11705; + VERSION_STRING = "1.17"; + BUILD_NUMBER = 11706; globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); diff --git a/#backups/scripts/globals/globals.gml.backup1 b/#backups/scripts/globals/globals.gml.backup1 index aeff0a099..fa4b068af 100644 --- a/#backups/scripts/globals/globals.gml.backup1 +++ b/#backups/scripts/globals/globals.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-29 18:33:01 +// 2024-05-01 08:11:28 #region save globalvar LOADING, CLONING, CLONING_GROUP; globalvar CONNECTION_CONFLICT, LOADING_VERSION; @@ -39,8 +39,8 @@ LATEST_VERSION = 11600; VERSION = 11700; SAVE_VERSION = 11690; - VERSION_STRING = "1.17.rc5"; - BUILD_NUMBER = 11705; + VERSION_STRING = "1.17"; + BUILD_NUMBER = 11706; globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); diff --git a/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup0 b/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup0 new file mode 100644 index 000000000..a6f80ae1c --- /dev/null +++ b/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup0 @@ -0,0 +1,87 @@ +// 2024-05-01 07:56:57 +function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "HSV Color"; + setDimension(96, 80); + + inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 3] = nodeValue("Normalized", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 1); + + inputs[| 4] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider); + + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + + input_display_list = [ 3, 0, 1, 2, 4 ]; + + static processData = function(_outSurf, _data, _output_index, _array_index) { #region + var nor = _data[3]; + + return make_color_hsva( + nor? _data[0] * 255 : _data[0], + nor? _data[1] * 255 : _data[1], + nor? _data[2] * 255 : _data[2], + nor? _data[4] * 255 : _data[4], + ); + } #endregion + + static onValueUpdate = function(index = 0) { #region + if(index == 3) { + var _nor = getInputData(3); + + if(_nor) { + inputs[| 0].setType(VALUE_TYPE.float); + inputs[| 0].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 1].setType(VALUE_TYPE.float); + inputs[| 1].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 2].setType(VALUE_TYPE.float); + inputs[| 2].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 4].setType(VALUE_TYPE.float); + inputs[| 4].setDisplay(VALUE_DISPLAY.slider); + } else { + inputs[| 0].setType(VALUE_TYPE.integer); + inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 1].setType(VALUE_TYPE.integer); + inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 2].setType(VALUE_TYPE.integer); + inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 4].setType(VALUE_TYPE.integer); + inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + } + } + } #endregion + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + var bbox = drawGetBbox(xx, yy, _s); + if(bbox.h < 1) return; + + var col = outputs[| 0].getValue(); + + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } + + drawColor(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + } #endregion + + static doApplyDeserialize = function() { #region + onValueUpdate(3); + } #endregion +} \ No newline at end of file diff --git a/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup1 b/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup1 new file mode 100644 index 000000000..3270d4af4 --- /dev/null +++ b/#backups/scripts/node_color_hsv/node_color_hsv.gml.backup1 @@ -0,0 +1,87 @@ +// 2024-05-01 07:56:39 +function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "HSV Color"; + setDimension(96, 80); + + inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider) + .setVisible(true, true); + + inputs[| 3] = nodeValue("Normalized", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 1); + + inputs[| 4] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider); + + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + + input_display_list = [ 3, 0, 1, 2, 4 ]; + + static processData = function(_outSurf, _data, _output_index, _array_index) { #region + var nor = _data[3]; + + return make_color_hsva( + nor? _data[0] * 255 : _data[0], + nor? _data[1] * 255 : _data[1], + nor? _data[2] * 255 : _data[2], + nor? _data[4] * 255 : _data[4], + ); + } #endregion + + static onValueUpdate = function(index = 0) { #region + if(index == 3) { + var _nor = getInputData(3); + + if(_nor) { + inputs[| 0].setType(VALUE_TYPE.float); + inputs[| 0].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 1].setType(VALUE_TYPE.float); + inputs[| 1].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 2].setType(VALUE_TYPE.float); + inputs[| 2].setDisplay(VALUE_DISPLAY.slider); + + inputs[| 4].setType(VALUE_TYPE.float); + inputs[| 4].setDisplay(VALUE_DISPLAY.slider); + } else { + inputs[| 0].setType(VALUE_TYPE.integer); + inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 1].setType(VALUE_TYPE.integer); + inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 2].setType(VALUE_TYPE.integer); + inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + + inputs[| 4].setType(VALUE_TYPE.integer); + inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); + } + } + } #endregion + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + var bbox = drawGetBbox(xx, yy, _s); + if(bbox.h < 1) return; + + var col = outputs[| 0].getValue(); + + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } + + drawColor(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + } #endregion + + static doApplyDeserialize = function() { #region + onValueUpdate(3); + } #endregion +} \ No newline at end of file diff --git a/#backups/scripts/node_math/node_math.gml.backup0 b/#backups/scripts/node_math/node_math.gml.backup0 new file mode 100644 index 000000000..303da63a1 --- /dev/null +++ b/#backups/scripts/node_math/node_math.gml.backup0 @@ -0,0 +1,247 @@ +// 2024-05-01 07:50:01 +enum MATH_OPERATOR { + add, + subtract, + multiply, + divide, + power, + root, + + sin, + cos, + tan, + + modulo, + + floor, + ceiling, + round, + + lerp, + abs +} + +#region create + global.node_math_keys = [ "add", "subtract", "multiply", "divide", "power", "root", "modulo", "round", "ceiling", "floor", "sin", "cos", "tan", "lerp", "abs" ]; + + function Node_create_Math(_x, _y, _group = noone, _param = {}) { + var query = struct_try_get(_param, "query", ""); + var node = new Node_Math(_x, _y, _group); + + switch(query) { #region + case "add" : node.inputs[| 0].setValue(MATH_OPERATOR.add); break; + case "subtract" : node.inputs[| 0].setValue(MATH_OPERATOR.subtract); break; + case "multiply" : node.inputs[| 0].setValue(MATH_OPERATOR.multiply); break; + case "divide" : node.inputs[| 0].setValue(MATH_OPERATOR.divide); break; + case "power" : node.inputs[| 0].setValue(MATH_OPERATOR.power); break; + case "root" : node.inputs[| 0].setValue(MATH_OPERATOR.root); break; + + case "sin" : node.inputs[| 0].setValue(MATH_OPERATOR.sin); break; + case "cos" : node.inputs[| 0].setValue(MATH_OPERATOR.cos); break; + case "tan" : node.inputs[| 0].setValue(MATH_OPERATOR.tan); break; + + case "modulo" : node.inputs[| 0].setValue(MATH_OPERATOR.modulo); break; + + case "floor" : node.inputs[| 0].setValue(MATH_OPERATOR.floor); break; + case "ceiling" : node.inputs[| 0].setValue(MATH_OPERATOR.ceiling); break; + case "round" : node.inputs[| 0].setValue(MATH_OPERATOR.round); break; + + case "lerp" : node.inputs[| 0].setValue(MATH_OPERATOR.lerp); break; + case "abs" : node.inputs[| 0].setValue(MATH_OPERATOR.abs); break; + } #endregion + + return node; + } +#endregion + +function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { + name = "Math"; + color = COLORS.node_blend_number; + setDimension(96, 80); + + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ + /* 0 - 9*/ "Add", "Subtract", "Multiply", "Divide", "Power", "Root", "Sin", "Cos", "Tan", "Modulo", + /*10 - 20*/ "Floor", "Ceil", "Round", "Lerp", "Abs" ]) + .rejectArray(); + + inputs[| 1] = nodeValue("a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setVisible(true, true); + + inputs[| 2] = nodeValue("b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setVisible(true, true); + + inputs[| 3] = nodeValue("Degree angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + + inputs[| 4] = nodeValue("To integer", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 5] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + + input_display_list = [ + 0, 1, 2, 5, 3, 4, + ] + + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + + use_mod = 0; + use_deg = false; + + static _eval = function(a, b, c = 0) { #region + switch(use_mod) { + case MATH_OPERATOR.add : return a + b; + case MATH_OPERATOR.subtract : return a - b; + case MATH_OPERATOR.multiply : return a * b; + case MATH_OPERATOR.divide : return b == 0? 0 : a / b; + + case MATH_OPERATOR.power : return power(a, b); + case MATH_OPERATOR.root : return b == 0? 0 : power(a, 1 / b); + + case MATH_OPERATOR.sin : return sin(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.cos : return cos(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.tan : return tan(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.modulo : return safe_mod(a, b); + + case MATH_OPERATOR.floor : return floor(a); + case MATH_OPERATOR.ceiling : return ceil(a); + case MATH_OPERATOR.round : return round(a); + + case MATH_OPERATOR.lerp : return lerp(a, b, c); + case MATH_OPERATOR.abs : return abs(a); + } + return 0; + } #endregion + + static step = function() { #region + var mode = getInputData(0); + + switch(mode) { + case MATH_OPERATOR.sin : + case MATH_OPERATOR.cos : + case MATH_OPERATOR.tan : + inputs[| 3].setVisible(true); + break; + default: + inputs[| 3].setVisible(false); + break; + } + + switch(mode) { + case MATH_OPERATOR.round : + case MATH_OPERATOR.floor : + case MATH_OPERATOR.ceiling : + inputs[| 4].setVisible(true); + + var int = getInputData(4); + if(int) outputs[| 0].setType(VALUE_TYPE.integer); + else outputs[| 0].setType(VALUE_TYPE.float); + break; + default: + inputs[| 4].setVisible(false); + + outputs[| 0].setType(VALUE_TYPE.float); + break; + } + + inputs[| 2].name = "b"; + inputs[| 5].setVisible(false); + + switch(mode) { + case MATH_OPERATOR.add : + case MATH_OPERATOR.subtract : + case MATH_OPERATOR.multiply : + case MATH_OPERATOR.divide : + case MATH_OPERATOR.power : + case MATH_OPERATOR.root : + case MATH_OPERATOR.modulo : + inputs[| 2].setVisible(true); + break; + case MATH_OPERATOR.sin : + case MATH_OPERATOR.cos : + case MATH_OPERATOR.tan : + inputs[| 2].setVisible(true); + inputs[| 2].name = "Amplitude"; + break; + case MATH_OPERATOR.floor : + case MATH_OPERATOR.ceiling : + case MATH_OPERATOR.round : + case MATH_OPERATOR.abs : + inputs[| 2].setVisible(false); + break; + case MATH_OPERATOR.lerp : + inputs[| 2].setVisible(true); + inputs[| 5].setVisible(true); + break; + default: return; + } + } #endregion + + function evalArray(a, b, c = 0) { #region + var as = is_array(a); + var bs = is_array(b); + var cs = is_array(c); + + if(!as && !bs && !cs) + return _eval(a, b, c); + + if(!as) a = [ a ]; + if(!bs) b = [ b ]; + if(!cs) c = [ c ]; + + var al = array_length(a); + var bl = array_length(b); + var cl = array_length(c); + + var amo = max(al, bl, cl); + var val = array_create(amo); + + for( var i = 0; i < amo; i++ ) + val[i] = evalArray( + array_safe_get(a, i,, ARRAY_OVERFLOW.loop), + array_safe_get(b, i,, ARRAY_OVERFLOW.loop), + array_safe_get(c, i,, ARRAY_OVERFLOW.loop), + ); + + return val; + } #endregion + + static update = function(frame = CURRENT_FRAME) { #region + use_mod = getInputData(0); + var a = getInputData(1); + var b = getInputData(2); + use_deg = getInputData(3); + var c = getInputData(5); + + var val = evalArray(a, b, c); + outputs[| 0].setValue(val); + } #endregion + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); + var str = ""; + switch(getInputData(0)) { + case MATH_OPERATOR.add : str = "+"; break; + case MATH_OPERATOR.subtract : str = "-"; break; + case MATH_OPERATOR.multiply : str = "*"; break; + case MATH_OPERATOR.divide : str = "/"; break; + case MATH_OPERATOR.power : str = "pow"; break; + case MATH_OPERATOR.root : str = "root"; break; + + case MATH_OPERATOR.sin : str = "sin"; break; + case MATH_OPERATOR.cos : str = "cos"; break; + case MATH_OPERATOR.tan : str = "tan"; break; + case MATH_OPERATOR.modulo : str = "mod"; break; + + case MATH_OPERATOR.floor : str = "floor"; break; + case MATH_OPERATOR.ceiling : str = "ceil"; break; + case MATH_OPERATOR.round : str = "round"; break; + + case MATH_OPERATOR.lerp : str = "lerp"; break; + case MATH_OPERATOR.abs : str = "abs"; break; + default: return; + } + + var bbox = drawGetBbox(xx, yy, _s); + var ss = string_scale(str, bbox.w, bbox.h); + draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); + } #endregion +} \ No newline at end of file diff --git a/scripts/color_selector/color_selector.gml b/scripts/color_selector/color_selector.gml index 79ef8d462..27d39b3ee 100644 --- a/scripts/color_selector/color_selector.gml +++ b/scripts/color_selector/color_selector.gml @@ -138,17 +138,21 @@ function colorSelector(onApply = noone) constructor { function colorPicker() { if(!dropper_active) return; dropper_color = int64(cola(draw_getpixel(mouse_mx, mouse_my))); + MOUSE_BLOCK = true; } static drawDropper = function(instance) { - if(mouse_press(mb_left)) { + if(mouse_check_button_pressed(mb_left)) { setColor(dropper_color); if(dropper_close) instance_destroy(instance); dropper_active = false; + MOUSE_BLOCK = true; + + return; } - if(dropper_active == true && mouse_press(mb_right)) + if(dropper_active && mouse_check_button_pressed(mb_right)) instance_destroy(instance); if(keyboard_check_released(vk_alt)) instance_destroy(instance); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 2a734effc..c727384d1 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -38,8 +38,8 @@ LATEST_VERSION = 11600; VERSION = 11700; SAVE_VERSION = 11690; - VERSION_STRING = "1.17.rc5"; - BUILD_NUMBER = 11705; + VERSION_STRING = "1.17"; + BUILD_NUMBER = 11706; globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); diff --git a/scripts/node_color_hsv/node_color_hsv.gml b/scripts/node_color_hsv/node_color_hsv.gml index a48a2657d..7b763fbaa 100644 --- a/scripts/node_color_hsv/node_color_hsv.gml +++ b/scripts/node_color_hsv/node_color_hsv.gml @@ -1,6 +1,5 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { - name = "HSV Color"; - + name = "HSV Color"; setDimension(96, 80); inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) @@ -28,7 +27,7 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var nor = _data[3]; return make_color_hsva( - nor? _data[0] * 255 : _data[0] / 360 * 255, + nor? _data[0] * 255 : _data[0], nor? _data[1] * 255 : _data[1], nor? _data[2] * 255 : _data[2], nor? _data[4] * 255 : _data[4], @@ -53,7 +52,7 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 4].setDisplay(VALUE_DISPLAY.slider); } else { inputs[| 0].setType(VALUE_TYPE.integer); - inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 360, 0.1] }); + inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); inputs[| 1].setType(VALUE_TYPE.integer); inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] }); diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index e5e201f21..94738c3a0 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -28,25 +28,25 @@ enum MATH_OPERATOR { var node = new Node_Math(_x, _y, _group); switch(query) { #region - case "add" : node.inputs[| 0].setValue(MATH_OPERATOR.add); break; - case "subtract" : node.inputs[| 0].setValue(MATH_OPERATOR.subtract); break; - case "multiply" : node.inputs[| 0].setValue(MATH_OPERATOR.multiply); break; - case "divide" : node.inputs[| 0].setValue(MATH_OPERATOR.divide); break; - case "power" : node.inputs[| 0].setValue(MATH_OPERATOR.power); break; - case "root" : node.inputs[| 0].setValue(MATH_OPERATOR.root); break; + case "add" : node.inputs[| 0].setValue(MATH_OPERATOR.add); break; + case "subtract" : node.inputs[| 0].setValue(MATH_OPERATOR.subtract); break; + case "multiply" : node.inputs[| 0].setValue(MATH_OPERATOR.multiply); break; + case "divide" : node.inputs[| 0].setValue(MATH_OPERATOR.divide); break; + case "power" : node.inputs[| 0].setValue(MATH_OPERATOR.power); break; + case "root" : node.inputs[| 0].setValue(MATH_OPERATOR.root); break; - case "sin" : node.inputs[| 0].setValue(MATH_OPERATOR.sin); break; - case "cos" : node.inputs[| 0].setValue(MATH_OPERATOR.cos); break; - case "tan" : node.inputs[| 0].setValue(MATH_OPERATOR.tan); break; + case "sin" : node.inputs[| 0].setValue(MATH_OPERATOR.sin); break; + case "cos" : node.inputs[| 0].setValue(MATH_OPERATOR.cos); break; + case "tan" : node.inputs[| 0].setValue(MATH_OPERATOR.tan); break; - case "modulo" : node.inputs[| 0].setValue(MATH_OPERATOR.modulo); break; + case "modulo" : node.inputs[| 0].setValue(MATH_OPERATOR.modulo); break; - case "floor" : node.inputs[| 0].setValue(MATH_OPERATOR.floor); break; - case "ceiling" : node.inputs[| 0].setValue(MATH_OPERATOR.ceiling); break; - case "round" : node.inputs[| 0].setValue(MATH_OPERATOR.round); break; + case "floor" : node.inputs[| 0].setValue(MATH_OPERATOR.floor); break; + case "ceiling" : node.inputs[| 0].setValue(MATH_OPERATOR.ceiling); break; + case "round" : node.inputs[| 0].setValue(MATH_OPERATOR.round); break; - case "lerp" : node.inputs[| 0].setValue(MATH_OPERATOR.lerp); break; - case "abs" : node.inputs[| 0].setValue(MATH_OPERATOR.abs); break; + case "lerp" : node.inputs[| 0].setValue(MATH_OPERATOR.lerp); break; + case "abs" : node.inputs[| 0].setValue(MATH_OPERATOR.abs); break; } #endregion return node;