From 33ea9fd7e326c022106c68c2817ce8551fd07ab1 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sun, 21 Apr 2024 14:36:00 +0700 Subject: [PATCH] Preview, Path Array, Canvas Fixes - [Preview Panel] Fix right-side toolbar overlap with preview content. - [Path Array Editor] Fix adding image not updating node automatically. - [Canvas] Fix custom surface brush drawn incorrectly. --- .../o_dialog_image_array_edit.yy.backup0 | 210 ++++++++++++++++++ .../o_dialog_image_array_edit.yy.backup1 | 210 ++++++++++++++++++ .../canvas_draw_functions.gml.backup0 | 4 +- .../canvas_draw_functions.gml.backup1 | 6 +- .../canvas_tool_brush.gml.backup0 | 5 +- .../canvas_tool_brush.gml.backup1 | 5 +- .../scripts/node_array/node_array.gml.backup0 | 2 +- .../scripts/node_array/node_array.gml.backup1 | 2 +- .../node_canvas/node_canvas.gml.backup0 | 3 +- .../node_canvas/node_canvas.gml.backup1 | 3 +- .../panel_preview/panel_preview.gml.backup0 | 16 +- .../panel_preview/panel_preview.gml.backup1 | 16 +- .../o_dialog_image_array_edit/Create_0.gml | 7 +- objects/o_dialog_image_array_edit/Draw_64.gml | 1 + .../canvas_draw_functions.gml | 2 +- .../canvas_tool_brush/canvas_tool_brush.gml | 3 +- scripts/globals/globals.gml | 4 +- scripts/node_canvas/node_canvas.gml | 1 - scripts/panel_preview/panel_preview.gml | 14 +- 19 files changed, 473 insertions(+), 41 deletions(-) create mode 100644 #backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup0 create mode 100644 #backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup1 diff --git a/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup0 b/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup0 new file mode 100644 index 000000000..87ed2db11 --- /dev/null +++ b/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup0 @@ -0,0 +1,210 @@ +// 2024-04-21 14:35:38 +#event properties (no comments/etc. here are saved) +parent_index = _p_dialog; +uses_physics = false; + +#event create +event_inherited(); + +#region data + destroy_on_click_out = true; + dialog_w = ui(648); + dialog_h = ui(640); + + draggable = false; + dialog_resizable = false; + dialog_w_min = ui(400); + dialog_h_min = ui(400); + dialog_w_max = WIN_W; + dialog_h_max = WIN_H; + + target = noone; + + function onResize() { + sp_content.resize(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding)); + } +#endregion + +#region content + menuOn = -1; + dragging = -1; + drag_spr = -1; + + sp_content = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) { + if(!target) return 0; + if(!struct_has(target, "spr")) return 0; + + draw_clear_alpha(COLORS.dialog_array_edit_bg, 0); + + var _h = ui(8); + + var ww = ui(100); + var hh = ui(100); + var pad = ui(16); + + var arr = target.getInputData(0); + if(array_length(arr) != array_length(target.spr)) + target.updatePaths(arr); + + var len = array_length(arr); + var col = floor((sp_content.surface_w - pad) / (ww + pad)); + var row = ceil(len / col); + + var yy = _y + ui(8); + var menu = -1; + var drag = -1; + var inb_hover = -1; + + for( var i = 0; i < row; i++ ) { + var ch = hh; + for( var j = 0; j < col; j++ ) { + var index = i * col + j; + if(index >= len) break; + + var xx = pad + (ww + pad) * j; + + draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh); + + if(sHOVER && sp_content.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) { + inb_hover = index; + if(dragging == -1) + draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1); + + if(mouse_press(mb_left, sFOCUS)) + dragging = index; + + if(mouse_press(mb_right, sFOCUS)) { + menu = index; + menuOn = index; + } + } + + var spr = array_safe_get_fast(target.spr, index, noone); + if(spr == noone || !sprite_exists(spr)) + spr = s_texture_default; + + var spr_w = sprite_get_width(spr); + var spr_h = sprite_get_height(spr); + var spr_s = min((ww - ui(16)) / spr_w, (hh - ui(16)) / spr_h); + var spr_x = xx + ww / 2 - spr_w * spr_s / 2; + var spr_y = yy + hh / 2 - spr_h * spr_s / 2; + + var aa = dragging == -1? 1 : (dragging == index? 1 : 0.5); + draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa); + + draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text); + var path = arr[index]; + var name = string_cut_line(string_replace(filename_name(path), filename_ext(path), ""), ww); + var txt_h = string_height_ext(name, -1, ww); + + draw_text_line(xx + ww / 2, yy + hh + ui(16), name, -1, ww); + + ch = max(ch, hh + txt_h + ui(32)); + } + + yy += ch; + _h += ch; + } + + if(dragging != -1) { + if(inb_hover != -1) { + rearrange(dragging, inb_hover); + dragging = inb_hover; + } + + if(mouse_release(mb_left)) + dragging = -1; + } + + if(menu > -1) { + menuCall("image_array_edit_menu",,, [ + menuItem(__txt("Remove"), function() { + var arr = target.getInputData(0); + array_delete(arr, menuOn, 1); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + }) + ],, target ); + } + + return _h; + }) +#endregion + +#region function + function rearrange(oldindex, newindex) { + if(oldindex == newindex) return; + + var arr = target.getInputData(0); + var val = arr[oldindex]; + array_delete(arr, oldindex, 1); + array_insert(arr, newindex, val); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } + + sortAsc = true; + function sortByName() { + if(!target) return 0; + var arr = target.getInputData(0); + + array_sort(arr, bool(sortAsc)); + sortAsc = !sortAsc; + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } +#endregion + +#event draw_gui init +if !ready exit; +if !target exit; + +#region base UI + DIALOG_DRAW_BG + if(sFOCUS) + DIALOG_DRAW_FOCUS + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit")); +#endregion + +#region content + var px = dialog_x + ui(padding); + var py = dialog_y + ui(title_height); + var pw = dialog_w - ui(padding + padding); + var ph = dialog_h - ui(title_height + padding); + + draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); + sp_content.setFocusHover(sFOCUS, sHOVER); + sp_content.draw(px, py); +#endregion + +#region button + var bw = ui(28); + var bh = ui(28); + var bx = dialog_x + dialog_w - ui(padding - 8) - bw; + var by = dialog_y + ui(18); + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) { + var path = get_open_filenames_compat("image|*.png;*.jpg", ""); + key_release(); + if(path != "") { + var paths = paths_to_array(path); + var arr = target.getInputData(0); + + for( var i = 0, n = array_length(paths); i < n; i++ ) + array_push(arr, paths[i]); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } + } + + bx -= ui(36); + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2) + sortByName(); +#endregion \ No newline at end of file diff --git a/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup1 b/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup1 new file mode 100644 index 000000000..542429567 --- /dev/null +++ b/#backups/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy.backup1 @@ -0,0 +1,210 @@ +// 2024-04-21 14:35:31 +#event properties (no comments/etc. here are saved) +parent_index = _p_dialog; +uses_physics = false; + +#event create +event_inherited(); + +#region data + destroy_on_click_out = true; + dialog_w = ui(648); + dialog_h = ui(640); + + draggable = false; + dialog_resizable = false; + dialog_w_min = ui(400); + dialog_h_min = ui(400); + dialog_w_max = WIN_W; + dialog_h_max = WIN_H; + + target = noone; + + function onResize() { + sp_content.resize(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding)); + } +#endregion + +#region content + menuOn = -1; + dragging = -1; + drag_spr = -1; + + sp_content = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) { + if(!target) return 0; + if(!struct_has(target, "spr")) return 0; + + draw_clear_alpha(COLORS.dialog_array_edit_bg, 0); + + var _h = ui(8); + + var ww = ui(100); + var hh = ui(100); + var pad = ui(16); + + var arr = target.getInputData(0); + if(array_length(arr) != array_length(target.spr)) + target.updatePaths(arr); + + var len = array_length(arr); + var col = floor((sp_content.surface_w - pad) / (ww + pad)); + var row = ceil(len / col); + + var yy = _y + ui(8); + var menu = -1; + var drag = -1; + var inb_hover = -1; + + for( var i = 0; i < row; i++ ) { + var ch = hh; + for( var j = 0; j < col; j++ ) { + var index = i * col + j; + if(index >= len) break; + + var xx = pad + (ww + pad) * j; + + draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh); + + if(sHOVER && sp_content.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) { + inb_hover = index; + if(dragging == -1) + draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1); + + if(mouse_press(mb_left, sFOCUS)) + dragging = index; + + if(mouse_press(mb_right, sFOCUS)) { + menu = index; + menuOn = index; + } + } + + var spr = array_safe_get_fast(target.spr, index, noone); + if(spr == noone || !sprite_exists(spr)) + spr = s_texture_default; + + var spr_w = sprite_get_width(spr); + var spr_h = sprite_get_height(spr); + var spr_s = min((ww - ui(16)) / spr_w, (hh - ui(16)) / spr_h); + var spr_x = xx + ww / 2 - spr_w * spr_s / 2; + var spr_y = yy + hh / 2 - spr_h * spr_s / 2; + + var aa = dragging == -1? 1 : (dragging == index? 1 : 0.5); + draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa); + + draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text); + var path = arr[index]; + var name = string_cut_line(string_replace(filename_name(path), filename_ext(path), ""), ww); + var txt_h = string_height_ext(name, -1, ww); + + draw_text_line(xx + ww / 2, yy + hh + ui(16), name, -1, ww); + + ch = max(ch, hh + txt_h + ui(32)); + } + + yy += ch; + _h += ch; + } + + if(dragging != -1) { + if(inb_hover != -1) { + rearrange(dragging, inb_hover); + dragging = inb_hover; + } + + if(mouse_release(mb_left)) + dragging = -1; + } + + if(menu > -1) { + menuCall("image_array_edit_menu",,, [ + menuItem(__txt("Remove"), function() { + var arr = target.getInputData(0); + array_delete(arr, menuOn, 1); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + }) + ],, target ); + } + + return _h; + }) +#endregion + +#region function + function rearrange(oldindex, newindex) { + if(oldindex == newindex) return; + + var arr = target.getInputData(0); + var val = arr[oldindex]; + array_delete(arr, oldindex, 1); + array_insert(arr, newindex, val); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } + + sortAsc = true; + function sortByName() { + if(!target) return 0; + var arr = target.getInputData(0); + + array_sort(arr, bool(sortAsc)); + sortAsc = !sortAsc; + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } +#endregion + +#event draw_gui init +if !ready exit; +if !target exit; + +#region base UI + DIALOG_DRAW_BG + if(sFOCUS) + DIALOG_DRAW_FOCUS + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit")); +#endregion + +#region content + var px = dialog_x + ui(padding); + var py = dialog_y + ui(title_height); + var pw = dialog_w - ui(padding + padding); + var ph = dialog_h - ui(title_height + padding); + + draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); + sp_content.setFocusHover(sFOCUS, sHOVER); + sp_content.draw(px, py); +#endregion + +#region button + var bw = ui(28); + var bh = ui(28); + var bx = dialog_x + dialog_w - ui(padding - 8) - bw; + var by = dialog_y + ui(18); + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) { + var path = get_open_filenames_compat("image|*.png;*.jpg", ""); + key_release(); + if(path != "") { + var paths = paths_to_array(path); + var arr = target.getInputData(0); + + for( var i = 0, n = array_length(paths); i < n; i++ ) + array_push(arr, paths[i]); + + target.inputs[| 0].setValue(arr); + target.triggerRender(); + } + } + + bx -= ui(36); + + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2) + sortByName(); +#endregion \ No newline at end of file diff --git a/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup0 b/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup0 index da711bf2a..66ac8d010 100644 --- a/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup0 +++ b/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-18 13:37:35 +// 2024-04-21 14:31:51 function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region if(brush.brush_surface == noone) { @@ -19,7 +19,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed); var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r); - draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha()); + draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha()); if(_draw) brush.brush_seed = irandom_range(100000, 999999); } diff --git a/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup1 b/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup1 index a7aff4e60..9534e69fe 100644 --- a/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup1 +++ b/#backups/scripts/canvas_draw_functions/canvas_draw_functions.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-18 13:37:22 +// 2024-04-21 14:29:52 function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region if(brush.brush_surface == noone) { @@ -19,7 +19,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed); var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r); - draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha()); + draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha()); if(_draw) brush.brush_seed = irandom_range(100000, 999999); } @@ -118,7 +118,7 @@ function canvas_draw_rect_brush(brush, _x0, _y0, _x1, _y1, _fill) { #region } } #endregion -function canvas_draw_ellp_size(brush, _x0, _y0, _x1, _y1, _fill) { #region +function canvas_draw_ellp_brush(brush, _x0, _y0, _x1, _y1, _fill) { #region if(_x0 == _x1 && _y0 == _y1) { canvas_draw_point_brush(brush, _x0, _y0); return; diff --git a/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup0 b/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup0 index b5c6477d6..b7a9fb94e 100644 --- a/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup0 +++ b/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-18 15:44:33 +// 2024-04-21 14:15:23 function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { self.brush = brush; isEraser = eraser; @@ -34,7 +34,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { } if(mouse_press(mb_left, active)) { - + surface_set_shader(drawing_surface, noone); canvas_draw_point_brush(brush, mouse_cur_x, mouse_cur_y, true); surface_reset_shader(); @@ -122,5 +122,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { draw_text(_x1 + 8, (_y0 + _y1) / 2, _h); } } - } \ No newline at end of file diff --git a/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup1 b/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup1 index 41f74fb69..23545a272 100644 --- a/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup1 +++ b/#backups/scripts/canvas_tool_brush/canvas_tool_brush.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-18 15:43:04 +// 2024-04-21 14:13:22 function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { self.brush = brush; isEraser = eraser; @@ -102,7 +102,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { function drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { - if(mouse_line_drawing && !brush.brush_sizing) { + if(mouse_line_drawing && !brush.brush_sizing && node.attributes.show_slope_check) { var _x0 = _x + mouse_line_x0 * _s; var _y0 = _y + mouse_line_y0 * _s; var _x1 = _x + mouse_line_x1 * _s; @@ -122,5 +122,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { draw_text(_x1 + 8, (_y0 + _y1) / 2, _h); } } - } \ No newline at end of file diff --git a/#backups/scripts/node_array/node_array.gml.backup0 b/#backups/scripts/node_array/node_array.gml.backup0 index 8b1eed6ad..2ffcc2218 100644 --- a/#backups/scripts/node_array/node_array.gml.backup0 +++ b/#backups/scripts/node_array/node_array.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-20 10:42:12 +// 2024-04-21 14:12:32 function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Array"; diff --git a/#backups/scripts/node_array/node_array.gml.backup1 b/#backups/scripts/node_array/node_array.gml.backup1 index 189ad3253..f615657b2 100644 --- a/#backups/scripts/node_array/node_array.gml.backup1 +++ b/#backups/scripts/node_array/node_array.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-20 10:41:12 +// 2024-04-21 12:50:40 function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Array"; diff --git a/#backups/scripts/node_canvas/node_canvas.gml.backup0 b/#backups/scripts/node_canvas/node_canvas.gml.backup0 index 1331a7672..e9bbb9f19 100644 --- a/#backups/scripts/node_canvas/node_canvas.gml.backup0 +++ b/#backups/scripts/node_canvas/node_canvas.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-20 10:03:26 +// 2024-04-21 14:29:32 function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Canvas"; color = COLORS.node_blend_canvas; @@ -863,7 +863,6 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); - #endregion var _x0 = _x; diff --git a/#backups/scripts/node_canvas/node_canvas.gml.backup1 b/#backups/scripts/node_canvas/node_canvas.gml.backup1 index f43e302db..c09f4e122 100644 --- a/#backups/scripts/node_canvas/node_canvas.gml.backup1 +++ b/#backups/scripts/node_canvas/node_canvas.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-20 08:26:31 +// 2024-04-21 14:28:39 function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Canvas"; color = COLORS.node_blend_canvas; @@ -864,6 +864,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); + canvas_draw_point_brush(brush, _x, _y, true); #endregion var _x0 = _x; diff --git a/#backups/scripts/panel_preview/panel_preview.gml.backup0 b/#backups/scripts/panel_preview/panel_preview.gml.backup0 index bd3cff62b..f2ef1bd3f 100644 --- a/#backups/scripts/panel_preview/panel_preview.gml.backup0 +++ b/#backups/scripts/panel_preview/panel_preview.gml.backup0 @@ -1,4 +1,4 @@ -// 2024-04-18 15:03:27 +// 2024-04-21 14:21:07 #region funtion calls function __fnInit_Preview() { __registerFunction("preview_focus_content", panel_preview_focus_content); @@ -123,7 +123,8 @@ function Panel_Preview() : PanelContent() constructor { toolbar_height = ui(40); tool_hovering = false; - tool_side_drawing = false; + tool_side_draw_l = false; + tool_side_draw_r = false; overlay_hovering = false; sbChannel = new scrollBox([], function(index) { #region @@ -571,9 +572,11 @@ function Panel_Preview() : PanelContent() constructor { if(node != noone) bbox = node.getPreviewBoundingBox(); if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]); - var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); + var tl = tool_side_draw_l * 40; + var tr = tool_side_draw_r * 40; + var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); canvas_s = ss; - canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2); + canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2; canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s; } #endregion @@ -1117,7 +1120,7 @@ function Panel_Preview() : PanelContent() constructor { preview_x_max = 0; if(array_length(pseq) > 1) { - var _xx = tool_side_drawing * ui(40); + var _xx = tool_side_draw_l * ui(40); var xx = _xx + preview_x + ui(8); var yy = h - toolbar_height - prev_size - ui(8); @@ -1195,7 +1198,8 @@ function Panel_Preview() : PanelContent() constructor { var cy = canvas_y + _node.preview_y * canvas_s; var _snx = 0, _sny = 0; - tool_side_drawing = _node.tools != -1; + tool_side_draw_l = _node.tools != -1; + tool_side_draw_r = _node.rightTools != -1; if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) { isHover = false; diff --git a/#backups/scripts/panel_preview/panel_preview.gml.backup1 b/#backups/scripts/panel_preview/panel_preview.gml.backup1 index 497cf17d7..fdf04ce87 100644 --- a/#backups/scripts/panel_preview/panel_preview.gml.backup1 +++ b/#backups/scripts/panel_preview/panel_preview.gml.backup1 @@ -1,4 +1,4 @@ -// 2024-04-18 15:02:59 +// 2024-04-21 14:21:06 #region funtion calls function __fnInit_Preview() { __registerFunction("preview_focus_content", panel_preview_focus_content); @@ -123,7 +123,8 @@ function Panel_Preview() : PanelContent() constructor { toolbar_height = ui(40); tool_hovering = false; - tool_side_drawing = false; + tool_side_draw_l = false; + tool_side_draw_r = false; overlay_hovering = false; sbChannel = new scrollBox([], function(index) { #region @@ -571,9 +572,11 @@ function Panel_Preview() : PanelContent() constructor { if(node != noone) bbox = node.getPreviewBoundingBox(); if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]); - var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); + var tl = tool_side_draw_l * 40; + var tr = tool_side_draw_r * 40; + var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); canvas_s = ss; - canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2); + canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2; canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s; } #endregion @@ -1117,7 +1120,7 @@ function Panel_Preview() : PanelContent() constructor { preview_x_max = 0; if(array_length(pseq) > 1) { - var _xx = tool_side_drawing * ui(40); + var _xx = tool_side_draw_l * ui(40); var xx = _xx + preview_x + ui(8); var yy = h - toolbar_height - prev_size - ui(8); @@ -1195,7 +1198,8 @@ function Panel_Preview() : PanelContent() constructor { var cy = canvas_y + _node.preview_y * canvas_s; var _snx = 0, _sny = 0; - tool_side_drawing = _node.tools != -1; + tool_side_draw_l = _node.tools != -1; + tool_side_draw_r = _node.rightTools != -1; if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) { isHover = false; diff --git a/objects/o_dialog_image_array_edit/Create_0.gml b/objects/o_dialog_image_array_edit/Create_0.gml index 339fead90..eae25090e 100644 --- a/objects/o_dialog_image_array_edit/Create_0.gml +++ b/objects/o_dialog_image_array_edit/Create_0.gml @@ -116,7 +116,9 @@ event_inherited(); menuItem(__txt("Remove"), function() { var arr = target.getInputData(0); array_delete(arr, menuOn, 1); + target.inputs[| 0].setValue(arr); + target.triggerRender(); }) ],, target ); } @@ -133,8 +135,9 @@ event_inherited(); var val = arr[oldindex]; array_delete(arr, oldindex, 1); array_insert(arr, newindex, val); + target.inputs[| 0].setValue(arr); - target.doUpdate(); + target.triggerRender(); } sortAsc = true; @@ -146,6 +149,6 @@ event_inherited(); sortAsc = !sortAsc; target.inputs[| 0].setValue(arr); - target.doUpdate(); + target.triggerRender(); } #endregion \ No newline at end of file diff --git a/objects/o_dialog_image_array_edit/Draw_64.gml b/objects/o_dialog_image_array_edit/Draw_64.gml index 8db3e4f18..fd425ad6f 100644 --- a/objects/o_dialog_image_array_edit/Draw_64.gml +++ b/objects/o_dialog_image_array_edit/Draw_64.gml @@ -39,6 +39,7 @@ if !target exit; array_push(arr, paths[i]); target.inputs[| 0].setValue(arr); + target.triggerRender(); } } diff --git a/scripts/canvas_draw_functions/canvas_draw_functions.gml b/scripts/canvas_draw_functions/canvas_draw_functions.gml index e0ac59618..61995b109 100644 --- a/scripts/canvas_draw_functions/canvas_draw_functions.gml +++ b/scripts/canvas_draw_functions/canvas_draw_functions.gml @@ -18,7 +18,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed); var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r); - draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha()); + draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha()); if(_draw) brush.brush_seed = irandom_range(100000, 999999); } diff --git a/scripts/canvas_tool_brush/canvas_tool_brush.gml b/scripts/canvas_tool_brush/canvas_tool_brush.gml index edb38b065..9252c2afd 100644 --- a/scripts/canvas_tool_brush/canvas_tool_brush.gml +++ b/scripts/canvas_tool_brush/canvas_tool_brush.gml @@ -33,7 +33,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { } if(mouse_press(mb_left, active)) { - + surface_set_shader(drawing_surface, noone); canvas_draw_point_brush(brush, mouse_cur_x, mouse_cur_y, true); surface_reset_shader(); @@ -121,5 +121,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor { draw_text(_x1 + 8, (_y0 + _y1) / 2, _h); } } - } \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 661d67624..9e05de74f 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.rc3"; - BUILD_NUMBER = 11700; + VERSION_STRING = "1.17.rc4"; + BUILD_NUMBER = 11704; globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 2c5e6fa5b..9c9756e82 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -862,7 +862,6 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); - #endregion var _x0 = _x; diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 1dd25a2f1..08c682b7a 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -122,7 +122,8 @@ function Panel_Preview() : PanelContent() constructor { toolbar_height = ui(40); tool_hovering = false; - tool_side_drawing = false; + tool_side_draw_l = false; + tool_side_draw_r = false; overlay_hovering = false; sbChannel = new scrollBox([], function(index) { #region @@ -570,9 +571,11 @@ function Panel_Preview() : PanelContent() constructor { if(node != noone) bbox = node.getPreviewBoundingBox(); if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]); - var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); + var tl = tool_side_draw_l * 40; + var tr = tool_side_draw_r * 40; + var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h); canvas_s = ss; - canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2); + canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2; canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s; } #endregion @@ -1116,7 +1119,7 @@ function Panel_Preview() : PanelContent() constructor { preview_x_max = 0; if(array_length(pseq) > 1) { - var _xx = tool_side_drawing * ui(40); + var _xx = tool_side_draw_l * ui(40); var xx = _xx + preview_x + ui(8); var yy = h - toolbar_height - prev_size - ui(8); @@ -1194,7 +1197,8 @@ function Panel_Preview() : PanelContent() constructor { var cy = canvas_y + _node.preview_y * canvas_s; var _snx = 0, _sny = 0; - tool_side_drawing = _node.tools != -1; + tool_side_draw_l = _node.tools != -1; + tool_side_draw_r = _node.rightTools != -1; if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) { isHover = false;