From 6d9b90ca2a4cfc99ac493102cf7639debaf88cd7 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 8 Jun 2024 11:31:21 +0700 Subject: [PATCH] several things --- PixelComposer.resource_order | 4 +- PixelComposer.yyp | 6 +- .../__node_VFX_effector.gml | 2 +- scripts/__polygon/__polygon.gml | 10 +- .../_node_VFX_spawner/_node_VFX_spawner.gml | 2 +- scripts/lerp_float/lerp_float.gml | 4 +- .../nodd_mk_delay_machine.gml | 2 +- .../node_FLIP_spawner/node_FLIP_spawner.gml | 2 +- .../node_array_shuffle/node_array_shuffle.gml | 2 +- .../node_ase_file_read/node_ase_file_read.gml | 72 +-- scripts/node_ase_layer/node_ase_layer.gml | 24 +- scripts/node_caustic/node_caustic.gml | 2 +- scripts/node_cellular/node_cellular.gml | 2 +- scripts/node_data/node_data.gml | 1 + scripts/node_diffuse/node_diffuse.gml | 2 +- scripts/node_dither/node_dither.gml | 2 +- scripts/node_fn_wiggler/node_fn_wiggler.gml | 2 +- scripts/node_gabor_noise/node_gabor_noise.gml | 2 +- scripts/node_grid/node_grid.gml | 2 +- scripts/node_grid_hex/node_grid_hex.gml | 2 +- scripts/node_grid_noise/node_grid_noise.gml | 2 +- .../node_grid_pentagonal.gml | 2 +- scripts/node_grid_tri/node_grid_tri.gml | 2 +- .../node_herringbone_tile.gml | 2 +- scripts/node_lovify/node_lovify.gml | 2 +- scripts/node_mesh_warp/node_mesh_warp.gml | 2 +- scripts/node_mk_blinker/node_mk_blinker.gml | 2 +- scripts/node_mk_brownian/node_mk_brownian.gml | 2 +- scripts/node_mk_fall/node_mk_fall.gml | 2 +- .../node_mk_gridballs/node_mk_gridballs.gml | 2 +- scripts/node_mk_gridflip/node_mk_gridflip.gml | 2 +- scripts/node_mk_rain/node_mk_rain.gml | 2 +- scripts/node_noise/node_noise.gml | 2 +- scripts/node_noise_aniso/node_noise_aniso.gml | 2 +- .../node_noise_bubble/node_noise_bubble.gml | 2 +- scripts/node_noise_fbm/node_noise_fbm.gml | 2 +- scripts/node_noise_hex/node_noise_hex.gml | 2 +- .../node_noise_strand/node_noise_strand.gml | 2 +- scripts/node_noise_tri/node_noise_tri.gml | 2 +- .../node_palette_extract.gml | 2 +- .../node_path_l_system/node_path_l_system.gml | 2 +- scripts/node_path_wave/node_path_wave.gml | 2 +- .../node_pb_fx_highlight.gml | 2 +- scripts/node_perlin/node_perlin.gml | 2 +- .../node_perlin_extra/node_perlin_extra.gml | 2 +- scripts/node_pixel_cloud/node_pixel_cloud.gml | 2 +- .../node_pytagorean_tile.gml | 2 +- .../node_random_shape/node_random_shape.gml | 2 +- scripts/node_random_tile/node_random_tile.gml | 2 +- scripts/node_region_fill/node_region_fill.gml | 2 +- scripts/node_repeat/node_repeat.gml | 2 +- .../node_rigid_object_spawner.gml | 2 +- scripts/node_scatter/node_scatter.gml | 2 +- .../node_scatter_points.gml | 2 +- scripts/node_shard_noise/node_shard_noise.gml | 2 +- scripts/node_shell/node_shell.gml | 2 +- .../node_smoke_turbulence.gml | 2 +- .../node_strand_break/node_strand_break.gml | 2 +- .../node_strand_create/node_strand_create.gml | 2 +- .../node_strand_force_apply.gml | 2 +- .../node_strand_render/node_strand_render.gml | 2 +- .../node_strand_render_texture.gml | 2 +- .../node_surface_replace.gml | 2 +- scripts/node_svg/node_svg.gml | 16 +- .../node_voronoi_extra/node_voronoi_extra.gml | 2 +- .../node_wavelet_noise/node_wavelet_noise.gml | 2 +- scripts/surfaceBox/surfaceBox.gml | 10 +- scripts/svg_objects/svg_objects.gml | 508 ++++++++++++++++-- scripts/svg_reader/svg_reader.gml | 12 +- .../sh_svg_curve_quad/sh_svg_curve_quad.fsh | 7 + .../sh_svg_curve_quad/sh_svg_curve_quad.vsh | 19 + .../sh_svg_curve_quad/sh_svg_curve_quad.yy | 12 + shaders/sh_svg_fill/sh_svg_fill.fsh | 16 + shaders/sh_svg_fill/sh_svg_fill.vsh | 19 + shaders/sh_svg_fill/sh_svg_fill.yy | 12 + 75 files changed, 709 insertions(+), 159 deletions(-) create mode 100644 shaders/sh_svg_curve_quad/sh_svg_curve_quad.fsh create mode 100644 shaders/sh_svg_curve_quad/sh_svg_curve_quad.vsh create mode 100644 shaders/sh_svg_curve_quad/sh_svg_curve_quad.yy create mode 100644 shaders/sh_svg_fill/sh_svg_fill.fsh create mode 100644 shaders/sh_svg_fill/sh_svg_fill.vsh create mode 100644 shaders/sh_svg_fill/sh_svg_fill.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 1e812a73e..3aa5ebded 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -24,8 +24,8 @@ {"name":"Compat","order":6,"path":"folders/functions/fluid_sim/Compat.yy",}, {"name":"Internal","order":7,"path":"folders/functions/fluid_sim/Internal.yy",}, {"name":"Shaders","order":8,"path":"folders/functions/fluid_sim/Shaders.yy",}, - {"name":"svg","order":47,"path":"folders/functions/svg.yy",}, {"name":"dynamic_surface","order":8,"path":"folders/functions/surface/dynamic_surface.yy",}, + {"name":"svg","order":47,"path":"folders/functions/svg.yy",}, {"name":"__base__","order":11,"path":"folders/nodes/data/__base__.yy",}, {"name":"3D","order":12,"path":"folders/nodes/data/3D.yy",}, {"name":"2d_effects","order":1,"path":"folders/nodes/data/3D/2d_effects.yy",}, @@ -164,6 +164,7 @@ {"name":"Flag","order":3,"path":"folders/shader/MK effects/Flag.yy",}, {"name":"Tile","order":4,"path":"folders/shader/MK effects/Tile.yy",}, {"name":"ray march","order":1,"path":"folders/shader/ray march.yy",}, + {"name":"svg","order":2,"path":"folders/shader/svg.yy",}, {"name":"histogram","order":3,"path":"folders/shader/UI/histogram.yy",}, {"name":"node","order":5,"path":"folders/shader/UI/node.yy",}, {"name":"palette mixer","order":2,"path":"folders/shader/UI/palette mixer.yy",}, @@ -1517,6 +1518,7 @@ {"name":"sh_surface_replace_fast_find","order":2,"path":"shaders/sh_surface_replace_fast_find/sh_surface_replace_fast_find.yy",}, {"name":"sh_surface_replace_fast_replace","order":3,"path":"shaders/sh_surface_replace_fast_replace/sh_surface_replace_fast_replace.yy",}, {"name":"sh_surface_replace_replace","order":1,"path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",}, + {"name":"sh_svg_fill","order":1,"path":"shaders/sh_svg_fill/sh_svg_fill.yy",}, {"name":"sh_texture_atlas","order":22,"path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",}, {"name":"sh_texture_remap","order":11,"path":"shaders/sh_texture_remap/sh_texture_remap.yy",}, {"name":"sh_threshold","order":18,"path":"shaders/sh_threshold/sh_threshold.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index ed100ca94..47aafccf9 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -90,7 +90,6 @@ {"$GMFolder":"","%Name":"Shaders","folderPath":"folders/functions/fluid_sim/Shaders.yy","name":"Shaders","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"geometry","folderPath":"folders/functions/geometry.yy","name":"geometry","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"GLSL","folderPath":"folders/functions/GLSL.yy","name":"GLSL","resourceType":"GMFolder","resourceVersion":"2.0",}, - {"$GMFolder":"","%Name":"svg","folderPath":"folders/functions/svg.yy","name":"svg","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"importers","folderPath":"folders/functions/importers.yy","name":"importers","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"inputs","folderPath":"folders/functions/inputs.yy","name":"inputs","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"lua","folderPath":"folders/functions/lua.yy","name":"lua","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -107,6 +106,7 @@ {"$GMFolder":"","%Name":"string","folderPath":"folders/functions/string.yy","name":"string","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"surface","folderPath":"folders/functions/surface.yy","name":"surface","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"dynamic_surface","folderPath":"folders/functions/surface/dynamic_surface.yy","name":"dynamic_surface","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"svg","folderPath":"folders/functions/svg.yy","name":"svg","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"test","folderPath":"folders/functions/test.yy","name":"test","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"tooltip","folderPath":"folders/functions/tooltip.yy","name":"tooltip","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"tween","folderPath":"folders/functions/tween.yy","name":"tween","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -300,6 +300,7 @@ {"$GMFolder":"","%Name":"pixel_builder","folderPath":"folders/shader/pixel_builder.yy","name":"pixel_builder","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"ray march","folderPath":"folders/shader/ray march.yy","name":"ray march","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"sprites","folderPath":"folders/shader/sprites.yy","name":"sprites","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"svg","folderPath":"folders/shader/svg.yy","name":"svg","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"transition","folderPath":"folders/shader/transition.yy","name":"transition","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"UI","folderPath":"folders/shader/UI.yy","name":"UI","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"histogram","folderPath":"folders/shader/UI/histogram.yy","name":"histogram","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -471,7 +472,6 @@ {"$GMIncludedFile":"","%Name":"CommonVS.hlsl","CopyToMask":-1,"filePath":"datafiles/Shaders/3dInstance","name":"CommonVS.hlsl","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"rubber_duck_toy_1k.bin","CopyToMask":-1,"filePath":"datafiles/Shaders/3dInstance","name":"rubber_duck_toy_1k.bin","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"snap_license.txt","CopyToMask":-1,"filePath":"datafiles","name":"snap_license.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, - {"$GMIncludedFile":"","%Name":"snap_license.txt","CopyToMask":-1,"filePath":"datafiles","name":"snap_license.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"ucrtbased.dll","ConfigValues":{},"CopyToMask":-1,"filePath":"datafiles","name":"ucrtbased.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"webpmux.exe","CopyToMask":-1,"filePath":"datafiles/webp","name":"webpmux.exe","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, @@ -2059,6 +2059,8 @@ {"id":{"name":"sh_surface_replace_fast_replace","path":"shaders/sh_surface_replace_fast_replace/sh_surface_replace_fast_replace.yy",},}, {"id":{"name":"sh_surface_replace_find","path":"shaders/sh_surface_replace_find/sh_surface_replace_find.yy",},}, {"id":{"name":"sh_surface_replace_replace","path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},}, + {"id":{"name":"sh_svg_curve_quad","path":"shaders/sh_svg_curve_quad/sh_svg_curve_quad.yy",},}, + {"id":{"name":"sh_svg_fill","path":"shaders/sh_svg_fill/sh_svg_fill.yy",},}, {"id":{"name":"sh_texture_atlas","path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",},}, {"id":{"name":"sh_texture_remap","path":"shaders/sh_texture_remap/sh_texture_remap.yy",},}, {"id":{"name":"sh_threshold","path":"shaders/sh_threshold/sh_threshold.yy",},}, diff --git a/scripts/__node_VFX_effector/__node_VFX_effector.gml b/scripts/__node_VFX_effector/__node_VFX_effector.gml index 31ca34d34..fe71a49f6 100644 --- a/scripts/__node_VFX_effector/__node_VFX_effector.gml +++ b/scripts/__node_VFX_effector/__node_VFX_effector.gml @@ -49,7 +49,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr .rejectArray(); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) .rejectArray(); effector_input_length = ds_list_size(inputs); diff --git a/scripts/__polygon/__polygon.gml b/scripts/__polygon/__polygon.gml index bbda92b8f..5d7c8b2d8 100644 --- a/scripts/__polygon/__polygon.gml +++ b/scripts/__polygon/__polygon.gml @@ -85,10 +85,10 @@ function polygon_triangulate_convex(points) { #region } #endregion function polygon_triangulate(points, tolerance = 4) { #region // ear clipping - if(array_length(points) < 3) return [ [], points ]; + if(array_length(points) < 3) return [ [], points, 1 ]; if(tolerance > 0) points = polygon_simplify(points, tolerance); - if(array_length(points) < 3) return [ [], points ]; + if(array_length(points) < 3) return [ [], points, 1 ]; var classes = polygon_points_classify(points); var convexes = classes[0]; @@ -96,7 +96,7 @@ function polygon_triangulate(points, tolerance = 4) { #region // ear clipping var checkSide = classes[2]; if(array_length(reflected) == 0) - return [ polygon_triangulate_convex(points), points ]; + return [ polygon_triangulate_convex(points), points, checkSide ]; var pointInd = array_create_ext(array_length(points), function(i) /*=>*/ { return i; }); var triangles = []; @@ -105,7 +105,7 @@ function polygon_triangulate(points, tolerance = 4) { #region // ear clipping //print($"Ear cutting : {array_length(points)} verticies"); while(array_length(pointInd) > 3) { - if(array_length(convexes) == 0) return [ triangles, points ]; + if(array_length(convexes) == 0) return [ triangles, points, checkSide ]; var len = array_length(pointInd); var c0 = convexes[0]; @@ -182,7 +182,7 @@ function polygon_triangulate(points, tolerance = 4) { #region // ear clipping if(array_length(pointInd) == 3) array_push(triangles, [ points[pointInd[0]], points[pointInd[1]], points[pointInd[2]] ]); - return [ triangles, points ]; + return [ triangles, points, checkSide ]; } #endregion function polygon_triangulate_convex_fan(points) { #region diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index c1c7ebc8b..5290d65a8 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -92,7 +92,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 31] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [] ); inputs[| 32] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 32].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 32].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 33] = nodeValue("Gravity direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, -90 ) .setDisplay(VALUE_DISPLAY.rotation); diff --git a/scripts/lerp_float/lerp_float.gml b/scripts/lerp_float/lerp_float.gml index a9dff7604..03e501d20 100644 --- a/scripts/lerp_float/lerp_float.gml +++ b/scripts/lerp_float/lerp_float.gml @@ -32,4 +32,6 @@ function lerp_float_angle(from, to, ratio) { function lerp_color(from, to, ratio) { if(abs(from - to) < 1) return to; return merge_color(from, to, ratio); -} \ No newline at end of file +} + +function lerp_invert(val, from, to) { return (val - from) / (to - from); } \ No newline at end of file diff --git a/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml b/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml index 283ef0124..566786b8a 100644 --- a/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml +++ b/scripts/nodd_mk_delay_machine/nodd_mk_delay_machine.gml @@ -19,7 +19,7 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Loop", "Pingpong", "Random" ]); inputs[| 6] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); diff --git a/scripts/node_FLIP_spawner/node_FLIP_spawner.gml b/scripts/node_FLIP_spawner/node_FLIP_spawner.gml index bb559f500..72a1ba461 100644 --- a/scripts/node_FLIP_spawner/node_FLIP_spawner.gml +++ b/scripts/node_FLIP_spawner/node_FLIP_spawner.gml @@ -32,7 +32,7 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); inputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 10] = nodeValue("Spawn Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 45, 135, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_random); diff --git a/scripts/node_array_shuffle/node_array_shuffle.gml b/scripts/node_array_shuffle/node_array_shuffle.gml index ee7fcf791..77eec603c 100644 --- a/scripts/node_array_shuffle/node_array_shuffle.gml +++ b/scripts/node_array_shuffle/node_array_shuffle.gml @@ -7,7 +7,7 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const .setVisible(true, true); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) .rejectArray(); outputs[| 0] = nodeValue("Shuffled array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); 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 b2f60646d..aeac3e364 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_ASE_File_Read(_x, _y, _group = noone) { #region +function Node_create_ASE_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("Aseprite file (*.aseprite, *.ase)|*.aseprite;*.ase", ""); @@ -11,9 +11,9 @@ function Node_create_ASE_File_Read(_x, _y, _group = noone) { #region if(NODE_NEW_MANUAL) node.doUpdate(); return node; -} #endregion +} -function Node_create_ASE_File_Read_path(_x, _y, path) { #region +function Node_create_ASE_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_ASE_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_ASE_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "ASE File In"; @@ -49,7 +49,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const .setDisplay(VALUE_DISPLAY.palette); hold_visibility = true; - layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region + layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var amo = array_length(layers); var hh = 28; var _h = hh * amo + 16; @@ -85,9 +85,9 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } return _h; - }); #endregion + }); - tag_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region + tag_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var current_tag = getInputData(2); var amo = array_length(tags); var abx = ui(24); @@ -118,19 +118,20 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_sprite_stretched_ext(THEME.timeline_node, 0, _x + 8, _tgy, _w - 16, _tgh, cc, 0.5); draw_sprite_stretched_ext(THEME.timeline_node, 0, _x + 8, _tgy, (_w - 16) * prog, _tgh, cc, 0.85); - draw_sprite_stretched_ext(THEME.timeline_node, 1, _x + 8, _tgy, (_w - 16) * prog, _tgh, c_white, 0.25); + draw_sprite_stretched_add(THEME.timeline_node, 1, _x + 8, _tgy, (_w - 16) * prog, _tgh, c_white, 0.1); txt = $"{progFr}/{rn}"; } else { - draw_sprite_stretched_ext(THEME.timeline_node, 0, _x + 8, _tgy, 8, _tgh, cc, 0.85); - draw_sprite_stretched_ext(THEME.timeline_node, 1, _x + 8, _tgy, 8, _tgh, c_white, 0.25); + draw_sprite_stretched_ext(THEME.timeline_node, 0, _x + 8, _tgy, 10, _tgh, cc, 0.85); + draw_sprite_stretched_add(THEME.timeline_node, 1, _x + 8, _tgy, 10, _tgh, c_white, 0.1); txt = $"{rn}"; } if(_hover && point_in_rectangle(_m[0], _m[1], _x + 8, _yy, _x + _w - 8, _yy + hh)) { - draw_sprite_stretched_ext(THEME.timeline_node, 0, _x + 8, _tgy, _w - 16, _tgh, c_white, 0.1); + draw_sprite_stretched_add(THEME.timeline_node, 0, _x + 8, _tgy, _w - 16, _tgh, c_white, 0.1); + if(mouse_press(mb_left, _focus)) { var _currTag = getInputData(2); var _tagName = tag[? "Name"]; @@ -139,15 +140,19 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); - draw_text_add(_x + 24, _yy + hh / 2, tag[? "Name"]); + draw_set_alpha(1); + draw_text_add(_x + 28, _yy + hh / 2, tag[? "Name"]); - draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub); + draw_set_halign(fa_right); + draw_set_alpha(0.4); draw_text_add(_x + _w - 20, _yy + hh / 2, txt); + + draw_set_alpha(1); } tag_renderer.h = _h; return _h; - }); #endregion + }); input_display_list = [ ["File", true], 0, @@ -170,13 +175,13 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const first_update = false; - on_drop_file = function(path) { #region + on_drop_file = function(path) { inputs[| 0].setValue(path); doUpdate(); return true; - } #endregion + } - function refreshLayers() { #region + function refreshLayers() { var _nh = 64; var nx = x + w + 32; var nh = (array_length(layers) - 1) / 2 * _nh; @@ -208,11 +213,14 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const lvs[i].inputs[| 1].setValue(use_cel); lvs[i].setDisplayName(_name); } - } #endregion + } - function updatePaths(path = path_current) { #region + function updatePaths(path = path_current) { if(path == -1) return false; - if(!file_exists_empty(path)) return false; + if(!file_exists_empty(path)) { + noti_warning("File not exist."); + return false; + } path_current = path; edit_time = max(edit_time, file_get_modify_s(path_current)); @@ -288,27 +296,27 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } return true; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - static step = function() { #region + static step = function() { if(!attributes.file_checker) return; - if(path_current == "") return; + if(!file_exists_empty(path_current)) return; if(file_get_modify_s(path_current) > edit_time) { updatePaths(); triggerRender(); } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); var current_tag = getInputData(2); @@ -359,19 +367,19 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_surface_safe(_inSurf, xx, yy); } surface_reset_target(); - } #endregion + } - static attributeSerialize = function() { #region + static attributeSerialize = function() { var att = {}; att.layer_visible = attributes.layer_visible; return att; - } #endregion + } - static attributeDeserialize = function(attr) { #region + static attributeDeserialize = function(attr) { struct_append(attributes, attr); if(struct_has(attr, "layer_visible")) attributes.layer_visible = attr.layer_visible; - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index 4bd93a69b..927a16b9a 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -16,31 +16,23 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct static onValueFromUpdate = function(index) { findLayer(); } static findLayer = function() { #region + layer_object = noone; + var data = getInputData(0); if(data == noone) return; - var layer_index = 0; - layer_object = noone; - for( var i = 0, n = array_length(data.layers); i < n; i++ ) { - if(data.layers[i].name != display_name) continue; - - layer_object = data.layers[i]; - break; + if(data.layers[i].name == display_name) + layer_object = data.layers[i]; } } #endregion static update = function(frame = CURRENT_FRAME) { #region - var data = getInputData(0); - if(data == noone) return; - - if(_name != display_name) { - _name = display_name; - findLayer(); - } - + findLayer(); if(layer_object == noone) return; - var cel = layer_object.getCel(CURRENT_FRAME - data._tag_delay); + + var data = getInputData(0); + var cel = layer_object.getCel(CURRENT_FRAME - data._tag_delay); var celDim = getInputData(1); var ww = data.content[? "Width"]; diff --git a/scripts/node_caustic/node_caustic.gml b/scripts/node_caustic/node_caustic.gml index cea328d18..df474d398 100644 --- a/scripts/node_caustic/node_caustic.gml +++ b/scripts/node_caustic/node_caustic.gml @@ -12,7 +12,7 @@ function Node_Caustic(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _g addShaderProp(SHADER_UNIFORM.float, "scale"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) diff --git a/scripts/node_cellular/node_cellular.gml b/scripts/node_cellular/node_cellular.gml index 8a9254b00..55d5cb1e5 100644 --- a/scripts/node_cellular/node_cellular.gml +++ b/scripts/node_cellular/node_cellular.gml @@ -12,7 +12,7 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setMappable(11); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 4] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Point", "Edge", "Cell", "Crystal" ]); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index f371c6bfd..24aa31ec6 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1328,6 +1328,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { for(var i = 0; i < ds_list_size(outputs); i++) { var jun = outputs[| i]; + if(!jun.isVisible()) continue; if(jun.drawJunction_fast(_s, _mx, _my)) hover = jun; diff --git a/scripts/node_diffuse/node_diffuse.gml b/scripts/node_diffuse/node_diffuse.gml index 3d0d1da8a..57e07b172 100644 --- a/scripts/node_diffuse/node_diffuse.gml +++ b/scripts/node_diffuse/node_diffuse.gml @@ -17,7 +17,7 @@ function Node_Diffuse(_x, _y, _group = noone) : Node(_x, _y, _group) constructor .setDisplay(VALUE_DISPLAY.slider_range); inputs[| 6] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 7] = nodeValue("External", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 7c73d3a07..d253915a7 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -49,7 +49,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co __init_mask_modifier(7); // inputs 11, 12, inputs[| 13] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 13].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 13].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 14] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); diff --git a/scripts/node_fn_wiggler/node_fn_wiggler.gml b/scripts/node_fn_wiggler/node_fn_wiggler.gml index ff430c04c..91724680b 100644 --- a/scripts/node_fn_wiggler/node_fn_wiggler.gml +++ b/scripts/node_fn_wiggler/node_fn_wiggler.gml @@ -8,7 +8,7 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) construc .setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] }); inputs[| inl + 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| inl + 3] = nodeValue("Clip", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b11 ) .setDisplay(VALUE_DISPLAY.toggle, { data : [ "Start", "End" ] }); diff --git a/scripts/node_gabor_noise/node_gabor_noise.gml b/scripts/node_gabor_noise/node_gabor_noise.gml index e3629f33a..bb8f31b01 100644 --- a/scripts/node_gabor_noise/node_gabor_noise.gml +++ b/scripts/node_gabor_noise/node_gabor_noise.gml @@ -13,7 +13,7 @@ function Node_Gabor_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y addShaderProp(SHADER_UNIFORM.float, "scale"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) diff --git a/scripts/node_grid/node_grid.gml b/scripts/node_grid/node_grid.gml index 7c5d1cde7..14a74ad92 100644 --- a/scripts/node_grid/node_grid.gml +++ b/scripts/node_grid/node_grid.gml @@ -38,7 +38,7 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid", "Texture sample"]); inputs[| 11] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 11].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 11].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 12] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); diff --git a/scripts/node_grid_hex/node_grid_hex.gml b/scripts/node_grid_hex/node_grid_hex.gml index e8d0d3a99..481e63e46 100644 --- a/scripts/node_grid_hex/node_grid_hex.gml +++ b/scripts/node_grid_hex/node_grid_hex.gml @@ -29,7 +29,7 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid", "Texture sample"]); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); diff --git a/scripts/node_grid_noise/node_grid_noise.gml b/scripts/node_grid_noise/node_grid_noise.gml index 6d096038b..ab3953a67 100644 --- a/scripts/node_grid_noise/node_grid_noise.gml +++ b/scripts/node_grid_noise/node_grid_noise.gml @@ -12,7 +12,7 @@ function Node_Grid_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group .setDisplay(VALUE_DISPLAY.vector); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 4] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, { range: [-0.5, 0.5, 0.01] }); diff --git a/scripts/node_grid_pentagonal/node_grid_pentagonal.gml b/scripts/node_grid_pentagonal/node_grid_pentagonal.gml index f491f37a2..76dc33c5d 100644 --- a/scripts/node_grid_pentagonal/node_grid_pentagonal.gml +++ b/scripts/node_grid_pentagonal/node_grid_pentagonal.gml @@ -31,7 +31,7 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _ .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid"]); inputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 10] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); diff --git a/scripts/node_grid_tri/node_grid_tri.gml b/scripts/node_grid_tri/node_grid_tri.gml index 4fe21590e..81b7794b5 100644 --- a/scripts/node_grid_tri/node_grid_tri.gml +++ b/scripts/node_grid_tri/node_grid_tri.gml @@ -31,7 +31,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid", "Texture sample"]); inputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 10] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); diff --git a/scripts/node_herringbone_tile/node_herringbone_tile.gml b/scripts/node_herringbone_tile/node_herringbone_tile.gml index 07c92cf28..49207641e 100644 --- a/scripts/node_herringbone_tile/node_herringbone_tile.gml +++ b/scripts/node_herringbone_tile/node_herringbone_tile.gml @@ -29,7 +29,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid"]); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); diff --git a/scripts/node_lovify/node_lovify.gml b/scripts/node_lovify/node_lovify.gml index 374913276..110538139 100644 --- a/scripts/node_lovify/node_lovify.gml +++ b/scripts/node_lovify/node_lovify.gml @@ -5,7 +5,7 @@ function Node_Lovify(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 ) .setDisplay(VALUE_DISPLAY.slider); diff --git a/scripts/node_mesh_warp/node_mesh_warp.gml b/scripts/node_mesh_warp/node_mesh_warp.gml index 105e44c44..62d0e80f3 100644 --- a/scripts/node_mesh_warp/node_mesh_warp.gml +++ b/scripts/node_mesh_warp/node_mesh_warp.gml @@ -228,7 +228,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) new scrollItem("Custom", s_node_mesh_type, 1), ] ); inputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/node_mk_blinker/node_mk_blinker.gml b/scripts/node_mk_blinker/node_mk_blinker.gml index 49e7b86cd..6d8b9327f 100644 --- a/scripts/node_mk_blinker/node_mk_blinker.gml +++ b/scripts/node_mk_blinker/node_mk_blinker.gml @@ -6,7 +6,7 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 3] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); diff --git a/scripts/node_mk_brownian/node_mk_brownian.gml b/scripts/node_mk_brownian/node_mk_brownian.gml index 4c2cebb5b..e934680b6 100644 --- a/scripts/node_mk_brownian/node_mk_brownian.gml +++ b/scripts/node_mk_brownian/node_mk_brownian.gml @@ -22,7 +22,7 @@ function Node_MK_Brownian(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 7] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Angular speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -45, 45 ]) .setDisplay(VALUE_DISPLAY.range); diff --git a/scripts/node_mk_fall/node_mk_fall.gml b/scripts/node_mk_fall/node_mk_fall.gml index 51691ce87..545335b02 100644 --- a/scripts/node_mk_fall/node_mk_fall.gml +++ b/scripts/node_mk_fall/node_mk_fall.gml @@ -8,7 +8,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor .setDisplay(VALUE_DISPLAY.vector); inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 3] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_AREA) .setDisplay(VALUE_DISPLAY.area); diff --git a/scripts/node_mk_gridballs/node_mk_gridballs.gml b/scripts/node_mk_gridballs/node_mk_gridballs.gml index 8b5318a8d..2ee149bc3 100644 --- a/scripts/node_mk_gridballs/node_mk_gridballs.gml +++ b/scripts/node_mk_gridballs/node_mk_gridballs.gml @@ -15,7 +15,7 @@ function Node_MK_GridBalls(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro inputs[| 4] = nodeValue("Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 6] = nodeValue("Shading", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); diff --git a/scripts/node_mk_gridflip/node_mk_gridflip.gml b/scripts/node_mk_gridflip/node_mk_gridflip.gml index b7ec9bb95..d4ecd6d98 100644 --- a/scripts/node_mk_gridflip/node_mk_gridflip.gml +++ b/scripts/node_mk_gridflip/node_mk_gridflip.gml @@ -10,7 +10,7 @@ function Node_MK_GridFlip(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou .setDisplay(VALUE_DISPLAY.vector); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 4] = nodeValue("Surface back", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); diff --git a/scripts/node_mk_rain/node_mk_rain.gml b/scripts/node_mk_rain/node_mk_rain.gml index a598b9eb2..a1362ea09 100644 --- a/scripts/node_mk_rain/node_mk_rain.gml +++ b/scripts/node_mk_rain/node_mk_rain.gml @@ -24,7 +24,7 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c .setDisplay(VALUE_DISPLAY.range); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Rain", s_node_mk_rain_type, 0), diff --git a/scripts/node_noise/node_noise.gml b/scripts/node_noise/node_noise.gml index e77daa2f8..6a9600452 100644 --- a/scripts/node_noise/node_noise.gml +++ b/scripts/node_noise/node_noise.gml @@ -5,7 +5,7 @@ function Node_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]); diff --git a/scripts/node_noise_aniso/node_noise_aniso.gml b/scripts/node_noise_aniso/node_noise_aniso.gml index e0c18742b..8fd2820b7 100644 --- a/scripts/node_noise_aniso/node_noise_aniso.gml +++ b/scripts/node_noise_aniso/node_noise_aniso.gml @@ -8,7 +8,7 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou .setMappable(6); inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 3] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) diff --git a/scripts/node_noise_bubble/node_noise_bubble.gml b/scripts/node_noise_bubble/node_noise_bubble.gml index bc6a0c71b..d96271661 100644 --- a/scripts/node_noise_bubble/node_noise_bubble.gml +++ b/scripts/node_noise_bubble/node_noise_bubble.gml @@ -7,7 +7,7 @@ function Node_Noise_Bubble(_x, _y, _group = noone) : Node_Shader_Generator(_x, _ addShaderProp(SHADER_UNIFORM.float, "density"); inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.8 ] ) diff --git a/scripts/node_noise_fbm/node_noise_fbm.gml b/scripts/node_noise_fbm/node_noise_fbm.gml index 68ab7c969..7e95d43c8 100644 --- a/scripts/node_noise_fbm/node_noise_fbm.gml +++ b/scripts/node_noise_fbm/node_noise_fbm.gml @@ -5,7 +5,7 @@ function Node_Noise_FBM(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); diff --git a/scripts/node_noise_hex/node_noise_hex.gml b/scripts/node_noise_hex/node_noise_hex.gml index 80307c4b9..27420e400 100644 --- a/scripts/node_noise_hex/node_noise_hex.gml +++ b/scripts/node_noise_hex/node_noise_hex.gml @@ -15,7 +15,7 @@ function Node_Noise_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0] ) .setDisplay(VALUE_DISPLAY.vector); diff --git a/scripts/node_noise_strand/node_noise_strand.gml b/scripts/node_noise_strand/node_noise_strand.gml index 06594c8f1..f9f142771 100644 --- a/scripts/node_noise_strand/node_noise_strand.gml +++ b/scripts/node_noise_strand/node_noise_strand.gml @@ -12,7 +12,7 @@ function Node_Noise_Strand(_x, _y, _group = noone) : Node_Shader_Generator(_x, _ addShaderProp(SHADER_UNIFORM.float, "density"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Slope", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 ) diff --git a/scripts/node_noise_tri/node_noise_tri.gml b/scripts/node_noise_tri/node_noise_tri.gml index 1ba3667e1..efb7210d3 100644 --- a/scripts/node_noise_tri/node_noise_tri.gml +++ b/scripts/node_noise_tri/node_noise_tri.gml @@ -15,7 +15,7 @@ function Node_Noise_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0] ) .setDisplay(VALUE_DISPLAY.vector); diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index 81df9d4ac..c0db61fd8 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -8,7 +8,7 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _ .rejectArray(); inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6), "Random seed to be used to initialize K-mean algorithm.") - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) .rejectArray(); inputs[| 3] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index 20434a239..5b65d2a9e 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -30,7 +30,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const .setDisplay(VALUE_DISPLAY.rotation); inputs[| 7] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); static createNewInput = function() { var index = ds_list_size(inputs); diff --git a/scripts/node_path_wave/node_path_wave.gml b/scripts/node_path_wave/node_path_wave.gml index fba1d71fa..dea1bde74 100644 --- a/scripts/node_path_wave/node_path_wave.gml +++ b/scripts/node_path_wave/node_path_wave.gml @@ -17,7 +17,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct inputs[| 4] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 6] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); diff --git a/scripts/node_pb_fx_highlight/node_pb_fx_highlight.gml b/scripts/node_pb_fx_highlight/node_pb_fx_highlight.gml index afca40610..b88a0df69 100644 --- a/scripts/node_pb_fx_highlight/node_pb_fx_highlight.gml +++ b/scripts/node_pb_fx_highlight/node_pb_fx_highlight.gml @@ -14,7 +14,7 @@ function Node_PB_Fx_Highlight(_x, _y, _group = noone) : Node_PB_Fx(_x, _y, _grou inputs[| 5] = nodeValue("Roughness Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ); inputs[| 6] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); holding_side = noone; diff --git a/scripts/node_perlin/node_perlin.gml b/scripts/node_perlin/node_perlin.gml index 416d65f90..897056fc4 100644 --- a/scripts/node_perlin/node_perlin.gml +++ b/scripts/node_perlin/node_perlin.gml @@ -17,7 +17,7 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 4] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 6] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]); diff --git a/scripts/node_perlin_extra/node_perlin_extra.gml b/scripts/node_perlin_extra/node_perlin_extra.gml index 734d3f2ab..5f06af241 100644 --- a/scripts/node_perlin_extra/node_perlin_extra.gml +++ b/scripts/node_perlin_extra/node_perlin_extra.gml @@ -19,7 +19,7 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _ addShaderProp(SHADER_UNIFORM.integer, "tile"); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 6] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) diff --git a/scripts/node_pixel_cloud/node_pixel_cloud.gml b/scripts/node_pixel_cloud/node_pixel_cloud.gml index b5bb7b30f..854ca6aba 100644 --- a/scripts/node_pixel_cloud/node_pixel_cloud.gml +++ b/scripts/node_pixel_cloud/node_pixel_cloud.gml @@ -4,7 +4,7 @@ function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01] }); diff --git a/scripts/node_pytagorean_tile/node_pytagorean_tile.gml b/scripts/node_pytagorean_tile/node_pytagorean_tile.gml index dae35b268..25b748c97 100644 --- a/scripts/node_pytagorean_tile/node_pytagorean_tile.gml +++ b/scripts/node_pytagorean_tile/node_pytagorean_tile.gml @@ -29,7 +29,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _ .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid"]); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); diff --git a/scripts/node_random_shape/node_random_shape.gml b/scripts/node_random_shape/node_random_shape.gml index 01d158947..f247f1c3c 100644 --- a/scripts/node_random_shape/node_random_shape.gml +++ b/scripts/node_random_shape/node_random_shape.gml @@ -5,7 +5,7 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro .setDisplay(VALUE_DISPLAY.vector); inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); diff --git a/scripts/node_random_tile/node_random_tile.gml b/scripts/node_random_tile/node_random_tile.gml index e1e50ee8a..9ba9c0f05 100644 --- a/scripts/node_random_tile/node_random_tile.gml +++ b/scripts/node_random_tile/node_random_tile.gml @@ -29,7 +29,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou .setDisplay(VALUE_DISPLAY.enum_scroll, ["Colored tile", "Height map", "Texture grid"]); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); diff --git a/scripts/node_region_fill/node_region_fill.gml b/scripts/node_region_fill/node_region_fill.gml index 9070851e6..6c3b00b84 100644 --- a/scripts/node_region_fill/node_region_fill.gml +++ b/scripts/node_region_fill/node_region_fill.gml @@ -11,7 +11,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 3] = nodeValue("Fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); inputs[| 4] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 5] = nodeValue("Target Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index b01b32aa5..d2f92d537 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -52,7 +52,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.enum_button, [ "Order", "Random", "Spread" ]); inputs[| 17] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 17].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 17].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 18] = nodeValue("Column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); diff --git a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml index 74577fc50..c81e88953 100644 --- a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml +++ b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml @@ -32,7 +32,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group .rejectArray(); inputs[| 7] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, object); diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 4dbc5f193..97f1fb070 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -40,7 +40,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c .setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random" ]); inputs[| 10] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 11] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ) .setMappable(28); diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index a77b39c90..42158618f 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -24,7 +24,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons .rejectArray(); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) .rejectArray(); inputs[| 6] = nodeValue("Fixed position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Fix point position, and only select point in the area."); diff --git a/scripts/node_shard_noise/node_shard_noise.gml b/scripts/node_shard_noise/node_shard_noise.gml index cca57033f..2ecf45f18 100644 --- a/scripts/node_shard_noise/node_shard_noise.gml +++ b/scripts/node_shard_noise/node_shard_noise.gml @@ -13,7 +13,7 @@ function Node_Shard_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y addShaderProp(SHADER_UNIFORM.float, "scale"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Sharpness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) diff --git a/scripts/node_shell/node_shell.gml b/scripts/node_shell/node_shell.gml index 58292a38e..e44c785d3 100644 --- a/scripts/node_shell/node_shell.gml +++ b/scripts/node_shell/node_shell.gml @@ -18,7 +18,7 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static update = function() { var _pro = getInputData(0); var _scr = getInputData(1); - if(_pro == "" || _scr == "") return; + if(_pro == "" && _scr == "") return; if(trusted) { shell_execute_async(_pro, _scr); diff --git a/scripts/node_smoke_turbulence/node_smoke_turbulence.gml b/scripts/node_smoke_turbulence/node_smoke_turbulence.gml index f3b1ea931..87053972a 100644 --- a/scripts/node_smoke_turbulence/node_smoke_turbulence.gml +++ b/scripts/node_smoke_turbulence/node_smoke_turbulence.gml @@ -17,7 +17,7 @@ function Node_Smoke_Turbulence(_x, _y, _group = noone) : Node_Smoke(_x, _y, _gro .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.01] }); inputs[| 4] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 5] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Override", "Add" ]); diff --git a/scripts/node_strand_break/node_strand_break.gml b/scripts/node_strand_break/node_strand_break.gml index 60213cabc..a11240b85 100644 --- a/scripts/node_strand_break/node_strand_break.gml +++ b/scripts/node_strand_break/node_strand_break.gml @@ -10,7 +10,7 @@ function Node_Strand_Break(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _ .setDisplay(VALUE_DISPLAY.slider); inputs[| input_fix_len + 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| input_fix_len + 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| input_fix_len + 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); array_push(input_display_list, ["Break", false], input_fix_len + 0, input_fix_len + 1 diff --git a/scripts/node_strand_create/node_strand_create.gml b/scripts/node_strand_create/node_strand_create.gml index 66e5283d5..d0021a877 100644 --- a/scripts/node_strand_create/node_strand_create.gml +++ b/scripts/node_strand_create/node_strand_create.gml @@ -35,7 +35,7 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const .setDisplay(VALUE_DISPLAY.slider); inputs[| 10] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 11] = nodeValue("Curl frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); diff --git a/scripts/node_strand_force_apply/node_strand_force_apply.gml b/scripts/node_strand_force_apply/node_strand_force_apply.gml index f433ced42..f968eac59 100644 --- a/scripts/node_strand_force_apply/node_strand_force_apply.gml +++ b/scripts/node_strand_force_apply/node_strand_force_apply.gml @@ -12,7 +12,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector inputs[| input_fix_len + 1] = nodeValue("Turbulence", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); inputs[| input_fix_len + 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| input_fix_len + 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| input_fix_len + 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| input_fix_len + 3] = nodeValue("Turbulence frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5); diff --git a/scripts/node_strand_render/node_strand_render.gml b/scripts/node_strand_render/node_strand_render.gml index 036defd3e..4fa853bb4 100644 --- a/scripts/node_strand_render/node_strand_render.gml +++ b/scripts/node_strand_render/node_strand_render.gml @@ -22,7 +22,7 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 5] = nodeValue("Color over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white)); inputs[| 6] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 7] = nodeValue("Child", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Render extra strands between the real strands."); diff --git a/scripts/node_strand_render_texture/node_strand_render_texture.gml b/scripts/node_strand_render_texture/node_strand_render_texture.gml index 75c2575e9..9b023804a 100644 --- a/scripts/node_strand_render_texture/node_strand_render_texture.gml +++ b/scripts/node_strand_render_texture/node_strand_render_texture.gml @@ -20,7 +20,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou inputs[| 4] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); diff --git a/scripts/node_surface_replace/node_surface_replace.gml b/scripts/node_surface_replace/node_surface_replace.gml index c52b547c7..dff9edce7 100644 --- a/scripts/node_surface_replace/node_surface_replace.gml +++ b/scripts/node_surface_replace/node_surface_replace.gml @@ -23,7 +23,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _ .setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Match index", "Randomized" ], update_hover: false }); inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); inputs[| 9] = nodeValue("Replace Empty", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) diff --git a/scripts/node_svg/node_svg.gml b/scripts/node_svg/node_svg.gml index f4952396d..1ef047b1f 100644 --- a/scripts/node_svg/node_svg.gml +++ b/scripts/node_svg/node_svg.gml @@ -72,6 +72,13 @@ function Node_SVG(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { triggerRender(); } #endregion + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { + var _scale = getInputData(1); + + if(is_instanceof(content, SVG)) + content.drawOverlay(hover, active, _x, _y, _s * _scale, _mx, _my, _snx, _sny); + } + static step = function() { #region var path = path_get(getInputData(0)); if(!file_exists_empty(path)) return; @@ -88,18 +95,19 @@ function Node_SVG(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(path != curr_path) readFile(path); + if(!is_instanceof(content, SVG)) return; outputs[| 1].setValue(path); + var _scale = getInputData(1); var _outsurf = outputs[| 0].getValue(); - var ww = 1; - var hh = 1; + var ww = content.width * _scale; + var hh = content.height * _scale; _outsurf = surface_verify(_outsurf, ww, hh, attrDepth()); - print(content); surface_set_shader(_outsurf, noone); - + content.draw(_scale); surface_reset_shader(); outputs[| 0].setValue(_outsurf); diff --git a/scripts/node_voronoi_extra/node_voronoi_extra.gml b/scripts/node_voronoi_extra/node_voronoi_extra.gml index 3c44780ea..1a5934ef1 100644 --- a/scripts/node_voronoi_extra/node_voronoi_extra.gml +++ b/scripts/node_voronoi_extra/node_voronoi_extra.gml @@ -12,7 +12,7 @@ function Node_Voronoi_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, addShaderProp(SHADER_UNIFORM.float, "scale"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) diff --git a/scripts/node_wavelet_noise/node_wavelet_noise.gml b/scripts/node_wavelet_noise/node_wavelet_noise.gml index ca9f0652a..7602c1443 100644 --- a/scripts/node_wavelet_noise/node_wavelet_noise.gml +++ b/scripts/node_wavelet_noise/node_wavelet_noise.gml @@ -13,7 +13,7 @@ function Node_Wavelet_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, addShaderProp(SHADER_UNIFORM.float, "scale"); inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) - .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }); addShaderProp(SHADER_UNIFORM.float, "seed"); inputs[| 4] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) diff --git a/scripts/surfaceBox/surfaceBox.gml b/scripts/surfaceBox/surfaceBox.gml index 5ab8d7372..58c186c91 100644 --- a/scripts/surfaceBox/surfaceBox.gml +++ b/scripts/surfaceBox/surfaceBox.gml @@ -78,16 +78,16 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor { var _arrInd = 0; if(is_array(_surface)) { - var _sprd = array_spread(_surface); - - if(array_length(_sprd)) { - _arrLen = array_length(_sprd); + if(array_length(_surface)) { + _arrLen = array_length(_surface); _arrInd = safe_mod(round(current_time / 250), _arrLen); - _surface = _sprd[_arrInd]; + _surface = _surface[_arrInd]; } else _surface = noone; } + if(!is_surface(_surface)) _surface = noone; + if(is_instanceof(_surface, __d3dMaterial)) _surface = _surface.surface; else if(is_instanceof(_surface, dynaSurf)) _surface = array_safe_get_fast(_surface.surfaces, 0, noone); else if(is_instanceof(_surface, Atlas)) _surface = _surface.getSurface(); diff --git a/scripts/svg_objects/svg_objects.gml b/scripts/svg_objects/svg_objects.gml index 4af0dcdef..6f7a55bb0 100644 --- a/scripts/svg_objects/svg_objects.gml +++ b/scripts/svg_objects/svg_objects.gml @@ -1,14 +1,87 @@ function SVG() constructor { width = 1; height = 1; - fill = c_black; - bbox = [ 0, 0, 0, 0 ]; + bbox = [ 1, 1, 1, 1 ]; + + fill = c_black; + fill_opacity = 1; + + stroke = undefined; + stroke_width = undefined; contents = []; + + static mapX = function(px) { return lerp_invert(px, bbox[0], bbox[0] + bbox[2]) * width; } + static mapY = function(py) { return lerp_invert(py, bbox[1], bbox[1] + bbox[3]) * height; } + + static getSurface = function(scale = 1) { return surface_create(width * scale, height * scale); } + + static draw = function(scale = 1) { + if(!is_undefined(fill)) + draw_set_color(fill); + + if(!is_undefined(fill_opacity)) + draw_set_alpha(fill_opacity); + + for (var i = 0, n = array_length(contents); i < n; i++) + contents[i].draw(scale); + } + + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { + for (var i = 0, n = array_length(contents); i < n; i++) + contents[i].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); + } } -function SVG_path() constructor { - anchors = []; +function SVG_path(svgObj) constructor { + parent = svgObj; + + fill = undefined; + fill_opacity = undefined; + + stroke = undefined; + stroke_width = undefined; + + segments = []; + shapes = []; + + static setTris = function() { + shapes = []; + var ox, oy, nx, ny, x0, y0; + + for (var i = 0, n = array_length(segments); i < n; i++) { + var _seg = segments[i]; + var _p = array_create(array_length(_seg)); + + for (var j = 0, m = array_length(_seg); j < m; j++) + _p[j] = new __vec2(_seg[j][0], _seg[j][1]); + + var _pTri = polygon_triangulate(_p); + var _ctri = []; + + for (var j = 0, m = array_length(_seg); j < m; j++) { + var _s = _seg[j]; + nx = _s[0]; + ny = _s[1]; + + if(j && array_length(_s) == 4) { + x0 = _s[2]; + y0 = _s[3]; + + array_push(_ctri, [ ox, oy, x0, y0, nx, ny ]); + } + + ox = nx; + oy = ny; + } + + _pTri[3] = _ctri; + shapes[i] = _pTri; + + // print($"{i}: {array_length(_pTri[0])} - {_pTri[2]}"); + } + + } static setDef = function(def) { var _mode = ""; @@ -25,51 +98,426 @@ function SVG_path() constructor { var _od = ord("."); var _os = ord(" "); - var _tx = 0; - var _ty = 0; + var _sx = 0, _sy = 0; + var _tx = 0, _ty = 0; + var _cx = 0, _cy = 0; + + segments = []; + var anchors = []; + // print("========================================================================="); + // print(def); repeat(_len) { var _chr = string_char_at(def, _ind); + var _chrn = _ind < _len? ord(string_char_at(def, _ind + 1)) : 0; var _och = ord(_chr); - var _eval = 0; + var _eval = false; + _ind++; - if((_och >= _oa && _och <= _oz) || (_och >= _oA && _och <= _oZ)) - _eval = 2; - else if(_och == _os) - _eval = 1; - else if((_och >= _o0 && _och >= _o9) || _och == _om || _och == _od) + if((_och >= _oa && _och <= _oz) || (_och >= _oA && _och <= _oZ)) { + + if(_chr == "Z" || _chr == "z") { + array_push(anchors, [ parent.mapX(_sx), parent.mapY(_sy) ]); + + if(!array_empty(anchors)) + array_push(segments, anchors); + anchors = []; + + } else if(_chr == "M" || _chr == "m") { + + if(!array_empty(anchors)) + array_push(segments, anchors); + anchors = []; + } + + _mode = _chr; + _val = ""; + + } else if((_och >= _o0 && _och <= _o9) || _och == _od || _och == _om) { _val += _chr; + } - if(_eval == 1) - array_push(_par, real(_val)); + if(_och == _os || _chrn == _om || (_chrn >= _oa && _chrn <= _oz) || (_chrn >= _oA && _chrn <= _oZ)) { + + if(_val != "") + array_push(_par, real(_val)); + _val = ""; + _eval = true; + } - else if(_eval == 2) { - array_push(_par, real(_val)); - _val = ""; + if(_eval) { + // print($"Eval [{_mode}]: ({anchors}) - {_par}"); switch(_mode) { case "M" : //Move to absolute - var _nx = array_safe_get(_par, 0); - var _ny = array_safe_get(_par, 1); - _tx = _nx; - _ty = _ny; + if(array_length(_par) >= 2) { + _tx = _par[0]; + _ty = _par[1]; + _sx = _tx; + _sy = _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } break; case "m" : //Move to relative - var _nx = array_safe_get(_par, 0); - var _ny = array_safe_get(_par, 1); - - _tx += _nx; - _ty += _ny; + + if(array_length(_par) >= 2) { + _tx += _par[0]; + _ty += _par[1]; + _sx = _tx; + _sy = _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } break; + + case "L" : //Line to absolute + if(array_length(_par) >= 2) { + _tx = _par[0]; + _ty = _par[1]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "l" : //Line to relative + if(array_length(_par) >= 2) { + _tx += _par[0]; + _ty += _par[1]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "H" : //Line to horizontal absolute + if(array_length(_par) >= 1) { + _tx = _par[0]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "h" : //Line to horizontal relative + if(array_length(_par) >= 1) { + _tx += _par[0]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "V" : //Line to vertical absolute + if(array_length(_par) >= 1) { + _ty = _par[0]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "v" : //Line to vertical relative + if(array_length(_par) >= 1) { + _ty += _par[0]; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty) ]); + _par = []; + } + break; + + case "C" : //Cubic bezier absolute + if(array_length(_par) >= 6) { + var _x1 = _par[0]; + var _y1 = _par[1]; + var _x2 = _par[2]; + var _y2 = _par[3]; + _tx = _par[4]; + _ty = _par[5]; + + _cx = _x2 - _tx; + _cy = _y2 - _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1), + parent.mapX(_x2), + parent.mapY(_y2) ]); + _par = []; + } + break; + + case "c" : //Cubic bezier relative + if(array_length(_par) >= 6) { + var _x1 = _tx + _par[0]; + var _y1 = _ty + _par[1]; + var _x2 = _tx + _par[2]; + var _y2 = _ty + _par[3]; + _tx = _tx + _par[4]; + _ty = _ty + _par[5]; + + _cx = _x2 - _tx; + _cy = _y2 - _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1), + parent.mapX(_x2), + parent.mapY(_y2) ]); + _par = []; + } + break; + + case "S" : //Smooth cubic bezier absolute + if(array_length(_par) >= 4) { + var _x1 = _tx + _cx; + var _y1 = _ty + _cy; + var _x2 = _par[0]; + var _y2 = _par[1]; + _tx = _par[2]; + _ty = _par[3]; + + _cx = _x2 - _tx; + _cy = _y2 - _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1), + parent.mapX(_x2), + parent.mapY(_y2) ]); + _par = []; + } + break; + + case "s" : //Smooth cubic bezier relative + if(array_length(_par) >= 4) { + var _x1 = _tx + _cx; + var _y1 = _ty + _cy; + var _x2 = _tx + _par[0]; + var _y2 = _ty + _par[1]; + _tx = _tx + _par[2]; + _ty = _ty + _par[3]; + + _cx = _x2 - _tx; + _cy = _y2 - _ty; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1), + parent.mapX(_x2), + parent.mapY(_y2) ]); + _par = []; + } + break; + + case "Q" : //Quadratic bezier absolute + if(array_length(_par) >= 4) { + var _x1 = _par[0]; + var _y1 = _par[1]; + _tx = _par[2]; + _ty = _par[3]; + + _cx = _tx - _x1; + _cy = _ty - _y1; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1) ]); + _par = []; + } + break; + + case "q" : //Quadratic bezier relative + if(array_length(_par) >= 4) { + var _x1 = _tx + _par[0]; + var _y1 = _ty + _par[1]; + _tx = _tx + _par[2]; + _ty = _ty + _par[3]; + + _cx = _tx - _x1; + _cy = _ty - _y1; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1) ]); + _par = []; + } + break; + + case "T" : //Smooth quadratic bezier absolute + if(array_length(_par) >= 2) { + var _x1 = _tx + _cx; + var _y1 = _ty + _cy; + _tx = _par[0]; + _ty = _par[1]; + + _cx = _tx - _x1; + _cy = _ty - _y1; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1) ]); + _par = []; + } + break; + + case "t" : //Smooth quadratic bezier relative + if(array_length(_par) >= 2) { + var _x1 = _tx + _cx; + var _y1 = _ty + _cy; + _tx = _tx + _par[0]; + _ty = _ty + _par[1]; + + _cx = _tx - _x1; + _cy = _ty - _y1; + + array_push(anchors, [ parent.mapX(_tx), + parent.mapY(_ty), + parent.mapX(_x1), + parent.mapY(_y1) ]); + _par = []; + } + break; + } - - _par = []; - _mode = _chr; } + } + + setTris(); + // print(segments); + } + + static draw = function(scale = 1) { + if(!is_undefined(fill)) + draw_set_color(fill); + + if(!is_undefined(fill_opacity)) + draw_set_alpha(fill_opacity); + + var _temp = [ + parent.getSurface(scale), + parent.getSurface(scale), + ]; + + var _sw = surface_get_width_safe(_temp[0]); + var _sh = surface_get_height_safe(_temp[0]); + + surface_clear(_temp[0]); + surface_clear(_temp[1]); + + var _surf = parent.getSurface(scale); + + for (var i = 0, n = array_length(shapes); i < n; i++) { + var shp = shapes[i]; + var _tri = shp[0]; + var _sid = shp[2]; + var _ctr = shp[3]; - _ind++; + surface_set_target(_surf); + DRAW_CLEAR + BLEND_OVERRIDE + + draw_primitive_begin(pr_trianglelist); + for (var j = 0, m = array_length(_tri); j < m; j++) { + draw_vertex(_tri[j][0].x * scale, _tri[j][0].y * scale); + draw_vertex(_tri[j][1].x * scale, _tri[j][1].y * scale); + draw_vertex(_tri[j][2].x * scale, _tri[j][2].y * scale); + } + draw_primitive_end(); + + shader_set(sh_svg_curve_quad); + draw_primitive_begin(pr_trianglelist); + for (var j = 0, m = array_length(_ctr); j < m; j++) { + draw_vertex_texture(_ctr[j][0] * scale, _ctr[j][1] * scale, 0.0, 0); + draw_vertex_texture(_ctr[j][2] * scale, _ctr[j][3] * scale, 0.5, 0); + draw_vertex_texture(_ctr[j][4] * scale, _ctr[j][5] * scale, 1.0, 1); + } + draw_primitive_end(); + shader_reset(); + + BLEND_NORMAL + surface_reset_target(); + + surface_set_shader(_temp[i % 2], sh_svg_fill); + + shader_set_surface("bg", _temp[!(i % 2)]); + shader_set_surface("fg", _surf); + + draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _sw, _sh, draw_get_color(), draw_get_alpha()); + + surface_reset_shader(); + + } + + draw_surface(_temp[!(i % 2)], 0, 0); + + surface_free(_surf); + surface_free(_temp[0]); + surface_free(_temp[1]); + } + + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { + + for (var i = 0, n = array_length(segments); i < n; i++) { + var _seg = segments[i]; + var _ox, _oy, _nx, _ny; + + draw_set_color(COLORS._main_accent); + + for (var j = 0, m = array_length(_seg); j < m; j++) { + var _pnt = _seg[j]; + _nx = _pnt[0]; + _ny = _pnt[1]; + + _nx = _x + _nx * _s; + _ny = _y + _ny * _s; + + if(j) draw_line(_ox, _oy, _nx, _ny); + draw_circle(_nx, _ny, 4, false); + + if(array_length(_pnt) >= 4) { + var _nx1 = _pnt[2]; + var _ny1 = _pnt[3]; + + _nx1 = _x + _nx1 * _s; + _ny1 = _y + _ny1 * _s; + + draw_circle(_nx1, _ny1, 4, true); + } + + if(array_length(_pnt) >= 6) { + var _nx1 = _pnt[4]; + var _ny1 = _pnt[5]; + + _nx1 = _x + _nx1 * _s; + _ny1 = _y + _ny1 * _s; + + draw_circle(_nx1, _ny1, 4, true); + } + + _ox = _nx; + _oy = _ny; + } } } } \ No newline at end of file diff --git a/scripts/svg_reader/svg_reader.gml b/scripts/svg_reader/svg_reader.gml index 14053e845..00cdc7133 100644 --- a/scripts/svg_reader/svg_reader.gml +++ b/scripts/svg_reader/svg_reader.gml @@ -21,12 +21,14 @@ function svg_parse(xmlStr) { var bbox = attr.viewBox; bbox = string_splice(bbox); for (var i = 0, n = array_length(bbox); i < n; i++) - bbox[i] = toNumber(string_digits(bbox[i])) + bbox[i] = real(bbox[i]) svg.bbox = bbox; } if(struct_has(attr, "fill")) { - svg.fill = attr.fill; + var _f = attr.fill; + _f = string_replace_all(_f, "#", ""); + svg.fill = color_from_rgb(_f); } if(struct_has(svg_object, "children")) { @@ -36,7 +38,7 @@ function svg_parse(xmlStr) { var _ch = svg_object.children[i]; switch(_ch.type) { - case "path" : svg.contents[_ind++] = svg_parse_path(_ch); break; + case "path" : svg.contents[_ind++] = svg_parse_path(_ch, svg); break; } } } @@ -44,8 +46,8 @@ function svg_parse(xmlStr) { return svg; } -function svg_parse_path(pathStr) { - var _path = new SVG_path(); +function svg_parse_path(pathStr, svgObj) { + var _path = new SVG_path(svgObj); var attr = pathStr.attributes; if(struct_has(attr, "d")) diff --git a/shaders/sh_svg_curve_quad/sh_svg_curve_quad.fsh b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.fsh new file mode 100644 index 000000000..46b709bb4 --- /dev/null +++ b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.fsh @@ -0,0 +1,7 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + float inner = step(v_vTexcoord.x * v_vTexcoord.x, v_vTexcoord.y); + gl_FragColor = v_vColour * inner; +} diff --git a/shaders/sh_svg_curve_quad/sh_svg_curve_quad.vsh b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_svg_curve_quad/sh_svg_curve_quad.yy b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.yy new file mode 100644 index 000000000..ea3cd990a --- /dev/null +++ b/shaders/sh_svg_curve_quad/sh_svg_curve_quad.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_svg_curve_quad", + "name":"sh_svg_curve_quad", + "parent":{ + "name":"svg", + "path":"folders/shader/svg.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/shaders/sh_svg_fill/sh_svg_fill.fsh b/shaders/sh_svg_fill/sh_svg_fill.fsh new file mode 100644 index 000000000..f3fe24d48 --- /dev/null +++ b/shaders/sh_svg_fill/sh_svg_fill.fsh @@ -0,0 +1,16 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform sampler2D bg, fg; + +void main() { + vec4 _bc = texture2D(bg, v_vTexcoord); + vec4 _fc = texture2D(fg, v_vTexcoord); + + // gl_FragColor = _fc; return; + + gl_FragColor = _bc; + if(_fc.a == 0.) return; + + gl_FragColor = _bc.a == 0.? v_vColour : vec4(0.); +} diff --git a/shaders/sh_svg_fill/sh_svg_fill.vsh b/shaders/sh_svg_fill/sh_svg_fill.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_svg_fill/sh_svg_fill.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_svg_fill/sh_svg_fill.yy b/shaders/sh_svg_fill/sh_svg_fill.yy new file mode 100644 index 000000000..a6668e535 --- /dev/null +++ b/shaders/sh_svg_fill/sh_svg_fill.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_svg_fill", + "name":"sh_svg_fill", + "parent":{ + "name":"svg", + "path":"folders/shader/svg.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file