diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index 0dfcbee45..a32133251 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -35,7 +35,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { __txtx("widget_area_two_points", "Two points"), ]); - onModifySingle[0] = function(val) { #region + onModifySingle[0] = function(val) { var v = toNumber(val); var m = onModify(v, 0); @@ -47,9 +47,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { m |= onModify(v, 3); return m; - } #endregion + } - onModifySingle[1] = function(val) { #region + onModifySingle[1] = function(val) { var v = toNumber(val); var m = onModify(v, 1); @@ -61,9 +61,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { m |= onModify(v, 3); return m; - } #endregion + } - onModifySingle[2] = function(val) { #region + onModifySingle[2] = function(val) { var v = toNumber(val); var m = onModify(v, 2); @@ -75,9 +75,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { m |= onModify(v, 3); return m; - } #endregion + } - onModifySingle[3] = function(val) { #region + onModifySingle[3] = function(val) { var v = toNumber(val); var m = onModify(v, 3); @@ -89,26 +89,26 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { m |= onModify(v, 2); return m; - } #endregion + } - for(var i = 0; i < 4; i++) { #region + for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i].slidable = true; tb[i].hide = true; - } #endregion + } - static setSlideSpeed = function(speed) { #region + static setSlideSpeed = function(speed) { for(var i = 0; i < 4; i++) tb[i].setSlidable(speed); - } #endregion + } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; for(var i = 0; i < 4; i++) tb[i].interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { switch(mode) { case AREA_MODE.two_point : case AREA_MODE.area : @@ -125,21 +125,21 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { if(unit != noone && unit.reference != noone) unit.triggerButton.register(parent); - } #endregion + } - static isHovering = function() { #region + static isHovering = function() { for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return false; - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); for(var i = 0; i < 4; i++) tb[i].setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { x = _x; y = _y; w = _w; @@ -172,7 +172,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var _bx = _x + _w - _bs; var _by = _y + _h / 2 - _bs / 2; - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode) == 2) { #region + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode) == 2) { switch(mode) { case AREA_MODE.area : //area to padding var cx = array_safe_get_fast(_data, 0); @@ -214,13 +214,13 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { } onModify((mode + 1) % 3, 5); - } #endregion + } var _bx = _x + _w - _bs; var _by = _y + _h + ui(4) + _h / 2 - _bs / 2; var _btxt = __txtx("widget_area_fill_surface", "Fill surface"); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, _btxt, THEME.fill, 0) == 2) { #region + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, _btxt, THEME.fill, 0) == 2) { var cnvt = unit != noone && unit.mode == VALUE_UNIT.reference; switch(mode) { @@ -246,12 +246,12 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { onModify(cnvt? 1 : ss[1], 3); break; } - } #endregion + } _w -= _bs + ui(4); } - if(_w - _bs > ui(100)) { #region + if(_w - _bs > ui(100)) { var _bx = _x; var _by = _y + _h / 2 - _bs / 2; @@ -274,13 +274,13 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { _x +=_bs + ui(4); } - } #endregion + } - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable); for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover); @@ -290,7 +290,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var tb_w = _w / 2; var tb_h = _h; - if(mode == AREA_MODE.area) { #region + if(mode == AREA_MODE.area) { var tb_x0 = _x; var tb_y0 = _y; @@ -308,9 +308,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m); tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m); - #endregion - } else if(mode == AREA_MODE.padding) { #region + + } else if(mode == AREA_MODE.padding) { var tb_lx = _x; var tb_ly = _y; @@ -334,9 +334,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { tb[1].draw(tb_tx, tb_ty, tb_w, tb_h, array_safe_get_fast(_data, 1), _m); tb[3].draw(tb_bx, tb_by, tb_w, tb_h, array_safe_get_fast(_data, 3), _m); - #endregion - } else if(mode == AREA_MODE.two_point) { #region + + } else if(mode == AREA_MODE.two_point) { var tb_x0 = _x; var tb_y0 = _y; @@ -354,17 +354,17 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m); tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m); - #endregion + } resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new areaBox(onModify, unit); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/button/button.gml b/scripts/button/button.gml index 4d7abb198..7e083aa08 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -19,56 +19,56 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { toggled = false; context = noone; - static setContext = function(struct) { #region + static setContext = function(struct) { onClick = method(struct, onClick); return self; - } #endregion + } - static setLua = function(_lua_thread, _lua_key, _lua_func) { #region + static setLua = function(_lua_thread, _lua_key, _lua_func) { lua_thread = _lua_thread; lua_thread_key = _lua_key; onClick = method(self, _lua_func); - } #endregion + } - static trigger = function() { #region + static trigger = function() { clicked = true; if(!is_callable(onClick)) return noone; triggered = true; onClick(); - } #endregion + } - static isTriggered = function() { #region + static isTriggered = function() { var t = triggered; triggered = false; return t; - } #endregion + } - static setIcon = function(_icon, _index = 0, _blend = c_white) { #region + static setIcon = function(_icon, _index = 0, _blend = c_white) { icon = _icon; icon_index = _index; icon_blend = _blend; return self; - } #endregion + } - static setText = function(_text) { #region + static setText = function(_text) { text = _text; return self; - } #endregion + } - static setTooltip = function(_tip) { #region + static setTooltip = function(_tip) { tooltip = _tip; return self; - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); return draw(params.x, params.y, params.w, params.h, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) { #region + static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) { x = _x; y = _y; w = _w; @@ -120,9 +120,9 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { if(mouse_release(mb_left)) pressed = false; return _h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new buttonClass(onClick); cln.icon = icon; @@ -134,7 +134,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { cln.blend = blend; return cln; - } #endregion + } } function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) { diff --git a/scripts/buttonColor/buttonColor.gml b/scripts/buttonColor/buttonColor.gml index cf590731e..2a9c8e768 100644 --- a/scripts/buttonColor/buttonColor.gml +++ b/scripts/buttonColor/buttonColor.gml @@ -111,17 +111,17 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor { var hoverRect = ihover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _bww, _y + _h); if(hoverRect) { - draw_sprite_stretched(THEME.button_def, 1, _x, _y, _cw, _h); + draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _cw, _h, boxColor); if(mouse_press(mb_left, iactive)) trigger(); if(mouse_click(mb_left, iactive)) { - draw_sprite_stretched(THEME.button_def, 2, _x, _y, _cw, _h); - draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _cw, _h, COLORS._main_accent, 1); + draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _cw, _h, boxColor); + draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _cw, _h, COLORS._main_accent); } } else { - draw_sprite_stretched(THEME.button_def, 0, _x, _y, _cw, _h); + draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _cw, _h, boxColor); if(mouse_press(mb_left)) deactivate(); } diff --git a/scripts/buttonGradient/buttonGradient.gml b/scripts/buttonGradient/buttonGradient.gml index 1eb3b163b..3dc291223 100644 --- a/scripts/buttonGradient/buttonGradient.gml +++ b/scripts/buttonGradient/buttonGradient.gml @@ -91,16 +91,16 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor { h = _h + ui(22); if(hoverRect) { - draw_sprite_stretched(THEME.button_def, 1, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _w, h, boxColor); if(mouse_press(mb_left, iactive)) trigger(); if(mouse_click(mb_left, iactive)) { - draw_sprite_stretched(THEME.button_def, 2, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _w, h, boxColor); draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1); } } else { - draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _w, h, boxColor); if(mouse_press(mb_left)) deactivate(); } diff --git a/scripts/buttonGroup/buttonGroup.gml b/scripts/buttonGroup/buttonGroup.gml index 82f178767..3c1f8a02b 100644 --- a/scripts/buttonGroup/buttonGroup.gml +++ b/scripts/buttonGroup/buttonGroup.gml @@ -51,6 +51,9 @@ function buttonGroup(_data, _onClick) : widget() constructor { setParam(params); sb_small.setParam(params); + for(var i = 0; i < array_length(data); i++) + buttons[i].setParam(params); + return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry); } @@ -105,7 +108,7 @@ function buttonGroup(_data, _onClick) : widget() constructor { var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]); if(_selecting == i) { - draw_sprite_stretched(spr, 2, floor(bx), _y, ceil(bww), _h); + draw_sprite_stretched_ext(spr, 2, floor(bx), _y, ceil(bww), _h, boxColor); draw_sel = [spr, bx]; } else { buttons[i].draw(floor(bx), _y, ceil(bww), _h, _m, spr); diff --git a/scripts/buttonPalette/buttonPalette.gml b/scripts/buttonPalette/buttonPalette.gml index b9c0b4916..cc7892486 100644 --- a/scripts/buttonPalette/buttonPalette.gml +++ b/scripts/buttonPalette/buttonPalette.gml @@ -86,16 +86,16 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor { h = _h + array_length(_color) * _colr_h + ui(2); if(hoverRect) { - draw_sprite_stretched(THEME.button_def, 1, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _w, h, boxColor); if(mouse_press(mb_left, iactive)) trigger(); if(mouse_click(mb_left, iactive)) { - draw_sprite_stretched(THEME.button_def, 2, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _w, h, boxColor); draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1); } } else { - draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, h); + draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _w, h, boxColor); if(mouse_press(mb_left)) deactivate(); } diff --git a/scripts/controlPointBox/controlPointBox.gml b/scripts/controlPointBox/controlPointBox.gml index 580f9b339..ba2d559f9 100644 --- a/scripts/controlPointBox/controlPointBox.gml +++ b/scripts/controlPointBox/controlPointBox.gml @@ -61,7 +61,7 @@ function controlPointBox(_onModify) : widget() constructor { return false; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); tbCx.setParam(params); tbCy.setParam(params); @@ -74,7 +74,7 @@ function controlPointBox(_onModify) : widget() constructor { scMode.setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry); - } #endregion + } static draw = function(_x, _y, _w, _h, _data, _m, _rx, _ry) { x = _x; @@ -101,8 +101,8 @@ function controlPointBox(_onModify) : widget() constructor { var _ww = _w / 2; var _wh = _h; - draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable); tbCx.draw(_x, yy, _ww, _wh, _cx, _m); tbCy.draw(_x + _ww, yy, _ww, _wh, _cy, _m); @@ -112,8 +112,8 @@ function controlPointBox(_onModify) : widget() constructor { case PUPPET_FORCE_MODE.move: case PUPPET_FORCE_MODE.puppet: - draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable); tbFx.label = "fx"; tbFy.label = "fy"; @@ -132,8 +132,8 @@ function controlPointBox(_onModify) : widget() constructor { case PUPPET_FORCE_MODE.wind: - draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable); tbFx.label = __txt("strength"); tbW.label = __txt("width"); @@ -151,9 +151,9 @@ function controlPointBox(_onModify) : widget() constructor { return yy - _y; } - static clone = function() { #region + static clone = function() { var cln = new controlPointBox(onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/cornerBox/cornerBox.gml b/scripts/cornerBox/cornerBox.gml index b0b7b0af4..709dfc451 100644 --- a/scripts/cornerBox/cornerBox.gml +++ b/scripts/cornerBox/cornerBox.gml @@ -88,11 +88,11 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor { _x += _bs + ui(4); } - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable); var tb_w = _w / 2; var tb_h = _h; @@ -120,9 +120,9 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor { return h; } - static clone = function() { #region + static clone = function() { var cln = new cornerBox(onModify, unit); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index ccc06966e..0eb605735 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -129,8 +129,8 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct var ww = _w / size; - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, ww * size, _h * size, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, ww * size, _h * size, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, ww * size, _h * size, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, ww * size, _h * size, boxColor, 0.5 + 0.5 * interactable); for(var i = 0; i < size; i++) for(var j = 0; j < size; j++) { @@ -150,9 +150,9 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct return h; } - static clone = function() { #region + static clone = function() { var cln = new matrixGrid(type, size, onModify, unit); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index bc098e338..11b80e263 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1,6 +1,7 @@ global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ]; #macro INAME internalName == ""? name : internalName +#macro SHOW_PARAM (show_parameter && previewable) enum CACHE_USE { none, @@ -94,11 +95,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { y = _y; name_height = 16; - w = 128; - h = 128; + w = 128; + h = 128; min_w = w; min_h = name_height; - fix_h = h; + con_h = 0; + h_param = h; will_setHeight = false; @@ -618,17 +620,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } run_in(1, function() /*=>*/ { updateIO() }); static setHeight = function() { - w = show_parameter? attributes.node_param_width : min_w; + w = SHOW_PARAM? attributes.node_param_width : min_w; if(!auto_height) return; - junction_draw_hei_y = show_parameter? 32 : 24; - junction_draw_pad_y = show_parameter? min_h : 32; + junction_draw_hei_y = SHOW_PARAM? 32 : 24; + junction_draw_pad_y = SHOW_PARAM? min_h : 32; var _hi, _ho; if(previewable) { - _hi = junction_draw_pad_y + show_parameter * 4; - _ho = junction_draw_pad_y + show_parameter * 4; + _hi = junction_draw_pad_y + SHOW_PARAM * 4; + _ho = junction_draw_pad_y + SHOW_PARAM * 4; } else { junction_draw_hei_y = 16; @@ -667,8 +669,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { h = max(min_h, _prev_surf * 128, _hi, _ho); if(attributes.node_height) h = max(h, attributes.node_height); - fix_h = h; - } static getJunctionList = function() { #region ////getJunctionList @@ -1145,7 +1145,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { out_cache_len = ds_list_size(outputs); } - var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * show_parameter) * _s; + var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s; for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) { jun = inputs[| i]; @@ -1162,7 +1162,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } xx = xx + w * _s; - var _outy = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * show_parameter) * _s; + var _outy = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s; for(var i = 0; i < outputs_amount; i++) { var idx = outputs_index[i]; @@ -1173,7 +1173,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { _outy += junction_draw_hei_y * _s * jun.isVisible(); } - if(show_parameter) h = h_param; + if(SHOW_PARAM) h = h_param; onPreDraw(_x, _y, _s, _iny, _outy); } @@ -1196,25 +1196,32 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static drawGetBbox = function(xx, yy, _s) { var pad_label = draw_name && display_parameter.avoid_label; - var _w = w; - var _h = show_parameter? min_h : h; + var x0 = xx; + var x1 = xx + w * _s; + var y0 = yy; + var y1 = yy + h * _s; - _w *= _s; - _h *= _s; + if(pad_label) y0 += name_height * _s; + if(SHOW_PARAM) y1 = yy + con_h * _s; - _w -= max(draw_padding, draw_pad_w) * 2; - _h -= max(draw_padding, draw_pad_h) * 2 + name_height * _s * pad_label; + x0 += max(draw_padding, draw_pad_w); + x1 -= max(draw_padding, draw_pad_w); + y0 += max(draw_padding, draw_pad_h); + y1 -= max(draw_padding, draw_pad_h); - var _xc = xx + w * _s / 2; - var _yc = yy + _h / 2 + pad_label * name_height * _s + draw_padding; + var _w = x1 - x0; + var _h = y1 - y0; + + var _xc = (x0 + x1) / 2; + var _yc = (y0 + y1) / 2; _w *= display_parameter.preview_scale / 100; _h *= display_parameter.preview_scale / 100; - var x0 = _xc - _w / 2; - var x1 = _xc + _w / 2; - var y0 = _yc - _h / 2; - var y1 = _yc + _h / 2; + x0 = _xc - _w / 2; + x1 = _xc + _w / 2; + y0 = _yc - _h / 2; + y1 = _yc + _h / 2; return __draw_bbox.fromPoints(x0, y0, x1, y1); } @@ -1272,12 +1279,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var rx = PANEL_GRAPH.x; var ry = PANEL_GRAPH.y; - var jy = _y + junction_draw_pad_y * _s + wh / 2; + var jy = _y + con_h * _s + wh / 2; - var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2]; - var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3]; - var extY = 0; - var drawText = _s > 0.5; + var extY = 0; + var drwT = _s > 0.5; for(var i = 0, n = array_length(inputDisplayList); i < n; i++) { var jun = inputDisplayList[i]; @@ -1285,7 +1290,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { jun.y = jy; - if(drawText) { + if(drwT) { draw_set_text(f_sdf, fa_left, fa_center, jun.color_display); draw_text_add(lx, jun.y, jun.getName(), _s * 0.25); @@ -1305,13 +1310,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { _param.h = wh - 4 * _s; _param.x = wx; _param.y = jy - _param.h / 2; - + _param.data = jun.showValue(); _param.m = _m; _param.rx = rx; _param.ry = ry; _param.s = wh; _param.font = f_p2; + _param.color = getColor(); if(is_instanceof(jun, checkBox)) _param.halign = fa_center; @@ -1321,14 +1327,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _h = wd.drawParam(_param); jun.graphWidgetH = _h / _s; - extY += max(0, (jun.graphWidgetH + 4) - junction_draw_hei_y); - - if(wd.isHovering()) draggable = false; + extY += max(0, jun.graphWidgetH + 4); + jy += (jun.graphWidgetH + 4) * _s; - jy += (jun.graphWidgetH + 4) * _s; + if(wd.isHovering()) draggable = false; } - h = fix_h + extY; + h = con_h + extY + 4; h_param = h; } @@ -1718,7 +1723,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { catch(e) { log_warning("NODE onDrawNode", exception_print(e)); } } - if(show_parameter) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus); + if(SHOW_PARAM) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus); draw_name = false; if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s); @@ -2298,13 +2303,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { INLINE min_w = _w; - min_h = _h; - min_h = name_height; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + con_h = _h; - if(_apply) { - w = _w; - h = _h; - } + if(_apply) { w = _w; h = _h; } } static move = function(_x, _y, _s) { diff --git a/scripts/node_normal_light/node_normal_light.gml b/scripts/node_normal_light/node_normal_light.gml index de8cd8209..a4c7e3674 100644 --- a/scripts/node_normal_light/node_normal_light.gml +++ b/scripts/node_normal_light/node_normal_light.gml @@ -9,7 +9,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 3] = nodeValue("Ambient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 4] = nodeValue("Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, -1 ]) + inputs[| 4] = nodeValue("Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); @@ -25,9 +25,11 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 9; + inputs[| 10] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + input_display_list = [ 9, 0, ["Normal", false], 1, 2, - ["Light", false], 3, 8, 4, 5, 6, 7 + ["Light", false], 3, 8, 4, 10, 5, 6, 7 ]; outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -58,14 +60,17 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var _light_int = _data[6]; var _light_col = _data[7]; var _light_typ = _data[8]; + var _light_hei = _data[10]; + + var _dim = surface_get_dimension(_data[0]); surface_set_shader(_outSurf, sh_normal_light); shader_set_surface("normalMap", _map); - shader_set_f("normalHeight", _hei); - shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); - shader_set_color("ambiance", _amb); + shader_set_f("normalHeight", _hei); + shader_set_f("dimension", _dim); + shader_set_color("ambiance", _amb); - shader_set_f("lightPosition", _light_pos[0], _light_pos[1], _light_pos[2] / 100, _light_ran ); + shader_set_f("lightPosition", _light_pos[0], _light_pos[1], -_light_hei / 100, _light_ran ); shader_set_color("lightColor", _light_col); shader_set_f("lightIntensity", _light_int); shader_set_i("lightType", _light_typ); diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index 85d430d0a..c22a82913 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -37,14 +37,14 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { var __ax = getInputData(0); if(is_array(__ax)) return; inputs[| 0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); - } #endregion + } - static step = function() { #region + static step = function() { var int = getInputData(1); var disp = getInputData(2); @@ -78,7 +78,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float); - } #endregion + } static processNumber = function(_val, _int) { if(is_string(_val)) return _int? round(toNumber(_val)) : toNumber(_val); @@ -92,13 +92,13 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return _val; } - static update = function() { #region + static update = function() { var _dat = getInputData(0); var _int = getInputData(1); var _res = processNumber(_dat, _int); outputs[| 0].setValue(_res); - } #endregion + } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region var bbox = drawGetBbox(xx, yy, _s); diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index 458bd1d64..77cd7627d 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -42,15 +42,15 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { static setSlideSpeed = function(speed) { for(var i = 0; i < 4; i++) tb[i].setSlidable(speed); } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; b_link.interactable = interactable; for( var i = 0; i < 4; i++ ) tb[i].interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { b_link.register(); if(unit != noone && unit.reference != noone) @@ -60,7 +60,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { tb[0].register(parent); tb[1].register(parent); tb[3].register(parent); - } #endregion + } static isHovering = function() { for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; @@ -103,11 +103,11 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { } } - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable); var tb_w = _w / 2; var tb_h = _h; @@ -134,9 +134,9 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { return h; } - static clone = function() { #region + static clone = function() { var cln = new paddingBox(onModify, unit); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/pathAnchorBox/pathAnchorBox.gml b/scripts/pathAnchorBox/pathAnchorBox.gml index 0b44376bb..5c1c6ef2e 100644 --- a/scripts/pathAnchorBox/pathAnchorBox.gml +++ b/scripts/pathAnchorBox/pathAnchorBox.gml @@ -88,9 +88,9 @@ function pathAnchorBox(_onModify) : widget() constructor { return h; } - static clone = function() { #region + static clone = function() { var cln = new pathAnchorBox(onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/pathArrayBox/pathArrayBox.gml b/scripts/pathArrayBox/pathArrayBox.gml index 758d52250..66fc92681 100644 --- a/scripts/pathArrayBox/pathArrayBox.gml +++ b/scripts/pathArrayBox/pathArrayBox.gml @@ -39,11 +39,11 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { } var click = false; - draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor); if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) { hovering = true; - draw_sprite_stretched(THEME.textbox, 1, _x, _y, _w, _h); + draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor); if(mouse_press(mb_left, active)) { trigger(); @@ -53,7 +53,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { if(mouse_click(mb_left, active)) draw_sprite_stretched(THEME.textbox, 2, _x, _y, _w, _h); } else { - draw_sprite_stretched(THEME.textbox, 0, _x, _y, _w, _h); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor); if(mouse_press(mb_left)) deactivate(); } @@ -82,9 +82,9 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { return h; } - static clone = function() { #region + static clone = function() { var cln = new pathArrayBox(target, data, onClick); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/quarternionBox/quarternionBox.gml b/scripts/quarternionBox/quarternionBox.gml index ca8fc37c4..167c56d22 100644 --- a/scripts/quarternionBox/quarternionBox.gml +++ b/scripts/quarternionBox/quarternionBox.gml @@ -124,8 +124,8 @@ function quarternionBox(_onModify) : widget() constructor { var _dispDat = _data; - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); for(var i = 0; i < size; i++) { var _a = _dispDat[i]; @@ -143,8 +143,8 @@ function quarternionBox(_onModify) : widget() constructor { return _h; } - static clone = function() { #region + static clone = function() { var cln = new quarternionBox(onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index 01b5c279d..3e66dbc2a 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -35,38 +35,38 @@ function rangeBox(_type, _onModify) : widget() constructor { tb[i].label = labels[i]; } - static setSlideSpeed = function(speed) { #region + static setSlideSpeed = function(speed) { tb[0].setSlidable(speed); tb[1].setSlidable(speed); - } #endregion + } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; tb[0].interactable = interactable; if(!linked) tb[1].interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { tb[0].register(parent); if(!linked) tb[1].register(parent); - } #endregion + } - static isHovering = function() { #region + static isHovering = function() { for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return false; - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); for(var i = 0; i < 2; i++) tb[i].setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { x = _x; y = _y; w = _w; @@ -104,8 +104,8 @@ function rangeBox(_type, _onModify) : widget() constructor { var ww = linked? _w : _w / 2; disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5); - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); if(linked) { tb[0].setFocusHover(active, hover); @@ -123,11 +123,11 @@ function rangeBox(_type, _onModify) : widget() constructor { resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new rangeBox(type, onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index d148bd887..36adb317f 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -17,25 +17,25 @@ function rotator(_onModify, _step = -1) : widget() constructor { halign = fa_center; - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; tb_value.interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { tb_value.register(parent); - } #endregion + } static isHovering = function() { return dragging || tb_value.hovering; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); tb_value.setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _m, draw_tb = true) { #region + static draw = function(_x, _y, _w, _h, _data, _m, draw_tb = true) { x = _x; y = _y; w = _w; @@ -56,8 +56,8 @@ function rotator(_onModify, _step = -1) : widget() constructor { var _tx = _drawRot? _x + _r + ui(4) : _x; var _tw = _drawRot? _w - _r - ui(4) : _w; - draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable); tb_value.setFocusHover(active, hover); tb_value.draw(_tx, _y, _tw, _h, _data, _m); @@ -123,11 +123,11 @@ function rotator(_onModify, _step = -1) : widget() constructor { resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new rotator(onModify, valStep); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/rotatorRandom/rotatorRandom.gml b/scripts/rotatorRandom/rotatorRandom.gml index 578227391..0565a0054 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -21,26 +21,26 @@ function rotatorRandom(_onModify) : widget() constructor { __txtx("widget_rotator_random_double_span", "Double Span") ]); - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; tb_min_0.interactable = interactable; tb_max_0.interactable = interactable; if(mode == 2 || mode == 3) tb_min_1.interactable = interactable; if(mode == 2) tb_max_1.interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { tb_min_0.register(parent); tb_max_0.register(parent); if(mode == 2 || mode == 3) tb_min_1.register(parent); if(mode == 2) tb_max_1.register(parent); - } #endregion + } static isHovering = function() { return dragging || tb_min_0.hovering || tb_max_0.hovering || tb_min_1.hovering || tb_max_1.hovering; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); tb_min_0.setParam(params); tb_max_0.setParam(params); @@ -48,9 +48,9 @@ function rotatorRandom(_onModify) : widget() constructor { tb_max_1.setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _m) { x = _x; y = _y; w = _w; @@ -69,17 +69,17 @@ function rotatorRandom(_onModify) : widget() constructor { switch(mode) { case 2 : - draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y + _h + ui(4), _tw, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y + _h + ui(4), _tw, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y + _h + ui(4), _tw, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y + _h + ui(4), _tw, _h, boxColor, 0.5 + 0.5 * interactable); case 0 : case 1 : - draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable); break; case 3 : - draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, boxColor, 0.5 + 0.5 * interactable); } if(_drawRot) { @@ -458,11 +458,10 @@ function rotatorRandom(_onModify) : widget() constructor { resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new rotatorRandom(onModify); - return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index 6692dd767..3d63d50d6 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -11,28 +11,28 @@ function rotatorRange(_onModify) : widget() constructor { 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 + static setInteract = function(interactable = noone) { self.interactable = interactable; tb_min.interactable = interactable; tb_max.interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { tb_min.register(parent); tb_max.register(parent); - } #endregion + } static isHovering = function() { return dragging || tb_min.hovering || tb_max.hovering; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); tb_min.setParam(params); tb_max.setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _m) { x = _x; y = _y; w = _w; @@ -46,8 +46,8 @@ function rotatorRange(_onModify) : widget() constructor { var _tx = _drawRot? _x + _r + ui(4) : _x; var _tw = _drawRot? _w - _r - ui(4) : _w; - draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable); _tw /= 2; @@ -125,11 +125,10 @@ function rotatorRange(_onModify) : widget() constructor { resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new rotatorRange(onModify); - return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index e95d325f2..f14da4862 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -12,33 +12,33 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { tb_value_min.hide = true; tb_value_max.hide = true; - static setSlideSpeed = function(speed) { #region + static setSlideSpeed = function(speed) { tb_value_min.setSlidable(speed); tb_value_max.setSlidable(speed); - } #endregion + } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; tb_value_min.interactable = interactable; tb_value_max.interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { tb_value_min.register(parent); tb_value_max.register(parent); - } #endregion + } static isHovering = function() { return tb_value_min.hovering || tb_value_max.hovering; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); tb_value_min.setParam(params); tb_value_max.setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _m) { x = _x; y = _y; w = _w; @@ -46,7 +46,7 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { if(!is_real(_data[0])) return h; if(!is_real(_data[1])) return h; - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); var _minn = slide_range[0]; var _maxx = slide_range[1]; @@ -59,17 +59,17 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { curr_range[1] = (_currMax <= _maxx)? _maxx : _maxx + ceil(abs(_currMax - _maxx) / _rang) * _rang; } - var lx = _w * (_currMin - curr_range[0]) / (curr_range[1] - curr_range[0]); + var lx = _w * ((_currMin ) - curr_range[0]) / (curr_range[1] - curr_range[0]); var lw = _w * ((_currMax - _currMin) - curr_range[0]) / (curr_range[1] - curr_range[0]); - draw_sprite_stretched_ext(THEME.textbox, 4, _x + lx, _y, lw, _h, c_white, 1); + draw_sprite_stretched_ext(THEME.textbox, 4, _x + lx, _y, lw, _h, boxColor, 1); var tb_w = _w / 2; if(tb_value_min.selecting || tb_value_max.selecting) { - draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, c_white, 1); + draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor, 1); } else { - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); } tb_value_min.curr_range[0] = curr_range[0]; @@ -85,11 +85,11 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { tb_value_max.draw(_x + tb_w, _y, tb_w, _h, _data[1], _m); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new sliderRange(stepSize, isInt, slide_range, onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/textArrayBox/textArrayBox.gml b/scripts/textArrayBox/textArrayBox.gml index 2250ed4d5..b0ae3c77f 100644 --- a/scripts/textArrayBox/textArrayBox.gml +++ b/scripts/textArrayBox/textArrayBox.gml @@ -8,13 +8,13 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { hide = false; open = false; - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); return draw(params.x, params.y, params.w, params.h, params.m, params.rx, params.ry); - } #endregion + } - static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) { #region + static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) { x = _x; y = _y; w = _w; @@ -39,13 +39,13 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { h = th; - draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, th); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, th, boxColor); if(open) { draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, th, COLORS._main_accent, 1); } else { if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + th)) { - draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, th, c_white, 0.5 + !hide * 0.5); + draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, th, boxColor, 0.5 + !hide * 0.5); if(mouse_press(mb_left, active)) { with(dialogCall(o_dialog_arrayBox, _rx + _x, _ry + _y + th)) { arrayBox = other; @@ -53,7 +53,7 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { } } } else if(!hide) - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, th, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, th, boxColor, 0.5 + 0.5 * interactable); } var tx = _x + ui(4); @@ -76,11 +76,11 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { resetFocus(); return th; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new textArrayBox(getArray, data, onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index a6ec7c412..8365de168 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -72,13 +72,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { static setOnRelease = function(release) { onRelease = release; return self; } - static modifyValue = function(value) { #region + static modifyValue = function(value) { if(input == TEXTBOX_INPUT.number) { if(use_range) value = clamp(value, range_min, range_max); } onModify(value); - } #endregion + } static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) { slidable = true; @@ -90,13 +90,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { return self; } - static setRange = function(_rng_min, _rng_max) { #region + static setRange = function(_rng_min, _rng_max) { use_range = true; range_min = _rng_min; range_max = _rng_max; return self; - } #endregion + } static setFont = function(font) { self.font = font; return self; } static setLabel = function(label) { self.label = label; return self; } @@ -104,7 +104,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { static setPadding = function(padding) { self.padding = padding; return self; } static setEmpty = function() { no_empty = false; return self; } - static activate = function() { #region + static activate = function() { WIDGET_CURRENT = self; WIDGET_CURRENT_SCROLL = parent; parentFocus(); @@ -120,9 +120,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { keyboard_lastkey = -1; if(PEN_USE) keyboard_virtual_show(input == TEXTBOX_INPUT.number? kbv_type_numbers : kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, true); - } #endregion + } - static deactivate = function() { #region + static deactivate = function() { if(WIDGET_CURRENT != self) return; apply(); @@ -133,9 +133,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { UNDO_HOLDING = false; if(PEN_USE) keyboard_virtual_hide(); - } #endregion + } - static onKey = function(key) { #region + static onKey = function(key) { if(KEYBOARD_PRESSED == vk_left) { if(key_mod_press(SHIFT)) { if(cursor_select == -1) @@ -155,9 +155,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { move_cursor(1); } - } #endregion + } - static apply = function(release = false) { #region + static apply = function(release = false) { var _val = _input_text; disp_x_to = 0; @@ -184,14 +184,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4; return false; - } #endregion + } - static move_cursor = function(delta) { #region + static move_cursor = function(delta) { var ll = string_length(_input_text) + 1; cursor = safe_mod(cursor + delta + ll, ll); - } #endregion + } - static editText = function() { #region + static editText = function() { var edited = false; #region text editor @@ -341,9 +341,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { } else if(auto_update && (edited || keyboard_check_pressed(vk_anykey))) { apply(); } - } #endregion + } - static display_text = function(_x, _y, _text, _w, _m = -1) { #region + static display_text = function(_x, _y, _text, _w, _m = -1) { draw_set_alpha(0.5 + 0.5 * interactable); _y += ui(1); //Huh? @@ -389,13 +389,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(mouse_release(mb_left, active)) click_block = false; } - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign); - } #endregion + } static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, halign = fa_left, valign = fa_top) { #region x = _x; diff --git a/scripts/transformBox/transformBox.gml b/scripts/transformBox/transformBox.gml index c3f9d28fe..1512c3af4 100644 --- a/scripts/transformBox/transformBox.gml +++ b/scripts/transformBox/transformBox.gml @@ -25,13 +25,13 @@ function transformBox(_onModify) : widget() constructor { tb[i].label = labels[i]; } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; for( var i = 0, n = array_length(tb); i < n; i++ ) tb[i].setInteract(interactable); rot.setInteract(interactable); - } #endregion + } static register = function(parent = noone) { tb[TRANSFORM.pos_x].register(parent); @@ -41,20 +41,20 @@ function transformBox(_onModify) : widget() constructor { tb[TRANSFORM.sca_y].register(parent); } - static isHovering = function() { #region + static isHovering = function() { for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return hovering; - } #endregion + } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); rot.setParam(params); for(var i = 0; i < 5; i++) tb[i].setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _m) { x = _x; y = _y; w = _w; @@ -82,8 +82,8 @@ function transformBox(_onModify) : widget() constructor { if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position")); - draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable); tb[TRANSFORM.pos_x].draw(_x + lbw, _y, tbw, tbh, _data[TRANSFORM.pos_x], _m); tb[TRANSFORM.pos_y].draw(_x + lbw + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m); @@ -97,8 +97,8 @@ function transformBox(_onModify) : widget() constructor { draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey); if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale")); - draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable); tbw = array_length(_data) > 4? (_w - lbw) / 2 : _w - lbw; @@ -109,11 +109,11 @@ function transformBox(_onModify) : widget() constructor { resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new transformBox(onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index 8fe8a5b9d..213cfb1cc 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -156,8 +156,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { var ww = per_line? _w : _w / sz; if(!per_line) { - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); } for(var i = 0; i < sz; i++) { diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 5ecf84335..67bd7dbee 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -31,44 +31,44 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const extras = -1; - for(var i = 0; i < size; i++) { #region + for(var i = 0; i < size; i++) { tb[i] = new textBox(_type, onModifySingle[i]); tb[i].slidable = true; tb[i].hide = true; - } #endregion + } - static setSlideSpeed = function(speed) { #region + static setSlideSpeed = function(speed) { for(var i = 0; i < size; i++) tb[i].setSlidable(speed); - } #endregion + } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; var _step = linked? 2 : 1; for( var i = 0; i < size; i += _step ) tb[i].interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { var _step = linked? 2 : 1; for( var i = 0; i < size; i += _step ) tb[i].register(parent); - } #endregion + } static isHovering = function() { for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return false; } - static drawParam = function(params) { #region + static drawParam = function(params) { setParam(params); for(var i = 0; i < size; i++) tb[i].setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m); - } #endregion + } - static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { x = _x; y = _y; w = _w; @@ -112,8 +112,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const var ww = _w / 2; if(linked) { - draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); for( var i = 0; i < 2; i++ ) { var bx = _x + ww * i; @@ -127,8 +127,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const for( var j = 0; j < 2; j++ ) { var by = _y + (_h + ui(4)) * j; - draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, c_white, 0.5 + 0.5 * interactable); + draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, boxColor, 1); + draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, boxColor, 0.5 + 0.5 * interactable); for( var i = 0; i < 2; i++ ) { var bx = _x + ww * i; @@ -143,14 +143,14 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const resetFocus(); return h; - } #endregion + } - static clone = function() { #region + static clone = function() { var cln = new vectorRangeBox(size, type, onModify, unit); cln.axis = axis; cln.extras = extras; return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/widget/widget.gml b/scripts/widget/widget.gml index 2c2a036fa..860c459a5 100644 --- a/scripts/widget/widget.gml +++ b/scripts/widget/widget.gml @@ -22,6 +22,8 @@ function widget() constructor { sep_axis = false; unit = noone; + boxColor = c_white; + x = 0; y = 0; w = 0; @@ -30,69 +32,71 @@ function widget() constructor { rx = 0; ry = 0; - static setLua = function(_lua_thread, _lua_key, _lua_func) { #region + static setLua = function(_lua_thread, _lua_key, _lua_func) { lua_thread = _lua_thread; lua_thread_key = _lua_key; onModify = method(self, _lua_func); - } #endregion + } - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; - } #endregion + } - static register = function(parent = noone) { #region + static register = function(parent = noone) { if(!interactable) return; array_push(WIDGET_ACTIVE, self); self.parent = parent; - } #endregion + } - static setParam = function(params) { #region + static setParam = function(params) { font = params.font; rx = params.rx; ry = params.ry; sep_axis = params.sep_axis; - } #endregion + + boxColor = params.color; + } static trigger = function() { } - static parentFocus = function() { #region + static parentFocus = function() { if(parent == noone) return; if(y < 0) parent.scroll_y_to += abs(y) + ui(16); else if(y + ui(16) > parent.surface_h) parent.scroll_y_to -= abs(parent.surface_h - y) + h + ui(16); - } #endregion + } static isHovering = function() { return hovering; } - static activate = function() { #region + static activate = function() { if(!interactable) return; WIDGET_CURRENT = self; WIDGET_CURRENT_SCROLL = parent; parentFocus(); - } #endregion + } - static deactivate = function() { #region + static deactivate = function() { if(WIDGET_CURRENT != self) return; WIDGET_CURRENT = noone; WIDGET_CURRENT_SCROLL = noone; - } #endregion + } - static setFocusHover = function(active = false, hover = false) { #region + static setFocusHover = function(active = false, hover = false) { self.active = interactable && active; self.hover = interactable && hover; self.iactive = active; self.ihover = hover; - } #endregion + } - static resetFocus = function() { #region + static resetFocus = function() { active = false; hover = false; - } #endregion + } static clone = function() { return variable_clone(self); } @@ -119,5 +123,6 @@ function widgetParam(x, y, w, h, data, display_data = {}, m = mouse_ui, rx = 0, self.font = f_p0; - sep_axis = false; + color = c_white; + sep_axis = false; } \ No newline at end of file