diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 903eae7cd..cac940bf6 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -244,7 +244,6 @@ {"name":"oRigidbody","order":13,"path":"objects/oRigidbody/oRigidbody.yy",}, {"name":"rotator_Rotator","order":3,"path":"objects/rotator_Rotator/rotator_Rotator.yy",}, {"name":"slider_Slider","order":1,"path":"objects/slider_Slider/slider_Slider.yy",}, - {"name":"textBox_slider","order":16,"path":"objects/textBox_slider/textBox_slider.yy",}, {"name":"__3d_particle","order":1,"path":"scripts/__3d_particle/__3d_particle.yy",}, {"name":"__3D","order":6,"path":"scripts/__3D/__3D.yy",}, {"name":"__add_node_item","order":13,"path":"scripts/__add_node_item/__add_node_item.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 5371b8d51..511edb0fd 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -579,7 +579,6 @@ {"id":{"name":"oRigidbody","path":"objects/oRigidbody/oRigidbody.yy",},}, {"id":{"name":"rotator_Rotator","path":"objects/rotator_Rotator/rotator_Rotator.yy",},}, {"id":{"name":"slider_Slider","path":"objects/slider_Slider/slider_Slider.yy",},}, - {"id":{"name":"textBox_slider","path":"objects/textBox_slider/textBox_slider.yy",},}, {"id":{"name":"rm_main","path":"rooms/rm_main/rm_main.yy",},}, {"id":{"name":"__3d_particle","path":"scripts/__3d_particle/__3d_particle.yy",},}, {"id":{"name":"__3D","path":"scripts/__3D/__3D.yy",},}, diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index c64208f43..14fa5a5e7 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -235,7 +235,6 @@ DIALOGS = ds_list_create(); WIDGET_TAB_BLOCK = false; - instance_create(0, 0, textBox_slider); instance_create(0, 0, o_dialog_textbox_autocomplete); instance_create(0, 0, o_dialog_textbox_function_guide); #endregion diff --git a/objects/textBox_slider/Create_0.gml b/objects/textBox_slider/Create_0.gml deleted file mode 100644 index 17ac0ecdd..000000000 --- a/objects/textBox_slider/Create_0.gml +++ /dev/null @@ -1,23 +0,0 @@ -/// @description -depth = -19999; -tb = noone; - -def_val = 0; -cur_val = 0; - -def_mx = 0; -def_my = 0; -prev_mx = 0; - -function activate(defVal) { - def_val = defVal; - cur_val = defVal; - - def_mx = mouse_mx; - def_my = mouse_my; - - prev_mx = mouse_mx; - - CURSOR_LOCK_X = mouse_mx; - CURSOR_LOCK_Y = mouse_my; -} \ No newline at end of file diff --git a/objects/textBox_slider/Draw_64.gml b/objects/textBox_slider/Draw_64.gml deleted file mode 100644 index c1b4ce3e4..000000000 --- a/objects/textBox_slider/Draw_64.gml +++ /dev/null @@ -1,41 +0,0 @@ -/// @description -if(tb == noone) exit; - -MOUSE_BLOCK = true; -CURSOR_LOCK = true; - -if(mouse_check_button_pressed(mb_right)) { - tb._input_text = string_real(def_val); - tb.apply(); - tb.sliding = false; - tb.deactivate(); - - UNDO_HOLDING = false; - tb = noone; - exit; -} - -var _s = tb.slide_speed; -var _mdx = window_mouse_get_delta_x(); -var _mdy = window_mouse_get_delta_y(); -var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy; - -if(key_mod_press(CTRL) && !tb.slide_snap) _s *= 10; -if(key_mod_press(ALT)) _s /= 10; - -cur_val += _dx * _s; - -if(tb.slide_range != noone) - cur_val = clamp(cur_val, tb.curr_range[0], tb.curr_range[1]); - -var _val = value_snap(cur_val, _s); - -if(key_mod_press(CTRL) && tb.slide_snap) _val = value_snap(cur_val, tb.slide_snap); -if(tb.slide_int) _val = round(_val); - -if(abs(_val) < _s * 4) _val = 0; - -tb._input_text = string_real(_val); -if(tb.apply()) UNDO_HOLDING = true; - -tb = noone; \ No newline at end of file diff --git a/objects/textBox_slider/textBox_slider.yy b/objects/textBox_slider/textBox_slider.yy deleted file mode 100644 index 6083b2008..000000000 --- a/objects/textBox_slider/textBox_slider.yy +++ /dev/null @@ -1,36 +0,0 @@ -{ - "$GMObject":"", - "%Name":"textBox_slider", - "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":"textBox_slider", - "overriddenProperties":[], - "parent":{ - "name":"text", - "path":"folders/widgets/text.yy", - }, - "parentObjectId":null, - "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/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index 7513289a4..e293a4984 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -139,7 +139,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { 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) { + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region x = _x; y = _y; w = _w; @@ -360,5 +360,11 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { resetFocus(); return h; - } + } #endregion + + static clone = function() { #region + 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 e1b35ee97..b48358103 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -115,6 +115,20 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { return _h; } #endregion + + static clone = function() { #region + var cln = new buttonClass(onClick); + + cln.icon = icon; + cln.icon_blend = icon_blend; + cln.icon_index = icon_index; + + cln.text = text; + cln.tooltip = tooltip; + 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) { #region diff --git a/scripts/buttonAnchor/buttonAnchor.gml b/scripts/buttonAnchor/buttonAnchor.gml index be80265a0..5139e290c 100644 --- a/scripts/buttonAnchor/buttonAnchor.gml +++ b/scripts/buttonAnchor/buttonAnchor.gml @@ -39,4 +39,12 @@ function buttonAnchor(_onClick) : widget() constructor { return _h; } + + static clone = function() { #region + var cln = new buttonAnchor(); + + cln.onClick = onClick; + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/buttonColor/buttonColor.gml b/scripts/buttonColor/buttonColor.gml index b805d8f6c..2fb1a40f7 100644 --- a/scripts/buttonColor/buttonColor.gml +++ b/scripts/buttonColor/buttonColor.gml @@ -1,8 +1,8 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor { - onApply = _onApply; - parentDialog = dialog; + onApply = _onApply; + parentDialog = dialog; current_value = 0; - triggered = false; + triggered = false; onColorPick = function() { var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); @@ -17,7 +17,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor { is_picking = false; current_color = c_black; - b_picker = button(onColorPick); + b_picker = button(onColorPick); b_picker.icon = THEME.color_picker_dropper; b_quick_pick = button(function() { @@ -152,6 +152,11 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor { resetFocus(); return h; } + + static clone = function() { #region + var cln = new buttonColor(onApply, parentDialog); + return cln; + } #endregion } function drawColor(color, _x, _y, _w, _h) { diff --git a/scripts/buttonGradient/buttonGradient.gml b/scripts/buttonGradient/buttonGradient.gml index 57cea8e1d..568a9501b 100644 --- a/scripts/buttonGradient/buttonGradient.gml +++ b/scripts/buttonGradient/buttonGradient.gml @@ -93,4 +93,9 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor { resetFocus(); return h; } #endregion + + static clone = function() { #region + var cln = new buttonGradient(onApply, parentDialog); + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/buttonGroup/buttonGroup.gml b/scripts/buttonGroup/buttonGroup.gml index 74f9b524d..11b1c0efe 100644 --- a/scripts/buttonGroup/buttonGroup.gml +++ b/scripts/buttonGroup/buttonGroup.gml @@ -120,4 +120,9 @@ function buttonGroup(_data, _onClick) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new buttonGroup(data, onClick); + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/buttonPalette/buttonPalette.gml b/scripts/buttonPalette/buttonPalette.gml index 500bd2871..5615b8347 100644 --- a/scripts/buttonPalette/buttonPalette.gml +++ b/scripts/buttonPalette/buttonPalette.gml @@ -93,6 +93,11 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor { return h; } #endregion + + static clone = function() { #region + var cln = new buttonPalette(onApply, parentDialog); + return cln; + } #endregion } function drawPalette(_pal, _x, _y, _w, _h, _a = 1) { #region diff --git a/scripts/checkbox/checkbox.gml b/scripts/checkbox/checkbox.gml index cb194454a..b4b6e39fe 100644 --- a/scripts/checkbox/checkbox.gml +++ b/scripts/checkbox/checkbox.gml @@ -83,4 +83,10 @@ function checkBox(_onClick) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new checkBox(onClick); + + return cln; + } #endregion } diff --git a/scripts/checkboxActive/checkboxActive.gml b/scripts/checkboxActive/checkboxActive.gml index bda23964b..6efb92b0c 100644 --- a/scripts/checkboxActive/checkboxActive.gml +++ b/scripts/checkboxActive/checkboxActive.gml @@ -45,4 +45,10 @@ function checkBoxActive(_onClick) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new checkBoxActive(onClick); + + return cln; + } #endregion } diff --git a/scripts/checkboxGroup/checkboxGroup.gml b/scripts/checkboxGroup/checkboxGroup.gml index 9abcbdfa7..51c987f96 100644 --- a/scripts/checkboxGroup/checkboxGroup.gml +++ b/scripts/checkboxGroup/checkboxGroup.gml @@ -70,4 +70,10 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new checkBoxGroup(sprs, onClick); + + return cln; + } #endregion } diff --git a/scripts/controlPointBox/controlPointBox.gml b/scripts/controlPointBox/controlPointBox.gml index 37ff3ec78..45e8b7dbe 100644 --- a/scripts/controlPointBox/controlPointBox.gml +++ b/scripts/controlPointBox/controlPointBox.gml @@ -150,4 +150,10 @@ function controlPointBox(_onModify) : widget() constructor { resetFocus(); return yy - _y; } + + static clone = function() { #region + 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 d69c1da2d..7e1882051 100644 --- a/scripts/cornerBox/cornerBox.gml +++ b/scripts/cornerBox/cornerBox.gml @@ -1,5 +1,6 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor { onModify = _onModify; + unit = _unit; linked = false; b_link = button(function() { linked = !linked; }); @@ -118,4 +119,10 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new cornerBox(onModify, unit); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/curveBox/curveBox.gml b/scripts/curveBox/curveBox.gml index bb16613f1..3b15a57d0 100644 --- a/scripts/curveBox/curveBox.gml +++ b/scripts/curveBox/curveBox.gml @@ -66,6 +66,7 @@ function curveBox(_onModify) : widget() constructor { if(node_dragging != -1) { #region editing show_coord = true; + _data = array_clone(_data); if(node_drag_typ == 0) { var node_point = (node_dragging - 2) / 6; @@ -381,4 +382,10 @@ function curveBox(_onModify) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new curveBox(onModify); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/draw_UI_scale/draw_UI_scale.gml b/scripts/draw_UI_scale/draw_UI_scale.gml index 266cd2277..539d06990 100644 --- a/scripts/draw_UI_scale/draw_UI_scale.gml +++ b/scripts/draw_UI_scale/draw_UI_scale.gml @@ -1,12 +1,18 @@ +global.LINE_HEIGHTS = {}; + function line_get_height(font = noone, offset = 0) { + INLINE + var _f = font != noone? font : draw_get_font(); + if(struct_has(global.LINE_HEIGHTS, _f)) return global.LINE_HEIGHTS[$ _f] + offset * UI_SCALE; + var ff = draw_get_font(); - if(font != noone) - draw_set_font(font); - var hh = string_height("l") + offset * UI_SCALE; - + if(font != noone) draw_set_font(font); + var hh = string_height("l"); + global.LINE_HEIGHTS[$ _f] = hh; draw_set_font(ff); - return hh; + + return hh + offset * UI_SCALE; } function line_get_width(txt, font = noone, offset = 0) { diff --git a/scripts/fontScrollBox/fontScrollBox.gml b/scripts/fontScrollBox/fontScrollBox.gml index 1b5ac8467..c5071aa4f 100644 --- a/scripts/fontScrollBox/fontScrollBox.gml +++ b/scripts/fontScrollBox/fontScrollBox.gml @@ -88,4 +88,10 @@ function fontScrollBox(_onModify) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new fontScrollBox(onModify); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index f8e1e96a8..ec781853e 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -1,4 +1,5 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() constructor { + type = _type; size = _size; inputs = size * size; onModify = _onModify; @@ -148,4 +149,10 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct return h; } + + static clone = function() { #region + var cln = new matrixGrid(type, size, onModify, unit); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 3f1737042..742a4b350 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -71,7 +71,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { if(visi_hold != noone && jun.visible != visi_hold) { jun.visible = visi_hold; - jun.node.setHeight(); + jun.node.refreshNodeDisplay(); } draw_sprite_ui_uniform(THEME.junc_visible, index, butx, lb_y, 1,, 1); @@ -80,7 +80,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(mouse_press(mb_left, _focus)) { jun.visible = !jun.visible; visi_hold = jun.visible; - jun.node.setHeight(); + jun.node.refreshNodeDisplay(); } } #endregion diff --git a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml index f362a8745..258e41955 100644 --- a/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml +++ b/scripts/node_VFX_renderer_output/node_VFX_renderer_output.gml @@ -61,7 +61,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x outParent.from = self; ds_list_add(group.outputs, outParent); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); } if(!LOADING && !APPENDING) createOutput(); #endregion diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 1635a3a0e..d8430e47c 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -456,7 +456,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc array_push_unique(attributes.output_display_list, i); output_display_list = attributes.output_display_list; - setHeight(); + refreshNodeDisplay(); } #endregion static getTool = function() { #region diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 8663fb39d..0e879b0e0 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -308,190 +308,190 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) static getInputAmount = function() { INLINE return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length; } - static getInputIndex = function(index) { #region - INLINE + //static getInputIndex = function(index) { #region + // INLINE - if(index < input_fix_len) return index; - return input_fix_len + (index - input_fix_len) * data_length; - } #endregion + // if(index < input_fix_len) return index; + // return input_fix_len + (index - input_fix_len) * data_length; + //} #endregion - static setHeight = function() { #region - var _hi = ui(32); - var _ho = ui(32); + //static setHeight = function() { #region + // var _hi = ui(32); + // var _ho = ui(32); - for( var i = 0; i < getInputAmount(); i++ ) - if(inputs[| getInputIndex(i)].isVisible()) - _hi += 24; + // for( var i = 0; i < getInputAmount(); i++ ) + // if(inputs[| getInputIndex(i)].isVisible()) + // _hi += 24; - for( var i = 0; i < ds_list_size(outputs); i++ ) - if(outputs[| i].isVisible()) - _ho += 24; + // for( var i = 0; i < ds_list_size(outputs); i++ ) + // if(outputs[| i].isVisible()) + // _ho += 24; - h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho); - } #endregion + // h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho); + //} #endregion - static drawJunctions = function(_x, _y, _mx, _my, _s) { #region - if(!active) return; - var hover = noone; - var amo = array_length(input_display_list); + //static drawJunctions = function(_x, _y, _mx, _my, _s) { #region + // if(!active) return; + // var hover = noone; + // var amo = array_length(input_display_list); - var hov = PANEL_GRAPH.value_focus; - var ind = -1; - if(hov != noone && struct_has(hov, "surface_index")) - ind = hov.surface_index; + // var hov = PANEL_GRAPH.value_focus; + // var ind = -1; + // if(hov != noone && struct_has(hov, "surface_index")) + // ind = hov.surface_index; - for( var i = 0; i < getInputAmount(); i++ ) { - var idx = getInputIndex(i); - if(!inputs[| idx].isVisible()) continue; + // for( var i = 0; i < getInputAmount(); i++ ) { + // var idx = getInputIndex(i); + // if(!inputs[| idx].isVisible()) continue; - if(inputs[| idx].drawJunction(_s, _mx, _my, 1.5)) - hover = inputs[| idx]; + // if(inputs[| idx].drawJunction(_s, _mx, _my, 1.5)) + // hover = inputs[| idx]; - if(idx >= input_fix_len && inputs[| idx].hover_effect > 0) { - var _px0 = 999999; - var _py0 = 999999; - var _px1 = -999999; - var _py1 = -999999; - var _drw = false; - var _hov = inputs[| idx].hover_effect; + // if(idx >= input_fix_len && inputs[| idx].hover_effect > 0) { + // var _px0 = 999999; + // var _py0 = 999999; + // var _px1 = -999999; + // var _py1 = -999999; + // var _drw = false; + // var _hov = inputs[| idx].hover_effect; - for( var j = 1; j < data_length; j++ ) { - if(!inputs[| idx + j].isVisible()) continue; - _px0 = min( _px0, inputs[| idx + j].x ); - _py0 = min( _py0, inputs[| idx + j].y ); - _px1 = max( _px1, inputs[| idx + j].x ); - _py1 = max( _py1, inputs[| idx + j].y ); - _drw = true; - } + // for( var j = 1; j < data_length; j++ ) { + // if(!inputs[| idx + j].isVisible()) continue; + // _px0 = min( _px0, inputs[| idx + j].x ); + // _py0 = min( _py0, inputs[| idx + j].y ); + // _px1 = max( _px1, inputs[| idx + j].x ); + // _py1 = max( _py1, inputs[| idx + j].y ); + // _drw = true; + // } - if(!_drw) continue; + // if(!_drw) continue; - //if(_hov > 0.5) { - // var pilx = _px0 - 16 * _s; - // var pily = _py0 - 16 * _s; - // var pilw = _px1 - _px0 + 32 * _s; - // var pilh = _py1 - _py0 + 32 * _s; + // //if(_hov > 0.5) { + // // var pilx = _px0 - 16 * _s; + // // var pily = _py0 - 16 * _s; + // // var pilw = _px1 - _px0 + 32 * _s; + // // var pilh = _py1 - _py0 + 32 * _s; - // draw_sprite_stretched_ext(THEME.node_bg_pill, 0, pilx, pily, pilw, pilh, COLORS._main_icon_dark, (_hov - 0.5) * 2); - //} + // // draw_sprite_stretched_ext(THEME.node_bg_pill, 0, pilx, pily, pilw, pilh, COLORS._main_icon_dark, (_hov - 0.5) * 2); + // //} - for( var j = 1; j < data_length; j++ ) { - if(inputs[| idx + j].drawJunction(_s, _mx, _my, 1.5)) - hover = inputs[| idx + j]; - } - } - } + // for( var j = 1; j < data_length; j++ ) { + // if(inputs[| idx + j].drawJunction(_s, _mx, _my, 1.5)) + // hover = inputs[| idx + j]; + // } + // } + // } - for(var i = 0; i < ds_list_size(outputs); i++) - if(outputs[| i].drawJunction(_s, _mx, _my)) - hover = outputs[| i]; + // for(var i = 0; i < ds_list_size(outputs); i++) + // if(outputs[| i].drawJunction(_s, _mx, _my)) + // hover = outputs[| i]; - return hover; - } #endregion + // return hover; + //} #endregion - static drawJunctionNames = function(_x, _y, _mx, _my, _s) { #region - if(!active) return; - var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); - var jun; + //static drawJunctionNames = function(_x, _y, _mx, _my, _s) { #region + // if(!active) return; + // var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); + // var jun; - var xx = x * _s + _x; - var yy = y * _s + _y; + // var xx = x * _s + _x; + // var yy = y * _s + _y; - show_input_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx - 8 * _s, yy + 20 * _s, xx + 8 * _s, yy + h * _s); - show_output_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s); + // show_input_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx - 8 * _s, yy + 20 * _s, xx + 8 * _s, yy + h * _s); + // show_output_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s); - var hov = PANEL_GRAPH.value_focus; - var ind = -1; - if(hov != noone && struct_has(hov, "surface_index")) - ind = hov.surface_index; + // var hov = PANEL_GRAPH.value_focus; + // var ind = -1; + // if(hov != noone && struct_has(hov, "surface_index")) + // ind = hov.surface_index; - if(ind != -1) { - for( var j = 1; j < data_length; j++ ) { - if(ind + j >= ds_list_size(inputs)) break; - inputs[| ind + j].drawNameBG(_s); - } + // if(ind != -1) { + // for( var j = 1; j < data_length; j++ ) { + // if(ind + j >= ds_list_size(inputs)) break; + // inputs[| ind + j].drawNameBG(_s); + // } - for( var j = 1; j < data_length; j++ ) { - if(ind + j >= ds_list_size(inputs)) break; - inputs[| ind + j].drawName(_s, _mx, _my); - } + // for( var j = 1; j < data_length; j++ ) { + // if(ind + j >= ds_list_size(inputs)) break; + // inputs[| ind + j].drawName(_s, _mx, _my); + // } - } else if(show_input_name) { - for( var i = 0; i < getInputAmount(); i++ ) { - var idx = getInputIndex(i); + // } else if(show_input_name) { + // for( var i = 0; i < getInputAmount(); i++ ) { + // var idx = getInputIndex(i); - if(idx == ind) continue; - inputs[| idx].drawNameBG(_s); - } + // if(idx == ind) continue; + // inputs[| idx].drawNameBG(_s); + // } - for( var i = 0; i < getInputAmount(); i++ ) { - var idx = getInputIndex(i); + // for( var i = 0; i < getInputAmount(); i++ ) { + // var idx = getInputIndex(i); - if(idx == ind) continue; - inputs[| idx].drawName(_s, _mx, _my); - } - } + // if(idx == ind) continue; + // inputs[| idx].drawName(_s, _mx, _my); + // } + // } - if(show_output_name) { - for(var i = 0; i < ds_list_size(outputs); i++) - outputs[| i].drawNameBG(_s); + // if(show_output_name) { + // for(var i = 0; i < ds_list_size(outputs); i++) + // outputs[| i].drawNameBG(_s); - for(var i = 0; i < ds_list_size(outputs); i++) - outputs[| i].drawName(_s, _mx, _my); - } - } #endregion + // for(var i = 0; i < ds_list_size(outputs); i++) + // outputs[| i].drawName(_s, _mx, _my); + // } + //} #endregion - static preDraw = function(_x, _y, _s) { #region - var xx = x * _s + _x; - var yy = y * _s + _y; - var jun; + //static preDraw = function(_x, _y, _s) { #region + // var xx = x * _s + _x; + // var yy = y * _s + _y; + // var jun; - var inamo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); - var _in = yy + ui(32) * _s; + // var inamo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); + // var _in = yy + ui(32) * _s; - var hov = PANEL_GRAPH.value_focus; - var ind = -1; - if(hov != noone && struct_has(hov, "surface_index")) - ind = hov.surface_index; + // var hov = PANEL_GRAPH.value_focus; + // var ind = -1; + // if(hov != noone && struct_has(hov, "surface_index")) + // ind = hov.surface_index; - for( var i = 0; i < getInputAmount(); i++ ) { - var idx = getInputIndex(i); - jun = ds_list_get(inputs, idx, noone); - if(jun == noone || is_undefined(jun)) continue; - jun.x = xx; - jun.y = _in; + // for( var i = 0; i < getInputAmount(); i++ ) { + // var idx = getInputIndex(i); + // jun = ds_list_get(inputs, idx, noone); + // if(jun == noone || is_undefined(jun)) continue; + // jun.x = xx; + // jun.y = _in; - if(i >= input_fix_len) { - jun.hover_effect = lerp_float(jun.hover_effect, ind == idx, 3); - var sp = jun.hover_effect * 24; - var sx = xx - sp * _s; - var sy = _in; + // if(i >= input_fix_len) { + // jun.hover_effect = lerp_float(jun.hover_effect, ind == idx, 3); + // var sp = jun.hover_effect * 24; + // var sx = xx - sp * _s; + // var sy = _in; - for( var j = 1; j < data_length; j++ ) { - var _jun = ds_list_get(inputs, idx + j, noone); - _jun.x = sx; - _jun.y = sy; + // for( var j = 1; j < data_length; j++ ) { + // var _jun = ds_list_get(inputs, idx + j, noone); + // _jun.x = sx; + // _jun.y = sy; - sy += sp * _s * _jun.isVisible(); - } - } + // sy += sp * _s * _jun.isVisible(); + // } + // } - _in += 24 * _s * jun.isVisible(); - } + // _in += 24 * _s * jun.isVisible(); + // } - var outamo = output_display_list == -1? ds_list_size(outputs) : array_length(output_display_list); + // var outamo = output_display_list == -1? ds_list_size(outputs) : array_length(output_display_list); - xx = xx + w * _s; - _in = yy + ui(32) * _s; - for(var i = 0; i < outamo; i++) { - var idx = getOutputJunctionIndex(i); - jun = outputs[| idx]; + // xx = xx + w * _s; + // _in = yy + ui(32) * _s; + // for(var i = 0; i < outamo; i++) { + // var idx = getOutputJunctionIndex(i); + // jun = outputs[| idx]; - jun.x = xx; - jun.y = _in; - _in += 24 * _s * jun.isVisible(); - } - } #endregion + // jun.x = xx; + // jun.y = _in; + // _in += 24 * _s * jun.isVisible(); + // } + //} #endregion static onValueFromUpdate = function(index) { #region if(LOADING || APPENDING) return; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 4ebb0f219..17821fc1b 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -14,6 +14,7 @@ enum DYNA_INPUT_COND { } function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { + #region ---- main & active ---- active = true; renderActive = true; @@ -173,7 +174,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { attributeEditors = [ "Display", - ["Params Width", function() { return attributes.node_param_width; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.node_param_width = val; setHeight(); }) ], + ["Params Width", function() { return attributes.node_param_width; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.node_param_width = val; refreshNodeDisplay(); }) ], "Node update", ["Auto update", function() { return attributes.update_graph; }, new checkBox(function() { attributes.update_graph = !attributes.update_graph; }) ], @@ -394,8 +395,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height); fix_h = h; - getJunctionList(); - } run_in(1, function() { setHeight(); }); #endregion + } #endregion static setDisplayName = function(_name) { #region renamed = true; @@ -684,7 +684,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(!is_instanceof(self, Node_Collection)) render_time = get_timer() - render_timer; - setHeight(); + refreshNodeDisplay(); LOG_BLOCK_END(); } #endregion @@ -717,7 +717,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static triggerRender = function() { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"Trigger render for {INAME}"); + //printCallStack(); + LOG_IF(global.FLAG.render == 1, $"Trigger render for {self}"); setRenderStatus(false); RENDER_PARTIAL @@ -899,8 +900,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static setRenderStatus = function(result) { #region INLINE + if(rendered == result) return; - LOG_LINE_IF(global.FLAG.render == 1, $"Set render status for {INAME} : {result}"); + LOG_LINE_IF(global.FLAG.render == 1, $"Set render status for {self} : {result}"); rendered = result; } #endregion @@ -926,8 +928,16 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { draw_graph_culled = !rectangle_in_rectangle(minx, miny, maxx, maxy, x0, y0, x1, y1); } #endregion + static refreshNodeDisplay = function() { #region + INLINE + + updateIO(); + setHeight(); + getJunctionList(); + } run_in(1, function() { refreshNodeDisplay(); }); #endregion + static getJunctionList = function() { #region - var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); + var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); inputDisplayList = []; for(var i = 0; i < amo; i++) { @@ -940,15 +950,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { array_push(inputDisplayList, jun); } - } run_in(1, function() { getJunctionList() }); #endregion + }#endregion static preDraw = function(_x, _y, _s) { #region var xx = x * _s + _x; var yy = y * _s + _y; var jun; - //getJunctionList(); - var inspCount = hasInspector1Update() + hasInspector2Update(); var ind = 1; if(hasInspector1Update()) { @@ -970,7 +978,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { updatedOutTrigger.y = yy + 10; if(in_cache_len != array_length(inputDisplayList) || out_cache_len != ds_list_size(outputs)) { - updateIO(); + refreshNodeDisplay(); in_cache_len = array_length(inputDisplayList); out_cache_len = ds_list_size(outputs); @@ -978,13 +986,18 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * show_parameter) * _s; - for(var i = 0; i < inputs_amount; i++) { - var idx = inputs_index[i]; - jun = inputs[| idx]; + for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) { + jun = inputs[| i]; + jun.x = xx; + jun.y = _iny; + } + + for(var i = 0; i < in_cache_len; i++) { + jun = inputDisplayList[i]; jun.x = xx; jun.y = _iny; - _iny += junction_draw_hei_y * _s * jun.isVisible(); + _iny += junction_draw_hei_y * _s; } xx = xx + w * _s; @@ -1026,6 +1039,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, cc, aa); } #endregion + __draw_bbox = BBOX(); static drawGetBbox = function(xx, yy, _s) { #region var pad_label = draw_name && display_parameter.avoid_label; @@ -1049,7 +1063,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var y0 = _yc - _h / 2; var y1 = _yc + _h / 2; - return BBOX().fromPoints(x0, y0, x1, y1); + return __draw_bbox.fromPoints(x0, y0, x1, y1); } #endregion static drawNodeName = function(xx, yy, _s) { #region @@ -1119,9 +1133,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { draw_set_text(f_sdf, fa_left, fa_center, jun.color_display); draw_text_add(lx, jun.y, jun.getName(), _s * 0.25); - if(jun.value_from) continue; - - if(wd == noone) { + if(jun.value_from || wd == noone) { jy += wh; continue; } @@ -1161,7 +1173,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static drawJunctions = function(_x, _y, _mx, _my, _s) { #region if(!active) return; var hover = noone; - gpu_set_texfilter(true); for(var i = 0, n = array_length(inputDisplayList); i < n; i++) { var jun = inputDisplayList[i]; @@ -1193,7 +1204,48 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } onDrawJunctions(_x, _y, _mx, _my, _s); - gpu_set_texfilter(false); + + return hover; + } #endregion + + static drawJunctions_fast = function(_x, _y, _mx, _my, _s) { #region + if(!active) return; + var hover = noone; + + _s = _s * 6; + + draw_set_circle_precision(4); + + for(var i = 0, n = array_length(inputDisplayList); i < n; i++) { + var jun = inputDisplayList[i]; + + if(jun.drawJunction_fast(_s, _mx, _my)) + hover = jun; + } + + for(var i = 0; i < ds_list_size(outputs); i++) { + var jun = outputs[| i]; + + if(jun.drawJunction_fast(_s, _mx, _my)) + hover = jun; + } + + if(hasInspector1Update()) { + if(inspectInput1.drawJunction_fast(_s, _mx, _my)) + hover = inspectInput1; + } + + if(hasInspector2Update()) { + if(inspectInput2.drawJunction_fast(_s, _mx, _my)) + hover = inspectInput2; + } + + if(attributes.show_update_trigger) { + if(updatedInTrigger.drawJunction_fast(_s, _mx, _my)) hover = updatedInTrigger; + if(updatedOutTrigger.drawJunction_fast(_s, _mx, _my)) hover = updatedOutTrigger; + } + + onDrawJunctions(_x, _y, _mx, _my, _s / 6); return hover; } #endregion @@ -1330,17 +1382,18 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { switch(_node.type) { case VALUE_TYPE.surface : case VALUE_TYPE.dynaSurface : - var val = _node.getValue(); + var val = _node.showValue(); return val; } return noone; } #endregion + __preview_surf = noone; + __preview_sw = noone; + __preview_sh = noone; + static drawPreview = function(xx, yy, _s) { #region - if(draw_graph_culled) return; - if(!active) return; - var surf = getGraphPreviewSurface(); if(surf == noone) return; @@ -1359,14 +1412,25 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { surf = surf[preview_index]; } - preview_surface = is_surface(surf)? surf : noone; + preview_surface = surf; if(preview_surface == noone) return; + //if(__preview_surf != preview_surface) { + __preview_sw = surface_get_width(preview_surface); + __preview_sh = surface_get_height(preview_surface); + // __preview_surf = preview_surface; + //} + var bbox = drawGetBbox(xx, yy, _s); var aa = 0.5 + 0.5 * renderActive; if(!isHighlightingInGraph()) aa *= 0.25; - draw_surface_bbox(preview_surface, bbox, c_white, aa * graph_preview_alpha); + var _sw = __preview_sw; + var _sh = __preview_sh; + var _ss = min(bbox.w / _sw, bbox.h / _sh); + draw_surface_ext(preview_surface, bbox.xc - _sw * _ss / 2, bbox.yc - _sh * _ss / 2, _ss, _ss, 0, c_white, 1); + + //draw_surface_bbox(preview_surface, bbox, c_white, aa * graph_preview_alpha); } #endregion static getNodeDimension = function(showFormat = true) { #region @@ -1490,7 +1554,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { draw_droppable = false; } - return drawJunctions(xx, yy, _mx, _my, _s); + return _s > 0.5? drawJunctions(xx, yy, _mx, _my, _s) : drawJunctions_fast(xx, yy, _mx, _my, _s); } #endregion static onDrawNodeBehind = function(_x, _y, _mx, _my, _s) {} diff --git a/scripts/node_dynasurf_in/node_dynasurf_in.gml b/scripts/node_dynasurf_in/node_dynasurf_in.gml index 44a34df3d..21d62ad64 100644 --- a/scripts/node_dynasurf_in/node_dynasurf_in.gml +++ b/scripts/node_dynasurf_in/node_dynasurf_in.gml @@ -22,7 +22,7 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru inParent.from = self; ds_list_add(group.inputs, inParent); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); return inParent; diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index e0666a254..3bfdc6687 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -291,7 +291,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru ds_list_add(group.inputs, inParent); outputs[| 0].setFrom(inParent, false, false); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); onValueUpdate(0); diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 7d7f5abaf..1be8ad7f5 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -79,7 +79,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr outParent.from = self; ds_list_add(group.outputs, outParent); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); outParent.setFrom(inputs[| 0]); diff --git a/scripts/node_rigid_render_output/node_rigid_render_output.gml b/scripts/node_rigid_render_output/node_rigid_render_output.gml index c1f73373b..2d42534a4 100644 --- a/scripts/node_rigid_render_output/node_rigid_render_output.gml +++ b/scripts/node_rigid_render_output/node_rigid_render_output.gml @@ -49,7 +49,7 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x outParent.from = self; ds_list_add(group.outputs, outParent); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); } if(!LOADING && !APPENDING) createOutput(); #endregion diff --git a/scripts/node_smoke_render_output/node_smoke_render_output.gml b/scripts/node_smoke_render_output/node_smoke_render_output.gml index 1a622e290..e8351e1ac 100644 --- a/scripts/node_smoke_render_output/node_smoke_render_output.gml +++ b/scripts/node_smoke_render_output/node_smoke_render_output.gml @@ -47,7 +47,7 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x outParent.from = self; ds_list_add(group.outputs, outParent); - group.setHeight(); + group.refreshNodeDisplay(); group.sortIO(); } if(!LOADING && !APPENDING) createOutput(); #endregion diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 78dea42b7..705c1de0f 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -678,7 +678,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(_type == VALUE_TYPE.curve) display_type = VALUE_DISPLAY.curve; else if(_type == VALUE_TYPE.d3vertex) display_type = VALUE_DISPLAY.d3vertex; - display_data = { update: method(node, node.triggerRender) }; + display_data = {}; display_attribute = noone; popup_dialog = noone; @@ -885,8 +885,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru switch(display_type) { case VALUE_DISPLAY._default : #region editWidget = new textBox(_txt, function(val) { return setValueInspector(val); } ); - editWidget.slidable = true; - if(type == VALUE_TYPE.integer) editWidget.setSlidable(); + editWidget.setSlidable(); if(struct_has(display_data, "slide_speed")) editWidget.setSlidable(display_data.slide_speed); if(struct_has(display_data, "unit")) editWidget.unit = display_data.unit; @@ -1280,7 +1279,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } editWidgetRaw = editWidget; - graphWidget = variable_clone(editWidget); + if(editWidget) graphWidget = editWidget.clone(); for( var i = 0, n = ds_list_size(animator.values); i < n; i++ ) { animator.values[| i].ease_in_type = key_inter; @@ -1338,7 +1337,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(inp.visible != vis) { inp.visible = vis; - node.setHeight(); + node.refreshNodeDisplay(); } } #endregion @@ -1594,12 +1593,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru cache_hit &= cache_value[3] == applyUnit; cache_hit &= connect_type == JUNCTION_CONNECT.input; cache_hit &= unit.reference == noone || unit.mode == VALUE_UNIT.constant; - //cache_hit &= !expUse; if(cache_hit) { + print($"Get cache {name} = {cache_value[2]}"); + global.cache_hit++; return cache_value[2]; } + } var val = _getValue(_time, applyUnit, arrIndex, log); @@ -1828,22 +1829,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return is_anim; } #endregion + show_val = []; static showValue = function() { #region - var useCache = true; - if(display_type == VALUE_DISPLAY.area) - useCache = false; + INLINE - var val = getValue(CURRENT_FRAME, false, 0, useCache, true); + var val = animator.values[| 0].value; - if(isArray(val)) { - if(array_length(val) == 0) return 0; - var v = val[safe_mod(node.preview_index, array_length(val))]; - if(array_length(v) >= 100) return $"[{array_length(v)}]"; + if(value_from != noone || is_anim || expUse) + val = getValue(CURRENT_FRAME, false, 0, true, true); + + else if(sep_axis) { + show_val = array_verify(show_val, array_length(animators)); + for( var i = 0, n = array_length(animators); i < n; i++ ) + show_val[i] = animators[i].values[| 0].value; + val = show_val; } - if(editWidget != noone && instanceof(editWidget) == "textBox" && string_length(string(val)) > 1024) - val = $"[Long string ({string_length(string(val))} char)]"; - return val; } #endregion @@ -1939,9 +1940,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var r = _node.inputs[| ind].setValueDirect(val, index); if(_node == node) res = r; } - } else + } else { res = setValueDirect(val, index); + //print($"Node {node} : {node.name} {node.internalName}"); + //print($"Inspecting {PANEL_INSPECTOR.inspecting} : {PANEL_INSPECTOR.inspecting.name} {PANEL_INSPECTOR.inspecting.internalName}"); + //print($"{node == PANEL_INSPECTOR.inspecting}"); + //print(""); + } + return res; } #endregion @@ -1966,6 +1973,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } updated = animator.setValue(_val, _inp && record, time); + } if(type == VALUE_TYPE.gradient) updated = true; @@ -1999,7 +2007,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(is_instanceof(node, Node)) node.setInputData(self.index, animator.getValue(time)); - if(tags != VALUE_TAG.none) return true; + if(tags == VALUE_TAG.updateInTrigger || tags == VALUE_TAG.updateOutTrigger) return true; if(_update) { if(!IS_PLAYING) node.triggerRender(); @@ -2258,10 +2266,24 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return -1; } #endregion - static drawJunction = function(_s, _mx, _my, sca = 1) { #region - var ss = max(0.25, _s / 2); - var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); - var is_hover = hov && point_in_circle(_mx, _my, x, y, 10 * _s * sca); + static drawJunction_fast = function(_s, _mx, _my) { #region + INLINE + + var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); + var is_hover = hov && abs(_mx - x) + abs(_my - y) < _s; + + draw_set_color(draw_fg); + draw_circle(x, y, _s, false); + + return is_hover; + } #endregion + + static drawJunction = function(_s, _mx, _my) { #region + _s /= 2; + + var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); + var _d = 12 * _s; + var is_hover = hov && point_in_rectangle(_mx, _my, x - _d, y - _d, x + _d, y + _d); var _bgS = THEME.node_junctions_bg; var _fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline; @@ -2272,7 +2294,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(draw_blend != -1) _cbg = merge_color(draw_blend_color, _cbg, draw_blend); - draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, ss, ss, 0, _cbg, 1); + __draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, _s, _s, 0, _cbg, 1); } else { var _cbg = draw_bg; var _cfg = draw_fg; @@ -2282,8 +2304,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru _cfg = merge_color(draw_blend_color, _cfg, draw_blend); } - draw_sprite_ext(_bgS, draw_junction_index, x, y, ss, ss, 0, _cbg, 1); - draw_sprite_ext(_fgS, draw_junction_index, x, y, ss, ss, 0, _cfg, 1); + __draw_sprite_ext(_bgS, draw_junction_index, x, y, _s, _s, 0, _cbg, 1); + __draw_sprite_ext(_fgS, draw_junction_index, x, y, _s, _s, 0, _cfg, 1); } return is_hover; diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index 46efbc968..94482e189 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -133,4 +133,10 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new paddingBox(onModify, unit); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 44c215414..2515f874f 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -453,7 +453,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { array_foreach(nodes_selecting, function(node, index) { if(index == 0) __temp_show = !node.previewable; node.previewable = __temp_show; - node.setHeight(); + node.refreshNodeDisplay(); }); } #endregion @@ -462,7 +462,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { array_foreach(nodes_selecting, function(node, index) { if(index == 0) __temp_show = !node.show_parameter; node.show_parameter = __temp_show; - node.setHeight(); + node.refreshNodeDisplay(); }); } #endregion diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index daf895c77..0f71f101f 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -739,7 +739,7 @@ function Panel_Inspector() : PanelContent() constructor { } #region color picker - if(key_mod_press(ALT) && color_picker_index && textBox_slider.tb == noone) { + if(key_mod_press(ALT) && color_picker_index) { pickers[picker_index].editWidget.onColorPick(); } diff --git a/scripts/pathAnchorBox/pathAnchorBox.gml b/scripts/pathAnchorBox/pathAnchorBox.gml index aa8b0b039..467bd6d00 100644 --- a/scripts/pathAnchorBox/pathAnchorBox.gml +++ b/scripts/pathAnchorBox/pathAnchorBox.gml @@ -87,4 +87,10 @@ function pathAnchorBox(_onModify) : widget() constructor { resetFocus(); return h; } + + static clone = function() { #region + 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 df553c3de..6db8a3b9d 100644 --- a/scripts/pathArrayBox/pathArrayBox.gml +++ b/scripts/pathArrayBox/pathArrayBox.gml @@ -81,4 +81,10 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { return h; } + + static clone = function() { #region + 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 cce0ceb92..b33145862 100644 --- a/scripts/quarternionBox/quarternionBox.gml +++ b/scripts/quarternionBox/quarternionBox.gml @@ -55,6 +55,13 @@ function quarternionBox(_onModify) : widget() constructor { return false; } + static apply = function() { + for( var i = 0; i < size; i++ ) { + tb[i].apply(); + current_value[i] = toNumber(tb[i]._input_text); + } + } + static drawParam = function(params) { setParam(params); for(var i = 0; i < 4; i++) tb[i].setParam(params); @@ -115,10 +122,9 @@ function quarternionBox(_onModify) : widget() constructor { return _h; } - static apply = function() { - for( var i = 0; i < size; i++ ) { - tb[i].apply(); - current_value[i] = toNumber(tb[i]._input_text); - } - } + static clone = function() { #region + 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 7203452e1..3c84dc284 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -1,4 +1,5 @@ function rangeBox(_type, _onModify) : widget() constructor { + type = _type; onModify = _onModify; linked = false; @@ -34,38 +35,38 @@ function rangeBox(_type, _onModify) : widget() constructor { tb[i].label = labels[i]; } - static setSlideSpeed = function(speed) { + static setSlideSpeed = function(speed) { #region tb[0].setSlidable(speed); tb[1].setSlidable(speed); - } + } #endregion - static setInteract = function(interactable = noone) { + static setInteract = function(interactable = noone) { #region self.interactable = interactable; tb[0].interactable = interactable; if(!linked) tb[1].interactable = interactable; - } + } #endregion - static register = function(parent = noone) { + static register = function(parent = noone) { #region tb[0].register(parent); if(!linked) tb[1].register(parent); - } + } #endregion - static isHovering = function() { + static isHovering = function() { #region for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return false; - } + } #endregion - static drawParam = function(params) { + static drawParam = function(params) { #region 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) { + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region x = _x; y = _y; w = _w; @@ -122,5 +123,11 @@ function rangeBox(_type, _onModify) : widget() constructor { resetFocus(); return h; - } + } #endregion + + static clone = function() { #region + 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 d2c55ccd2..3598f28f0 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -124,4 +124,10 @@ function rotator(_onModify, _step = -1) : widget() constructor { return h; } #endregion + + static clone = function() { #region + 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 568db7a5a..024f9769e 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -456,4 +456,10 @@ function rotatorRandom(_onModify) : widget() constructor { return h; } #endregion + + static clone = function() { #region + 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 01ab33963..ca0b7c073 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -126,4 +126,10 @@ function rotatorRange(_onModify) : widget() constructor { return h; } #endregion + + static clone = function() { #region + var cln = new rotatorRange(onModify); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index 45621016b..fccc25709 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -130,4 +130,10 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor return h; } #endregion + + static clone = function() { #region + var cln = new scrollBox(data, onModify, update_hover); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index 0b868edb5..05925351f 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -1,8 +1,8 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { - slide_range = _range; - curr_range = [ _range[0], _range[1] ]; stepSize = _step; + slide_range = _range; isInt = _int; + curr_range = [ _range[0], _range[1] ]; onModify = _onModify; @@ -80,4 +80,10 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor { return h; } #endregion + + static clone = function() { #region + var cln = new sliderRange(stepSize, isInt, slide_range, onModify); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/surfaceBox/surfaceBox.gml b/scripts/surfaceBox/surfaceBox.gml index 096a1d54f..7886005ce 100644 --- a/scripts/surfaceBox/surfaceBox.gml +++ b/scripts/surfaceBox/surfaceBox.gml @@ -10,8 +10,7 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor { display_data = {}; cb_atlas_crop = new checkBox(function() { - display_data.atlas_crop = !display_data.atlas_crop; - display_data.update(); + display_data.atlas_crop = !display_data.atlas_crop; }); static trigger = function() { @@ -135,4 +134,10 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor { return h; } + + static clone = function() { #region + var cln = new surfaceBox(onModify, def_path); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index dbc4f991a..c57005e5e 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -1032,4 +1032,5 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor return hh; } #endregion + } \ No newline at end of file diff --git a/scripts/textArrayBox/textArrayBox.gml b/scripts/textArrayBox/textArrayBox.gml index 03e5a6093..2250ed4d5 100644 --- a/scripts/textArrayBox/textArrayBox.gml +++ b/scripts/textArrayBox/textArrayBox.gml @@ -2,19 +2,19 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { self.getArray = arraySet; self.arraySet = noone; - self.data = data; + self.data = data; self.onModify = onModify; hide = false; open = false; - static drawParam = function(params) { + static drawParam = function(params) { #region 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) { + static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) { #region x = _x; y = _y; w = _w; @@ -76,5 +76,11 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor { resetFocus(); return th; - } + } #endregion + + static clone = function() { #region + 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 ea4976013..1379a871a 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -27,6 +27,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { slide_range = noone; curr_range = [ 0, 1 ]; + slider_def_val = 0; + slider_cur_val = 0; + label = ""; starting_char = 1; @@ -160,7 +163,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { } } #endregion - static apply = function(fn = onModify) { #region + static apply = function(release = false) { #region var _input_text_current = _input_text; disp_x_to = 0; @@ -171,10 +174,18 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { _input_text_current = _last_text; current_value = _input_text_current; - if(is_callable(fn)) { - var _modi = fn(_input_text_current); - if(_modi && IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4; - return _modi; + if(release) { + if(is_callable(onRelease)) { + var _modi = onRelease(_input_text_current); + if(_modi && IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4; + return _modi; + } + } else { + if(is_callable(onModify)) { + var _modi = onModify(_input_text_current); + if(_modi && IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4; + return _modi; + } } if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4; @@ -401,6 +412,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(shake_amount) shake_amount--; } + var drawText = selecting || _h >= line_get_height(font); + switch(halign) { case fa_left: _x = _x; break; case fa_center: _x = _x - _w / 2; break; @@ -435,8 +448,10 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { case fa_right : tx = _x + _w - ui(8); break; } - var _update = !surface_valid(text_surface, _w - ui(16), _h); - if(_update) text_surface = surface_verify(text_surface, _w - ui(16), _h); + if(drawText) { + var _update = !surface_valid(text_surface, _w - ui(16), _h); + if(_update) text_surface = surface_verify(text_surface, _w - ui(16), _h); + } if(!hide) { draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1); @@ -485,15 +500,56 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(sliding == 1 && abs(slide_delta) > 8) { deactivate(); - textBox_slider.activate(toNumber(_input_text)); + var _defval = toNumber(_current_text); + slider_def_val = _defval; + slider_cur_val = _defval; + + CURSOR_LOCK_X = mouse_mx; + CURSOR_LOCK_Y = mouse_my; + sliding = 2; } if(sliding == 2) { - textBox_slider.tb = self; + MOUSE_BLOCK = true; + CURSOR_LOCK = true; + + if(mouse_check_button_pressed(mb_right)) { + _input_text = string_real(slider_def_val); + sliding = 0; + apply(); + deactivate(); + + UNDO_HOLDING = false; + + } else { + var _s = slide_speed; + var _mdx = window_mouse_get_delta_x(); + var _mdy = window_mouse_get_delta_y(); + var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy; + + if(key_mod_press(CTRL) && !slide_snap) _s *= 10; + if(key_mod_press(ALT)) _s /= 10; + + slider_cur_val += _dx * _s; + + if(slide_range != noone) + slider_cur_val = clamp(slider_cur_val, curr_range[0], curr_range[1]); + + var _val = value_snap(slider_cur_val, _s); + + if(key_mod_press(CTRL) && slide_snap) _val = value_snap(slider_cur_val, slide_snap); + if(slide_int) _val = round(_val); + + if(abs(_val) < _s * 4) _val = 0; + + _input_text = string_real(_val); + if(apply()) UNDO_HOLDING = true; + } + if(mouse_release(mb_left)) { deactivate(); - if(onRelease != noone) apply(onRelease); + if(onRelease != noone) apply(true); } } @@ -611,22 +667,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { deactivate(); } else { - draw_set_text(font, fa_left, fa_center); - var _display_text = _raw_text; - - if(input == TEXTBOX_INPUT.number) { - var dig = floor(_w / string_width("0")) - 3; - _display_text = string_real(_display_text, dig, precision); - } - - var tw = string_width(_display_text); - var th = string_height(_display_text); - - switch(align) { - case fa_left : break; - case fa_center : tx -= tw / 2; break; - case fa_right : tx -= tw; break; - } if(hover && hoverRect) { hovering = true; @@ -655,15 +695,34 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { } else if(!hide) draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable); - if(_update || _display_text != _disp_text) { - surface_set_shader(text_surface, noone, true, BLEND.add); - display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4)); - surface_reset_shader(); - } + if(drawText) { + draw_set_text(font, fa_left, fa_center); + var _display_text = _raw_text; - BLEND_ALPHA - draw_surface(text_surface, tb_surf_x, tb_surf_y); - BLEND_NORMAL + if(input == TEXTBOX_INPUT.number) { + var dig = floor(_w / string_width("0")) - 3; + _display_text = string_real(_display_text, dig, precision); + } + + var tw = string_width(_display_text); + var th = string_height(_display_text); + + switch(align) { + case fa_left : break; + case fa_center : tx -= tw / 2; break; + case fa_right : tx -= tw; break; + } + + if(_update || _display_text != _disp_text) { + surface_set_shader(text_surface, noone, true, BLEND.add); + display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4)); + surface_reset_shader(); + } + + BLEND_ALPHA + draw_surface(text_surface, tb_surf_x, tb_surf_y); + BLEND_NORMAL + } } if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) { diff --git a/scripts/textInput/textInput.gml b/scripts/textInput/textInput.gml index e14ff6fe1..f7e0ccbde 100644 --- a/scripts/textInput/textInput.gml +++ b/scripts/textInput/textInput.gml @@ -15,4 +15,15 @@ function textInput(_input, _onModify) : widget() constructor { } #endregion static breakCharacter = function(ch) { return ch == " " || ch == "\n"; } + + static clone = function() { + var _onModify = onModify; + onModify = noone; + + var cln = variable_clone(self); + cln.onModify = _onModify; + onModify = _onModify; + + return cln; + } } \ No newline at end of file diff --git a/scripts/toggleGroup/toggleGroup.gml b/scripts/toggleGroup/toggleGroup.gml index 362a340b8..ae4c6916d 100644 --- a/scripts/toggleGroup/toggleGroup.gml +++ b/scripts/toggleGroup/toggleGroup.gml @@ -77,4 +77,10 @@ function toggleGroup(_data, _onClick) : widget() constructor { return h; } + + static clone = function() { #region + var cln = new toggleGroup(data, onClick); + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/transformBox/transformBox.gml b/scripts/transformBox/transformBox.gml index 6a419fcf6..df4ab7e3e 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) { + static setInteract = function(interactable = noone) { #region 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() { + static isHovering = function() { #region for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; return hovering; - } + } #endregion - static drawParam = function(params) { + static drawParam = function(params) { #region 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) { + static draw = function(_x, _y, _w, _h, _data, _m) { #region x = _x; y = _y; w = _w; @@ -109,5 +109,11 @@ function transformBox(_onModify) : widget() constructor { resetFocus(); return h; - } + } #endregion + + static clone = function() { #region + 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 c95ce0b83..e590a3a2c 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -51,6 +51,13 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { tb[i].slidable = true; } + static apply = function() { #region + for( var i = 0; i < size; i++ ) { + tb[i].apply(); + current_value[i] = toNumber(tb[i]._input_text); + } + } #endregion + static setLinkInactiveColor = function(color) { #region link_inactive_color = color; return self; @@ -83,10 +90,10 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { unit.triggerButton.register(parent); } #endregion - static isHovering = function() { + static isHovering = function() { #region 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 setParam(params); @@ -95,7 +102,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { 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) { + static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region x = _x; y = _y; w = _w; @@ -168,12 +175,14 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { resetFocus(); return h; - } + } #endregion - static apply = function() { - for( var i = 0; i < size; i++ ) { - tb[i].apply(); - current_value[i] = toNumber(tb[i]._input_text); - } - } + static clone = function() { #region + var cln = new vectorBox(size, onModify, unit); + + cln.linkable = linkable; + cln.per_line = per_line; + + return cln; + } #endregion } \ No newline at end of file diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 6507df199..595496999 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -1,5 +1,6 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() constructor { size = _size; + type = _type; onModify = _onModify; unit = _unit; linked = false; @@ -135,4 +136,13 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const return h; } #endregion + + static clone = function() { #region + 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 63f425cea..b0769ca46 100644 --- a/scripts/widget/widget.gml +++ b/scripts/widget/widget.gml @@ -23,22 +23,22 @@ function widget() constructor { rx = 0; ry = 0; - static setLua = function(_lua_thread, _lua_key, _lua_func) { + static setLua = function(_lua_thread, _lua_key, _lua_func) { #region lua_thread = _lua_thread; lua_thread_key = _lua_key; onModify = method(self, _lua_func); - } + } #endregion - static setInteract = function(interactable = noone) { + static setInteract = function(interactable = noone) { #region self.interactable = interactable; - } + } #endregion - static register = function(parent = noone) { + static register = function(parent = noone) { #region if(!interactable) return; array_push(WIDGET_ACTIVE, self); self.parent = parent; - } + } #endregion static setParam = function(params) { #region font = params.font; @@ -48,42 +48,44 @@ function widget() constructor { static trigger = function() { } - static parentFocus = function() { + static parentFocus = function() { #region 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() { + static activate = function() { #region if(!interactable) return; WIDGET_CURRENT = self; WIDGET_CURRENT_SCROLL = parent; parentFocus(); - } + } #endregion - static deactivate = function() { + static deactivate = function() { #region if(WIDGET_CURRENT != self) return; WIDGET_CURRENT = noone; WIDGET_CURRENT_SCROLL = noone; - } + } #endregion - static setFocusHover = function(active = false, hover = false) { + static setFocusHover = function(active = false, hover = false) { #region self.active = interactable && active; self.hover = interactable && hover; self.iactive = active; self.ihover = hover; - } + } #endregion - static resetFocus = function() { + static resetFocus = function() { #region active = false; hover = false; - } + } #endregion + + static clone = function() { return variable_clone(self); } static drawParam = function(params) {} static draw = function() {}