diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 5952378dd..3a8a3393f 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -65,6 +65,7 @@ {"name":"physics","order":21,"path":"folders/functions/physics.yy",}, {"name":"project","order":37,"path":"folders/functions/project.yy",}, {"name":"shader","order":16,"path":"folders/functions/shader.yy",}, + {"name":"sprite","order":42,"path":"folders/functions/sprite.yy",}, {"name":"string","order":5,"path":"folders/functions/string.yy",}, {"name":"surface","order":9,"path":"folders/functions/surface.yy",}, {"name":"dynamic surface","order":10,"path":"folders/functions/surface/dynamic surface.yy",}, @@ -208,7 +209,6 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, - {"name":"sprite","order":42,"path":"folders/functions/sprite.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -1324,6 +1324,7 @@ {"name":"buttonGradient","order":4,"path":"scripts/buttonGradient/buttonGradient.yy",}, {"name":"sh_draw_downsample","order":2,"path":"shaders/sh_draw_downsample/sh_draw_downsample.yy",}, {"name":"__view_get","order":1,"path":"scripts/__view_get/__view_get.yy",}, + {"name":"export_portable","order":3,"path":"scripts/export_portable/export_portable.yy",}, {"name":"s_node_texture_map","order":38,"path":"sprites/s_node_texture_map/s_node_texture_map.yy",}, {"name":"fd_rectangle_create","order":7,"path":"scripts/fd_rectangle_create/fd_rectangle_create.yy",}, {"name":"s_node_level_selector","order":29,"path":"sprites/s_node_level_selector/s_node_level_selector.yy",}, @@ -1565,6 +1566,7 @@ {"name":"o_dialog_assetbox","order":3,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",}, {"name":"node_lerp","order":2,"path":"scripts/node_lerp/node_lerp.yy",}, {"name":"s_node_pixel_sort","order":42,"path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",}, + {"name":"sh_mask_expand","order":55,"path":"shaders/sh_mask_expand/sh_mask_expand.yy",}, {"name":"node_texture_remap","order":2,"path":"scripts/node_texture_remap/node_texture_remap.yy",}, {"name":"sh_fd_visualize_pixel_art_fiery_smoke_glsl","order":14,"path":"shaders/sh_fd_visualize_pixel_art_fiery_smoke_glsl/sh_fd_visualize_pixel_art_fiery_smoke_glsl.yy",}, {"name":"node_ase_layer","order":15,"path":"scripts/node_ase_layer/node_ase_layer.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 74d42a892..0ced07067 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -88,6 +88,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"physics","folderPath":"folders/functions/physics.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"project","folderPath":"folders/functions/project.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/functions/shader.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprite","folderPath":"folders/functions/sprite.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"string","folderPath":"folders/functions/string.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/functions/surface.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"dynamic surface","folderPath":"folders/functions/surface/dynamic surface.yy",}, @@ -247,7 +248,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprite","folderPath":"folders/functions/sprite.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -262,7 +262,6 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Addons.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Assets.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",}, - {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"icon.png","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"layouts.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Horizontal.json","CopyToMask":-1,"filePath":"datafiles/data/layouts",}, @@ -286,6 +285,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"UI.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"words.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"FiraCode-Medium.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"fonts.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, @@ -363,6 +363,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_array_processor.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_center_canvas.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_curve_connection.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_export_package.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_setting.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_keyframe_override.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -403,6 +404,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_resize.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_use_experssion.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_use_global.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_console.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_error_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_file_load.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_file_save.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -2021,6 +2023,7 @@ {"id":{"name":"buttonGradient","path":"scripts/buttonGradient/buttonGradient.yy",},}, {"id":{"name":"sh_draw_downsample","path":"shaders/sh_draw_downsample/sh_draw_downsample.yy",},}, {"id":{"name":"__view_get","path":"scripts/__view_get/__view_get.yy",},}, + {"id":{"name":"export_portable","path":"scripts/export_portable/export_portable.yy",},}, {"id":{"name":"sh_sample","path":"shaders/sh_sample/sh_sample.yy",},}, {"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},}, {"id":{"name":"fd_rectangle_create","path":"scripts/fd_rectangle_create/fd_rectangle_create.yy",},}, @@ -2302,6 +2305,7 @@ {"id":{"name":"o_dialog_assetbox","path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",},}, {"id":{"name":"node_lerp","path":"scripts/node_lerp/node_lerp.yy",},}, {"id":{"name":"s_node_pixel_sort","path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",},}, + {"id":{"name":"sh_mask_expand","path":"shaders/sh_mask_expand/sh_mask_expand.yy",},}, {"id":{"name":"node_texture_remap","path":"scripts/node_texture_remap/node_texture_remap.yy",},}, {"id":{"name":"sh_fd_visualize_pixel_art_fiery_smoke_glsl","path":"shaders/sh_fd_visualize_pixel_art_fiery_smoke_glsl/sh_fd_visualize_pixel_art_fiery_smoke_glsl.yy",},}, {"id":{"name":"node_ase_layer","path":"scripts/node_ase_layer/node_ase_layer.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index 56d061ea0..0f419d3a8 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_crash_handler/Draw_64.gml b/objects/o_crash_handler/Draw_64.gml index 8e1d71bf1..2e2408133 100644 --- a/objects/o_crash_handler/Draw_64.gml +++ b/objects/o_crash_handler/Draw_64.gml @@ -128,7 +128,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); if(point_in_rectangle(mouse_mx, mouse_my, bx0, by0, bx0 + bw, by0 + bh)) { if(mouse_check_button_pressed(mb_left)) { var path = executable_get_pathname(); - execute_shell(path, "--crashed"); + shell_execute(path, "--crashed"); } if(mouse_check_button(mb_left)) diff --git a/objects/o_dialog_color_selector/Draw_64.gml b/objects/o_dialog_color_selector/Draw_64.gml index bfe7ee5f7..7417ceba8 100644 --- a/objects/o_dialog_color_selector/Draw_64.gml +++ b/objects/o_dialog_color_selector/Draw_64.gml @@ -46,7 +46,7 @@ if !ready exit; if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) { var _realpath = environment_get_variable("LOCALAPPDATA") + "/Pixels_Composer/Palettes"; var _windir = environment_get_variable("WINDIR") + "/explorer.exe"; - execute_shell(_windir, _realpath); + shell_execute(_windir, _realpath); } bx -= ui(32); diff --git a/objects/o_dialog_migration/Draw_64.gml b/objects/o_dialog_migration/Draw_64.gml index 7eb7f1aa3..4cc831e62 100644 --- a/objects/o_dialog_migration/Draw_64.gml +++ b/objects/o_dialog_migration/Draw_64.gml @@ -45,7 +45,7 @@ draw_set_alpha(1); if(directory_exists(_o)) { var shell = "/E /I " + _o + " " + _n; - execute_shell("Xcopy", shell); + shell_execute("Xcopy", shell); } } instance_destroy(); diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 2505828e8..1b2621412 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -91,10 +91,10 @@ environment_set_variable("IMGUI_DIALOG_WIDTH", string(800)); var cmd = ".pxc=\"" + string(program_directory) + "PixelComposer.exe\""; - execute_shell("assoc", cmd); + shell_execute("assoc", cmd); var cmd = ".pxcc=\"" + string(program_directory) + "PixelComposer.exe\""; - execute_shell("assoc", cmd); + shell_execute("assoc", cmd); //print($"Setup time: {(current_time - t)/1000}s"); #endregion diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index c26ce360f..36401b1ea 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -11,18 +11,18 @@ enum PARTICLE_BLEND_MODE { } function __part(_node) constructor { - seed = irandom(99999); - node = _node; - active = false; - surf = noone; - prevx = 0; - prevy = 0; - x = 0; - y = 0; + seed = irandom(99999); + node = _node; + active = false; + surf = noone; + prevx = 0; + prevy = 0; + x = 0; + y = 0; speedx = 0; speedy = 0; turning = 0; - turnSpd = 0 + turnSpd = 0; accel = 0; wig = 0; @@ -120,6 +120,7 @@ function __part(_node) constructor { static kill = function() { active = false; + node.onPartDestroy(self); } @@ -169,7 +170,6 @@ function __part(_node) constructor { } static draw = function(exact, surf_w, surf_h) { - if(!active) return; var ss = surf; if(is_array(surf)) { var ind = abs(round((life_total - life) * anim_speed)); @@ -189,7 +189,9 @@ function __part(_node) constructor { break; } } - if(!is_surface(ss)) return; + + var surface = node.surface_cache[? ss]; + if(!is_surface(surface)) return; var lifeRat = 1 - life / life_total; var scCurve = eval_curve_x(sct, lifeRat); @@ -197,8 +199,8 @@ function __part(_node) constructor { scy = sc_sy * scCurve; var _xx, _yy; - var s_w = surface_get_width_safe(ss) * scx; - var s_h = surface_get_height_safe(ss) * scy; + var s_w = surface_get_width_safe(surface) * scx; + var s_h = surface_get_height_safe(surface) * scy; if(boundary_data == -1) { var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot); @@ -233,7 +235,7 @@ function __part(_node) constructor { if(blend != c_white) cc = colorMultiply(blend, cc); alp_draw = alp * eval_curve_x(alp_fade, lifeRat); - draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw); + draw_surface_ext_safe(surface, _xx, _yy, scx, scy, rot, cc, alp_draw); } static getPivot = function() { diff --git a/scripts/__node_3d_repeat/__node_3d_repeat.gml b/scripts/__node_3d_repeat/__node_3d_repeat.gml index 03d77729c..13158d928 100644 --- a/scripts/__node_3d_repeat/__node_3d_repeat.gml +++ b/scripts/__node_3d_repeat/__node_3d_repeat.gml @@ -162,7 +162,7 @@ function __Node_3D_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 21].setVisible(_proj); } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dim = inputs[| 0].getValue(); var _lpos = inputs[| 1].getValue(); var _lrot = inputs[| 2].getValue(); diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index ec1dcaf1e..e630ddc4b 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -147,19 +147,20 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co parts_runner = 0; seed = 0; - spawn_index = 0; + spawn_index = 0; scatter_index = 0; - def_surface = -1; + def_surface = -1; - current_data = []; + current_data = []; + surface_cache = ds_map_create(); for(var i = 0; i < attributes.part_amount; i++) parts[i] = new __part(self); - static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { + static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { #region var _inSurf = current_data[0]; - if(_inSurf == 0) { + if(!is_surface(_inSurf)) { if(!is_surface(def_surface)) return; _inSurf = def_surface; @@ -309,7 +310,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co parts_runner = safe_mod(parts_runner + 1, attributes.part_amount); } - } + } #endregion static onSpawn = function(_time, part) {} @@ -326,6 +327,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co render(); seed = inputs[| 32].getValue(); + var keys = ds_map_keys_to_array(surface_cache); + for( var i = 0, n = array_length(keys); i < n; i++ ) + surface_free_safe(surface_cache[? keys[i]]); + var _loop = inputs[| 21].getValue(); if(!_loop) return; @@ -357,6 +362,17 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co for( var i = 0; i < ds_list_size(inputs); i++ ) current_data[i] = inputs[| i].getValue(_time); + var surfs = current_data[0]; + if(!is_array(current_data[0])) surfs = [ surfs ]; + if(!array_empty(current_data[0])) { + if(is_array(current_data[0])) + surfs = array_spread(surfs); + for( var i = 0, n = array_length(surfs); i < n; i++ ) { + if(is_surface(surface_cache[? surfs[i]])) continue; + surface_cache[? surfs[i]] = surface_clone(surfs[i]); + } + } + if(_spawn_active) { switch(_spawn_type) { case 0 : diff --git a/scripts/dynaSurf/dynaSurf.gml b/scripts/dynaSurf/dynaSurf.gml index 4d4e90e91..6f8d616b4 100644 --- a/scripts/dynaSurf/dynaSurf.gml +++ b/scripts/dynaSurf/dynaSurf.gml @@ -30,7 +30,7 @@ function dynaSurf() constructor { onFree(); } - static clone = function() {} + static clone = function() { return noone; } static destroy = function() {} } @@ -60,4 +60,14 @@ function compute_dynaSurf() : dynaSurf() constructor { drawFn.eval(params); } + + static clone = function() { + var _surf = new compute_dynaSurf(); + + _surf.drawFn = drawFn; + _surf.widthFn = widthFn; + _surf.heightFn = heightFn; + + return _surf; + } } \ No newline at end of file diff --git a/scripts/dynaSurf_iso/dynaSurf_iso.gml b/scripts/dynaSurf_iso/dynaSurf_iso.gml index d89cf46a4..34a97e7bb 100644 --- a/scripts/dynaSurf_iso/dynaSurf_iso.gml +++ b/scripts/dynaSurf_iso/dynaSurf_iso.gml @@ -34,13 +34,26 @@ function dynaSurf_iso() : dynaSurf() constructor { var _surf = getSurface(_rot); draw_surface_part_ext_safe(_surf, _l, _t, _w, _h, _x, _y, _xs, _ys, 0, _col, _alp); } + + static clone = function() { + var _new = new dynaSurf_iso(); + _new.surfaces = surface_array_clone(surfaces); + _new.angles = array_clone(angles); + _new.angle_shift = angle_shift; + + return _new; + } + + static destroy = function() { + surface_array_free(surfaces); + } } function dynaSurf_iso_4() : dynaSurf_iso() constructor { surfaces = array_create(4, noone); static getSurface = function(_rot) { - _rot += angle; + _rot += angle_shift; var ind = 0; if(abs(angle_difference( 0, _rot)) <= 45) ind = 0; else if(abs(angle_difference( 90, _rot)) <= 45) ind = 1; @@ -52,8 +65,9 @@ function dynaSurf_iso_4() : dynaSurf_iso() constructor { static clone = function() { var _new = new dynaSurf_iso_4(); - _new.surfaces = surfaces; - _new.angle = angle; + _new.surfaces = surface_array_clone(surfaces); + _new.angles = array_clone(angles); + _new.angle_shift = angle_shift; return _new; } @@ -63,7 +77,7 @@ function dynaSurf_iso_8() : dynaSurf_iso() constructor { surfaces = array_create(8, noone); static getSurface = function(_rot) { - _rot += angle; + _rot += angle_shift; var ind = 0; if(abs(angle_difference( 0, _rot)) <= 22.5) ind = 0; else if(abs(angle_difference( 45, _rot)) <= 22.5) ind = 1; @@ -79,8 +93,9 @@ function dynaSurf_iso_8() : dynaSurf_iso() constructor { static clone = function() { var _new = new dynaSurf_iso_8(); - _new.surfaces = surfaces; - _new.angle = angle; + _new.surfaces = surface_array_clone(surfaces); + _new.angles = array_clone(angles); + _new.angle_shift = angle_shift; return _new; } diff --git a/scripts/export_portable/export_portable.gml b/scripts/export_portable/export_portable.gml new file mode 100644 index 000000000..729456b95 --- /dev/null +++ b/scripts/export_portable/export_portable.gml @@ -0,0 +1,51 @@ +function __pack_file_strip(zip, path) { + var _fname = filename_name(path); + var _nname = "src/" + _fname; + zip_add_file(zip, _nname, path); + + return _nname; +} + +function exportPortable(project = PROJECT) { + if(DEMO) return false; + + var path = get_save_filename("Pixel Composer portable project (.zip)|*.zip", ""); + key_release(); + if(path == "") return false; + + var raw_name = filename_name_only(path); + var raw_path = filename_path(path) + raw_name; + var _proj = save_serialize(project, true); + + var zip = zip_create(); + + for( var i = 0, n = array_length(_proj.nodes); i < n; i++ ) { + var _node = _proj.nodes[i]; + + for( var j = 0, m = array_length(_node.inputs); j < m; j++ ) { + var _input = _node.inputs[j]; + + for( var k = 0, o = array_length(_input.raw_value); k < o; k++ ) { + var _val = _input.raw_value[k][1]; + + if(is_string(_val) && file_exists(_val)) + _input.raw_value[k][1] = __pack_file_strip(zip, _val); + else if(is_array(_val)) { + for( var l = 0, p = array_length(_val); l < p; l++ ) { + if(is_string(_val[l]) && file_exists(_val[l])) + _input.raw_value[k][1][l] = __pack_file_strip(zip, _val[l]); + } + } + } + } + } + + var pro_path = DIRECTORY + "temp/" + raw_name + ".pxc"; + var file = file_text_open_write(pro_path); + file_text_write_string(file, PREF_MAP[? "save_file_minify"]? json_stringify_minify(_proj) : json_stringify(_proj, true)); + file_text_close(file); + zip_add_file(zip, raw_name + ".pxc", pro_path); + zip_save(zip, raw_path + ".zip"); + + log_message("EXPORT", $"Export package to {raw_path}.zip succeed.", THEME.noti_icon_file_save); +} \ No newline at end of file diff --git a/scripts/export_portable/export_portable.yy b/scripts/export_portable/export_portable.yy new file mode 100644 index 000000000..212708a39 --- /dev/null +++ b/scripts/export_portable/export_portable.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "export_portable", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "project", + "path": "folders/functions/project.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index bef051581..ea00e7175 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -59,7 +59,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr refreshDynamicInput(); } - function step() { + static step = function() { var _dim = inputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -67,7 +67,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0].setValue(_outSurf); } - function update(_time = PROJECT.animator.current_frame) { + static update = function(_time = PROJECT.animator.current_frame) { if(!PROJECT.animator.is_playing) { recoverCache(); return; @@ -103,6 +103,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr for(var j = 0; j < array_length(parts); j++) for(var k = 0; k < array_length(parts[j]); k++) { + if(!parts[j][k].active) continue; parts[j][k].draw(_exact, surf_w, surf_h); } } diff --git a/scripts/node_armature_sample/node_armature_sample.gml b/scripts/node_armature_sample/node_armature_sample.gml index ca4c0b7f8..f06969ba1 100644 --- a/scripts/node_armature_sample/node_armature_sample.gml +++ b/scripts/node_armature_sample/node_armature_sample.gml @@ -39,7 +39,7 @@ function Node_Armature_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) con _b.draw(attributes, false, _x, _y, _s, _mx, _my); } #endregion - function update() { #region + static update = function() { #region var _bone = inputs[| 0].getValue(); var _name = inputs[| 1].getValue(); var _prog = inputs[| 2].getValue(); diff --git a/scripts/node_armature_to_path/node_armature_to_path.gml b/scripts/node_armature_to_path/node_armature_to_path.gml index bff846237..94f9c7074 100644 --- a/scripts/node_armature_to_path/node_armature_to_path.gml +++ b/scripts/node_armature_to_path/node_armature_to_path.gml @@ -76,7 +76,7 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const return new __vec2( _x, _y ); } #endregion - function update() { #region + static update = function() { #region var _bone = inputs[| 0].getValue(); if(_bone == noone) return; diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index e2c2470da..ab36d622f 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -11,7 +11,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; diff --git a/scripts/node_compare/node_compare.gml b/scripts/node_compare/node_compare.gml index 4aa009aa4..a990736b1 100644 --- a/scripts/node_compare/node_compare.gml +++ b/scripts/node_compare/node_compare.gml @@ -54,7 +54,7 @@ function Node_Compare(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return 0; } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var mode = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var b = inputs[| 2].getValue(); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index ae2d32e0a..bf187c085 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -273,7 +273,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var shell_cmd = _pathTemp + " -define webp:lossless=true " + _frame; array_push(frames, _frame); - execute_shell(magick, shell_cmd); + shell_execute(magick, shell_cmd, self); _path = file_find_next(); } @@ -291,7 +291,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor cmd += "-bgcolor 0,0,0,0 "; cmd += "-o \"" + target_path + "\""; - execute_shell(webp, cmd); + shell_execute(webp, cmd, self); var noti = log_message("EXPORT", "Export webp as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false); noti.path = filename_dir(target_path); @@ -318,14 +318,14 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor shell_cmd += temp_path; //print($"{gifski} {shell_cmd}"); - execute_shell(gifski, shell_cmd); + shell_execute(gifski, shell_cmd, self); } else { var shell_cmd = $"-delay {framerate} -alpha set -dispose previous -loop {loop_str}"; if(opti) shell_cmd += $" -fuzz {fuzz * 100}% -layers OptimizeFrame -layers OptimizeTransparency"; shell_cmd += " " + temp_path + " " + target_path; //print($"{converter} {shell_cmd}"); - execute_shell(converter, shell_cmd); + shell_execute(converter, shell_cmd, self); } var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false); @@ -373,8 +373,18 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor res = true; break; case "i" : - if(_array) array_push(s, [ "i", string(index) ]); - else s += string(index); + var _txt = ""; + var float_str = string_digits(str); + if(float_str != "") { + var float_val = string_digits(float_str); + var str_val = max(float_val - string_length(string(index)), 0); + repeat(str_val) + _txt += "0"; + } + + _txt += string(index); + if(_array) array_push(s, [ "i", _txt ]); + else s += _txt; res = true; break; case "d" : @@ -418,8 +428,11 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } } - if(_array) array_push(s, ["ext", ".png"]); - else s += ".png"; + var _e = inputs[| 9].getValue(); + var _ext = array_safe_get(inputs[| 9].display_data, _e, ".png"); + + if(_array) array_push(s, ["ext", _ext]); + else s += _ext; return s; } @@ -451,7 +464,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor _pathTemp = "\"" + _pathTemp + "\""; var shell_cmd = _pathTemp + " -quality " + string(qual) + " " + _pathOut; - execute_shell(magick, shell_cmd); + shell_execute(magick, shell_cmd, self); break; case ".webp": @@ -461,7 +474,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor _pathTemp = "\"" + _pathTemp + "\""; var shell_cmd = _pathTemp + " -quality " + string(qual) + " -define webp:lossless=true " + _pathOut; - execute_shell(magick, shell_cmd); + shell_execute(magick, shell_cmd, self); break; } diff --git a/scripts/node_fluid_add/node_fluid_add.gml b/scripts/node_fluid_add/node_fluid_add.gml index 36548a6ae..ae60fd54a 100644 --- a/scripts/node_fluid_add/node_fluid_add.gml +++ b/scripts/node_fluid_add/node_fluid_add.gml @@ -21,14 +21,22 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con inputs[| 5] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]); + inputs[| 6] = nodeValue("Expand velocity mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + + inputs[| 7] = nodeValue("Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0]) + .setDisplay(VALUE_DISPLAY.vector); + input_display_list = [ - ["Domain", false], 0, - ["Fluid", false], 3, 1, 5, 2, 4, + ["Domain", false], 0, + ["Fluid", false], 3, 1, 5, 2, + ["Velocity", false], 7, 4, 6, ]; + _prevPos = noone; + outputs[| 0] = nodeValue("Fluid Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone); - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var _mat = inputs[| 1].getValue(); var _pos = inputs[| 2].getValue(); @@ -42,9 +50,7 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con } inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); - } - - _prevPos = noone; + } #endregion static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); @@ -53,6 +59,8 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con var _act = inputs[| 3].getValue(frame); var _inh = inputs[| 4].getValue(frame); var _den = inputs[| 5].getValue(frame); + var _msk = inputs[| 6].getValue(frame); + var _vel = inputs[| 7].getValue(frame); if(_dom == noone || !instance_exists(_dom)) return; outputs[| 0].setValue(_dom); @@ -63,11 +71,38 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con var sw = surface_get_width_safe(_mat); var sh = surface_get_height_safe(_mat); + var dx = _vel[0]; + var dy = _vel[1]; + if(_prevPos != noone && _inh != 0) { - var dx = _pos[0] - _prevPos[0]; - var dy = _pos[1] - _prevPos[1]; + dx += (_pos[0] - _prevPos[0]) * _inh; + dy += (_pos[1] - _prevPos[1]) * _inh; + } + + if(dx != 0 || dy != 0) { + if(_msk == 0) + fd_rectangle_add_velocity_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, dx, dy); + else { + var _vw = sw + max(0, _msk * 2); + var _vh = sh + max(0, _msk * 2); - fd_rectangle_add_velocity_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, dx * _inh, dy * _inh); + var _vmask = surface_create(_vw, _vh); + surface_set_shader(_vmask,,, BLEND.over); + draw_surface_safe(_mat, max(0, _msk), max(0, _msk)); + surface_reset_shader(); + + var vel_mask = surface_create(_vw, _vh); + surface_set_shader(vel_mask, sh_mask_expand); + shader_set_f("dimension", _vw, _vh); + shader_set_f("amount", _msk); + draw_surface_safe(_vmask); + surface_reset_shader(); + + fd_rectangle_add_velocity_surface(_dom, vel_mask, _pos[0] - _vw / 2, _pos[1] - _vh / 2, 1, 1, dx, dy); + + surface_free(_vmask); + surface_free(vel_mask); + } } fd_rectangle_add_material_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, c_white, _den); diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index 156a06450..fde581d95 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -25,10 +25,12 @@ function variable_editor(nodeVal) constructor { vb_range = new vectorBox(2, function(index, val) { slider_range[index] = val; + refreshInput(); }); tb_step = new textBox(TEXTBOX_INPUT.number, function(val) { slider_step = val; + refreshInput(); }); sc_type = new scrollBox(val_type_name, function(val) { @@ -81,6 +83,7 @@ function variable_editor(nodeVal) constructor { value.setValue([0, 0, 0]); break; case "Vector4" : + case "Vector2 range" : case "Padding" : value.setValue([0, 0, 0, 0]); break; @@ -124,16 +127,16 @@ function variable_editor(nodeVal) constructor { case "Rotation" : value.setDisplay(VALUE_DISPLAY.rotation); break; case "Rotation range" : value.setDisplay(VALUE_DISPLAY.rotation_range); break; case "Slider" : - value.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + value.setDisplay(VALUE_DISPLAY.slider, [slider_range[0], slider_range[1], slider_step]); break; case "Slider range" : - value.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); + value.setDisplay(VALUE_DISPLAY.slider_range, [slider_range[0], slider_range[1], slider_step]); break; case "Padding" : value.setDisplay(VALUE_DISPLAY.padding); break; - case "Vector2" : value.setDisplay(VALUE_DISPLAY.vector); break; - case "Vector3" : value.setDisplay(VALUE_DISPLAY.vector); break; + case "Vector2" : + case "Vector3" : case "Vector4" : value.setDisplay(VALUE_DISPLAY.vector); break; - case "Vector range" : value.setDisplay(VALUE_DISPLAY.vector_range); break; + case "Vector range" : case "Vector2 range" : value.setDisplay(VALUE_DISPLAY.vector_range); break; case "Area" : value.setDisplay(VALUE_DISPLAY.area); break; case "Palette" : value.setDisplay(VALUE_DISPLAY.palette); break; diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index edf6e6046..4c8430299 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -101,7 +101,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con json_save_struct(path, cont); } - function step() { + static step = function() { for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) { var inp = inputs[| i + 1]; var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type; diff --git a/scripts/node_logic_operate/node_logic_operate.gml b/scripts/node_logic_operate/node_logic_operate.gml index 54bace780..47228dcea 100644 --- a/scripts/node_logic_operate/node_logic_operate.gml +++ b/scripts/node_logic_operate/node_logic_operate.gml @@ -181,7 +181,7 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var mode = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var val; diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index 9f4b8addd..4b1daaf4f 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -201,7 +201,7 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { use_mod = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var b = inputs[| 2].getValue(); diff --git a/scripts/node_mesh_create_path/node_mesh_create_path.gml b/scripts/node_mesh_create_path/node_mesh_create_path.gml index 887e2a077..2adf38390 100644 --- a/scripts/node_mesh_create_path/node_mesh_create_path.gml +++ b/scripts/node_mesh_create_path/node_mesh_create_path.gml @@ -22,7 +22,7 @@ function Node_Mesh_Create_Path(_x, _y, _group = noone) : Node(_x, _y, _group) co mesh.draw(_x, _y, _s); } - function update() { + static update = function() { var _pth = inputs[| 0].getValue(); var _sam = inputs[| 1].getValue(); var _algo = inputs[| 2].getValue(); diff --git a/scripts/node_mesh_to_path/node_mesh_to_path.gml b/scripts/node_mesh_to_path/node_mesh_to_path.gml index 431c8a930..90b90ed7c 100644 --- a/scripts/node_mesh_to_path/node_mesh_to_path.gml +++ b/scripts/node_mesh_to_path/node_mesh_to_path.gml @@ -48,7 +48,7 @@ function Node_Mesh_To_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constr return new __vec2(); } - function update() { + static update = function() { var _mesh = inputs[| 0].getValue(); outputs[| 0].setValue(self); if(_mesh == noone) return; diff --git a/scripts/node_mesh_transform/node_mesh_transform.gml b/scripts/node_mesh_transform/node_mesh_transform.gml index 1760ca0de..b33e46eb6 100644 --- a/scripts/node_mesh_transform/node_mesh_transform.gml +++ b/scripts/node_mesh_transform/node_mesh_transform.gml @@ -48,7 +48,7 @@ function Node_Mesh_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons p.y = _pp[1] + _pos[1]; } - function update() { + static update = function() { var _msh = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _rot = inputs[| 2].getValue(); diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index 0dbfd6611..e0d8090d4 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -36,7 +36,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - function step() { + static step = function() { var int = inputs[| 1].getValueCached(); var disp = inputs[| 2].getValueCached(); @@ -227,7 +227,7 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c } } - function step() { + static step = function() { var int = inputs[| 2].getValueCached(); var disp = inputs[| 3].getValueCached(); @@ -411,7 +411,7 @@ function Node_Vector3(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - function step() { + static step = function() { var int = inputs[| 3].getValueCached(); for( var i = 0; i < 3; i++ ) { inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; @@ -466,7 +466,7 @@ function Node_Vector4(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - function step() { + static step = function() { var int = inputs[| 4].getValueCached(); for( var i = 0; i < 4; i++ ) { inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float; diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index 0c2003e66..9c728166e 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -305,7 +305,7 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con static onValueUpdate = function() { extractPalettes(); } static onValueFromUpdate = function() { extractPalettes(); } - function update() { + static update = function() { extractPalettes(); } diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 421e963ac..e4c78377c 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -29,7 +29,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ static onInspector2Update = function() { clearCache(); } - static onValueUpdate = function(index = 0) { + static onValueUpdate = function(index = 0) { #region if(index == input_len + 0) { var _dim = inputs[| input_len + 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -40,17 +40,17 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ if(PROJECT.animator.is_playing) PROJECT.animator.setFrame(-1); - } + } #endregion - static onStep = function() { + static onStep = function() { #region var _dim = inputs[| input_len + 0].getValue(); var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); outputs[| 0].setValue(_outSurf); - } + } #endregion - static onUpdate = function() { + static onUpdate = function() { #region if(ANIMATION_STATIC) { if(!recoverCache()) { var _dim = inputs[| input_len + 0].getValue(); @@ -67,9 +67,9 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ if(PROJECT.animator.current_frame == 0) reset(); runVFX(PROJECT.animator.current_frame); - } + } #endregion - function render(_time = PROJECT.animator.current_frame) { + function render(_time = PROJECT.animator.current_frame) { #region var _dim = inputs[| input_len + 0].getValue(_time); var _exact = inputs[| input_len + 1].getValue(_time); var _blend = inputs[| input_len + 2].getValue(_time); @@ -90,8 +90,12 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ var surf_w = surface_get_width_safe(_outSurf); var surf_h = surface_get_height_safe(_outSurf); - for(var i = 0; i < attributes.part_amount; i++) + //print($"===== Drawing frame {_time} ====="); + for(var i = 0; i < attributes.part_amount; i++) { + if(!parts[i].active) continue; + //print($" > Draw part {i} = ({parts[i].x}, {parts[i].y})"); parts[i].draw(_exact, surf_w, surf_h); + } BLEND_NORMAL; surface_reset_shader(); @@ -100,5 +104,5 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ //print($"Cache frame {PROJECT.animator.current_frame}"); cacheCurrentFrame(_outSurf); } - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_path_blend/node_path_blend.gml b/scripts/node_path_blend/node_path_blend.gml index c4668a8a8..9b1f894ae 100644 --- a/scripts/node_path_blend/node_path_blend.gml +++ b/scripts/node_path_blend/node_path_blend.gml @@ -129,7 +129,7 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc return _p1.lerpTo(_p2, _lerp); } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_builder/node_path_builder.gml b/scripts/node_path_builder/node_path_builder.gml index 70fff2e5a..9e8c8ea33 100644 --- a/scripts/node_path_builder/node_path_builder.gml +++ b/scripts/node_path_builder/node_path_builder.gml @@ -107,7 +107,7 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr return boundary; } - function update() { + static update = function() { var _lines = inputs[| 0].getValue(); var _conn = inputs[| 1].getValue(); diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index cf2151d68..b58fe577d 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -181,7 +181,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const static getBoundary = function() { return boundary; } - function update() { #region + static update = function() { #region var _len = inputs[| 0].getValue(); var _ang = inputs[| 1].getValue(); var _pos = inputs[| 2].getValue(); diff --git a/scripts/node_path_map_area/node_path_map_area.gml b/scripts/node_path_map_area/node_path_map_area.gml index 781f04cd8..8d3a7a5ca 100644 --- a/scripts/node_path_map_area/node_path_map_area.gml +++ b/scripts/node_path_map_area/node_path_map_area.gml @@ -70,7 +70,7 @@ function Node_Path_Map_Area(_x, _y, _group = noone) : Node(_x, _y, _group) const _area[AREA_INDEX.center_y] + _area[AREA_INDEX.half_h] ); } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_plot/node_path_plot.gml b/scripts/node_path_plot/node_path_plot.gml index f309501c7..9796c70cf 100644 --- a/scripts/node_path_plot/node_path_plot.gml +++ b/scripts/node_path_plot/node_path_plot.gml @@ -116,7 +116,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct static getBoundary = function() { return boundary; } - function step() { + static step = function() { var _coor = inputs[| 1].getValue(); var _eqa = inputs[| 2].getValue(); @@ -167,7 +167,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - function updateBoundary() { + static updateBoundary = function() { boundary = new BoundingBox( 0, 0, 1, 1 ); length = 0; @@ -184,7 +184,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - function update() { + static update = function() { updateBoundary(); outputs[| 0].setValue(self); } diff --git a/scripts/node_path_reverse/node_path_reverse.gml b/scripts/node_path_reverse/node_path_reverse.gml index 8742b0480..896e2dcba 100644 --- a/scripts/node_path_reverse/node_path_reverse.gml +++ b/scripts/node_path_reverse/node_path_reverse.gml @@ -46,7 +46,7 @@ function Node_Path_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) constr return getPointRatio(_dist / getLength(), ind); } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_shift/node_path_shift.gml b/scripts/node_path_shift/node_path_shift.gml index f073bd4eb..27b9c14d0 100644 --- a/scripts/node_path_shift/node_path_shift.gml +++ b/scripts/node_path_shift/node_path_shift.gml @@ -64,7 +64,7 @@ function Node_Path_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) construc return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 ); } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_transform/node_path_transform.gml b/scripts/node_path_transform/node_path_transform.gml index 4f0b72120..1aabc8d9d 100644 --- a/scripts/node_path_transform/node_path_transform.gml +++ b/scripts/node_path_transform/node_path_transform.gml @@ -134,7 +134,7 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons _b[3] = cy + (_b[3] - cy) * _sca[1]; } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_trim/node_path_trim.gml b/scripts/node_path_trim/node_path_trim.gml index 0c7f5b929..0606babf1 100644 --- a/scripts/node_path_trim/node_path_trim.gml +++ b/scripts/node_path_trim/node_path_trim.gml @@ -57,7 +57,7 @@ function Node_Path_Trim(_x, _y, _group = noone) : Node(_x, _y, _group) construct return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 ); } - function update() { + static update = function() { outputs[| 0].setValue(self); } diff --git a/scripts/node_path_wave/node_path_wave.gml b/scripts/node_path_wave/node_path_wave.gml index 0448ef284..4c0f66e37 100644 --- a/scripts/node_path_wave/node_path_wave.gml +++ b/scripts/node_path_wave/node_path_wave.gml @@ -99,7 +99,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 ); } - function update() { + static update = function() { for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) current_data[i] = inputs[| i].getValue(); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index b490d7fc9..702fafded 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -76,24 +76,25 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct if(_output.type == VALUE_TYPE.d3object) //passing 3D vertex call return _out; - if(_output.type == VALUE_TYPE.surface) //free surface if needed - surface_array_free(_out); - - if(_output.type == VALUE_TYPE.surface && dimension_index > -1) { //resize surface - var surf = inputs_data[dimension_index]; - var _sw = 1, _sh = 1; - if(inputs[| dimension_index].type == VALUE_TYPE.surface) { - if(is_surface(surf)) { - _sw = surface_get_width_safe(surf); - _sh = surface_get_height_safe(surf); - } else - return noone; - } else if(is_array(surf)) { - _sw = array_safe_get(surf, 0, 1); - _sh = array_safe_get(surf, 1, 1); + if(_output.type == VALUE_TYPE.surface) { //resize surface + if(dimension_index == -1) + surface_array_free(_out); + else { + var surf = inputs_data[dimension_index]; + var _sw = 1, _sh = 1; + if(inputs[| dimension_index].type == VALUE_TYPE.surface) { + if(is_surface(surf)) { + _sw = surface_get_width_safe(surf); + _sh = surface_get_height_safe(surf); + } else + return noone; + } else if(is_array(surf)) { + _sw = array_safe_get(surf, 0, 1); + _sh = array_safe_get(surf, 1, 1); + } + + _out = surface_verify(_out, _sw, _sh, attrDepth()); } - - _out = surface_verify(_out, _sw, _sh, attrDepth()); } current_data = inputs_data; @@ -105,7 +106,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct return inputs_data[0] } - all_inputs = inputs_data; var data = processData(_out, inputs_data, outIndex, 0); /// Process data return data; } #endregion @@ -190,6 +190,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct } #endregion static processOutput = function() { #region + var val; + for(var i = 0; i < ds_list_size(outputs); i++) { if(outputs[| i].process_array) { val = processDataArray(i); diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index 609a04105..22ce9d0df 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -251,7 +251,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor surface_reset_target(); } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _inSurf = inputs[| 0].getValue(); if(is_array(_inSurf) && array_length(_inSurf) == 0) return; if(!is_array(_inSurf) && !is_surface(_inSurf)) return; diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index b86831846..3d6c72e5d 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -53,7 +53,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons static getPreviewValues = function() { return refVal.getValue(); } - function update(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _area = inputs[| 0].getValue(); var _dist = inputs[| 1].getValue(); var _scat = inputs[| 2].getValue(); diff --git a/scripts/node_string_join/node_string_join.gml b/scripts/node_string_join/node_string_join.gml index 44d7f4edf..1f00263ef 100644 --- a/scripts/node_string_join/node_string_join.gml +++ b/scripts/node_string_join/node_string_join.gml @@ -13,7 +13,7 @@ function Node_String_Join(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - function update() { + static update = function() { var _arr = inputs[| 0].getValue(); var _div = inputs[| 1].getValue(); var str = ""; diff --git a/scripts/node_string_trim/node_string_trim.gml b/scripts/node_string_trim/node_string_trim.gml index 7d82ccdcd..e37e59a00 100644 --- a/scripts/node_string_trim/node_string_trim.gml +++ b/scripts/node_string_trim/node_string_trim.gml @@ -25,7 +25,7 @@ function Node_String_Trim(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou ["Trim", false], 3, 4, 1, 2, ]; - function step() { + static step = function() { var mode = inputs[| 4].getValue(); inputs[| 1].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer; diff --git a/scripts/node_struct/node_struct.gml b/scripts/node_struct/node_struct.gml index 94acf9e18..71f9e188b 100644 --- a/scripts/node_struct/node_struct.gml +++ b/scripts/node_struct/node_struct.gml @@ -53,7 +53,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| index + 1].name = inputs[| index].getValue() + " value"; } - function step() { + static step = function() { for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) { var inp = inputs[| i + 1]; var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type; @@ -61,7 +61,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } } - function update() { + static update = function() { var str = {}; for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) { diff --git a/scripts/node_struct_get/node_struct_get.gml b/scripts/node_struct_get/node_struct_get.gml index 4382d5109..d36f09145 100644 --- a/scripts/node_struct_get/node_struct_get.gml +++ b/scripts/node_struct_get/node_struct_get.gml @@ -11,7 +11,7 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {}); - function update() { + static update = function() { var str = inputs[| 0].getValue(); var key = inputs[| 1].getValue(); diff --git a/scripts/node_trigger/node_trigger.gml b/scripts/node_trigger/node_trigger.gml index 578072fc2..59afbf008 100644 --- a/scripts/node_trigger/node_trigger.gml +++ b/scripts/node_trigger/node_trigger.gml @@ -25,7 +25,7 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputs[| 0].setValue(true); } - function step() { + static step = function() { if(doTrigger == 1) { outputs[| 0].setValue(true); doTrigger = -1; @@ -35,7 +35,7 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } } - function update() { + static update = function() { var trg = inputs[| 0].getValue(); if(trg) doTrigger = 1; } diff --git a/scripts/node_trigger_bool/node_trigger_bool.gml b/scripts/node_trigger_bool/node_trigger_bool.gml index a5d2f43bc..f4683b89f 100644 --- a/scripts/node_trigger_bool/node_trigger_bool.gml +++ b/scripts/node_trigger_bool/node_trigger_bool.gml @@ -18,7 +18,7 @@ function Node_Trigger_Bool(_x, _y, _group = noone) : Node(_x, _y, _group) constr doTrigger = 0; - function step() { + static step = function() { if(doTrigger == 1) { outputs[| 0].setValue(true); doTrigger = -1; @@ -28,7 +28,7 @@ function Node_Trigger_Bool(_x, _y, _group = noone) : Node(_x, _y, _group) constr } } - function update() { + static update = function() { var val = inputs[| 0].getValue(); var con = inputs[| 1].getValue(); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 55747acec..1de3a660c 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -810,8 +810,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.slider_range : #region editWidget = new sliderRange(display_data[0], display_data[1], display_data[2], function(index, val) { - //var _val = animator.getValue(); - //_val[index] = val; return setValueDirect(val, index); } ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1); diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index ed8db5887..f282cd3f0 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -15,7 +15,7 @@ function Panel_Menu() : PanelContent() constructor { else action_buttons = ["exit", "minimize", "maximize", "fullscreen"]; - menu_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"]), menuItem(__txt("Save"), function() { SAVE(); }, THEME.save, ["", "Save"]), @@ -31,7 +31,17 @@ function Panel_Menu() : PanelContent() constructor { return submenuCall(_dat, arr); }).setIsShelf(), menuItem(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), function() { shellOpenExplorer(DIRECTORY + "autosave"); }, THEME.save_auto), + menuItem(__txt("Export"), function(_dat) { + var arr = [ + menuItem(__txt("Portable project (.zip)") + "...", function() { exportPortable(); }), + ]; + + return submenuCall(_dat, arr); + }).setIsShelf(), -1, + ]; + + menu_file = [ menuItem(__txt("Preferences") + "...", function() { dialogCall(o_dialog_preference); }, THEME.gear), menuItem(__txt("Splash screen"), function() { dialogCall(o_dialog_splash); }), -1, @@ -68,7 +78,7 @@ function Panel_Menu() : PanelContent() constructor { menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]), ]; - if(DEMO) array_delete(menu_file, 1, 5); + if(!DEMO) menu_file = array_append(menu_file_nondemo, menu_file); menu_help = [ menuItem(__txtx("panel_menu_help_video", "Tutorial videos"), function() { diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 8ef6ed845..5898542f8 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -10,7 +10,7 @@ function NEW() { PANEL_GRAPH = graph; } -function save_serialize(project = PROJECT) { +function save_serialize(project = PROJECT, _outMap = false) { var _map = {}; _map.version = SAVE_VERSION; @@ -50,8 +50,9 @@ function save_serialize(project = PROJECT) { } _map.addon = _addon; - var val = PREF_MAP[? "save_file_minify"]? json_stringify_minify(_map) : json_stringify(_map, true); - return val; + if(_outMap) return _map; + + return PREF_MAP[? "save_file_minify"]? json_stringify_minify(_map) : json_stringify(_map, true); } function SET_PATH(project, path) { diff --git a/scripts/shell_helper/shell_helper.gml b/scripts/shell_helper/shell_helper.gml index 3dc9bd2e0..3a8a87ff8 100644 --- a/scripts/shell_helper/shell_helper.gml +++ b/scripts/shell_helper/shell_helper.gml @@ -1,5 +1,12 @@ function shellOpenExplorer(path) { var _windir = environment_get_variable("WINDIR") + "/explorer.exe"; path = string_replace_all(path, "/", "\\"); - execute_shell(_windir, path); + shell_execute(_windir, path); +} + +function shell_execute(path, command, ref = noone) { + gml_pragma("forceinline"); + + noti_status($"{path} {command}", THEME.noti_icon_console, false, ref); + execute_shell(path, command); } \ No newline at end of file diff --git a/scripts/slider/slider.gml b/scripts/slider/slider.gml index 312f9f30b..cb7512d35 100644 --- a/scripts/slider/slider.gml +++ b/scripts/slider/slider.gml @@ -1,7 +1,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widget() constructor { minn = _min; curr_minn = _min; maxx = _max; curr_maxx = _max; - step = _step; + stepSize = _step; onModify = _onModify; onRelease = _onRelease; @@ -38,7 +38,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg return draw(params.x, params.y, params.w, params.h, params.data, params.m); } - static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 50, halign = fa_left, valign = fa_top) { + static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 64, halign = fa_left, valign = fa_top) { x = _x; y = _y; w = _w; @@ -89,7 +89,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg draw_sprite_stretched_ext(spr, 3, _kx - handle_w / 2, _y, handle_w, _h, COLORS._main_accent, 1); var val = (_m[0] - _x) / sw * (curr_maxx - curr_minn) + curr_minn; - val = round(val / step) * step; + val = round(val / stepSize) * stepSize; val = clamp(val, curr_minn, curr_maxx); if(key_mod_press(CTRL)) diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index c5edb28a7..a98d83ad9 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -1,7 +1,7 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { minn = _min; maxx = _max; - step = _step; + stepSize = _step; spr = THEME.slider; onModify = _onModify; @@ -70,7 +70,7 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { draw_sprite_stretched_ext(spr, 3, _slider_x1 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1); var val = (_m[0] - _x0) / sw * (maxx - minn) + minn; - val = round(val / step) * step; + val = round(val / stepSize) * stepSize; val = clamp(val, minn, maxx); if(key_mod_press(CTRL)) val = round(val); diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index 1e2958bd8..e124c227a 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -337,21 +337,23 @@ function surface_copy_from(dst, src, format = noone) { surface_reset_target(); } -function surface_clone(surface, source = noone, format = noone) { +function surface_clone(surface, destination = noone, format = noone) { gml_pragma("forceinline"); + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) + return surface.clone(); if(!is_surface(surface)) return noone; - source = surface_verify(source, surface_get_width_safe(surface), surface_get_height_safe(surface), format == noone? surface_get_format(surface) : format); + destination = surface_verify(destination, surface_get_width_safe(surface), surface_get_height_safe(surface), format == noone? surface_get_format(surface) : format); - surface_set_target(source); + surface_set_target(destination); DRAW_CLEAR BLEND_OVERRIDE; draw_surface_safe(surface, 0, 0); BLEND_NORMAL surface_reset_target(); - return source; + return destination; } //in-place modification diff --git a/shaders/sh_mask_expand/sh_mask_expand.fsh b/shaders/sh_mask_expand/sh_mask_expand.fsh new file mode 100644 index 000000000..4a78eae92 --- /dev/null +++ b/shaders/sh_mask_expand/sh_mask_expand.fsh @@ -0,0 +1,64 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 dimension; +uniform float amount; + +void main() { + vec2 tx = 1. / dimension; + gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord ); + + if(amount > 0.) { + if(gl_FragColor.a > 0.) { + gl_FragColor = vec4(1.); + return; + } + + for( float i = 0.; i < amount; i++ ) { + vec2 _tx0 = v_vTexcoord + vec2( tx.x, 0. ) * i; + vec2 _tx1 = v_vTexcoord + vec2( -tx.x, 0. ) * i; + vec2 _tx2 = v_vTexcoord + vec2( 0., tx.y ) * i; + vec2 _tx3 = v_vTexcoord + vec2( 0., -tx.y ) * i; + + vec4 _sm0 = texture2D( gm_BaseTexture, _tx0 ); + if(_sm0.a > 0.) { gl_FragColor = vec4(1.); return; } + + vec4 _sm1 = texture2D( gm_BaseTexture, _tx1 ); + if(_sm1.a > 0.) { gl_FragColor = vec4(1.); return; } + + vec4 _sm2 = texture2D( gm_BaseTexture, _tx2 ); + if(_sm2.a > 0.) { gl_FragColor = vec4(1.); return; } + + vec4 _sm3 = texture2D( gm_BaseTexture, _tx3 ); + if(_sm3.a > 0.) { gl_FragColor = vec4(1.); return; } + } + + gl_FragColor = vec4(0.); + } else { + if(gl_FragColor == vec4(0.)) return; + + for( float i = 0.; i < abs(amount); i++ ) { + vec2 _tx0 = v_vTexcoord + vec2( tx.x, 0. ) * i; + vec2 _tx1 = v_vTexcoord + vec2( -tx.x, 0. ) * i; + vec2 _tx2 = v_vTexcoord + vec2( 0., tx.y ) * i; + vec2 _tx3 = v_vTexcoord + vec2( 0., -tx.y ) * i; + + vec4 _sm0 = texture2D( gm_BaseTexture, _tx0 ); + if(_sm0.a == 0.) { gl_FragColor = vec4(0.); return; } + + vec4 _sm1 = texture2D( gm_BaseTexture, _tx1 ); + if(_sm1.a == 0.) { gl_FragColor = vec4(0.); return; } + + vec4 _sm2 = texture2D( gm_BaseTexture, _tx2 ); + if(_sm2.a == 0.) { gl_FragColor = vec4(0.); return; } + + vec4 _sm3 = texture2D( gm_BaseTexture, _tx3 ); + if(_sm3.a == 0.) { gl_FragColor = vec4(0.); return; } + } + + gl_FragColor = vec4(1.); + } +} diff --git a/shaders/sh_mask_expand/sh_mask_expand.vsh b/shaders/sh_mask_expand/sh_mask_expand.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_mask_expand/sh_mask_expand.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_expand/sh_mask_expand.yy b/shaders/sh_mask_expand/sh_mask_expand.yy new file mode 100644 index 000000000..d56640e5a --- /dev/null +++ b/shaders/sh_mask_expand/sh_mask_expand.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_mask_expand", + "parent": { + "name": "filter", + "path": "folders/shader/filter.yy", + }, + "type": 1, +} \ No newline at end of file