From 292deadd78d2059c9b528a013464498c8bef234a Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sun, 26 Nov 2023 19:16:38 +0700 Subject: [PATCH] Fix several more things --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 1 + objects/o_dialog_add_node/Create_0.gml | 2 +- .../Create_0.gml | 14 ++-- .../o_dialog_file_name_collection/Draw_64.gml | 23 ++++-- objects/o_dialog_splash/Create_0.gml | 15 ++-- objects/o_dialog_splash/Draw_64.gml | 2 +- .../Create_0.gml | 4 ++ objects/o_main/Create_0.gml | 2 + objects/o_main/Step_1.gml | 2 +- .../animation_controller.gml | 71 ++++++++++--------- scripts/globals/globals.gml | 6 +- scripts/node_collection/node_collection.gml | 2 +- .../node_image_splice_sheet.gml | 58 +++++++-------- scripts/node_number/node_number.gml | 2 + .../node_pb_box_divide/node_pb_box_divide.gml | 8 +-- .../node_pb_box_inset/node_pb_box_inset.gml | 4 +- .../node_pb_box_split/node_pb_box_split.gml | 10 ++- .../node_pb_draw_roundrectangle.gml | 8 +-- scripts/node_pb_fx/node_pb_fx.gml | 11 +++ scripts/node_pb_layer/node_pb_layer.gml | 13 +++- .../node_pixel_builder/node_pixel_builder.gml | 58 ++++----------- scripts/node_polar/node_polar.gml | 5 +- scripts/node_processor/node_processor.gml | 7 +- .../node_texture_remap/node_texture_remap.gml | 2 +- scripts/node_transform/node_transform.gml | 19 ++--- scripts/node_value/node_value.gml | 44 ++++++++++-- scripts/panel_collection/panel_collection.gml | 20 +++--- .../panel_graph_export_image.gml | 6 +- scripts/pcx_ast/pcx_ast.gml | 6 +- .../steam_ugc_collection.gml | 20 ++++-- scripts/textArea/textArea.gml | 13 ++-- shaders/sh_polar/sh_polar.fsh | 6 +- .../sh_slice_spritesheet_empty_scan.fsh | 30 ++++++++ .../sh_slice_spritesheet_empty_scan.vsh | 19 +++++ .../sh_slice_spritesheet_empty_scan.yy | 10 +++ 36 files changed, 314 insertions(+), 210 deletions(-) create mode 100644 shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.fsh create mode 100644 shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.vsh create mode 100644 shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 9846fb88e..3601175ba 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1198,6 +1198,7 @@ {"name":"s_node_3d_plane","order":6,"path":"sprites/s_node_3d_plane/s_node_3d_plane.yy",}, {"name":"Regex","order":7,"path":"extensions/Regex/Regex.yy",}, {"name":"s_node_path_shift","order":4,"path":"sprites/s_node_path_shift/s_node_path_shift.yy",}, + {"name":"sh_slice_spritesheet_empty_scan","order":10,"path":"shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy",}, {"name":"s_node_grid_tri","order":6,"path":"sprites/s_node_grid_tri/s_node_grid_tri.yy",}, {"name":"s_node_local_analyze","order":52,"path":"sprites/s_node_local_analyze/s_node_local_analyze.yy",}, {"name":"_f_p0b","order":5,"path":"fonts/_f_p0b/_f_p0b.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 0b9a91917..417c37b11 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1891,6 +1891,7 @@ {"id":{"name":"Regex","path":"extensions/Regex/Regex.yy",},}, {"id":{"name":"s_node_path_shift","path":"sprites/s_node_path_shift/s_node_path_shift.yy",},}, {"id":{"name":"node_rigid_group","path":"scripts/node_rigid_group/node_rigid_group.yy",},}, + {"id":{"name":"sh_slice_spritesheet_empty_scan","path":"shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy",},}, {"id":{"name":"s_node_grid_tri","path":"sprites/s_node_grid_tri/s_node_grid_tri.yy",},}, {"id":{"name":"s_node_local_analyze","path":"sprites/s_node_local_analyze/s_node_local_analyze.yy",},}, {"id":{"name":"_f_p0b","path":"fonts/_f_p0b/_f_p0b.yy",},}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index c9356eb17..0195974c2 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -363,7 +363,7 @@ event_inherited(); } else if(ADD_NODE_PAGE == -1) { #region _list = NEW_NODES; #endregion - } else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT) { #region + } else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT && category == NODE_CATEGORY) { #region _list = ds_list_create(); var sug = []; diff --git a/objects/o_dialog_file_name_collection/Create_0.gml b/objects/o_dialog_file_name_collection/Create_0.gml index 807db658e..70a9b2e4b 100644 --- a/objects/o_dialog_file_name_collection/Create_0.gml +++ b/objects/o_dialog_file_name_collection/Create_0.gml @@ -16,13 +16,16 @@ event_inherited(); meta_expand = false; updating = noone; update_note = "Updated"; + onModify = -1; - node = noone; + node = noone; data_path = ""; ugc = 0; ugc_loading = false; - //name = __txtx("new_collection_placeholder", "New collection"); + + tb_name = new textBox(TEXTBOX_INPUT.text, function(str) { meta.name = str; }); + KEYBOARD_STRING = ""; t_desc = new textArea(TEXTBOX_INPUT.text, function(str) { meta.description = str; }); t_auth = new textArea(TEXTBOX_INPUT.text, function(str) { meta.author = str; }); @@ -44,11 +47,4 @@ event_inherited(); dialog_w = dialog_w_expand; dialog_h = dialog_h_expand; } -#endregion - -#region text - onModify = -1; - tb_name = new textBox(TEXTBOX_INPUT.text, function(str) { meta.name = str; }); - - KEYBOARD_STRING = ""; #endregion \ No newline at end of file diff --git a/objects/o_dialog_file_name_collection/Draw_64.gml b/objects/o_dialog_file_name_collection/Draw_64.gml index 64bf1e89d..86b6d56ec 100644 --- a/objects/o_dialog_file_name_collection/Draw_64.gml +++ b/objects/o_dialog_file_name_collection/Draw_64.gml @@ -55,7 +55,7 @@ if(meta.author_steam_id == 0) meta.author_steam_id = STEAM_USER_ID; - if(updating == noone) { + if(updating == noone && node != noone) { saveCollection(node, data_path, meta.name, true, meta); } else { var _map = json_load_struct(updating.path); @@ -64,7 +64,22 @@ json_save_struct(updating.path, _map); json_save_struct(updating.meta_path, _meta); - updating.meta = meta; + var _newPath = $"{filename_dir(updating.path)}/{meta.name}.pxcc"; + var _newMeta = $"{filename_dir(updating.meta_path)}/{meta.name}.meta"; + var _oldSpr = $"{filename_dir(updating.path)}/{filename_name_only(updating.path)}.png"; + var _newSpr = $"{filename_dir(updating.path)}/{meta.name}.png"; + + if(_newPath != updating.path) { + file_rename(updating.path, _newPath); + file_rename(updating.meta_path, _newMeta); + if(file_exists(_oldSpr)) file_rename(_oldSpr, _newSpr); + } + + updating.path = _newPath; + updating.meta_path = _newMeta; + updating.spr_path[0] = _newSpr; + updating.meta = meta; + PANEL_COLLECTION.refreshContext(); } @@ -73,7 +88,7 @@ ugc_loading = true; } else if(ugc == 2) { saveCollection(node, data_path, updating.path, false, updating.meta); - steam_ugc_update_collection(updating,, update_note); + steam_ugc_update_collection(updating, false, update_note); ugc_loading = true; } else instance_destroy(); @@ -86,7 +101,7 @@ doExpand(); #endregion -#region metadata +#region display dialog_h = ui(64); if(meta_expand) { diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index aea2c22b4..4b1ce2203 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -44,15 +44,18 @@ event_inherited(); draw_clear_alpha(COLORS.panel_bg_clear_inner, 0); var expand = PREFERENCES.splash_expand_recent; var ww = ui(264); - var hh = 0; + var hh = ui(8); var pad = ui(8); var hgt = ui(16) + line_get_height(f_p0b) + line_get_height(f_p1); _y += pad; var col = expand? 2 : 1; var row = ceil(ds_list_size(RECENT_FILES) / col); + var hg = recent_thumbnail? ui(100) : hgt; for(var i = 0; i < row; i++) { + + if(_y > -(hg + pad) && _y < sp_recent.surface_h) for(var j = 0; j < col; j++) { var ind = i * col + j; if(ind >= ds_list_size(RECENT_FILES)) break; @@ -61,14 +64,8 @@ event_inherited(); var _dat = RECENT_FILE_DATA[| ind]; if(!file_exists(_rec)) continue; - var thmb = noone; - var hg = hgt; - if(recent_thumbnail) { - hg = ui(100); - thmb = _dat.getThumbnail(); - } - - var fx = j * (ww + ui(8)); + var thmb = recent_thumbnail? _dat.getThumbnail() : noone; + var fx = j * (ww + ui(8)); draw_sprite_stretched(THEME.ui_panel_bg, 1, fx, _y, ww, hg); if(thmb && _y + hg > 0 && _y < sp_recent.h) { diff --git a/objects/o_dialog_splash/Draw_64.gml b/objects/o_dialog_splash/Draw_64.gml index 8325c4d2b..81fd9114f 100644 --- a/objects/o_dialog_splash/Draw_64.gml +++ b/objects/o_dialog_splash/Draw_64.gml @@ -42,7 +42,7 @@ if !ready exit; draw_set_text(f_p0, fa_left, fa_bottom, COLORS._main_text_sub); draw_text(x0, y0 - ui(4), __txt("Recent files")); - //draw_sprite_stretched(THEME.ui_panel_bg, 1, x0, y0, x1 - x0, y1 - y0); + sp_recent.setFocusHover(sFOCUS, sHOVER); sp_recent.draw(x0 + ui(6), y0); draw_sprite_stretched(THEME.ui_panel_fg, 0, x0, y0, x1 - x0, y1 - y0); diff --git a/objects/o_dialog_textbox_autocomplete/Create_0.gml b/objects/o_dialog_textbox_autocomplete/Create_0.gml index 70ef3bbf1..f3482ca76 100644 --- a/objects/o_dialog_textbox_autocomplete/Create_0.gml +++ b/objects/o_dialog_textbox_autocomplete/Create_0.gml @@ -97,7 +97,11 @@ event_inherited(); textbox._input_text = $"{_sPreC}{rep}{_sPosC}"; textbox.cursor += _repAmo - _prmAmo; textbox.cut_line(); + textbox.autocomplete_delay = 0; textbox = noone; + + prompt = ""; + data = []; } #endregion diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index f9dd3cb85..e8c7cd486 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -326,4 +326,6 @@ #region debug //instance_create_depth(0, 0, 0, addon_key_displayer); + + __debug_animator_counter = 0; #endregion \ No newline at end of file diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index b12a8b370..3caa67030 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -75,7 +75,7 @@ _HOVERING_ELEMENT = noone; } #endregion -#region render +#region animation & render //physics_pause_enable(true); DEF_SURFACE_RESET(); diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index fb2cafaa5..d8c59b5c5 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -24,15 +24,14 @@ framerate = 30; is_playing = false; frame_progress = false; - play_freeze = 0; render_stop = false; + __debug_animator_counter = 0; + rendering = []; playback = ANIMATOR_END.loop; - static setFrame = function(frame, resetTime = true) { - //if(frame == 0) resetAnimation(); - + static setFrame = function(frame, resetTime = true) { #region var _c = current_frame; frame = clamp(frame, 0, frames_total); real_frame = frame; @@ -41,12 +40,12 @@ if(current_frame == frames_total) { if(render_stop) { is_playing = false; - setFrame(0); + setFrame(0, resetTime); render_stop = false; } else if(playback == ANIMATOR_END.stop) { is_playing = false; } else { - setFrame(0); + setFrame(0, resetTime); } } @@ -59,9 +58,9 @@ frame_progress = false; if(array_length(rendering)) render_stop = true; - } + } #endregion - static resetAnimation = function() { + static resetAnimation = function() { #region var _key = ds_map_find_first(PROJECT.nodeMap); var amo = ds_map_size(PROJECT.nodeMap); @@ -70,61 +69,63 @@ _node.resetAnimation(); _key = ds_map_find_next(PROJECT.nodeMap, _key); } - } + } #endregion - static render = function() { + static render = function() { #region setFrame(0); is_playing = true; frame_progress = true; time_since_last_frame = 0; - } + } #endregion - static toggle = function() { + static toggle = function() { #region is_playing = !is_playing; frame_progress = true; time_since_last_frame = 0; - } + } #endregion - static pause = function() { + static pause = function() { #region is_playing = false; frame_progress = true; time_since_last_frame = 0; - } + } #endregion - static play = function() { + static play = function() { #region setFrame(0); is_playing = true; frame_progress = true; time_since_last_frame = 0; - } + } #endregion - static resume = function() { + static resume = function() { #region is_playing = true; frame_progress = true; time_since_last_frame = 0; - } + } #endregion - static stop = function() { + static stop = function() { #region setFrame(0); is_playing = false; time_since_last_frame = 0; - } + } #endregion - static step = function() { - if(is_playing && play_freeze == 0) { - time_since_last_frame += framerate * (delta_time / 1000000); + static step = function() { #region + if(!is_playing) return; + + var _frTime = 1 / framerate; + time_since_last_frame += delta_time / 1_000_000; + var tslf = time_since_last_frame; - if(time_since_last_frame >= 1) { - setFrame(real_frame + 1, false); - time_since_last_frame -= 1; - } - } else { - frame_progress = false; - //setFrame(real_frame); - time_since_last_frame = 0; + if(time_since_last_frame >= _frTime) { + setFrame(real_frame + 1, false); + time_since_last_frame -= _frTime; + + //var _t = get_timer(); + //print($"Frame progress {current_frame} delay {(_t - __debug_animator_counter) / 1000}"); + //__debug_animator_counter = _t; } - - play_freeze = max(0, play_freeze - 1); - } + + //print($" > TSLF: {tslf} > {_frTime} > {time_since_last_frame}"); + } #endregion } #endregion \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 860d98cd9..52154b78a 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -25,10 +25,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; LATEST_VERSION = 11500; - VERSION = 11584; + VERSION = 11585; SAVE_VERSION = 11600; - VERSION_STRING = "1.16rc4"; - BUILD_NUMBER = 11584; + VERSION_STRING = "1.16rc5"; + BUILD_NUMBER = 11585; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 73bbe16d1..894a990f8 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -295,7 +295,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static isActiveDynamic = function(frame = CURRENT_FRAME) { #region if(update_on_frame) return true; - for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) + for( var i = custom_input_index, n = ds_list_size(inputs); i < n; i++ ) if(inputs[| i].isActiveDynamic(frame) || !inputs[| i].from.rendered) return true; return false; diff --git a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml index 12f0e6b36..eece8b25d 100644 --- a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml +++ b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml @@ -100,6 +100,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru sprite_valid = []; spliceSurf = noone; + temp_surface = [ noone ]; + static getPreviewValues = function() { return getInputData(0); } static onValueFromUpdate = function() { _inSurf = noone; } @@ -300,6 +302,9 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _total = _amo[0] * _amo[1]; var _pad = getInputData(6); + surf_space = getInputData(5); + surf_origin = getInputData(9); + var ww = _dim[0] + _pad[0] + _pad[2]; var hh = _dim[1] + _pad[1] + _pad[3]; @@ -321,28 +326,37 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(_filt) { var filSize = 4; - var _empS = surface_create_valid(filSize, filSize, cDep); - var _buff = buffer_create(filSize * filSize * surface_format_get_bytes(cDep), buffer_fixed, 2); + temp_surface[0] = surface_verify(temp_surface[0], surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf)); + + surface_set_shader(temp_surface[0], sh_slice_spritesheet_empty_scan); + shader_set_dim("dimension", _inSurf); + shader_set_f("paddingStart", _pad[2], _pad[1]); + shader_set_f("spacing", surf_space[0], surf_space[1]); + shader_set_f("spriteDim", _dim[0], _dim[1]); + shader_set_color("color", _flcl); + shader_set_i("empty", !_fltp); + + draw_surface(_inSurf, 0, 0); + surface_reset_shader(); } var _atl = array_create(_total); var _sar = array_create(_total); var _arrAmo = 0; - surf_space = getInputData(5); - surf_origin = getInputData(9); - for(var i = 0; i < _total; i++) sprite_pos[i] = getSpritePosition(i); for(var i = 0; i < _total; i++) { var _s = array_safe_get(surf_array, i); - if(!surface_exists(_s)) _s = surface_create(ww, hh, cDep); + if(!is_surface(_s)) + _s = surface_create(ww, hh, cDep); else if(surface_get_format(_s) != cDep) { surface_free(_s); _s = surface_create(ww, hh, cDep); - } else if(_resizeSurf) _s = surface_resize(_s, ww, hh); + } else if(_resizeSurf) + surface_resize(_s, ww, hh); var _a = array_safe_get(atls_array, i, 0); if(_a == 0) _a = new SurfaceAtlas(_s, 0, 0); @@ -367,27 +381,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru continue; } - gpu_set_tex_filter(true); - surface_set_target(_empS); - DRAW_CLEAR - draw_surface_stretched_safe(_s, 0, 0, filSize, filSize); - surface_reset_target(); - gpu_set_tex_filter(false); - - buffer_get_surface(_buff, _empS, 0); - buffer_seek(_buff, buffer_seek_start, 0); - var empty = true; - - repeat(filSize * filSize - 1) { - var c = buffer_read(_buff, buffer_u32); - if(_fltp == 0 && ((c & 0xFF000000) >> 24) != 0) { - empty = false; - break; - } else if(_fltp == 1 && (c & 0x00FFFFFF) != _flcl) { - empty = false; - break; - } - } + var empPx = surface_get_pixel(temp_surface[0], _spr_pos[0], _spr_pos[1]); + var empty = empPx == 0.; if(!empty) { _atl[_arrAmo] = _a; @@ -408,11 +403,6 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(_out == 1) outputs[| 0].setValue(surf_array); outputs[| 1].setValue(atls_array); - - if(_filt) { - buffer_delete(_buff); - surface_free(_empS); - } } #endregion static update = function(frame = CURRENT_FRAME) { #region @@ -422,6 +412,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(_out == 1) { outputs[| 0].setValue(surf_array); update_on_frame = false; + + //outputs[| 0].setValue(temp_surface[0]); return; } diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index ee6363aa4..646b7b7c3 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -95,6 +95,8 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co static processData = function(_output, _data, _output_index, _array_index = 0) { #region var _res = _data[1]? round(_data[0]) : _data[0]; + if(!is_numeric(_res)) _res = real(_res); + display_output = _res; return _res; } #endregion diff --git a/scripts/node_pb_box_divide/node_pb_box_divide.gml b/scripts/node_pb_box_divide/node_pb_box_divide.gml index b57a8a068..c734aaac0 100644 --- a/scripts/node_pb_box_divide/node_pb_box_divide.gml +++ b/scripts/node_pb_box_divide/node_pb_box_divide.gml @@ -38,10 +38,8 @@ function Node_PB_Box_Divide(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group var _res = noone; - if(_output_index == 0) - _res = array_create(_amou); - else if(_output_index == 1) - _res = array_create(_amou - 1); + if(_output_index == 0) _res = array_create(_amou); + else if(_output_index == 1) _res = array_create(_amou - 1); var _spAmo = _amou; switch(_spacing) { @@ -52,7 +50,7 @@ function Node_PB_Box_Divide(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group } if(_axis == 0) { - var _ww = (_pbox.w - _spac * _spAmo) / _amou; + var _ww = (_pbox.w - _spac * _spAmo) / _amou; if(_output_index == 0) for( var i = 0; i < _amou; i++ ) { diff --git a/scripts/node_pb_box_inset/node_pb_box_inset.gml b/scripts/node_pb_box_inset/node_pb_box_inset.gml index 304de3142..afa6672e7 100644 --- a/scripts/node_pb_box_inset/node_pb_box_inset.gml +++ b/scripts/node_pb_box_inset/node_pb_box_inset.gml @@ -69,8 +69,8 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group) w = round(_nbox.w * _widt); h = round(_nbox.h * _high); - x0 = _nbox.x + (_nbox.w - w) * (_nbox.mirror_h? 1. - _hali : _hali); - y0 = _nbox.y + (_nbox.h - h) * (_nbox.mirror_v? 1. - _vali : _vali); + x0 = round(_nbox.x + (_nbox.w - w) * (_nbox.mirror_h? 1. - _hali : _hali)); + y0 = round(_nbox.y + (_nbox.h - h) * (_nbox.mirror_v? 1. - _vali : _vali)); } if(_output_index == 0) { diff --git a/scripts/node_pb_box_split/node_pb_box_split.gml b/scripts/node_pb_box_split/node_pb_box_split.gml index fc0acdc07..ef244f442 100644 --- a/scripts/node_pb_box_split/node_pb_box_split.gml +++ b/scripts/node_pb_box_split/node_pb_box_split.gml @@ -166,7 +166,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group) if(_mirr) draw_surface_ext_safe(_pbox.mask, 0, _nbox.h + shf, 1, -1, 0, c_white, 1); else - draw_surface_safe(_pbox.mask, -shf, 0); + draw_surface_safe(_pbox.mask, 0, -shf); surface_reset_target(); } @@ -177,7 +177,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group) if(_mirr) draw_surface_ext_safe(_pbox.content, 0, _nbox.h + shf, 1, -1, 0, c_white, 1); else - draw_surface_safe(_pbox.content, -shf, 0); + draw_surface_safe(_pbox.content, 0, -shf); surface_reset_target(); } } @@ -195,9 +195,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group) draw_set_color(c_white); draw_rectangle_border(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 2); - if(_axs == 0) - draw_line(bbox.xc, bbox.y0, bbox.xc, bbox.y1); - else - draw_line(bbox.x0, bbox.yc, bbox.x1, bbox.yc); + if(_axs == 0) draw_line(bbox.xc, bbox.y0, bbox.xc, bbox.y1); + else draw_line(bbox.x0, bbox.yc, bbox.x1, bbox.yc); } } \ No newline at end of file diff --git a/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml b/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml index 476f329ce..c48b614f7 100644 --- a/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml +++ b/scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.gml @@ -46,15 +46,9 @@ function Node_PB_Draw_Round_Rectangle(_x, _y, _group = noone) : Node_PB_Draw(_x, if(_rela) { inputs[| 4].setType(VALUE_TYPE.float); inputs[| 5].setType(VALUE_TYPE.float); - - inputs[| 4].editWidget.setSlideSpeed(0.001); - inputs[| 5].editWidget.setSlideSpeed(0.001); } else { inputs[| 4].setType(VALUE_TYPE.integer); inputs[| 5].setType(VALUE_TYPE.integer); - - inputs[| 4].editWidget.setSlideSpeed(0.01); - inputs[| 5].editWidget.setSlideSpeed(0.01); } } @@ -112,7 +106,7 @@ function Node_PB_Draw_Round_Rectangle(_x, _y, _group = noone) : Node_PB_Draw(_x, if(_rela) _corn = max(0, round(_corn * min(_pbox.w, _pbox.h))); if(_corn > array_length(corner_pixels)) - draw_roundrect_ext(_x0, _y0, _x1, _y1, 6 + _corn, 6 + _corn, false); + draw_roundrect_ext(_x0 - 1, _y0 - 1, _x1, _y1, 6 + _corn, 6 + _corn, false); else { draw_rectangle(_x0, _y0, _x1, _y1, false); BLEND_SUBTRACT diff --git a/scripts/node_pb_fx/node_pb_fx.gml b/scripts/node_pb_fx/node_pb_fx.gml index 38b2bb311..6910b7296 100644 --- a/scripts/node_pb_fx/node_pb_fx.gml +++ b/scripts/node_pb_fx/node_pb_fx.gml @@ -5,6 +5,17 @@ function Node_PB_Fx(_x, _y, _group = noone) : Node_PB(_x, _y, _group) constructo .setVisible(true, true); outputs[| 0] = nodeValue("pBox", self, JUNCTION_CONNECT.output, VALUE_TYPE.pbBox, noone); + + static getGraphPreviewSurface = function() { + var _nbox = outputs[| 0].getValue(); + if(_nbox == noone) return noone; + if(is_array(_nbox)) { + if(array_empty(_nbox)) return noone; + _nbox = _nbox[0]; + } + + return _nbox.content; + } } #macro PB_FX_PBOX if(_output_index == 1) { \ diff --git a/scripts/node_pb_layer/node_pb_layer.gml b/scripts/node_pb_layer/node_pb_layer.gml index 36a5ce8f4..dd5e617db 100644 --- a/scripts/node_pb_layer/node_pb_layer.gml +++ b/scripts/node_pb_layer/node_pb_layer.gml @@ -10,7 +10,18 @@ function Node_PB_Layer(_x, _y, _group = noone) : Node(_x, _y, _group) constructo outputs[| 0] = nodeValue("pBox", self, JUNCTION_CONNECT.output, VALUE_TYPE.pbBox, noone ); - static update = function() {} + static update = function() { + var _dim = group.getInputData(0); + + var _box = new __pbBox(); + _box.layer = getInputData(0); + _box.w = array_safe_get(_dim, 0, 1); + _box.h = array_safe_get(_dim, 1, 1); + _box.layer_w = array_safe_get(_dim, 0, 1); + _box.layer_h = array_safe_get(_dim, 1, 1); + + outputs[| 0].setValue(_box); + } static getPreviewValues = function() { return group.outputs[| 0].getValue(); } diff --git a/scripts/node_pixel_builder/node_pixel_builder.gml b/scripts/node_pixel_builder/node_pixel_builder.gml index 02adb0370..443ee1d32 100644 --- a/scripts/node_pixel_builder/node_pixel_builder.gml +++ b/scripts/node_pixel_builder/node_pixel_builder.gml @@ -18,7 +18,7 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g RENDER_ALL } - static getNextNodes = function() { + static getNextNodes = function() { #region var allReady = true; for(var i = custom_input_index; i < ds_list_size(inputs); i++) { var _in = inputs[| i].from; @@ -30,9 +30,9 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g if(!allReady) return []; return __nodeLeafList(getNodeList()); - } + } #endregion - static checkComplete = function() { + static checkComplete = function() { #region for( var i = 0; i < ds_list_size(nodes); i++ ) if(!nodes[| i].rendered) return []; @@ -47,33 +47,9 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g } return _nodes; - } + } #endregion - static update = function() { - var _dim = getInputData(0); - - for( var i = 0; i < ds_list_size(nodes); i++ ) { - var _n = nodes[| i]; - - if(!is_instanceof(_n, Node_PB_Layer)) - continue; - - var _layer = _n.getInputData(0); - - var _box = new __pbBox(); - _box.layer = _layer; - _box.w = _dim[0]; - _box.h = _dim[1]; - _box.layer_w = _dim[0]; - _box.layer_h = _dim[1]; - - _n.outputs[| 0].setValue(_box); - } - - outputs[| 0].setValue(surface_create(_dim[0], _dim[1])); - } - - static buildPixel = function() { + static buildPixel = function() { #region LOG_BLOCK_START(); LOG_IF(global.FLAG.render == 1, $"================== BUILD PIXEL =================="); LOG_BLOCK_START(); @@ -119,28 +95,24 @@ function Node_Pixel_Builder(_x, _y, _group = noone) : Node_Collection(_x, _y, _g } var _layers = ds_map_keys_to_array(_surfs); - array_sort(_layers, true); - _outSurf = surface_create(_dim[0], _dim[1]); + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + surface_set_target(_outSurf); DRAW_CLEAR - - for( var k = 0; k < array_length(_layers); k++ ) { - var _s = _surfs[? _layers[k]]; + for( var k = 0; k < array_length(_layers); k++ ) { + var _s = _surfs[? _layers[k]]; - for( var j = 0; j < array_length(_s); j++ ) { - var _box = _s[j]; - draw_surface_safe(_box.content, _box.x, _box.y); - } - } - + for( var j = 0; j < array_length(_s); j++ ) { + var _box = _s[j]; + draw_surface_safe(_box.content, _box.x, _box.y); + } + } surface_reset_target(); ds_map_destroy(_surfs); outputs[| 0].setValue(_outSurf); - } - - PATCH_STATIC + } #endregion } \ No newline at end of file diff --git a/scripts/node_polar/node_polar.gml b/scripts/node_polar/node_polar.gml index 5da1e460e..6b78626a2 100644 --- a/scripts/node_polar/node_polar.gml +++ b/scripts/node_polar/node_polar.gml @@ -24,11 +24,13 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 9] = nodeValue("Radius mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Inverse Square", "Logarithm" ]); + inputs[| 10] = nodeValue("Swap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 3, 4, ["Surfaces", false], 0, 1, 2, 7, 8, - ["Effect", false], 5, 6, 9, + ["Effect", false], 5, 6, 9, 10, ] attribute_surface_depth(); @@ -44,6 +46,7 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con shader_set_i("invert", _data[5]); shader_set_i("distMode", _data[9]); shader_set_f("blend", _data[6]); + shader_set_i("swap", _data[10]); draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index ac7bc7736..7255e5c0e 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -267,11 +267,12 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct all_inputs = array_verify(all_inputs, _len); for(var i = 0; i < _len; i++) { - var val = inputs[| i].getValue(); - var amo = inputs[| i].arrayLength(val); + var raw = inputs[| i].getValue(); + var amo = inputs[| i].arrayLength(raw); + var val = raw; if(amo == 0) val = noone; //empty array - else if(amo == 1) val = val[0]; //spread single array + else if(amo == 1) val = raw[0]; //spread single array amo = max(1, amo); setInputData(i, val); diff --git a/scripts/node_texture_remap/node_texture_remap.gml b/scripts/node_texture_remap/node_texture_remap.gml index a201ef4e6..aac62c8f0 100644 --- a/scripts/node_texture_remap/node_texture_remap.gml +++ b/scripts/node_texture_remap/node_texture_remap.gml @@ -36,7 +36,7 @@ function Node_Texture_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _outSurf = surface_verify(_outSurf, _sw, _sh); surface_set_shader(_outSurf, shader); - shader_set_interpolation_surface(_data[0]); + shader_set_interpolation(_data[0]); texture_set_stage(uniform_map, surface_get_texture(_data[1])); draw_surface_stretched_safe(_data[0], 0, 0, _sw, _sh); surface_reset_shader(); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index bab28136f..09d940a2c 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -197,7 +197,8 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var ww = surface_get_width_safe(ins); var hh = surface_get_height_safe(ins); - var _ww = ww, _hh = hh; + var _ww = ww; + var _hh = hh; if(_ww <= 1 && _hh <= 1) return _outSurf; switch(out_type) { @@ -244,7 +245,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) pos = point_rotate(pos[0], pos[1], pos[0] + anc[0], pos[1] + anc[1], rot); - if(mode == 1) { + if(mode == 1) { #region var _w = _ww * sqrt(2); var _h = _hh * sqrt(2); var _px = (_w - _ww) / 2; @@ -253,8 +254,8 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) surface_set_target(_s); DRAW_CLEAR - BLEND_OVERRIDE; - + BLEND_OVERRIDE + if(is_surface(ins)) { var draw_x, draw_y; draw_x = _px + pos[0]; @@ -267,17 +268,18 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_surface_tiled_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], c_white, 1); } - BLEND_NORMAL; + BLEND_NORMAL surface_reset_target(); var _cc = point_rotate(-_px, -_py, _ww / 2, _hh / 2, rot); surface_set_shader(_outSurf); - shader_set_interpolation_surface(_s); + shader_set_interpolation(_s); draw_surface_ext_safe(_s, _cc[0], _cc[1], 1, 1, rot, c_white, 1); surface_reset_shader(); surface_free(_s); - } else { + #endregion + } else { #region var draw_x, draw_y; draw_x = pos[0]; draw_y = pos[1]; @@ -288,7 +290,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } surface_set_shader(_outSurf); - shader_set_interpolation_surface(ins); + shader_set_interpolation(ins); draw_surface_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], rot, c_white, 1); if(mode == 2) { @@ -304,6 +306,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_surface_ext_safe(ins, draw_x + _ww, draw_y + _hh, sca[0], sca[1], rot, c_white, 1); } surface_reset_shader(); + #endregion } return _outSurf; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 2d14caf25..7e94080fd 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -575,6 +575,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru def_val = _value; def_length = is_array(def_val)? array_length(def_val) : 0; unit = new nodeValueUnit(self); + def_unit = VALUE_UNIT.constant; dyna_depo = ds_list_create(); value_tag = ""; @@ -694,11 +695,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return self; } #endregion - static resetValue = function() { setValue(def_val); is_modified = false; } + static resetValue = function() { #region + unit.mode = def_unit; + setValue(unit.apply(def_val)); + is_modified = false; + } #endregion static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region unit.reference = ref; unit.mode = mode; + def_unit = mode; cache_value[0] = false; return self; @@ -1406,6 +1412,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return value; } #endregion + static valueExpressionProcess = function(value) { #region + switch(type) { + case VALUE_TYPE.float : + case VALUE_TYPE.integer : + if(!is_numeric(value)) + return toNumber(value); + break; + case VALUE_TYPE.boolean : + return bool(value); + } + + return value; + } #endregion + static resetCache = function() { cache_value[0] = false; } static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region @@ -1497,6 +1517,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(connect_type == JUNCTION_CONNECT.output) return val; + if(expUse) { + if(is_array(val)) { + for( var i = 0, n = array_length(val); i < n; i++ ) + val[i] = valueExpressionProcess(val[i]); + } else + val = valueExpressionProcess(val); + return arrayBalance(val); + } + if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float) && accept_array) { //Dimension conversion if(is_array(val)) { var eqSize = true; @@ -1529,7 +1558,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru for( var i = 0, n = array_length(val); i < n; i++ ) _val[i] = valueProcess(val[i], nod, applyUnit, arrIndex); return _val; - } + } return valueProcess(val, nod, applyUnit, arrIndex); } #endregion @@ -1562,12 +1591,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru }; var _exp_res = expTree.eval(variable_clone(expContext)); - //print(json_stringify(expTree, true)); - //print($"======= {_exp_res}"); + printIf(global.LOG_EXPRESSION, $">>>> Result = {_exp_res}"); if(is_undefined(_exp_res)) { val[0] = 0; - noti_warning("Expression not returning any values."); + noti_warning("Expression not returning valid values."); } else val[0] = _exp_res; global.EVALUATE_HEAD = noone; @@ -1594,12 +1622,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru animators[i].values[| 0].time = CURRENT_FRAME; } } else { + var _val = animator.getValue(); ds_list_clear(animator.values); - animator.values[| 0] = new valueKey(0, animator.getValue(), animator); + animator.values[| 0] = new valueKey(0, _val, animator); for( var i = 0, n = array_length(animators); i < n; i++ ) { + var _val = animators[i].getValue(); ds_list_clear(animators[i].values); - animators[i].values[| 0] = new valueKey(0, animators[i].getValue(), animators[i]); + animators[i].values[| 0] = new valueKey(0, _val, animators[i]); } } diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 92a36f257..d5a8990d2 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -18,7 +18,7 @@ function Panel_Collection() : PanelContent() constructor { roots = [ ["Collections", COLLECTIONS] , ["Assets", global.ASSETS] ]; mode = 0; - root = roots[mode][1]; + root = roots[mode][1]; context = root; search_list = ds_list_create(); @@ -65,7 +65,7 @@ function Panel_Collection() : PanelContent() constructor { return; } - var icon_path = string_replace(_path, filename_ext(_path), "") + ".png"; + var icon_path = string_replace(_path, filename_ext(_path), ".png"); surface_save_safe(preview_surface, icon_path); refreshContext(); @@ -84,18 +84,11 @@ function Panel_Collection() : PanelContent() constructor { if(STEAM_ENABLED) { if(!meta.steam) { array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", function() { - var s = PANEL_PREVIEW.getNodePreviewSurface(); - if(!is_surface(s)) { - noti_warning("Please send any node to preview panel to use as a thumbnail.") - return; - } - var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320)); var meta = _menu_node.getMetadata(); if(meta != noone && meta != undefined) dia.meta = meta; - - dia.node = PANEL_INSPECTOR.getInspecting(); + dia.data_path = data_path; dia.ugc = 1; dia.updating = _menu_node; @@ -104,12 +97,17 @@ function Panel_Collection() : PanelContent() constructor { } else { if(meta.author_steam_id == STEAM_USER_ID && meta.file_id != 0) { array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_update", "Update Steam Workshop content") + "...", function() { + var _node = PANEL_INSPECTOR.getInspecting(); + if(_node == noone) { + noti_warning("No node selected. Select a node in graph panel to update workshop content."); + return; + } var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320)); var meta = _menu_node.getMetadata(); if(meta != noone && meta != undefined) dia.meta = meta; - dia.node = PANEL_INSPECTOR.getInspecting(); + dia.node = _node; dia.data_path = data_path; dia.ugc = 2; dia.updating = _menu_node; diff --git a/scripts/panel_graph_export_image/panel_graph_export_image.gml b/scripts/panel_graph_export_image/panel_graph_export_image.gml index f6e808489..5498e5548 100644 --- a/scripts/panel_graph_export_image/panel_graph_export_image.gml +++ b/scripts/panel_graph_export_image/panel_graph_export_image.gml @@ -136,14 +136,14 @@ function graph_export_image(allList, nodeList, settings = {}) { if(bgEnable) draw_clear(bgColor); else draw_clear_alpha(0, 0); + BLEND_ALPHA_MULP draw_surface(s, borderPad, borderPad); draw_set_color(borderColor); draw_set_alpha(borderAlpha); - - draw_rectangle(borderPad, borderPad, bbox_w + borderPad, bbox_h + borderPad, 1); - + draw_rectangle(borderPad, borderPad, bbox_w + borderPad, bbox_h + borderPad, 1); draw_set_alpha(1); + BLEND_NORMAL surface_reset_target(); diff --git a/scripts/pcx_ast/pcx_ast.gml b/scripts/pcx_ast/pcx_ast.gml index 0020a99ca..48f11ae3e 100644 --- a/scripts/pcx_ast/pcx_ast.gml +++ b/scripts/pcx_ast/pcx_ast.gml @@ -82,8 +82,9 @@ return true; } ]; - global.FUNCTIONS[? "surface_get_width"] = [ ["surface"], function(val) { return surface_get_width_safe(array_safe_get(val, 0)); } ]; - global.FUNCTIONS[? "surface_get_height"] = [ ["surface"], function(val) { return surface_get_height_safe(array_safe_get(val, 0)); } ]; + global.FUNCTIONS[? "surface_get_dimension"] = [ ["surface"], function(val) { var s = array_safe_get(val, 0); return [ surface_get_width_safe(s), surface_get_height_safe(s) ]; } ]; + global.FUNCTIONS[? "surface_get_width"] = [ ["surface"], function(val) { return surface_get_width_safe(array_safe_get(val, 0)); } ]; + global.FUNCTIONS[? "surface_get_height"] = [ ["surface"], function(val) { return surface_get_height_safe(array_safe_get(val, 0)); } ]; global.FUNCTIONS[? "color_hex"] = [ ["char"], function(val) { return colorFromHex(array_safe_get(val, 0)); } ]; global.FUNCTIONS[? "color_rgb"] = [ ["red", "green", "blue"], function(val) { return make_color_rgb(array_safe_get(val, 0), array_safe_get(val, 1), array_safe_get(val, 2)); } ]; @@ -464,6 +465,7 @@ printIf(global.LOG_EXPRESSION, $"symbol : {symbol}"); printIf(global.LOG_EXPRESSION, $"l : | {typeof(l)} |{l}|"); printIf(global.LOG_EXPRESSION, $"r : | {typeof(r)} |{r}|"); + printIf(global.LOG_EXPRESSION, $"params : {params}"); printIf(global.LOG_EXPRESSION, "===================="); break; } diff --git a/scripts/steam_ugc_collection/steam_ugc_collection.gml b/scripts/steam_ugc_collection/steam_ugc_collection.gml index b5d755aff..2dab34064 100644 --- a/scripts/steam_ugc_collection/steam_ugc_collection.gml +++ b/scripts/steam_ugc_collection/steam_ugc_collection.gml @@ -8,12 +8,13 @@ function steam_ugc_create_collection(file) { #region directory_destroy(DIRECTORY + "steamUGC"); directory_create(DIRECTORY + "steamUGC"); + file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); file_copy(file.meta_path, DIRECTORY + "steamUGC/" + filename_name(file.meta_path)); - if(array_safe_get(file.spr_path, 0, 0) != 0) + if(array_safe_get(file.spr_path, 0) != 0) file_copy(file.spr_path[0], DIRECTORY + "steamUGC/" + filename_name(file.spr_path[0])); - steam_ugc_collection_generate(file); + steam_ugc_collection_generate(array_safe_get(file.spr_path, 0)); STEAM_UGC_ITEM_ID = steam_ugc_create_item(STEAM_APP_ID, ugc_filetype_community); } #endregion @@ -28,6 +29,7 @@ function steam_ugc_update_collection(file, update_preview = false, update_note = directory_destroy(DIRECTORY + "steamUGC"); directory_create(DIRECTORY + "steamUGC"); + file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); file_copy(file.meta_path, DIRECTORY + "steamUGC/" + filename_name(file.meta_path)); if(array_safe_get(file.spr_path, 0, 0) != 0) @@ -44,17 +46,23 @@ function steam_ugc_update_collection(file, update_preview = false, update_note = array_insert(tgs, 0, "Collection"); array_push(tgs, VERSION_STRING); + steam_ugc_collection_generate(array_safe_get(file.spr_path, 0)); + steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs); steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC"); + if(file_exists(TEMPDIR + "steamUGCthumbnail.png")) + steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png"); STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note); } #endregion function steam_ugc_collection_generate(file, dest_path = TEMPDIR + "steamUGCthumbnail.png") { #region file_delete(dest_path); - var spr = STEAM_UGC_ITEM_FILE.getSpr(); + var prev_size = 512; - var _s = surface_create(prev_size, prev_size); + var spr = sprite_add(file, 0, false, false, 0, 0); + var _s = surface_create(prev_size, prev_size); + surface_set_target(_s); draw_clear(COLORS._main_icon_dark); draw_sprite_tiled(s_workshop_bg, 0, -64, -64); @@ -71,9 +79,9 @@ function steam_ugc_collection_generate(file, dest_path = TEMPDIR + "steamUGCthum draw_set_text(f_h2, fa_right, fa_bottom, COLORS._main_icon_dark); var _bw = 48 + string_width(VERSION_STRING); - var _bh = 88; + var _bh = 80; draw_sprite_stretched(s_workshop_badge_version, 0, prev_size - 8 - _bw, prev_size - 8 - _bh, _bw, _bh); - draw_text(prev_size - 16, prev_size - 12, VERSION_STRING); + draw_text(prev_size - 16, prev_size - 8, VERSION_STRING); surface_reset_target(); surface_save_safe(_s, dest_path); surface_free(_s); diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 8ea444770..c72ff68ef 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -146,11 +146,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor _c--; } var guide = function_guide_server(_fn); - + + o_dialog_textbox_function_guide.dialog_x = rx + cursor_pos_x + 1; + o_dialog_textbox_function_guide.dialog_y = ry + cursor_pos_y - 12; + if(guide != "") { o_dialog_textbox_function_guide.activate(self); - o_dialog_textbox_function_guide.dialog_x = rx + cursor_pos_x + 1; - o_dialog_textbox_function_guide.dialog_y = ry + cursor_pos_y - 12; o_dialog_textbox_function_guide.prompt = guide; o_dialog_textbox_function_guide.index = amo; } else @@ -207,10 +208,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor } } - if(!(isCodeFormat() && o_dialog_textbox_autocomplete.textbox == self)) { + var tbActive = o_dialog_textbox_autocomplete.active && o_dialog_textbox_autocomplete.textbox == self; + + if(!(isCodeFormat() && tbActive)) { if(key == vk_up) { var _target; - + if(cursor_line == 0) _target = 0; else { diff --git a/shaders/sh_polar/sh_polar.fsh b/shaders/sh_polar/sh_polar.fsh index 5bf6f487d..b173524a7 100644 --- a/shaders/sh_polar/sh_polar.fsh +++ b/shaders/sh_polar/sh_polar.fsh @@ -6,6 +6,7 @@ varying vec4 v_vColour; uniform int invert; uniform float blend; uniform int distMode; +uniform int swap; #region /////////////// SAMPLING /////////////// @@ -67,7 +68,7 @@ void main() { vec2 cenPos = v_vTexcoord - center; float angle = (atan(cenPos.y, cenPos.x) / PI + 1.) / 2.; - coord = fract(vec2(angle, dist)); + coord = fract(vec2(dist, angle)); } else if(invert == 1) { float dist = v_vTexcoord.x * 0.5; if(distMode == 1) dist = sqrt(dist); @@ -78,5 +79,6 @@ void main() { coord = fract(center + vec2(cos(ang), sin(ang)) * dist); } - gl_FragColor = texture2D( gm_BaseTexture, mix(v_vTexcoord, coord, blend) ); + if(swap == 1) coord.xy = coord.yx; + gl_FragColor = texture2Dintp( gm_BaseTexture, mix(v_vTexcoord, coord, blend) ); } diff --git a/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.fsh b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.fsh new file mode 100644 index 000000000..0ccbe00b7 --- /dev/null +++ b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.fsh @@ -0,0 +1,30 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 dimension; +uniform vec2 paddingStart; +uniform vec2 spacing; +uniform vec2 spriteDim; +uniform vec4 color; +uniform int empty; + +void main() { + vec2 px = v_vTexcoord * dimension - 0.5; + vec2 cls = floor((px - paddingStart) / (spriteDim + spacing)) * (spriteDim + spacing); + + gl_FragColor = vec4(0.); + + for(float i = 0.; i < spriteDim.x; i++) + for(float j = 0.; j < spriteDim.y; j++) { + vec2 tx = (cls + vec2(i, j)) / dimension; + vec4 col = texture2D( gm_BaseTexture, tx ); + + if((empty == 1 && col.a != 0.) || (empty == 0 && col != color)) { + gl_FragColor = col; + return; + } + } +} diff --git a/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.vsh b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy new file mode 100644 index 000000000..15c01253e --- /dev/null +++ b/shaders/sh_slice_spritesheet_empty_scan/sh_slice_spritesheet_empty_scan.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_slice_spritesheet_empty_scan", + "parent": { + "name": "misc", + "path": "folders/shader/misc.yy", + }, + "type": 1, +} \ No newline at end of file