From 0009a20ba349e2d32d4ff8ed5443f2ef982778dd Mon Sep 17 00:00:00 2001 From: Tanasart Date: Wed, 19 Jun 2024 14:04:03 +0700 Subject: [PATCH] - [Animation Panel] Add Ctrl+Click to edit keyframe value directly. --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_value_editor/Create_0.gml | 47 +++++++ objects/o_dialog_value_editor/Draw_64.gml | 24 ++++ .../o_dialog_value_editor.yy | 39 ++++++ scripts/__sliderRange/__sliderRange.gml | 8 +- scripts/addon_lua_widget/addon_lua_widget.gml | 2 +- scripts/areaBox/areaBox.gml | 82 ++++++------ scripts/checkboxGroup/checkboxGroup.gml | 6 +- scripts/controlPointBox/controlPointBox.gml | 18 +-- scripts/cornerBox/cornerBox.gml | 14 +-- scripts/draw_tooltip/draw_tooltip.gml | 119 ++++++++++-------- scripts/matrixGrid/matrixGrid.gml | 38 +++--- scripts/node_global/node_global.gml | 18 +-- scripts/node_value/node_value.gml | 39 +++--- scripts/paddingBox/paddingBox.gml | 14 +-- scripts/panel_animation/panel_animation.gml | 57 +++++++-- .../panel_graph_export_image.gml | 36 +++--- .../panel_graph_export_image_dialog.gml | 81 +++++++----- .../panel_node_canvas_pressure.gml | 2 +- .../panel_preview_3d_setting.gml | 2 +- .../panel_preview_grid_setting.gml | 2 +- scripts/pathAnchorBox/pathAnchorBox.gml | 14 +-- scripts/project_data/project_data.gml | 4 +- scripts/quarternionBox/quarternionBox.gml | 14 +-- scripts/rangeBox/rangeBox.gml | 14 +-- scripts/rotatorRandom/rotatorRandom.gml | 53 ++++---- scripts/rotatorRange/rotatorRange.gml | 10 +- scripts/sliderRange/sliderRange.gml | 4 +- scripts/textArea/textArea.gml | 4 +- scripts/textBox/textBox.gml | 2 +- scripts/transformBox/transformBox.gml | 12 +- scripts/vectorBox/vectorBox.gml | 14 +-- scripts/vectorRangeBox/vectorRangeBox.gml | 20 +-- scripts/widget/widget.gml | 13 +- 35 files changed, 505 insertions(+), 323 deletions(-) create mode 100644 objects/o_dialog_value_editor/Create_0.gml create mode 100644 objects/o_dialog_value_editor/Draw_64.gml create mode 100644 objects/o_dialog_value_editor/o_dialog_value_editor.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 5d3510cb8..c69f35d9e 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -260,6 +260,7 @@ {"name":"o_dialog_splash","order":9,"path":"objects/o_dialog_splash/o_dialog_splash.yy",}, {"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, {"name":"o_dialog_textbox_function_guide","order":8,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",}, + {"name":"o_dialog_value_editor","order":9,"path":"objects/o_dialog_value_editor/o_dialog_value_editor.yy",}, {"name":"o_dialog_warning","order":10,"path":"objects/o_dialog_warning/o_dialog_warning.yy",}, {"name":"o_main","order":1,"path":"objects/o_main/o_main.yy",}, {"name":"o_pie_menu","order":14,"path":"objects/o_pie_menu/o_pie_menu.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index ccdf31d8f..22cc990fa 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -568,6 +568,7 @@ {"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},}, {"id":{"name":"o_dialog_textbox_autocomplete","path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",},}, {"id":{"name":"o_dialog_textbox_function_guide","path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",},}, + {"id":{"name":"o_dialog_value_editor","path":"objects/o_dialog_value_editor/o_dialog_value_editor.yy",},}, {"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},}, {"id":{"name":"o_main","path":"objects/o_main/o_main.yy",},}, {"id":{"name":"o_pie_menu","path":"objects/o_pie_menu/o_pie_menu.yy",},}, diff --git a/objects/o_dialog_value_editor/Create_0.gml b/objects/o_dialog_value_editor/Create_0.gml new file mode 100644 index 000000000..6dc717536 --- /dev/null +++ b/objects/o_dialog_value_editor/Create_0.gml @@ -0,0 +1,47 @@ +/// @description init +event_inherited(); + +#region data + dialog_w = ui(240); + dialog_h = TEXTBOX_HEIGHT + ui(8); + draggable = false; + + destroy_on_click_out = true; + + junction = noone; + keyframe = noone; + editWidget = noone; + + wid_h = 0; + + function setKey(_key) { + self.keyframe = _key; + junction = _key.anim.prop; + if(!junction.editWidget) { + instance_destroy(); + return self; + } + + editWidget = junction.editWidget.clone(); + if(editWidget == noone) { + instance_destroy(); + return self; + } + + editWidget.onModify = function(val, index = noone) { + var v = keyframe.value; + if(is_array(v)) { + if(index >= 0) + v[index] = val; + else if(is_array(val)) + v = val; + } else + v = val; + + keyframe.value = v; + junction.node.triggerRender(); + }; + + return self; + } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_value_editor/Draw_64.gml b/objects/o_dialog_value_editor/Draw_64.gml new file mode 100644 index 000000000..fd23682ca --- /dev/null +++ b/objects/o_dialog_value_editor/Draw_64.gml @@ -0,0 +1,24 @@ +/// @description init +if(editWidget == noone) exit; + +#region Draw + draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h); + draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); + + editWidget.setFocusHover(sFOCUS, sHOVER); + + var eX = dialog_x + ui(4); + var eY = dialog_y + ui(4); + var eW = dialog_w - ui(8); + + var param = new widgetParam(eX, eY, eW, TEXTBOX_HEIGHT, keyframe.value, junction.display_data); + var _h = editWidget.drawParam(param); + + dialog_h = _h + ui(8); + + if(wid_h != dialog_h) { + dialog_y = min(dialog_y, WIN_H - dialog_h - ui(8)); + wid_h = dialog_h; + } + +#endregion \ No newline at end of file diff --git a/objects/o_dialog_value_editor/o_dialog_value_editor.yy b/objects/o_dialog_value_editor/o_dialog_value_editor.yy new file mode 100644 index 000000000..79f259889 --- /dev/null +++ b/objects/o_dialog_value_editor/o_dialog_value_editor.yy @@ -0,0 +1,39 @@ +{ + "$GMObject":"", + "%Name":"o_dialog_value_editor", + "eventList":[ + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + ], + "managed":true, + "name":"o_dialog_value_editor", + "overriddenProperties":[], + "parent":{ + "name":"widget", + "path":"folders/dialog/widget.yy", + }, + "parentObjectId":{ + "name":"_p_dialog", + "path":"objects/_p_dialog/_p_dialog.yy", + }, + "persistent":false, + "physicsAngularDamping":0.1, + "physicsDensity":0.5, + "physicsFriction":0.2, + "physicsGroup":1, + "physicsKinematic":false, + "physicsLinearDamping":0.1, + "physicsObject":false, + "physicsRestitution":0.1, + "physicsSensor":false, + "physicsShape":1, + "physicsShapePoints":[], + "physicsStartAwake":true, + "properties":[], + "resourceType":"GMObject", + "resourceVersion":"2.0", + "solid":false, + "spriteId":null, + "spriteMaskId":null, + "visible":true, +} \ No newline at end of file diff --git a/scripts/__sliderRange/__sliderRange.gml b/scripts/__sliderRange/__sliderRange.gml index 8fab30c09..f33dc2dbf 100644 --- a/scripts/__sliderRange/__sliderRange.gml +++ b/scripts/__sliderRange/__sliderRange.gml @@ -9,8 +9,8 @@ function __sliderRange(_min, _max, _step, _onModify) : widget() constructor { dragging = noone; drag_sv = 0; - tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, minn, maxx)); }); - tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, minn, maxx)); }); + tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, minn, maxx), 0); }); + tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, minn, maxx), 1); }); tb_value_min.slidable = true; tb_value_max.slidable = true; @@ -83,13 +83,13 @@ function __sliderRange(_min, _max, _step, _onModify) : widget() constructor { if(key_mod_press(CTRL)) val = round(val); - if(onModify(dragging_index, val)) + if(onModify(val, dragging_index)) UNDO_HOLDING = true; MOUSE_BLOCK = true; if(mouse_check_button_pressed(mb_right)) { - onModify(dragging_index, drag_sv); + onModify(drag_sv, dragging_index); instance_destroy(dragging); dragging = noone; UNDO_HOLDING = false; diff --git a/scripts/addon_lua_widget/addon_lua_widget.gml b/scripts/addon_lua_widget/addon_lua_widget.gml index cee82b00a..36f0d9ce4 100644 --- a/scripts/addon_lua_widget/addon_lua_widget.gml +++ b/scripts/addon_lua_widget/addon_lua_widget.gml @@ -60,7 +60,7 @@ end", if(_addon == noone) return noone; var wd = new vectorBox(size, noone); - wd.setLua(_addon.thread, onModify, function(i, v) { + wd.setLua(_addon.thread, onModify, function(v, i) { return lua_call(lua_thread, lua_thread_key, i + 1, v); }); diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index 1d7ebf157..0dfcbee45 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -37,56 +37,56 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { onModifySingle[0] = function(val) { #region var v = toNumber(val); - var m = onModify(0, v); + var m = onModify(v, 0); if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) return m; - m |= onModify(1, v); - m |= onModify(2, v); - m |= onModify(3, v); + m |= onModify(v, 1); + m |= onModify(v, 2); + m |= onModify(v, 3); return m; } #endregion onModifySingle[1] = function(val) { #region var v = toNumber(val); - var m = onModify(1, v); + var m = onModify(v, 1); if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) return m; - m |= onModify(0, v); - m |= onModify(2, v); - m |= onModify(3, v); + m |= onModify(v, 0); + m |= onModify(v, 2); + m |= onModify(v, 3); return m; } #endregion onModifySingle[2] = function(val) { #region var v = toNumber(val); - var m = onModify(2, v); + var m = onModify(v, 2); if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) return m; - m |= onModify(0, v); - m |= onModify(1, v); - m |= onModify(3, v); + m |= onModify(v, 0); + m |= onModify(v, 1); + m |= onModify(v, 3); return m; } #endregion onModifySingle[3] = function(val) { #region var v = toNumber(val); - var m = onModify(3, v); + var m = onModify(v, 3); if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) return m; - m |= onModify(0, v); - m |= onModify(1, v); - m |= onModify(2, v); + m |= onModify(v, 0); + m |= onModify(v, 1); + m |= onModify(v, 2); return m; } #endregion @@ -181,10 +181,10 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var sh = array_safe_get_fast(_data, 3); var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize(); - onModify(0, ss[0] - (cx + sw)); - onModify(1, cy - sh); - onModify(2, cx - sw); - onModify(3, ss[1] - (cy + sh)); + onModify(ss[0] - (cx + sw), 0); + onModify(cy - sh, 1); + onModify(cx - sw, 2); + onModify(ss[1] - (cy + sh), 3); break; case AREA_MODE.padding : //padding to two points @@ -194,10 +194,10 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var b = array_safe_get_fast(_data, 3); var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize(); - onModify(0, l); - onModify(1, t); - onModify(2, ss[0] - r); - onModify(3, ss[1] - b); + onModify(l, 0); + onModify(t, 1); + onModify(ss[0] - r, 2); + onModify(ss[1] - b, 3); break; case AREA_MODE.two_point : //twp points to area @@ -206,14 +206,14 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var x1 = array_safe_get_fast(_data, 2); var y1 = array_safe_get_fast(_data, 3); - onModify(0, (x0 + x1) / 2); - onModify(1, (y0 + y1) / 2); - onModify(2, abs(x0 - x1) / 2); - onModify(3, abs(y0 - y1) / 2); + onModify( (x0 + x1) / 2, 0); + onModify( (y0 + y1) / 2, 1); + onModify(abs(x0 - x1) / 2, 2); + onModify(abs(y0 - y1) / 2, 3); break; } - onModify(5, (mode + 1) % 3); + onModify((mode + 1) % 3, 5); } #endregion var _bx = _x + _w - _bs; @@ -226,24 +226,24 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { switch(mode) { case AREA_MODE.area : var ss = onSurfaceSize(); - onModify(0, cnvt? 0.5 : ss[0] / 2); - onModify(1, cnvt? 0.5 : ss[1] / 2); - onModify(2, cnvt? 0.5 : ss[0] / 2); - onModify(3, cnvt? 0.5 : ss[1] / 2); + onModify(cnvt? 0.5 : ss[0] / 2, 0); + onModify(cnvt? 0.5 : ss[1] / 2, 1); + onModify(cnvt? 0.5 : ss[0] / 2, 2); + onModify(cnvt? 0.5 : ss[1] / 2, 3); break; case AREA_MODE.padding : var ss = onSurfaceSize(); onModify(0, 0); - onModify(1, 0); - onModify(2, 0); - onModify(3, 0); + onModify(0, 1); + onModify(0, 2); + onModify(0, 3); break; case AREA_MODE.two_point : var ss = onSurfaceSize(); - onModify(0, 0); - onModify(1, 0); - onModify(2, cnvt? 1 : ss[0]); - onModify(3, cnvt? 1 : ss[1]); + onModify(0, 0); + onModify(0, 1); + onModify(cnvt? 1 : ss[0], 2); + onModify(cnvt? 1 : ss[1], 3); break; } } #endregion @@ -257,7 +257,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { if(useShape && !is_array(_bind) && buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _bact, _bhov,, THEME.inspector_area, _bind) == 2) { var val = (array_safe_get_fast(_data, 4) + 1) % 2; - onModify(4, val); + onModify(val, 4); } if(mode == AREA_MODE.padding) { diff --git a/scripts/checkboxGroup/checkboxGroup.gml b/scripts/checkboxGroup/checkboxGroup.gml index 73cf58171..12f5ccc94 100644 --- a/scripts/checkboxGroup/checkboxGroup.gml +++ b/scripts/checkboxGroup/checkboxGroup.gml @@ -6,7 +6,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor { holding = noone; tooltips = []; - static trigger = function(ind, val) { onClick(ind, val); } + static trigger = function(value, index) { onClick(value, index); } static setTooltips = function(tt) { tooltips = tt; return self; } static drawParam = function(params) { @@ -47,10 +47,10 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor { TOOLTIP = array_safe_get(tooltips, i, ""); if(holding != noone) - trigger(i, holding); + trigger(holding, i); if(mouse_press(mb_left, active)) { - trigger(i, !_value[i]); + trigger(!_value[i], i); holding = _value[i]; } } else diff --git a/scripts/controlPointBox/controlPointBox.gml b/scripts/controlPointBox/controlPointBox.gml index 45e8b7dbe..580f9b339 100644 --- a/scripts/controlPointBox/controlPointBox.gml +++ b/scripts/controlPointBox/controlPointBox.gml @@ -18,15 +18,15 @@ function controlPointBox(_onModify) : widget() constructor { onModify = _onModify; onSurfaceSize = -1; - tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); }); tbCx.hide = true; tbCx.slidable = true; - tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); }); tbCy.hide = true; tbCy.slidable = true; - tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); }); tbFx.hide = true; tbFx.slidable = true; - tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFy.hide = true; tbFy.slidable = true; - tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); tbW.hide = true; tbW.slidable = true; - tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); tbH.hide = true; tbH.slidable = true; - rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); + tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.cx ); }); tbCx.hide = true; tbCx.slidable = true; + tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.cy ); }); tbCy.hide = true; tbCy.slidable = true; + tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fx ); }); tbFx.hide = true; tbFx.slidable = true; + tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fy ); }); tbFy.hide = true; tbFy.slidable = true; + tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(max(0, toNumber(val)), PUPPET_CONTROL.width ); }); tbW.hide = true; tbW.slidable = true; + tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(max(0, toNumber(val)), PUPPET_CONTROL.height); }); tbH.hide = true; tbH.slidable = true; + rot = new rotator(function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fy); }); - sW = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(PUPPET_CONTROL.width, toNumber(val)); }) + sW = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(toNumber(val), PUPPET_CONTROL.width); }) .setSlidable(0.01, false, [ 1, 32 ]); tbCx.label = "cx"; @@ -39,7 +39,7 @@ function controlPointBox(_onModify) : widget() constructor { scMode = new scrollBox( sMode, - function(val) { onModify(PUPPET_CONTROL.mode, toNumber(val)); } + function(val) { onModify(toNumber(val), PUPPET_CONTROL.mode); } ); widgets = [ scMode, tbCx, tbCy, tbFx, tbFy, tbW, tbH, rot, sW ]; diff --git a/scripts/cornerBox/cornerBox.gml b/scripts/cornerBox/cornerBox.gml index 7e1882051..b0b7b0af4 100644 --- a/scripts/cornerBox/cornerBox.gml +++ b/scripts/cornerBox/cornerBox.gml @@ -6,20 +6,20 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor { b_link = button(function() { linked = !linked; }); b_link.icon = THEME.value_link; - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { if(linked) { for( var i = 0; i < 4; i++ ) - onModify(i, toNumber(val)); + onModify(toNumber(val), i); return; } - onModify(index, toNumber(val)); + onModify(toNumber(val), index); } - onModifySingle[0] = function(val) { onModifyIndex(0, val); } - onModifySingle[1] = function(val) { onModifyIndex(1, val); } - onModifySingle[2] = function(val) { onModifyIndex(2, val); } - onModifySingle[3] = function(val) { onModifyIndex(3, val); } + onModifySingle[0] = function(val) { onModifyIndex(val, 0); } + onModifySingle[1] = function(val) { onModifyIndex(val, 1); } + onModifySingle[2] = function(val) { onModifyIndex(val, 2); } + onModifySingle[3] = function(val) { onModifyIndex(val, 3); } labels = [ "r", "t", "l", "b" ]; diff --git a/scripts/draw_tooltip/draw_tooltip.gml b/scripts/draw_tooltip/draw_tooltip.gml index fc2c9aacc..a1fffd1e5 100644 --- a/scripts/draw_tooltip/draw_tooltip.gml +++ b/scripts/draw_tooltip/draw_tooltip.gml @@ -9,12 +9,13 @@ function draw_tooltip_text(txt) { #region var tw = min(max(320, WIN_W * 0.4), string_width(txt)); var th = string_height_ext(txt, -1, tw); - var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (th + ui(16))); + var pd = ui(8); + var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); - draw_text_line(mx + ui(8), my + ui(8), txt, -1, tw); + draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2); + draw_text_line(mx + pd, my + pd, txt, -1, tw); } #endregion function draw_tooltip_color(clr) { #region @@ -26,14 +27,15 @@ function draw_tooltip_color(clr) { #region var ww = ui(32); var hh = ui(32); - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - draw_set_color(clr); - draw_rectangle(mx + ui(8), my + ui(8), mx + ui(ww + 8), my + ui(hh + 8), false); + draw_sprite_stretched_ext(THEME.menu_button_mask, 0, mx + pd, my + pd, ww, hh, clr, 1); + draw_sprite_stretched_add(THEME.menu_button_mask, 1, mx + pd, my + pd, ww, hh, c_white, 0.3); } #endregion function draw_tooltip_palette(clr) { #region @@ -49,17 +51,20 @@ function draw_tooltip_palette(clr) { #region var ww = min(ui(160), ui(32) * pal_len); var hh = array_length(clr) * ph; - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - var _y = my + ui(8); + var _y = my + pd; for( var i = 0, n = array_length(clr); i < n; i++ ) { - drawPalette(clr[i], mx + ui(8), _y, ui(ww), ph); + drawPalette(clr[i], mx + pd, _y, ui(ww), ph); _y += ph; } + + draw_sprite_stretched_add(THEME.menu_button_mask, 1, mx + pd, my + pd, ww, hh, c_white, 0.3); } #endregion function draw_tooltip_gradient(clr) { #region @@ -69,15 +74,16 @@ function draw_tooltip_gradient(clr) { #region var ww = ui(160); var hh = array_length(clr) * gh; - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - var _y = my + ui(8); + var _y = my + pd; for( var i = 0, n = array_length(clr); i < n; i++ ) { - clr[i].draw(mx + ui(8), _y, ui(ww), gh); + clr[i].draw(mx + pd, _y, ui(ww), gh); _y += gh; } } #endregion @@ -101,11 +107,12 @@ function draw_tooltip_surface_array(surf) { #region var ww = sw * col; var hh = sh * row; - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); for( var ind = 0; ind < amo; ind++ ) { if(!is_surface(surf[ind])) continue; @@ -116,8 +123,8 @@ function draw_tooltip_surface_array(surf) { #region var sw = surface_get_width_safe(surf[ind]); var sh = surface_get_height_safe(surf[ind]); var ss = nn / max(sw, sh); - var cx = mx + ui(8) + j * nn + nn / 2; - var cy = my + ui(8) + i * nn + nn / 2; + var cx = mx + pd + j * nn + nn / 2; + var cy = my + pd + i * nn + nn / 2; draw_surface_ext_safe(surf[ind], cx - sw * ss / 2, cy - sh * ss / 2, ss, ss, 0, c_white, 1); draw_set_color(COLORS._main_icon); @@ -146,13 +153,14 @@ function draw_tooltip_surface(surf) { #region var ww = sw * ss; var hh = sh * ss; - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - draw_surface_ext_safe(surf, mx + ui(8), my + ui(8), ss, ss); + draw_surface_ext_safe(surf, mx + pd, my + pd, ss, ss); } #endregion function draw_tooltip_sprite(spr) { #region @@ -170,20 +178,21 @@ function draw_tooltip_sprite(spr) { #region var ww = sw * ss * sn + 2 * (sn - 1); var hh = sh * ss + ui(16); - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - var sx = mx + ui(8) + ox * ss; - var sy = my + ui(8) + oy * ss; + var sx = mx + pd + ox * ss; + var sy = my + pd + oy * ss; for( var i = 0; i < sn; i++ ) draw_sprite_ext(spr, i, sx + i * (sw * ss + 2), sy, ss, ss, 0, c_white, 1); draw_set_text(f_p3, fa_center, fa_bottom, COLORS._main_text_sub); - draw_text(mx + (ww + ui(16)) / 2, my + hh + ui(16 - 4), $"{sw} x {sh} px"); + draw_text(mx + (ww + pd * 2) / 2, my + hh + pd * 2 - ui(4), $"{sw} x {sh} px"); } #endregion function draw_tooltip_atlas(atlas) { #region @@ -195,14 +204,15 @@ function draw_tooltip_atlas(atlas) { #region if(amo && is_array(atlas[0])) return; - var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); + var pd = ui(4); + var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); + draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2); - var sx = mx + ui(8); - var sy = my + ui(8); + var sx = mx + pd; + var sy = my + pd; for( var i = 0; i < amo; i++ ) { var _y = sy + i * ui(48 + 8); @@ -215,7 +225,7 @@ function draw_tooltip_atlas(atlas) { #region var sw = surface_get_width_safe(surf); var sh = surface_get_height_safe(surf); - + var ss = min(ui(48) / sw, ui(48) / sh); draw_surface_ext_safe(surf, sx, _y, ss, ss); @@ -247,15 +257,16 @@ function draw_tooltip_buffer(buff) { #region if(len > 400) th += string_height(" "); - var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16))); - var my = min(mouse_my + ui(16), WIN_H - (th + ui(16))); + var pd = ui(8); + var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2)); + var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2)); - draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); - draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); - draw_text_line(mx + ui(8), my + ui(8), txt, -1, tw); + draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2); + draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2); + draw_text_line(mx + pd, my + pd, txt, -1, tw); if(len > 400) { draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub); - draw_text(mx + ui(8), my + th + ui(8), $"...({buffer_get_size(buff)} bytes)"); + draw_text(mx + pd, my + th + pd, $"...({buffer_get_size(buff)} bytes)"); } } #endregion \ No newline at end of file diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index ec781853e..ccc06966e 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -9,37 +9,37 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct b_link = button(function() { linked = !linked; }); b_link.icon = THEME.value_link; - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { var modi = false; if(linked) { for( var i = 0; i < inputs; i++ ) - modi |= onModify(i, toNumber(val)); + modi |= onModify(toNumber(val), i); return modi; } - return onModify(index, toNumber(val)); + return onModify(toNumber(val), index); } - onModifySingle[0] = function(val) { return onModifyIndex(0, val); } - onModifySingle[1] = function(val) { return onModifyIndex(1, val); } - onModifySingle[2] = function(val) { return onModifyIndex(2, val); } - onModifySingle[3] = function(val) { return onModifyIndex(3, val); } + onModifySingle[0] = function(val) { return onModifyIndex(val, 0); } + onModifySingle[1] = function(val) { return onModifyIndex(val, 1); } + onModifySingle[2] = function(val) { return onModifyIndex(val, 2); } + onModifySingle[3] = function(val) { return onModifyIndex(val, 3); } - onModifySingle[4] = function(val) { return onModifyIndex(4, val); } - onModifySingle[5] = function(val) { return onModifyIndex(5, val); } - onModifySingle[6] = function(val) { return onModifyIndex(6, val); } - onModifySingle[7] = function(val) { return onModifyIndex(7, val); } + onModifySingle[4] = function(val) { return onModifyIndex(val, 4); } + onModifySingle[5] = function(val) { return onModifyIndex(val, 5); } + onModifySingle[6] = function(val) { return onModifyIndex(val, 6); } + onModifySingle[7] = function(val) { return onModifyIndex(val, 7); } - onModifySingle[ 8] = function(val) { return onModifyIndex( 8, val); } - onModifySingle[ 9] = function(val) { return onModifyIndex( 9, val); } - onModifySingle[10] = function(val) { return onModifyIndex(10, val); } - onModifySingle[11] = function(val) { return onModifyIndex(11, val); } + onModifySingle[ 8] = function(val) { return onModifyIndex(val, 8); } + onModifySingle[ 9] = function(val) { return onModifyIndex(val, 9); } + onModifySingle[10] = function(val) { return onModifyIndex(val, 10); } + onModifySingle[11] = function(val) { return onModifyIndex(val, 11); } - onModifySingle[12] = function(val) { return onModifyIndex(12, val); } - onModifySingle[13] = function(val) { return onModifyIndex(13, val); } - onModifySingle[14] = function(val) { return onModifyIndex(14, val); } - onModifySingle[15] = function(val) { return onModifyIndex(15, val); } + onModifySingle[12] = function(val) { return onModifyIndex(val, 12); } + onModifySingle[13] = function(val) { return onModifyIndex(val, 13); } + onModifySingle[14] = function(val) { return onModifyIndex(val, 14); } + onModifySingle[15] = function(val) { return onModifyIndex(val, 15); } extras = -1; diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index 8f8e55b11..d1e4ddf4d 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -23,19 +23,19 @@ function variable_editor(nodeVal) constructor { RENDER_ALL }); - vb_range = new vectorBox(2, function(index, val) { - slider_range[index] = val; + vb_range = new vectorBox(2, function(value, index) { + slider_range[index] = value; refreshInput(); }); - tb_step = new textBox(TEXTBOX_INPUT.number, function(val) { - slider_step = val; + tb_step = new textBox(TEXTBOX_INPUT.number, function(value) { + slider_step = value; refreshInput(); }); - sc_type = new scrollBox(val_type_name, function(val) { - type_index = val; - sc_disp.data_list = display_list[val]; + sc_type = new scrollBox(val_type_name, function(value) { + type_index = value; + sc_disp.data_list = display_list[value]; disp_index = 0; refreshInput(); @@ -43,8 +43,8 @@ function variable_editor(nodeVal) constructor { } ); sc_type.update_hover = false; - sc_disp = new scrollBox(display_list[0], function(val) { - disp_index = val; + sc_disp = new scrollBox(display_list[0], function(value) { + disp_index = value; refreshInput(); RENDER_ALL diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 26c64865a..da3bd4c53 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -391,8 +391,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru default : mapWidget = vec4? - new vectorRangeBox(4, TEXTBOX_INPUT.number, function(index, val) { return setValueDirect(val, index); }) : - new rangeBox(TEXTBOX_INPUT.number, function(index, val) { return setValueDirect(val, index); }); + new vectorRangeBox(4, TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); }) : + new rangeBox( TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); }); mapWidget.side_button = mapButton; break; } @@ -536,7 +536,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.range : #region - editWidget = new rangeBox(_txt, function(index, val) { return setValueInspector(val, index); } ); + editWidget = new rangeBox(_txt, function(val, index) { return setValueInspector(val, index); } ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); @@ -553,7 +553,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var len = array_length(val); if(len <= 4) { - editWidget = new vectorBox(len, function(index, val) { return setValueInspector(val, index); }, unit ); + editWidget = new vectorBox(len, function(val, index) { return setValueInspector(val, index); }, unit ); if(struct_has(display_data, "label")) editWidget.axis = display_data.label; if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable; @@ -588,7 +588,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru case VALUE_DISPLAY.vector_range : #region var val = animator.getValue(); - editWidget = new vectorRangeBox(array_length(val), _txt, function(index, val) { return setValueInspector(val, index); }, unit ); + editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); @@ -614,7 +614,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.rotation_range : #region - editWidget = new rotatorRange(function(index, val) { return setValueInspector(val, index); } ); + editWidget = new rotatorRange(function(val, index) { return setValueInspector(val, index); } ); for( var i = 0, n = array_length(animators); i < n; i++ ) animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i); @@ -623,7 +623,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.rotation_random : #region - editWidget = new rotatorRandom(function(index, val) { return setValueInspector(val, index); } ); + editWidget = new rotatorRandom(function(val, index) { return setValueInspector(val, index); } ); extract_node = "Node_Vector2"; break; #endregion @@ -644,7 +644,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]); editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ], - function(index, val) { return setValueInspector(val, index); } ); + function(val, index) { return setValueInspector(val, index); } ); for( var i = 0, n = array_length(animators); i < n; i++ ) animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i); @@ -653,7 +653,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.area : #region - editWidget = new areaBox(function(index, val) { return setValueInspector(val, index); }, unit); + editWidget = new areaBox(function(val, index) { return setValueInspector(val, index); }, unit); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); @@ -667,7 +667,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.padding : #region - editWidget = new paddingBox(function(index, val) { return setValueInspector(val, index); }, unit); + editWidget = new paddingBox(function(val, index) { return setValueInspector(val, index); }, unit); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); for( var i = 0, n = array_length(animators); i < n; i++ ) @@ -677,7 +677,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.corner : #region - editWidget = new cornerBox(function(index, val) { return setValueInspector(val, index); }, unit); + editWidget = new cornerBox(function(val, index) { return setValueInspector(val, index); }, unit); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); for( var i = 0, n = array_length(animators); i < n; i++ ) @@ -687,7 +687,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.puppet_control : #region - editWidget = new controlPointBox(function(index, val) { return setValueInspector(val, index); }); + editWidget = new controlPointBox(function(val, index) { return setValueInspector(val, index); }); extract_node = ""; break; #endregion @@ -720,7 +720,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.matrix : #region - editWidget = new matrixGrid(_txt, display_data.size, function(index, val) { return setValueInspector(val, index); }, unit ); + editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); for( var i = 0, n = array_length(animators); i < n; i++ ) @@ -730,7 +730,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.boolean_grid : #region - editWidget = new matrixGrid(_txt, display_data.size, function(index, val) { return setValueInspector(val, index); }, unit ); + editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit ); for( var i = 0, n = array_length(animators); i < n; i++ ) animators[i].suffix = $" {i}"; @@ -739,7 +739,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.transform : #region - editWidget = new transformBox(function(index, val) { return setValueInspector(val, index); }); + editWidget = new transformBox(function(val, index) { return setValueInspector(val, index); }); extract_node = "Node_Transform_Array"; break; #endregion @@ -753,14 +753,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.d3quarternion : #region - editWidget = new quarternionBox(function(index, val) { return setValueInspector(val, index); }); + editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); }); extract_node = "Node_Vector4"; display_data.angle_display = QUARTERNION_DISPLAY.euler; break; #endregion case VALUE_DISPLAY.path_anchor : #region - editWidget = new pathAnchorBox(function(index, val) { return setValueInspector(val, index); }); + editWidget = new pathAnchorBox(function(val, index) { return setValueInspector(val, index); }); extract_node = "Node_Path_Anchor"; break; #endregion @@ -1455,7 +1455,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } } #endregion - static setValueInspector = function(_val = 0, index = noone) { #region + static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) { #region INLINE var res = false; @@ -1472,7 +1472,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(_node == node) res = r; } } else { - res = setValueDirect(val, index); + res = setValueDirect(val, index, time); } return res; @@ -1520,6 +1520,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var _sval = val; if(is_array(_sval) && !array_empty(_sval)) _sval = _sval[0]; + if(is_instanceof(_sval, SurfaceAtlas)) draw_junction_index = VALUE_TYPE.atlas; } diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index 94482e189..458bd1d64 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -13,20 +13,20 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { b_link = button(function() { linked = !linked; }); b_link.icon = THEME.value_link; - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { if(linked) { for( var i = 0; i < 4; i++ ) - onModify(i, toNumber(val)); + onModify(toNumber(val), i); return; } - onModify(index, toNumber(val)); + onModify(toNumber(val), index); } - onModifySingle[0] = function(val) { onModifyIndex(0, val); } - onModifySingle[1] = function(val) { onModifyIndex(1, val); } - onModifySingle[2] = function(val) { onModifyIndex(2, val); } - onModifySingle[3] = function(val) { onModifyIndex(3, val); } + onModifySingle[0] = function(val) { onModifyIndex(val, 0); } + onModifySingle[1] = function(val) { onModifyIndex(val, 1); } + onModifySingle[2] = function(val) { onModifyIndex(val, 2); } + onModifySingle[3] = function(val) { onModifyIndex(val, 3); } for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index 9ed91d95e..f897092a0 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -1156,6 +1156,8 @@ function Panel_Animation() : PanelContent() constructor { } #endregion //// DRAW KEYFRAMES + __keyframe_editing = noone; + function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region var _node = _cont.node; var prop_y = animator.y; @@ -1199,12 +1201,49 @@ function Panel_Animation() : PanelContent() constructor { keyframe_dragout = false; keyframe_drag_mx = mx; keyframe_drag_my = my; + } else if(mouse_press(mb_left)) { - keyframe_dragging = keyframe; - keyframe_drag_type = KEYFRAME_DRAG_TYPE.move; - keyframe_drag_mx = mx; - keyframe_drag_my = my; - keyframe_drag_my = my; + if(key_mod_press(CTRL)) { + + var _wid = animator.prop.editWidget; + __keyframe_editing = keyframe; + + switch(animator.prop.type) { + case VALUE_TYPE.color : + switch(animator.prop.display_type) { + case VALUE_DISPLAY.palette : + var dialog = dialogCall(o_dialog_palette, WIN_W / 2, WIN_H / 2); + dialog.setDefault(keyframe.value); + dialog.onApply = function(val) { __keyframe_editing.value = val; }; + dialog.drop_target = _wid; + break; + + default : + var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); + dialog.setDefault(keyframe.value); + dialog.selector.onApply = function(val) { __keyframe_editing.value = val; }; + dialog.onApply = function(val) { __keyframe_editing.value = val; }; + dialog.drop_target = _wid; + } + break; + + case VALUE_TYPE.gradient : + var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2); + dialog.setDefault(keyframe.value.clone()); + dialog.onApply = function(val) { __keyframe_editing.value = val; }; + dialog.drop_target = _wid; + break; + + default : + dialogCall(o_dialog_value_editor, mouse_mx + ui(8), mouse_my + ui(8)).setKey(keyframe); + } + + } else { + keyframe_dragging = keyframe; + keyframe_drag_type = KEYFRAME_DRAG_TYPE.move; + keyframe_drag_mx = mx; + keyframe_drag_my = my; + } } } } @@ -1336,12 +1375,12 @@ function Panel_Animation() : PanelContent() constructor { _add = true; break; } else if(_key.time > CURRENT_FRAME) { - ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, animator.getValue(), animator)); + ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue()), animator)); _add = true; break; } } - if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(, false), animator)); + if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue(, false)), animator)); } #endregion @@ -1858,9 +1897,7 @@ function Panel_Animation() : PanelContent() constructor { if(!array_exists(keyframe_selecting, key_hover)) keyframe_selecting = [ key_hover ]; } - } - - if(mouse_press(mb_left, pFOCUS)) { + if(stagger_mode == 1) { if(key_hover == noone || !array_exists(keyframe_selecting, key_hover)) stagger_mode = 0; diff --git a/scripts/panel_graph_export_image/panel_graph_export_image.gml b/scripts/panel_graph_export_image/panel_graph_export_image.gml index 28d938e1e..fce51e138 100644 --- a/scripts/panel_graph_export_image/panel_graph_export_image.gml +++ b/scripts/panel_graph_export_image/panel_graph_export_image.gml @@ -1,5 +1,5 @@ function graph_export_image(allList, nodeList, settings = {}) { - var amo = ds_list_size(nodeList); + var amo = array_length(nodeList); if(amo < 1) return; var scale = struct_try_get(settings, "scale", 1); @@ -16,13 +16,13 @@ function graph_export_image(allList, nodeList, settings = {}) { var borderColor = struct_try_get(settings, "borderColor", c_white); var borderAlpha = struct_try_get(settings, "borderAlpha", 0.5); - var bbox_x0 = nodeList[| 0].x * scale; - var bbox_y0 = nodeList[| 0].y * scale; - var bbox_x1 = bbox_x0 + nodeList[| 0].w * scale; - var bbox_y1 = bbox_y0 + nodeList[| 0].h * scale; + var bbox_x0 = nodeList[0].x * scale; + var bbox_y0 = nodeList[0].y * scale; + var bbox_x1 = bbox_x0 + nodeList[0].w * scale; + var bbox_y1 = bbox_y0 + nodeList[0].h * scale; - for( var i = 0; i < ds_list_size(nodeList); i++ ) { - var _node = nodeList[| i]; + for( var i = 0; i < array_length(nodeList); i++ ) { + var _node = nodeList[i]; _node.draw_graph_culled = false; var _x = _node.x * scale; @@ -76,13 +76,13 @@ function graph_export_image(allList, nodeList, settings = {}) { draw_set_alpha(1); } - for(var i = 0; i < ds_list_size(allList); i++) - allList[| i].preDraw(gr_x, gr_y, scale); + for(var i = 0; i < array_length(allList); i++) + allList[i].preDraw(gr_x, gr_y, scale); #region draw frame - for(var i = 0; i < ds_list_size(nodeList); i++) { - if(instanceof(nodeList[| i]) != "Node_Frame") continue; - nodeList[| i].drawNode(gr_x, gr_y, mx, my, scale); + for(var i = 0; i < array_length(nodeList); i++) { + if(instanceof(nodeList[i]) != "Node_Frame") continue; + nodeList[i].drawNode(gr_x, gr_y, mx, my, scale); } #endregion @@ -100,8 +100,8 @@ function graph_export_image(allList, nodeList, settings = {}) { param.avoid_label = true; param.preview_scale = 100; - for(var i = 0; i < ds_list_size(nodeList); i++) - nodeList[| i].drawConnections(param, true); + for(var i = 0; i < array_length(nodeList); i++) + nodeList[i].drawConnections(param, true); surface_reset_target(); shader_set(sh_downsample); @@ -113,11 +113,11 @@ function graph_export_image(allList, nodeList, settings = {}) { #endregion #region draw node - for(var i = 0; i < ds_list_size(nodeList); i++) - nodeList[| i].onDrawNodeBehind(gr_x, gr_y, mx, my, scale); + for(var i = 0; i < array_length(nodeList); i++) + nodeList[i].onDrawNodeBehind(gr_x, gr_y, mx, my, scale); - for(var i = 0; i < ds_list_size(nodeList); i++) { - var _node = nodeList[| i]; + for(var i = 0; i < array_length(nodeList); i++) { + var _node = nodeList[i]; if(instanceof(_node) == "Node_Frame") continue; var val = _node.drawNode(gr_x, gr_y, mx, my, scale, param); } diff --git a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml index 4968d922a..839526ea5 100644 --- a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml +++ b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml @@ -1,8 +1,10 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { - title = __txtx("panel_export_graph", "Export Graph"); - w = ui(360); - h = ui(524); - min_h = h; + title = __txtx("panel_export_graph", "Export Graph"); + padding = ui(8); + w = ui(640); + h = ui(400); + set_w = ui(240); + surf_s = w - set_w - padding * 2; self.targetPanel = targetPanel; @@ -24,33 +26,45 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { borderAlpha : 0.05, }; - sel = 0; + sel = 0; nodes_select = [ "All nodes", "Selected" ]; - widgets = []; + widgets = []; + widgets[0] = [ "Nodes", new scrollBox(nodes_select, function(val) { sel = val; nodeList = val? ds_list_create_from_array(targetPanel.nodes_selecting) : targetPanel.nodes_list; refresh(); }, false), function() { return nodes_select[sel] } ]; + widgets[1] = [ "Scale", new textBox(TEXTBOX_INPUT.number, function(val) { settings.scale = val; refresh(); }), function() { return settings.scale } ]; + widgets[2] = [ "Padding", new textBox(TEXTBOX_INPUT.number, function(val) { settings.padding = val; refresh(); }), function() { return settings.padding } ]; + widgets[3] = [ "Solid Background", new checkBox(function() { settings.bgEnable = !settings.bgEnable; refresh(); }), function() { return settings.bgEnable } ]; + widgets[4] = [ "Background Color", new buttonColor(function(val) { settings.bgColor = val; refresh(); }), function() { return settings.bgColor } ]; + widgets[5] = [ "Render Grid", new checkBox(function() { settings.gridEnable = !settings.gridEnable; refresh(); }), function() { return settings.gridEnable } ]; + widgets[6] = [ "Grid Color", new buttonColor(function(val) { settings.gridColor = val; refresh(); }), function() { return settings.gridColor } ]; + widgets[7] = [ "Grid Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.gridAlpha = val; refresh(); }), function() { return settings.gridAlpha } ]; + widgets[8] = [ "Border", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderPad = val; refresh(); }), function() { return settings.borderPad } ]; + widgets[9] = [ "Border Color", new buttonColor(function(val) { settings.borderColor = val; refresh(); }), function() { return settings.borderColor } ]; + widgets[10] = [ "Border Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderAlpha = val; refresh(); }), function() { return settings.borderAlpha } ]; + - b_export = button(function() { #region + b_export = button(function() { if(!is_surface(surface)) return; var path = get_save_filename_pxc("image|*.png;*.jpg", "Screenshot"); @@ -59,9 +73,11 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { if(filename_ext(path) != ".png") path += ".png"; surface_save(surface, path); noti_status($"Graph image exported at {path}"); - }); #endregion + }); - sc_settings = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 204), function(_y, _m) { #region + b_export.text = __txt("Export") + "..."; + + sc_settings = new scrollPane(set_w, h - padding * 2, function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear, 0); var _ww = ui(160); @@ -89,13 +105,15 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { var _h = wh * array_length(widgets) + _hh; return _h; - }); #endregion + }); - function onResize() { #region - sc_settings.resize(w - ui(padding + padding), h - ui(title_height + padding + 204)); - } #endregion + function onResize() { + surf_s = w - set_w - padding * 2; + + sc_settings.resize(set_w, h - padding * 2); + } - function refresh() { #region + function refresh() { if(is_surface(surface)) surface_free(surface); surface = noone; @@ -104,54 +122,53 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { return; surface = graph_export_image(targetPanel.nodes_list, nodeList, settings); - } refresh(); #endregion + } refresh(); - function drawContent(panel) { #region + function drawContent(panel) { var tx = padding; var ty = padding; var sh = 160; + var _sx0 = tx, _sx1 = _sx0 + surf_s; + var _sy0 = ty, _sy1 = _sy0 + surf_s; + if(is_surface(surface)) { var _sw = surface_get_width_safe(surface); var _sh = surface_get_height_safe(surface); + var ss = min(surf_s / _sw, surf_s / _sh); - var ss = min((w - padding * 2) / _sw, sh / _sh); - draw_surface_ext_safe(surface, w / 2 - _sw * ss / 2, ty + sh / 2 - _sh * ss / 2, ss, ss, 0, c_white, 1); + draw_surface_ext_safe(surface, _sx0 + surf_s / 2 - _sw * ss / 2, + _sy0 + surf_s / 2 - _sh * ss / 2, ss, ss, 0, c_white, 1); draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub); - draw_text_add(w / 2, ty + sh - ui(2), $"{surface_get_width_safe(surface)} x {surface_get_height_safe(surface)} px"); + draw_text_add(w / 2, ty + sh - ui(2), $"{_sw} x {_sh} px"); } draw_set_color(COLORS._main_icon); - draw_rectangle(tx, ty, tx + w - padding * 2, ty + sh, 1); + draw_rectangle(_sx0, _sy0, _sx1, _sy1, 1); - var bx = w - padding - ui(4) - ui(24); - var by = padding + ui(4); + var bx = _sx1 - ui(24); + var by = _sy0; var _m = [ mx, my ]; if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, pFOCUS, pHOVER) == 2) refresh(); draw_sprite_ui(THEME.refresh_16, 0, bx + ui(12), by + ui(12),,,, COLORS._main_icon, 1); - var sx = tx; - var sy = ty + sh + ui(16); + var sx = _sx1; + var sy = _sy0; sc_settings.setFocusHover(pFOCUS, pHOVER); sc_settings.draw(sx, sy, mx - sx, my - sy); draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text); - var txt = __txt("Export") + "..."; - var _bw = string_width(txt) + ui(32); - var _bh = string_height(txt) + ui(12); + var _bw = ui(64); + var _bh = ui(24); bx = w - padding - _bw; by = h - padding - _bh; b_export.setInteract(is_surface(surface)); b_export.setFocusHover(pFOCUS, pHOVER); b_export.draw(bx, by, _bw, _bh, _m); - - draw_set_alpha(is_surface(surface) * 0.5 + 0.5); - draw_text(bx + ui(16), by + ui(6), txt); - draw_set_alpha(1); - } #endregion + } } \ No newline at end of file diff --git a/scripts/panel_node_canvas_pressure/panel_node_canvas_pressure.gml b/scripts/panel_node_canvas_pressure/panel_node_canvas_pressure.gml index 8df934d4f..7c4898ebc 100644 --- a/scripts/panel_node_canvas_pressure/panel_node_canvas_pressure.gml +++ b/scripts/panel_node_canvas_pressure/panel_node_canvas_pressure.gml @@ -15,7 +15,7 @@ function Panel_Node_Canvas_Pressure(canvas) : Panel_Linear_Setting() constructor ), new __Panel_Linear_Setting_Item( __txt("Size"), - new vectorBox(2, function(in, val) { canvas.tool_attribute.pressure_size[in] = val; }), + new vectorBox(2, function(value, index) { canvas.tool_attribute.pressure_size[index] = value; }), function() { return canvas.tool_attribute.pressure_size; }, function(val) { canvas.tool_attribute.pressure_size = val; }, [ 1, 1 ], diff --git a/scripts/panel_preview_3d_setting/panel_preview_3d_setting.gml b/scripts/panel_preview_3d_setting/panel_preview_3d_setting.gml index 65c52f313..1df530026 100644 --- a/scripts/panel_preview_3d_setting/panel_preview_3d_setting.gml +++ b/scripts/panel_preview_3d_setting/panel_preview_3d_setting.gml @@ -39,7 +39,7 @@ function Panel_Preview_3D_Setting(panel) : Panel_Linear_Setting() constructor { ), new __Panel_Linear_Setting_Item( __txt("View Plane"), - new vectorBox(2, function(index, value) { + new vectorBox(2, function(value, index) { if(index == 0) preview_panel.d3_view_camera.view_near = value; else if(index == 1) preview_panel.d3_view_camera.view_far = value; }), diff --git a/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml b/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml index 326e1e32f..4cd8c58fe 100644 --- a/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml +++ b/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml @@ -28,7 +28,7 @@ function Panel_Preview_Grid_Setting() : Panel_Linear_Setting() constructor { ), new __Panel_Linear_Setting_Item( __txt("Grid size"), - new vectorBox(2, function(index, value) { + new vectorBox(2, function(value, index) { var _v = PROJECT.previewGrid.size[index]; PROJECT.previewGrid.size[index] = max(1, value); diff --git a/scripts/pathAnchorBox/pathAnchorBox.gml b/scripts/pathAnchorBox/pathAnchorBox.gml index cb362859a..0b44376bb 100644 --- a/scripts/pathAnchorBox/pathAnchorBox.gml +++ b/scripts/pathAnchorBox/pathAnchorBox.gml @@ -1,13 +1,13 @@ function pathAnchorBox(_onModify) : widget() constructor { onModify = _onModify; - onModifySingle[0] = function(val) { return onModify(0, toNumber(val)); } - onModifySingle[1] = function(val) { return onModify(1, toNumber(val)); } + onModifySingle[0] = function(val) { return onModify(toNumber(val), 0); } + onModifySingle[1] = function(val) { return onModify(toNumber(val), 1); } - onModifySingle[2] = function(val) { return onModify(2, toNumber(val)); } - onModifySingle[3] = function(val) { return onModify(3, toNumber(val)); } - onModifySingle[4] = function(val) { return onModify(4, toNumber(val)); } - onModifySingle[5] = function(val) { return onModify(5, toNumber(val)); } + onModifySingle[2] = function(val) { return onModify(toNumber(val), 2); } + onModifySingle[3] = function(val) { return onModify(toNumber(val), 3); } + onModifySingle[4] = function(val) { return onModify(toNumber(val), 4); } + onModifySingle[5] = function(val) { return onModify(toNumber(val), 5); } for(var i = 0; i < 6; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); @@ -82,7 +82,7 @@ function pathAnchorBox(_onModify) : widget() constructor { var by = _ty + _th / 2 - _bw / 2; if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, active, hover, "Linked", THEME.value_link, !_linked, _blend) == 2) - onModify(6, !_linked); + onModify(!_linked, 6); resetFocus(); return h; diff --git a/scripts/project_data/project_data.gml b/scripts/project_data/project_data.gml index 47828fa7c..d5d6b9b09 100644 --- a/scripts/project_data/project_data.gml +++ b/scripts/project_data/project_data.gml @@ -72,8 +72,8 @@ attributeEditor = [ [ "Default Surface", "surface_dimension", new vectorBox(2, - function(ind, val) { - attributes.surface_dimension[ind] = val; + function(val, index) { + attributes.surface_dimension[index] = val; PROJECT_ATTRIBUTES.surface_dimension = array_clone(attributes.surface_dimension); RENDER_ALL return true; diff --git a/scripts/quarternionBox/quarternionBox.gml b/scripts/quarternionBox/quarternionBox.gml index 68abbf409..ca8fc37c4 100644 --- a/scripts/quarternionBox/quarternionBox.gml +++ b/scripts/quarternionBox/quarternionBox.gml @@ -8,11 +8,11 @@ function quarternionBox(_onModify) : widget() constructor { current_value = [ 0, 0, 0, 0 ]; current_unit = QUARTERNION_DISPLAY.quarterion; - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { var v = toNumber(val); if(current_unit == QUARTERNION_DISPLAY.quarterion) { - return onModify(index, v); + return onModify(v, index); } else { var v = toNumber(val); @@ -23,7 +23,7 @@ function quarternionBox(_onModify) : widget() constructor { ]; qv[index] = v; - return onModify(noone, qv); + return onModify(qv); } } @@ -34,10 +34,10 @@ function quarternionBox(_onModify) : widget() constructor { disp_w = noone; clickable = true; - onModifySingle[0] = function(val) { return onModifyIndex(0, val); } - onModifySingle[1] = function(val) { return onModifyIndex(1, val); } - onModifySingle[2] = function(val) { return onModifyIndex(2, val); } - onModifySingle[3] = function(val) { return onModifyIndex(3, val); } + onModifySingle[0] = function(val) { return onModifyIndex(val, 0); } + onModifySingle[1] = function(val) { return onModifyIndex(val, 1); } + onModifySingle[2] = function(val) { return onModifyIndex(val, 2); } + onModifySingle[3] = function(val) { return onModifyIndex(val, 3); } for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index 3c84dc284..01b5c279d 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -10,21 +10,21 @@ function rangeBox(_type, _onModify) : widget() constructor { __txtx("widget_range_constant", "Constant"), ]); - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { var modi = false; if(linked) { for( var i = 0; i < 2; i++ ) - modi |= onModify(i, toNumber(val)); + modi |= onModify(toNumber(val), i); return modi; } - return onModify(index, toNumber(val)); + return onModify(toNumber(val), index); } labels = [ "min", "max" ]; - onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } - onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } + onModifySingle[0] = function(val) { return onModifyIndex(toNumber(val), 0); } + onModifySingle[1] = function(val) { return onModifyIndex(toNumber(val), 1); } extras = -1; @@ -92,8 +92,8 @@ function rangeBox(_type, _onModify) : widget() constructor { _display_data.linked = linked; if(linked) { - onModify(0, _data[0]); - onModify(1, _data[0]); + onModify(_data[0], 0); + onModify(_data[0], 1); } } diff --git a/scripts/rotatorRandom/rotatorRandom.gml b/scripts/rotatorRandom/rotatorRandom.gml index 024f9769e..578227391 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -9,10 +9,10 @@ function rotatorRandom(_onModify) : widget() constructor { knob_hovering = noone; mode = 0; - tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_0.hide = true; - tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(2, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_0.hide = true; - tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(3, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_1.hide = true; - tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(4, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_1.hide = true; + tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_min_0.hide = true; + tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 2); } ).setSlidable([ 0.1, 15 ], true); tb_max_0.hide = true; + tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 3); } ).setSlidable([ 0.1, 15 ], true); tb_min_1.hide = true; + tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 4); } ).setSlidable([ 0.1, 15 ], true); tb_max_1.hide = true; tooltip = new tooltipSelector("Mode", [ __txtx("widget_rotator_random_range", "Range"), @@ -87,23 +87,26 @@ function rotatorRandom(_onModify) : widget() constructor { tooltip.index = mode; if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region mode = (mode + 1) % 4; - onModify(0, mode); + onModify(mode, 0); if(mode == 0) { - onModify(1, 0); - onModify(2, 180); + onModify( 0, 1); + onModify(180, 2); + } else if(mode == 1) { - onModify(1, (_data[1] + _data[2]) / 2); - onModify(2, abs(_data[1] - _data[2]) / 2); + onModify((_data[1] + _data[2]) / 2, 1); + onModify(abs(_data[1] - _data[2]) / 2, 2); + } else if(mode == 2) { - onModify(1, 0); - onModify(2, 90); - onModify(3, 180); - onModify(4, 270); + onModify(0, 1); + onModify(90, 2); + onModify(180, 3); + onModify(270, 4); + } else if(mode == 3) { - onModify(1, 45); - onModify(2, 225); - onModify(3, 45); + onModify(45, 1); + onModify(225, 2); + onModify(45, 3); } } #endregion @@ -139,17 +142,17 @@ function rotatorRandom(_onModify) : widget() constructor { curr_val[2] = round(dragging.delta_acc + drag_sv[2]); val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1]; - modi |= onModify(1, val); + modi |= onModify(val, 1); val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2]; - modi |= onModify(2, val); + modi |= onModify(val, 2); if(modi) UNDO_HOLDING = true; MOUSE_BLOCK = true; if(mouse_check_button_pressed(mb_right)) { - for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); + for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i); instance_destroy(rotator_Rotator); dragging = noone; @@ -214,12 +217,12 @@ function rotatorRandom(_onModify) : widget() constructor { real_val[1] = round(dragging.delta_acc + drag_sv[1]); val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1]; - if(onModify(1, val)) UNDO_HOLDING = true; + if(onModify(val, 1)) UNDO_HOLDING = true; MOUSE_BLOCK = true; if(mouse_check_button_pressed(mb_right)) { - for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); + for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i); instance_destroy(rotator_Rotator); dragging = noone; @@ -294,7 +297,7 @@ function rotatorRandom(_onModify) : widget() constructor { real_val[ind] = round(drag_sv[ind] + dragging.delta_acc); val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind]; - if(onModify(ind, val)) modi = true; + if(onModify(val, ind)) modi = true; } if(modi) { @@ -303,7 +306,7 @@ function rotatorRandom(_onModify) : widget() constructor { } if(mouse_check_button_pressed(mb_right)) { - for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); + for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i); instance_destroy(rotator_Rotator); dragging = noone; @@ -390,12 +393,12 @@ function rotatorRandom(_onModify) : widget() constructor { real_val[ind] = round(drag_sv[ind] + dragging.delta_acc); val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind]; - if(onModify(ind, val)) UNDO_HOLDING = true; + if(onModify(val, ind)) UNDO_HOLDING = true; MOUSE_BLOCK = true; if(mouse_check_button_pressed(mb_right)) { - for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); + for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i); instance_destroy(rotator_Rotator); dragging = noone; diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index ca0b7c073..6692dd767 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -8,8 +8,8 @@ function rotatorRange(_onModify) : widget() constructor { knob_hovering = noone; - tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true; - tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true; + tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 0); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true; + tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true; static setInteract = function(interactable = noone) { #region self.interactable = interactable; @@ -76,16 +76,16 @@ function rotatorRange(_onModify) : widget() constructor { real_val[1] = round(dragging.delta_acc + drag_sv[1]); val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0]; - modi |= onModify(0, val); + modi |= onModify(val, 0); val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1]; - modi |= onModify(1, val); + modi |= onModify(val, 1); if(modi) UNDO_HOLDING = true; MOUSE_BLOCK = true; if(mouse_check_button_pressed(mb_right)) { - for( var i = 0; i < 2; i++ ) onModify(i, drag_dat[i]); + for( var i = 0; i < 2; i++ ) onModify(drag_dat[i], i); instance_destroy(rotator_Rotator); dragging = noone; diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index 9de089326..e95d325f2 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -6,8 +6,8 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { onModify = _onModify; - tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range); - tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range); + tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, curr_range[0], curr_range[1]), 0); }).setSlidable(_step, _int, _range); + tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, curr_range[0], curr_range[1]), 1); }).setSlidable(_step, _int, _range); tb_value_min.hide = true; tb_value_max.hide = true; diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 818cad0c6..e2906479d 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -921,8 +921,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor ch_y += line_get_height(); } - cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 2); - cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 2); + cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 1); + cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 1); #endregion display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect); diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 1d2165312..14e40d403 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -649,7 +649,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { disp_x_to -= _w - ui(16); cursor_pos_y = c_y0; - cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 2); + cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 1); if(cursor_select > -1) { //draw highlight draw_set_color(COLORS.widget_text_highlight); diff --git a/scripts/transformBox/transformBox.gml b/scripts/transformBox/transformBox.gml index df4ab7e3e..c3f9d28fe 100644 --- a/scripts/transformBox/transformBox.gml +++ b/scripts/transformBox/transformBox.gml @@ -9,13 +9,13 @@ enum TRANSFORM { function transformBox(_onModify) : widget() constructor { onModify = _onModify; - onModifySingle[TRANSFORM.pos_x] = function(val) { onModify(TRANSFORM.pos_x, val); } - onModifySingle[TRANSFORM.pos_y] = function(val) { onModify(TRANSFORM.pos_y, val); } - onModifySingle[TRANSFORM.rot ] = function(val) { onModify(TRANSFORM.rot , val); } //unused - onModifySingle[TRANSFORM.sca_x] = function(val) { onModify(TRANSFORM.sca_x, val); } - onModifySingle[TRANSFORM.sca_y] = function(val) { onModify(TRANSFORM.sca_y, val); } + onModifySingle[TRANSFORM.pos_x] = function(val) { onModify(val, TRANSFORM.pos_x); } + onModifySingle[TRANSFORM.pos_y] = function(val) { onModify(val, TRANSFORM.pos_y); } + onModifySingle[TRANSFORM.rot ] = function(val) { onModify(val, TRANSFORM.rot ); } //unused + onModifySingle[TRANSFORM.sca_x] = function(val) { onModify(val, TRANSFORM.sca_x); } + onModifySingle[TRANSFORM.sca_y] = function(val) { onModify(val, TRANSFORM.sca_y); } - rot = new rotator(function(val) { onModify(TRANSFORM.rot, val); }); + rot = new rotator(function(val) { onModify(val, TRANSFORM.rot); }); labels = [ "x", "y", "rot", "sx", "sy" ]; diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index edce55b98..851ea6dba 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -18,7 +18,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { tooltip = new tooltipSelector("Axis", [ __txt("Independent"), __txt("Linked") ]); - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { var v = toNumber(val); if(linked) { @@ -27,21 +27,21 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { tb[i]._input_text = v; if(is_callable(onModify)) - modi |= onModify(i, v); + modi |= onModify(v, i); } return modi; } if(is_callable(onModify)) - return onModify(index, v); + return onModify(v, index); return noone; } axis = [ "x", "y", "z", "w" ]; - onModifySingle[0] = function(val) { return onModifyIndex(0, val); } - onModifySingle[1] = function(val) { return onModifyIndex(1, val); } - onModifySingle[2] = function(val) { return onModifyIndex(2, val); } - onModifySingle[3] = function(val) { return onModifyIndex(3, val); } + onModifySingle[0] = function(val) { return onModifyIndex(val, 0); } + onModifySingle[1] = function(val) { return onModifyIndex(val, 1); } + onModifySingle[2] = function(val) { return onModifyIndex(val, 2); } + onModifySingle[3] = function(val) { return onModifyIndex(val, 3); } for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index f27183f43..5ecf84335 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -12,22 +12,22 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const __txtx("widget_range_constant", "Constant"), ]); - onModifyIndex = function(index, val) { + onModifyIndex = function(val, index) { if(linked) { var modi = false; - modi |= onModify(floor(index / 2) * 2 + 0, toNumber(val)); - modi |= onModify(floor(index / 2) * 2 + 1, toNumber(val)); + modi |= onModify(toNumber(val), floor(index / 2) * 2 + 0); + modi |= onModify(toNumber(val), floor(index / 2) * 2 + 1); return modi; } - return onModify(index, toNumber(val)); + return onModify(toNumber(val), index); } axis = [ "x", "y", "z", "w"]; - onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } - onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } - onModifySingle[2] = function(val) { return onModifyIndex(2, toNumber(val)); } - onModifySingle[3] = function(val) { return onModifyIndex(3, toNumber(val)); } + onModifySingle[0] = function(val) { return onModifyIndex(toNumber(val), 0); } + onModifySingle[1] = function(val) { return onModifyIndex(toNumber(val), 1); } + onModifySingle[2] = function(val) { return onModifyIndex(toNumber(val), 2); } + onModifySingle[3] = function(val) { return onModifyIndex(toNumber(val), 3); } extras = -1; @@ -99,8 +99,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const if(linked) { for(var i = 0; i < size; i += 2) { - onModify(i + 0, _data[i]); - onModify(i + 1, _data[i]); + onModify(_data[i], i + 0); + onModify(_data[i], i + 1); } } } diff --git a/scripts/widget/widget.gml b/scripts/widget/widget.gml index a34a27865..f511432d7 100644 --- a/scripts/widget/widget.gml +++ b/scripts/widget/widget.gml @@ -1,10 +1,11 @@ function widget() constructor { - active = false; - hover = false; - hovering= false; - iactive = false; - ihover = false; - parent = noone; + active = false; + hover = false; + hovering = false; + iactive = false; + ihover = false; + parent = noone; + keyframe = noone; interactable = true; right_click_block = true;