diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 2c78b33dc..f0f60c908 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -749,7 +749,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static resetDefault = function() { var folder = instanceof(self); - if(!ds_map_exists(global.PRESETS_MAP, folder)) return; + if(!ds_map_exists(global.PRESETS_MAP, folder)) { + for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) + inputs[| i].resetValue(); + return; + } var pres = global.PRESETS_MAP[? folder]; for( var i = 0, n = array_length(pres); i < n; i++ ) { @@ -758,9 +762,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { deserialize(loadPreset(preset), true, true); applyDeserialize(true); + return; } - doUpdate(); + for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) + inputs[| i].resetValue(); + } if(!APPENDING && !LOADING) run_in(1, method(self, resetDefault)); static addInput = function(junctionFrom, shift = input_fix_len) { diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index cfe99c382..0d28ebd71 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -122,10 +122,12 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text); draw_text_cut((draw_x0 + draw_x1) / 2, draw_y0 + name_height + 1, txt, _w - 4); + // draw_text_ext_add((draw_x0 + draw_x1) / 2, draw_y0 + name_height + 1, txt, -1, _w - 4); + // name_height = max(18, string_height_ext(txt, -1, _w - 4)); if(point_in_rectangle(_mx, _my, draw_x0, draw_y0, draw_x0 + _w, draw_y0 + name_height)) { if(PANEL_GRAPH.pFOCUS && DOUBLE_CLICK) - tb_name.activate(); + tb_name.activate(txt); } } diff --git a/scripts/panel_globalvar/panel_globalvar.gml b/scripts/panel_globalvar/panel_globalvar.gml index 99bda308c..734bc89bc 100644 --- a/scripts/panel_globalvar/panel_globalvar.gml +++ b/scripts/panel_globalvar/panel_globalvar.gml @@ -70,7 +70,7 @@ function Panel_Globalvar() : PanelContent() constructor { draw_sprite_stretched_ext(THEME.timeline_node, 0, _bx, _by, _bw, _add_h, _hov? COLORS._main_icon_light : COLORS._main_icon, .3 + _hov * .1); draw_sprite_stretched_ext(THEME.timeline_node, 1, _bx, _by, _bw, _add_h, _hov? COLORS._main_icon_light : COLORS._main_icon, .6 + _hov * .25); draw_set_text(f_p2, fa_center, fa_center, _hov? COLORS._main_icon_light : COLORS._main_icon); - draw_text_add(_bx + _bw / 2, _by + _add_h / 2, __txt("Exit")); + draw_text_add(_bx + _bw / 2, _by + _add_h / 2, __txt("Apply")); contentPane.hover_content |= _hov; if(mouse_press(mb_left, _hov && pFOCUS)) diff --git a/scripts/panel_nodes/panel_nodes.gml b/scripts/panel_nodes/panel_nodes.gml index 61ab49ab9..1b9ccbef3 100644 --- a/scripts/panel_nodes/panel_nodes.gml +++ b/scripts/panel_nodes/panel_nodes.gml @@ -1,29 +1,20 @@ function Panel_Nodes() : PanelContent() constructor { - #region data - title = __txt("Nodes"); - showHeader = false; - - w = ui(320); - h = ui(480); - - title_height = 64; - padding = 20; - - search_string = ""; - - tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { - search_string = string(str); - }); - tb_search.align = fa_left; - tb_search.auto_update = true; - tb_search.boxColor = COLORS._main_icon_light; - - node_collapse = ds_map_create(); - #endregion + title = __txt("Nodes"); + padding = 8; + + w = ui(320); + h = ui(480); + + search_string = ""; + + tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); }); + tb_search.align = fa_left; + tb_search.auto_update = true; + tb_search.boxColor = COLORS._main_icon_light; + + node_collapse = ds_map_create(); - function onResize() { - sc_nodes.resize(w - ui(padding + padding), h - ui(padding + title_height + 40)); - } + function onResize() { sc_nodes.resize(w - ui(padding + padding), h - ui(padding + padding + 40)); } function drawNodeList(_arr, _x0, _x1, _y, _m) { var ww = sc_nodes.surface_w; @@ -60,6 +51,7 @@ function Panel_Nodes() : PanelContent() constructor { } } else draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _x0, _y, _x1 - _x0, hg, COLORS._main_icon_light, 1); + draw_sprite_stretched_add(THEME.ui_panel_fg, 0, _x0, _y, _x1 - _x0, hg, c_white, .3); var bw = ui(24); var bh = ui(24); @@ -72,12 +64,11 @@ function Panel_Nodes() : PanelContent() constructor { var _n = ALL_NODES[? instanceof(node)]; var spr = _n.spr; - draw_sprite_ui(spr, 1, _x0 + ui(4 + 16), _y + hg / 2, 0.25, 0.25, 0, c_white, 0.75); + draw_sprite_ui(spr, 1, _x0 + ui(4 + 16), _y + hg / 2, 0.25, 0.25, 0, c_white, 1); var cc = COLORS._main_text; draw_set_text(f_p1, fa_left, fa_center, cc); draw_text(_x0 + hg + ui(8) + (isGroup * ui(20)), _y + hg / 2, name); - if(isGroup) - draw_sprite_ui(THEME.arrow, (!node_collapse[? node.node_id]) * 3, _x0 + hg + ui(16), _y + hg / 2,,,,, 0.75); + if(isGroup) draw_sprite_ui(THEME.arrow, (!node_collapse[? node.node_id]) * 3, _x0 + hg + ui(16), _y + hg / 2,,,,, 0.75); _y += hg + ui(4); _h += hg + ui(4); @@ -92,7 +83,7 @@ function Panel_Nodes() : PanelContent() constructor { return _h; } - sc_nodes = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 40), function(_y, _m) { + sc_nodes = new scrollPane(w - ui(padding + padding), h - ui(padding + padding + 40), function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear, 0); var _h = drawNodeList(PROJECT.nodes, 0, sc_nodes.surface_w, _y, _m); return _h; @@ -100,13 +91,11 @@ function Panel_Nodes() : PanelContent() constructor { function drawContent(panel) { draw_clear_alpha(COLORS.panel_bg_clear, 0); - PANEL_PADDING - PANEL_TITLE var px = ui(padding); - var py = ui(title_height); + var py = ui(padding); var pw = w - ui(padding + padding); - var ph = h - ui(title_height + padding); + var ph = h - ui(padding + padding); draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); tb_search.setFocusHover(pFOCUS, pHOVER); diff --git a/scripts/panel_presets/panel_presets.gml b/scripts/panel_presets/panel_presets.gml index 477ba6ce5..80f75e6a0 100644 --- a/scripts/panel_presets/panel_presets.gml +++ b/scripts/panel_presets/panel_presets.gml @@ -112,6 +112,11 @@ function Panel_Presets(_node) : PanelContent() constructor { aa = .75; sc_presets.hover_content = true; + if(mouse_press(mb_left, pFOCUS)) { + node.resetDefault(); + if(in_dialog && panel.destroy_on_click_out) close(); + } + if(mouse_press(mb_right, pFOCUS)) menuCall("preset_window_menu",,, context_def); } diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index b3e8d1b10..01643a4d8 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -103,15 +103,15 @@ 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() { + static activate = function(_def_str = _current_text) { WIDGET_CURRENT = self; WIDGET_CURRENT_SCROLL = parent; parentFocus(); - _input_text = _current_text; - _last_text = _current_text; + _input_text = _def_str; + _last_text = _def_str; - cursor = string_length(_current_text); + cursor = string_length(_def_str); cursor_select = 0; click_block = 1;