diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index fd776c806..4986983e9 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -222,6 +222,7 @@ {"name":"region","order":34,"path":"folders/shader/generator/region.yy",}, {"name":"mask","order":10,"path":"folders/shader/mask.yy",}, {"name":"misc","order":13,"path":"folders/shader/misc.yy",}, + {"name":"find boundary","order":9,"path":"folders/shader/misc/find boundary.yy",}, {"name":"morph","order":17,"path":"folders/shader/morph.yy",}, {"name":"pixel builder","order":18,"path":"folders/shader/pixel builder.yy",}, {"name":"shape seperator","order":5,"path":"folders/shader/shape seperator.yy",}, @@ -241,7 +242,6 @@ {"name":"button","order":34,"path":"folders/widgets/button.yy",}, {"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",}, {"name":"text","order":36,"path":"folders/widgets/text.yy",}, - {"name":"find boundary","order":9,"path":"folders/shader/misc/find boundary.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -1391,6 +1391,7 @@ {"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",}, {"name":"s_node_image_replace","order":55,"path":"sprites/s_node_image_replace/s_node_image_replace.yy",}, {"name":"node_alpha_hash","order":11,"path":"scripts/node_alpha_hash/node_alpha_hash.yy",}, + {"name":"sh_mask_modify","order":2,"path":"shaders/sh_mask_modify/sh_mask_modify.yy",}, {"name":"toggleGroup","order":31,"path":"scripts/toggleGroup/toggleGroup.yy",}, {"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",}, {"name":"string_cut","order":2,"path":"scripts/string_cut/string_cut.yy",}, @@ -1518,6 +1519,7 @@ {"name":"vectorBox","order":10,"path":"scripts/vectorBox/vectorBox.yy",}, {"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",}, {"name":"sh_blend_normal_dim","order":10,"path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",}, + {"name":"sh_invert_all","order":20,"path":"shaders/sh_invert_all/sh_invert_all.yy",}, {"name":"__d3d11_cbuffer","order":1,"path":"scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy",}, {"name":"node_skew","order":11,"path":"scripts/node_skew/node_skew.yy",}, {"name":"s_node_dot_product","order":13,"path":"sprites/s_node_dot_product/s_node_dot_product.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 92aa3eb08..6d09233c4 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -254,6 +254,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"region","folderPath":"folders/shader/generator/region.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"mask","folderPath":"folders/shader/mask.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/shader/misc.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"find boundary","folderPath":"folders/shader/misc/find boundary.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"morph","folderPath":"folders/shader/morph.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"pixel builder","folderPath":"folders/shader/pixel builder.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"shape seperator","folderPath":"folders/shader/shape seperator.yy",}, @@ -276,7 +277,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"find boundary","folderPath":"folders/shader/misc/find boundary.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -356,6 +356,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_bone.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_not_found_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_open.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_cache_group.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_cache.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_chat.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -2118,6 +2119,7 @@ {"id":{"name":"s_node_image_replace","path":"sprites/s_node_image_replace/s_node_image_replace.yy",},}, {"id":{"name":"node_alpha_hash","path":"scripts/node_alpha_hash/node_alpha_hash.yy",},}, {"id":{"name":"node_PCX_condition","path":"scripts/node_PCX_condition/node_PCX_condition.yy",},}, + {"id":{"name":"sh_mask_modify","path":"shaders/sh_mask_modify/sh_mask_modify.yy",},}, {"id":{"name":"toggleGroup","path":"scripts/toggleGroup/toggleGroup.yy",},}, {"id":{"name":"mouse_input","path":"scripts/mouse_input/mouse_input.yy",},}, {"id":{"name":"string_cut","path":"scripts/string_cut/string_cut.yy",},}, @@ -2264,6 +2266,7 @@ {"id":{"name":"vectorBox","path":"scripts/vectorBox/vectorBox.yy",},}, {"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},}, {"id":{"name":"sh_blend_normal_dim","path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",},}, + {"id":{"name":"sh_invert_all","path":"shaders/sh_invert_all/sh_invert_all.yy",},}, {"id":{"name":"__d3d11_cbuffer","path":"scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy",},}, {"id":{"name":"node_skew","path":"scripts/node_skew/node_skew.yy",},}, {"id":{"name":"s_node_dot_product","path":"sprites/s_node_dot_product/s_node_dot_product.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index 5d5cf2816..f0ef90be4 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_dialog_color_quick_pick/Draw_64.gml b/objects/o_dialog_color_quick_pick/Draw_64.gml index b05694e82..6eb828507 100644 --- a/objects/o_dialog_color_quick_pick/Draw_64.gml +++ b/objects/o_dialog_color_quick_pick/Draw_64.gml @@ -14,7 +14,7 @@ var x1 = x0 + ww; var y1 = y0 + hh; - draw_sprite_stretched(THEME.dialog_bg, 0, x0, y0, ww, hh); + draw_sprite_stretched(THEME.dialog_bg, 0, x0 - ui(8), y0 - ui(8), ww + ui(8) * 2, hh + ui(8) * 2); for( var i = 0, n = array_length(pal); i < n; i++ ) { var r = floor(i / col); diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 2593d8545..e728e1ec9 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -261,8 +261,8 @@ event_inherited(); "ffmpeg_path", new textBox(TEXTBOX_INPUT.text, function(txt) { PREFERENCES.gifski_path = txt; PREF_SAVE(); }) .setSideButton(button(function() { PREFERENCES.ffmpeg_path = get_directory(PREFERENCES.ffmpeg_path); PREF_SAVE(); }, THEME.button_path_icon)) - .setFont(f_p2) - .setEmpty(), + .setFont(f_p2) + .setEmpty(), )); #endregion @@ -307,14 +307,15 @@ event_inherited(); locals = []; var f = file_find_first(DIRECTORY + "Locale/*", fa_directory); while(f != "") { - if(directory_exists(DIRECTORY + "Locale/" + f)) - array_push(locals, f); + if(directory_exists(DIRECTORY + "Locale/" + f)) { + if(f != "_extend") array_push(locals, f); + } f = file_find_next(); } file_find_close(); ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference( - __txtx("pref_interface_language", "Interface Language (restart required)"), + __txtx("pref_interface_language", "Interface Language*"), "local", new scrollBox(locals, function(str) { if(str < 0) return; @@ -323,6 +324,15 @@ event_inherited(); }, false) )); + ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference( + __txtx("pref_ui_font", "Overwrite UI font*"), + "font_overwrite", + new textBox(TEXTBOX_INPUT.text, function(txt) { PREFERENCES.font_overwrite = txt; PREF_SAVE(); }) + .setSideButton(button(function() { PREFERENCES.font_overwrite = get_open_filename("Font files (.ttf, .otf)|*.ttf;*.otf", ""); PREF_SAVE(); }, THEME.button_path_icon)) + .setFont(f_p2) + .setEmpty() + )); + ds_list_add(pref_appr, __txt("Splash")); ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference( diff --git a/scripts/blurSurface/blurSurface.gml b/scripts/blurSurface/blurSurface.gml index 4eb44a373..73af6067a 100644 --- a/scripts/blurSurface/blurSurface.gml +++ b/scripts/blurSurface/blurSurface.gml @@ -1,8 +1,32 @@ +globalvar GAUSSIAN_COEFF; +GAUSSIAN_COEFF = {}; + function surface_blur_init() { __blur_hori = surface_create(1, 1); __blur_vert = surface_create(1, 1); } +function __gaussian_get_kernel(size) { + size = max(1, round(size)); + if(struct_has(GAUSSIAN_COEFF, size)) return GAUSSIAN_COEFF[$ size]; + + var gau_array = array_create(size); + var we = 0; + var b = 0.3 * ((size - 1) * 0.5 - 1) + 0.8; + for(var i = 0; i < size; i++) { + var _x = i * .5; + + gau_array[i] = (1 / sqrt(2 * pi * b)) * exp( -sqr(_x) / (2 * sqr(b)) ); + we += i? gau_array[i] * 2 : gau_array[i]; + } + + for(var i = 0; i < size; i++) + gau_array[i] /= we; + + GAUSSIAN_COEFF[$ size] = gau_array; + return gau_array; +} + function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampleMode = 0, overColor = noone) { static uni_bor = shader_get_uniform(sh_blur_gaussian, "sampleMode"); static uni_dim = shader_get_uniform(sh_blur_gaussian, "dimension"); @@ -16,21 +40,8 @@ function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampl __blur_hori = surface_verify(__blur_hori, surface_get_width_safe(surface), surface_get_height_safe(surface), format); __blur_vert = surface_verify(__blur_vert, surface_get_width_safe(surface), surface_get_height_safe(surface), format); - #region kernel generation - size = max(1, round(size)); - var gau_array = array_create(size); - var we = 0; - var b = 0.3 * ((size - 1) * 0.5 - 1) + 0.8; - for(var i = 0; i < size; i++) { - var _x = i * .5; - - gau_array[i] = (1 / sqrt(2 * pi * b)) * exp( -sqr(_x) / (2 * sqr(b)) ); - we += i? gau_array[i] * 2 : gau_array[i]; - } - for(var i = 0; i < size; i++) { - gau_array[i] /= we; - } - #endregion + size = min(size, 128); + var gau_array = __gaussian_get_kernel(size); BLEND_OVERRIDE; gpu_set_tex_filter(true); diff --git a/scripts/draw_surface_blend/draw_surface_blend.gml b/scripts/draw_surface_blend/draw_surface_blend.gml index ddd1051e1..63a66cbbf 100644 --- a/scripts/draw_surface_blend/draw_surface_blend.gml +++ b/scripts/draw_surface_blend/draw_surface_blend.gml @@ -34,9 +34,9 @@ function draw_surface_blend(background, foreground, blend = 0, alpha = 1, _pre_a if(is_surface(foreground)) { shader_set(sh); - shader_set_surface("fore", foreground); - shader_set_surface("mask", _mask); - shader_set_i("useMask", _mask != 0? 1 : 0); + shader_set_surface("fore", foreground); + shader_set_surface("mask", _mask); + shader_set_i("useMask", is_surface(_mask)); shader_set_f("dimension", surface_get_width_safe(background) / surface_get_width_safe(foreground), surface_get_height_safe(background) / surface_get_height_safe(foreground)); shader_set_f("opacity", alpha); shader_set_i("preserveAlpha", _pre_alp); diff --git a/scripts/draw_text_function/draw_text_function.gml b/scripts/draw_text_function/draw_text_function.gml index ccd6fc7d2..c99d8ab5e 100644 --- a/scripts/draw_text_function/draw_text_function.gml +++ b/scripts/draw_text_function/draw_text_function.gml @@ -1,27 +1,85 @@ -function draw_text_line(_x, _y, _text, _sep, _w) { +function draw_text_line(_x, _y, _text, _sep, _w) { #region + INLINE __draw_text_ext_transformed(_x, _y, _text, _sep, _w, 1, 1, 0); -} +} #endregion -function draw_text_add(_x, _y, _text, scale = 1) { +function draw_text_add(_x, _y, _text, scale = 1) { #region + INLINE BLEND_ALPHA_MULP; draw_text_transformed(_x, _y, _text, scale, scale, 0); BLEND_NORMAL; -} +} #endregion -function draw_text_over(_x, _y, _text, scale = 1) { +function draw_text_over(_x, _y, _text, scale = 1) { #region + INLINE BLEND_OVERRIDE; draw_text_transformed(_x, _y, _text, scale, scale, 0); BLEND_NORMAL; -} +} #endregion -function draw_text_ext_add(_x, _y, _text, _sep, _w, scale = 1) { +function draw_text_lang_add(_x, _y, _text, scale = 1) { #region + INLINE BLEND_ALPHA_MULP; - var h = __draw_text_ext_transformed(_x, _y, _text, _sep, _w, scale, scale, 0); + draw_text_lang(_x, _y, _text, scale); + BLEND_NORMAL; +} #endregion + +function draw_text_lang_over(_x, _y, _text, scale = 1) { #region + INLINE + BLEND_OVERRIDE; + draw_text_lang(_x, _y, _text, scale); + BLEND_NORMAL; +} #endregion + +function draw_text_lang(_x, _y, _text, scale = 1) { #region + var _w = string_width(_text); + var _h = string_height(_text); + + var _ha = draw_get_halign(); + switch(_ha) { + case fa_left : break; + case fa_center : _x -= _w / 2; break; + case fa_right : _x -= _w; break; + } + draw_set_halign(fa_left); + + var amo = string_length(_text); + var _f = draw_get_font(); + var _font = _f; + var _gMap = GLYPH_MAP[$ _f]; + var gly, _g , _ff; + + for( var i = 1; i <= amo; i++ ) { + gly = string_char_at(_text, i); + + if(struct_has(_gMap, gly)) { + _ff = _gMap[$ gly]; + _g = gly; + } else { + _ff = _f; + _g = "?"; + } + + if(_font != _ff) draw_set_font(_ff); + _font = _ff; + draw_text_transformed(_x, _y, _g, scale, scale, 0); + _x += string_width(_g) * scale; + } + + draw_set_font(_f); + draw_set_halign(_ha); +} #endregion + +function draw_text_ext_add(_x, _y, _text, _sep, _w, scale = 1, forceCut = false) { #region + INLINE + BLEND_ALPHA_MULP; + var h = __draw_text_ext_transformed(_x, _y, _text, _sep, _w, scale, scale, 0, forceCut); BLEND_NORMAL; return h; -} +} #endregion -function draw_text_bbox(bbox, text) { +function draw_text_bbox(bbox, text) { #region + INLINE var ss = min(bbox.w / string_width(text), bbox.h / string_height(text)); ss = max(0.5, ss); @@ -29,16 +87,19 @@ function draw_text_bbox(bbox, text) { draw_set_valign(fa_center); draw_text_cut(bbox.xc, bbox.yc, text, bbox.w, ss); -} +} #endregion -function draw_text_cut(x, y, str, w, scale = 1) { +function draw_text_cut(x, y, str, w, scale = 1) { #region + INLINE BLEND_ALPHA_MULP; draw_text_transformed(x, y, string_cut(str, w,, scale), scale, scale, 0); BLEND_NORMAL; -} +} #endregion -function __draw_text_ext_transformed(_x, _y, _text, _sep, _w, sx, sy, rotation) { - if(!LOCALE.config.per_character_line_break) { +function __draw_text_ext_transformed(_x, _y, _text, _sep, _w, sx, sy, rotation, forceCut = false) { #region + INLINE + + if(!LOCALE.config.per_character_line_break && !forceCut) { BLEND_ALPHA_MULP; draw_text_ext_transformed(_x, _y, _text, _sep, _w, sx, sy, rotation); BLEND_NORMAL; @@ -105,12 +166,13 @@ function __draw_text_ext_transformed(_x, _y, _text, _sep, _w, sx, sy, rotation) draw_set_valign(va); return hh; -} +} #endregion #macro _string_width_ext string_width_ext #macro string_width_ext __string_width_ext -function __string_width_ext(text, sep, w) { +function __string_width_ext(text, sep, w) { #region + INLINE if(!LOCALE.config.per_character_line_break) return _string_width_ext(text, sep, w); @@ -131,12 +193,13 @@ function __string_width_ext(text, sep, w) { mxw = max(mxw, lw); return mxw; -} +} #endregion #macro _string_height_ext string_height_ext #macro string_height_ext __string_height_ext -function __string_height_ext(text, sep, w, _break = LOCALE.config.per_character_line_break) { +function __string_height_ext(text, sep, w, _break = LOCALE.config.per_character_line_break) { #region + INLINE if(!_break) return _string_height_ext(text, sep, w); @@ -158,4 +221,4 @@ function __string_height_ext(text, sep, w, _break = LOCALE.config.per_character_ } return hh; -} \ No newline at end of file +} #endregion \ No newline at end of file diff --git a/scripts/font_loader/font_loader.gml b/scripts/font_loader/font_loader.gml index 1deecfb93..2fe12e8a0 100644 --- a/scripts/font_loader/font_loader.gml +++ b/scripts/font_loader/font_loader.gml @@ -1,31 +1,47 @@ -globalvar FONT_ISLOADED, FONT_CACHE; +globalvar FONT_ISLOADED, FONT_CACHE, GLYPH_MAP; globalvar f_h1, f_h2, f_h3, f_h5, f_p0, f_p0b, f_p1, f_p2, f_p3, f_code, f_sdf; FONT_CACHE = {}; FONT_ISLOADED = false; +GLYPH_MAP = {}; -function _font_add(path, size, sdf = false) { +function _font_add(path, size, sdf = false) { #region var font_cache_dir = DIRECTORY + "font_cache"; directory_verify(font_cache_dir); var _key = $"{filename_name_only(path)}_{size}_{sdf}"; - if(struct_has(FONT_CACHE, _key) && font_exists(FONT_CACHE[$ _key])) { - //print($"Add font {_key}: restore from cache"); + if(struct_has(FONT_CACHE, _key) && font_exists(FONT_CACHE[$ _key])) return FONT_CACHE[$ _key]; - } var _t = current_time; var _f = font_add(path, size, false, false, 0, 0); - if(sdf) { - font_enable_sdf(_f, true); - } - + if(sdf) font_enable_sdf(_f, true); FONT_CACHE[$ _key] = _f; + _font_extend_locale(_f, _f); + return _f; -} +} #endregion -function _font_path(rel) { +function _font_extend_locale(baseFont, localFont, override = false) { #region + if(!struct_exists(GLYPH_MAP, baseFont)) + GLYPH_MAP[$ baseFont] = {}; + + var Gmap = GLYPH_MAP[$ baseFont]; + var _fInfo = font_get_info(localFont); + var _gMap = _fInfo.glyphs; + var _glyphs = variable_struct_get_names(_gMap); + + for( var i = 0, n = array_length(_glyphs); i < n; i++ ) { + var _g = _glyphs[i]; + if(_gMap[$ _g] == undefined) continue; + + if(override || !struct_has(Gmap, _g)) + Gmap[$ _g] = localFont; + } +} #endregion + +function _font_path(rel) { #region rel = string_replace_all(rel, "./", ""); var defPath = $"{DIRECTORY}themes/{PREFERENCES.theme}/fonts/{rel}"; @@ -36,32 +52,35 @@ function _font_path(rel) { var overridePath = $"{LOCALE.fontDir}{rel}"; if(file_exists(overridePath)) return overridePath; - - return defPath; -} - -function _font_load_from_struct(str, name, def) { - if(!struct_has(str, name)) return def; - var font = str[$ name]; - var path = _font_path(font.path); - if(!file_exists(path)) { - noti_status("Font resource " + string(path), " not found. Rollback to default font."); - return def; + return defPath; +} #endregion + +function _font_load_from_struct(str, name, def, over = true) { #region + if(!struct_has(str, name)) return def; + + var font = str[$ name]; + var path = ""; + + if(over && file_exists(PREFERENCES.font_overwrite)) path = PREFERENCES.font_overwrite; + else { + path = _font_path(font.path); + if(!file_exists(path)) { + noti_status($"Font resource {path} not found. Rollback to default font."); + return def; + } } - var _sdf = struct_try_get(font, "sdf", false); - //print($"Font [{name}] {font} : {_sdf}") - font_add_enable_aa(THEME_VALUE.font_aa); + var _sdf = struct_try_get(font, "sdf", false); var _font = _font_add(path, font.size * UI_SCALE, _sdf); return _font; -} +} #endregion function font_clear(font) { if(font_exists(font)) font_delete(font); } -function loadFonts() { +function loadFonts() { #region if(FONT_ISLOADED) { font_clear(f_h1); font_clear(f_h2); @@ -83,15 +102,15 @@ function loadFonts() { if(!file_exists(path)) { noti_status("Font not defined at " + path + ", rollback to default fonts."); - f_h1 = _f_h1; - f_h2 = _f_h2; - f_h3 = _f_h3; - f_h5 = _f_h5; - f_p0 = _f_p0; - f_p0b = _f_p0b; - f_p1 = _f_p1; - f_p2 = _f_p2; - f_p3 = _f_p3; + f_h1 = _f_h1; + f_h2 = _f_h2; + f_h3 = _f_h3; + f_h5 = _f_h5; + f_p0 = _f_p0; + f_p0b = _f_p0b; + f_p1 = _f_p1; + f_p2 = _f_p2; + f_p3 = _f_p3; f_code = _f_code; f_sdf = _f_sdf; FONT_ISLOADED = false; @@ -113,8 +132,34 @@ function loadFonts() { f_p2 = _font_load_from_struct(fontDef, "p2", _f_p2); f_p3 = _font_load_from_struct(fontDef, "p3", _f_p3); - f_code = _font_load_from_struct(fontDef, "code", _f_code); + f_code = _font_load_from_struct(fontDef, "code", _f_code, false); f_sdf = _font_load_from_struct(fontDef, "sdf", _f_sdf); FONT_ISLOADED = true; -} \ No newline at end of file +} #endregion + +#region unused font cache + //function __fontCache() { + // var _f = font_add("LXGWWenKaiMonoLite-Bold.ttf", 16, false, false, 0, 0); + // var _fInfo = font_get_info(_f); + // var _gMap = _fInfo.glyphs; + // var _glyphs = variable_struct_get_names(_gMap); + + // draw_set_text(_f, fa_left, fa_top, c_white); + + // for( var i = 0, n = array_length(_glyphs); i < n; i++ ) { + // var _g = _glyphs[i]; + // var _glyph = _gMap[$ _g]; + + // if(_glyph.w == 0 || _glyph.h == 0) continue; + + // var _s = surface_create(_glyph.w, _glyph.h); + // surface_set_target(_s); DRAW_CLEAR + // draw_text(0, 0, chr(_glyph.char)); + // surface_reset_target(); + + // surface_save(_s, $"{DIRECTORY}Locale/extend/cache/{_glyph.char}.png"); + // surface_clear(_s); + // } + //} run_in(1, __fontCache); +#endregion diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 385d2a297..8d279e274 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 = 11583; + VERSION = 11584; SAVE_VERSION = 11570; - VERSION_STRING = "1.16rc3"; - BUILD_NUMBER = 11583; + VERSION_STRING = "1.16rc4"; + BUILD_NUMBER = 11584; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/mask_function/mask_function.gml b/scripts/mask_function/mask_function.gml index 0bd8a2587..6c551a9e5 100644 --- a/scripts/mask_function/mask_function.gml +++ b/scripts/mask_function/mask_function.gml @@ -1,28 +1,76 @@ -function mask_apply(original, edited, mask, mix = 1) { +function __init_mask_modifier(_mask_index) { #region + var _ind = ds_list_size(inputs); + + inputs[| _ind + 0] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| _ind + 1] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16) + .setDisplay(VALUE_DISPLAY.slider, { range: [0, 32, 1] }); + + __mask_index = _mask_index; + __mask_mod_index = _ind; + __mask_invert = false; + __mask_feather = 0; +} #endregion + +function __step_mask_modifier() { #region + var _msk = is_surface(getSingleValue(__mask_index)); + inputs[| __mask_mod_index + 0].setVisible(_msk); + inputs[| __mask_mod_index + 1].setVisible(_msk); +} #endregion + +function __process_mask_modifier(data) { #region + __mask_invert = data[__mask_mod_index + 0]; + __mask_feather = data[__mask_mod_index + 1]; +} #endregion + +function mask_modify(mask, invert = false, feather = 0) { #region + if(!is_surface(mask)) return mask; + if(!invert && feather == 0) return mask; + + if(!struct_has(self, "__temp_mask")) __temp_mask = surface_create(1, 1); + + __temp_mask = surface_verify(__temp_mask, surface_get_width_safe(mask), surface_get_height_safe(mask)); + + surface_set_shader(__temp_mask, invert? sh_invert_all : noone); + draw_surface(mask, 0, 0); + surface_reset_shader(); + + if(feather > 0) { + if(!struct_has(self, "__blur_hori")) surface_blur_init(); + __temp_mask = surface_apply_gaussian(__temp_mask, feather, false, c_white, 1, noone); + } + + return __temp_mask; +} #endregion + +function mask_apply(original, edited, mask, mix = 1) { #region if(!is_surface(mask) && mix == 1) return edited; var _f = surface_get_format(edited); var _s = surface_create_size(original, _f); - surface_set_target(_s); - shader_set(sh_mask); - texture_set_stage(shader_get_sampler_index(sh_mask, "original"), surface_get_texture(original)); - texture_set_stage(shader_get_sampler_index(sh_mask, "edited"), surface_get_texture(edited)); + if(is_surface(mask) && __mask_feather > 0) { + if(!struct_has(self, "__blur_hori")) surface_blur_init(); + mask = surface_apply_gaussian(mask, __mask_feather, false, c_white, 1, noone); + } + + surface_set_shader(_s, sh_mask); + shader_set_surface("original", original); + shader_set_surface("edited", edited); + shader_set_surface("mask", mask); - shader_set_uniform_i(shader_get_uniform(sh_mask, "useMask"), is_surface(mask)); - texture_set_stage(shader_get_sampler_index(sh_mask, "mask"), surface_get_texture(mask)); - - shader_set_uniform_f(shader_get_uniform(sh_mask, "mixRatio"), mix); + shader_set_i("useMask", is_surface(mask)); + shader_set_i("invMask", __mask_invert); + shader_set_f("mixRatio", mix); draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(original), surface_get_height_safe(original)); - shader_reset(); - surface_reset_target(); + surface_reset_shader(); surface_free(edited); return _s; -} +} #endregion -function channel_apply(original, edited, channel) { +function channel_apply(original, edited, channel) { #region if(channel == 0b1111) return edited; var _f = surface_get_format(edited); @@ -44,4 +92,4 @@ function channel_apply(original, edited, channel) { surface_free(edited); return _s; -} \ No newline at end of file +} #endregion \ No newline at end of file diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 1ecbb8100..d9a4239c8 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -33,7 +33,12 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var butx = xx; if(jun.connect_type == JUNCTION_CONNECT.input && jun.isAnimable() && !jun.expUse) { #region animation var index = jun.hasJunctionFrom()? 2 : jun.is_anim; - draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, index == 2? COLORS._main_accent : c_white, 0.8); + + var cc = c_white; + if(jun.is_anim) cc = COLORS._main_value_positive; + if(index == 2) cc = COLORS._main_accent; + + draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, cc, 0.8); if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { if(anim_hold != noone) jun.setAnim(anim_hold); @@ -88,7 +93,12 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc cc = expValid? COLORS._main_value_positive : COLORS._main_value_negative; } - if(global_var) if(string_pos(" ", _name)) cc = COLORS._main_value_negative; + if(global_var) { + if(string_pos(" ", _name)) cc = COLORS._main_value_negative; + } else { + if(jun.hasJunctionFrom()) cc = COLORS._main_accent; + if(jun.is_anim) cc = COLORS._main_value_positive; + } draw_set_text(_font, fa_left, fa_center, cc); var lb_w = string_width(_name) + ui(48); @@ -190,8 +200,15 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc #region expression, pop up editor if(jun.connect_type == JUNCTION_CONNECT.input && breakLine && !jun.is_anim && !global_var) { - var bx = xx + ww - ui(12); + var bx = xx + ww + ui(16); var by = lb_y; + + bx -= ui(28); + if(jun.is_modified && buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_reset", "Reset value"), THEME.refresh_s, 0, COLORS._main_icon) == 2) { + jun.resetValue(); + } + + bx -= ui(28); var ic_b = jun.expUse? c_white : COLORS._main_icon; if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_use_expression", "Use expression"), THEME.node_use_expression, jun.expUse, ic_b) == 2) { jun.expUse = !jun.expUse; diff --git a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml index bf110f4e6..6b3b08987 100644 --- a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml +++ b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml @@ -14,8 +14,10 @@ function Node_Alpha_Cutoff(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 4; + __init_mask_modifier(2); // inputs 5, 6, + input_display_list = [ 4, - ["Surfaces", true], 0, 2, 3, + ["Surfaces", true], 0, 2, 3, 5, 6, ["Cutoff", false], 1, ] @@ -23,6 +25,10 @@ function Node_Alpha_Cutoff(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region surface_set_target(_outSurf); DRAW_CLEAR @@ -36,6 +42,7 @@ function Node_Alpha_Cutoff(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]); return _outSurf; diff --git a/scripts/node_average/node_average.gml b/scripts/node_average/node_average.gml index a91a7d306..1121a2db8 100644 --- a/scripts/node_average/node_average.gml +++ b/scripts/node_average/node_average.gml @@ -17,8 +17,10 @@ function Node_Average(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 4] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(1); // inputs 5, 6, + input_display_list = [ 3, 4, - ["Surfaces", false], 0, 1, 2, + ["Surfaces", false], 0, 1, 2, 5, 6, ] outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -29,6 +31,10 @@ function Node_Average(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c colors = []; + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var inSurf = _data[0]; if(!is_surface(inSurf)) return _outSurf; @@ -77,6 +83,7 @@ function Node_Average(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c draw_clear(cc); surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); _outSurf = channel_apply(_data[0], _outSurf, _data[4]); colors[_array_index] = cc; diff --git a/scripts/node_bevel/node_bevel.gml b/scripts/node_bevel/node_bevel.gml index 309995481..1969dcff7 100644 --- a/scripts/node_bevel/node_bevel.gml +++ b/scripts/node_bevel/node_bevel.gml @@ -32,10 +32,12 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 8] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Bevel", false], 4, 1, ["Transform", false], 2, 3, ]; @@ -55,6 +57,10 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 2].drawOverlay(active, _x + _pw, _y + _ph, _s, _mx, _my, _snx, _sny); } + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _hei = _data[1]; var _shf = _data[2]; @@ -73,6 +79,7 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); return _outSurf; diff --git a/scripts/node_blend/node_blend.gml b/scripts/node_blend/node_blend.gml index 5a90be017..e29dad129 100644 --- a/scripts/node_blend/node_blend.gml +++ b/scripts/node_blend/node_blend.gml @@ -40,10 +40,15 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 11] = nodeValue("Vertical Align", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ THEME.inspector_surface_valign, THEME.inspector_surface_valign, THEME.inspector_surface_valign]); + inputs[| 12] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 13] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] }); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 8, - ["Surfaces", true], 0, 1, 4, 6, 7, + ["Surfaces", true], 0, 1, 4, 12, 13, 6, 7, ["Blend", false], 2, 3, 9, ["Transform", false], 5, 10, 11, ] @@ -67,6 +72,10 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 10].setVisible(_fill == 0 && !_atlas); inputs[| 11].setVisible(_fill == 0 && !_atlas); + + var _msk = is_surface(getSingleValue(4)); + inputs[| 12].setVisible(_msk); + inputs[| 12].setVisible(_msk); } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region @@ -83,6 +92,10 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _halign = _data[10]; var _valign = _data[11]; + + var _mskInv = _data[12]; + var _mskFea = _data[13]; + var cDep = attrDepth(); var ww = 1, hh = 1; @@ -168,6 +181,8 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con else _output = surface_verify(_outSurf, ww, hh, cDep); + _mask = mask_modify(_mask, _mskInv, _mskFea); + surface_set_shader(_output, noone); draw_surface_blend(_backDraw, _foreDraw, _type, _opacity, _pre_alp, _mask, _fill == 2); surface_reset_shader(); diff --git a/scripts/node_bloom/node_bloom.gml b/scripts/node_bloom/node_bloom.gml index 97167141f..c21080a7f 100644 --- a/scripts/node_bloom/node_bloom.gml +++ b/scripts/node_bloom/node_bloom.gml @@ -31,8 +31,10 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Bloom", false], 1, 2, 3, 4, ] @@ -42,6 +44,10 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con surface_blur_init(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _size = _data[1]; var _tole = _data[2]; @@ -83,6 +89,7 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_blur/node_blur.gml b/scripts/node_blur/node_blur.gml index f45a8a1b9..599f8dd72 100644 --- a/scripts/node_blur/node_blur.gml +++ b/scripts/node_blur/node_blur.gml @@ -23,10 +23,12 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Blur", false], 1, 3, 4, ]; @@ -34,6 +36,10 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons attribute_oversample(); surface_blur_init(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _size = _data[1]; var _clamp = struct_try_get(attributes, "oversample"); @@ -51,6 +57,7 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_blur_bokeh/node_blur_bokeh.gml b/scripts/node_blur_bokeh/node_blur_bokeh.gml index 46d40b9a0..b6751198d 100644 --- a/scripts/node_blur_bokeh/node_blur_bokeh.gml +++ b/scripts/node_blur_bokeh/node_blur_bokeh.gml @@ -21,8 +21,10 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 5] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(2); // inputs 6, 7 + input_display_list = [ 4, 5, - ["Surfaces", true], 0, 2, 3, + ["Surfaces", true], 0, 2, 3, 6, 7, ["Blur", false], 1, ] @@ -30,6 +32,10 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _str = _data[1]; var _mask = _data[2]; @@ -48,6 +54,7 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[5]); diff --git a/scripts/node_blur_contrast/node_blur_contrast.gml b/scripts/node_blur_contrast/node_blur_contrast.gml index 26e8e4610..9a3639142 100644 --- a/scripts/node_blur_contrast/node_blur_contrast.gml +++ b/scripts/node_blur_contrast/node_blur_contrast.gml @@ -1,12 +1,6 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Contrast Blur"; - shader = sh_blur_box_contrast; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_siz = shader_get_uniform(shader, "size"); - uniform_tes = shader_get_uniform(shader, "treshold"); - uniform_dir = shader_get_uniform(shader, "direction"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) @@ -26,8 +20,10 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8 + input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Blur", false], 1, 2, ] @@ -37,6 +33,10 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _surf = _data[0]; var _size = _data[1]; @@ -49,29 +49,24 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr temp_surface[0] = surface_verify(temp_surface[0], ww, hh, attrDepth()); - surface_set_target(temp_surface[0]); - DRAW_CLEAR - BLEND_OVERRIDE; - shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [ ww, hh ]); - shader_set_uniform_f(uniform_siz, _size); - shader_set_uniform_f(uniform_tes, _tres); - shader_set_uniform_i(uniform_dir, 0); + surface_set_shader(temp_surface[0], sh_blur_box_contrast); + shader_set_surface("baseSurface", _surf); + shader_set_f("dimension", [ ww, hh ]); + shader_set_f("size", _size); + shader_set_f("treshold", _tres); + shader_set_i("direction", 0); + draw_surface_safe(_surf, 0, 0); - shader_reset(); - BLEND_NORMAL; - surface_reset_target(); + surface_reset_shader(); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - shader_set(shader); - shader_set_uniform_i(uniform_dir, 1); + surface_set_shader(_outSurf, sh_blur_box_contrast); + shader_set(sh_blur_box_contrast); + shader_set_i("direction", 1); + draw_surface_safe(temp_surface[0], 0, 0); - shader_reset(); - BLEND_NORMAL; - surface_reset_target(); + surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_blur_directional/node_blur_directional.gml b/scripts/node_blur_directional/node_blur_directional.gml index 446d8fc26..4cc5bd12e 100644 --- a/scripts/node_blur_directional/node_blur_directional.gml +++ b/scripts/node_blur_directional/node_blur_directional.gml @@ -20,8 +20,10 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y, inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8 + input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Blur", false], 1, 2, ] @@ -43,6 +45,10 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y, inputs[| 2].drawOverlay(active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my, _snx, _sny); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _str = _data[1]; var _dir = _data[2]; @@ -57,6 +63,7 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y, draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_blur_radial/node_blur_radial.gml b/scripts/node_blur_radial/node_blur_radial.gml index 604172169..6826bc449 100644 --- a/scripts/node_blur_radial/node_blur_radial.gml +++ b/scripts/node_blur_radial/node_blur_radial.gml @@ -24,10 +24,12 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 7] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(4); // inputs 8, 9, + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 6, 7, - ["Surfaces", true], 0, 4, 5, + ["Surfaces", true], 0, 4, 5, 8, 9, ["Blur", false], 1, 2, ]; @@ -44,6 +46,10 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _str = _data[1]; var _cen = _data[2]; @@ -63,6 +69,7 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[7]); diff --git a/scripts/node_blur_simple/node_blur_simple.gml b/scripts/node_blur_simple/node_blur_simple.gml index 809f77fb7..540d4141a 100644 --- a/scripts/node_blur_simple/node_blur_simple.gml +++ b/scripts/node_blur_simple/node_blur_simple.gml @@ -35,8 +35,10 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 9] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(6); // inputs 10, 11, + input_display_list = [ 8, 9, - ["Surfaces", true], 0, 6, 7, + ["Surfaces", true], 0, 6, 7, 10, 11, ["Blur", false], 1, 3, 4, 5, ]; @@ -45,6 +47,10 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou attribute_surface_depth(); attribute_oversample(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region if(!is_surface(_data[0])) return _outSurf; var _size = _data[1]; @@ -79,6 +85,7 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _msk, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[9]); diff --git a/scripts/node_blur_zoom/node_blur_zoom.gml b/scripts/node_blur_zoom/node_blur_zoom.gml index 6f6c10885..014713c68 100644 --- a/scripts/node_blur_zoom/node_blur_zoom.gml +++ b/scripts/node_blur_zoom/node_blur_zoom.gml @@ -28,10 +28,12 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 9] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(6); // inputs 10, 11 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 8, 9, - ["Surfaces", true], 0, 6, 7, + ["Surfaces", true], 0, 6, 7, 10, 11, ["Blur", false], 1, 2, 4, 5 ]; @@ -47,6 +49,10 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _str = _data[1]; var _cen = _data[2]; @@ -72,6 +78,7 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); _outSurf = channel_apply(_data[0], _outSurf, _data[9]); diff --git a/scripts/node_bw/node_bw.gml b/scripts/node_bw/node_bw.gml index 51bd5d04a..ff66870f1 100644 --- a/scripts/node_bw/node_bw.gml +++ b/scripts/node_bw/node_bw.gml @@ -23,9 +23,11 @@ function Node_BW(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); - + + __init_mask_modifier(3); // inputs 7, 8 + input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["BW", false], 1, 2, ] @@ -33,6 +35,10 @@ function Node_BW(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _exp = _data[1]; var _con = _data[2]; @@ -49,6 +55,7 @@ function Node_BW(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_camera/node_camera.gml b/scripts/node_camera/node_camera.gml index c95de730a..704532888 100644 --- a/scripts/node_camera/node_camera.gml +++ b/scripts/node_camera/node_camera.gml @@ -4,7 +4,7 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - onSurfaceSize = function() { return surface_get_dimension(getInputData(0, DEF_SURF)); }; + onSurfaceSize = function() { return surface_get_dimension(getInputData(0)); }; inputs[| 1] = nodeValue("Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 16, 16, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); diff --git a/scripts/node_color_adjustment/node_color_adjustment.gml b/scripts/node_color_adjustment/node_color_adjustment.gml index 5fff3243c..867e39158 100644 --- a/scripts/node_color_adjustment/node_color_adjustment.gml +++ b/scripts/node_color_adjustment/node_color_adjustment.gml @@ -47,13 +47,18 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 15] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + inputs[| 16] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + inputs[| 17] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] }); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Color out", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) .setDisplay(VALUE_DISPLAY.palette); input_display_list = [11, 12, 15, 9, - ["Surface", false], 0, 8, 13, + ["Surface", false], 0, 8, 16, 17, 13, ["Brightness", false], 1, 10, 2, ["HSV", false], 3, 4, 5, ["Color blend", false], 6, 14, 7 @@ -74,6 +79,10 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro outputs[| 0].setVisible(type == 0, type == 0); outputs[| 1].setVisible(type == 1, type == 1); + + var _msk = is_surface(getSingleValue(8)); + inputs[| 16].setVisible(_msk); + inputs[| 17].setVisible(_msk); } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region @@ -93,6 +102,9 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var _col = _data[13]; var _blm = _data[14]; + var _mskInv = _data[16]; + var _mskFea = _data[17]; + if(_type == 0 && _output_index != 0) return []; if(_type == 1 && _output_index != 1) return noone; @@ -134,6 +146,8 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro return _col; } + _m = mask_modify(_m, _mskInv, _mskFea); + surface_set_shader(_baseSurf, sh_color_adjust); shader_set_f("brightness", _bri); shader_set_f("exposure", _exp); diff --git a/scripts/node_color_palette_replacement/node_color_palette_replacement.gml b/scripts/node_color_palette_replacement/node_color_palette_replacement.gml index bc2b8b327..1d269d183 100644 --- a/scripts/node_color_palette_replacement/node_color_palette_replacement.gml +++ b/scripts/node_color_palette_replacement/node_color_palette_replacement.gml @@ -40,8 +40,10 @@ function Node_Color_replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr inputs[| 10] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(7); // inputs 11, 12 + input_display_list = [ 9, 10, - ["Surfaces", true], 0, 7, 8, + ["Surfaces", true], 0, 7, 8, 11, 12, ["Palette", false], 1, 2, ["Comparison", false], 3, 5, ["Render", false], 4, 6 @@ -51,6 +53,10 @@ function Node_Color_replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var fr = _data[1]; var to = _data[2]; @@ -100,6 +106,7 @@ function Node_Color_replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr BLEND_NORMAL surface_reset_target(); + __process_mask_modifier(_data); if(!in) _outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]); _outSurf = channel_apply(_data[0], _outSurf, _data[10]); diff --git a/scripts/node_color_remove/node_color_remove.gml b/scripts/node_color_remove/node_color_remove.gml index f2c7fa9f7..82c57d24a 100644 --- a/scripts/node_color_remove/node_color_remove.gml +++ b/scripts/node_color_remove/node_color_remove.gml @@ -29,8 +29,10 @@ function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 7] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 8, 9, + input_display_list = [ 5, 7, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 8, 9, ["Remove", false], 1, 2, 6, ] @@ -38,6 +40,10 @@ function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var frm = _data[1]; var thr = _data[2]; @@ -63,6 +69,7 @@ function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[7]); diff --git a/scripts/node_color_replacement/node_color_replacement.gml b/scripts/node_color_replacement/node_color_replacement.gml index 9b5479bae..cdc8fca64 100644 --- a/scripts/node_color_replacement/node_color_replacement.gml +++ b/scripts/node_color_replacement/node_color_replacement.gml @@ -20,10 +20,12 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g inputs[| 6] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 6; + __init_mask_modifier(4); // inputs 7, 8, + selecting_index = 0; function setColor(colr) { #region - var _to = getInputData(2); + var _to = array_clone(getInputData(2)); _to[selecting_index] = colr; inputs[| 2].setValue(_to); // Not necessary due to array reference @@ -118,7 +120,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g }); #endregion input_display_list = [ 6, - ["Surfaces", true], 0, 4, 5, + ["Surfaces", true], 0, 4, 5, 7, 8, ["Replace", false], render_palette, 2, ["Comparison", false], 3, ]; @@ -166,6 +168,10 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g inputs[| 2].setValue(palette); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var fr = _data[1]; var to = _data[2]; @@ -183,6 +189,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); return _outSurf; diff --git a/scripts/node_colorize/node_colorize.gml b/scripts/node_colorize/node_colorize.gml index d32947f97..47704101b 100644 --- a/scripts/node_colorize/node_colorize.gml +++ b/scripts/node_colorize/node_colorize.gml @@ -29,8 +29,10 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 7] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 8, 9, + input_display_list = [ 5, 7, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 8, 9, ["Colorize", false], 1, 2, 6, ] @@ -38,6 +40,10 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _gra = _data[1]; var _gra_shift = _data[2]; @@ -65,6 +71,7 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[7]); diff --git a/scripts/node_convolution/node_convolution.gml b/scripts/node_convolution/node_convolution.gml index 98912d63d..deabf42d4 100644 --- a/scripts/node_convolution/node_convolution.gml +++ b/scripts/node_convolution/node_convolution.gml @@ -25,16 +25,22 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8, + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Kernel", false], 1, ]; attribute_surface_depth(); attribute_oversample(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _ker = _data[1]; var _sam = struct_try_get(attributes, "oversample"); @@ -53,6 +59,7 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_corner/node_corner.gml b/scripts/node_corner/node_corner.gml index 705a00e1b..c994f2afe 100644 --- a/scripts/node_corner/node_corner.gml +++ b/scripts/node_corner/node_corner.gml @@ -23,8 +23,10 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 5] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(2); // inputs 6, 7 + input_display_list = [ 4, 5, - ["Surfaces", true], 0, 2, 3, + ["Surfaces", true], 0, 2, 3, 6, 7, ["Corner", false], 1, ] @@ -32,6 +34,10 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var wd = _data[1]; @@ -65,6 +71,7 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co surface_reset_target(); surface_free(temp); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]); _outSurf = channel_apply(_data[0], _outSurf, _data[5]); diff --git a/scripts/node_curve/node_curve.gml b/scripts/node_curve/node_curve.gml index c9fc099e1..dc552b30e 100644 --- a/scripts/node_curve/node_curve.gml +++ b/scripts/node_curve/node_curve.gml @@ -35,15 +35,21 @@ function Node_Curve(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Curve", false], 1, 2, 3, 4, ]; attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _wcur = _data[1]; var _rcur = _data[2]; @@ -70,6 +76,7 @@ function Node_Curve(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_dilate/node_dilate.gml b/scripts/node_dilate/node_dilate.gml index b55d6da1e..3ed29492a 100644 --- a/scripts/node_dilate/node_dilate.gml +++ b/scripts/node_dilate/node_dilate.gml @@ -33,10 +33,12 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Dilate", false], 1, 2, 3, ]; @@ -54,6 +56,10 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var center = _data[1]; var stren = _data[2]; @@ -70,6 +76,7 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 2bb430bf3..5a1282bf2 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -40,8 +40,10 @@ If set, then strength value control how many times the effect applies on itself. inputs[| 12] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(8); // inputs 13, 14 + input_display_list = [ 10, 12, - ["Surfaces", true], 0, 8, 9, + ["Surfaces", true], 0, 8, 9, 13, 14, ["Displace", false], 1, 3, 4, ["Color", false], 5, 2, ["Algorithm", true], 6, 11, @@ -53,6 +55,10 @@ If set, then strength value control how many times the effect applies on itself. attribute_oversample(); attribute_interpolation(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region switch(_data[5]) { case 0 : @@ -83,6 +89,7 @@ If set, then strength value control how many times the effect applies on itself. draw_surface_safe(_data[0]); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[8], _data[9]); _outSurf = channel_apply(_data[0], _outSurf, _data[12]); diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 6740860d7..9ad9a70bb 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -45,16 +45,22 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 10] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(7); // inputs 11, 12, + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 9, 10, - ["Surfaces", true], 0, 7, 8, + ["Surfaces", true], 0, 7, 8, 11, 12, ["Pattern", false], 2, 3, ["Dither", false], 6, 1, 4, 5 ] attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _pal = _data[1]; var _typ = _data[2]; @@ -142,6 +148,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]); _outSurf = channel_apply(_data[0], _outSurf, _data[10]); diff --git a/scripts/node_edge_detect/node_edge_detect.gml b/scripts/node_edge_detect/node_edge_detect.gml index 8d977e714..878dcd64d 100644 --- a/scripts/node_edge_detect/node_edge_detect.gml +++ b/scripts/node_edge_detect/node_edge_detect.gml @@ -25,16 +25,22 @@ function Node_Edge_Detect(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Edge detect", false], 1, ]; attribute_surface_depth(); attribute_oversample(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var ft = _data[1]; var ov = struct_try_get(attributes, "oversample"); @@ -53,6 +59,7 @@ function Node_Edge_Detect(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_erode/node_erode.gml b/scripts/node_erode/node_erode.gml index be7e7dd7b..1680fbb1d 100644 --- a/scripts/node_erode/node_erode.gml +++ b/scripts/node_erode/node_erode.gml @@ -26,8 +26,10 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 7] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(4); // inputs 8, 9, + input_display_list = [ 6, 7, - ["Surfaces", true], 0, 4, 5, + ["Surfaces", true], 0, 4, 5, 8, 9, ["Erode", false], 1, 2, 3, ] @@ -35,6 +37,10 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var wd = _data[1]; @@ -53,6 +59,7 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); _outSurf = channel_apply(_data[0], _outSurf, _data[7]); diff --git a/scripts/node_flood_fill/node_flood_fill.gml b/scripts/node_flood_fill/node_flood_fill.gml index 64417c04e..8384c5a35 100644 --- a/scripts/node_flood_fill/node_flood_fill.gml +++ b/scripts/node_flood_fill/node_flood_fill.gml @@ -22,10 +22,12 @@ function Node_Flood_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 7] = nodeValue("Diagonal", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + __init_mask_modifier(1); // inputs 8, 9 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 3, - ["Surfaces", false], 0, 1, 2, + ["Surfaces", false], 0, 1, 2, 8, 9, ["Fill", false], 4, 6, 5, 7, ] @@ -45,6 +47,10 @@ function Node_Flood_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var inSurf = _data[0]; if(!is_surface(inSurf)) return _outSurf; @@ -109,6 +115,7 @@ function Node_Flood_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _group shader_reset(); surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); return _outSurf; } diff --git a/scripts/node_glow/node_glow.gml b/scripts/node_glow/node_glow.gml index 21b00c5e7..6a065714e 100644 --- a/scripts/node_glow/node_glow.gml +++ b/scripts/node_glow/node_glow.gml @@ -27,8 +27,10 @@ function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 7; + __init_mask_modifier(5); // inputs 8, 9, + input_display_list = [ 7, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 8, 9, ["Glow", false], 1, 2, 3, 4, ] @@ -37,6 +39,10 @@ function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons surface_blur_init(); attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _border = _data[1]; var _size = _data[2]; @@ -73,6 +79,7 @@ function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons surface_free(pass1); surface_free(s); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); return _outSurf; diff --git a/scripts/node_greyscale/node_greyscale.gml b/scripts/node_greyscale/node_greyscale.gml index 18cfd17d7..2f417f66b 100644 --- a/scripts/node_greyscale/node_greyscale.gml +++ b/scripts/node_greyscale/node_greyscale.gml @@ -24,8 +24,10 @@ function Node_Greyscale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8 + input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Greyscale", false], 1, 2, ] @@ -33,6 +35,10 @@ function Node_Greyscale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _exp = _data[1]; var _con = _data[2]; @@ -49,6 +55,7 @@ function Node_Greyscale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_interpret_number/node_interpret_number.gml b/scripts/node_interpret_number/node_interpret_number.gml index bfaa39a68..11f6a902d 100644 --- a/scripts/node_interpret_number/node_interpret_number.gml +++ b/scripts/node_interpret_number/node_interpret_number.gml @@ -31,17 +31,18 @@ function Node_Interpret_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, static processData = function(_outSurf, _data, _output_index, _array_index) { static BATCH_SIZE = 1024; - var _num = _data[0]; + var _val = _data[0]; var _mod = _data[1]; var _ran = _data[2]; var _grd = _data[3]; - if(!is_array(_num)) _num = [ _num ]; - _num = array_spread(_num); - + if(is_array(_val) && array_empty(_val)) return _outSurf; + if(!is_array(_val)) _val = [ _val ]; + var _num = array_spread(_val); var _amo = array_length(_num); _outSurf = surface_verify(_outSurf, _amo, 1, attrDepth()); + if(_amo == 0) return _outSurf; surface_set_shader(_outSurf, sh_interpret_number); shader_set_i("mode", _mod); diff --git a/scripts/node_invert/node_invert.gml b/scripts/node_invert/node_invert.gml index 840dddeca..bfd6b4a87 100644 --- a/scripts/node_invert/node_invert.gml +++ b/scripts/node_invert/node_invert.gml @@ -14,14 +14,20 @@ function Node_Invert(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 4] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(1); // inputs 5, 6 + input_display_list = [ 3, 4, - ["Surfaces", true], 0, 1, 2, + ["Surfaces", true], 0, 1, 2, 5, 6, ] outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region surface_set_target(_outSurf); DRAW_CLEAR @@ -34,6 +40,7 @@ function Node_Invert(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); _outSurf = channel_apply(_data[0], _outSurf, _data[4]); diff --git a/scripts/node_level/node_level.gml b/scripts/node_level/node_level.gml index e27a5c66f..50fa4d61e 100644 --- a/scripts/node_level/node_level.gml +++ b/scripts/node_level/node_level.gml @@ -41,6 +41,8 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 9] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(6); // inputs 10, 11 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); attribute_surface_depth(); @@ -80,7 +82,7 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con input_display_list = [ 8, 9, level_renderer, - ["Surfaces", true], 0, 6, 7, + ["Surfaces", true], 0, 6, 7, 10, 11, ["Level", false], 1, ["Channel", true], 2, 3, 4, 5 ]; @@ -99,6 +101,10 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con } } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _wmin = min(_data[1][0], _data[1][1]); var _wmax = max(_data[1][0], _data[1][1]); @@ -133,6 +139,7 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); _outSurf = channel_apply(_data[0], _outSurf, _data[9]); diff --git a/scripts/node_level_selector/node_level_selector.gml b/scripts/node_level_selector/node_level_selector.gml index c353fd64f..4b0cc8532 100644 --- a/scripts/node_level_selector/node_level_selector.gml +++ b/scripts/node_level_selector/node_level_selector.gml @@ -24,6 +24,8 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8, + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); attribute_surface_depth(); @@ -65,7 +67,7 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g input_display_list = [ 5, 6, level_renderer, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Level", false], 1, 2, ]; histogramInit(); @@ -83,6 +85,10 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g } } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _middle = _data[1]; var _range = _data[2]; @@ -101,6 +107,7 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_local_analyze/node_local_analyze.gml b/scripts/node_local_analyze/node_local_analyze.gml index c25fca7e1..e84f6cd49 100644 --- a/scripts/node_local_analyze/node_local_analyze.gml +++ b/scripts/node_local_analyze/node_local_analyze.gml @@ -33,16 +33,22 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Effect", false], 1, 2, 4, ]; attribute_surface_depth(); attribute_oversample(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _alg = _data[1]; var _siz = _data[2]; @@ -65,6 +71,7 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr BLEND_NORMAL; surface_reset_target(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index 5f55666dd..c3b9e4048 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -30,12 +30,14 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 12] = nodeValue("Crop border", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + __init_mask_modifier(9); // inputs 13, 14 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Outline", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 11, - ["Surfaces", true], 0, 9, 10, + ["Surfaces", true], 0, 9, 10, 13, 14, ["Outline", false], 1, 5, 8, 12, ["Render", false], 2, 3, 4, 6, ]; @@ -49,6 +51,8 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 4].setVisible(blend); inputs[| 12].setVisible(_side == 0); + + __step_mask_modifier(); } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region @@ -82,6 +86,7 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[9], _data[10]); return _outSurf; diff --git a/scripts/node_palette_shift/node_palette_shift.gml b/scripts/node_palette_shift/node_palette_shift.gml index 444727a2b..5b330f460 100644 --- a/scripts/node_palette_shift/node_palette_shift.gml +++ b/scripts/node_palette_shift/node_palette_shift.gml @@ -20,8 +20,10 @@ function Node_Palette_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(3); // inputs 7, 8 + input_display_list = [ 5, 6, - ["Surfaces", true], 0, 3, 4, + ["Surfaces", true], 0, 3, 4, 7, 8, ["Palette", false], 1, 2 ] @@ -29,6 +31,10 @@ function Node_Palette_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _pal = _data[1]; var _shf = _data[2]; @@ -48,6 +54,7 @@ function Node_Palette_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); _outSurf = channel_apply(_data[0], _outSurf, _data[6]); diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index e71f9fb61..0cac64242 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -2,7 +2,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ name = "Particle"; use_cache = CACHE_USE.auto; - onSurfaceSize = function() { return surface_get_dimension(getInputData(input_len, DEF_SURF)); }; + onSurfaceSize = function() { return getInputData(input_len, DEF_SURF); }; inputs[| 3].setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); inputs[| 22].setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation", "Array" ]); diff --git a/scripts/node_pixel_sort/node_pixel_sort.gml b/scripts/node_pixel_sort/node_pixel_sort.gml index 33ba0aec3..b4faea136 100644 --- a/scripts/node_pixel_sort/node_pixel_sort.gml +++ b/scripts/node_pixel_sort/node_pixel_sort.gml @@ -28,8 +28,10 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 7] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(4); // inputs 8, 9 + input_display_list = [ 6, 7, - ["Surfaces", true], 0, 4, 5, + ["Surfaces", true], 0, 4, 5, 8, 9, ["Pixel sort", false], 1, 2, 3, ] @@ -37,6 +39,10 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group attribute_surface_depth(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var _in = _data[0]; @@ -89,6 +95,7 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group surface_free(pp[0]); surface_free(pp[1]); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); _outSurf = channel_apply(_data[0], _outSurf, _data[7]); diff --git a/scripts/node_polar/node_polar.gml b/scripts/node_polar/node_polar.gml index 0d973e61d..23813a6f2 100644 --- a/scripts/node_polar/node_polar.gml +++ b/scripts/node_polar/node_polar.gml @@ -19,16 +19,22 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 6] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider); + __init_mask_modifier(1); // inputs 7, 8, + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 3, 4, - ["Surfaces", false], 0, 1, 2, + ["Surfaces", false], 0, 1, 2, 7, 8, ["Effect", false], 5, 6, ] attribute_surface_depth(); attribute_interpolation(); + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { surface_set_shader(_outSurf, sh_polar); shader_set_interpolation(_data[0]); @@ -38,6 +44,7 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); _outSurf = channel_apply(_data[0], _outSurf, _data[4]); diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 206bd2dec..b991e19cc 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -15,7 +15,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_random); - onSurfaceSize = function() { return surface_get_dimension(getInputData(1, DEF_SURF)); }; + onSurfaceSize = function() { return getInputData(1, DEF_SURF); }; inputs[| 5] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index f4434daaf..7bf3331b1 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -5,7 +5,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons w = 96; - onSurfaceSize = function() { return surface_get_dimension(getInputData(7, DEF_SURF)); }; + onSurfaceSize = function() { return getInputData(7, DEF_SURF); }; inputs[| 0] = nodeValue("Point area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); diff --git a/scripts/node_shadow/node_shadow.gml b/scripts/node_shadow/node_shadow.gml index 8d97f5fc2..7cfa20422 100644 --- a/scripts/node_shadow/node_shadow.gml +++ b/scripts/node_shadow/node_shadow.gml @@ -30,10 +30,12 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 8; + __init_mask_modifier(6); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 8, - ["Surfaces", true], 0, 6, 7, + ["Surfaces", true], 0, 6, 7, 9, 10, ["Shadow", false], 1, 2, 3, 4, 5, ]; @@ -53,6 +55,10 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 3].drawOverlay(active, _x + ww / 2, _y + hh / 2, _s, _mx, _my, _snx, _sny); } + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var cl = _data[1]; var _stre = _data[2]; @@ -84,6 +90,7 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co surface_reset_target(); surface_free(pass1); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); return _outSurf; diff --git a/scripts/node_simple_shape/node_simple_shape.gml b/scripts/node_simple_shape/node_simple_shape.gml index d7c45a9fd..a61d813d8 100644 --- a/scripts/node_simple_shape/node_simple_shape.gml +++ b/scripts/node_simple_shape/node_simple_shape.gml @@ -20,7 +20,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 2] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Rectangle", "Ellipse", "Regular polygon", "Star", "Arc", "Teardrop", "Cross", "Leaf" ]); - onSurfaceSize = function() { return surface_get_dimension(getInputData(0, DEF_SURF)); }; + onSurfaceSize = function() { return getInputData(0, DEF_SURF); }; inputs[| 3] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); diff --git a/scripts/node_skew/node_skew.gml b/scripts/node_skew/node_skew.gml index 59531a446..d8c5ea238 100644 --- a/scripts/node_skew/node_skew.gml +++ b/scripts/node_skew/node_skew.gml @@ -29,8 +29,10 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 9] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(6); // inputs 10, 11 + input_display_list = [ 8, 9, - ["Surfaces", true], 0, 6, 7, + ["Surfaces", true], 0, 6, 7, 10, 11, ["Skew", false], 1, 2, 4, ] @@ -52,6 +54,10 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { var _axis = _data[1]; var _amou = _data[2]; @@ -69,6 +75,7 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); _outSurf = channel_apply(_data[0], _outSurf, _data[9]); diff --git a/scripts/node_threshold/node_threshold.gml b/scripts/node_threshold/node_threshold.gml index 38ae941d9..dd3bfd800 100644 --- a/scripts/node_threshold/node_threshold.gml +++ b/scripts/node_threshold/node_threshold.gml @@ -30,10 +30,12 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 10] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(4); // inputs 11, 12 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 6, 10, - ["Surfaces", true], 0, 4, 5, + ["Surfaces", true], 0, 4, 5, 11, 12, ["Threshold", false], 1, 2, 3, 7, 8, 9, ]; @@ -47,6 +49,8 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _alpha = getInputData(7); inputs[| 8].setVisible(_alpha); inputs[| 9].setVisible(_alpha); + + __step_mask_modifier(); } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { #region @@ -70,6 +74,7 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_surface_safe(_data[0]); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); _outSurf = channel_apply(_data[0], _outSurf, _data[10]); diff --git a/scripts/node_twirl/node_twirl.gml b/scripts/node_twirl/node_twirl.gml index 336abd32c..cd94df243 100644 --- a/scripts/node_twirl/node_twirl.gml +++ b/scripts/node_twirl/node_twirl.gml @@ -33,10 +33,12 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 8] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + __init_mask_modifier(5); // inputs 9, 10 + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 7, 8, - ["Surfaces", true], 0, 5, 6, + ["Surfaces", true], 0, 5, 6, 9, 10, ["Twirl", false], 1, 2, 3, ]; @@ -53,6 +55,10 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } #endregion + static step = function() { #region + __step_mask_modifier(); + } #endregion + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var center = _data[1]; var stren = _data[2]; @@ -69,6 +75,7 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); + __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); _outSurf = channel_apply(_data[0], _outSurf, _data[8]); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index e3a46037c..2fd653166 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -578,7 +578,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru dyna_depo = ds_list_create(); value_tag = ""; - is_changed = true; + is_modified = false; cache_value = [ false, false, undefined, undefined ]; cache_array = [ false, false ]; use_cache = true; @@ -694,7 +694,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return self; } #endregion - static resetValue = function() { setValue(def_val); } + static resetValue = function() { setValue(def_val); is_modified = false; } static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region unit.reference = ref; @@ -1439,7 +1439,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } if(useCache) { - is_changed = !isEqual(cache_value[2], val); cache_value[0] = true; cache_value[1] = _time; } @@ -1721,6 +1720,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } #endregion static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region + is_modified = true; var updated = false; var _val; @@ -2414,6 +2414,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru _map.sep_axis = sep_axis; _map.shift_x = draw_line_shift_x; _map.shift_y = draw_line_shift_y; + _map.is_modified= is_modified; if(!preset && value_from) { _map.from_node = value_from.node.node_id; @@ -2466,6 +2467,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru draw_line_shift_x = struct_try_get(_map, "shift_x"); draw_line_shift_y = struct_try_get(_map, "shift_y"); + is_modified = struct_try_get(_map, "is_modified", true); name_custom = struct_try_get(_map, "name_custom", false); if(name_custom) name = struct_try_get(_map, "name", name); diff --git a/scripts/node_wrap_area/node_wrap_area.gml b/scripts/node_wrap_area/node_wrap_area.gml index a2885d89f..e07307b18 100644 --- a/scripts/node_wrap_area/node_wrap_area.gml +++ b/scripts/node_wrap_area/node_wrap_area.gml @@ -3,7 +3,7 @@ function Node_Wrap_Area(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - onSurfaceSize = function() { return surface_get_dimension(getInputData(0, DEF_SURF)); }; + onSurfaceSize = function() { return surface_get_dimension(getInputData(0)); }; inputs[| 1] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index d58291055..2837971b2 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -30,6 +30,8 @@ function Panel_Collection() : PanelContent() constructor { updated_prog = 0; data_path = ""; + view_tooltip = new tooltipSelector("View", [ "Grid", "List" ]) + static initMenu = function() { #region if(_menu_node == noone) return; var meta = _menu_node.getMetadata(); @@ -141,7 +143,7 @@ function Panel_Collection() : PanelContent() constructor { contentView = 0; contentPane = new scrollPane(content_w - ui(6), content_h, function(_y, _m) { #region - draw_clear_alpha(COLORS._main_text_inner, 0); + draw_clear_alpha(c_white, 0); var nodes = search_string == ""? context.content : search_list; if(mode == 0 && context == root) nodes = STEAM_COLLECTION; @@ -154,10 +156,10 @@ function Panel_Collection() : PanelContent() constructor { var node_list = ds_list_size(nodes); var node_count = node_list + array_length(steamNode); - var hh = 0; - var frame = current_time * PREFERENCES.collection_preview_speed / 3000; - var _cw = contentPane.surface_w; + var frame = current_time * PREFERENCES.collection_preview_speed / 3000; + var _cw = contentPane.surface_w; var _hover = pHOVER && contentPane.hover; + var hh = 0; updated_prog = lerp_linear(updated_prog, 0, 0.01); @@ -219,7 +221,7 @@ function Panel_Collection() : PanelContent() constructor { if(sprite_exists(_node.spr)) { var sw = sprite_get_width(_node.spr); var sh = sprite_get_height(_node.spr); - var ss = ui(32) / max(sw, sh); + var ss = (grid_size - ui(10)) / max(sw, sh); var xo = (sprite_get_xoffset(_node.spr) - sw / 2) * ss; var yo = (sprite_get_yoffset(_node.spr) - sh / 2) * ss; @@ -247,8 +249,8 @@ function Panel_Collection() : PanelContent() constructor { } draw_set_text(f_p3, fa_center, fa_top, COLORS._main_text_inner); - name_height = max(name_height, string_height_ext(_node.name, -1, grid_width) + 8); - draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width); + var _txtH = draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width,, true); + name_height = max(name_height, _txtH + 8); } var hght = grid_size + name_height + ui(8); @@ -425,10 +427,9 @@ function Panel_Collection() : PanelContent() constructor { if(search_string == "") { if(bx > rootx) { - var txt = contentView? __txtx("view_grid", "Grid view") : __txtx("view_list", "List view"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.view_mode, contentView) == 2) { + view_tooltip.index = contentView; + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, view_tooltip, THEME.view_mode, contentView) == 2) contentView = !contentView; - } } bx -= ui(36); @@ -451,7 +452,7 @@ function Panel_Collection() : PanelContent() constructor { draw_sprite_ui_uniform(THEME.add, 0, bx + bs / 2, by + bs / 2, 1, COLORS._main_icon_dark); } bx -= ui(36); - + if(bx > rootx) { var txt = __txtx("panel_collection_add_folder", "Add folder"); if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt) == 2) { @@ -470,7 +471,7 @@ function Panel_Collection() : PanelContent() constructor { if(bx > rootx) { var txt = __txtx("panel_collection_open_file", "Open in file explorer"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.folder) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.button_path_open) == 2) shellOpenExplorer(context.path); } bx -= ui(36); diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 5c930e6ca..35c0bf0be 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -8,13 +8,14 @@ function Panel_Menu() : PanelContent() constructor { noti_icon_show = 0; noti_icon_time = 0; + vertical_break = ui(240); version_name_copy = 0; - if(PREFERENCES.panel_menu_right_control) - action_buttons = ["exit", "maximize", "minimize", "fullscreen"]; - else - action_buttons = ["exit", "minimize", "maximize", "fullscreen"]; + var _right = PREFERENCES.panel_menu_right_control; + if(_right) action_buttons = ["exit", "maximize", "minimize", "fullscreen"]; + else action_buttons = ["exit", "minimize", "maximize", "fullscreen"]; + #region file menu_file_nondemo = [ menuItem(__txt("New"), function() { NEW(); }, THEME.new_file, ["", "New file"]), menuItem(__txt("Open") + "...", function() { LOAD(); }, THEME.noti_icon_file_load, ["", "Open"]) @@ -84,11 +85,13 @@ function Panel_Menu() : PanelContent() constructor { menuItem(__txt("Close current project"), function() { PANEL_GRAPH.close(); },, [ "", "Close file" ]), menuItem(__txt("Close all projects"), function() { for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); },, [ "", "Close all" ]), menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]), - ]; + ]; if(!DEMO) menu_file = array_append(menu_file_nondemo, menu_file); + #endregion - menu_help = [ + #region help + menu_help = [ menuItem(__txtx("panel_menu_help_video", "Tutorial videos"), function() { url_open("https://www.youtube.com/@makhamdev"); }, THEME.youtube), @@ -111,13 +114,9 @@ function Panel_Menu() : PanelContent() constructor { dialogPanelCall(new Panel_Patreon()); }, THEME.patreon), ]; + #endregion - menu_help_steam = array_clone(menu_help); - array_push(menu_help_steam, -1, - menuItem(__txtx("panel_menu_steam_workshop", "Steam Workshop"), function() { - steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); - }, THEME.steam) ); - + #region //////// MENU //////// menus = [ [ __txt("File"), menu_file ], [ __txt("Edit"), [ @@ -225,9 +224,10 @@ function Panel_Menu() : PanelContent() constructor { } ).setIsShelf(), ]], [ __txt("Help"), menu_help ], - ] + ]; + #endregion - if(TESTING) { + if(TESTING) { #region array_push(menus, [ __txt("Dev"), [ menuItem(__txtx("panel_debug_console", "Debug console"), function() { panelAdd("Panel_Console", true) @@ -275,16 +275,22 @@ function Panel_Menu() : PanelContent() constructor { ]); } ).setIsShelf(), ]]); - } + } #endregion + + menu_help_steam = array_clone(menu_help); + array_push(menu_help_steam, -1, + menuItem(__txtx("panel_menu_steam_workshop", "Steam Workshop"), function() { + steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); + }, THEME.steam) ); function onFocusBegin() { PANEL_MENU = self; } - function setNotiIcon(icon) { + function setNotiIcon(icon) { #region noti_icon = icon; noti_icon_time = 90; - } + } #endregion - function undoUpdate() { + function undoUpdate() { #region var txt; if(ds_stack_empty(UNDO_STACK)) { @@ -312,9 +318,11 @@ function Panel_Menu() : PanelContent() constructor { menus[1][1][1].active = !ds_stack_empty(REDO_STACK); menus[1][1][1].name = txt; - } + } #endregion - function drawContent(panel) { + function drawContent(panel) { #region + var _right = PREFERENCES.panel_menu_right_control; + draw_clear_alpha(COLORS.panel_bg_clear, 1); menus[6][1] = STEAM_ENABLED? menu_help_steam : menu_help; var hori = w > h; @@ -322,114 +330,119 @@ function Panel_Menu() : PanelContent() constructor { var xx = ui(40); var yy = ui(8); - if(hori) { - if(PREFERENCES.panel_menu_right_control) - xx = ui(24); - else { - xx = ui(140); - draw_set_color(COLORS._main_icon_dark); - draw_line_round(xx, ui(8), xx, h - ui(8), 3); - } - - var bx = xx; - if(!PREFERENCES.panel_menu_right_control) - bx = w - ui(24); - - draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white); - if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), 0, bx + ui(16), ui(32))) { - if(mouse_press(mb_left, pFOCUS)) - dialogCall(o_dialog_about); - } - } else { - var bx = ui(20); - var by = h - ui(20); - - draw_sprite_ui_uniform(THEME.icon_24, 0, bx, by, 1, c_white); - if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) { - if(mouse_press(mb_left, pFOCUS)) - dialogCall(o_dialog_about); - } - } - - if(hori) { - if(PREFERENCES.panel_menu_right_control) - xx += ui(20); - else - xx += ui(8); - yy = 0; - } else { - xx = ui(8); - yy = w < ui(200)? ui(72) : ui(40); - } - - var sx = xx; - var xc, x0, x1, yc, y0, y1, _mx = xx; - var row = 1, maxRow = ceil(h / ui(40)); - - var _ww = 0; - for(var i = 0; i < array_length(menus) - 1; i++) { - draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var ww = string_width(menus[i][0]) + ui(16 + 8); - _ww += ww; - if(_ww > w * 0.4 - sx) { - row++; - _ww = 0; - } - } - - row = min(row, maxRow); - var _curRow = 0, currY; - var _rowH = (h - ui(12)) / row; - var _ww = 0; - - for(var i = 0; i < array_length(menus); i++) { - draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var ww = string_width(menus[i][0]) + ui(16); - var hh = line_get_height() + ui(8); - + #region about icon if(hori) { - xc = xx + ww / 2; - - x0 = xx; - x1 = xx + ww; - y0 = ui(6) + _rowH * _curRow; - y1 = y0 + _rowH; - - yc = (y0 + y1) / 2; - currY = yc; + if(PREFERENCES.panel_menu_right_control) + xx = ui(24); + else { + xx = ui(140); + draw_set_color(COLORS._main_icon_dark); + draw_line_round(xx, ui(8), xx, h - ui(8), 3); + } + + var bx = xx; + if(!PREFERENCES.panel_menu_right_control) + bx = w - ui(24); + + draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white); + if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), 0, bx + ui(16), ui(32))) { + if(mouse_press(mb_left, pFOCUS)) + dialogCall(o_dialog_about); + } } else { - xc = w / 2; - yc = yy + hh / 2; - - x0 = ui(6); - x1 = w - ui(6); - y0 = yy; - y1 = yy + hh; - } + var bx = ui(20); + var by = h - ui(20); - if(pHOVER && point_in_rectangle(mx, my, x0, y0, x1, y1)) { - draw_sprite_stretched(THEME.menu_button, 0, x0, y0, x1 - x0, y1 - y0); - - if((mouse_press(mb_left, pFOCUS)) || instance_exists(o_dialog_menubox)) { - if(hori) menuCall("main_" + menus[i][0] + "_menu", x + x0, y + y1, menus[i][1]); - else menuCall("main_" + menus[i][0] + "_menu", x + x1, y + y0, menus[i][1]); + draw_sprite_ui_uniform(THEME.icon_24, 0, bx, by, 1, c_white); + if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) { + if(mouse_press(mb_left, pFOCUS)) + dialogCall(o_dialog_about); } } - - draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - draw_text_add(xc, yc, menus[i][0]); - + #endregion + + #region menu if(hori) { - xx += ww + 8; - _mx = max(_mx, xx); - _ww += ww + 8; + if(PREFERENCES.panel_menu_right_control) + xx += ui(20); + else + xx += ui(8); + yy = 0; + } else { + xx = ui(8); + yy = w < vertical_break? ui(72) : ui(40); + } + + var sx = xx; + var xc, x0, x1, yc, y0, y1, _mx = xx; + var row = 1, maxRow = ceil(h / ui(40)); + + var _ww = 0; + for(var i = 0; i < array_length(menus) - 1; i++) { + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + var ww = string_width(menus[i][0]) + ui(16 + 8); + _ww += ww; if(_ww > w * 0.4 - sx) { - _curRow++; + row++; _ww = 0; - xx = sx; + } + } + + row = min(row, maxRow); + var _curRow = 0, currY; + var _rowH = (h - ui(12)) / row; + var _ww = 0; + + for(var i = 0; i < array_length(menus); i++) { + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + var ww = string_width(menus[i][0]) + ui(16); + var hh = line_get_height() + ui(8); + + if(hori) { + xc = xx + ww / 2; + + x0 = xx; + x1 = xx + ww; + y0 = ui(6) + _rowH * _curRow; + y1 = y0 + _rowH; + + yc = (y0 + y1) / 2; + currY = yc; + } else { + xc = w / 2; + yc = yy + hh / 2; + + x0 = ui(6); + x1 = w - ui(6); + y0 = yy; + y1 = yy + hh; } - } else yy += hh + 8; - } + + if(pHOVER && point_in_rectangle(mx, my, x0, y0, x1, y1)) { + draw_sprite_stretched(THEME.menu_button, 0, x0, y0, x1 - x0, y1 - y0); + + if((mouse_press(mb_left, pFOCUS)) || instance_exists(o_dialog_menubox)) { + if(hori) menuCall("main_" + menus[i][0] + "_menu", x + x0, y + y1, menus[i][1]); + else menuCall("main_" + menus[i][0] + "_menu", x + x1, y + y0, menus[i][1]); + } + } + + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + draw_text_add(xc, yc, menus[i][0]); + + if(hori) { + xx += ww + 8; + _mx = max(_mx, xx); + _ww += ww + 8; + if(_ww > w * 0.4 - sx) { + _curRow++; + _ww = 0; + xx = sx; + } + } else + yy += hh + 8; + } + #endregion #region notification var warning_amo = 0; @@ -521,11 +534,7 @@ function Panel_Menu() : PanelContent() constructor { } #endregion - var x1 = w - ui(6); - if(PREFERENCES.panel_menu_right_control) - x1 = w - ui(6); - else - x1 = ui(8 + 28); + var x1 = _right? w - ui(6) : ui(8 + 28); #region actions var bs = ui(28); @@ -588,16 +597,14 @@ function Panel_Menu() : PanelContent() constructor { break; } - if(PREFERENCES.panel_menu_right_control) - x1 -= bs + ui(4); - else - x1 += bs + ui(4); + if(_right) x1 -= bs + ui(4); + else x1 += bs + ui(4); } #endregion - if(!PREFERENCES.panel_menu_right_control) x1 = w - ui(40); - #region version + var _xx1 = _right? x1 : w - ui(40); + var txt = "v. " + string(VERSION_STRING); if(STEAM_ENABLED) txt += " Steam"; @@ -607,20 +614,11 @@ function Panel_Menu() : PanelContent() constructor { if(hori) { draw_set_text(f_p0, fa_center, fa_center, tc); - var ww = string_width(txt) + ui(12); - - if(h > ui(76)) { - ww += ui(16); - var _x0 = w - ui(8) - ww; - var _y0 = h - ui(40); - var _x1 = w - ui(8); - var _y1 = h - ui(8); - } else { - var _x0 = x1 - ww; - var _y0 = ui(6); - var _x1 = x1; - var _y1 = h - ui(6); - } + var ww = string_width(txt) + ui(12); + var _x0 = _xx1 - ww; + var _y0 = ui(6); + var _x1 = _xx1; + var _y1 = h - ui(6); if(pHOVER && point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) { draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _x0, _y0, _x1 - _x0, _y1 - _y0, sc, 1); @@ -635,13 +633,13 @@ function Panel_Menu() : PanelContent() constructor { draw_text((_x0 + _x1) / 2, (_y0 + _y1) / 2, txt); } else { - var x1 = ui(40); + var _xx1 = ui(40); var y1 = h - ui(20); draw_set_text(f_p0, fa_left, fa_center, tc); var ww = string_width(txt) + ui(12); - if(pHOVER && point_in_rectangle(mx, my, x1, y1 - ui(16), x1 + ww, y1 + ui(16))) { - draw_sprite_stretched_ext(THEME.button_hide_fill, 1, x1, y1 - ui(16), ww, ui(32), sc, 1); + if(pHOVER && point_in_rectangle(mx, my, _xx1, y1 - ui(16), _xx1 + ww, y1 + ui(16))) { + draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _xx1, y1 - ui(16), ww, ui(32), sc, 1); if(mouse_press(mb_left, pFOCUS)) dialogCall(o_dialog_release_note); @@ -651,7 +649,7 @@ function Panel_Menu() : PanelContent() constructor { } } - draw_text(x1 + ui(6), y1, txt); + draw_text(_xx1 + ui(6), y1, txt); } #endregion @@ -666,30 +664,27 @@ function Panel_Menu() : PanelContent() constructor { if(ALPHA) txt += " ALPHA"; else if(DEMO) txt += " DEMO"; - var tx0, tx1, maxW, tcx; + var tx0, tx1, tcx; var ty0, ty1; var tbx0, tby0; + var maxW; if(hori) { - if(h > ui(76)) { - tx0 = nx0; - tx1 = w - ui(8); - ty0 = 0; - ty1 = h; - } else { - tx0 = nx0; - tx1 = x1 - ww; - ty0 = 0; - ty1 = h; - } - + tx0 = nx0; + tx1 = w - ui(16); + ty0 = 0; + ty1 = h; tcx = (tx0 + tx1) / 2; } else { tx0 = ui(8); - tx1 = w < ui(200)? w - ui(16) : w - ui(144); - ty0 = w < ui(200)? ui(36) : ui(6); + tx1 = w < vertical_break? w - ui(16) : w - ui(144); + ty0 = w < vertical_break? ui(36) : ui(6); - tcx = tx0; + tcx = tx0; + if(!_right && w >= vertical_break) { + tx0 = x1 - bs; + tx1 = w - ui(16); + } } maxW = abs(tx0 - tx1); @@ -760,5 +755,5 @@ function Panel_Menu() : PanelContent() constructor { draw_sprite_ext(s_patreon_supporter, 1, _cx, _cy, 1, 1, 0, _ib, 1); } #endregion - } + } #endregion } \ No newline at end of file diff --git a/scripts/preferences/preferences.gml b/scripts/preferences/preferences.gml index 4beb626f6..23a88f07f 100644 --- a/scripts/preferences/preferences.gml +++ b/scripts/preferences/preferences.gml @@ -53,6 +53,7 @@ PREFERENCES.theme = "default"; PREFERENCES.local = "en"; + PREFERENCES.font_overwrite = ""; PREFERENCES.dialog_add_node_grouping = true; PREFERENCES.dialog_add_node_view = 0; diff --git a/scripts/shader_functions/shader_functions.gml b/scripts/shader_functions/shader_functions.gml index 6785539a0..f4a77a4ea 100644 --- a/scripts/shader_functions/shader_functions.gml +++ b/scripts/shader_functions/shader_functions.gml @@ -34,6 +34,7 @@ function shader_set_f(uniform, value) { if(shader == -1) return; if(is_array(value)) { + if(array_empty(value)) return; shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), value); return; } @@ -71,8 +72,7 @@ function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) { var _len = array_length(array); if(_len == 0) return; - if(_len > max_length) - array_resize(array, max_length) + if(_len > max_length) array_resize(array, max_length) shader_set_uniform_f_array(uniform, array); } diff --git a/shaders/sh_blur_box_contrast/sh_blur_box_contrast.fsh b/shaders/sh_blur_box_contrast/sh_blur_box_contrast.fsh index f2d1cc71e..cb42a955c 100644 --- a/shaders/sh_blur_box_contrast/sh_blur_box_contrast.fsh +++ b/shaders/sh_blur_box_contrast/sh_blur_box_contrast.fsh @@ -4,11 +4,11 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; -uniform vec2 dimension; +uniform sampler2D baseSurface; +uniform vec2 dimension; uniform float size; uniform float treshold; -//#define size 5. -uniform int direction; +uniform int direction; vec3 rgb2xyz( vec3 c ) { vec3 tmp; @@ -43,25 +43,29 @@ float colorDifferent(in vec4 c1, in vec4 c2) { } void main() { - vec4 base_col = texture2D( gm_BaseTexture, v_vTexcoord); + vec4 base_col = texture2D( baseSurface, v_vTexcoord); + vec4 curr_col = texture2D( gm_BaseTexture, v_vTexcoord); + if(base_col.a > 0.5) { - vec4 col = base_col; - vec4 _col; + vec4 col = curr_col; + vec4 _bcol, _ccol; float mulp = 1.; if(direction == 0) { for(float i = 1.; i < 32.; i++) { if(i >= size) break; - _col = texture2D( gm_BaseTexture, v_vTexcoord + vec2(i / dimension.x, 0.)); - if(_col.a > 0.5 && colorDifferent(base_col, _col) < treshold) { - col += _col; + _bcol = texture2D( baseSurface, v_vTexcoord + vec2(i / dimension.x, 0.)); + if(_bcol.a > 0.5 && colorDifferent(base_col, _bcol) < treshold) { + _ccol = texture2D( gm_BaseTexture, v_vTexcoord + vec2(i / dimension.x, 0.)); + col += _ccol; mulp++; } - _col = texture2D( gm_BaseTexture, v_vTexcoord - vec2(i / dimension.x, 0.)); - if(_col.a > 0.5 && colorDifferent(base_col, _col) < treshold) { - col += _col; + _bcol = texture2D( baseSurface, v_vTexcoord - vec2(i / dimension.x, 0.)); + if(_bcol.a > 0.5 && colorDifferent(base_col, _bcol) < treshold) { + _ccol = texture2D( gm_BaseTexture, v_vTexcoord - vec2(i / dimension.x, 0.)); + col += _ccol; mulp++; } } @@ -70,21 +74,25 @@ void main() { } else if(direction == 1) { for(float i = 1.; i < 32.; i++) { if(i >= size) break; - _col = texture2D( gm_BaseTexture, v_vTexcoord + vec2(0., i / dimension.y)); - if(_col.a > 0.5 && colorDifferent(base_col, _col) < treshold) { - col += _col; + + _bcol = texture2D( baseSurface, v_vTexcoord + vec2(0., i / dimension.y)); + if(_bcol.a > 0.5 && colorDifferent(base_col, _bcol) < treshold) { + _ccol = texture2D( gm_BaseTexture, v_vTexcoord + vec2(0., i / dimension.y)); + col += _ccol; mulp++; } - _col = texture2D( gm_BaseTexture, v_vTexcoord - vec2(0., i / dimension.y)); - if(_col.a > 0.5 && colorDifferent(base_col, _col) < treshold) { - col += _col; + _bcol = texture2D( baseSurface, v_vTexcoord - vec2(0., i / dimension.y)); + if(_bcol.a > 0.5 && colorDifferent(base_col, _bcol) < treshold) { + _ccol = texture2D( gm_BaseTexture, v_vTexcoord - vec2(0., i / dimension.y)); + col += _ccol; mulp++; } } col /= mulp; } + col.a = base_col.a; gl_FragColor = col; } else { diff --git a/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh b/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh index d23275ce1..32bcfbc6b 100644 --- a/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh +++ b/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh @@ -7,7 +7,7 @@ varying vec4 v_vColour; uniform vec2 dimension; uniform int horizontal; -uniform float weight[32]; +uniform float weight[128]; uniform int size; uniform int sampleMode; diff --git a/shaders/sh_invert_all/sh_invert_all.fsh b/shaders/sh_invert_all/sh_invert_all.fsh new file mode 100644 index 000000000..a3f6dce6a --- /dev/null +++ b/shaders/sh_invert_all/sh_invert_all.fsh @@ -0,0 +1,10 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + gl_FragColor = 1. - c; +} diff --git a/shaders/sh_invert_all/sh_invert_all.vsh b/shaders/sh_invert_all/sh_invert_all.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_invert_all/sh_invert_all.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_invert_all/sh_invert_all.yy b/shaders/sh_invert_all/sh_invert_all.yy new file mode 100644 index 000000000..3e74bfcb3 --- /dev/null +++ b/shaders/sh_invert_all/sh_invert_all.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_invert_all", + "parent": { + "name": "color", + "path": "folders/shader/filter/color.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_mask/sh_mask.fsh b/shaders/sh_mask/sh_mask.fsh index e437630d1..cdc521345 100644 --- a/shaders/sh_mask/sh_mask.fsh +++ b/shaders/sh_mask/sh_mask.fsh @@ -6,6 +6,7 @@ varying vec4 v_vColour; uniform sampler2D mask; uniform int useMask; +uniform int invMask; uniform sampler2D original; uniform sampler2D edited; @@ -16,6 +17,13 @@ void main() { vec4 ori = texture2D( original, v_vTexcoord ); vec4 edt = texture2D( edited, v_vTexcoord ); - float rat = (useMask == 1? (msk.r + msk.g + msk.b) / 3. * msk.a : 1.) * mixRatio; - gl_FragColor = mix(ori, edt, clamp(rat, 0., 1.)); + float mskAmo = (msk.r + msk.g + msk.b) / 3. * msk.a; + if(invMask == 1) mskAmo = 1. - mskAmo; + + float rat = (useMask == 1? mskAmo : 1.) * mixRatio; + rat = clamp(rat, 0., 1.); + + gl_FragColor = mix(ori, edt, rat); + if(ori.a == 0.) gl_FragColor.rgb = edt.rgb; + if(edt.a == 0.) gl_FragColor.rgb = ori.rgb; } diff --git a/shaders/sh_mask_modify/sh_mask_modify.fsh b/shaders/sh_mask_modify/sh_mask_modify.fsh new file mode 100644 index 000000000..e28a17897 --- /dev/null +++ b/shaders/sh_mask_modify/sh_mask_modify.fsh @@ -0,0 +1,10 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); +} diff --git a/shaders/sh_mask_modify/sh_mask_modify.vsh b/shaders/sh_mask_modify/sh_mask_modify.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_mask_modify/sh_mask_modify.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_mask_modify/sh_mask_modify.yy b/shaders/sh_mask_modify/sh_mask_modify.yy new file mode 100644 index 000000000..d7d1d6282 --- /dev/null +++ b/shaders/sh_mask_modify/sh_mask_modify.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_mask_modify", + "parent": { + "name": "mask", + "path": "folders/shader/mask.yy", + }, + "type": 1, +} \ No newline at end of file