From 1971cb7660a83550afb0d38896510162dbd60d65 Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Tue, 18 Jan 2022 11:31:19 +0700 Subject: [PATCH] save load append --- Pixels Composer.yyp | 4 +- objects/o_dialog_add_node/Create_0.gml | 46 ++++- objects/o_dialog_add_node/Draw_64.gml | 2 + scripts/append/append.gml | 93 ++++++++++ scripts/append/append.yy | 12 ++ scripts/debug/debug.gml | 2 +- scripts/node_2d_light/node_2d_light.gml | 2 +- .../node_3d_prim_cube/node_3d_prim_cube.gml | 2 +- .../node_3d_prim_cylinder.gml | 2 +- .../node_3d_transform/node_3d_transform.gml | 2 +- scripts/node_9slice/node_9slice.gml | 2 +- .../node_alpha_cutoff/node_alpha_cutoff.gml | 2 +- .../node_alpha_to_grey/node_alpha_to_grey.gml | 2 +- scripts/node_array/node_array.gml | 2 +- .../node_array_length/node_array_length.gml | 2 +- scripts/node_atlas/node_atlas.gml | 2 +- scripts/node_bevel/node_bevel.gml | 2 +- scripts/node_blend/node_blend.gml | 2 +- scripts/node_bloom/node_bloom.gml | 2 +- scripts/node_blur/node_blur.gml | 2 +- .../node_blur_contrast/node_blur_contrast.gml | 2 +- .../node_blur_directional.gml | 2 +- scripts/node_blur_radial/node_blur_radial.gml | 2 +- scripts/node_bw/node_bw.gml | 2 +- scripts/node_canvas/node_canvas.gml | 8 +- scripts/node_channels/node_channels.gml | 2 +- .../node_checkerboard/node_checkerboard.gml | 2 +- scripts/node_collection/node_collection.gml | 51 +++++- scripts/node_color/node_color.gml | 2 +- .../node_color_adjustment.gml | 2 +- .../node_color_from_hsv.gml | 2 +- .../node_color_from_rgb.gml | 2 +- .../node_color_remove/node_color_remove.gml | 2 +- .../node_color_replacement.gml | 2 +- .../node_color_sampler/node_color_sampler.gml | 2 +- scripts/node_colorize/node_colorize.gml | 8 +- scripts/node_composite/node_composite.gml | 6 +- scripts/node_corner/node_corner.gml | 2 +- scripts/node_crop/node_crop.gml | 2 +- scripts/node_data/node_data.gml | 54 +++--- scripts/node_de_corner/node_de_corner.gml | 2 +- scripts/node_de_stray/node_de_stray.gml | 2 +- scripts/node_dilate/node_dilate.gml | 2 +- .../node_displacement/node_displacement.gml | 2 +- scripts/node_dither/node_dither.gml | 2 +- scripts/node_erode/node_erode.gml | 2 +- scripts/node_frame/node_frame.gml | 2 +- scripts/node_glow/node_glow.gml | 2 +- scripts/node_gradient/node_gradient.gml | 31 +++- .../node_gradient_output.gml | 2 +- .../node_grey_to_alpha/node_grey_to_alpha.gml | 2 +- scripts/node_greyscale/node_greyscale.gml | 2 +- scripts/node_grid/node_grid.gml | 2 +- scripts/node_group_input/node_group_input.gml | 90 ++++++--- .../node_group_output/node_group_output.gml | 56 ++++-- scripts/node_image/node_image.gml | 2 +- .../node_image_animated.gml | 2 +- scripts/node_image_gif/node_image_gif.gml | 2 +- .../node_image_sequence.gml | 2 +- scripts/node_image_sheet/node_image_sheet.gml | 2 +- scripts/node_invert/node_invert.gml | 2 +- scripts/node_keyframe/node_keyframe.gml | 1 - scripts/node_level/node_level.gml | 2 +- .../node_level_selector.gml | 2 +- scripts/node_line/node_line.gml | 2 +- scripts/node_mirror/node_mirror.gml | 2 +- scripts/node_noise_ani/node_noise_ani.gml | 2 +- scripts/node_noise_cell/node_noise_cell.gml | 2 +- scripts/node_noise_grid/node_noise_grid.gml | 2 +- scripts/node_normal/node_normal.gml | 2 +- .../node_normal_light/node_normal_light.gml | 2 +- scripts/node_outline/node_outline.gml | 4 +- scripts/node_padding/node_padding.gml | 2 +- scripts/node_palette/node_palette.gml | 2 +- scripts/node_particle/node_particle.gml | 6 +- .../node_particle_effector.gml | 4 +- scripts/node_path/node_path.gml | 4 +- scripts/node_perlin/node_perlin.gml | 2 +- .../node_perlin_smear/node_perlin_smear.gml | 2 +- scripts/node_pin/node_pin.gml | 2 +- scripts/node_pixel_cloud/node_pixel_cloud.gml | 2 +- scripts/node_polar/node_polar.gml | 2 +- scripts/node_posterize/node_posterize.gml | 4 +- scripts/node_processor/node_processor.gml | 4 +- scripts/node_registry/node_registry.gml | 7 +- scripts/node_scale/node_scale.gml | 2 +- scripts/node_scale_algo/node_scale_algo.gml | 2 +- scripts/node_scatter/node_scatter.gml | 2 +- .../node_seperate_shapes.gml | 2 +- .../node_sequence_to_anim.gml | 2 +- scripts/node_shadow/node_shadow.gml | 2 +- .../node_simple_shape/node_simple_shape.gml | 2 +- scripts/node_solid/node_solid.gml | 2 +- .../node_sprite_sheet/node_sprite_sheet.gml | 4 +- .../node_sprite_stack/node_sprite_stack.gml | 2 +- scripts/node_stripe/node_stripe.gml | 2 +- .../node_surface_data/node_surface_data.gml | 2 +- scripts/node_text/node_text.gml | 2 +- .../node_texture_remap/node_texture_remap.gml | 2 +- scripts/node_time_remap/node_time_remap.gml | 2 +- .../node_timeline_preview.gml | 2 +- scripts/node_trail/node_trail.gml | 2 +- scripts/node_transform/node_transform.gml | 4 +- .../node_transform_single.gml | 2 +- scripts/node_twirl/node_twirl.gml | 2 +- scripts/node_value/node_value.gml | 46 ++--- .../node_value_processor.gml | 2 +- scripts/node_wrap/node_wrap.gml | 2 +- scripts/node_wrap_mesh/node_wrap_mesh.gml | 4 +- scripts/node_zigzag/node_zigzag.gml | 2 +- scripts/panel_collection/panel_collection.gml | 2 +- scripts/panel_data/panel_data.gml | 12 +- scripts/panel_inspector/panel_inspector.gml | 2 +- scripts/render_data/render_data.gml | 14 +- scripts/save_load/save_load.gml | 173 +++++------------- scripts/save_load/save_load.yy | 4 +- scripts/surface_modify/surface_modify.gml | 1 + shaders/sh_colorize/sh_colorize.fsh | 3 +- shaders/sh_gradient/sh_gradient.fsh | 3 + 119 files changed, 557 insertions(+), 380 deletions(-) create mode 100644 scripts/append/append.gml create mode 100644 scripts/append/append.yy diff --git a/Pixels Composer.yyp b/Pixels Composer.yyp index ca552e0c2..09bb576e8 100644 --- a/Pixels Composer.yyp +++ b/Pixels Composer.yyp @@ -277,11 +277,12 @@ {"id":{"name":"areaBox","path":"scripts/areaBox/areaBox.yy",},"order":1,}, {"id":{"name":"s_node_noise_aniso","path":"sprites/s_node_noise_aniso/s_node_noise_aniso.yy",},"order":39,}, {"id":{"name":"node_particle","path":"scripts/node_particle/node_particle.yy",},"order":0,}, + {"id":{"name":"append","path":"scripts/append/append.yy",},"order":1,}, {"id":{"name":"s_node_particle_effector","path":"sprites/s_node_particle_effector/s_node_particle_effector.yy",},"order":37,}, {"id":{"name":"s_dialog_active","path":"sprites/s_dialog_active/s_dialog_active.yy",},"order":0,}, {"id":{"name":"obj_reader","path":"scripts/obj_reader/obj_reader.yy",},"order":2,}, {"id":{"name":"sh_invert","path":"shaders/sh_invert/sh_invert.yy",},"order":30,}, - {"id":{"name":"save_load","path":"scripts/save_load/save_load.yy",},"order":3,}, + {"id":{"name":"save_load","path":"scripts/save_load/save_load.yy",},"order":0,}, {"id":{"name":"node_perlin_smear","path":"scripts/node_perlin_smear/node_perlin_smear.yy",},"order":10,}, {"id":{"name":"node_alpha_cutoff","path":"scripts/node_alpha_cutoff/node_alpha_cutoff.yy",},"order":37,}, {"id":{"name":"sh_channel_R","path":"shaders/sh_channel_R/sh_channel_R.yy",},"order":12,}, @@ -642,6 +643,7 @@ {"folderPath":"folders/sprites/preview.yy","order":9,"resourceVersion":"1.0","name":"preview","tags":[],"resourceType":"GMFolder",}, {"folderPath":"folders/sprites/preview/path.yy","order":8,"resourceVersion":"1.0","name":"path","tags":[],"resourceType":"GMFolder",}, {"folderPath":"folders/functions/debug.yy","order":15,"resourceVersion":"1.0","name":"debug","tags":[],"resourceType":"GMFolder",}, + {"folderPath":"folders/functions/save load.yy","order":16,"resourceVersion":"1.0","name":"save load","tags":[],"resourceType":"GMFolder",}, ], "AudioGroups": [ {"targets":-1,"resourceVersion":"1.3","name":"audiogroup_default","resourceType":"GMAudioGroup",}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 488b114d2..02136fb00 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -13,6 +13,9 @@ event_inherited(); destroy_on_click_out = true; + node_selecting = 0; + node_focusing = -1; + anchor = ANCHOR.left | ANCHOR.top; if(PANEL_GRAPH.getCurrentContext() == -1 && ADD_NODE_PAGE == "Group") @@ -89,6 +92,7 @@ event_inherited(); var hh = grid_space; var yy = _y + grid_space; var name_height = 0; + var amo = 0; for(var i = 0; i < row; i++) { name_height = 0; @@ -116,13 +120,14 @@ event_inherited(); draw_set_text(f_p1, fa_center, fa_top, c_white); name_height = max(name_height, string_height_ext(_node.name, -1, grid_size) + 8); draw_text_ext(_boxx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_width); + + amo++; } } var hght = grid_size + grid_space + name_height; hh += hght; yy += hght; } - return hh; }); #endregion @@ -157,16 +162,19 @@ event_inherited(); search_pane = new scrollPane(dialog_w - 32, dialog_h - 52 - 14, function(_y, _m) { draw_clear_alpha(c_ui_blue_black, 0); - var grid_size = 64; + var grid_size = 64; var grid_width = 80; var grid_space = 16; - var col = floor(search_pane.surface_w / (grid_width + grid_space)); - var hh = (grid_space + grid_size) * 2; - var yy = _y + grid_space; - var index = 0; + var col = floor(search_pane.surface_w / (grid_width + grid_space)); + var hh = (grid_space + grid_size) * 2; + var yy = _y + grid_space; + var index = 0; var name_height = 0; + var amo = 0; + var use_mouse = false; var search_lower = string_lower(search_string); + for(var i = 0; i < ds_list_size(NODE_CATAGORY); i++) { var _page = ALL_NODES[? NODE_CATAGORY[| i]]; @@ -194,11 +202,21 @@ event_inherited(); draw_text_ext(_boxx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_width); if(point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) { - draw_sprite_stretched(s_node_active, 0, _boxx, yy, grid_size, grid_size); + node_selecting = amo; if(mouse_check_button_pressed(mb_left)) buildNode(_node); } + if(node_selecting == amo) { + draw_sprite_stretched(s_node_active, 0, _boxx, yy, grid_size, grid_size); + if(keyboard_check_pressed(vk_enter)) + buildNode(_node); + } + + if(node_focusing == amo) { + search_pane.scroll_y_to = -max(0, hh - search_pane.h); + } + if(++index >= col) { index = 0; var hght = grid_size + grid_space + name_height; @@ -206,10 +224,24 @@ event_inherited(); hh += hght; yy += hght; } + + amo++; } } } + node_focusing = -1; + + if(keyboard_check_pressed(vk_up)) { + node_selecting = safe_mod(node_selecting - 1 + amo, amo); + node_focusing = node_selecting; + } + + if(keyboard_check_pressed(vk_down)) { + node_selecting = safe_mod(node_selecting + 1, amo); + node_focusing = node_selecting; + } + return hh; }); #endregion \ No newline at end of file diff --git a/objects/o_dialog_add_node/Draw_64.gml b/objects/o_dialog_add_node/Draw_64.gml index a926cb9bf..3248912f6 100644 --- a/objects/o_dialog_add_node/Draw_64.gml +++ b/objects/o_dialog_add_node/Draw_64.gml @@ -21,6 +21,8 @@ if !ready exit; draw_sprite_stretched(s_ui_panel_bg, 0, dialog_x + 120, dialog_y + 14, dialog_w - 120 - 14, dialog_h - 28); content_pane.active = FOCUS == self; content_pane.draw(dialog_x + 120, dialog_y + 14); + + node_selecting = 0; } else { tb_search.draw(dialog_x + 14, dialog_y + 14, dialog_w - 28, 32, search_string, [mouse_mx, mouse_my]); diff --git a/scripts/append/append.gml b/scripts/append/append.gml new file mode 100644 index 000000000..34f6e2c2d --- /dev/null +++ b/scripts/append/append.gml @@ -0,0 +1,93 @@ +function APPEND(_path) { + APPEND_ID = NODE_ID + 1; + APPENDING = true; + + if(_path == "") return; + + var file = file_text_open_read(_path); + var load_str = ""; + while(!file_text_eof(file)) { + load_str += file_text_readln(file); + } + var _map = json_decode(load_str); + + if(ds_map_exists(_map, "version")) { + var _v = _map[? "version"]; + if(_v != SAVEFILE_VERSION) { + var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); + log_warning("FILE", warn) + PANEL_MENU.addNotiExtra(warn); + } + } else { + var warn = "File version mismatch : loading old format to Pixel Composer " + string(SAVEFILE_VERSION); + log_warning("FILE", warn) + PANEL_MENU.addNotiExtra(warn); + } + + var _node_list = _map[? "nodes"]; + var appended_list = ds_list_create(); + var node_create = ds_list_create(); + + ds_queue_clear(CONNECTION_CONFLICT); + + for(var i = 0; i < ds_list_size(_node_list); i++) { + var _node = nodeLoad(_node_list[| i], true); + if(_node) ds_list_add(appended_list, _node); + } + ds_map_destroy(_map); + file_text_close(file); + + for(var i = 0; i < ds_list_size(appended_list); i++) { + var _node = appended_list[| i]; + _node.loadGroup(); + + if(_node.group == PANEL_GRAPH.getCurrentContext()) + ds_list_add(node_create, _node); + } + + for(var i = 0; i < ds_list_size(appended_list); i++) { + appended_list[| i].postDeserialize(); + } + + for(var i = 0; i < ds_list_size(appended_list); i++) { + appended_list[| i].preConnect(); + } + + for(var i = 0; i < ds_list_size(appended_list); i++) { + appended_list[| i].connect(); + } + + for(var i = 0; i < ds_list_size(appended_list); i++) { + appended_list[| i].postConnect(); + } + + for(var i = 0; i < ds_list_size(appended_list); i++) { + appended_list[| i].doUpdate(); + } + + ds_list_destroy(appended_list); + + renderAll(); + + if(!ds_queue_empty(CONNECTION_CONFLICT)) { + var pass = 0; + + while(++pass < 2 && !ds_queue_empty(CONNECTION_CONFLICT)) { + var size = ds_queue_size(CONNECTION_CONFLICT); + log_message("LOAD", "[Connect] " + string(size) + " Connection conflict(s) detected ( pass: " + string(pass) + " )"); + repeat(size) { + ds_queue_dequeue(CONNECTION_CONFLICT).connect(); + } + renderAll(); + } + + if(!ds_queue_empty(CONNECTION_CONFLICT)) + PANEL_MENU.addNotiExtra("Some connection(s) is unsolved. This may caused by render node not being update properly, or image path is broken."); + } + + APPENDING = false; + PANEL_ANIMATION.updatePropertyList(); + + log_message("FILE", "append file " + _path); + return node_create; +} \ No newline at end of file diff --git a/scripts/append/append.yy b/scripts/append/append.yy new file mode 100644 index 000000000..3586f3bd0 --- /dev/null +++ b/scripts/append/append.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "save load", + "path": "folders/functions/save load.yy", + }, + "resourceVersion": "1.0", + "name": "append", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index 52dbbfc36..593c1804d 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -32,7 +32,7 @@ function log_newline() { exception_unhandled_handler(function(ex) { var tt = "\n-------------------------- OH NO --------------------------\n\n"; tt += ex.longMessage; - tt += "\n-------------------------- STACK TRACE --------------------------\n"; + tt += "\n-------------------------- STACK TRACE --------------------------\n\n"; for( var i = 0; i < array_length(ex.stacktrace); i++ ) { tt += ex.stacktrace[i] + "\n"; } diff --git a/scripts/node_2d_light/node_2d_light.gml b/scripts/node_2d_light/node_2d_light.gml index 985b8b4af..823f67ab4 100644 --- a/scripts/node_2d_light/node_2d_light.gml +++ b/scripts/node_2d_light/node_2d_light.gml @@ -82,7 +82,7 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor { } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _shape = _data[1]; switch(_shape) { diff --git a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml index abf9423c3..5694406ae 100644 --- a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml +++ b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml @@ -135,7 +135,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor { } } - function update() { + static update = function() { var _inSurf = inputs[| 0].getValue(); var _ww = surface_get_width(_inSurf); diff --git a/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml b/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml index 02345fa56..bf909be81 100644 --- a/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml +++ b/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml @@ -185,7 +185,7 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor { camera_set_view_mat(cam, cam_proj); #endregion - function update() { + static update = function() { var _sides = inputs[| 0].getValue(); var _thick = inputs[| 1].getValue(); diff --git a/scripts/node_3d_transform/node_3d_transform.gml b/scripts/node_3d_transform/node_3d_transform.gml index b8c5bd5a3..95072c808 100644 --- a/scripts/node_3d_transform/node_3d_transform.gml +++ b/scripts/node_3d_transform/node_3d_transform.gml @@ -135,7 +135,7 @@ function Node_3D_Transform(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _out_type = inputs[| 4].getValue(); var _out = inputs[| 5].getValue(); diff --git a/scripts/node_9slice/node_9slice.gml b/scripts/node_9slice/node_9slice.gml index 5ae8790ac..ea5f76d36 100644 --- a/scripts/node_9slice/node_9slice.gml +++ b/scripts/node_9slice/node_9slice.gml @@ -106,7 +106,7 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _inSurf = _data[0]; var _dim = _data[1]; var _splice = _data[2]; diff --git a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml index ff97fad00..20bae4dc2 100644 --- a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml +++ b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml @@ -13,7 +13,7 @@ function Node_Alpha_Cutoff(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_alpha_to_grey/node_alpha_to_grey.gml b/scripts/node_alpha_to_grey/node_alpha_to_grey.gml index fe5f89131..67ab27a93 100644 --- a/scripts/node_alpha_to_grey/node_alpha_to_grey.gml +++ b/scripts/node_alpha_to_grey/node_alpha_to_grey.gml @@ -11,7 +11,7 @@ function Node_Alpha_Grey(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index 7b2c78eeb..989077a51 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -20,7 +20,7 @@ function Node_Array(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - function update() { + static update = function() { var res = array_create(input_size); input_size = 0; diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index 7f557f200..a476a966f 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -16,7 +16,7 @@ function Node_Array_Length(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - function update() { + static update = function() { var _arr = inputs[| 0].getValue(); if(!is_array(_arr)) return; outputs[| 0].setValue(array_length(_arr)); diff --git a/scripts/node_atlas/node_atlas.gml b/scripts/node_atlas/node_atlas.gml index 43d692ef5..53598742a 100644 --- a/scripts/node_atlas/node_atlas.gml +++ b/scripts/node_atlas/node_atlas.gml @@ -13,7 +13,7 @@ function Node_Atlas(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_bevel/node_bevel.gml b/scripts/node_bevel/node_bevel.gml index 0113267c0..45fcc6854 100644 --- a/scripts/node_bevel/node_bevel.gml +++ b/scripts/node_bevel/node_bevel.gml @@ -23,7 +23,7 @@ function Node_Bevel(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _hei = _data[1]; var _shf = _data[2]; var _sca = _data[3]; diff --git a/scripts/node_blend/node_blend.gml b/scripts/node_blend/node_blend.gml index 1b8d04ba4..5cd9f059d 100644 --- a/scripts/node_blend/node_blend.gml +++ b/scripts/node_blend/node_blend.gml @@ -25,7 +25,7 @@ function Node_Blend(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _fore = _data[1]; var _type = _data[2]; var _opacity = _data[3]; diff --git a/scripts/node_bloom/node_bloom.gml b/scripts/node_bloom/node_bloom.gml index ce3800ed5..7f9fff138 100644 --- a/scripts/node_bloom/node_bloom.gml +++ b/scripts/node_bloom/node_bloom.gml @@ -22,7 +22,7 @@ function Node_Bloom(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _size = _data[1]; var _tole = _data[2]; var _stre = _data[3]; diff --git a/scripts/node_blur/node_blur.gml b/scripts/node_blur/node_blur.gml index 47ac6168c..f74db4ade 100644 --- a/scripts/node_blur/node_blur.gml +++ b/scripts/node_blur/node_blur.gml @@ -15,7 +15,7 @@ function Node_Blur(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _size = _data[1]; var _clamp = _data[2]; diff --git a/scripts/node_blur_contrast/node_blur_contrast.gml b/scripts/node_blur_contrast/node_blur_contrast.gml index 7733637bc..6f70f9d2f 100644 --- a/scripts/node_blur_contrast/node_blur_contrast.gml +++ b/scripts/node_blur_contrast/node_blur_contrast.gml @@ -23,7 +23,7 @@ function Node_Blur_Contrast(_x, _y) : Node_Processor(_x, _y) constructor { pass = surface_create(1, 1); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _surf = _data[0]; var _size = _data[1]; var _tres = _data[2]; diff --git a/scripts/node_blur_directional/node_blur_directional.gml b/scripts/node_blur_directional/node_blur_directional.gml index 84ca7e6fd..387b884e9 100644 --- a/scripts/node_blur_directional/node_blur_directional.gml +++ b/scripts/node_blur_directional/node_blur_directional.gml @@ -32,7 +32,7 @@ function Node_Blur_Directional(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 2].drawOverlay(_active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _str = _data[1]; var _dir = _data[2]; surface_set_target(_outSurf); diff --git a/scripts/node_blur_radial/node_blur_radial.gml b/scripts/node_blur_radial/node_blur_radial.gml index a8c6308e8..0a81165b7 100644 --- a/scripts/node_blur_radial/node_blur_radial.gml +++ b/scripts/node_blur_radial/node_blur_radial.gml @@ -27,7 +27,7 @@ function Node_Blur_Radial(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _str = _data[1]; var _cen = _data[2]; _cen[0] /= surface_get_width(_outSurf); diff --git a/scripts/node_bw/node_bw.gml b/scripts/node_bw/node_bw.gml index 48c163e7d..e38beedaa 100644 --- a/scripts/node_bw/node_bw.gml +++ b/scripts/node_bw/node_bw.gml @@ -19,7 +19,7 @@ function Node_BW(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _exp = _data[1]; var _con = _data[2]; surface_set_target(_outSurf); diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 7c643f378..d2f01e622 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -497,7 +497,7 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor { #endregion } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -527,9 +527,9 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor { _map[? "surface"] = buffer_base64_encode(surface_buffer, 0, buffer_get_size(surface_buffer)); } - static doDeserialize = function(_map) { - if(!ds_map_exists(_map, "surface")) return; - surface_buffer = buffer_base64_decode(_map[? "surface"]); + static postDeserialize = function() { + if(!ds_map_exists(load_map, "surface")) return; + surface_buffer = buffer_base64_decode(load_map[? "surface"]); var _outSurf = outputs[| 0].getValue(); buffer_set_surface(surface_buffer, _outSurf, 0); } diff --git a/scripts/node_channels/node_channels.gml b/scripts/node_channels/node_channels.gml index 313b76133..6febce161 100644 --- a/scripts/node_channels/node_channels.gml +++ b/scripts/node_channels/node_channels.gml @@ -13,7 +13,7 @@ function Node_RGB_Channel(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 1] = nodeValue(1, "Surface green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); outputs[| 2] = nodeValue(2, "Surface blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, output_index) { + static process_data = function(_outSurf, _data, output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_checkerboard/node_checkerboard.gml b/scripts/node_checkerboard/node_checkerboard.gml index 7b53fd0b8..27fe72b91 100644 --- a/scripts/node_checkerboard/node_checkerboard.gml +++ b/scripts/node_checkerboard/node_checkerboard.gml @@ -34,7 +34,7 @@ function Node_Checker(_x, _y) : Node(_x, _y) constructor { inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _amo = inputs[| 1].getValue(); var _ang = inputs[| 2].getValue(); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index cd6127ed5..adbf5c3dc 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -27,7 +27,7 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor { } } - function step() { + static step = function() { render_time = 0; for(var i = 0; i < ds_list_size(nodes); i++) { nodes[| i].step(); @@ -40,15 +40,48 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor { } } - load_map = -1; - - function doDeserialize(map) { - load_map = ds_map_create(); - ds_map_copy(load_map, map); + static preConnect = function() { + sortIO(); + deserialize(keyframe_scale); } - static doConnect = function() { - deserialize(load_map, keyframe_scale); - ds_map_destroy(load_map); + static sortIO = function() { + var siz = ds_list_size(inputs); + var ar = ds_priority_create(); + + for( var i = 0; i < siz; i++ ) { + var _in = inputs[| i]; + var _or = _in.from.inputs[| 5].getValue(); + + ds_priority_add(ar, _in, _or); + } + + ds_list_clear(inputs); + for( var i = 0; i < siz; i++ ) { + var _jin = ds_priority_delete_min(ar); + _jin.index = i; + ds_list_add(inputs, _jin); + } + + ds_priority_destroy(ar); + + var siz = ds_list_size(outputs); + var ar = ds_priority_create(); + + for( var i = 0; i < siz; i++ ) { + var _out = outputs[| i]; + var _or = _out.from.inputs[| 1].getValue(); + + ds_priority_add(ar, _out, _or); + } + + ds_list_clear(outputs); + for( var i = 0; i < siz; i++ ) { + var _jout = ds_priority_delete_min(ar); + _jout.index = i; + ds_list_add(outputs, _jout); + } + + ds_priority_destroy(ar); } } \ No newline at end of file diff --git a/scripts/node_color/node_color.gml b/scripts/node_color/node_color.gml index effb467d2..ed9a1e7e6 100644 --- a/scripts/node_color/node_color.gml +++ b/scripts/node_color/node_color.gml @@ -16,7 +16,7 @@ function Node_Color(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []); - function update() { + static update = function() { outputs[| 0].setValue(inputs[| 0].getValue()); } diff --git a/scripts/node_color_adjustment/node_color_adjustment.gml b/scripts/node_color_adjustment/node_color_adjustment.gml index 9c41bb59e..7c5901d9e 100644 --- a/scripts/node_color_adjustment/node_color_adjustment.gml +++ b/scripts/node_color_adjustment/node_color_adjustment.gml @@ -63,7 +63,7 @@ function Node_Color_adjust(_x, _y) : Node_Processor(_x, _y) constructor { ["Color blend", false], 6, 7, 9 ]; - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _exp = _data[1]; var _con = _data[2]; var _hue = _data[3]; diff --git a/scripts/node_color_from_hsv/node_color_from_hsv.gml b/scripts/node_color_from_hsv/node_color_from_hsv.gml index 0a0f0e038..5fe6e22fd 100644 --- a/scripts/node_color_from_hsv/node_color_from_hsv.gml +++ b/scripts/node_color_from_hsv/node_color_from_hsv.gml @@ -22,7 +22,7 @@ function Node_Color_HSV(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); - function update() { + static update = function() { outputs[| 0].setValue(make_color_hsv(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); } doUpdate(); diff --git a/scripts/node_color_from_rgb/node_color_from_rgb.gml b/scripts/node_color_from_rgb/node_color_from_rgb.gml index 32d845c3a..f2c000d29 100644 --- a/scripts/node_color_from_rgb/node_color_from_rgb.gml +++ b/scripts/node_color_from_rgb/node_color_from_rgb.gml @@ -22,7 +22,7 @@ function Node_Color_RGB(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); - function update() { + static update = function() { outputs[| 0].setValue(make_color_rgb(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); } doUpdate(); diff --git a/scripts/node_color_remove/node_color_remove.gml b/scripts/node_color_remove/node_color_remove.gml index 84c40b5dc..4e133919a 100644 --- a/scripts/node_color_remove/node_color_remove.gml +++ b/scripts/node_color_remove/node_color_remove.gml @@ -21,7 +21,7 @@ function Node_Color_Remove(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var fr = _data[1]; var tr = _data[2]; diff --git a/scripts/node_color_replacement/node_color_replacement.gml b/scripts/node_color_replacement/node_color_replacement.gml index 33677d29f..780887699 100644 --- a/scripts/node_color_replacement/node_color_replacement.gml +++ b/scripts/node_color_replacement/node_color_replacement.gml @@ -42,7 +42,7 @@ function Node_Color_replace(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var fr = _data[1]; var to = _data[2]; var tr = _data[3]; diff --git a/scripts/node_color_sampler/node_color_sampler.gml b/scripts/node_color_sampler/node_color_sampler.gml index 5e97cf7b2..b0ad8dffd 100644 --- a/scripts/node_color_sampler/node_color_sampler.gml +++ b/scripts/node_color_sampler/node_color_sampler.gml @@ -20,7 +20,7 @@ function Node_Sampler(_x, _y) : Node(_x, _y) constructor { } _input = -1; - function update() { + static update = function() { var _surf = inputs[| 0].getValue(); if(!is_surface(_surf)) return; if(_input != _surf) { diff --git a/scripts/node_colorize/node_colorize.gml b/scripts/node_colorize/node_colorize.gml index 687ef97f3..21634a3c6 100644 --- a/scripts/node_colorize/node_colorize.gml +++ b/scripts/node_colorize/node_colorize.gml @@ -10,17 +10,22 @@ function Node_Colorize(_x, _y) : Node_Processor(_x, _y) constructor { uniform_grad_blend = shader_get_uniform(sh_colorize, "gradient_blend"); uniform_color = shader_get_uniform(sh_colorize, "gradient_color"); uniform_time = shader_get_uniform(sh_colorize, "gradient_time"); + uniform_shift = shader_get_uniform(sh_colorize, "gradient_shift"); uniform_key = shader_get_uniform(sh_colorize, "keys"); inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue(1, "Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) .setDisplay(VALUE_DISPLAY.gradient); + + inputs[| 2] = nodeValue(2, "Gradient shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, .01 ]); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _gra = _data[1]; var _gra_data = inputs[| 1].getExtraData(); + var _gra_shift = _data[2]; var _grad_color = []; var _grad_time = []; @@ -41,6 +46,7 @@ function Node_Colorize(_x, _y) : Node_Processor(_x, _y) constructor { shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); shader_set_uniform_f_array(uniform_color, _grad_color); shader_set_uniform_f_array(uniform_time, _grad_time); + shader_set_uniform_f(uniform_shift, _gra_shift); shader_set_uniform_i(uniform_key, ds_list_size(_gra)); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index ca7e665f3..5841f05ad 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -247,7 +247,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _pad = _data[0]; var _dim_type = _data[1]; var _dim = _data[2]; @@ -325,8 +325,8 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor { surface_reset_target(); } - static doDeserialize = function(_map) { - var _inputs = _map[? "inputs"]; + static postDeserialize = function() { + var _inputs = load_map[? "inputs"]; for(var i = input_fix_len; i < ds_list_size(_inputs); i += data_length) { createNewSurface(); diff --git a/scripts/node_corner/node_corner.gml b/scripts/node_corner/node_corner.gml index 9e360446e..1fe323de7 100644 --- a/scripts/node_corner/node_corner.gml +++ b/scripts/node_corner/node_corner.gml @@ -30,7 +30,7 @@ function Node_Corner(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var wd = _data[1]; var temp = surface_create(surface_get_width(_data[0]), surface_get_height(_data[0])); diff --git a/scripts/node_crop/node_crop.gml b/scripts/node_crop/node_crop.gml index 69d868f4a..9a861117e 100644 --- a/scripts/node_crop/node_crop.gml +++ b/scripts/node_crop/node_crop.gml @@ -95,7 +95,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _inSurf = _data[0]; var _crop = _data[1]; var _dim = [ surface_get_width(_inSurf) - _crop[0] - _crop[2], surface_get_height(_inSurf) - _crop[1] - _crop[3] ]; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 68c66ddac..c601c9e0a 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -172,20 +172,16 @@ function Node(_x, _y) constructor { jun = inputs[| input_display_list[i]]; } - if(jun.isVisible()) { - jun.y = _in; - _in += 24 * _s; - } + jun.y = _in; + _in += 24 * _s * jun.isVisible(); } var _in = yy + junction_shift_y * _s; for(var i = 0; i < ds_list_size(outputs); i++) { var jun = outputs[| i]; - if(jun.isVisible()) { - jun.y = _in; - _in += 24 * _s; - } + jun.y = _in; + _in += 24 * _s * jun.isVisible(); } } @@ -470,7 +466,7 @@ function Node(_x, _y) constructor { ds_list_add(group.nodes, input_node); - input_node._inParent.setFrom(_in.value_from); + input_node.inParent.setFrom(_in.value_from); input_node.onValueUpdate(0); _in.setFrom(input_node.outputs[| 0]); } @@ -483,7 +479,7 @@ function Node(_x, _y) constructor { var output_node = new Node_Group_Output(x + w + 64, y, group); ds_list_add(group.nodes, output_node); - _to.setFrom(output_node._outParent); + _to.setFrom(output_node.outParent); output_node.inputs[| 0].setFrom(_ou); } } @@ -518,22 +514,23 @@ function Node(_x, _y) constructor { static doSerialize = function(_map) {} keyframe_scale = false; - static deserialize = function(_map, scale = false) { + load_map = -1; + static deserialize = function(scale = false) { keyframe_scale = scale; - node_id = _map[? "id"] + APPEND_ID; + node_id = load_map[? "id"] + APPEND_ID; NODE_MAP[? node_id] = self; NODE_ID = max(NODE_ID, node_id + 1); - name = _map[? "name"]; - _group = _map[? "group"]; + name = load_map[? "name"]; + _group = load_map[? "group"]; - x = _map[? "x"]; - y = _map[? "y"]; + x = load_map[? "x"]; + y = load_map[? "y"]; - if(ds_map_exists(_map, "attri")) - ds_map_override(attributes, _map[? "attri"]); + if(ds_map_exists(load_map, "attri")) + ds_map_override(attributes, load_map[? "attri"]); - var _inputs = _map[? "inputs"]; + var _inputs = load_map[? "inputs"]; if(!ds_list_empty(_inputs) && !ds_list_empty(inputs)) { var _siz = min(ds_list_size(_inputs), ds_list_size(inputs)); @@ -541,34 +538,29 @@ function Node(_x, _y) constructor { inputs[| i].deserialize(_inputs[| i], scale); } } - - doDeserialize(_map); } - static doDeserialize = function(_map) {} - static postDeserialize = function() {} - static connect = function() { + static loadGroup = function() { if(_group == -1) { var c = PANEL_GRAPH.getCurrentContext(); if(c != -1) c.add(self); } else { - if(ds_map_exists(NODE_MAP, _group + APPEND_ID)) + if(ds_map_exists(NODE_MAP, _group + APPEND_ID)) { NODE_MAP[? _group + APPEND_ID].add(self); + } } - - preConnect(); - + } + + static connect = function() { var connected = true; for(var i = 0; i < ds_list_size(inputs); i++) { connected &= inputs[| i].connect(); } if(!connected) ds_queue_enqueue(CONNECTION_CONFLICT, self); - - doConnect(); } static preConnect = function() {} - static doConnect = function() {} + static postConnect = function() {} } \ No newline at end of file diff --git a/scripts/node_de_corner/node_de_corner.gml b/scripts/node_de_corner/node_de_corner.gml index b4488b5a6..38189bb2d 100644 --- a/scripts/node_de_corner/node_de_corner.gml +++ b/scripts/node_de_corner/node_de_corner.gml @@ -15,7 +15,7 @@ function Node_De_Corner(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_de_stray/node_de_stray.gml b/scripts/node_de_stray/node_de_stray.gml index 850c312f4..09fcd4fcb 100644 --- a/scripts/node_de_stray/node_de_stray.gml +++ b/scripts/node_de_stray/node_de_stray.gml @@ -16,7 +16,7 @@ function Node_De_Stray(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_dilate/node_dilate.gml b/scripts/node_dilate/node_dilate.gml index 594cdfc93..39d17864e 100644 --- a/scripts/node_dilate/node_dilate.gml +++ b/scripts/node_dilate/node_dilate.gml @@ -32,7 +32,7 @@ function Node_Dilate(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, s_anchor_scale_hori); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index e8f52dfe3..63f27de8b 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -45,7 +45,7 @@ function Node_Displace(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { switch(_data[5]) { case 0 : inputs[| 2].show_in_inspector = true; diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 0ddfe893a..08f6a5384 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -53,7 +53,7 @@ function Node_Dither(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _pal = _data[1]; var _typ = _data[2]; var _map = _data[3]; diff --git a/scripts/node_erode/node_erode.gml b/scripts/node_erode/node_erode.gml index e77c71a6e..f17df63ec 100644 --- a/scripts/node_erode/node_erode.gml +++ b/scripts/node_erode/node_erode.gml @@ -17,7 +17,7 @@ function Node_Erode(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var wd = _data[1]; surface_set_target(_outSurf); diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index 20a9e0a68..51c0a9347 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -27,7 +27,7 @@ function Node_Frame(_x, _y) : Node(_x, _y) constructor { inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ) .setVisible(false); - function step() { + static step = function() { var si = inputs[| 0].getValue(); w = si[0]; h = si[1]; diff --git a/scripts/node_glow/node_glow.gml b/scripts/node_glow/node_glow.gml index fd081a5e8..1357e006a 100644 --- a/scripts/node_glow/node_glow.gml +++ b/scripts/node_glow/node_glow.gml @@ -25,7 +25,7 @@ function Node_Glow(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _border = _data[1]; var _size = _data[2]; var _stre = _data[3]; diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 6db376227..9ef537187 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -11,6 +11,7 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor { uniform_grad = shader_get_uniform(sh_gradient, "gradient_color"); uniform_grad_time = shader_get_uniform(sh_gradient, "gradient_time"); uniform_grad_key = shader_get_uniform(sh_gradient, "gradient_keys"); + uniform_grad_loop = shader_get_uniform(sh_gradient, "gradient_loop"); uniform_type = shader_get_uniform(sh_gradient, "type"); uniform_center = shader_get_uniform(sh_gradient, "center"); @@ -23,33 +24,43 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor { .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue(1, "Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) - .setDisplay(VALUE_DISPLAY.gradient); + .setDisplay(VALUE_DISPLAY.gradient) inputs[| 2] = nodeValue(2, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]); + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]) + .setVisible(false); inputs[| 3] = nodeValue(3, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.rotation); - - inputs[| 4] = nodeValue(4, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5); + .setDisplay(VALUE_DISPLAY.rotation) + .setVisible(false); + + inputs[| 4] = nodeValue(4, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5) + .setVisible(false); + inputs[| 5] = nodeValue(5, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) - .setDisplay(VALUE_DISPLAY.slider, [-2, 2, 0.01]); + .setDisplay(VALUE_DISPLAY.slider, [-2, 2, 0.01]) + .setVisible(false); inputs[| 6] = nodeValue(6, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [def_surf_size / 2, def_surf_size / 2]) - .setDisplay(VALUE_DISPLAY.vector); + .setDisplay(VALUE_DISPLAY.vector) + .setVisible(false); + + inputs[| 7] = nodeValue(7, "Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .setVisible(false); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); input_display_list = [ ["Output", true], 0, - ["Gradient", false], 1, 2, 3, 4, 5, 6 + ["Gradient", false], 1, 5, 7, + ["Shape", false], 2, 3, 4, 6 ]; static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { inputs[| 6].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -67,6 +78,7 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor { var _rad = inputs[| 4].getValue(); var _shf = inputs[| 5].getValue(); var _cnt = inputs[| 6].getValue(); + var _lop = inputs[| 7].getValue(); var _grad_color = []; var _grad_time = []; @@ -92,6 +104,7 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor { shader_set_uniform_f_array(uniform_grad, _grad_color); shader_set_uniform_f_array(uniform_grad_time, _grad_time); shader_set_uniform_i(uniform_grad_key, ds_list_size(_gra)); + shader_set_uniform_i(uniform_grad_loop, _lop); shader_set_uniform_f_array(uniform_center, [_cnt[0] / _dim[0], _cnt[1] / _dim[1]]); shader_set_uniform_i(uniform_type, _typ); diff --git a/scripts/node_gradient_output/node_gradient_output.gml b/scripts/node_gradient_output/node_gradient_output.gml index a59f7530d..ff1ca5f19 100644 --- a/scripts/node_gradient_output/node_gradient_output.gml +++ b/scripts/node_gradient_output/node_gradient_output.gml @@ -23,7 +23,7 @@ function Node_Gradient_Out(_x, _y) : Node(_x, _y) constructor { outputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); _pal = -1; - function update() { + static update = function() { var pal = inputs[| 0].getValue(); var pos = inputs[| 1].getValue(); diff --git a/scripts/node_grey_to_alpha/node_grey_to_alpha.gml b/scripts/node_grey_to_alpha/node_grey_to_alpha.gml index 0c9fb769c..8e1fcce23 100644 --- a/scripts/node_grey_to_alpha/node_grey_to_alpha.gml +++ b/scripts/node_grey_to_alpha/node_grey_to_alpha.gml @@ -11,7 +11,7 @@ function Node_Grey_Alpha(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_greyscale/node_greyscale.gml b/scripts/node_greyscale/node_greyscale.gml index b601f3d10..1b6ef47ec 100644 --- a/scripts/node_greyscale/node_greyscale.gml +++ b/scripts/node_greyscale/node_greyscale.gml @@ -19,7 +19,7 @@ function Node_Greyscale(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _exp = _data[1]; var _con = _data[2]; surface_set_target(_outSurf); diff --git a/scripts/node_grid/node_grid.gml b/scripts/node_grid/node_grid.gml index 28f44d83f..6e5a6b246 100644 --- a/scripts/node_grid/node_grid.gml +++ b/scripts/node_grid/node_grid.gml @@ -34,7 +34,7 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor { inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 4fe3cbc8e..9da25a175 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -12,7 +12,8 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { auto_height = false; input_index = -1; - self.group = _group; + group = _group; + inParent = undefined; w = 96; h = 32 + 24; @@ -38,11 +39,19 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { .setDisplay(VALUE_DISPLAY.enum_button, [ "2", "3", "4" ]) .setVisible(false, false); - input_display_list = [ 2, 0, 1, 3, 4 ]; + inputs[| 5] = nodeValue(5, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setVisible(false); + + input_display_list = [ + ["Data", false], 2, 4, + ["Display", false], 5, 0, 1, 3 + ]; outputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - function onValueUpdate(index) { + static onValueUpdate = function(index) { + if(is_undefined(inParent)) return; + var _dtype = inputs[| 0].getValue(); var _range = inputs[| 1].getValue(); var _val_type = inputs[| 2].getValue(); @@ -58,36 +67,36 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { } } - _inParent.type = _val_type; + inParent.type = _val_type; outputs[| 0].type = _val_type; - var _val = _inParent.getValue(); + var _val = inParent.getValue(); switch(_dtype) { case VALUE_DISPLAY.range : case VALUE_DISPLAY.slider : - _inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); + inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); break; case VALUE_DISPLAY.slider_range : - _inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); + inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); case VALUE_DISPLAY.rotation_range : if(!is_array(_val) || array_length(_val) != 2) - _inParent.value = new animValue([0, 0], _inParent); + inParent.value = new animValue([0, 0], inParent); break; case VALUE_DISPLAY.enum_button : case VALUE_DISPLAY.enum_scroll : - _inParent.setDisplay(_dtype, string_splice(_enum_label, ",")); + inParent.setDisplay(_dtype, string_splice(_enum_label, ",")); break; case VALUE_DISPLAY.padding : if(!is_array(_val) || array_length(_val) != 4) - _inParent.value = new animValue([0, 0, 0, 0], _inParent); + inParent.value = new animValue([0, 0, 0, 0], inParent); break; case VALUE_DISPLAY.area : if(!is_array(_val) || array_length(_val) != 5) - _inParent.value = new animValue([0, 0, 0, 0, 5], _inParent); + inParent.value = new animValue([0, 0, 0, 0, 5], inParent); break; case VALUE_DISPLAY.vector : @@ -95,40 +104,53 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { switch(_vec_size) { case 0 : if(!is_array(_val) || array_length(_val) != 2) - _inParent.value = new animValue([0, 0], _inParent); + inParent.value = new animValue([0, 0], inParent); break; case 1 : if(!is_array(_val) || array_length(_val) != 3) - _inParent.value = new animValue([0, 0, 0], _inParent); + inParent.value = new animValue([0, 0, 0], inParent); break; case 2 : if(!is_array(_val) || array_length(_val) != 4) - _inParent.value = new animValue([0, 0, 0, 0], _inParent); + inParent.value = new animValue([0, 0, 0, 0], inParent); break; } - _inParent.setDisplay(_dtype); + inParent.setDisplay(_dtype); break; case VALUE_DISPLAY.palette : if(!is_array(_val)) - _inParent.value = new animValue([c_black], _inParent); + inParent.value = new animValue([c_black], inParent); break; default : - _inParent.setDisplay(_dtype); + inParent.setDisplay(_dtype); break; } + + group.sortIO(); } - function createInput() { - input_index = ds_list_size(group.inputs); - _inParent = nodeValue(ds_list_size(group.inputs), "Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1); - ds_list_add(group.inputs, _inParent); - outputs[| 0].setFrom(_inParent, false, false); - group.setHeight(); - - onValueUpdate(0); + function createInput(override_order = false) { + if(group && is_struct(group)) { + if(override_order) { + input_index = ds_list_size(group.inputs); + inputs[| 5].setValue(input_index); + } else { + input_index = inputs[| 5].getValue(); + } + + inParent = nodeValue(ds_list_size(group.inputs), "Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1); + inParent.from = self; + + ds_list_add(group.inputs, inParent); + outputs[| 0].setFrom(inParent, false, false); + group.setHeight(); + group.sortIO(); + + onValueUpdate(0); + } } if(!LOADING && !APPENDING) @@ -137,8 +159,14 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { dtype = -1; range = 0; - function update() { - _inParent.name = name; + static step = function() { + if(is_undefined(inParent)) return; + + inParent.name = name; + } + + static update = function() { + if(is_undefined(inParent)) return; var _dtype = inputs[| 0].getValue(); @@ -163,12 +191,14 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor { } } - static preConnect = function() { - createInput(); + static postDeserialize = function() { + createInput(false); onValueUpdate(0); } function onDestroy() { - ds_list_remove(group.inputs, _inParent); + if(is_undefined(inParent)) return; + + ds_list_remove(group.inputs, inParent); } } \ No newline at end of file diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 1410722fa..2b0da393b 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -19,43 +19,67 @@ function Node_Group_Output(_x, _y, _group) : Node(_x, _y) constructor { inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1); - _outParent = -1; + inputs[| 1] = nodeValue(1, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setVisible(false); - function createOutput() { - _outParent = nodeValue(ds_list_size(group.outputs), "Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.any, -1); - ds_list_add(group.outputs, _outParent); - group.setHeight(); + outParent = undefined; + output_index = -1; + + static onValueUpdate = function(index) { + if(is_undefined(outParent)) return; - _outParent.setFrom(inputs[| 0]); + group.sortIO(); + } + + function createOutput(override_order = true) { + if(group && is_struct(group)) { + if(override_order) { + output_index = ds_list_size(group.outputs); + inputs[| 1].setValue(output_index); + } else { + output_index = inputs[| 1].getValue(); + } + + outParent = nodeValue(ds_list_size(group.outputs), "Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.any, -1); + outParent.from = self; + ds_list_add(group.outputs, outParent); + group.setHeight(); + group.sortIO(); + + outParent.setFrom(inputs[| 0]); + } } if(!LOADING && !APPENDING) createOutput(); - function step() { - _outParent.name = name; + static step = function() { + if(is_undefined(outParent)) return; + + outParent.name = name; if(inputs[| 0].value_from) { - _outParent.type = inputs[| 0].value_from.type; + outParent.type = inputs[| 0].value_from.type; inputs[| 0].type = inputs[| 0].value_from.type; } else { inputs[| 0].type = VALUE_TYPE.any; } } function doUpdateForward() { - if(_outParent == -1) return; + if(is_undefined(outParent)) return; - for(var j = 0; j < ds_list_size(_outParent.value_to); j++) { - if(_outParent.value_to[| j].value_from == _outParent) { - _outParent.value_to[| j].node.updateForward(); + for(var j = 0; j < ds_list_size(outParent.value_to); j++) { + if(outParent.value_to[| j].value_from == outParent) { + outParent.value_to[| j].node.updateForward(); } } } - function doConnect() { - createOutput(); + static postDeserialize = function() { + createOutput(false); } function onDestroy() { - ds_list_delete(group.outputs, ds_list_find_index(group.outputs, _outParent)); + if(is_undefined(outParent)) return; + ds_list_delete(group.outputs, ds_list_find_index(group.outputs, outParent)); } } \ No newline at end of file diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 7ec5d19fb..0085a5245 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -83,7 +83,7 @@ function Node_Image(_x, _y) : Node(_x, _y) constructor { return false; } - function update() { + static update = function() { var path = inputs[| 0].getValue(); var pad = inputs[| 1].getValue(); if(path == "") return; diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index 124e50f69..bfbd40784 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -110,7 +110,7 @@ function Node_Image_Animated(_x, _y) : Node(_x, _y) constructor { return true; } - function update() { + static update = function() { var path = inputs[| 0].getValue(); if(path == "") return; if(is_array(path) && !array_equals(path, path_loaded)) diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 003a1d731..b45935d53 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -103,7 +103,7 @@ function Node_Image_gif(_x, _y) : Node(_x, _y) constructor { } } - function update() { + static update = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index 310709f94..91af38759 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -113,7 +113,7 @@ function Node_Image_Sequence(_x, _y) : Node(_x, _y) constructor { return true; } - function update() { + static update = function() { var path = inputs[| 0].getValue(); if(path == "") return; if(!array_equals(path, path_loaded)) diff --git a/scripts/node_image_sheet/node_image_sheet.gml b/scripts/node_image_sheet/node_image_sheet.gml index 1fe7d12de..cad291306 100644 --- a/scripts/node_image_sheet/node_image_sheet.gml +++ b/scripts/node_image_sheet/node_image_sheet.gml @@ -223,7 +223,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor { } } - function update() { + static update = function() { if(inputs[| 0].value_from == noone) return; var _inSurf = inputs[| 0].getValue(); diff --git a/scripts/node_invert/node_invert.gml b/scripts/node_invert/node_invert.gml index 0a9e69504..bca2c7f61 100644 --- a/scripts/node_invert/node_invert.gml +++ b/scripts/node_invert/node_invert.gml @@ -11,7 +11,7 @@ function Node_Invert(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 3e6b0c76f..85f0503c0 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -39,7 +39,6 @@ function animValue(_val, _node) constructor { static getValue = function() { if(node.display_type == VALUE_DISPLAY.gradient) return processType(values); - if(node.type == VALUE_TYPE.path) return processType(values[| 0].value); if(!is_anim) return processType(values[| 0].value); diff --git a/scripts/node_level/node_level.gml b/scripts/node_level/node_level.gml index a21b7f17d..ea3fe6be9 100644 --- a/scripts/node_level/node_level.gml +++ b/scripts/node_level/node_level.gml @@ -20,7 +20,7 @@ function Node_Level(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _black = _data[1]; var _white = _data[2]; diff --git a/scripts/node_level_selector/node_level_selector.gml b/scripts/node_level_selector/node_level_selector.gml index 3e676f839..6c472d0fb 100644 --- a/scripts/node_level_selector/node_level_selector.gml +++ b/scripts/node_level_selector/node_level_selector.gml @@ -20,7 +20,7 @@ function Node_Level_Selector(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _middle = _data[1]; var _range = _data[2]; diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index 8076f3307..89ed071fc 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -50,7 +50,7 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _bg = inputs[| 1].getValue(); var _seg = inputs[| 2].getValue(); diff --git a/scripts/node_mirror/node_mirror.gml b/scripts/node_mirror/node_mirror.gml index bf5162971..e6e5d607d 100644 --- a/scripts/node_mirror/node_mirror.gml +++ b/scripts/node_mirror/node_mirror.gml @@ -38,7 +38,7 @@ function Node_Mirror(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 2].drawOverlay(_active, _posx, _posy, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _dim = [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]; var _pos = _data[1]; var _ang = _data[2]; diff --git a/scripts/node_noise_ani/node_noise_ani.gml b/scripts/node_noise_ani/node_noise_ani.gml index 3760563c2..5b061ed09 100644 --- a/scripts/node_noise_ani/node_noise_ani.gml +++ b/scripts/node_noise_ani/node_noise_ani.gml @@ -34,7 +34,7 @@ function Node_Noise_Aniso(_x, _y) : Node(_x, _y) constructor { inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _amo = inputs[| 1].getValue(); var _sed = inputs[| 2].getValue(); diff --git a/scripts/node_noise_cell/node_noise_cell.gml b/scripts/node_noise_cell/node_noise_cell.gml index 558211c59..3a693a407 100644 --- a/scripts/node_noise_cell/node_noise_cell.gml +++ b/scripts/node_noise_cell/node_noise_cell.gml @@ -56,7 +56,7 @@ function Node_Cellular(_x, _y) : Node(_x, _y) constructor { inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); diff --git a/scripts/node_noise_grid/node_noise_grid.gml b/scripts/node_noise_grid/node_noise_grid.gml index 622aa3f43..4c1c30672 100644 --- a/scripts/node_noise_grid/node_noise_grid.gml +++ b/scripts/node_noise_grid/node_noise_grid.gml @@ -38,7 +38,7 @@ function Node_Grid_Noise(_x, _y) : Node(_x, _y) constructor { inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); diff --git a/scripts/node_normal/node_normal.gml b/scripts/node_normal/node_normal.gml index 5c253792e..d838356b3 100644 --- a/scripts/node_normal/node_normal.gml +++ b/scripts/node_normal/node_normal.gml @@ -15,7 +15,7 @@ function Node_Normal(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _hei = _data[1]; surface_set_target(_outSurf); diff --git a/scripts/node_normal_light/node_normal_light.gml b/scripts/node_normal_light/node_normal_light.gml index a068ab841..acf7fbe88 100644 --- a/scripts/node_normal_light/node_normal_light.gml +++ b/scripts/node_normal_light/node_normal_light.gml @@ -50,7 +50,7 @@ function Node_Normal_Light(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _map = _data[1]; var _hei = _data[2]; var _amb = _data[3]; diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index 857d397fe..44eba5049 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -38,7 +38,7 @@ function Node_Outline(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); outputs[| 1] = nodeValue(1, "Outline", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var ww = surface_get_width(_data[0]); var hh = surface_get_height(_data[0]); var wd = _data[1]; @@ -73,7 +73,7 @@ function Node_Outline(_x, _y) : Node_Processor(_x, _y) constructor { return _outSurf; } - function step() { + static step = function() { var blend = inputs[| 3].getValue(); inputs[| 4].show_in_inspector = blend; } diff --git a/scripts/node_padding/node_padding.gml b/scripts/node_padding/node_padding.gml index d3336e2e6..726f55b5b 100644 --- a/scripts/node_padding/node_padding.gml +++ b/scripts/node_padding/node_padding.gml @@ -14,7 +14,7 @@ function Node_Padding(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var padding = _data[1]; var ww = surface_get_width(_data[0]); diff --git a/scripts/node_palette/node_palette.gml b/scripts/node_palette/node_palette.gml index 343d6ee9f..00e5da98e 100644 --- a/scripts/node_palette/node_palette.gml +++ b/scripts/node_palette/node_palette.gml @@ -27,7 +27,7 @@ function Node_Palette(_x, _y) : Node(_x, _y) constructor { _pal = -1; _ran = [0, 1]; - function update() { + static update = function() { var pal = inputs[| 0].getValue(); var ran = inputs[| 1].getValue(); diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 1675b807f..8ef841bc9 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -83,7 +83,7 @@ function __part() constructor { active = false; } - function step() { + static step = function() { if(!active) return; var xp = x, yp = y; x += sx; @@ -444,7 +444,7 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor { } } - function step() { + static step = function() { var _inSurf = inputs[| 0].getValue(); var _scatt = inputs[| 27].getValue(); @@ -535,7 +535,7 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor { cacheCurrentFrame(_outSurf); } - function update() { + static update = function() { reset(); } doUpdate(); diff --git a/scripts/node_particle_effector/node_particle_effector.gml b/scripts/node_particle_effector/node_particle_effector.gml index 6b2668789..a9e865943 100644 --- a/scripts/node_particle_effector/node_particle_effector.gml +++ b/scripts/node_particle_effector/node_particle_effector.gml @@ -72,7 +72,7 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor { inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function step() { + static step = function() { var _type = inputs[| 5].getValue(); switch(_type) { case FORCE_TYPE.Wind : @@ -205,7 +205,7 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor { } } - function update() { + static update = function() { var jun = outputs[| 0]; for(var j = 0; j < ds_list_size(jun.value_to); j++) { if(jun.value_to[| j].value_from == jun) { diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index 93168867f..ab73bfdc8 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -306,8 +306,8 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor { draw_sprite_ext(s_node_draw_path, 0, xx + w * _s / 2, yy + 10 + (h - 10) * _s / 2, _s, _s, 0, c_white, 1); } - static doDeserialize = function(_map) { - var _inputs = _map[? "inputs"]; + static postDeserialize = function() { + var _inputs = load_map[? "inputs"]; for(var i = list_start; i < ds_list_size(_inputs); i++) { createAnchor(0, 0).deserialize(_inputs[| i]); diff --git a/scripts/node_perlin/node_perlin.gml b/scripts/node_perlin/node_perlin.gml index 8f6486c40..6c2f99c81 100644 --- a/scripts/node_perlin/node_perlin.gml +++ b/scripts/node_perlin/node_perlin.gml @@ -30,7 +30,7 @@ function Node_Perlin(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); diff --git a/scripts/node_perlin_smear/node_perlin_smear.gml b/scripts/node_perlin_smear/node_perlin_smear.gml index e9fadccf7..2faa56a3e 100644 --- a/scripts/node_perlin_smear/node_perlin_smear.gml +++ b/scripts/node_perlin_smear/node_perlin_smear.gml @@ -30,7 +30,7 @@ function Node_Perlin_Smear(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index 3781d0b8d..21b2906db 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -20,7 +20,7 @@ function Node_Pin(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - function update() { + static update = function() { if(inputs[| 0].value_from != noone) { outputs[| 0].value_from = inputs[| 0].value_from; } diff --git a/scripts/node_pixel_cloud/node_pixel_cloud.gml b/scripts/node_pixel_cloud/node_pixel_cloud.gml index e80f3ad8e..f7f5bce0f 100644 --- a/scripts/node_pixel_cloud/node_pixel_cloud.gml +++ b/scripts/node_pixel_cloud/node_pixel_cloud.gml @@ -48,7 +48,7 @@ function Node_Pixel_Cloud(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _sed = _data[1]; var _str = _data[2]; var _map = _data[3]; diff --git a/scripts/node_polar/node_polar.gml b/scripts/node_polar/node_polar.gml index b47fb8560..5bd3a526a 100644 --- a/scripts/node_polar/node_polar.gml +++ b/scripts/node_polar/node_polar.gml @@ -11,7 +11,7 @@ function Node_Polar(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_posterize/node_posterize.gml b/scripts/node_posterize/node_posterize.gml index 95f54bb28..c21d0d4cf 100644 --- a/scripts/node_posterize/node_posterize.gml +++ b/scripts/node_posterize/node_posterize.gml @@ -32,7 +32,7 @@ function Node_Posterize(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function step() { + static step = function() { var _use_pal = inputs[| 2].getValue(); inputs[| 1].show_in_inspector = _use_pal; @@ -40,7 +40,7 @@ function Node_Posterize(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 4].show_in_inspector = !_use_pal; } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _gra = _data[1]; var _use_gra = _data[2]; diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index d8b06734b..08b58c9ea 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -9,9 +9,9 @@ function Node_Processor(_x, _y) : Node(_x, _y) constructor { icon = s_node_processor; - function process_data(_outSurf, _data, _output_index) { return _outSurf; } + static process_data = function(_outSurf, _data, _output_index) { return _outSurf; } - function update() { + static update = function() { var len = 0; for(var i = 0; i < ds_list_size(inputs); i++) { var _in = inputs[| i].getValue(); diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 4d281cac6..04080aa16 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -209,8 +209,11 @@ function NodeObject(_name, _spr, _create, tags = []) constructor { var _node = NODE_CREATE_FUCTION[? _type](_x, _y); - if(_node) - _node.deserialize(_data, scale); + if(_node) { + _node.load_map = ds_map_create(); + ds_map_copy(_node.load_map, _data); + _node.deserialize(scale); + } return _node; } diff --git a/scripts/node_scale/node_scale.gml b/scripts/node_scale/node_scale.gml index 9332aadaf..b3f22c992 100644 --- a/scripts/node_scale/node_scale.gml +++ b/scripts/node_scale/node_scale.gml @@ -16,7 +16,7 @@ function Node_Scale(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var scale = _data[1]; var keep = _data[2]; diff --git a/scripts/node_scale_algo/node_scale_algo.gml b/scripts/node_scale_algo/node_scale_algo.gml index ce504d86c..6c8792e26 100644 --- a/scripts/node_scale_algo/node_scale_algo.gml +++ b/scripts/node_scale_algo/node_scale_algo.gml @@ -19,7 +19,7 @@ function Node_Scale_Algo(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var inSurf = _data[0]; var algo = _data[1]; var ww = surface_get_width(inSurf); diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 58d0f2ffc..62ed0f760 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -59,7 +59,7 @@ function Node_Scatter(_x, _y) : Node(_x, _y) constructor { inputs[| 5].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _inSurf = inputs[| 0].getValue(), surf; if(_inSurf == 0) return; diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index c41c0f502..274e5a2b3 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -39,7 +39,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor { _prev_type = -1; - function update() { + static update = function() { var _inSurf = inputs[| 0].getValue(); var _out_type = inputs[| 1].getValue(); var t = current_time; diff --git a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml index 5ecc6524a..7d37ab4dd 100644 --- a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml +++ b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml @@ -13,7 +13,7 @@ function Node_Sequence_Anim(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { var seq = inputs[| 0].getValue(); var spd = inputs[| 1].getValue(); diff --git a/scripts/node_shadow/node_shadow.gml b/scripts/node_shadow/node_shadow.gml index e84154f0f..c6f1a0f98 100644 --- a/scripts/node_shadow/node_shadow.gml +++ b/scripts/node_shadow/node_shadow.gml @@ -41,7 +41,7 @@ function Node_Shadow(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 3].drawOverlay(_active, _x + ww / 2, _y + hh / 2, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var cl = _data[1]; var _stre = _data[2]; var _shf = _data[3]; diff --git a/scripts/node_simple_shape/node_simple_shape.gml b/scripts/node_simple_shape/node_simple_shape.gml index 29516dfce..336ff604a 100644 --- a/scripts/node_simple_shape/node_simple_shape.gml +++ b/scripts/node_simple_shape/node_simple_shape.gml @@ -73,7 +73,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var _dim = _data[0]; var _bg = _data[1]; var _shape = _data[2]; diff --git a/scripts/node_solid/node_solid.gml b/scripts/node_solid/node_solid.gml index 8f860b112..86bd55039 100644 --- a/scripts/node_solid/node_solid.gml +++ b/scripts/node_solid/node_solid.gml @@ -14,7 +14,7 @@ function Node_Solid(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _col = inputs[| 1].getValue(); diff --git a/scripts/node_sprite_sheet/node_sprite_sheet.gml b/scripts/node_sprite_sheet/node_sprite_sheet.gml index 76422b94b..6c145a29f 100644 --- a/scripts/node_sprite_sheet/node_sprite_sheet.gml +++ b/scripts/node_sprite_sheet/node_sprite_sheet.gml @@ -43,7 +43,7 @@ function Node_Render_Sprite_Sheet(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function step() { + static step = function() { var inpt = inputs[| 0].getValue(); var oupt = outputs[| 0].getValue(); @@ -136,7 +136,7 @@ function Node_Render_Sprite_Sheet(_x, _y) : Node(_x, _y) constructor { if(drawn) anim_drawn[ANIMATOR.current_frame] = true; } - function update() { + static update = function() { for(var i = 0; i < array_length(anim_drawn); i++) anim_drawn[i] = false; var inpt = inputs[| 0].getValue(); diff --git a/scripts/node_sprite_stack/node_sprite_stack.gml b/scripts/node_sprite_stack/node_sprite_stack.gml index 0eb28e910..905dd9747 100644 --- a/scripts/node_sprite_stack/node_sprite_stack.gml +++ b/scripts/node_sprite_stack/node_sprite_stack.gml @@ -37,7 +37,7 @@ function Node_Sprite_Stack(_x, _y) : Node(_x, _y) constructor { inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my); } - function update() { + static update = function() { var _in = inputs[| 0].getValue(); var _dim = inputs[| 1].getValue(); var _amo = inputs[| 2].getValue(); diff --git a/scripts/node_stripe/node_stripe.gml b/scripts/node_stripe/node_stripe.gml index c6c91c589..05aed0fb3 100644 --- a/scripts/node_stripe/node_stripe.gml +++ b/scripts/node_stripe/node_stripe.gml @@ -37,7 +37,7 @@ function Node_Stripe(_x, _y) : Node(_x, _y) constructor { inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _amo = inputs[| 1].getValue(); var _ang = inputs[| 2].getValue(); diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index c5b24f0af..3bf3797f1 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -18,7 +18,7 @@ function Node_Surface_data(_x, _y) : Node(_x, _y) constructor { min_h = 0; w = 96; - function update() { + static update = function() { var _insurf = inputs[| 0].getValue(); if(is_array(_insurf)) { var len = array_length(_insurf); diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index d8936972d..b41b7ac07 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -72,7 +72,7 @@ function Node_Text(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var str = _data[0]; var _font = _data[1]; var _size = _data[2]; diff --git a/scripts/node_texture_remap/node_texture_remap.gml b/scripts/node_texture_remap/node_texture_remap.gml index 3f189e4fa..6d4c68536 100644 --- a/scripts/node_texture_remap/node_texture_remap.gml +++ b/scripts/node_texture_remap/node_texture_remap.gml @@ -14,7 +14,7 @@ function Node_Texture_Remap(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index 00a64fac2..56fd1de7f 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -18,7 +18,7 @@ function Node_Time_Remap(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function update() { + static update = function() { if(array_length(cached_output) != ANIMATOR.frames_total + 1) return; diff --git a/scripts/node_timeline_preview/node_timeline_preview.gml b/scripts/node_timeline_preview/node_timeline_preview.gml index 4221ad84a..8d12c060e 100644 --- a/scripts/node_timeline_preview/node_timeline_preview.gml +++ b/scripts/node_timeline_preview/node_timeline_preview.gml @@ -16,7 +16,7 @@ function Node_Timeline_Preview(_x, _y) : Node(_x, _y) constructor { inputs[| 0] = nodeValue(0, "Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - function update() { + static update = function() { var _inSurf = inputs[| 0].getValue(); if(_inSurf == 0) return; diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index da7754c4c..d9d62f4d6 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -25,7 +25,7 @@ function Node_Trail(_x, _y) : Node_Processor(_x, _y) constructor { temp_surf = [ surface_create(1, 1), surface_create(1, 1) ]; - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { if(!inputs[| 0].value_from) return _outSurf; if(array_length(cached_output) != ANIMATOR.frames_total + 1) diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 6841f80fd..b71f4b7d1 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -114,7 +114,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 2].setValue([ surface_get_width(_surf) / 2, surface_get_height(_surf) / 2 ]); } - function step() { + static step = function() { var pos = inputs[| 2].getValue(); if(ANIMATOR.is_playing && ANIMATOR.frame_progress) { @@ -131,7 +131,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var ins = _data[0]; var out_type = _data[9]; diff --git a/scripts/node_transform_single/node_transform_single.gml b/scripts/node_transform_single/node_transform_single.gml index 5eca8b4ab..115333c4c 100644 --- a/scripts/node_transform_single/node_transform_single.gml +++ b/scripts/node_transform_single/node_transform_single.gml @@ -19,7 +19,7 @@ function Node_Transform_Single(_x, _y) : Node_Processor(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var pos_x = _data[1]; var pos_y = _data[2]; var anc_x = _data[3]; diff --git a/scripts/node_twirl/node_twirl.gml b/scripts/node_twirl/node_twirl.gml index 11d81285a..2b186671e 100644 --- a/scripts/node_twirl/node_twirl.gml +++ b/scripts/node_twirl/node_twirl.gml @@ -32,7 +32,7 @@ function Node_Twirl(_x, _y) : Node_Processor(_x, _y) constructor { inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, s_anchor_scale_hori); } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); BLEND_ADD diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index d115ce4fc..81206c783 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -368,9 +368,25 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T resetDisplay(); static getValue = function() { - var val = getValueRecursive(tag); + var _val = getValueRecursive(); + var val = _val[0]; + var typ = _val[1]; + var _base = value.getValue(); + if((tag & VALUE_TAG.dimension_2d) && typ == VALUE_TYPE.surface) { + if(is_array(val)) { + if(array_length(val) > 0 && is_surface(val[0])) { + var _v = array_create(array_length(val)); + for( var i = 0; i < array_length(val); i++ ) + _v[i] = [ surface_get_width(val[i]), surface_get_height(val[i]) ]; + return _v; + } + } else if (is_surface(val)) { + return [ surface_get_width(val), surface_get_height(val) ]; + } + } + if(is_array(_base)) { if(!is_array(val)) return array_create(array_length(_base), val); @@ -384,26 +400,13 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T return val; } - static getValueRecursive = function(_tag) { - var val = -1; + static getValueRecursive = function() { + var val = [ -1, VALUE_TYPE.any ]; if(value_from == noone) - val = value.getValue(); + val = [value.getValue(), type]; else if(value_from != self) { - val = value_from.getValueRecursive(_tag); - - if((_tag & VALUE_TAG.dimension_2d) && value_from.type == VALUE_TYPE.surface) { - if(is_array(val)) { - if(array_length(val) > 0 && is_surface(val[0])) { - var _v = array_create(array_length(val)); - for( var i = 0; i < array_length(val); i++ ) - _v[i] = [ surface_get_width(val[i]), surface_get_height(val[i]) ]; - return _v; - } - } else if (is_surface(val)) { - return [ surface_get_width(val), surface_get_height(val) ]; - } - } + val = value_from.getValueRecursive(); } return val; @@ -971,14 +974,15 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T if(con_index < _ol) { if(setFrom(_nd.outputs[| con_index], false)) return true; - else { + else log_warning("LOAD", "[Connect] Connection conflict " + string(node.name) + " to " + string(_nd.name) + " : Connection failed."); - return true; - } + return false; } else { log_warning("LOAD", "[Connect] Connection conflict " + string(node.name) + " to " + string(_nd.name) + " : Node not exist."); return false; } + } else { + log_warning("LOAD", "[Connect] Connection error, node does not exist."); } var txt = "Node connect error : Node ID " + string(con_node + APPEND_ID) + " not found."; diff --git a/scripts/node_value_processor/node_value_processor.gml b/scripts/node_value_processor/node_value_processor.gml index ff173be34..aa0625507 100644 --- a/scripts/node_value_processor/node_value_processor.gml +++ b/scripts/node_value_processor/node_value_processor.gml @@ -64,7 +64,7 @@ function Node_Value_Processor(_x, _y) : Node(_x, _y) constructor { } } - function update() { + static update = function() { for(var i = 0; i < ds_list_size(outputs); i++) { var _output = preProcess(i); diff --git a/scripts/node_wrap/node_wrap.gml b/scripts/node_wrap/node_wrap.gml index 899f5c8b0..fc6921f81 100644 --- a/scripts/node_wrap/node_wrap.gml +++ b/scripts/node_wrap/node_wrap.gml @@ -168,7 +168,7 @@ function Node_Warp(_x, _y) : Node_Processor(_x, _y) constructor { } } - function process_data(_outSurf, _data, _output_index) { + static process_data = function(_outSurf, _data, _output_index) { var ww = surface_get_width(_data[0]); var hh = surface_get_height(_data[0]); var tl = _data[1]; diff --git a/scripts/node_wrap_mesh/node_wrap_mesh.gml b/scripts/node_wrap_mesh/node_wrap_mesh.gml index ed948d3bc..597fb3504 100644 --- a/scripts/node_wrap_mesh/node_wrap_mesh.gml +++ b/scripts/node_wrap_mesh/node_wrap_mesh.gml @@ -304,8 +304,8 @@ function Node_Mesh_Warp(_x, _y) : Node(_x, _y) constructor { surface_reset_target(); } - static doDeserialize = function(_map) { - var _inputs = _map[? "inputs"]; + static postDeserialize = function() { + var _inputs = load_map[? "inputs"]; for(var i = control_index; i < ds_list_size(_inputs); i++) { createControl(); diff --git a/scripts/node_zigzag/node_zigzag.gml b/scripts/node_zigzag/node_zigzag.gml index 30c0b979e..33a2bdc2b 100644 --- a/scripts/node_zigzag/node_zigzag.gml +++ b/scripts/node_zigzag/node_zigzag.gml @@ -25,7 +25,7 @@ function Node_Zigzag(_x, _y) : Node(_x, _y) constructor { inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); } - function update() { + static update = function() { var _dim = inputs[| 0].getValue(); var _amo = inputs[| 1].getValue(); var _pos = inputs[| 2].getValue(); diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index b23c4e45b..f4c0f6644 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -197,7 +197,7 @@ function Panel_Collection(_panel) : PanelContent(_panel) constructor { return hh; }); - function onResize(dw, dh) { + function onResize() { content_w = w - 24 - group_w; content_h = h - 32 - 16; contentPane.resize(content_w, content_h); diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index 5d2febe7d..2fa9d10f4 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -121,7 +121,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { if(content) { content.w = w; content.h = h; - content.onResize(dw, dh); + content.onResize(); } } @@ -149,7 +149,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { w = _w; if(content) { content.w = w; - content.onResize(w - prev_w, 0); + content.onResize(); } if(parent == noone) PANEL_MAIN = _panelParent; @@ -178,7 +178,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { h = _h; if(content) { content.h = h; - content.onResize(0, h - prev_h); + content.onResize(); } if(parent == noone) PANEL_MAIN = _panelParent; @@ -285,7 +285,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { } } - function step() { + static step = function() { for(var i = 0; i < ds_list_size(childs); i++) { var _panel = childs[| i]; _panel.step(); @@ -395,10 +395,10 @@ function PanelContent(_panel) constructor { min_h = 32; function refresh() { - onResize(0, 0); + onResize(); } - function onResize(dw, dh) {} + function onResize() {} function onStepBegin() { mx = mouse_mx - x; diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 125829e8b..c7f2ee96e 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -365,7 +365,7 @@ function Panel_Inspector(_panel) : PanelContent(_panel) constructor { prop_selecting.setString(clipboard_get_text()); } - function onResize(dw, dh) { + function onResize() { content_w = w - 32; content_h = h - top_bar_h - 24; contentPane.resize(content_w, content_h); diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 2f34f1a8c..16a43ec61 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -52,13 +52,15 @@ function renderAll() { } if(instanceof(rendering) == "Node_Group_Output") { - var _ot = rendering._outParent; - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; + var _ot = rendering.outParent; + if(_ot != undefined) { + for(var j = 0; j < ds_list_size(_ot.value_to); j++) { + var _to = _ot.value_to[| j]; - if(_to.node.active && _to.value_from != noone && _to.value_from.node == rendering.group) { - _to.node.rendered = false; - ds_queue_enqueue(render_q, _to.node); + if(_to.node.active && _to.value_from != noone && _to.value_from.node == rendering.group) { + _to.node.rendered = false; + ds_queue_enqueue(render_q, _to.node); + } } } } else { diff --git a/scripts/save_load/save_load.gml b/scripts/save_load/save_load.gml index 1a7a1c442..85d448930 100644 --- a/scripts/save_load/save_load.gml +++ b/scripts/save_load/save_load.gml @@ -44,36 +44,6 @@ function save_serialize() { return val; } -function load_deserialize(_map) { - if(ds_map_exists(_map, "version")) { - var _v = _map[? "version"]; - if(_v != SAVEFILE_VERSION) { - var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); - log_warning("FILE", warn) - PANEL_MENU.addNotiExtra(warn); - } - } else { - var warn = "File version mismatch : loading old format to Pixel Composer " + string(SAVEFILE_VERSION); - log_warning("FILE", warn) - PANEL_MENU.addNotiExtra(warn); - } - - clearNodes(); - - if(ds_map_exists(_map, "nodes")) { - var _node_list = _map[? "nodes"]; - for(var i = 0; i < ds_list_size(_node_list); i++) { - nodeLoad(_node_list[| i]); - } - } - - if(ds_map_exists(_map, "animator")) { - var _anim_map = _map[? "animator"]; - ANIMATOR.frames_total = _anim_map[? "frames_total"]; - ANIMATOR.framerate = _anim_map[? "framerate"]; - } -} - function SET_PATH(path) { if(READONLY) window_set_caption("[READ ONLY] " + filename_name(path) + " - Pixel Composer"); @@ -165,29 +135,61 @@ function LOAD_PATH(path, readonly = false) { file_text_close(file); var _map = json_decode(load_str); - load_deserialize(_map); + if(ds_map_exists(_map, "version")) { + var _v = _map[? "version"]; + if(_v != SAVEFILE_VERSION) { + var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); + log_warning("FILE", warn) + PANEL_MENU.addNotiExtra(warn); + } + } else { + var warn = "File version mismatch : loading old format to Pixel Composer " + string(SAVEFILE_VERSION); + log_warning("FILE", warn) + PANEL_MENU.addNotiExtra(warn); + } + + clearNodes(); + + var create_list = ds_list_create(); + if(ds_map_exists(_map, "nodes")) { + var _node_list = _map[? "nodes"]; + for(var i = 0; i < ds_list_size(_node_list); i++) { + var _node = nodeLoad(_node_list[| i]); + if(_node) ds_list_add(create_list, _node); + } + } + + if(ds_map_exists(_map, "animator")) { + var _anim_map = _map[? "animator"]; + ANIMATOR.frames_total = _anim_map[? "frames_total"]; + ANIMATOR.framerate = _anim_map[? "framerate"]; + } ds_map_destroy(_map); ds_queue_clear(CONNECTION_CONFLICT); - var _key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var _node = NODE_MAP[? _key]; - if(_node.is_dynamic_output) { - _node.connect(); - _node.doUpdate(); - } - - _key = ds_map_find_next(NODE_MAP, _key); + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].loadGroup(); } - var _key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var _node = NODE_MAP[? _key]; - _node.connect(); - _node.rendered = false; - - _key = ds_map_find_next(NODE_MAP, _key); + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].postDeserialize(); + } + + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].preConnect(); + } + + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].connect(); + } + + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].postConnect(); + } + + for(var i = 0; i < ds_list_size(create_list); i++) { + create_list[| i].doUpdate(); } renderAll(); @@ -218,83 +220,6 @@ function LOAD_PATH(path, readonly = false) { return true; } -function APPEND(_path) { - APPEND_ID = NODE_ID + 1; - APPENDING = true; - - if(_path == "") return; - - var file = file_text_open_read(_path); - var load_str = ""; - while(!file_text_eof(file)) { - load_str += file_text_readln(file); - } - var _map = json_decode(load_str); - - if(ds_map_exists(_map, "version")) { - var _v = _map[? "version"]; - if(_v != SAVEFILE_VERSION) { - var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); - log_warning("FILE", warn) - PANEL_MENU.addNotiExtra(warn); - } - } else { - var warn = "File version mismatch : loading old format to Pixel Composer " + string(SAVEFILE_VERSION); - log_warning("FILE", warn) - PANEL_MENU.addNotiExtra(warn); - } - - var _node_list = _map[? "nodes"]; - var appended_list = ds_list_create(); - var node_create = ds_list_create(); - - for(var i = 0; i < ds_list_size(_node_list); i++) { - var _node = nodeLoad(_node_list[| i], true); - if(_node) - ds_list_add(appended_list, _node); - } - ds_map_destroy(_map); - file_text_close(file); - - for(var i = 0; i < ds_list_size(appended_list); i++) { - var _node = appended_list[| i]; - _node.connect(); - - if(_node.group == PANEL_GRAPH.getCurrentContext()) - ds_list_add(node_create, _node); - } - - for(var i = 0; i < ds_list_size(appended_list); i++) { - appended_list[| i].doUpdate(); - } - - ds_list_destroy(appended_list); - - renderAll(); - - if(!ds_queue_empty(CONNECTION_CONFLICT)) { - var pass = 0; - - while(++pass < 2 && !ds_queue_empty(CONNECTION_CONFLICT)) { - var size = ds_queue_size(CONNECTION_CONFLICT); - log_message("LOAD", "[Connect] " + string(size) + " Connection conflict(s) detected ( pass: " + string(pass) + " )"); - repeat(size) { - ds_queue_dequeue(CONNECTION_CONFLICT).connect(); - } - renderAll(); - } - - if(!ds_queue_empty(CONNECTION_CONFLICT)) - PANEL_MENU.addNotiExtra("Some connection(s) is unsolved. This may caused by render node not being update properly, or image path is broken."); - } - - APPENDING = false; - PANEL_ANIMATION.updatePropertyList(); - - log_message("FILE", "append file " + _path); - return node_create; -} - function SAVE_COLLECTIONS(_list, _path, save_surface = true) { var file = file_text_open_write(_path); var _map = ds_map_create(); diff --git a/scripts/save_load/save_load.yy b/scripts/save_load/save_load.yy index 60e9c5831..47d816875 100644 --- a/scripts/save_load/save_load.yy +++ b/scripts/save_load/save_load.yy @@ -2,8 +2,8 @@ "isDnD": false, "isCompatibility": false, "parent": { - "name": "scritps", - "path": "folders/main/scritps.yy", + "name": "save load", + "path": "folders/functions/save load.yy", }, "resourceVersion": "1.0", "name": "save_load", diff --git a/scripts/surface_modify/surface_modify.gml b/scripts/surface_modify/surface_modify.gml index 7b93fce7a..1ed5cd692 100644 --- a/scripts/surface_modify/surface_modify.gml +++ b/scripts/surface_modify/surface_modify.gml @@ -49,6 +49,7 @@ function surface_valid(s) { } function is_surface(s) { + if(is_array(s)) return false; if(!s) return false; if(!surface_exists(s)) return false; diff --git a/shaders/sh_colorize/sh_colorize.fsh b/shaders/sh_colorize/sh_colorize.fsh index 46267661b..ffe608f50 100644 --- a/shaders/sh_colorize/sh_colorize.fsh +++ b/shaders/sh_colorize/sh_colorize.fsh @@ -8,10 +8,11 @@ uniform int gradient_blend; uniform vec4 gradient_color[16]; uniform float gradient_time[16]; uniform int keys; +uniform float gradient_shift; void main() { vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); - float prog = (_col.r + _col.g + _col.b) / 3.; + float prog = fract(dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722)) + gradient_shift); vec4 col = vec4(0.); for(int i = 0; i < 16; i++) { diff --git a/shaders/sh_gradient/sh_gradient.fsh b/shaders/sh_gradient/sh_gradient.fsh index 1c69a45ac..a534fa8d0 100644 --- a/shaders/sh_gradient/sh_gradient.fsh +++ b/shaders/sh_gradient/sh_gradient.fsh @@ -10,6 +10,7 @@ uniform int gradient_blend; uniform vec4 gradient_color[16]; uniform float gradient_time[16]; uniform int gradient_keys; +uniform int gradient_loop; uniform vec2 center; uniform float angle; @@ -56,6 +57,8 @@ void main() { prog = (_a - floor(_a / TAU) * TAU) / TAU; } prog += shift; + if(gradient_loop == 1) + prog = fract(prog); vec4 col = gradientEval(prog);