diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index a6d6b072c..fc15588f9 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -139,6 +139,7 @@ {"name":"sprites","order":12,"path":"folders/sprites.yy",}, {"name":"gameframe","order":2,"path":"folders/sprites/gameframe.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, + {"name":"surface replace","order":53,"path":"folders/shader/surface replace.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":14,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -165,6 +166,7 @@ {"name":"s_node_grid_tri_noise","order":22,"path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",}, {"name":"o_dialog_menubox","order":1,"path":"objects/o_dialog_menubox/o_dialog_menubox.yy",}, {"name":"s_node_blend","order":5,"path":"sprites/s_node_blend/s_node_blend.yy",}, + {"name":"node_wrap_perspective","order":15,"path":"scripts/node_wrap_perspective/node_wrap_perspective.yy",}, {"name":"s_node_rigidSim_object_spawner","order":5,"path":"sprites/s_node_rigidSim_object_spawner/s_node_rigidSim_object_spawner.yy",}, {"name":"draw_text_function","order":11,"path":"scripts/draw_text_function/draw_text_function.yy",}, {"name":"o_dialog_file_name_collection","order":5,"path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",}, @@ -400,6 +402,7 @@ {"name":"node_fluid_render","order":2,"path":"scripts/node_fluid_render/node_fluid_render.yy",}, {"name":"s_node_invert","order":25,"path":"sprites/s_node_invert/s_node_invert.yy",}, {"name":"draw_text_delimiter","order":14,"path":"scripts/draw_text_delimiter/draw_text_delimiter.yy",}, + {"name":"s_node_path_anchor","order":13,"path":"sprites/s_node_path_anchor/s_node_path_anchor.yy",}, {"name":"node_array_get","order":10,"path":"scripts/node_array_get/node_array_get.yy",}, {"name":"Apollo","order":6,"path":"extensions/Apollo/Apollo.yy",}, {"name":"sh_grid","order":14,"path":"shaders/sh_grid/sh_grid.yy",}, @@ -445,8 +448,10 @@ {"name":"s_node_random","order":3,"path":"sprites/s_node_random/s_node_random.yy",}, {"name":"s_node_color_remove","order":7,"path":"sprites/s_node_color_remove/s_node_color_remove.yy",}, {"name":"sh_average","order":7,"path":"shaders/sh_average/sh_average.yy",}, + {"name":"sh_warp_4points_pers","order":10,"path":"shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy",}, {"name":"node_mirror","order":3,"path":"scripts/node_mirror/node_mirror.yy",}, {"name":"node_corner","order":6,"path":"scripts/node_corner/node_corner.yy",}, + {"name":"node_path_anchor","order":13,"path":"scripts/node_path_anchor/node_path_anchor.yy",}, {"name":"s_node_path_wave","order":7,"path":"sprites/s_node_path_wave/s_node_path_wave.yy",}, {"name":"string_function","order":6,"path":"scripts/string_function/string_function.yy",}, {"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",}, @@ -560,6 +565,7 @@ {"name":"node_perlin","order":1,"path":"scripts/node_perlin/node_perlin.yy",}, {"name":"node_blur_simple","order":4,"path":"scripts/node_blur_simple/node_blur_simple.yy",}, {"name":"node_feedback_input","order":1,"path":"scripts/node_feedback_input/node_feedback_input.yy",}, + {"name":"s_node_base_conversion","order":10,"path":"sprites/s_node_base_conversion/s_node_base_conversion.yy",}, {"name":"s_node_loop_array","order":23,"path":"sprites/s_node_loop_array/s_node_loop_array.yy",}, {"name":"s_node_iterator_amount","order":26,"path":"sprites/s_node_iterator_amount/s_node_iterator_amount.yy",}, {"name":"sh_color_adjust","order":6,"path":"shaders/sh_color_adjust/sh_color_adjust.yy",}, @@ -580,6 +586,7 @@ {"name":"sh_channel_R_grey","order":7,"path":"shaders/sh_channel_R_grey/sh_channel_R_grey.yy",}, {"name":"sh_blend_subtract","order":5,"path":"shaders/sh_blend_subtract/sh_blend_subtract.yy",}, {"name":"panel_animation","order":1,"path":"scripts/panel_animation/panel_animation.yy",}, + {"name":"node_surface_replace","order":29,"path":"scripts/node_surface_replace/node_surface_replace.yy",}, {"name":"node_strand_create","order":1,"path":"scripts/node_strand_create/node_strand_create.yy",}, {"name":"sh_gradient","order":17,"path":"shaders/sh_gradient/sh_gradient.yy",}, {"name":"node_json_file_read","order":8,"path":"scripts/node_json_file_read/node_json_file_read.yy",}, @@ -652,6 +659,7 @@ {"name":"node_trigger_bool","order":1,"path":"scripts/node_trigger_bool/node_trigger_bool.yy",}, {"name":"s_node_strandSim_gravity","order":4,"path":"sprites/s_node_strandSim_gravity/s_node_strandSim_gravity.yy",}, {"name":"node_VFX_effect_turbulence","order":11,"path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",}, + {"name":"sh_surface_replace_replace","order":1,"path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",}, {"name":"node_ase_file_read","order":14,"path":"scripts/node_ase_file_read/node_ase_file_read.yy",}, {"name":"sh_seperate_shape_counter","order":1,"path":"shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.yy",}, {"name":"s_node_stack","order":35,"path":"sprites/s_node_stack/s_node_stack.yy",}, @@ -751,6 +759,7 @@ {"name":"area_function","order":2,"path":"scripts/area_function/area_function.yy",}, {"name":"node_mesh_to_path","order":3,"path":"scripts/node_mesh_to_path/node_mesh_to_path.yy",}, {"name":"sh_convolution","order":44,"path":"shaders/sh_convolution/sh_convolution.yy",}, + {"name":"number_function","order":14,"path":"scripts/number_function/number_function.yy",}, {"name":"s_node_array_shift","order":12,"path":"sprites/s_node_array_shift/s_node_array_shift.yy",}, {"name":"s_node_statistic","order":5,"path":"sprites/s_node_statistic/s_node_statistic.yy",}, {"name":"s_node_cache_array","order":25,"path":"sprites/s_node_cache_array/s_node_cache_array.yy",}, @@ -950,6 +959,7 @@ {"name":"node_csv_file_read","order":9,"path":"scripts/node_csv_file_read/node_csv_file_read.yy",}, {"name":"scrollPane","order":14,"path":"scripts/scrollPane/scrollPane.yy",}, {"name":"node_gradient_extract","order":13,"path":"scripts/node_gradient_extract/node_gradient_extract.yy",}, + {"name":"node_base_convert","order":25,"path":"scripts/node_base_convert/node_base_convert.yy",}, {"name":"s_node_normal_light","order":29,"path":"sprites/s_node_normal_light/s_node_normal_light.yy",}, {"name":"node_transform_single","order":1,"path":"scripts/node_transform_single/node_transform_single.yy",}, {"name":"node_string_length","order":22,"path":"scripts/node_string_length/node_string_length.yy",}, @@ -1025,6 +1035,7 @@ {"name":"s_node_bokeh","order":49,"path":"sprites/s_node_bokeh/s_node_bokeh.yy",}, {"name":"sh_vertex_depth_pass","order":6,"path":"shaders/sh_vertex_depth_pass/sh_vertex_depth_pass.yy",}, {"name":"sh_curve","order":3,"path":"shaders/sh_curve/sh_curve.yy",}, + {"name":"sh_warp_4points","order":9,"path":"shaders/sh_warp_4points/sh_warp_4points.yy",}, {"name":"_f_p2","order":4,"path":"fonts/_f_p2/_f_p2.yy",}, {"name":"fd_rectangle_get_pressure_iteration_type","order":17,"path":"scripts/fd_rectangle_get_pressure_iteration_type/fd_rectangle_get_pressure_iteration_type.yy",}, {"name":"node_text_file_write","order":11,"path":"scripts/node_text_file_write/node_text_file_write.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 0874e1b42..88acfb1d9 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -171,6 +171,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface replace","folderPath":"folders/shader/surface replace.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","CopyToMask":-1,"filePath":"datafiles",}, @@ -570,6 +571,7 @@ {"id":{"name":"s_node_grid_tri_noise","path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",},}, {"id":{"name":"o_dialog_menubox","path":"objects/o_dialog_menubox/o_dialog_menubox.yy",},}, {"id":{"name":"s_node_blend","path":"sprites/s_node_blend/s_node_blend.yy",},}, + {"id":{"name":"node_wrap_perspective","path":"scripts/node_wrap_perspective/node_wrap_perspective.yy",},}, {"id":{"name":"s_node_rigidSim_object_spawner","path":"sprites/s_node_rigidSim_object_spawner/s_node_rigidSim_object_spawner.yy",},}, {"id":{"name":"draw_text_function","path":"scripts/draw_text_function/draw_text_function.yy",},}, {"id":{"name":"o_dialog_file_name_collection","path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",},}, @@ -842,6 +844,7 @@ {"id":{"name":"node_fluid_render","path":"scripts/node_fluid_render/node_fluid_render.yy",},}, {"id":{"name":"s_node_invert","path":"sprites/s_node_invert/s_node_invert.yy",},}, {"id":{"name":"draw_text_delimiter","path":"scripts/draw_text_delimiter/draw_text_delimiter.yy",},}, + {"id":{"name":"s_node_path_anchor","path":"sprites/s_node_path_anchor/s_node_path_anchor.yy",},}, {"id":{"name":"node_array_get","path":"scripts/node_array_get/node_array_get.yy",},}, {"id":{"name":"Apollo","path":"extensions/Apollo/Apollo.yy",},}, {"id":{"name":"node_lua_compute","path":"scripts/node_lua_compute/node_lua_compute.yy",},}, @@ -861,6 +864,7 @@ {"id":{"name":"sh_blur_radial","path":"shaders/sh_blur_radial/sh_blur_radial.yy",},}, {"id":{"name":"node_blur","path":"scripts/node_blur/node_blur.yy",},}, {"id":{"name":"node_iterator_each_input","path":"scripts/node_iterator_each_input/node_iterator_each_input.yy",},}, + {"id":{"name":"sh_surface_replace_find","path":"shaders/sh_surface_replace_find/sh_surface_replace_find.yy",},}, {"id":{"name":"json_minify","path":"scripts/json_minify/json_minify.yy",},}, {"id":{"name":"sh_fd_vortex","path":"shaders/sh_fd_vortex/sh_fd_vortex.yy",},}, {"id":{"name":"s_node_loop","path":"sprites/s_node_loop/s_node_loop.yy",},}, @@ -892,9 +896,11 @@ {"id":{"name":"s_node_random","path":"sprites/s_node_random/s_node_random.yy",},}, {"id":{"name":"s_node_color_remove","path":"sprites/s_node_color_remove/s_node_color_remove.yy",},}, {"id":{"name":"sh_average","path":"shaders/sh_average/sh_average.yy",},}, + {"id":{"name":"sh_warp_4points_pers","path":"shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy",},}, {"id":{"name":"node_mirror","path":"scripts/node_mirror/node_mirror.yy",},}, {"id":{"name":"node_corner","path":"scripts/node_corner/node_corner.yy",},}, {"id":{"name":"vertex_function","path":"scripts/vertex_function/vertex_function.yy",},}, + {"id":{"name":"node_path_anchor","path":"scripts/node_path_anchor/node_path_anchor.yy",},}, {"id":{"name":"s_node_path_wave","path":"sprites/s_node_path_wave/s_node_path_wave.yy",},}, {"id":{"name":"string_function","path":"scripts/string_function/string_function.yy",},}, {"id":{"name":"o_dialog_palette","path":"objects/o_dialog_palette/o_dialog_palette.yy",},}, @@ -1028,6 +1034,7 @@ {"id":{"name":"node_feedback_input","path":"scripts/node_feedback_input/node_feedback_input.yy",},}, {"id":{"name":"o_dialog_add_multiple_images","path":"objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy",},}, {"id":{"name":"assets_data","path":"scripts/assets_data/assets_data.yy",},}, + {"id":{"name":"s_node_base_conversion","path":"sprites/s_node_base_conversion/s_node_base_conversion.yy",},}, {"id":{"name":"s_node_loop_array","path":"sprites/s_node_loop_array/s_node_loop_array.yy",},}, {"id":{"name":"s_node_iterator_amount","path":"sprites/s_node_iterator_amount/s_node_iterator_amount.yy",},}, {"id":{"name":"sh_color_adjust","path":"shaders/sh_color_adjust/sh_color_adjust.yy",},}, @@ -1049,6 +1056,7 @@ {"id":{"name":"sh_blend_subtract","path":"shaders/sh_blend_subtract/sh_blend_subtract.yy",},}, {"id":{"name":"o_dialog_file_name","path":"objects/o_dialog_file_name/o_dialog_file_name.yy",},}, {"id":{"name":"panel_animation","path":"scripts/panel_animation/panel_animation.yy",},}, + {"id":{"name":"node_surface_replace","path":"scripts/node_surface_replace/node_surface_replace.yy",},}, {"id":{"name":"node_strand_create","path":"scripts/node_strand_create/node_strand_create.yy",},}, {"id":{"name":"sh_gradient","path":"shaders/sh_gradient/sh_gradient.yy",},}, {"id":{"name":"node_json_file_read","path":"scripts/node_json_file_read/node_json_file_read.yy",},}, @@ -1129,6 +1137,7 @@ {"id":{"name":"node_trigger_bool","path":"scripts/node_trigger_bool/node_trigger_bool.yy",},}, {"id":{"name":"s_node_strandSim_gravity","path":"sprites/s_node_strandSim_gravity/s_node_strandSim_gravity.yy",},}, {"id":{"name":"node_VFX_effect_turbulence","path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",},}, + {"id":{"name":"sh_surface_replace_replace","path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},}, {"id":{"name":"node_ase_file_read","path":"scripts/node_ase_file_read/node_ase_file_read.yy",},}, {"id":{"name":"s_workshop_frame","path":"sprites/s_workshop_frame/s_workshop_frame.yy",},}, {"id":{"name":"sh_seperate_shape_counter","path":"shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.yy",},}, @@ -1236,6 +1245,7 @@ {"id":{"name":"node_mesh_to_path","path":"scripts/node_mesh_to_path/node_mesh_to_path.yy",},}, {"id":{"name":"node_fluid_sim","path":"scripts/node_fluid_sim/node_fluid_sim.yy",},}, {"id":{"name":"sh_convolution","path":"shaders/sh_convolution/sh_convolution.yy",},}, + {"id":{"name":"number_function","path":"scripts/number_function/number_function.yy",},}, {"id":{"name":"s_node_array_shift","path":"sprites/s_node_array_shift/s_node_array_shift.yy",},}, {"id":{"name":"s_node_statistic","path":"sprites/s_node_statistic/s_node_statistic.yy",},}, {"id":{"name":"s_node_cache_array","path":"sprites/s_node_cache_array/s_node_cache_array.yy",},}, @@ -1469,6 +1479,7 @@ {"id":{"name":"node_csv_file_read","path":"scripts/node_csv_file_read/node_csv_file_read.yy",},}, {"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},}, {"id":{"name":"node_gradient_extract","path":"scripts/node_gradient_extract/node_gradient_extract.yy",},}, + {"id":{"name":"node_base_convert","path":"scripts/node_base_convert/node_base_convert.yy",},}, {"id":{"name":"s_node_normal_light","path":"sprites/s_node_normal_light/s_node_normal_light.yy",},}, {"id":{"name":"node_transform_single","path":"scripts/node_transform_single/node_transform_single.yy",},}, {"id":{"name":"node_string_length","path":"scripts/node_string_length/node_string_length.yy",},}, @@ -1555,6 +1566,7 @@ {"id":{"name":"s_node_bokeh","path":"sprites/s_node_bokeh/s_node_bokeh.yy",},}, {"id":{"name":"sh_vertex_depth_pass","path":"shaders/sh_vertex_depth_pass/sh_vertex_depth_pass.yy",},}, {"id":{"name":"sh_curve","path":"shaders/sh_curve/sh_curve.yy",},}, + {"id":{"name":"sh_warp_4points","path":"shaders/sh_warp_4points/sh_warp_4points.yy",},}, {"id":{"name":"_f_p2","path":"fonts/_f_p2/_f_p2.yy",},}, {"id":{"name":"fd_rectangle_get_pressure_iteration_type","path":"scripts/fd_rectangle_get_pressure_iteration_type/fd_rectangle_get_pressure_iteration_type.yy",},}, {"id":{"name":"node_text_file_write","path":"scripts/node_text_file_write/node_text_file_write.yy",},}, diff --git a/objects/o_dialog_image_array_edit/Create_0.gml b/objects/o_dialog_image_array_edit/Create_0.gml index 0cbb0fd0f..bb7d0e186 100644 --- a/objects/o_dialog_image_array_edit/Create_0.gml +++ b/objects/o_dialog_image_array_edit/Create_0.gml @@ -6,7 +6,8 @@ event_inherited(); dialog_w = ui(648); dialog_h = ui(640); - dialog_resizable = true; + draggable = false; + dialog_resizable = false; dialog_w_min = ui(400); dialog_h_min = ui(400); dialog_w_max = WIN_W; @@ -71,7 +72,10 @@ event_inherited(); } } - var spr = target.spr[index]; + var spr = array_safe_get(target.spr, index, noone); + if(spr == noone || !sprite_exists(spr)) + spr = s_texture_default; + var spr_w = sprite_get_width(spr); var spr_h = sprite_get_height(spr); var spr_s = min((ww - ui(16)) / spr_w, (hh - ui(16)) / spr_h); diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index d3d8e293f..ba4ac4f04 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -19,7 +19,8 @@ gameframe_caption_height_normal = ui(40); gameframe_caption_height_maximized = ui(40); - gameframe_button_array = [ game_frame_button_create("", s_kenney, 0, function() {}), + gameframe_button_array = [ + game_frame_button_create("", s_kenney, 0, function() {}), game_frame_button_create("", s_kenney, 0, function() {}), ]; } else if(OS == os_macosx) diff --git a/scripts/Script610/Script610.gml b/scripts/Script610/Script610.gml deleted file mode 100644 index 1652b2d9c..000000000 --- a/scripts/Script610/Script610.gml +++ /dev/null @@ -1,3 +0,0 @@ -function Script610(){ - -} \ No newline at end of file diff --git a/scripts/__bbox/__bbox.gml b/scripts/__bbox/__bbox.gml index a5bbb692c..7f1fdd811 100644 --- a/scripts/__bbox/__bbox.gml +++ b/scripts/__bbox/__bbox.gml @@ -28,4 +28,18 @@ function BoundingBox(minx = noone, miny = noone, maxx = noone, maxy = noone) con } static clone = function() { return new BoundingBox(minx, miny, maxx, maxy); } +} + +function node_bbox(x0, y0, x1, y1) constructor { + self.x0 = x0; + self.x1 = x1; + self.y0 = y0; + self.y1 = y1; + + xc = (x0 + x1) / 2; + yc = (y0 + y1) / 2; + w = x1 - x0; + h = y1 - y0; + + static clone = function() { return node_bbox(x0, y0, x1, y1); }; } \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 873528e0e..ba4674f64 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -33,7 +33,7 @@ globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING; VERSION = 1140; SAVEFILE_VERSION = 1400; - VERSION_STRING = "1.14.0pr6"; + VERSION_STRING = "1.14.0pr7"; globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES; diff --git a/scripts/node_area611/node_area611.gml b/scripts/node_area611/node_area611.gml deleted file mode 100644 index 661bca37e..000000000 --- a/scripts/node_area611/node_area611.gml +++ /dev/null @@ -1,3 +0,0 @@ -function node_area611(){ - -} \ No newline at end of file diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index 1cb0802c9..ed7deb288 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -26,7 +26,6 @@ function Node_create_ASE_File_Read_path(_x, _y, path) { function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "ASE File In"; update_on_frame = true; - always_output = true; w = 128; diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index c87138018..d86787e8d 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -1,7 +1,6 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "ASE Layer"; update_on_frame = true; - always_output = true; previewable = false; inputs[| 0] = nodeValue("ASE data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) diff --git a/scripts/node_base_convert/node_base_convert.gml b/scripts/node_base_convert/node_base_convert.gml new file mode 100644 index 000000000..c679f1a6e --- /dev/null +++ b/scripts/node_base_convert/node_base_convert.gml @@ -0,0 +1,38 @@ +function Node_Base_Convert(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Convert Base"; + color = COLORS.node_blend_number; + previewable = false; + + w = 96; + + inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + .setVisible(true, true); + + inputs[| 1] = nodeValue("Base from", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 10); + + inputs[| 2] = nodeValue("Base to", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 10); + + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + + function process_data(_output, _data, _output_index, _array_index = 0) { + var val = _data[0]; + var bFrom = max(2, _data[1]); + var bTo = max(2, _data[2]); + + return convertBase(val, bFrom, bTo); + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); + var baseFrom = current_data[1]; + var baseTo = current_data[2]; + + var bbox = drawGetBbox(xx, yy, _s); + var b1 = new node_bbox(bbox.x0, bbox.y0, bbox.xc - _s * 8, bbox.y1); + var b2 = new node_bbox(bbox.xc + _s * 8, bbox.y0, bbox.x1, bbox.y1); + + draw_sprite_ext(THEME.arrow, 0, bbox.xc, bbox.yc + 1 * _s, .5 * _s, .5 * _s, 0, COLORS._main_icon, 1); + draw_text_bbox(b1, baseFrom); + draw_text_bbox(b2, baseTo); + } +} \ No newline at end of file diff --git a/scripts/node_base_convert/node_base_convert.yy b/scripts/node_base_convert/node_base_convert.yy new file mode 100644 index 000000000..56ec3b101 --- /dev/null +++ b/scripts/node_base_convert/node_base_convert.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_base_convert", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "number", + "path": "folders/nodes/data/value/number.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_bevel/node_bevel.gml b/scripts/node_bevel/node_bevel.gml index f62be20f7..99c617d46 100644 --- a/scripts/node_bevel/node_bevel.gml +++ b/scripts/node_bevel/node_bevel.gml @@ -44,6 +44,8 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con attribute_oversample(); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + PROCESSOR_OVERLAY_CHECK + var _surf = current_data[0]; if(!is_surface(_surf)) return; diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index c93390122..d252d2914 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -142,13 +142,14 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(!_in.renderActive) continue; array_push(nodes, _in); - printIf(global.RENDER_LOG, "Push group input " + _in.name + " to stack"); + printIf(global.RENDER_LOG, " >> Check complete, push " + _in.name + " to stack."); } return nodes; } static setRenderStatus = function(result) { + printIf(global.RENDER_LOG, " >> Set render status for " + name + " : " + string(result)); rendered = result; if(result) { diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index 6e98b95bf..6a717f794 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -21,15 +21,19 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct .setVisible(true, true); inputs[| 5] = nodeValue("Eval mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Boolean", "Comparison"]) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Boolean", "Number compare", "Text compare" ]) .rejectArray(); inputs[| 6] = nodeValue("Boolean", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) .setVisible(true, true) .rejectArray(); + inputs[| 7] = nodeValue("Text 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + + inputs[| 8] = nodeValue("Text 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + input_display_list = [ 5, - ["Condition", false], 0, 1, 2, 6, + ["Condition", false], 0, 1, 2, 6, 7, 8, ["Result", true], 3, 4 ] @@ -39,10 +43,12 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct static step = function() { var _mode = inputs[| 5].getValue(); - inputs[| 0].setVisible(_mode); - inputs[| 1].setVisible(_mode); - inputs[| 2].setVisible(_mode); - inputs[| 6].setVisible(!_mode); + inputs[| 0].setVisible(_mode == 1, _mode == 1); + inputs[| 1].setVisible(_mode == 1); + inputs[| 2].setVisible(_mode == 1, _mode == 1); + inputs[| 6].setVisible(_mode == 0, _mode == 0); + inputs[| 7].setVisible(_mode == 2, _mode == 2); + inputs[| 8].setVisible(_mode == 2, _mode == 2); } static update = function(frame = ANIMATOR.current_frame) { @@ -55,23 +61,28 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _cond = inputs[| 1].getValue(); var _valu = inputs[| 2].getValue(); var _bool = inputs[| 6].getValue(); + var _txt1 = inputs[| 7].getValue(); + var _txt2 = inputs[| 8].getValue(); inputs[| 3].type = inputs[| 3].value_from == noone? VALUE_TYPE.any : inputs[| 3].value_from.type; inputs[| 4].type = inputs[| 4].value_from == noone? VALUE_TYPE.any : inputs[| 4].value_from.type; var res = false; - if(_mode) { - switch(_cond) { - case 0 : res = _chck == _valu; break; - case 1 : res = _chck != _valu; break; - case 2 : res = _chck < _valu; break; - case 3 : res = _chck <= _valu; break; - case 4 : res = _chck > _valu; break; - case 5 : res = _chck >= _valu; break; - } - } else - res = _bool; + switch(_mode) { + case 0 : res = _bool; break; + case 1 : + switch(_cond) { + case 0 : res = _chck == _valu; break; + case 1 : res = _chck != _valu; break; + case 2 : res = _chck < _valu; break; + case 3 : res = _chck <= _valu; break; + case 4 : res = _chck > _valu; break; + case 5 : res = _chck >= _valu; break; + } + break; + case 2 : res = _txt1 == _txt2; break; + } if(res) { outputs[| 0].setValue(_true); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index a01800d90..cf7d91f54 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -53,7 +53,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x show_input_name = false; show_output_name = false; - always_output = false; inspecting = false; previewing = 0; @@ -248,24 +247,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(use_cache) cacheArrayCheck(); var willUpdate = false; - if(always_output) { - for(var i = 0; i < ds_list_size(outputs); i++) { - if(outputs[| i].type != VALUE_TYPE.surface) - continue; - var val = outputs[| i].getValue(); - - if(is_array(val)) { - for(var j = 0; j < array_length(val); j++) { - var _surf = val[j]; - if(is_surface(_surf) && _surf != DEF_SURFACE) - continue; - willUpdate = true; - } - } else if(!is_surface(val) || val == DEF_SURFACE) - willUpdate = true; - } - } - if(ANIMATOR.frame_progress) { if(update_on_frame) willUpdate = true; @@ -350,7 +331,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x nodes[i].triggerRender(); } - static isRenderable = function() { //Check if every input is ready (updated) + static isRenderable = function(log = false) { //Check if every input is ready (updated) if(!active) return false; if(!renderActive) return false; @@ -360,8 +341,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if( _in.type == VALUE_TYPE.node) continue; var val_from = _in.value_from; - if( val_from == noone) continue; - if(!val_from.node.active) continue; + if( val_from == noone) continue; + if(!val_from.node.active) continue; if(!val_from.node.renderActive) continue; if(!val_from.node.rendered) return false; @@ -380,10 +361,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var _to = _ot.value_to[| j]; if(!_to.node.active || _to.value_from == noone) continue; - printIf(global.RENDER_LOG, " -> Check render " + _to.node.name + " from " + _to.value_from.node.name); + printIf(global.RENDER_LOG, " |--> Check render " + _to.node.name + " from " + _to.value_from.node.name); if(_to.value_from.node != self) continue; - printIf(global.RENDER_LOG, " --> Check complete, push " + _to.node.name + " to stack."); + printIf(global.RENDER_LOG, " >> Check complete, push " + _to.node.name + " to stack."); array_push(nodes, _to.node); } } @@ -394,6 +375,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static onInspect = function() {} static setRenderStatus = function(result) { + printIf(global.RENDER_LOG, " >> Set render status for " + name + " : " + string(result)); rendered = result; if(!result && group != noone) @@ -466,15 +448,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var y0 = yy + 20 * draw_name + draw_padding * _s; var y1 = yy + (h - draw_padding) * _s; - return { x0 : x0, - x1 : x1, - y0 : y0, - y1 : y1, - xc : (x0 + x1) / 2, - yc : (y0 + y1) / 2, - w : x1 - x0, - h : y1 - y0 - }; + return new node_bbox(x0, y0, x1, y1); } static drawNodeName = function(xx, yy, _s) { @@ -490,7 +464,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x draw_sprite_stretched_ext(THEME.node_bg_name, 0, xx, yy, w * _s, ui(20), color, aa); var cc = COLORS._main_text; - if(PREF_MAP[? "node_show_render_status"] && !rendered) + if(/*PREF_MAP[? "node_show_render_status"] && */!rendered) cc = isRenderable()? COLORS._main_value_positive : COLORS._main_value_negative; draw_set_text(f_p1, fa_left, fa_center, cc); diff --git a/scripts/node_display_image/node_display_image.gml b/scripts/node_display_image/node_display_image.gml index 5be9d60e1..67cd81327 100644 --- a/scripts/node_display_image/node_display_image.gml +++ b/scripts/node_display_image/node_display_image.gml @@ -27,7 +27,6 @@ function Node_create_Display_Image_path(_x, _y, path) { function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = ""; - always_output = true; auto_height = false; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 7b3b68312..11442ad98 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -26,31 +26,29 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static getNextNodes = function() { if(is_undefined(outParent)) return []; - group.setRenderStatus(true); + //group.setRenderStatus(true); //printIf(global.RENDER_LOG, "Value to amount " + string(ds_list_size(outParent.value_to))); var nodes = []; for(var j = 0; j < ds_list_size(outParent.value_to); j++) { var _to = outParent.value_to[| j]; if(!_to.node.renderActive) continue; - printIf(global.RENDER_LOG, "Value to " + _to.name); + //printIf(global.RENDER_LOG, "Value to " + _to.name); if(!_to.node.active || _to.value_from == noone) { - printIf(global.RENDER_LOG, "no value from"); + //printIf(global.RENDER_LOG, "no value from"); continue; } if(_to.value_from.node != group) { - printIf(global.RENDER_LOG, "value from not equal group"); + //printIf(global.RENDER_LOG, "value from not equal group"); continue; } - printIf(global.RENDER_LOG, "Group output ready " + string(_to.node.isRenderable())); + //printIf(global.RENDER_LOG, "Group output ready " + string(_to.node.isRenderable())); - if(_to.node.isRenderable()) { - array_push(nodes, _to.node); - printIf(global.RENDER_LOG, "Push node " + _to.node.name + " to stack"); - } + array_push(nodes, _to.node); + printIf(global.RENDER_LOG, " >> Check complete, push " + _to.node.name + " to stack."); } return nodes; diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 3b477c81b..5c179e103 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -24,7 +24,6 @@ function Node_create_Image_path(_x, _y, path) { function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Image"; color = COLORS.node_blend_input; - always_output = true; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_load, ["*.png", ""]) diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index fa2aefb19..82febd891 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -38,7 +38,6 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons color = COLORS.node_blend_input; update_on_frame = true; - always_output = true; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) .setDisplay(VALUE_DISPLAY.path_array, ["*.png", ""]); diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index be4e8e1f9..3e68a7056 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -29,7 +29,6 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct name = "Image GIF"; color = COLORS.node_blend_input; update_on_frame = true; - always_output = true; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_load, ["*.gif", ""]); diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index a635375a5..a39983a80 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -35,7 +35,6 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons name = "Image Array"; spr = []; color = COLORS.node_blend_input; - always_output = true; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) .setDisplay(VALUE_DISPLAY.path_array, ["*.png", ""]); @@ -135,6 +134,8 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons var _ww = -1, _hh = -1; var surfs = outputs[| 0].getValue(); + surface_array_free(surfs); + surfs = []; for(var i = 0; i < array_length(spr); i++) { var _spr = spr[i]; @@ -168,7 +169,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons ww = sprite_get_width(_spr) + pad[0] + pad[2]; hh = sprite_get_height(_spr) + pad[1] + pad[3]; - surfs[i] = surface_verify(array_safe_get(surfs, i), ww, hh, attrDepth()); + surfs[i] = surface_create(ww, hh, attrDepth()); surface_set_target(surfs[i]); DRAW_CLEAR BLEND_OVERRIDE; @@ -178,7 +179,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons break; case CANVAS_SIZE.maximum : case CANVAS_SIZE.minimum : - surfs[i] = surface_verify(array_safe_get(surfs, i), ww, hh, attrDepth()); + surfs[i] = surface_create(ww, hh, attrDepth()); var _w = sprite_get_width(_spr); var _h = sprite_get_height(_spr); diff --git a/scripts/node_lerp609/node_lerp609.gml b/scripts/node_lerp609/node_lerp609.gml deleted file mode 100644 index 0af5e9668..000000000 --- a/scripts/node_lerp609/node_lerp609.gml +++ /dev/null @@ -1,3 +0,0 @@ -function node_lerp609(){ - -} \ No newline at end of file diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index 9422c867e..48d36576c 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -149,34 +149,48 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(drag_type < 2) { var inp = inputs[| input_fix_len + drag_point]; var anc = inp.getValue(); - if(drag_type == 0) { + if(drag_type == 0) { //drag point anc[0] = dx; anc[1] = dy; if(key_mod_press(CTRL)) { anc[0] = round(anc[0]); anc[1] = round(anc[1]); } - } else if(drag_type == 1) { + } else if(drag_type == 1) { //drag control 1 anc[2] = dx - anc[0]; anc[3] = dy - anc[1]; - anc[4] = -anc[2]; - anc[5] = -anc[3]; + + if(!key_mod_press(SHIFT)) { + anc[4] = -anc[2]; + anc[5] = -anc[3]; + } + if(key_mod_press(CTRL)) { anc[2] = round(anc[2]); anc[3] = round(anc[3]); - anc[4] = round(anc[4]); - anc[5] = round(anc[5]); + + if(key_mod_press(SHIFT)) { + anc[4] = round(anc[4]); + anc[5] = round(anc[5]); + } } - } else if(drag_type == -1) { + } else if(drag_type == -1) { //drag control 2 anc[4] = dx - anc[0]; anc[5] = dy - anc[1]; - anc[2] = -anc[4]; - anc[3] = -anc[5]; + + if(!key_mod_press(SHIFT)) { + anc[2] = -anc[4]; + anc[3] = -anc[5]; + } + if(key_mod_press(CTRL)) { anc[2] = round(anc[2]); anc[3] = round(anc[3]); - anc[4] = round(anc[4]); - anc[5] = round(anc[5]); + + if(!key_mod_press(SHIFT)) { + anc[4] = round(anc[4]); + anc[5] = round(anc[5]); + } } } @@ -563,7 +577,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { drag_point_sy = _a[1]; } } - } else if(key_mod_press(SHIFT)) { + } else if(hover_type == 0 && key_mod_press(SHIFT)) { draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { diff --git a/scripts/node_path_anchor/node_path_anchor.gml b/scripts/node_path_anchor/node_path_anchor.gml new file mode 100644 index 000000000..ecf302880 --- /dev/null +++ b/scripts/node_path_anchor/node_path_anchor.gml @@ -0,0 +1,66 @@ +function Node_Path_Anchor(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Path Anchor"; + color = COLORS.node_blend_number; + previewable = false; + w = 96; + + inputs[| 0] = nodeValue("Postion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Control point 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -16, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 2] = nodeValue("Control point 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 3] = nodeValue("Mirror control point", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); + + outputs[| 0] = nodeValue("Anchor", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0, 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector); + + tools = [ + new NodeTool( "Adjust control point", THEME.path_tools_anchor ), + ]; + + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + var _pos = inputs[| 0].getValue(); + var _cn1 = inputs[| 1].getValue(); + var _cn2 = inputs[| 2].getValue(); + var _mir = inputs[| 3].getValue(); + + var px = _x + _pos[0] * _s; + var py = _y + _pos[1] * _s; + + var c1x = px + _cn1[0] * _s; + var c1y = py + _cn1[1] * _s; + var c2x = _mir? px - _cn1[0] * _s : px + _cn2[0] * _s; + var c2y = _mir? py - _cn1[1] * _s : py + _cn2[1] * _s; + + draw_set_color(COLORS._main_accent); + draw_line(px, py, c1x, c1y); + draw_line(px, py, c2x, c2y); + + active &= !inputs[| 0].drawOverlay(!isUsingTool(0) && active, _x, _y, _s, _mx, _my, _snx, _sny); + active &= !inputs[| 1].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny); + + if(!_mir) + active &= !inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny); + else + draw_circle(c2x, c2y, 4, false); + } + + function process_data(_output, _data, _output_index, _array_index = 0) { + var _mir = _data[3]; + + if(_mir) + return [_data[0][0], _data[0][1], _data[1][0], _data[1][1], -_data[1][0], -_data[1][1]]; + else + return [_data[0][0], _data[0][1], _data[1][0], _data[1][1], _data[2][0], _data[2][1]]; + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_fit(s_node_path_anchor, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + } +} \ No newline at end of file diff --git a/scripts/node_path_anchor/node_path_anchor.yy b/scripts/node_path_anchor/node_path_anchor.yy new file mode 100644 index 000000000..7fbea5a25 --- /dev/null +++ b/scripts/node_path_anchor/node_path_anchor.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_path_anchor", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "path", + "path": "folders/nodes/data/value/path.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index ef93b1ae6..af08110d1 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -61,7 +61,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getLength(ind).clone(); + if(ind < lc) return _path.getLength(ind); ind -= lc; } @@ -73,7 +73,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getBoundary(ind).clone(); + if(ind < lc) return _path.getBoundary(ind); ind -= lc; } @@ -85,7 +85,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getSegmentLength(ind).clone(); + if(ind < lc) return _path.getSegmentLength(ind); ind -= lc; } @@ -97,7 +97,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getAccuLength(ind).clone(); + if(ind < lc) return _path.getAccuLength(ind); ind -= lc; } @@ -109,7 +109,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getSegmentCount(ind).clone(); + if(ind < lc) return _path.getSegmentCount(ind); ind -= lc; } diff --git a/scripts/node_perlin612/node_perlin612.gml b/scripts/node_perlin612/node_perlin612.gml deleted file mode 100644 index 583d057ad..000000000 --- a/scripts/node_perlin612/node_perlin612.gml +++ /dev/null @@ -1,3 +0,0 @@ -function node_perlin612(){ - -} \ No newline at end of file diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 26810ffc0..ec1520d96 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -239,17 +239,17 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(transform, "Flip", s_node_flip, "Node_Flip", [1, Node_Flip], ["mirror"], "Flip image horizontally or vertically."); ds_list_add(transform, "Warps"); - addNodeObject(transform, "Crop", s_node_crop, "Node_Crop", [1, Node_Crop],, "Crop out image to create smaller ones."); - addNodeObject(transform, "Crop Content", s_node_crop_content, "Node_Crop_Content", [1, Node_Crop_Content],, "Crop out empty pixel pixel from the image."); - addNodeObject(transform, "Warp", s_node_warp, "Node_Warp", [1, Node_Warp], ["wrap"], "Warp image by freely moving the corners."); - addNodeObject(transform, "Skew", s_node_skew, "Node_Skew", [1, Node_Skew],, "Skew image horizontally, or vertically."); - addNodeObject(transform, "Mesh Warp", s_node_warp_mesh, "Node_Mesh_Warp", [1, Node_Mesh_Warp], ["mesh wrap"], "Wrap image by converting it to mesh, and using control points."); - addNodeObject(transform, "Polar", s_node_polar, "Node_Polar", [1, Node_Polar],, "Convert image to polar coordinate."); - addNodeObject(transform, "Area Warp", s_node_padding, "Node_Wrap_Area", [1, Node_Wrap_Area],, "Wrap image to fit area value (x, y, w, h)."); + addNodeObject(transform, "Crop", s_node_crop, "Node_Crop", [1, Node_Crop],, "Crop out image to create smaller ones."); + addNodeObject(transform, "Crop Content", s_node_crop_content, "Node_Crop_Content", [1, Node_Crop_Content],, "Crop out empty pixel pixel from the image."); + addNodeObject(transform, "Warp", s_node_warp, "Node_Warp", [1, Node_Warp], ["wrap"], "Warp image by freely moving the corners."); + addNodeObject(transform, "Skew", s_node_skew, "Node_Skew", [1, Node_Skew],, "Skew image horizontally, or vertically."); + addNodeObject(transform, "Mesh Warp", s_node_warp_mesh, "Node_Mesh_Warp", [1, Node_Mesh_Warp], ["mesh wrap"], "Wrap image by converting it to mesh, and using control points."); + addNodeObject(transform, "Polar", s_node_polar, "Node_Polar", [1, Node_Polar],, "Convert image to polar coordinate."); + addNodeObject(transform, "Area Warp", s_node_padding, "Node_Wrap_Area", [1, Node_Wrap_Area],, "Wrap image to fit area value (x, y, w, h)."); ds_list_add(transform, "Others"); addNodeObject(transform, "Composite", s_node_compose, "Node_Composite", [1, Node_Composite], ["merge"], "Combine multiple images with controllable position, rotation, scale."); - addNodeObject(transform, "Nine Slice", s_node_9patch, "Node_9Slice", [1, Node_9Slice], ["9", "splice"], "Cut image into 3x3 parts, and scale/repeat only the middle part."); + addNodeObject(transform, "Nine Slice", s_node_9patch, "Node_9Slice", [1, Node_9Slice], ["9 slice", "splice"], "Cut image into 3x3 parts, and scale/repeat only the middle part."); addNodeObject(transform, "Padding", s_node_padding, "Node_Padding", [1, Node_Padding],, "Make image bigger by adding space in 4 directions."); var filter = ds_list_create(); @@ -258,7 +258,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(filter, "Blend", s_node_blend, "Node_Blend", [0, Node_create_Blend], ["normal", "add", "subtract", "multiply", "screen", "maxx", "minn"], "Blend 2 images using different blendmodes."); addNodeObject(filter, "RGBA Combine", s_node_RGB_combine, "Node_Combine_RGB", [1, Node_Combine_RGB],, "Combine 4 image in to one. Each image use to control RGBA channel.").setVersion(1070); addNodeObject(filter, "HSV Combine", s_node_HSV_combine, "Node_Combine_HSV", [1, Node_Combine_HSV],, "Combine 4 image in to one. Each image use to control HSVA channel.").setVersion(1070); - + ds_list_add(filter, "Blurs"); addNodeObject(filter, "Blur", s_node_blur, "Node_Blur", [1, Node_Blur], ["gaussian blur"], "Blur image smoothly."); addNodeObject(filter, "Simple Blur", s_node_blur_simple, "Node_Blur_Simple", [1, Node_Blur_Simple],, "Blur image using simpler algorithm. Allowing for variable blur strength.").setVersion(1070); @@ -268,7 +268,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(filter, "Lens Blur", s_node_bokeh, "Node_Blur_Bokeh", [1, Node_Blur_Bokeh], ["bokeh"], "Create bokeh effect. Blur lighter color in a lens-like manner.").setVersion(1110); addNodeObject(filter, "Contrast Blur", s_node_blur_contrast, "Node_Blur_Contrast", [1, Node_Blur_Contrast],, "Blur only pixel of a similiar color."); addNodeObject(filter, "Average", s_node_average, "Node_Average", [1, Node_Average],, "Average color of every pixels in the image.").setVersion(1110); - + ds_list_add(filter, "Warps"); addNodeObject(filter, "Mirror", s_node_mirror, "Node_Mirror", [1, Node_Mirror],, "Reflect the image along a reflection line.").setVersion(1070); addNodeObject(filter, "Twirl", s_node_twirl, "Node_Twirl", [1, Node_Twirl], ["twist"], "Twist the image around a mid point."); @@ -294,8 +294,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(filter, "Convolution", s_node_convolution, "Node_Convolution", [1, Node_Convolution], ["kernel"], "Apply convolution operation on each pixel using a custom 3x3 kernel.").setVersion(1090); addNodeObject(filter, "Local Analyze", s_node_local_analyze, "Node_Local_Analyze", [1, Node_Local_Analyze],, "Apply non-linear operation (minimum, maximum) on each pixel locally.").setVersion(1110); addNodeObject(filter, "SDF", s_node_sdf, "Node_SDF", [1, Node_SDF],, "Create signed distance field using jump flooding algorithm.").setVersion(1130); + addNodeObject(filter, "Replace Image", s_node_sdf, "Node_Surface_Replace", [1, Node_Surface_Replace]).setVersion(1140); addNodeObject(filter, "Chromatic Aberration", s_node_chromatic_abarration, "Node_Chromatic_Aberration", [1, Node_Chromatic_Aberration],, "Apply chromatic aberration effect to the image."); - + ds_list_add(filter, "Colors"); addNodeObject(filter, "Replace Color", s_node_color_replace, "Node_Color_replace", [1, Node_Color_replace], ["isolate color", "select color", "palette swap"], "Replace color that match one palette with another palette."); addNodeObject(filter, "Remove Color", s_node_color_remove, "Node_Color_Remove", [1, Node_Color_Remove], ["delete color"], "Remove color that match a palette."); @@ -418,12 +419,13 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(values, "Equation", s_node_equation, "Node_Equation", [0, Node_create_Equation],, "Evaluate string of equation. With an option for setting variables."); addNodeObject(values, "Random", s_node_random, "Node_Random", [1, Node_Random]); addNodeObject(values, "Statistic", s_node_statistic, "Node_Statistic", [0, Node_create_Statistic], ["sum", "average", "mean", "median", "min", "max"]); + addNodeObject(values, "Convert Base", s_node_base_conversion, "Node_Base_Convert", [1, Node_Base_Convert], ["base convert", "binary", "hexadecimal"]).setVersion(1140); addNodeObject(values, "Vector2", s_node_vec2, "Node_Vector2", [1, Node_Vector2]); addNodeObject(values, "Vector3", s_node_vec3, "Node_Vector3", [1, Node_Vector3]); addNodeObject(values, "Vector4", s_node_vec4, "Node_Vector4", [1, Node_Vector4]); addNodeObject(values, "Vector Split", s_node_vec_split, "Node_Vector_Split", [1, Node_Vector_Split]); addNodeObject(values, "Scatter Points", s_node_scatter_point, "Node_Scatter_Points", [1, Node_Scatter_Points],, "Generate array of vector 2 points for scattering.").setVersion(1120); - + ds_list_add(values, "Texts"); addNodeObject(values, "Text", s_node_text, "Node_String", [1, Node_String]); addNodeObject(values, "Unicode", s_node_unicode, "Node_Unicode", [1, Node_Unicode]); @@ -457,6 +459,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(values, "Paths"); addNodeObject(values, "Path", s_node_path, "Node_Path", [1, Node_Path]); + addNodeObject(values, "Path Anchor", s_node_path_anchor, "Node_Path_Anchor", [1, Node_Path_Anchor]).setVersion(1140); addNodeObject(values, "Path Array", s_node_path_array, "Node_Path_Array", [1, Node_Path_Array]).setVersion(1137); addNodeObject(values, "Sample Path", s_node_path_sample, "Node_Path_Sample", [1, Node_Path_Sample],, "Sample a 2D position from a path"); addNodeObject(values, "Blend Path", s_node_path_blend, "Node_Path_Blend", [1, Node_Path_Blend],, "Blend between 2 paths."); @@ -614,7 +617,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #region attribute global.SURFACE_INTERPOLATION = [ "No aliasing", - "Linear", + "Bilinear", "Bicubic", "radSin" ]; diff --git a/scripts/node_string_get_char/node_string_get_char.gml b/scripts/node_string_get_char/node_string_get_char.gml index 423d7e15f..d81c7b6dc 100644 --- a/scripts/node_string_get_char/node_string_get_char.gml +++ b/scripts/node_string_get_char/node_string_get_char.gml @@ -1,19 +1,19 @@ function Node_String_Get_Char(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Get Character"; - previewable = false; - + previewable = false; w = 96; - inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - inputs[| 1] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 1] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + + inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - function process_data(_output, _data, _index = 0) { - return string_char_at(_data[0], _data[1]); + function process_data(_output, _data, _index = 0) { + return string_copy(_data[0], _data[1], _data[2]); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_surface_replace/node_gradient.yy b/scripts/node_surface_replace/node_gradient.yy new file mode 100644 index 000000000..fa813bb58 --- /dev/null +++ b/scripts/node_surface_replace/node_gradient.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_gradient", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_surface_replace/node_surface_replace.gml b/scripts/node_surface_replace/node_surface_replace.gml new file mode 100644 index 000000000..80741baad --- /dev/null +++ b/scripts/node_surface_replace/node_surface_replace.gml @@ -0,0 +1,66 @@ +function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Replace Image"; + preview_channel = 1; + + inputs[| 0] = nodeValue("Base image", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); + + inputs[| 1] = nodeValue("Target image", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); + + inputs[| 2] = nodeValue("Replacement image", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); + + inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1 ) + .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]); + + outputs[| 0] = nodeValue("Mapping", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + outputs[| 1] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ + ["Surface", false], 0, 1, 2, + ["Repalcement", false], 3, + ]; + + output_display_list = [ 1, 0 ] + + temp_surface = [ surface_create(1, 1) ]; + + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var _bas = _data[0]; + var _tar = _data[1]; + var _rep = _data[2]; + var _thr = _data[3]; + + if(!is_surface(_tar)) return _outSurf; + if(!is_surface(_rep)) return _outSurf; + + if(_output_index == 0) { + _outSurf = surface_verify(_outSurf, surface_get_width(_bas), surface_get_height(_bas)); + + surface_set_shader(_outSurf, sh_surface_replace_find); + DRAW_CLEAR + shader_set_f("dimension", surface_get_width(_bas), surface_get_height(_bas)); + shader_set_surface("target", _tar); + shader_set_f("target_dim", surface_get_width(_tar), surface_get_height(_tar)); + shader_set_f("threshold", _thr); + + draw_surface_safe(_bas); + surface_reset_shader(); + + temp_surface[0] = _outSurf; + return _outSurf; + } + + if(_output_index == 1) { + surface_set_shader(_outSurf, sh_surface_replace_replace); + DRAW_CLEAR + shader_set_surface("replace", _rep); + shader_set_f("replace_dim", surface_get_width(_rep), surface_get_height(_rep)); + shader_set_surface("findRes", temp_surface[0]); + + draw_surface_safe(_bas); + surface_reset_shader(); + + return _outSurf; + } + } +} \ No newline at end of file diff --git a/scripts/node_surface_replace/node_surface_replace.yy b/scripts/node_surface_replace/node_surface_replace.yy new file mode 100644 index 000000000..5ec8ddc25 --- /dev/null +++ b/scripts/node_surface_replace/node_surface_replace.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_surface_replace", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 863834824..f6e168af2 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -396,6 +396,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru global_edit = new textBox(TEXTBOX_INPUT.text, function(str) { global_key = str; node.triggerRender(); + UPDATE = RENDER_TYPE.partial; }); global_edit.boxColor = COLORS._main_value_positive; global_edit.align = fa_left; @@ -1159,9 +1160,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(updated) { if(connect_type == JUNCTION_CONNECT.input) { node.triggerRender(); - if(_update) - node.valueUpdate(index); + if(_update) node.valueUpdate(index); node.clearCacheForward(); + + UPDATE = RENDER_TYPE.partial; } cache_array[0] = false; @@ -1254,6 +1256,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru node.onValueFromUpdate(index); node.triggerRender(); node.clearCacheForward(); + + UPDATE = RENDER_TYPE.partial; } cache_array[0] = false; diff --git a/scripts/node_wrap/node_wrap.gml b/scripts/node_wrap/node_wrap.gml index 41baba39a..b06e284a7 100644 --- a/scripts/node_wrap/node_wrap.gml +++ b/scripts/node_wrap/node_wrap.gml @@ -179,50 +179,75 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var bl = _data[3]; var br = _data[4]; - surface_set_shader(_outSurf); - shader_set_interpolation(_data[0]); - draw_set_color(c_white); + var sw = surface_get_width(_data[0]); + var sh = surface_get_height(_data[0]); + + var teq = round(tl[1]) == round(tr[1]); + var beq = round(bl[1]) == round(br[1]); + var leq = round(tl[0]) == round(bl[0]); + var req = round(tr[0]) == round(br[0]); + + if(teq && beq && leq && req) { + surface_set_shader(_outSurf) + shader_set_interpolation(_data[0]); + draw_surface_stretched_safe(_data[0], tl[0], tl[1], tr[0] - tl[0], bl[1] - tl[1]); + surface_reset_shader(); + } else { + surface_set_shader(_outSurf, sh_warp_4points); + shader_set_interpolation(_data[0]); + shader_set_f("p0", br[0] / sw, br[1] / sh); + shader_set_f("p1", tr[0] / sw, tr[1] / sh); + shader_set_f("p2", tl[0] / sw, tl[1] / sh); + shader_set_f("p3", bl[0] / sw, bl[1] / sh); - var tex = surface_get_texture(_data[0]); - draw_primitive_begin_texture(pr_trianglestrip, tex); + draw_surface(_data[0], 0, 0); + surface_reset_shader(); + } + + //surface_set_shader(_outSurf); + //shader_set_interpolation(_data[0]); + // draw_set_color(c_white); - var res = 4; - var _i0, _i1, _j0, _j1; - var tl_x = tl[0]; - var tl_y = tl[1]; - var tr_x = tr[0]; - var tr_y = tr[1]; - var bl_x = bl[0]; - var bl_y = bl[1]; - var br_x = br[0]; - var br_y = br[1]; + // var tex = surface_get_texture(_data[0]); + // draw_primitive_begin_texture(pr_trianglestrip, tex); - for( var i = 0; i < res; i++ ) { - for( var j = 0; j < res; j++ ) { - _i0 = i / res; - _i1 = (i + 1) / res; - _j0 = j / res; - _j1 = (j + 1) / res; + // var res = 4; + // var _i0, _i1, _j0, _j1; + // var tl_x = tl[0]; + // var tl_y = tl[1]; + // var tr_x = tr[0]; + // var tr_y = tr[1]; + // var bl_x = bl[0]; + // var bl_y = bl[1]; + // var br_x = br[0]; + // var br_y = br[1]; + + // for( var i = 0; i < res; i++ ) { + // for( var j = 0; j < res; j++ ) { + // _i0 = i / res; + // _i1 = (i + 1) / res; + // _j0 = j / res; + // _j1 = (j + 1) / res; - var _tlx = lerp(lerp(tl_x, tr_x, _i0), lerp(bl_x, br_x, _i0), _j0); - var _tly = lerp(lerp(tl_y, tr_y, _i0), lerp(bl_y, br_y, _i0), _j0); - var _trx = lerp(lerp(tl_x, tr_x, _i1), lerp(bl_x, br_x, _i1), _j0); - var _try = lerp(lerp(tl_y, tr_y, _i1), lerp(bl_y, br_y, _i1), _j0); + // var _tlx = lerp(lerp(tl_x, tr_x, _i0), lerp(bl_x, br_x, _i0), _j0); + // var _tly = lerp(lerp(tl_y, tr_y, _i0), lerp(bl_y, br_y, _i0), _j0); + // var _trx = lerp(lerp(tl_x, tr_x, _i1), lerp(bl_x, br_x, _i1), _j0); + // var _try = lerp(lerp(tl_y, tr_y, _i1), lerp(bl_y, br_y, _i1), _j0); - var _blx = lerp(lerp(tl_x, tr_x, _i0), lerp(bl_x, br_x, _i0), _j1); - var _bly = lerp(lerp(tl_y, tr_y, _i0), lerp(bl_y, br_y, _i0), _j1); - var _brx = lerp(lerp(tl_x, tr_x, _i1), lerp(bl_x, br_x, _i1), _j1); - var _bry = lerp(lerp(tl_y, tr_y, _i1), lerp(bl_y, br_y, _i1), _j1); + // var _blx = lerp(lerp(tl_x, tr_x, _i0), lerp(bl_x, br_x, _i0), _j1); + // var _bly = lerp(lerp(tl_y, tr_y, _i0), lerp(bl_y, br_y, _i0), _j1); + // var _brx = lerp(lerp(tl_x, tr_x, _i1), lerp(bl_x, br_x, _i1), _j1); + // var _bry = lerp(lerp(tl_y, tr_y, _i1), lerp(bl_y, br_y, _i1), _j1); - draw_vertex_texture(_tlx, _tly, _i0, _j0); - draw_vertex_texture(_trx, _try, _i1, _j0); + // draw_vertex_texture(_tlx, _tly, _i0, _j0); + // draw_vertex_texture(_trx, _try, _i1, _j0); - draw_vertex_texture(_blx, _bly, _i0, _j1); - draw_vertex_texture(_brx, _bry, _i1, _j1); - } - } - draw_primitive_end(); - surface_reset_shader(); + // draw_vertex_texture(_blx, _bly, _i0, _j1); + // draw_vertex_texture(_brx, _bry, _i1, _j1); + // } + // } + // draw_primitive_end(); + //surface_reset_shader(); return _outSurf; } diff --git a/scripts/node_wrap608/node_wrap608.gml b/scripts/node_wrap608/node_wrap608.gml deleted file mode 100644 index fc5ad80da..000000000 --- a/scripts/node_wrap608/node_wrap608.gml +++ /dev/null @@ -1,3 +0,0 @@ -function node_wrap608(){ - -} \ No newline at end of file diff --git a/scripts/node_wrap_perspective/node_outline.yy b/scripts/node_wrap_perspective/node_outline.yy new file mode 100644 index 000000000..86468bc09 --- /dev/null +++ b/scripts/node_wrap_perspective/node_outline.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_outline", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_wrap_perspective/node_wrap_perspective.gml b/scripts/node_wrap_perspective/node_wrap_perspective.gml new file mode 100644 index 000000000..ed941476b --- /dev/null +++ b/scripts/node_wrap_perspective/node_wrap_perspective.gml @@ -0,0 +1,226 @@ +function Node_Warp_Perspective(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Perspective Warp"; + + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 1; + + inputs[| 2] = nodeValue("Top left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 3] = nodeValue("Top right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 4] = nodeValue("Bottom left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 5] = nodeValue("Bottom right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 6] = nodeValue("Top left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 7] = nodeValue("Top right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 8] = nodeValue("Bottom left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + inputs[| 9] = nodeValue("Bottom right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 1, + ["Surface", false], 0, + ["Origin", false], 2, 3, 4, 5, + ["Warp", false], 6, 7, 8, 9, + ] + + attribute_surface_depth(); + attribute_interpolation(); + + drag_side = -1; + drag_mx = 0; + drag_my = 0; + drag_s = [[0, 0], [0, 0]]; + + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + if(array_length(current_data) < ds_list_size(inputs)) return; + + var _surf = outputs[| 0].getValue(); + if(is_array(_surf)) { + if(array_length(_surf) == 0) return; + _surf = _surf[preview_index]; + } + + if(drag_side > -1) { + dx = (_mx - drag_mx) / _s; + dy = (_my - drag_my) / _s; + + if(mouse_release(mb_left)) { + drag_side = -1; + UNDO_HOLDING = false; + } + } + + var tool = 1; + + var tl = current_data[tool * 4 + 2]; + var tr = current_data[tool * 4 + 3]; + var bl = current_data[tool * 4 + 4]; + var br = current_data[tool * 4 + 5]; + + tl[0] = _x + tl[0] * _s; + tr[0] = _x + tr[0] * _s; + bl[0] = _x + bl[0] * _s; + br[0] = _x + br[0] * _s; + + tl[1] = _y + tl[1] * _s; + tr[1] = _y + tr[1] * _s; + bl[1] = _y + bl[1] * _s; + br[1] = _y + br[1] * _s; + + draw_set_color(COLORS._main_accent); + draw_line(tl[0], tl[1], tr[0], tr[1]); + draw_line(tl[0], tl[1], bl[0], bl[1]); + draw_line(br[0], br[1], tr[0], tr[1]); + draw_line(br[0], br[1], bl[0], bl[1]); + + if(inputs[| tool * 4 + 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; + if(inputs[| tool * 4 + 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; + if(inputs[| tool * 4 + 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; + if(inputs[| tool * 4 + 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; + + var dx = 0; + var dy = 0; + + draw_set_color(COLORS.node_overlay_gizmo_inactive); + if(drag_side == tool * 4 + 2) { + draw_line_width(tl[0], tl[1], tr[0], tr[1], 3); + + var _tlx = value_snap(drag_s[0][0] + dx, _snx); + var _tly = value_snap(drag_s[0][1] + dy, _sny); + + var _trx = value_snap(drag_s[1][0] + dx, _snx); + var _try = value_snap(drag_s[1][1] + dy, _sny); + + inputs[| tool * 4 + 2].setValue([ _tlx, _tly ]) + if(inputs[| tool * 4 + 3].setValue([ _trx, _try ])) UNDO_HOLDING = true; + } else if(drag_side == tool * 4 + 3) { + draw_line_width(tl[0], tl[1], bl[0], bl[1], 3); + + var _tlx = value_snap(drag_s[0][0] + dx, _snx); + var _tly = value_snap(drag_s[0][1] + dy, _sny); + + var _blx = value_snap(drag_s[1][0] + dx, _snx); + var _bly = value_snap(drag_s[1][1] + dy, _sny); + + inputs[| tool * 4 + 2].setValue([ _tlx, _tly ]); + if(inputs[| tool * 4 + 4].setValue([ _blx, _bly ])) UNDO_HOLDING = true; + } else if(drag_side == tool * 4 + 4) { + draw_line_width(br[0], br[1], tr[0], tr[1], 3); + + var _brx = value_snap(drag_s[0][0] + dx, _snx); + var _bry = value_snap(drag_s[0][1] + dy, _sny); + + var _trx = value_snap(drag_s[1][0] + dx, _snx); + var _try = value_snap(drag_s[1][1] + dy, _sny); + + inputs[| tool * 4 + 5].setValue([ _brx, _bry ]); + if(inputs[| tool * 4 + 3].setValue([ _trx, _try ])) UNDO_HOLDING = true; + } else if(drag_side == tool * 4 + 5) { + draw_line_width(br[0], br[1], bl[0], bl[1], 3); + + var _brx = value_snap(drag_s[0][0] + dx, _snx); + var _bry = value_snap(drag_s[0][1] + dy, _sny); + + var _blx = value_snap(drag_s[1][0] + dx, _snx); + var _bly = value_snap(drag_s[1][1] + dy, _sny); + + inputs[| tool * 4 + 5].setValue([ _brx, _bry ]); + if(inputs[| tool * 4 + 4].setValue([ _blx, _bly ])) UNDO_HOLDING = true; + } else if(active) { + draw_set_color(COLORS._main_accent); + if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], tr[0], tr[1]) < 12) { + draw_line_width(tl[0], tl[1], tr[0], tr[1], 3); + if(mouse_press(mb_left, active)) { + drag_side = tool * 4 + 2; + drag_mx = _mx; + drag_my = _my; + drag_s = [ current_data[tool * 4 + 2], current_data[tool * 4 + 3] ]; + } + } else if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], bl[0], bl[1]) < 12) { + draw_line_width(tl[0], tl[1], bl[0], bl[1], 3); + if(mouse_press(mb_left, active)) { + drag_side = tool * 4 + 3; + drag_mx = _mx; + drag_my = _my; + drag_s = [ current_data[tool * 4 + 2], current_data[tool * 4 + 4] ]; + } + } else if(distance_to_line_infinite(_mx, _my, br[0], br[1], tr[0], tr[1]) < 12) { + draw_line_width(br[0], br[1], tr[0], tr[1], 3); + if(mouse_press(mb_left, active)) { + drag_side = tool * 4 + 4; + drag_mx = _mx; + drag_my = _my; + drag_s = [ current_data[tool * 4 + 5], current_data[tool * 4 + 3] ]; + } + } else if(distance_to_line_infinite(_mx, _my, br[0], br[1], bl[0], bl[1]) < 12) { + draw_line_width(br[0], br[1], bl[0], bl[1], 3); + if(mouse_press(mb_left, active)) { + drag_side = tool * 4 + 5; + drag_mx = _mx; + drag_my = _my; + drag_s = [ current_data[tool * 4 + 5], current_data[tool * 4 + 4] ]; + } + } + } + + inputs[| tool * 4 + 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| tool * 4 + 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| tool * 4 + 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| tool * 4 + 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + } + + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var Ftl = _data[2]; + var Ftr = _data[3]; + var Fbl = _data[4]; + var Fbr = _data[5]; + + var Ttl = _data[6]; + var Ttr = _data[7]; + var Tbl = _data[8]; + var Tbr = _data[9]; + + var sw = surface_get_width(_data[0]); + var sh = surface_get_height(_data[0]); + + surface_set_shader(_outSurf, sh_warp_4points_pers); + shader_set_interpolation(_data[0]); + shader_set_f("f1", Fbr[0] / sw, Fbr[1] / sh); + shader_set_f("f2", Ftr[0] / sw, Ftr[1] / sh); + shader_set_f("f3", Ftl[0] / sw, Ftl[1] / sh); + shader_set_f("f4", Fbl[0] / sw, Fbl[1] / sh); + + shader_set_f("t1", Tbr[0] / sw, Tbr[1] / sh); + shader_set_f("t2", Ttr[0] / sw, Ttr[1] / sh); + shader_set_f("t3", Ttl[0] / sw, Ttl[1] / sh); + shader_set_f("t4", Tbl[0] / sw, Tbl[1] / sh); + + draw_surface(_data[0], 0, 0); + surface_reset_shader(); + + return _outSurf; + } +} \ No newline at end of file diff --git a/scripts/node_wrap_perspective/node_wrap_perspective.yy b/scripts/node_wrap_perspective/node_wrap_perspective.yy new file mode 100644 index 000000000..5dca3d01c --- /dev/null +++ b/scripts/node_wrap_perspective/node_wrap_perspective.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_wrap_perspective", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "transform", + "path": "folders/nodes/data/transform.yy", + }, +} \ No newline at end of file diff --git a/scripts/number_function/number_function.gml b/scripts/number_function/number_function.gml new file mode 100644 index 000000000..d3bd64fe7 --- /dev/null +++ b/scripts/number_function/number_function.gml @@ -0,0 +1,31 @@ +function convertBase(str, fromBase, toBase) { + // Convert the input string to decimal first + var decimalNum = 0; + var len = string_length(str); + + for (var i = 1; i <= len; i++) { + var digit = string_char_at(str, len - i + 1); + var value = 0; + if (digit >= "0" && digit <= "9") + value = ord(digit) - ord("0"); + else if (digit >= "A" && digit <= "Z") + value = ord(digit) - ord("A") + 10; + else if (digit >= "a" && digit <= "z") + value = ord(digit) - ord("a") + 10; + + decimalNum += value * power(fromBase, i - 1); + } + + // Convert the decimal number to the new base + var newStr = ""; + while (decimalNum > 0) { + var digit = decimalNum % toBase; + if (digit < 10) + newStr = chr(digit + ord("0")) + newStr; + else + newStr = chr(digit - 10 + ord("A")) + newStr; + decimalNum = floor(decimalNum / toBase); + } + + return newStr; +} \ No newline at end of file diff --git a/scripts/number_function/number_function.yy b/scripts/number_function/number_function.yy new file mode 100644 index 000000000..1a150754b --- /dev/null +++ b/scripts/number_function/number_function.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "number_function", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "value", + "path": "folders/functions/value.yy", + }, +} \ No newline at end of file diff --git a/scripts/pathArrayBox/pathArrayBox.gml b/scripts/pathArrayBox/pathArrayBox.gml index 1dab2f600..851c05e60 100644 --- a/scripts/pathArrayBox/pathArrayBox.gml +++ b/scripts/pathArrayBox/pathArrayBox.gml @@ -7,6 +7,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { var path = get_open_filenames(data[0], data[1]); key_release(); if(path == "") return noone; + var paths = string_splice(path, "\n"); onClick(paths); }, THEME.button_path_icon); diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 6fbea437e..42cd42abb 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -23,7 +23,7 @@ function __nodeLeafList(_list) { var _startNode = _node.isRenderable(); if(_startNode) { array_push(nodes, _node); - printIf(global.RENDER_LOG, "Push node " + _node.name + " to stack"); + printIf(global.RENDER_LOG, " > Push node " + _node.name + " to stack"); } } @@ -83,36 +83,41 @@ function Render(partial = false, runAction = false) { if(!_node.active) continue; if(!_node.renderActive) continue; - if(_node.rendered) continue; + if(_node.rendered) { + printIf(global.RENDER_LOG, " > Skip rendered " + _node.name + " (" + _node.display_name + ")"); + continue; + } + if(__nodeInLoop(_node)) continue; - - var _startNode = _node.isRenderable(); + + var _startNode = _node.isRenderable(global.RENDER_LOG); if(_startNode) { printIf(global.RENDER_LOG, " > Found leaf " + _node.name + " (" + _node.display_name + ")"); _node.triggerRender(); ds_queue_enqueue(RENDER_QUEUE, _node); - } + } else + printIf(global.RENDER_LOG, " > Skip leaf " + _node.name + " (" + _node.display_name + ")"); } // render forward while(!ds_queue_empty(RENDER_QUEUE)) { rendering = ds_queue_dequeue(RENDER_QUEUE); + var txt = rendering.rendered? " [Skip]" : " [Update]"; + if(!rendering.rendered) { rendering.doUpdate(); - printIf(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "] (Update)"); var nextNodes = rendering.getNextNodes(); - for( var i = 0; i < array_length(nextNodes); i++ ) { - if(!nextNodes[i].isRenderable()) continue; + for( var i = 0; i < array_length(nextNodes); i++ ) ds_queue_enqueue(RENDER_QUEUE, nextNodes[i]); - } if(runAction && rendering.hasInspector1Update()) rendering.inspector1Update(); - } else - printIf(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "] (Skip)"); + } + + printIf(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + txt); } } catch(e) noti_warning(exception_print(e)); @@ -153,7 +158,7 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { if(_node.isRenderable()) { ds_queue_enqueue(RENDER_QUEUE, _node); - printIf(global.RENDER_LOG, " > Push " + _node.name + " (" + _node.display_name + ") node to stack"); + printIf(global.RENDER_LOG, " > Push " + _node.name + " (" + _node.display_name + ") node to stack"); } } @@ -163,6 +168,7 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { if(rendering.group == context) break; var txt = rendering.rendered? " [Skip]" : " [Update]"; + if(!rendering.rendered) { rendering.doUpdate(); if(rendering.hasInspector1Update()) { @@ -171,11 +177,10 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { } var nextNodes = rendering.getNextNodes(); - for( var i = 0; i < array_length(nextNodes); i++ ) { - if(!nextNodes[i].isRenderable()) continue; + for( var i = 0; i < array_length(nextNodes); i++ ) ds_queue_enqueue(RENDER_QUEUE, nextNodes[i]); - } } + printIf(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + txt); } diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index e3a74c948..a6b968ae2 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -1,5 +1,5 @@ //draw -function draw_surface_safe(surface, _x, _y) { +function draw_surface_safe(surface, _x = 0, _y = 0) { if(!is_surface(surface)) return; __channel_pre(surface); diff --git a/shaders/Shader182/Shader182.fsh b/shaders/Shader182/Shader182.fsh deleted file mode 100644 index e28a17897..000000000 --- a/shaders/Shader182/Shader182.fsh +++ /dev/null @@ -1,10 +0,0 @@ -// -// Simple passthrough fragment shader -// -varying vec2 v_vTexcoord; -varying vec4 v_vColour; - -void main() -{ - gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); -} diff --git a/shaders/Shader184/Shader184.fsh b/shaders/Shader184/Shader184.fsh deleted file mode 100644 index e28a17897..000000000 --- a/shaders/Shader184/Shader184.fsh +++ /dev/null @@ -1,10 +0,0 @@ -// -// Simple passthrough fragment shader -// -varying vec2 v_vTexcoord; -varying vec4 v_vColour; - -void main() -{ - gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); -} diff --git a/shaders/sh_surface_replace_find/sh_surface_replace_find.fsh b/shaders/sh_surface_replace_find/sh_surface_replace_find.fsh new file mode 100644 index 000000000..7d72056e1 --- /dev/null +++ b/shaders/sh_surface_replace_find/sh_surface_replace_find.fsh @@ -0,0 +1,61 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 dimension; +uniform sampler2D target; +uniform vec2 target_dim; +uniform float threshold; + +float random (in vec2 st) { + return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); +} + +float matchTemplate(vec2 pos) { + float match = 0.; + vec2 baseTx = 1. / dimension; + vec2 targTx = 1. / target_dim; + + for( float i = 0.; i < target_dim.x; i++ ) + for( float j = 0.; j < target_dim.y; j++ ) { + vec2 bpx = pos + vec2(i, j); + vec4 base = texture2D( gm_BaseTexture, bpx * baseTx ); + vec4 targ = texture2D( target, vec2(i, j) * targTx ); + + if(distance(base.rgb * base.a, targ.rgb * targ.a) <= threshold) + match++; + } + + return match; +} + +void main() { + vec4 base = texture2D( gm_BaseTexture, v_vTexcoord ); + if(base.a == 0.) { + gl_FragColor = vec4(vec3(0.), 0.); + return; + } + + vec2 px = v_vTexcoord * dimension; + + float target_pixels = target_dim.x * target_dim.y * (1. - threshold); + float match = 0.; + vec2 matchPos = vec2(0., 0.); + + for( float i = 0.; i < target_dim.x; i++ ) + for( float j = 0.; j < target_dim.y; j++ ) { + vec2 uv = px - vec2(i, j); + if(uv.x < 0. || uv.y < 0.) continue; + if(uv.x + target_dim.x > dimension.x || uv.y + target_dim.y > dimension.y) continue; + + float matchTemp = matchTemplate(uv); + if(matchTemp > match) { + match = matchTemp; + matchPos = vec2(i, j) / target_dim; + } + } + + gl_FragColor = match >= target_pixels? vec4(matchPos, random(matchPos), 1.) : vec4(vec3(0.), 0.); +} diff --git a/shaders/Shader182/Shader182.vsh b/shaders/sh_surface_replace_find/sh_surface_replace_find.vsh similarity index 100% rename from shaders/Shader182/Shader182.vsh rename to shaders/sh_surface_replace_find/sh_surface_replace_find.vsh diff --git a/shaders/sh_surface_replace_find/sh_surface_replace_find.yy b/shaders/sh_surface_replace_find/sh_surface_replace_find.yy new file mode 100644 index 000000000..ce3ba397b --- /dev/null +++ b/shaders/sh_surface_replace_find/sh_surface_replace_find.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_surface_replace_find", + "parent": { + "name": "surface replace", + "path": "folders/shader/surface replace.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_surface_replace_find185/sh_surface_replace_find185.fsh b/shaders/sh_surface_replace_find185/sh_surface_replace_find185.fsh deleted file mode 100644 index e28a17897..000000000 --- a/shaders/sh_surface_replace_find185/sh_surface_replace_find185.fsh +++ /dev/null @@ -1,10 +0,0 @@ -// -// Simple passthrough fragment shader -// -varying vec2 v_vTexcoord; -varying vec4 v_vColour; - -void main() -{ - gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); -} diff --git a/shaders/sh_surface_replace_replace/sh_surface_replace_replace.fsh b/shaders/sh_surface_replace_replace/sh_surface_replace_replace.fsh new file mode 100644 index 000000000..1bb80d0c0 --- /dev/null +++ b/shaders/sh_surface_replace_replace/sh_surface_replace_replace.fsh @@ -0,0 +1,17 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform sampler2D replace; +uniform vec2 replace_dim; +uniform sampler2D findRes; + +void main() { + vec4 res = texture2D( findRes, v_vTexcoord ); + if(res.a == 1.) + gl_FragColor = texture2D( replace, res.rg ); + else + gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord ); +} diff --git a/shaders/Shader184/Shader184.vsh b/shaders/sh_surface_replace_replace/sh_surface_replace_replace.vsh similarity index 100% rename from shaders/Shader184/Shader184.vsh rename to shaders/sh_surface_replace_replace/sh_surface_replace_replace.vsh diff --git a/shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy b/shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy new file mode 100644 index 000000000..1e077a026 --- /dev/null +++ b/shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_surface_replace_replace", + "parent": { + "name": "surface replace", + "path": "folders/shader/surface replace.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_warp_4points/sh_warp_4points.fsh b/shaders/sh_warp_4points/sh_warp_4points.fsh new file mode 100644 index 000000000..6675cce74 --- /dev/null +++ b/shaders/sh_warp_4points/sh_warp_4points.fsh @@ -0,0 +1,94 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 p0; +uniform vec2 p1; +uniform vec2 p2; +uniform vec2 p3; + +/////////////// SAMPLING /////////////// + +const float PI = 3.14159265358979323846; +uniform int interpolation; +uniform vec2 sampleDimension; + +const int RSIN_RADIUS = 1; + +float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + +vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); + + vec4 sum = vec4(0.0); + float weights = 0.; + + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } + + return sum / weights; +} + +vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); +} + +vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); +} + +/////////////// SAMPLING /////////////// + +void main() { + float px = v_vTexcoord.x; + float py = v_vTexcoord.y; + + vec2 A = (p3 - p0) - (p2 - p1); + vec2 B = (p0 - p1); + vec2 C = (p2 - p1); + vec2 D = p1; + + if(abs(A.x) < 0.001) A.x = 0.001; + if(abs(B.x) < 0.001) B.x = 0.001; + if(abs(C.x) < 0.001) C.x = 0.001; + + if(abs(A.y) < 0.001) A.y = 0.001; + if(abs(B.y) < 0.001) B.y = 0.001; + if(abs(C.y) < 0.001) C.y = 0.001; + + float c1 = (B.y * C.x) + (A.y * D.x) - (B.x * C.y) - (A.x * D.y); + float c2 = (B.y * D.x) - (B.x * D.y); + + float _A = (A.y * C.x) - (A.x * C.y); + + float _B = (A.x * py) + c1 - (A.y * px); + float _C = (B.x * py) + c2 - (B.y * px); + + highp float u = A == 0.? 0. : (-_B - sqrt(_B * _B - 4.0 * _A * _C)) / (_A * 2.0); + highp float v = (u * A.x + B.x) == 0.? 0. : (px - (u * C.x) - D.x) / (u * A.x + B.x); + + vec2 uv = vec2(1. - u, v); + + if(uv.x >= 0. && uv.y >= 0. && uv.x <= 1. && uv.y <= 1.) + gl_FragColor = texture2Dintp( gm_BaseTexture, uv ); + else + gl_FragColor = vec4(0.); +} \ No newline at end of file diff --git a/shaders/sh_surface_replace_find185/sh_surface_replace_find185.vsh b/shaders/sh_warp_4points/sh_warp_4points.vsh similarity index 100% rename from shaders/sh_surface_replace_find185/sh_surface_replace_find185.vsh rename to shaders/sh_warp_4points/sh_warp_4points.vsh diff --git a/shaders/sh_warp_4points/sh_warp_4points.yy b/shaders/sh_warp_4points/sh_warp_4points.yy new file mode 100644 index 000000000..2dbe37996 --- /dev/null +++ b/shaders/sh_warp_4points/sh_warp_4points.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_warp_4points", + "parent": { + "name": "warp", + "path": "folders/shader/warp.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_warp_4points183/sh_warp_4points183.fsh b/shaders/sh_warp_4points183/sh_warp_4points183.fsh deleted file mode 100644 index e28a17897..000000000 --- a/shaders/sh_warp_4points183/sh_warp_4points183.fsh +++ /dev/null @@ -1,10 +0,0 @@ -// -// Simple passthrough fragment shader -// -varying vec2 v_vTexcoord; -varying vec4 v_vColour; - -void main() -{ - gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); -} diff --git a/shaders/sh_warp_4points_pers/sh_warp_4points_pers.fsh b/shaders/sh_warp_4points_pers/sh_warp_4points_pers.fsh new file mode 100644 index 000000000..ba9c53ca2 --- /dev/null +++ b/shaders/sh_warp_4points_pers/sh_warp_4points_pers.fsh @@ -0,0 +1,123 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 f1; +uniform vec2 f2; +uniform vec2 f3; +uniform vec2 f4; +uniform vec2 t1; +uniform vec2 t2; +uniform vec2 t3; +uniform vec2 t4; + +/////////////// SAMPLING /////////////// + +const float PI = 3.14159265358979323846; +uniform int interpolation; +uniform vec2 sampleDimension; + +const int RSIN_RADIUS = 1; + +float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + +vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); + + vec4 sum = vec4(0.0); + float weights = 0.; + + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } + + return sum / weights; +} + +vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); +} + +vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); +} + +/////////////// SAMPLING /////////////// + +mat3 m_inverse(mat3 m) { + float a11 = m[0][0], a12 = m[0][1], a13 = m[0][2]; + float a21 = m[1][0], a22 = m[1][1], a23 = m[1][2]; + float a31 = m[2][0], a32 = m[2][1], a33 = m[2][2]; + + float b11 = a22 * a33 - a23 * a32; + float b12 = a13 * a32 - a12 * a33; + float b13 = a12 * a23 - a13 * a22; + float b21 = a23 * a31 - a21 * a33; + float b22 = a11 * a33 - a13 * a31; + float b23 = a13 * a21 - a11 * a23; + float b31 = a21 * a32 - a22 * a31; + float b32 = a12 * a31 - a11 * a32; + float b33 = a11 * a22 - a12 * a21; + + float det = a11 * b11 + a12 * b21 + a13 * b31; + + mat3 inverse; + inverse[0][0] = b11 / det; + inverse[0][1] = b12 / det; + inverse[0][2] = b13 / det; + inverse[1][0] = b21 / det; + inverse[1][1] = b22 / det; + inverse[1][2] = b23 / det; + inverse[2][0] = b31 / det; + inverse[2][1] = b32 / det; + inverse[2][2] = b33 / det; + + return inverse; +} + +void main() { + vec3 p1 = vec3(f1, 1.0); + vec3 p2 = vec3(f2, 1.0); + vec3 p3 = vec3(f3, 1.0); + vec3 p4 = vec3(f4, 1.0); + vec3 q1 = vec3(t1, 1.0); + vec3 q2 = vec3(t2, 1.0); + vec3 q3 = vec3(t3, 1.0); + vec3 q4 = vec3(t4, 1.0); + + mat3 A = mat3(p1, p2, p3); + vec3 b = p4; + vec3 x = m_inverse(A) * b; + vec3 h1 = x; + vec3 h2 = vec3(q2 - q1); + vec3 h3 = cross(h1, h2); + vec3 h4 = vec3(q3 - q1); + vec3 h5 = cross(h1, h4); + vec3 h6 = vec3(q4 - q1); + vec3 h7 = cross(h1, h6); + mat3 H = mat3(h2 / h3.x, h4 / h5.x, h6 / h7.x); + H[2][2] = 1.0 / h3.x; + + vec3 coord = vec3(v_vTexcoord, 1.0); + vec3 newCoord = H * coord; + vec2 texCoord = newCoord.xy / newCoord.z; + + gl_FragColor = texture2Dintp(gm_BaseTexture, texCoord); +} \ No newline at end of file diff --git a/shaders/sh_warp_4points183/sh_warp_4points183.vsh b/shaders/sh_warp_4points_pers/sh_warp_4points_pers.vsh similarity index 100% rename from shaders/sh_warp_4points183/sh_warp_4points183.vsh rename to shaders/sh_warp_4points_pers/sh_warp_4points_pers.vsh diff --git a/shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy b/shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy new file mode 100644 index 000000000..15afdf55f --- /dev/null +++ b/shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_warp_4points_pers", + "parent": { + "name": "warp", + "path": "folders/shader/warp.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/sprites/s_node_base_conversion/8f5ef343-0765-4267-8c9b-30f46b265120.png b/sprites/s_node_base_conversion/8f5ef343-0765-4267-8c9b-30f46b265120.png new file mode 100644 index 000000000..79440bdca Binary files /dev/null and b/sprites/s_node_base_conversion/8f5ef343-0765-4267-8c9b-30f46b265120.png differ diff --git a/sprites/s_node_base_conversion/layers/8f5ef343-0765-4267-8c9b-30f46b265120/d068b122-7d27-4f96-88b3-2dbdda1fe515.png b/sprites/s_node_base_conversion/layers/8f5ef343-0765-4267-8c9b-30f46b265120/d068b122-7d27-4f96-88b3-2dbdda1fe515.png new file mode 100644 index 000000000..79440bdca Binary files /dev/null and b/sprites/s_node_base_conversion/layers/8f5ef343-0765-4267-8c9b-30f46b265120/d068b122-7d27-4f96-88b3-2dbdda1fe515.png differ diff --git a/sprites/s_node_base_conversion/s_node_base_conversion.yy b/sprites/s_node_base_conversion/s_node_base_conversion.yy new file mode 100644 index 000000000..e7ce744cc --- /dev/null +++ b/sprites/s_node_base_conversion/s_node_base_conversion.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_base_conversion", + "bbox_bottom": 61, + "bbox_left": 5, + "bbox_right": 58, + "bbox_top": 2, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"8f5ef343-0765-4267-8c9b-30f46b265120",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"d068b122-7d27-4f96-88b3-2dbdda1fe515","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "number", + "path": "folders/nodes/icons/value/number.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_base_conversion", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"8f5ef343-0765-4267-8c9b-30f46b265120","path":"sprites/s_node_base_conversion/s_node_base_conversion.yy",},},},"Disabled":false,"id":"49080284-00fd-46a8-942f-694d0b6874f1","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file diff --git a/sprites/s_node_path_anchor/4cb2f931-05ab-4688-9386-ebb9abcb610f.png b/sprites/s_node_path_anchor/4cb2f931-05ab-4688-9386-ebb9abcb610f.png new file mode 100644 index 000000000..3a30970d3 Binary files /dev/null and b/sprites/s_node_path_anchor/4cb2f931-05ab-4688-9386-ebb9abcb610f.png differ diff --git a/sprites/s_node_path_anchor/layers/4cb2f931-05ab-4688-9386-ebb9abcb610f/b11b18ac-301f-4e35-b417-368060b829b6.png b/sprites/s_node_path_anchor/layers/4cb2f931-05ab-4688-9386-ebb9abcb610f/b11b18ac-301f-4e35-b417-368060b829b6.png new file mode 100644 index 000000000..3a30970d3 Binary files /dev/null and b/sprites/s_node_path_anchor/layers/4cb2f931-05ab-4688-9386-ebb9abcb610f/b11b18ac-301f-4e35-b417-368060b829b6.png differ diff --git a/sprites/s_node_path_anchor/s_node_path_anchor.yy b/sprites/s_node_path_anchor/s_node_path_anchor.yy new file mode 100644 index 000000000..bddeba1ec --- /dev/null +++ b/sprites/s_node_path_anchor/s_node_path_anchor.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_path_anchor", + "bbox_bottom": 60, + "bbox_left": 3, + "bbox_right": 60, + "bbox_top": 3, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"4cb2f931-05ab-4688-9386-ebb9abcb610f",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"b11b18ac-301f-4e35-b417-368060b829b6","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "path", + "path": "folders/nodes/icons/value/path.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_path_anchor", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"4cb2f931-05ab-4688-9386-ebb9abcb610f","path":"sprites/s_node_path_anchor/s_node_path_anchor.yy",},},},"Disabled":false,"id":"8269fa6b-95c8-404c-bf4f-c0cfc7b80e09","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file