From bc98b195f8ed9d6f3823154371a301b0b64ab1df Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:32:32 +0700 Subject: [PATCH] Source control mishap fix 1 --- Pixels Composer.yyp | 27 +- objects/o_dialog_about/o_dialog_about.yy | 4 +- objects/o_dialog_exit/o_dialog_exit.yy | 4 +- objects/o_dialog_history/o_dialog_history.yy | 4 +- .../o_dialog_image_array_edit.yy | 4 +- .../o_dialog_lua_reference.yy | 4 +- objects/o_dialog_migration/Create_0.gml | 7 + objects/o_dialog_migration/Draw_64.gml | 51 +++ .../o_dialog_migration/o_dialog_migration.yy | 37 ++ .../o_dialog_notifications.yy | 4 +- objects/o_dialog_preference/Create_0.gml | 83 ++-- .../o_dialog_preference.yy | 4 +- .../o_dialog_release_note.yy | 4 +- objects/o_dialog_splash/o_dialog_splash.yy | 4 +- objects/o_dialog_warning/o_dialog_warning.yy | 4 +- objects/o_main/Draw_64.gml | 18 +- objects/o_main/Other_2.gml | 7 +- objects/o_main/Other_3.gml | 7 + objects/o_main/Other_4.gml | 9 +- objects/o_main/Other_69.gml | 2 +- objects/o_main/Other_75.gml | 5 +- scripts/Script509/Script509.gml | 3 - scripts/__VFX/__VFX.gml | 11 +- .../_node_VFX_effector/_node_VFX_effector.gml | 39 +- .../_node_VFX_spawner/_node_VFX_spawner.gml | 150 ++++--- scripts/areaBox/areaBox.gml | 39 +- scripts/buttonColor/buttonColor.gml | 13 +- scripts/buttonGradient/buttonGradient.gml | 8 +- scripts/buttonGroup/buttonGroup.gml | 10 + scripts/controlPointBox/controlPointBox.gml | 14 +- .../draw_surface_blend/draw_surface_blend.gml | 39 +- .../draw_text_function/draw_text_function.gml | 24 +- scripts/event_recorder/event_recorder.gml | 89 +++- .../gradients_function/gradients_function.gml | 83 ++-- scripts/json_file/json_file.gml | 14 +- scripts/matrixGrid/matrixGrid.gml | 31 +- .../migration_function/migration_function.gml | 12 + .../migration_function/migration_function.yy | 11 + scripts/node_2d_light/node_2d_light.gml | 47 ++- scripts/node_3d_combine/node_3d_combine.gml | 85 ++-- scripts/node_3d_extrude/node_3d_extrude.gml | 45 +- scripts/node_3d_obj/node_3D_obj.gml | 106 +++-- .../node_3d_object_transform.gml | 98 ++--- scripts/node_3d_plane/node_3d_plane.gml | 47 ++- .../node_3d_prim_cone/node_3d_prim_cone.gml | 43 +- .../node_3d_prim_cube/node_3d_prim_cube.gml | 55 +-- .../node_3d_prim_cylinder.gml | 49 +-- .../node_3d_prim_sphere.gml | 41 +- scripts/node_3d_repeat/node_3d_repeat.gml | 76 ++-- scripts/node_9slice/node_9slice.gml | 14 +- .../node_VFX_effect_turbulence.gml | 2 +- .../node_VFX_effect_vortex.gml | 4 +- .../node_VFX_effector/node_VFX_effector.gml | 44 +- scripts/node_VFX_group/node_VFX_group.gml | 1 + .../node_VFX_renderer/node_VFX_renderer.gml | 36 +- scripts/node_VFX_spawner/node_VFX_spawner.gml | 22 +- .../node_alpha_cutoff/node_alpha_cutoff.gml | 28 +- scripts/node_alpha_hash/node_alpha_hash.gml | 10 +- .../node_alpha_to_grey/node_alpha_to_grey.gml | 17 +- .../node_animate_curve/node_animate_curve.gml | 19 +- scripts/node_area/node_area.gml | 10 +- scripts/node_array/node_array.gml | 63 ++- scripts/node_array_add/node_array_add.gml | 11 +- scripts/node_array_get/node_array_get.gml | 51 ++- .../node_array_length/node_array_length.gml | 23 +- scripts/node_array_range/node_array_range.gml | 15 +- .../node_ase_file_read/node_ase_file_read.gml | 30 +- scripts/node_ase_layer/node_ase_layer.gml | 16 +- scripts/node_atlas/node_atlas.gml | 13 +- scripts/node_average/node_average.gml | 28 +- scripts/node_bevel/node_bevel.gml | 36 +- scripts/node_blend/node_blend.gml | 33 +- scripts/node_bloom/node_bloom.gml | 39 +- scripts/node_blur/node_blur.gml | 36 +- scripts/node_blur_bokeh/node_blur_bokeh.gml | 32 +- .../node_blur_contrast/node_blur_contrast.gml | 38 +- .../node_blur_directional.gml | 32 +- scripts/node_blur_radial/node_blur_radial.gml | 34 +- scripts/node_blur_simple/node_blur_simple.gml | 40 +- scripts/node_blur_zoom/node_blur_zoom.gml | 36 +- scripts/node_boolean/node_boolean.gml | 8 +- scripts/node_bw/node_bw.gml | 28 +- scripts/node_camera/node_camera.gml | 27 +- scripts/node_canvas/node_canvas.gml | 399 ++++++++++-------- scripts/node_channels/node_channels.gml | 18 +- .../node_channels_hsv/node_channels_hsv.gml | 12 +- .../node_checkerboard/node_checkerboard.gml | 18 +- .../node_chromatic_aberration.gml | 19 +- scripts/node_collection/node_collection.gml | 118 +++++- scripts/node_color/node_color.gml | 11 +- .../node_color_adjustment.gml | 37 +- scripts/node_color_data/node_color_data.gml | 20 +- .../node_color_from_hsv.gml | 24 +- .../node_color_from_rgb.gml | 24 +- .../node_color_remove/node_color_remove.gml | 54 ++- .../node_color_replacement.gml | 37 +- .../node_color_sampler/node_color_sampler.gml | 20 +- scripts/node_colorize/node_colorize.gml | 65 +-- scripts/node_combine_hsv/node_combine_hsv.gml | 12 +- scripts/node_combine_rgb/node_combine_rgb.gml | 18 +- scripts/node_compare/node_compare.gml | 11 +- scripts/node_composite/node_composite.gml | 141 ++++--- scripts/node_condition/node_condition.gml | 32 +- scripts/node_convolution/node_convolution.gml | 29 +- scripts/node_corner/node_corner.gml | 35 +- scripts/node_counter/node_counter.gml | 20 +- scripts/node_crop/node_crop.gml | 17 +- .../node_csv_file_read/node_csv_file_read.gml | 18 +- .../node_csv_file_write.gml | 13 +- scripts/node_de_corner/node_de_corner.gml | 17 +- scripts/node_de_stray/node_de_stray.gml | 19 +- scripts/node_dilate/node_dilate.gml | 37 +- .../node_displacement/node_displacement.gml | 46 +- .../node_display_image/node_display_image.gml | 11 +- .../node_display_text/node_display_text.gml | 17 +- scripts/node_dither/node_dither.gml | 45 +- scripts/node_edge_detect/node_edge_detect.gml | 29 +- scripts/node_equation/node_equation.gml | 14 +- scripts/node_erode/node_erode.gml | 31 +- scripts/node_export/node_export.gml | 267 +++++++++--- .../node_feedback_input.gml | 2 +- .../node_feedback_output.gml | 4 +- scripts/node_flip/node_flip.gml | 20 +- scripts/node_frame/node_frame.gml | 18 +- scripts/node_global/node_global.gml | 67 ++- scripts/node_glow/node_glow.gml | 45 +- scripts/node_gradient/node_gradient.gml | 44 +- .../node_gradient_output.gml | 25 +- .../node_gradient_points.gml | 59 ++- .../node_grey_to_alpha/node_grey_to_alpha.gml | 22 +- scripts/node_greyscale/node_greyscale.gml | 29 +- scripts/node_grid/node_grid.gml | 30 +- scripts/node_grid_hex/node_grid_hex.gml | 20 +- scripts/node_grid_tri/node_grid_tri.gml | 20 +- scripts/node_group_input/node_group_input.gml | 69 ++- .../node_group_output/node_group_output.gml | 30 +- scripts/node_image/node_image.gml | 24 +- .../node_image_animated.gml | 53 +-- scripts/node_image_gif/node_image_gif.gml | 18 +- .../node_image_sequence.gml | 50 +-- scripts/node_image_sheet/node_image_sheet.gml | 55 +-- scripts/node_invert/node_invert.gml | 24 +- scripts/node_iterate/node_iterate.gml | 10 +- .../node_iterator_index.gml | 5 +- .../node_iterator_input.gml | 4 +- .../node_iterator_output.gml | 73 +++- .../node_json_file_read.gml | 19 +- .../node_json_file_write.gml | 21 +- scripts/node_lerp/node_lerp.gml | 10 +- scripts/node_level/node_level.gml | 35 +- .../node_level_selector.gml | 29 +- scripts/node_line/node_line.gml | 34 +- .../node_local_analyze/node_local_analyze.gml | 30 +- scripts/node_lua_compute/node_lua_compute.gml | 75 +++- scripts/node_lua_global/node_lua_global.gml | 29 +- scripts/node_lua_surface/node_lua_surface.gml | 70 ++- scripts/node_math/node_math.gml | 142 ++++--- scripts/node_mirror/node_mirror.gml | 27 +- scripts/node_noise/node_noise.gml | 6 +- scripts/node_noise_ani/node_noise_ani.gml | 14 +- scripts/node_noise_cell/node_noise_cell.gml | 26 +- scripts/node_noise_grid/node_noise_grid.gml | 22 +- .../node_noise_grid_hex.gml | 77 ++-- .../node_noise_grid_tri.gml | 77 ++-- .../node_noise_simplex/node_noise_simplex.gml | 14 +- scripts/node_normal/node_normal.gml | 22 +- .../node_normal_light/node_normal_light.gml | 37 +- scripts/node_outline/node_outline.gml | 47 ++- scripts/node_padding/node_padding.gml | 21 +- scripts/node_palette/node_palette.gml | 35 +- .../node_palette_extract.gml | 146 ++++--- .../node_palette_replacement.gml | 114 ++--- scripts/node_particle/node_particle.gml | 40 +- scripts/node_path/node_path.gml | 143 +++++-- scripts/node_perlin/node_perlin.gml | 22 +- .../node_perlin_smear/node_perlin_smear.gml | 18 +- scripts/node_pin/node_pin.gml | 12 +- scripts/node_pixel_cloud/node_pixel_cloud.gml | 66 +-- scripts/node_pixel_sort/node_pixel_sort.gml | 39 +- scripts/node_polar/node_polar.gml | 22 +- scripts/node_posterize/node_posterize.gml | 29 +- scripts/node_random/node_random.gml | 11 +- scripts/node_registry/node_registry.gml | 2 +- scripts/node_repeat/node_repeat.gml | 87 ++-- .../node_rigid_activation.gml | 14 +- .../node_rigid_force_apply.gml | 97 ++++- .../node_rigid_global/node_rigid_global.gml | 7 +- .../node_rigid_object/node_rigid_object.gml | 44 +- .../node_rigid_object_spawner.gml | 34 +- .../node_rigid_render/node_rigid_render.gml | 22 +- scripts/node_rigid_sim/node_rigid_sim.gml | 3 +- scripts/node_scale/node_scale.gml | 20 +- scripts/node_scale_algo/node_scale_algo.gml | 22 +- scripts/node_scatter/node_scatter.gml | 200 +++++---- .../node_seperate_shapes.gml | 64 +-- .../node_sequence_to_anim.gml | 14 +- scripts/node_shadow/node_shadow.gml | 46 +- scripts/node_shadow_cast/node_shadow_cast.gml | 55 +-- .../node_simple_shape/node_simple_shape.gml | 107 ++++- scripts/node_skew/node_skew.gml | 32 +- scripts/node_solid/node_solid.gml | 35 +- .../node_sprite_sheet/node_sprite_sheet.gml | 68 +-- .../node_sprite_stack/node_sprite_stack.gml | 20 +- scripts/node_stack/node_stack.gml | 124 +++--- scripts/node_statistic/node_statistic.gml | 12 +- scripts/node_string/node_string.gml | 4 +- .../node_string_get_char.gml | 6 +- .../node_string_merge/node_string_merge.gml | 6 +- .../node_string_split/node_string_split.gml | 6 +- scripts/node_string_trim/node_string_trim.gml | 8 +- scripts/node_stripe/node_stripe.gml | 34 +- .../node_surface_data/node_surface_data.gml | 8 +- scripts/node_switch/node_switch.gml | 17 +- scripts/node_text/node_text.gml | 28 +- .../node_text_file_read.gml | 16 +- .../node_text_file_write.gml | 15 +- .../node_texture_remap/node_texture_remap.gml | 17 +- scripts/node_threshold/node_threshold.gml | 31 +- scripts/node_time_remap/node_time_remap.gml | 23 +- .../node_timeline_preview.gml | 4 +- scripts/node_trail/node_trail.gml | 18 +- scripts/node_transform/node_transform.gml | 56 +-- .../node_transform_single.gml | 24 +- scripts/node_tunnel_in/node_tunnel_in.gml | 17 +- scripts/node_tunnel_out/node_tunnel_out.gml | 11 +- scripts/node_twirl/node_twirl.gml | 36 +- scripts/node_unicode/node_unicode.gml | 4 +- scripts/node_vector/node_vector.gml | 50 +-- scripts/node_wiggler/node_wiggler.gml | 38 +- scripts/node_wrap/node_wrap.gml | 24 +- scripts/node_wrap_area/node_wrap_area.gml | 19 +- scripts/node_wrap_mesh/node_wrap_mesh.gml | 47 ++- scripts/node_zigzag/node_zigzag.gml | 18 +- scripts/paddingBox/paddingBox.gml | 11 +- scripts/panel_collection/panel_collection.gml | 2 +- scripts/panel_menu/panel_menu.gml | 2 +- scripts/rangeBox/rangeBox.gml | 21 +- scripts/rotator/rotator.gml | 6 +- scripts/rotatorRange/rotatorRange.gml | 24 +- scripts/scrollBox/scrollBox.gml | 9 + scripts/scrollPane/scrollPane.gml | 22 +- scripts/shell_helper/shell_helper.gml | 2 +- scripts/slider/slider.gml | 13 +- scripts/sliderRange/sliderRange.gml | 15 +- scripts/textArea/textArea.gml | 29 +- scripts/vectorBox/vectorBox.gml | 20 +- scripts/vectorRangeBox/vectorRangeBox.gml | 22 +- shaders/sh_blend_add/sh_blend_add.fsh | 2 + .../sh_blend_contrast/sh_blend_contrast.fsh | 2 + shaders/sh_blend_luma/sh_blend_luma.fsh | 30 +- shaders/sh_blend_max/sh_blend_max.fsh | 2 + shaders/sh_blend_min/sh_blend_min.fsh | 2 + .../sh_blend_multiply/sh_blend_multiply.fsh | 2 + shaders/sh_blend_normal/sh_blend_normal.fsh | 2 + shaders/sh_blend_overlay/sh_blend_overlay.fsh | 2 + shaders/sh_blend_screen/sh_blend_screen.fsh | 2 + .../sh_blend_subtract/sh_blend_subtract.fsh | 2 + 257 files changed, 5302 insertions(+), 3265 deletions(-) create mode 100644 objects/o_dialog_migration/Create_0.gml create mode 100644 objects/o_dialog_migration/Draw_64.gml create mode 100644 objects/o_dialog_migration/o_dialog_migration.yy delete mode 100644 scripts/Script509/Script509.gml create mode 100644 scripts/migration_function/migration_function.gml create mode 100644 scripts/migration_function/migration_function.yy diff --git a/Pixels Composer.yyp b/Pixels Composer.yyp index 92317b927..66b03fa8c 100644 --- a/Pixels Composer.yyp +++ b/Pixels Composer.yyp @@ -81,7 +81,7 @@ {"id":{"name":"s_node_polar","path":"sprites/s_node_polar/s_node_polar.yy",},"order":5,}, {"id":{"name":"draw_set_blend_mode_ext","path":"scripts/draw_set_blend_mode_ext/draw_set_blend_mode_ext.yy",},"order":2,}, {"id":{"name":"s_node_noise_simplex","path":"sprites/s_node_noise_simplex/s_node_noise_simplex.yy",},"order":20,}, - {"id":{"name":"o_dialog_notifications","path":"objects/o_dialog_notifications/o_dialog_notifications.yy",},"order":9,}, + {"id":{"name":"o_dialog_notifications","path":"objects/o_dialog_notifications/o_dialog_notifications.yy",},"order":6,}, {"id":{"name":"s_node_array_find","path":"sprites/s_node_array_find/s_node_array_find.yy",},"order":2,}, {"id":{"name":"fd_rectangle_set_velocity_time_step","path":"scripts/fd_rectangle_set_velocity_time_step/fd_rectangle_set_velocity_time_step.yy",},"order":17,}, {"id":{"name":"fd_rectangle_set_collision_mask_sprite","path":"scripts/fd_rectangle_set_collision_mask_sprite/fd_rectangle_set_collision_mask_sprite.yy",},"order":1,}, @@ -110,7 +110,7 @@ {"id":{"name":"sh_mesh_generation","path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},"order":44,}, {"id":{"name":"math_function","path":"scripts/math_function/math_function.yy",},"order":7,}, {"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},"order":13,}, - {"id":{"name":"o_dialog_exit","path":"objects/o_dialog_exit/o_dialog_exit.yy",},"order":8,}, + {"id":{"name":"o_dialog_exit","path":"objects/o_dialog_exit/o_dialog_exit.yy",},"order":2,}, {"id":{"name":"fd_rectangle_get_collision_mask_sprite","path":"scripts/fd_rectangle_get_collision_mask_sprite/fd_rectangle_get_collision_mask_sprite.yy",},"order":4,}, {"id":{"name":"node_flip","path":"scripts/node_flip/node_flip.yy",},"order":13,}, {"id":{"name":"shader_set_functions","path":"scripts/shader_set_functions/shader_set_functions.yy",},"order":0,}, @@ -169,7 +169,7 @@ {"id":{"name":"fd_draw_self_to_collision_mask_surface","path":"scripts/fd_draw_self_to_collision_mask_surface/fd_draw_self_to_collision_mask_surface.yy",},"order":0,}, {"id":{"name":"s_node_HSV_combine","path":"sprites/s_node_HSV_combine/s_node_HSV_combine.yy",},"order":42,}, {"id":{"name":"node_normal_light","path":"scripts/node_normal_light/node_normal_light.yy",},"order":0,}, - {"id":{"name":"o_dialog_release_note","path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},"order":5,}, + {"id":{"name":"o_dialog_release_note","path":"objects/o_dialog_release_note/o_dialog_release_note.yy",},"order":8,}, {"id":{"name":"sh_fd_advect_material_rgba_16_glsl","path":"shaders/sh_fd_advect_material_rgba_16_glsl/sh_fd_advect_material_rgba_16_glsl.yy",},"order":4,}, {"id":{"name":"panel_inspector","path":"scripts/panel_inspector/panel_inspector.yy",},"order":0,}, {"id":{"name":"node_padding","path":"scripts/node_padding/node_padding.yy",},"order":9,}, @@ -221,7 +221,7 @@ {"id":{"name":"s_node_chromatic_abarration","path":"sprites/s_node_chromatic_abarration/s_node_chromatic_abarration.yy",},"order":12,}, {"id":{"name":"node_blur_directional","path":"scripts/node_blur_directional/node_blur_directional.yy",},"order":2,}, {"id":{"name":"s_node_group","path":"sprites/s_node_group/s_node_group.yy",},"order":4,}, - {"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},"order":6,}, + {"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},"order":9,}, {"id":{"name":"json_file","path":"scripts/json_file/json_file.yy",},"order":4,}, {"id":{"name":"s_node_curve_edit","path":"sprites/s_node_curve_edit/s_node_curve_edit.yy",},"order":0,}, {"id":{"name":"node_gradient","path":"scripts/node_gradient/node_gradient.yy",},"order":0,}, @@ -243,6 +243,7 @@ {"id":{"name":"sh_zigzag","path":"shaders/sh_zigzag/sh_zigzag.yy",},"order":11,}, {"id":{"name":"node_blur_bokeh","path":"scripts/node_blur_bokeh/node_blur_bokeh.yy",},"order":6,}, {"id":{"name":"sh_color_remove","path":"shaders/sh_color_remove/sh_color_remove.yy",},"order":22,}, + {"id":{"name":"o_dialog_migration","path":"objects/o_dialog_migration/o_dialog_migration.yy",},"order":11,}, {"id":{"name":"s_node_blur","path":"sprites/s_node_blur/s_node_blur.yy",},"order":7,}, {"id":{"name":"textArea","path":"scripts/textArea/textArea.yy",},"order":20,}, {"id":{"name":"s_node_gradient_4points","path":"sprites/s_node_gradient_4points/s_node_gradient_4points.yy",},"order":2,}, @@ -266,7 +267,7 @@ {"id":{"name":"string_formatting","path":"scripts/string_formatting/string_formatting.yy",},"order":7,}, {"id":{"name":"node_level_selector","path":"scripts/node_level_selector/node_level_selector.yy",},"order":8,}, {"id":{"name":"node_posterize","path":"scripts/node_posterize/node_posterize.yy",},"order":13,}, - {"id":{"name":"o_dialog_image_array_edit","path":"objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy",},"order":15,}, + {"id":{"name":"o_dialog_image_array_edit","path":"objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy",},"order":4,}, {"id":{"name":"s_ui_base_white","path":"sprites/s_ui_base_white/s_ui_base_white.yy",},"order":2,}, {"id":{"name":"s_node_array_range","path":"sprites/s_node_array_range/s_node_array_range.yy",},"order":6,}, {"id":{"name":"sh_fd_advect_material_a_16_glsl","path":"shaders/sh_fd_advect_material_a_16_glsl/sh_fd_advect_material_a_16_glsl.yy",},"order":2,}, @@ -287,7 +288,7 @@ {"id":{"name":"meta_data","path":"scripts/meta_data/meta_data.yy",},"order":11,}, {"id":{"name":"node_find_pixel","path":"scripts/node_find_pixel/node_find_pixel.yy",},"order":0,}, {"id":{"name":"node_scatter_points","path":"scripts/node_scatter_points/node_scatter_points.yy",},"order":24,}, - {"id":{"name":"o_dialog_lua_reference","path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},"order":16,}, + {"id":{"name":"o_dialog_lua_reference","path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},"order":5,}, {"id":{"name":"node_surface_data","path":"scripts/node_surface_data/node_surface_data.yy",},"order":4,}, {"id":{"name":"load_palette","path":"scripts/load_palette/load_palette.yy",},"order":3,}, {"id":{"name":"sh_alpha_cutoff","path":"shaders/sh_alpha_cutoff/sh_alpha_cutoff.yy",},"order":21,}, @@ -752,7 +753,7 @@ {"id":{"name":"node_tunnel_in","path":"scripts/node_tunnel_in/node_tunnel_in.yy",},"order":9,}, {"id":{"name":"node_anim_priority","path":"scripts/node_anim_priority/node_anim_priority.yy",},"order":2,}, {"id":{"name":"s_node_fluidSim_render","path":"sprites/s_node_fluidSim_render/s_node_fluidSim_render.yy",},"order":4,}, - {"id":{"name":"o_dialog_crashed","path":"objects/o_dialog_crashed/o_dialog_crashed.yy",},"order":17,}, + {"id":{"name":"o_dialog_crashed","path":"objects/o_dialog_crashed/o_dialog_crashed.yy",},"order":1,}, {"id":{"name":"fd_rectangle_enums","path":"scripts/fd_rectangle_enums/fd_rectangle_enums.yy",},"order":3,}, {"id":{"name":"s_texture_default","path":"sprites/s_texture_default/s_texture_default.yy",},"order":1,}, {"id":{"name":"directory_object","path":"scripts/directory_object/directory_object.yy",},"order":3,}, @@ -892,13 +893,13 @@ {"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},"order":7,}, {"id":{"name":"regex","path":"scripts/regex/regex.yy",},"order":0,}, {"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},"order":6,}, - {"id":{"name":"o_dialog_history","path":"objects/o_dialog_history/o_dialog_history.yy",},"order":0,}, + {"id":{"name":"o_dialog_history","path":"objects/o_dialog_history/o_dialog_history.yy",},"order":3,}, {"id":{"name":"draw_background_stretched","path":"scripts/draw_background_stretched/draw_background_stretched.yy",},"order":5,}, {"id":{"name":"s_node_path","path":"sprites/s_node_path/s_node_path.yy",},"order":0,}, {"id":{"name":"node_tunnel_out","path":"scripts/node_tunnel_out/node_tunnel_out.yy",},"order":10,}, {"id":{"name":"s_node_array_shuffle","path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},"order":10,}, {"id":{"name":"node_level","path":"scripts/node_level/node_level.yy",},"order":7,}, - {"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},"order":3,}, + {"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},"order":10,}, {"id":{"name":"s_node_group_output","path":"sprites/s_node_group_output/s_node_group_output.yy",},"order":15,}, {"id":{"name":"sh_channel_S","path":"shaders/sh_channel_S/sh_channel_S.yy",},"order":5,}, {"id":{"name":"string_scale","path":"scripts/string_scale/string_scale.yy",},"order":6,}, @@ -952,13 +953,14 @@ {"id":{"name":"sh_mask","path":"shaders/sh_mask/sh_mask.yy",},"order":0,}, {"id":{"name":"node_rigid_variable","path":"scripts/node_rigid_variable/node_rigid_variable.yy",},"order":8,}, {"id":{"name":"s_node_zoom","path":"sprites/s_node_zoom/s_node_zoom.yy",},"order":52,}, + {"id":{"name":"migration_function","path":"scripts/migration_function/migration_function.yy",},"order":0,}, {"id":{"name":"sh_channel_V","path":"shaders/sh_channel_V/sh_channel_V.yy",},"order":6,}, {"id":{"name":"node_alpha_to_grey","path":"scripts/node_alpha_to_grey/node_alpha_to_grey.yy",},"order":3,}, {"id":{"name":"shell_helper","path":"scripts/shell_helper/shell_helper.yy",},"order":20,}, - {"id":{"name":"o_dialog_preference","path":"objects/o_dialog_preference/o_dialog_preference.yy",},"order":4,}, + {"id":{"name":"o_dialog_preference","path":"objects/o_dialog_preference/o_dialog_preference.yy",},"order":7,}, {"id":{"name":"node_wrap","path":"scripts/node_wrap/node_wrap.yy",},"order":2,}, {"id":{"name":"node_3d_prim_sphere","path":"scripts/node_3d_prim_sphere/node_3d_prim_sphere.yy",},"order":13,}, - {"id":{"name":"o_dialog_about","path":"objects/o_dialog_about/o_dialog_about.yy",},"order":2,}, + {"id":{"name":"o_dialog_about","path":"objects/o_dialog_about/o_dialog_about.yy",},"order":0,}, {"id":{"name":"dialog_management","path":"scripts/dialog_management/dialog_management.yy",},"order":1,}, {"id":{"name":"draw_shapes","path":"scripts/draw_shapes/draw_shapes.yy",},"order":10,}, {"id":{"name":"node_channels","path":"scripts/node_channels/node_channels.yy",},"order":0,}, @@ -1025,7 +1027,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"functions","folderPath":"folders/functions.yy","order":7,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"3d","folderPath":"folders/functions/3d.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/functions/animation.yy","order":19,}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"async","folderPath":"folders/functions/async.yy","order":0,}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"migration","folderPath":"folders/functions/migration.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"bones","folderPath":"folders/functions/bones.yy","order":18,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"compat","folderPath":"folders/functions/compat.yy","order":13,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"control","folderPath":"folders/functions/control.yy","order":22,}, @@ -1137,6 +1139,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy","order":6,}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"menu","folderPath":"folders/dialog/menu.yy","order":18,}, ], "AudioGroups": [ {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, diff --git a/objects/o_dialog_about/o_dialog_about.yy b/objects/o_dialog_about/o_dialog_about.yy index 428ac1ddb..e60d48f6b 100644 --- a/objects/o_dialog_about/o_dialog_about.yy +++ b/objects/o_dialog_about/o_dialog_about.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_exit/o_dialog_exit.yy b/objects/o_dialog_exit/o_dialog_exit.yy index 80686c6aa..485c5d61f 100644 --- a/objects/o_dialog_exit/o_dialog_exit.yy +++ b/objects/o_dialog_exit/o_dialog_exit.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_history/o_dialog_history.yy b/objects/o_dialog_history/o_dialog_history.yy index 264cbae53..89903d998 100644 --- a/objects/o_dialog_history/o_dialog_history.yy +++ b/objects/o_dialog_history/o_dialog_history.yy @@ -32,7 +32,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy b/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy index df89ffc08..8eb324c91 100644 --- a/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy +++ b/objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_lua_reference/o_dialog_lua_reference.yy b/objects/o_dialog_lua_reference/o_dialog_lua_reference.yy index 7fdcb60fa..0cac452fa 100644 --- a/objects/o_dialog_lua_reference/o_dialog_lua_reference.yy +++ b/objects/o_dialog_lua_reference/o_dialog_lua_reference.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_migration/Create_0.gml b/objects/o_dialog_migration/Create_0.gml new file mode 100644 index 000000000..05ec3f2fe --- /dev/null +++ b/objects/o_dialog_migration/Create_0.gml @@ -0,0 +1,7 @@ +/// @description init +event_inherited(); + +#region data + dialog_w = ui(480); + dialog_h = ui(140); +#endregion \ No newline at end of file diff --git a/objects/o_dialog_migration/Draw_64.gml b/objects/o_dialog_migration/Draw_64.gml new file mode 100644 index 000000000..a56fb7c56 --- /dev/null +++ b/objects/o_dialog_migration/Draw_64.gml @@ -0,0 +1,51 @@ +/// @description init +if !ready exit; +draw_set_color(c_black); +draw_set_alpha(0.5); +draw_rectangle(0, 0, WIN_W, WIN_H, false); +draw_set_alpha(1); + +#region base UI + draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h); + if(sFOCUS) + draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1); +#endregion + +#region text + var py = dialog_y + ui(16); + draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text_title); + draw_text(dialog_x + ui(24), py, get_text("dialog_migration_title", "Program directory changed in 1.13")); + py += line_height(, 4); + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text_ext(dialog_x + ui(24), py, get_text("dialog_migration_content", + "You can press migrate files or manually move all custom collections, assets, palettes, gradients, fonts and presets."), -1, dialog_w - ui(48)); + + var bw = ui(96), bh = TEXTBOX_HEIGHT; + var bx1 = dialog_x + dialog_w - ui(16); + var by1 = dialog_y + dialog_h - ui(16); + var bx0 = bx1 - bw; + var by0 = by1 - bh; + + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + draw_text(bx0 + bw / 2, by0 + bh / 2, get_text("ignore", "Ignore")); + if(b == 2) + instance_destroy(); + + bx0 -= bw + ui(12); + var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + draw_text(bx0 + bw / 2, by0 + bh / 2, get_text("migrate_files", "Migrate files")); + if(b == 2) { + + instance_destroy(); + } + + bx0 = dialog_x + ui(16); + var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + draw_text(bx0 + bw / 2, by0 + bh / 2, get_text("migrate_open_directory", "Open directory") + "..."); + if(b == 2) { + var path = string(DIRECTORY); + if(file_exists(path)) shellOpenExplorer(path); + } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_migration/o_dialog_migration.yy b/objects/o_dialog_migration/o_dialog_migration.yy new file mode 100644 index 000000000..3ced4767d --- /dev/null +++ b/objects/o_dialog_migration/o_dialog_migration.yy @@ -0,0 +1,37 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "o_dialog_migration", + "spriteId": null, + "solid": false, + "visible": true, + "managed": true, + "spriteMaskId": null, + "persistent": false, + "parentObjectId": { + "name": "_p_dialog", + "path": "objects/_p_dialog/_p_dialog.yy", + }, + "physicsObject": false, + "physicsSensor": false, + "physicsShape": 1, + "physicsGroup": 1, + "physicsDensity": 0.5, + "physicsRestitution": 0.1, + "physicsLinearDamping": 0.1, + "physicsAngularDamping": 0.1, + "physicsFriction": 0.2, + "physicsStartAwake": true, + "physicsKinematic": false, + "physicsShapePoints": [], + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, + ], + "properties": [], + "overriddenProperties": [], + "parent": { + "name": "menu", + "path": "folders/dialog/menu.yy", + }, +} \ No newline at end of file diff --git a/objects/o_dialog_notifications/o_dialog_notifications.yy b/objects/o_dialog_notifications/o_dialog_notifications.yy index 655945ae0..96b86e200 100644 --- a/objects/o_dialog_notifications/o_dialog_notifications.yy +++ b/objects/o_dialog_notifications/o_dialog_notifications.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 499a628d1..592e793e0 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -23,16 +23,16 @@ event_inherited(); #region pages page_current = 0; - page[0] = "General"; - page[1] = "Node settings"; - page[2] = "Appearances"; - page[3] = "Colors"; - page[4] = "Hotkeys"; + page[0] = get_text("pref_pages_general", "General"); + page[1] = get_text("pref_pages_nodes", "Node settings"); + page[2] = get_text("pref_pages_appearance", "Appearances"); + page[3] = get_text("pref_pages_colors", "Colors"); + page[4] = get_text("pref_pages_hotkeys", "Hotkeys"); pref_global = ds_list_create(); ds_list_add(pref_global, [ - "Show welcome screen", + get_text("pref_show_welcome_screen", "Show welcome screen"), "show_splash", new checkBox(function() { PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"]; @@ -42,7 +42,7 @@ event_inherited(); PREF_MAP[? "_display_scaling"] = PREF_MAP[? "display_scaling"]; ds_list_add(pref_global, [ - "GUI scaling", + get_text("pref_gui_scaling", "GUI scaling"), "_display_scaling", new slider(0.5, 2, 0.01, function(val) { PREF_MAP[? "_display_scaling"] = val; @@ -61,7 +61,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Double click delay", + get_text("pref_double_click_delay", "Double click delay"), "double_click_delay", new slider(0, 1, 0.01, function(val) { PREF_MAP[? "double_click_delay"] = val; @@ -70,7 +70,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Keyboard hold start", + get_text("pref_keyboard_hold_start", "Keyboard hold start"), "keyboard_repeat_start", new slider(0, 1, 0.01, function(val) { PREF_MAP[? "keyboard_repeat_start"] = val; @@ -79,7 +79,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Keyboard repeat delay", + get_text("pref_keyboard_repeat_delay", "Keyboard repeat delay"), "keyboard_repeat_speed", new slider(0, 1, 0.01, function(val) { PREF_MAP[? "keyboard_repeat_speed"] = val; @@ -88,7 +88,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "UI frame rate", + get_text("pref_ui_frame_rate", "UI frame rate"), "ui_framerate", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "ui_framerate"] = max(15, round(real(str))); @@ -98,7 +98,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Default surface size", + get_text("pref_default_surface_size", "Default surface size"), "default_surface_side", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "default_surface_side"] = max(1, round(real(str))); @@ -107,7 +107,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Show node render time", + get_text("pref_show_node_render_time", "Show node render time"), "node_show_time", new checkBox(function() { PREF_MAP[? "node_show_time"] = !PREF_MAP[? "node_show_time"]; @@ -116,7 +116,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Show node render status", + get_text("pref_show_node_render_status", "Show node render status"), "node_show_render_status", new checkBox(function() { PREF_MAP[? "node_show_render_status"] = !PREF_MAP[? "node_show_render_status"]; @@ -125,7 +125,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Collection preview speed", + get_text("pref_collection_preview_speed", "Collection preview speed"), "collection_preview_speed", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "collection_preview_speed"] = max(1, round(real(str))); @@ -135,7 +135,7 @@ event_inherited(); ds_list_add(pref_global, [ - "Inspector line break width", + get_text("pref_inspector_line_break_width", "Inspector line break width"), "inspector_line_break_width", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "inspector_line_break_width"] = max(1, round(real(str))); @@ -144,7 +144,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Expand hovering panel", + get_text("pref_expand_hovering_panel", "Expand hovering panel"), "expand_hover", new checkBox(function() { PREF_MAP[? "expand_hover"] = !PREF_MAP[? "expand_hover"]; @@ -153,7 +153,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Graph zoom smoothing", + get_text("pref_graph_zoom_smoothing", "Graph zoom smoothing"), "graph_zoom_smoooth", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "graph_zoom_smoooth"] = max(1, round(real(str))); @@ -162,7 +162,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - "Warning notification time", + get_text("pref_warning_notification_time", "Warning notification time"), "notification_time", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "notification_time"] = max(0, round(real(str))); @@ -170,6 +170,15 @@ event_inherited(); }) ]); + ds_list_add(pref_global, [ + get_text("pref_enable_test_mode", "Enable test mode (require restart)"), + "test_mode", + new checkBox(function() { + PREF_MAP[? "test_mode"] = !PREF_MAP[? "test_mode"]; + PREF_SAVE(); + }) + ]); + #endregion #region //NODE @@ -177,7 +186,7 @@ event_inherited(); ds_list_add(pref_node, "Particle"); ds_list_add(pref_node, [ - "Max particles", + get_text("pref_max_particles", "Max particles"), "part_max_amount", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "part_max_amount"] = real(str); @@ -187,7 +196,7 @@ event_inherited(); ds_list_add(pref_node, "Separate shape"); ds_list_add(pref_node, [ - "Max shapes", + get_text("pref_max_shapes", "Max shapes"), "shape_separation_max", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "shape_separation_max"] = real(str); @@ -197,7 +206,7 @@ event_inherited(); ds_list_add(pref_node, "Levels"); ds_list_add(pref_node, [ - "Histogram resolution", + get_text("pref_histogram_resolution", "Histogram resolution"), "level_resolution", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "level_resolution"] = real(str); @@ -206,7 +215,7 @@ event_inherited(); ]); ds_list_add(pref_node, [ - "Maximum sampling", + get_text("pref_maximum_sampling", "Maximum sampling"), "level_max_sampling", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "level_max_sampling"] = real(str); @@ -216,7 +225,7 @@ event_inherited(); ds_list_add(pref_node, "Physics"); ds_list_add(pref_node, [ - "Verlet iteration", + get_text("pref_verlet_iteration", "Verlet iteration"), "verlet_iteration", new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "verlet_iteration"] = real(str); @@ -225,10 +234,10 @@ event_inherited(); ]); ds_list_add(pref_node, [ - "Gravity", + get_text("pref_gravity", "Gravity"), "physics_gravity", - new vectorBox(2, TEXTBOX_INPUT.number, function(val) { - PREF_MAP[? "physics_gravity"] = val; + new vectorBox(2, TEXTBOX_INPUT.number, function(index, val) { + PREF_MAP[? "physics_gravity"][index] = val; physics_world_gravity(PREF_MAP[? "physics_gravity"][0], PREF_MAP[? "physics_gravity"][1]); PREF_SAVE(); }) @@ -240,18 +249,18 @@ event_inherited(); ds_list_add(pref_appr, "Graph"); ds_list_add(pref_appr, [ - "Connection thickness", + get_text("pref_connection_thickness", "Connection thickness"), "connection_line_width", - new textBox(TEXTBOX_INPUT.float, function(str) { + new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "connection_line_width"] = real(str); PREF_SAVE(); }) ]); ds_list_add(pref_appr, [ - "Connection curve smoothness", + get_text("pref_connection_curve_smoothness", "Connection curve smoothness"), "connection_line_sample", - new textBox(TEXTBOX_INPUT.float, function(str) { + new textBox(TEXTBOX_INPUT.number, function(str) { PREF_MAP[? "connection_line_sample"] = real(str); PREF_SAVE(); }) @@ -328,7 +337,7 @@ event_inherited(); if(b == 2) { var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); - dialog.selector.setColor(val); + dialog.setDefault(val); self.key = key; dialog.onApply = function(color) { variable_struct_set(COLORS, self.key, color); @@ -498,9 +507,9 @@ event_inherited(); if(hk_editing == key) { var _mod_prs = 0; - if(key_mod_press(CTRL)) _mod_prs |= MOD_KEY.ctrl; - if(keyboard_check(vk_shift)) _mod_prs |= MOD_KEY.shift; - if(keyboard_check(vk_alt)) _mod_prs |= MOD_KEY.alt; + if(key_mod_press(CTRL)) _mod_prs |= MOD_KEY.ctrl; + if(key_mod_press(SHIFT)) _mod_prs |= MOD_KEY.shift; + if(key_mod_press(ALT)) _mod_prs |= MOD_KEY.alt; if(keyboard_check_pressed(vk_escape)) { key.key = ""; @@ -551,7 +560,7 @@ event_inherited(); modified = true; var bx = x1 - ui(32); var by = _y + hh; - if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, "Reset", THEME.refresh_s) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, get_text("reset", "Reset"), THEME.refresh_s) == 2) { key.key = dkey; key.modi = dmod; } @@ -564,7 +573,7 @@ event_inherited(); if(modified) { var bx = x1 - ui(32); var by = _y + ui(2); - if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, "Reset all", THEME.refresh_s) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, get_text("reset_all", "Reset all"), THEME.refresh_s) == 2) { for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) { var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]]; for(var i = 0; i < ds_list_size(ll); i++) { diff --git a/objects/o_dialog_preference/o_dialog_preference.yy b/objects/o_dialog_preference/o_dialog_preference.yy index 1f774d79e..84347c299 100644 --- a/objects/o_dialog_preference/o_dialog_preference.yy +++ b/objects/o_dialog_preference/o_dialog_preference.yy @@ -32,7 +32,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_release_note/o_dialog_release_note.yy b/objects/o_dialog_release_note/o_dialog_release_note.yy index 7069b8817..ca6ec167a 100644 --- a/objects/o_dialog_release_note/o_dialog_release_note.yy +++ b/objects/o_dialog_release_note/o_dialog_release_note.yy @@ -33,7 +33,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_splash/o_dialog_splash.yy b/objects/o_dialog_splash/o_dialog_splash.yy index a430249b5..f0b75a0cc 100644 --- a/objects/o_dialog_splash/o_dialog_splash.yy +++ b/objects/o_dialog_splash/o_dialog_splash.yy @@ -31,7 +31,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_dialog_warning/o_dialog_warning.yy b/objects/o_dialog_warning/o_dialog_warning.yy index 204ce36da..677820661 100644 --- a/objects/o_dialog_warning/o_dialog_warning.yy +++ b/objects/o_dialog_warning/o_dialog_warning.yy @@ -32,7 +32,7 @@ "properties": [], "overriddenProperties": [], "parent": { - "name": "dialog", - "path": "folders/dialog.yy", + "name": "menu", + "path": "folders/dialog/menu.yy", }, } \ No newline at end of file diff --git a/objects/o_main/Draw_64.gml b/objects/o_main/Draw_64.gml index fe0f42f54..20661dec4 100644 --- a/objects/o_main/Draw_64.gml +++ b/objects/o_main/Draw_64.gml @@ -19,12 +19,14 @@ #region panels if(PANEL_MAIN == 0) setPanel(); - var surf = surface_get_target(); - try - PANEL_MAIN.draw(); - catch(e) { - while(surface_get_target() != surf) - surface_reset_target(); - noti_warning("UI error: " + exception_print(e)); - } + PANEL_MAIN.draw(); + + //var surf = surface_get_target(); + //try + // PANEL_MAIN.draw(); + //catch(e) { + // while(surface_get_target() != surf) + // surface_reset_target(); + // noti_warning("UI error: " + exception_print(e)); + //} #endregion \ No newline at end of file diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 8579dd863..799697133 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -15,6 +15,9 @@ log_message("DIRECTORY", DIRECTORY); PREF_LOAD(); + loadFonts(); + loadGraphic(PREF_MAP[? "theme"]); + loadColor(PREF_MAP[? "theme"]); __initLocale(); __init_theme(); @@ -26,10 +29,6 @@ __init_node_guide(); __initSteamUGC(); - loadFonts(); - loadGraphic(PREF_MAP[? "theme"]); - loadColor(PREF_MAP[? "theme"]); - setPanel(); if(file_exists("icon.png")) diff --git a/objects/o_main/Other_3.gml b/objects/o_main/Other_3.gml index 0b202124e..5c0d7c293 100644 --- a/objects/o_main/Other_3.gml +++ b/objects/o_main/Other_3.gml @@ -1,4 +1,11 @@ /// @description #region log log_message("SESSION", "Ended"); + PREF_SAVE(); +#endregion + +#region steam + if(STEAM_ENABLED) { + steam_shutdown(); + } #endregion \ No newline at end of file diff --git a/objects/o_main/Other_4.gml b/objects/o_main/Other_4.gml index 82a8651b2..d66d8d9f9 100644 --- a/objects/o_main/Other_4.gml +++ b/objects/o_main/Other_4.gml @@ -1,3 +1,10 @@ /// @description init MODIFIED = false; -PREF_LOAD(); \ No newline at end of file +PREF_LOAD(); + +#region reset data + ds_stack_clear(UNDO_STACK); + ds_stack_clear(REDO_STACK); + + VARIABLE = new Node_Global(); +#endregion \ No newline at end of file diff --git a/objects/o_main/Other_69.gml b/objects/o_main/Other_69.gml index 6048027a4..5cb0880ac 100644 --- a/objects/o_main/Other_69.gml +++ b/objects/o_main/Other_69.gml @@ -18,7 +18,7 @@ if(string(ev_id) == string(STEAM_UGC_ITEM_ID) && ev_type == "ugc_create_item") { var _s = surface_create(prev_size, prev_size); surface_set_target(_s); draw_clear(COLORS._main_icon_dark); - draw_sprite_tiled(s_workshop_bg, 0, -64, -64); + draw_sprite_tiled(s_workshop_background, 0, -64, -64); draw_sprite_stretched(s_workshop_frame, 0, 0, 0, prev_size, prev_size); if(spr == -1) spr = THEME.group; diff --git a/objects/o_main/Other_75.gml b/objects/o_main/Other_75.gml index a7d9fbf8c..d8c98c21f 100644 --- a/objects/o_main/Other_75.gml +++ b/objects/o_main/Other_75.gml @@ -1,5 +1,8 @@ /// @description -if(async_load[?"event_type"] == "file_drop") { +var ev_id = async_load[? "id"]; +var ev_type = async_load[? "event_type"]; + +if(ev_type == "file_drop") { dropping = async_load[?"filename"]; array_push(drop_path, dropping); } \ No newline at end of file diff --git a/scripts/Script509/Script509.gml b/scripts/Script509/Script509.gml deleted file mode 100644 index 9320edda7..000000000 --- a/scripts/Script509/Script509.gml +++ /dev/null @@ -1,3 +0,0 @@ -function Script509(){ - -} \ No newline at end of file diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 8940501bc..8c32e73f6 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -24,9 +24,6 @@ function __part(_node) constructor { boundary_data = -1; - fx = 0; - fy = 0; - gy = 0; scx = 1; @@ -122,7 +119,7 @@ function __part(_node) constructor { if(life-- < 0) kill(); } - function draw(exact, surf_w, surf_h) { + function draw(exact, surf_w, surf_h) { if(!active) return; var ss = surf; if(is_array(surf)) { @@ -145,8 +142,8 @@ function __part(_node) constructor { } if(!is_surface(ss)) return; - scx = sc_sx * eval_curve_bezier_cubic_x(sct, 1 - life / life_total); - scy = sc_sy * eval_curve_bezier_cubic_x(sct, 1 - life / life_total); + scx = sc_sx * eval_curve_x(sct, 1 - life / life_total); + scy = sc_sy * eval_curve_x(sct, 1 - life / life_total); var _xx, _yy; var s_w = surface_get_width(ss) * scx; @@ -183,7 +180,7 @@ function __part(_node) constructor { var cc = (col == -1)? c_white : gradient_eval(col, 1 - life / life_total); cc = colorMultiply(blend, cc); - alp_draw = alp * eval_curve_bezier_cubic_x(alp_fade, 1 - life / life_total); + alp_draw = alp * eval_curve_x(alp_fade, 1 - life / life_total); draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw); } diff --git a/scripts/_node_VFX_effector/_node_VFX_effector.gml b/scripts/_node_VFX_effector/_node_VFX_effector.gml index 512ea80c8..b618d8344 100644 --- a/scripts/_node_VFX_effector/_node_VFX_effector.gml +++ b/scripts/_node_VFX_effector/_node_VFX_effector.gml @@ -7,51 +7,52 @@ enum FORCE_TYPE { Turbulence, Destroy } - +/* function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Effector"; previewable = false; + color = COLORS.node_blend_vfx; + icon = THEME.vfx; w = 96; h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Particle data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, -1 ) + inputs[| 0] = nodeValue("Particle data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, -1 ) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 1] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) + inputs[| 2] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area); - inputs[| 3] = nodeValue(3, "Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ) - .setDisplay(VALUE_DISPLAY.curve); + inputs[| 3] = nodeValue("Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ); - inputs[| 4] = nodeValue(4, "Falloff distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ); + inputs[| 4] = nodeValue("Falloff distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ); - inputs[| 5] = nodeValue(5, "Effect type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 5] = nodeValue("Effect type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Wind", "Accelerate", "Attract", "Repel", "Vortex", "Turbulence", "Destroy" ] ); - inputs[| 6] = nodeValue(6, "Effect Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -1, 0 ] ) + inputs[| 6] = nodeValue("Effect Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -1, 0 ] ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ); + inputs[| 7] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ); - inputs[| 8] = nodeValue(8, "Rotate particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| 8] = nodeValue("Rotate particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 9] = nodeValue(9, "Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) + inputs[| 9] = nodeValue("Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector_range); - inputs[| 10] = nodeValue(10, "Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16 ); + inputs[| 10] = nodeValue("Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16 ); input_display_list = [ 0, 1, ["Area", false], 2, 3, 4, ["Effect", false], 5, 10, 7, 6, 8, 9 ]; - outputs[| 0] = nodeValue(0, "Particle data", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, -1 ); + outputs[| 0] = nodeValue("Particle data", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, -1 ); current_data = []; @@ -91,12 +92,12 @@ function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) cons distance_to_line(pv[0], pv[1], _area_x0, _area_y1, _area_x1, _area_y1), distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x0, _area_y1), distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _area_y1)); - str = eval_curve_bezier_cubic_t(_fall, clamp(_dst / _fads, 0., 1.)); + str = eval_curve_x(_fall, clamp(_dst / _fads, 0., 1.)); } } else if(_area_t == AREA_SHAPE.elipse) { if(point_in_circle(pv[0], pv[1], _area_x, _area_y, min(_area_w, _area_h))) { var _dst = point_distance(pv[0], pv[1], _area_x, _area_y); - str = eval_curve_bezier_cubic_t(_fall, clamp(_dst / _fads, 0., 1.)); + str = eval_curve_x(_fall, clamp(_dst / _fads, 0., 1.)); } } @@ -219,12 +220,12 @@ function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) cons distance_to_line(pv[0], pv[1], _area_x0, _area_y1, _area_x1, _area_y1), distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x0, _area_y1), distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _area_y1)); - str = eval_curve_bezier_cubic_t(_fall, clamp(_dst / _fads, 0., 1.)); + str = eval_curve_x(_fall, clamp(_dst / _fads, 0., 1.)); } } else if(_area_t == AREA_SHAPE.elipse) { if(point_in_circle(pv[0], pv[1], _area_x, _area_y, min(_area_w, _area_h))) { var _dst = point_distance(pv[0], pv[1], _area_x, _area_y); - str = eval_curve_bezier_cubic_t(_fall, clamp(_dst / _fads, 0., 1.)); + str = eval_curve_x(_fall, clamp(_dst / _fads, 0., 1.)); } } @@ -291,7 +292,7 @@ function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) cons else part.scy += sign(part.scy) * scy_s; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { outputs[| 0].setValue(inputs[| 0].getValue()); var jun = outputs[| 0]; for(var j = 0; j < ds_list_size(jun.value_to); j++) { diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index a9270a5ef..6407b612e 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -1,93 +1,99 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Spawner"; - inputs[| 0] = nodeValue(0, "Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) - .setDisplay(noone, "particles"); + inputs[| 0] = nodeValue("Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn."); + inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn."); - inputs[| 2] = nodeValue(2, "Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2, "Amount of particle spawn in that frame."); + inputs[| 2] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2, "Amount of particle spawn in that frame."); - inputs[| 3] = nodeValue(3, "Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) + inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area); - inputs[| 4] = nodeValue(4, "Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Area", "Border" ]); + inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data" ]); - inputs[| 5] = nodeValue(5, "Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ]) + inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ]) .setDisplay(VALUE_DISPLAY.range); - inputs[| 6] = nodeValue(6, "Spawn direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 45, 135 ]) + inputs[| 6] = nodeValue("Spawn direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 45, 135 ]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 7] = nodeValue(7, "Acceleration", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 7] = nodeValue("Acceleration", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.range); - inputs[| 8] = nodeValue(8, "Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) + inputs[| 8] = nodeValue("Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 9] = nodeValue(9, "Rotational speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 9] = nodeValue("Rotational speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.range); - inputs[| 10] = nodeValue(10, "Spawn scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) + inputs[| 10] = nodeValue("Spawn scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) .setDisplay(VALUE_DISPLAY.vector_range); - inputs[| 11] = nodeValue(11, "Scale over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); + inputs[| 11] = nodeValue("Scale over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); - inputs[| 12] = nodeValue(12, "Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 12] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 13] = nodeValue(13, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 13] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.range); - inputs[| 14] = nodeValue(14, "Alpha over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); + inputs[| 14] = nodeValue("Alpha over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); - inputs[| 15] = nodeValue(15, "Rotate by direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make the particle rotates to follow its movement."); + inputs[| 15] = nodeValue("Rotate by direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make the particle rotates to follow its movement."); - inputs[| 16] = nodeValue(16, "Spawn type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 16] = nodeValue("Spawn type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Stream", "Burst" ]); - inputs[| 17] = nodeValue(17, "Spawn size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) + inputs[| 17] = nodeValue("Spawn size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) .setDisplay(VALUE_DISPLAY.range); - inputs[| 18] = nodeValue(18, "Spawn velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [1, 2] ) + inputs[| 18] = nodeValue("Spawn velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [1, 2] ) .setDisplay(VALUE_DISPLAY.range); - inputs[| 19] = nodeValue(19, "Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ); + inputs[| 19] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ); - inputs[| 20] = nodeValue(20, "Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ); + inputs[| 20] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ); - inputs[| 21] = nodeValue(21, "Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); + inputs[| 21] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); - inputs[| 22] = nodeValue(22, "Surface array", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Whether to select image from an array in order, at random, or treat array as animation." ) + inputs[| 22] = nodeValue("Surface array", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Whether to select image from an array in order, at random, or treat array as animation." ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation" ]) .setVisible(false); - inputs[| 23] = nodeValue(23, "Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) + inputs[| 23] = nodeValue("Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) .setVisible(false); - inputs[| 24] = nodeValue(24, "Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 24] = nodeValue("Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random", "Data" ]); - inputs[| 25] = nodeValue(25, "Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, []) + inputs[| 25] = nodeValue("Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, []) .setVisible(false, true); - inputs[| 26] = nodeValue(26, "On animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, ANIM_END_ACTION.loop) + inputs[| 26] = nodeValue("On animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, ANIM_END_ACTION.loop) .setDisplay(VALUE_DISPLAY.enum_button, [ "Loop", "Ping pong", "Destroy" ]) .setVisible(false); - inputs[| 27] = nodeValue(27, "Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 27] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 28] = nodeValue(28, "Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 28] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 29] = nodeValue(29, "Directed from center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make particle move away from the spawn center."); - + inputs[| 29] = nodeValue("Directed from center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make particle move away from the spawn center."); + + inputs[| 30] = nodeValue("Distribution map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) + + inputs[| 31] = nodeValue("Distribution data", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, []) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 32] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom_range(100000, 999999)) + input_len = ds_list_size(inputs); - input_display_list = [ + input_display_list = [ 32, ["Sprite", false], 0, 22, 23, 26, - ["Spawn", true], 27, 16, 1, 2, 3, 4, 24, 25, 5, + ["Spawn", true], 27, 16, 1, 2, 3, 4, 30, 31, 24, 25, 5, ["Movement", true], 29, 6, 18, 7, ["Physics", true], 19, 20, ["Rotation", true], 15, 8, 9, @@ -99,8 +105,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const parts = array_create(PREF_MAP[? "part_max_amount"]); parts_runner = 0; - seed_origin = irandom(9999999); - seed = seed_origin; + seed = 0; spawn_index = 0; scatter_index = 0; def_surface = -1; @@ -114,30 +119,28 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const var _inSurf = current_data[0]; if(_inSurf == 0) { - if(def_surface == -1 || !surface_exists(def_surface)) { - def_surface = PIXEL_SURFACE; - surface_set_target(def_surface); - draw_clear(c_white); - surface_reset_target(); - } + if(!is_surface(def_surface)) + return; _inSurf = def_surface; } var _spawn_amount = current_data[ 2]; var _amo = _spawn_amount; - var _spawn_area = current_data[ 3]; - var _distrib = current_data[ 4]; - var _scatter = current_data[24]; + var _spawn_area = current_data[ 3]; + var _distrib = current_data[ 4]; + var _dist_map = current_data[30]; + var _dist_data = current_data[31]; + var _scatter = current_data[24]; var _life = current_data[ 5]; var _direction = current_data[ 6]; var _directCenter = current_data[29]; var _velocity = current_data[18]; - var _accel = current_data[ 7]; - var _grav = current_data[19]; - var _wigg = current_data[20]; + var _accel = current_data[ 7]; + var _grav = current_data[19]; + var _wigg = current_data[20]; var _follow = current_data[15]; var _rotation = current_data[ 8]; @@ -158,8 +161,14 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const if(_rotation[1] < _rotation[0]) _rotation[1] += 360; - repeat(_amo) { - random_set_seed(seed++); + var _posDist = []; + if(_distrib == 2) + _posDist = get_points_from_dist(_dist_map, _amo, seed); + + for( var i = 0; i < _amo; i++ ) { + random_set_seed(seed); + seed += 100; + parts_runner = clamp(parts_runner, 0, array_length(parts) - 1); var part = parts[parts_runner]; @@ -190,11 +199,25 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const part.boundary_data = _b; } else { - var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed); - xx = sp[0]; - yy = sp[1]; + if(_distrib < 2) { + var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed); + xx = sp[0]; + yy = sp[1]; - part.boundary_data = -1; + part.boundary_data = -1; + } else if(_distrib == 2) { + var sp = array_safe_get(_posDist, i); + if(!is_array(sp)) continue; + + xx = _spawn_area[0] + _spawn_area[2] * (sp[0] * 2 - 1.); + yy = _spawn_area[1] + _spawn_area[3] * (sp[1] * 2 - 1.); + } else if(_distrib == 3) { + sp = array_safe_get(_dist_data, spawn_index); + if(!is_array(sp)) continue; + + _x = sp[0]; + _y = sp[1]; + } } } else { xx = _pos[0]; @@ -231,7 +254,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const spawn_index = safe_mod(spawn_index + 1, PREF_MAP[? "part_max_amount"]); onSpawn(_time, part); - parts_runner = safe_mod((parts_runner + 1), PREF_MAP[? "part_max_amount"]); + parts_runner = safe_mod(parts_runner + 1, PREF_MAP[? "part_max_amount"]); } } @@ -248,7 +271,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const } render(); - seed = seed_origin; + seed = inputs[| 32].getValue(); var _loop = inputs[| 21].getValue(); if(!_loop) return; @@ -258,7 +281,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const updateParticleForward(false); } - seed = seed_origin; + seed = inputs[| 32].getValue(); } function checkPartPool() { @@ -306,14 +329,18 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const } static step = function() { - var _inSurf = inputs[| 0].getValue(); + var _inSurf = inputs[| 0].getValue(); + var _dist = inputs[| 4].getValue(); var _scatt = inputs[| 24].getValue(); var _dirAng = inputs[| 29].getValue(); inputs[| 6].setVisible(!_dirAng); inputs[| 22].setVisible(false); inputs[| 23].setVisible(false); + inputs[| 26].setVisible(false); inputs[| 25].setVisible(_scatt == 2); + inputs[| 30].setVisible(_dist == 2, _dist == 2); + inputs[| 31].setVisible(_dist == 3, _dist == 3); if(is_array(_inSurf)) { inputs[| 22].setVisible(true); @@ -333,8 +360,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const } static onStep = function() { - if(!ANIMATOR.frame_progress) return; - if(!ANIMATOR.is_playing) return; + RETURN_ON_REST if(ANIMATOR.current_frame == 0) reset(); @@ -349,7 +375,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const static onDrawOverlay = -1; - static update = function() {} + static update = function(frame = ANIMATOR.current_frame) {} static render = function() {} static onPartCreate = function(part) {} diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index c3ad5f667..9cadc59b3 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -21,53 +21,53 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { onModifySingle[0] = function(val) { if(mode == AREA_MODE.area) { - onModify(0, toNumber(val)); + return onModify(0, toNumber(val)); } else if(mode == AREA_MODE.padding) { var v = toNumber(val); if(link_value) current_data = [ v, v, v, v ]; else current_data[0] = v; - setAllData(current_data); + return setAllData(current_data); } else if(mode == AREA_MODE.two_point) { - onModify(0, val); + return onModify(0, val); } } onModifySingle[1] = function(val) { if(mode == AREA_MODE.area) { - onModify(1, toNumber(val)); + return onModify(1, toNumber(val)); } else if(mode == AREA_MODE.padding) { var v = toNumber(val); if(link_value) current_data = [ v, v, v, v ]; else current_data[1] = v; - setAllData(current_data); + return setAllData(current_data); } else if(mode == AREA_MODE.two_point) { - onModify(1, val); + return onModify(1, val); } } onModifySingle[2] = function(val) { if(mode == AREA_MODE.area) { - onModify(2, toNumber(val)); + return onModify(2, toNumber(val)); } else if(mode == AREA_MODE.padding) { var v = toNumber(val); if(link_value) current_data = [ v, v, v, v ]; else current_data[2] = v; - setAllData(current_data); + return setAllData(current_data); } else if(mode == AREA_MODE.two_point) { - onModify(2, val); + return onModify(2, val); } } onModifySingle[3] = function(val) { if(mode == AREA_MODE.area) { - onModify(3, toNumber(val)); + return onModify(3, toNumber(val)); } else if(mode == AREA_MODE.padding) { var v = toNumber(val); if(link_value) current_data = [ v, v, v, v ]; else current_data[3] = v; - setAllData(current_data); + return setAllData(current_data); } else if(mode == AREA_MODE.two_point) { - onModify(3, val); + return onModify(3, val); } } @@ -76,11 +76,18 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { tb[i].slidable = true; } + static setSlideSpeed = function(speed) { + for(var i = 0; i < 4; i++) + tb[i].slide_speed = speed; + } + static setAllData = function(data) { - onModify(0, data[0]); - onModify(1, data[1]); - onModify(2, data[2]); - onModify(3, data[3]); + var mod0 = onModify(0, data[0]); + var mod1 = onModify(1, data[1]); + var mod2 = onModify(2, data[2]); + var mod3 = onModify(3, data[3]); + + return mod0 || mod1 || mod2 || mod3; } static setInteract = function(interactable = noone) { diff --git a/scripts/buttonColor/buttonColor.gml b/scripts/buttonColor/buttonColor.gml index 780d581a4..fc7428c60 100644 --- a/scripts/buttonColor/buttonColor.gml +++ b/scripts/buttonColor/buttonColor.gml @@ -19,7 +19,7 @@ function buttonColorClass(_onApply) : widget() constructor { static trigger = function() { var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); - dialog.selector.setColor(current_color); + dialog.setDefault(current_color); dialog.selector.onApply = onApply; dialog.onApply = onApply; } @@ -35,17 +35,6 @@ function buttonColorClass(_onApply) : widget() constructor { b_picker.active = active; b_picker.draw(_x + _w - ui(32), _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide); - //if(keyboard_check_pressed(vk_alt)) { - // onColorPick(); - // is_picking = true; - //} - //if(is_picking) { - // if(keyboard_check_released(vk_alt)) { - // instance_destroy(o_dialog_color_selector); - // is_picking = false; - // } - //} - var _cw = _w - ui(40); var click = false; if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _cw, _y + _h)) { diff --git a/scripts/buttonGradient/buttonGradient.gml b/scripts/buttonGradient/buttonGradient.gml index 654b9242c..cfd5c8ad6 100644 --- a/scripts/buttonGradient/buttonGradient.gml +++ b/scripts/buttonGradient/buttonGradient.gml @@ -10,7 +10,7 @@ function buttonGradientClass(_onApply) : widget() constructor { static trigger = function() { var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2); - dialog.setGradient(current_gradient, current_data); + dialog.setDefault(current_gradient, current_data); dialog.onApply = onApply; } @@ -23,13 +23,13 @@ function buttonGradientClass(_onApply) : widget() constructor { current_data = _data; var click = false; - if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) { + if(ihover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) { draw_sprite_stretched(THEME.button, 1, _x, _y, _w, _h); - if(mouse_press(mb_left, active)) { + if(mouse_press(mb_left, iactive)) { trigger(); click = true; } - if(mouse_click(mb_left, active)) + if(mouse_click(mb_left, iactive)) draw_sprite_stretched(THEME.button, 2, _x, _y, _w, _h); } else { draw_sprite_stretched(THEME.button, 0, _x, _y, _w, _h); diff --git a/scripts/buttonGroup/buttonGroup.gml b/scripts/buttonGroup/buttonGroup.gml index a3fb8636d..fcddbfce3 100644 --- a/scripts/buttonGroup/buttonGroup.gml +++ b/scripts/buttonGroup/buttonGroup.gml @@ -75,6 +75,16 @@ function buttonGroupClass(_data, _onClick) : widget() constructor { draw_sprite_ui_uniform(data[i], i, bx + ww / 2, _y + _h / 2); } } + + if(point_in_rectangle(_m[0], _m[1], _x, _y, _x + w, _y + _h)) { + if(is_array(data) && key_mod_press(SHIFT)) { + var len = array_length(data); + if(len) { + if(mouse_wheel_down()) onClick((_selecting + 1 + len) % len); + if(mouse_wheel_up()) onClick((_selecting - 1 + len) % len); + } + } + } } else { sb_small.hover = hover; sb_small.active = active; diff --git a/scripts/controlPointBox/controlPointBox.gml b/scripts/controlPointBox/controlPointBox.gml index d64cdf694..b906914ae 100644 --- a/scripts/controlPointBox/controlPointBox.gml +++ b/scripts/controlPointBox/controlPointBox.gml @@ -19,13 +19,13 @@ function controlPointBox(_onModify) : widget() constructor { onModify = _onModify; onSurfaceSize = -1; - tbCx = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.cx, toNumber(val)); }); - tbCy = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.cy, toNumber(val)); }); - tbFx = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.fx, toNumber(val)); }); - tbFy = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.fy, toNumber(val)); }); - tbW = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); - tbH = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); - rot = new rotator(function(val) { onModify(PUPPET_CONTROL.fy, toNumber(val)); }); + tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); }); + tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); }); + tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); }); + tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); + tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); + tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); + rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFx.slidable = true; tbFy.slidable = true; tbW.slidable = true; diff --git a/scripts/draw_surface_blend/draw_surface_blend.gml b/scripts/draw_surface_blend/draw_surface_blend.gml index e09f09432..5b2eff5d1 100644 --- a/scripts/draw_surface_blend/draw_surface_blend.gml +++ b/scripts/draw_surface_blend/draw_surface_blend.gml @@ -4,40 +4,37 @@ BLEND_TYPES = [ "Normal", "Add", "Subtract", "Subtract keep alpha", "Multiply", enum BLEND_MODE { normal, add, - subtract, - subtract_alpha, - multiply, - multiply_alpha, - screen, - screen_alpha, - contrast, overlay, + hue, + sat, + luma, maxx, minn, } -function draw_surface_blend(background, foreground, blend, alpha, _mask = 0, tile = 0) { +function draw_surface_blend(background, foreground, blend, alpha, _pre_alp = true, _mask = 0, tile = 0) { if(!is_surface(background)) return; var sh = sh_blend_normal switch(blend) { - case BLEND_MODE.normal : sh = sh_blend_normal break; - case BLEND_MODE.add : sh = sh_blend_add; break; - case BLEND_MODE.subtract : sh = sh_blend_subtract; break; - case BLEND_MODE.subtract_alpha : sh = sh_blend_subtract_alpha; break; - case BLEND_MODE.multiply : sh = sh_blend_multiply; break; - case BLEND_MODE.multiply_alpha : sh = sh_blend_multiply_alpha; break; - case BLEND_MODE.screen : sh = sh_blend_screen; break; - case BLEND_MODE.screen_alpha : sh = sh_blend_screen_alpha; break; - case BLEND_MODE.contrast : sh = sh_blend_contrast; break; - case BLEND_MODE.overlay : sh = sh_blend_overlay; break; - case BLEND_MODE.maxx : sh = sh_blend_max; break; - case BLEND_MODE.minn : sh = sh_blend_min; break; + case BLEND_MODE.normal : sh = sh_blend_normal break; + case BLEND_MODE.add : sh = sh_blend_add; break; + case BLEND_MODE.subtract : sh = sh_blend_subtract; break; + case BLEND_MODE.multiply : sh = sh_blend_multiply; break; + case BLEND_MODE.screen : sh = sh_blend_screen; break; + case BLEND_MODE.contrast : sh = sh_blend_contrast; break; + case BLEND_MODE.overlay : sh = sh_blend_overlay; break; + case BLEND_MODE.hue : sh = sh_blend_hue; break; + case BLEND_MODE.sat : sh = sh_blend_sat; break; + case BLEND_MODE.luma : sh = sh_blend_luma; break; + + case BLEND_MODE.maxx : sh = sh_blend_max; break; + case BLEND_MODE.minn : sh = sh_blend_min; break; } var uniform_foreground = shader_get_sampler_index(sh, "fore"); @@ -46,6 +43,7 @@ function draw_surface_blend(background, foreground, blend, alpha, _mask = 0, til var uniform_is_mask = shader_get_uniform(sh, "useMask"); var uniform_alpha = shader_get_uniform(sh, "opacity"); var uniform_tile = shader_get_uniform(sh, "tile_type"); + var uniform_presalpha = shader_get_uniform(sh, "preserveAlpha"); var surf = surface_get_target(); var surf_w = surface_get_width(surf); @@ -58,6 +56,7 @@ function draw_surface_blend(background, foreground, blend, alpha, _mask = 0, til shader_set_uniform_i(uniform_is_mask, _mask != 0? 1 : 0); shader_set_uniform_f_array(uniform_dim_rat, [ surface_get_width(background) / surface_get_width(foreground), surface_get_height(background) / surface_get_height(foreground) ]); shader_set_uniform_f(uniform_alpha, alpha); + shader_set_uniform_i(uniform_presalpha, _pre_alp); shader_set_uniform_i(uniform_tile, tile); } diff --git a/scripts/draw_text_function/draw_text_function.gml b/scripts/draw_text_function/draw_text_function.gml index c2c5bd49b..381bae89d 100644 --- a/scripts/draw_text_function/draw_text_function.gml +++ b/scripts/draw_text_function/draw_text_function.gml @@ -1,11 +1,23 @@ -function draw_text_add(_x, _y, _text) { - BLEND_OVERRIDE +function draw_text_over(_x, _y, _text) { + BLEND_OVERRIDE; draw_text(_x, _y, _text); - BLEND_NORMAL + BLEND_NORMAL; +} + +function draw_text_ext_over(_x, _y, _text, _sep, _w) { + BLEND_OVERRIDE; + draw_text_ext(_x, _y, _text, _sep, _w); + BLEND_NORMAL; +} + +function draw_text_add(_x, _y, _text) { + BLEND_ADD; + draw_text(_x, _y, _text); + BLEND_NORMAL; } function draw_text_ext_add(_x, _y, _text, _sep, _w) { - BLEND_OVERRIDE + BLEND_ADD; draw_text_ext(_x, _y, _text, _sep, _w); - BLEND_NORMAL -} \ No newline at end of file + BLEND_NORMAL; +} diff --git a/scripts/event_recorder/event_recorder.gml b/scripts/event_recorder/event_recorder.gml index f9ff7cf87..4664924cf 100644 --- a/scripts/event_recorder/event_recorder.gml +++ b/scripts/event_recorder/event_recorder.gml @@ -15,9 +15,15 @@ enum ACTION_TYPE { node_added, node_delete, junction_connect, + junction_disconnect, group_added, group_removed, + + group, + ungroup, + + collection_loaded, } enum DS_TYPE { @@ -29,12 +35,13 @@ function Action(_type, _object, _data) constructor { type = _type; obj = _object; data = _data; + extra_data = 0; static undo = function() { var _n; switch(type) { - case ACTION_TYPE.var_modify : + case ACTION_TYPE.var_modify : if(is_struct(obj)) { _n = variable_struct_get(obj, data[1]); variable_struct_set(obj, data[1], data[0]); @@ -47,6 +54,7 @@ function Action(_type, _object, _data) constructor { case ACTION_TYPE.list_insert : if(!ds_exists(obj, ds_type_list)) return; ds_list_delete(obj, data[1]); + PANEL_ANIMATION.updatePropertyList(); break; case ACTION_TYPE.list_modify : if(!ds_exists(obj, ds_type_list)) return; @@ -62,19 +70,33 @@ function Action(_type, _object, _data) constructor { nodeDelete(obj); break; case ACTION_TYPE.node_delete : - ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); + obj.restore(); break; case ACTION_TYPE.junction_connect : var _d = obj.value_from; obj.setFrom(data); data = _d; break; + case ACTION_TYPE.junction_disconnect : + obj.setFrom(data); + break; case ACTION_TYPE.group_added : obj.remove(data); break; case ACTION_TYPE.group_removed : obj.add(data); break; + case ACTION_TYPE.group : + upgroupNode(obj, false); + break; + case ACTION_TYPE.ungroup : + obj.restore(); + groupNodes(data.content, obj, false); + break; + case ACTION_TYPE.collection_loaded : + for( var i = 0; i < array_length(obj); i++ ) + nodeDelete(obj[i]); + break; } } @@ -94,6 +116,7 @@ function Action(_type, _object, _data) constructor { case ACTION_TYPE.list_insert : if(!ds_exists(obj, ds_type_list)) return; ds_list_insert(obj, data[1], data[0]); + PANEL_ANIMATION.updatePropertyList(); break; case ACTION_TYPE.list_modify : if(!ds_exists(obj, ds_type_list)) return; @@ -106,7 +129,7 @@ function Action(_type, _object, _data) constructor { ds_list_delete(obj, data[1]); break; case ACTION_TYPE.node_added : - ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); + obj.restore(); break; case ACTION_TYPE.node_delete : nodeDelete(obj); @@ -116,23 +139,43 @@ function Action(_type, _object, _data) constructor { obj.setFrom(data); data = _d; break; + case ACTION_TYPE.junction_disconnect : + obj.removeFrom(); + break; case ACTION_TYPE.group_added : obj.add(data); break; case ACTION_TYPE.group_removed : obj.remove(data); break; - } + case ACTION_TYPE.group : + obj.restore(); + groupNodes(data.content, obj, false); + break; + case ACTION_TYPE.ungroup : + upgroupNode(obj, false); + break; + case ACTION_TYPE.collection_loaded : + for( var i = 0; i < array_length(obj); i++ ) + obj[i].restore(); + break; + } } static toString = function() { var ss = ""; switch(type) { case ACTION_TYPE.var_modify : - ss = "modify " + string(data[1]); + if(array_length(data) > 2) + ss = "modify " + string(data[2]); + else + ss = "modify " + string(data[1]); break; case ACTION_TYPE.list_insert : - ss = "insert " + string(data[1]) + " to list " + string(obj); + if(array_length(data) > 2) + ss = data[2]; + else + ss = "insert " + string(data[1]) + " to list " + string(obj); break; case ACTION_TYPE.list_modify : ss = "modify " + string(data[1]) + " of list " + string(obj); @@ -147,7 +190,10 @@ function Action(_type, _object, _data) constructor { ss = "deleted " + string(obj.name) + " node"; break; case ACTION_TYPE.junction_connect : - ss = "connect " + string(obj.name) + " junction"; + ss = "connect " + string(obj.name); + break; + case ACTION_TYPE.junction_disconnect : + ss = "disconnect " + string(obj.name); break; case ACTION_TYPE.group_added : ss = "add " + string(obj.name) + " to group"; @@ -155,32 +201,40 @@ function Action(_type, _object, _data) constructor { case ACTION_TYPE.group_removed : ss = "remove " + string(obj.name) + " from group"; break; + case ACTION_TYPE.group : + ss = "group " + string(array_length(data.content)) + " nodes"; + break; + case ACTION_TYPE.ungroup : + ss = "ungroup " + string(obj.name) + " node"; + break; + case ACTION_TYPE.collection_loaded : + ss = "load " + string(filename_name(data)); + break; } return ss; } } -function recordAction(_type, _object, _data = -1) { +function recordAction(_type, _object, _data = -1) { if(IS_UNDOING) return; - if(UNDO_HOLDING) return; if(LOADING) return; + if(UNDO_HOLDING) return; var act = new Action(_type, _object, _data); array_push(o_main.action_last_frame, act); + ds_stack_clear(REDO_STACK); return act; } function UNDO() { - if(ds_stack_empty(UNDO_STACK)) return; - if(instance_exists(_p_dialog)) return; + if(ds_stack_empty(UNDO_STACK)) return; + if(instance_exists(_p_dialog_undo_block)) return; IS_UNDOING = true; var actions = ds_stack_pop(UNDO_STACK); - for(var i = 0; i < array_length(actions); i++) { - //print("UNDO " + actions[i].toString()); + for(var i = array_length(actions) - 1; i >= 0; i--) actions[i].undo(); - } IS_UNDOING = false; Render(); @@ -188,14 +242,13 @@ function UNDO() { } function REDO() { - if(ds_stack_empty(REDO_STACK)) return; + if(ds_stack_empty(REDO_STACK)) return; + if(instance_exists(_p_dialog_undo_block)) return; IS_UNDOING = true; var actions = ds_stack_pop(REDO_STACK); - for(var i = 0; i < array_length(actions); i++) { - //print("REDO " + actions[i].toString()); + for(var i = 0; i < array_length(actions); i++) actions[i].redo(); - } IS_UNDOING = false; Render(); diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index c46cac7bb..b79b942bc 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -4,8 +4,21 @@ enum GRADIENT_INTER { hue } +function gradientKey(time, value) constructor { + self.time = time; + self.value = value; + + static clone = function() { return new gradientKey(time, value); } + + static serialize = function() { + var m = ds_map_create(); + m[? "time"] = time; + m[? "value"] = value; + return m; + } +} + function draw_gradient(_x, _y, _w, _h, _grad, _int = GRADIENT_INTER.smooth) { - if(!ds_exists(_grad, ds_type_list)) return; static RES = 48; var _step = _w / RES; var _ox, _oc; @@ -18,22 +31,22 @@ function draw_gradient(_x, _y, _w, _h, _grad, _int = GRADIENT_INTER.smooth) { var _grad_color = []; var _grad_time = []; - for(var i = 0; i < ds_list_size(_grad); i++) { - _grad_color[i * 4 + 0] = color_get_red(_grad[| i].value) / 255; - _grad_color[i * 4 + 1] = color_get_green(_grad[| i].value) / 255; - _grad_color[i * 4 + 2] = color_get_blue(_grad[| i].value) / 255; + for(var i = 0; i < array_length(_grad); i++) { + _grad_color[i * 4 + 0] = color_get_red(_grad[i].value) / 255; + _grad_color[i * 4 + 1] = color_get_green(_grad[i].value) / 255; + _grad_color[i * 4 + 2] = color_get_blue(_grad[i].value) / 255; _grad_color[i * 4 + 3] = 1; - _grad_time[i] = _grad[| i].time; + _grad_time[i] = _grad[i].time; } - if(ds_list_empty(_grad)) { + if(array_length(_grad) == 0) { draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _w, _h) } else { shader_set(sh_gradient_display); shader_set_uniform_i(uniform_grad_blend, _int); - shader_set_uniform_f_array(uniform_grad, _grad_color); - shader_set_uniform_f_array(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, ds_list_size(_grad)); + shader_set_uniform_f_array_safe(uniform_grad, _grad_color); + shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); + shader_set_uniform_i(uniform_grad_key, array_length(_grad)); draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _w, _h) shader_reset(); @@ -41,50 +54,62 @@ function draw_gradient(_x, _y, _w, _h, _grad, _int = GRADIENT_INTER.smooth) { } function gradient_eval(_gradient, _time, _int = GRADIENT_INTER.smooth) { - if(!ds_exists(_gradient, ds_type_list)) return c_white; - if(ds_list_size(_gradient) == 0) return c_white; - if(ds_list_size(_gradient) == 1) return _gradient[| 0].value; + if(array_length(_gradient) == 0) return c_white; + if(array_length(_gradient) == 1) return _gradient[0].value; - for(var i = 0; i < ds_list_size(_gradient); i++) { - var _key = _gradient[| i]; + for(var i = 0; i < array_length(_gradient); i++) { + var _key = _gradient[i]; if(_key.time < _time) continue; - if(_key.time == _time) return _gradient[| i].value; + if(_key.time == _time) return _gradient[i].value; if(i == 0) //before first color - return _gradient[| 0].value; + return _gradient[0].value; - var c0 = _gradient[| i - 1].value; + var c0 = _gradient[i - 1].value; if(_int == GRADIENT_INTER.smooth) { - var rat = (_time - _gradient[| i - 1].time) / (_gradient[| i].time - _gradient[| i - 1].time); - var c1 = _gradient[| i].value; + var rat = (_time - _gradient[i - 1].time) / (_gradient[i].time - _gradient[i - 1].time); + var c1 = _gradient[i].value; return merge_color(c0, c1, rat); } else if(_int == GRADIENT_INTER.none) { return c0; } } - return _gradient[| ds_list_size(_gradient) - 1].value; //after last color + return _gradient[array_length(_gradient) - 1].value; //after last color } function gradient_add(_gradient, _addkey, _deleteDup) { - if(!ds_exists(_gradient, ds_type_list)) return; - - if(ds_list_size(_gradient) == 0) { - ds_list_add(_gradient, _addkey); + if(array_length(_gradient) == 0) { + array_push(_gradient, _addkey); return; } - for(var i = 0; i < ds_list_size(_gradient); i++) { - var _key = _gradient[| i]; + for(var i = 0; i < array_length(_gradient); i++) { + var _key = _gradient[i]; + if(_key.time == _addkey.time) { if(_deleteDup) _key.value = _addkey.value; return; } else if(_key.time > _addkey.time) { - ds_list_insert(_gradient, i, _addkey); + array_insert(_gradient, i, _addkey); return; } } - ds_list_add(_gradient, _addkey); + array_push(_gradient, _addkey); +} + +function gradient_to_array(_gradient) { + var _grad_color = [], _grad_time = []; + + for(var i = 0; i < array_length(_gradient); i++) { + _grad_color[i * 4 + 0] = color_get_red(_gradient[i].value) / 255; + _grad_color[i * 4 + 1] = color_get_green(_gradient[i].value) / 255; + _grad_color[i * 4 + 2] = color_get_blue(_gradient[i].value) / 255; + _grad_color[i * 4 + 3] = 1; + _grad_time[i] = _gradient[i].time; + } + + return [ _grad_color, _grad_time ]; } \ No newline at end of file diff --git a/scripts/json_file/json_file.gml b/scripts/json_file/json_file.gml index 1f098c94a..31258fdd1 100644 --- a/scripts/json_file/json_file.gml +++ b/scripts/json_file/json_file.gml @@ -1,3 +1,11 @@ +function json_encode_minify(map) { + return json_minify(json_encode(map)); +} + +function json_stringify_minify(map) { + return json_minify(json_stringify(map)); +} + function json_load(path) { if(!file_exists(path)) return noone; @@ -9,8 +17,8 @@ function json_load(path) { return js; } -function json_save(path, struct) { - var s = json_encode(struct); +function json_save(path, map) { + var s = json_encode_minify(map); var f = file_text_open_write(path); file_text_write_string(f, s); @@ -29,7 +37,7 @@ function json_load_struct(path) { } function json_save_struct(path, struct) { - var s = json_stringify(struct); + var s = json_stringify_minify(struct); var f = file_text_open_write(path); file_text_write_string(f, s); diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index 7dbe7f5ea..52bc0ff4c 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -8,26 +8,28 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor { b_link.icon = THEME.value_link; onModifyIndex = function(index, val) { + var modi = false; + if(linked) { for( var i = 0; i < size; i++ ) - onModify(i, toNumber(val)); - return; + modi |= onModify(i, toNumber(val)); + return modi; } - onModify(index, toNumber(val)); + return onModify(index, toNumber(val)); } - onModifySingle[0] = function(val) { onModifyIndex(0, val); } - onModifySingle[1] = function(val) { onModifyIndex(1, val); } - onModifySingle[2] = function(val) { onModifyIndex(2, val); } + onModifySingle[0] = function(val) { return onModifyIndex(0, val); } + onModifySingle[1] = function(val) { return onModifyIndex(1, val); } + onModifySingle[2] = function(val) { return onModifyIndex(2, val); } - onModifySingle[3] = function(val) { onModifyIndex(3, val); } - onModifySingle[4] = function(val) { onModifyIndex(4, val); } - onModifySingle[5] = function(val) { onModifyIndex(5, val); } + onModifySingle[3] = function(val) { return onModifyIndex(3, val); } + onModifySingle[4] = function(val) { return onModifyIndex(4, val); } + onModifySingle[5] = function(val) { return onModifyIndex(5, val); } - onModifySingle[6] = function(val) { onModifyIndex(6, val); } - onModifySingle[7] = function(val) { onModifyIndex(7, val); } - onModifySingle[8] = function(val) { onModifyIndex(8, val); } + onModifySingle[6] = function(val) { return onModifyIndex(6, val); } + onModifySingle[7] = function(val) { return onModifyIndex(7, val); } + onModifySingle[8] = function(val) { return onModifyIndex(8, val); } extras = -1; @@ -60,6 +62,11 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor { tb[i].slidable = true; } + static setSlideSpeed = function(speed) { + for(var i = 0; i < size; i++) + tb[i].slide_speed = speed; + } + static draw = function(_x, _y, _w, _h, _data, _m) { x = _x; y = _y; diff --git a/scripts/migration_function/migration_function.gml b/scripts/migration_function/migration_function.gml new file mode 100644 index 000000000..d21dfbd4b --- /dev/null +++ b/scripts/migration_function/migration_function.gml @@ -0,0 +1,12 @@ +function __migration_check() { + var oldDir = environment_get_variable("userprofile") + "\\AppData\\Local\\Pixels Composer\\"; + if(!directory_exists(oldDir)) return; + + var mig = oldDir + "migration"; + if(file_exists(mig)) return; + + var f = file_text_open_write(mig); + file_text_close(f); + + dialogCall(o_dialog_migration); +} \ No newline at end of file diff --git a/scripts/migration_function/migration_function.yy b/scripts/migration_function/migration_function.yy new file mode 100644 index 000000000..64a8d4ea6 --- /dev/null +++ b/scripts/migration_function/migration_function.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "migration_function", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "migration", + "path": "folders/functions/migration.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_2d_light/node_2d_light.gml b/scripts/node_2d_light/node_2d_light.gml index d3b20e848..f4b39aa7f 100644 --- a/scripts/node_2d_light/node_2d_light.gml +++ b/scripts/node_2d_light/node_2d_light.gml @@ -14,53 +14,56 @@ function Node_2D_light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_band = shader_get_uniform(shader, "band"); uniform_attn = shader_get_uniform(shader, "atten"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Light shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Light shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Point", "Line", "Line asymmetric", "Spot" ]); - inputs[| 2] = nodeValue(2, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16]) + inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); + inputs[| 3] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); - inputs[| 4] = nodeValue(4, "Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 4] = nodeValue("Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 6] = nodeValue(6, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16]) + inputs[| 6] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Finish", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 16]) + inputs[| 7] = nodeValue("Finish", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 16]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 8] = nodeValue(8, "Sweep", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 15) + inputs[| 8] = nodeValue("Sweep", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 15) .setDisplay(VALUE_DISPLAY.slider, [-80, 80, 1]); - inputs[| 9] = nodeValue(9, "Sweep end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 9] = nodeValue("Sweep end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.slider, [-80, 80, 1]); - inputs[| 10] = nodeValue(10, "Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 10] = nodeValue("Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 1]); - inputs[| 11] = nodeValue(11, "Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.") + inputs[| 11] = nodeValue("Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.") .setDisplay(VALUE_DISPLAY.enum_scroll, ["Quadratic", "Invert quadratic", "Linear"]); - inputs[| 12] = nodeValue(12, "Radial banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 12] = nodeValue("Radial banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 1]); - inputs[| 13] = nodeValue(13, "Radial start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 13] = nodeValue("Radial start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 14] = nodeValue(14, "Radial band ratio", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 14] = nodeValue("Radial band ratio", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Light only", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - input_display_list = [ 0, + inputs[| 15] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 15; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Light only", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 15, 0, ["Shape", false], 1, 2, 6, 7, 8, 9, ["Light", false], 3, 4, 5, 12, 13, 14, ["Render", false], 11, 10 @@ -150,14 +153,14 @@ function Node_2D_light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con } else draw_clear_alpha(c_black, 1); - BLEND_ADD + BLEND_ADD; shader_set(shader); gpu_set_colorwriteenable(1, 1, 1, 0); shader_set_uniform_f(uniform_intn, _inten); shader_set_uniform_f(uniform_band, _band); shader_set_uniform_f(uniform_attn, _attn); - shader_set_uniform_f_array(uniform_colr, [ color_get_red(_color) / 255, color_get_green(_color) / 255, color_get_blue(_color) / 255 ]); + shader_set_uniform_f_array_safe(uniform_colr, [ color_get_red(_color) / 255, color_get_green(_color) / 255, color_get_blue(_color) / 255 ]); switch(_shape) { case LIGHT_SHAPE_2D.point : @@ -235,7 +238,7 @@ function Node_2D_light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con gpu_set_colorwriteenable(1, 1, 1, 1); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_3d_combine/node_3d_combine.gml b/scripts/node_3d_combine/node_3d_combine.gml index 8833e9d3f..0f4728b46 100644 --- a/scripts/node_3d_combine/node_3d_combine.gml +++ b/scripts/node_3d_combine/node_3d_combine.gml @@ -1,43 +1,56 @@ function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "3D Combine"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) - .setDisplay(VALUE_DISPLAY.vector); - - inputs[| 1] = nodeValue(1, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) - .setDisplay(VALUE_DISPLAY.vector); - - inputs[| 2] = nodeValue(2, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) - .setDisplay(VALUE_DISPLAY.vector); - - inputs[| 3] = nodeValue(3, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) - .setDisplay(VALUE_DISPLAY.vector); - - inputs[| 4] = nodeValue(4, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector) - .setUnitRef( function() { return inputs[| 2].getValue(); }); + .rejectArray(); - inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) - .setDisplay(VALUE_DISPLAY.vector); - - inputs[| 6] = nodeValue(6, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) - .setDisplay(VALUE_DISPLAY.rotation); - - inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) - .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - - inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) - .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + inputs[| 1] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 2] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 3] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); + + inputs[| 4] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef( function() { return inputs[| 2].getValue(); }) + .rejectArray(); + + inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 11] = nodeValue(11, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 6] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.rotation) + .rejectArray(); - inputs[| 12] = nodeValue(12, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) - .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); + inputs[| 7] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]) + .rejectArray(); + + inputs[| 8] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) + .rejectArray(); + + inputs[| 9] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + .rejectArray(); + + inputs[| 10] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey) + .rejectArray(); + + inputs[| 11] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); + + inputs[| 12] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]) + .rejectArray(); input_display_list = [ 0, ["Object transform", false], 1, 2, 3, @@ -50,11 +63,11 @@ function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor input_fix_len = ds_list_size(inputs); input_display_len = array_length(input_display_list); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D objects", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D objects", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 @@ -64,7 +77,7 @@ function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone ) + inputs[| index] = nodeValue("3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone ) .setVisible(true, true); array_push(input_display_list, index); @@ -131,7 +144,7 @@ function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor _3d_clear_local_transform(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _dim = inputs[| 0].getValue(); var _lpos = inputs[| 1].getValue(); var _lrot = inputs[| 2].getValue(); diff --git a/scripts/node_3d_extrude/node_3d_extrude.gml b/scripts/node_3d_extrude/node_3d_extrude.gml index daf8c74fa..78d402242 100644 --- a/scripts/node_3d_extrude/node_3d_extrude.gml +++ b/scripts/node_3d_extrude/node_3d_extrude.gml @@ -1,56 +1,57 @@ function Node_3D_Extrude(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "3D Extrude"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 2] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 180, 0 ]) + inputs[| 3] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 180, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 0.1 ]) + inputs[| 4] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 0.1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 5] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef( function() { return inputs[| 1].getValue(); }); - inputs[| 6] = nodeValue(6, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 6] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 7] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 8] = nodeValue(8, "Manual generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 8] = nodeValue("Manual generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { generateMesh(); update(); }, "Generate"] ); - inputs[| 9] = nodeValue(9, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 9] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 10] = nodeValue(10, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 10] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 11] = nodeValue(11, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 11] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 12] = nodeValue(12, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 13] = nodeValue(13, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 12] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 13] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 14] = nodeValue(14, "Height map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 14] = nodeValue("Height map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 15] = nodeValue(15, "Always update", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 15] = nodeValue("Always update", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 16] = nodeValue(16, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 16] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 17] = nodeValue(17, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 17] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); input_display_list = [1, @@ -60,11 +61,11 @@ function Node_3D_Extrude(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c ["Light", false], 9, 10, 11, 12, 13, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function(index) { return submit_vertex(index); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function(index) { return submit_vertex(index); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 diff --git a/scripts/node_3d_obj/node_3D_obj.gml b/scripts/node_3d_obj/node_3D_obj.gml index 88748714a..28e22c2f5 100644 --- a/scripts/node_3d_obj/node_3D_obj.gml +++ b/scripts/node_3d_obj/node_3D_obj.gml @@ -9,57 +9,66 @@ function Node_create_3D_Obj_path(_x, _y, path) { function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "3D Object"; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, [ "*.obj", "" ]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, [ "*.obj", "" ]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { updateObj(); doUpdate(); }, "Generate"] ); - inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 2] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 3] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef( function() { return inputs[| 2].getValue(); }); - inputs[| 4] = nodeValue(4, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 4] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) - .setDisplay(VALUE_DISPLAY.rotation); + inputs[| 6] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.rotation) + .rejectArray(); - inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) - .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); + inputs[| 7] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]) + .rejectArray(); - inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) - .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + inputs[| 8] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) + .rejectArray(); - inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 9] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + .rejectArray(); - inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 10] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey) + .rejectArray(); - inputs[| 11] = nodeValue(11, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 11] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 12] = nodeValue(12, "Flip UV", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Flip UV axis, can be use to fix some texture mapping error."); + inputs[| 12] = nodeValue("Flip UV", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Flip UV axis, can be use to fix some texture mapping error.") + .rejectArray(); - inputs[| 13] = nodeValue(13, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 180 ]) + inputs[| 13] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 180 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 14] = nodeValue(14, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 14] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 15] = nodeValue(15, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 15] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 16] = nodeValue(16, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) - .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); + inputs[| 16] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]) + .rejectArray(); input_display_list = [ 2, ["Geometry", false], 0, 1, @@ -71,11 +80,11 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { input_length = ds_list_size(inputs); input_display_len = array_length(input_display_list); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 @@ -84,26 +93,25 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { _3d_node_init(2, /*Transform*/ 3, 13, 5); function reset_tex() { - tex_surface = PIXEL_SURFACE; + tex_surface = surface_create(1, 1); surface_set_target(tex_surface); draw_clear(c_black); surface_reset_target(); } reset_tex(); - static onValueUpdate = function(index) { - if(index == 12) updateObj(); + static onValueUpdate = function(index = 0) { + if(index == 12) updateObj(false); } function setPath(path) { inputs[| 0].setValue(path); updateObj(); - doUpdate(); } function createMaterial(m_index) { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, materialNames[m_index] + " texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface); + inputs[| index] = nodeValue(materialNames[m_index] + " texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface); inputs[| index].setVisible(true); input_display_list[input_display_len + m_index] = index; @@ -131,28 +139,35 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { materialIndex = []; materials = []; - static updateObj = function() { + static updateObj = function(updateMat = true) { var _path = inputs[| 0].getValue(); var _flip = inputs[| 12].getValue(); + var _dir = filename_dir(_path); var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl"; var _v = readObj(_path, _flip); + if(_v != noone) { - VB = _v[0]; - materialNames = _v[1]; - materialIndex = _v[2]; - use_normal = _v[3]; + VB = _v.vertex_groups; + materialNames = _v.materials; + materialIndex = _v.material_index; + use_normal = _v.use_normal; + if(_v.mtl_path != "") + _pathMtl = _dir + "\\" + _v.mtl_path; } - if(array_length(materialNames)) - materials = readMtl(_pathMtl); - else { - materialNames = ["Material"]; - materialIndex = [0]; - materials = [ new MTLmaterial("Material") ]; - } + if(updateMat) { + if(array_length(materialNames)) + materials = readMtl(_pathMtl); + else { + materialNames = ["Material"]; + materialIndex = [0]; + materials = [ new MTLmaterial("Material") ]; + } - do_reset_material = true; + do_reset_material = true; + } + update(); } do_reset_material = false; @@ -168,7 +183,6 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { _3d_local_transform(_lpos, _lrot, _lsca); for(var i = 0; i < array_length(VB); i++) { - if(i >= ds_list_size(inputs)) break; if(i >= array_length(materialIndex)) continue; var mIndex = materialIndex[i]; @@ -181,7 +195,7 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { _3d_clear_local_transform(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(!surface_exists(tex_surface)) reset_tex(); if(do_reset_material) { diff --git a/scripts/node_3d_object_transform/node_3d_object_transform.gml b/scripts/node_3d_object_transform/node_3d_object_transform.gml index 155b5191e..31849db48 100644 --- a/scripts/node_3d_object_transform/node_3d_object_transform.gml +++ b/scripts/node_3d_object_transform/node_3d_object_transform.gml @@ -1,45 +1,46 @@ -function Node_3D_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { +function Node_3D_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "3D Transform"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 1] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 2] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 3] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 4] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef( function() { return inputs[| 2].getValue(); }); - inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 6] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 7] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 8] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 9] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 10] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 11] = nodeValue(11, "3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone) + inputs[| 11] = nodeValue("3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone) .setVisible(true, true); - inputs[| 12] = nodeValue(12, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 12] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 13] = nodeValue(13, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 13] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); input_display_list = [ 0, 11, @@ -48,11 +49,11 @@ function Node_3D_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) construct ["Light", true], 6, 7, 8, 9, 10, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 @@ -83,40 +84,39 @@ function Node_3D_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) construct _3d_clear_local_transform(); } - static update = function() { - var _dim = inputs[| 0].getValue(); - var _lpos = inputs[| 1].getValue(); - var _lrot = inputs[| 2].getValue(); - var _lsca = inputs[| 3].getValue(); - - var _pos = inputs[| 4].getValue(); - var _sca = inputs[| 5].getValue(); - - var _ldir = inputs[| 6].getValue(); - var _lhgt = inputs[| 7].getValue(); - var _lint = inputs[| 8].getValue(); - var _lclr = inputs[| 9].getValue(); - var _aclr = inputs[| 10].getValue(); - + static step = function() { var _proj = inputs[| 12].getValue(); - var _fov = inputs[| 13].getValue(); - inputs[| 13].setVisible(_proj); + } + + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var _dim = _data[0]; + var _lpos = _data[1]; + var _lrot = _data[2]; + var _lsca = _data[3]; - for( var i = 0; i < array_length(output_display_list) - 1; i++ ) { - var ind = output_display_list[i]; - var _outSurf = outputs[| ind].getValue(); - outputs[| ind].setValue(surface_verify(_outSurf, _dim[0], _dim[1])); - - var pass = "diff"; - switch(ind) { - case 0 : pass = "diff" break; - case 2 : pass = "norm" break; - } + var _pos = _data[4]; + var _sca = _data[5]; - _3d_pre_setup(_outSurf, _dim, _pos, _sca, _ldir, _lhgt, _lint, _lclr, _aclr, _lpos, _lrot, _lsca, _proj, _fov, pass, false); - submit_vertex(); - _3d_post_setup(); + var _ldir = _data[ 6]; + var _lhgt = _data[ 7]; + var _lint = _data[ 8]; + var _lclr = _data[ 9]; + var _aclr = _data[10]; + + var _proj = _data[12]; + var _fov = _data[13]; + + var pass = "diff"; + switch(_output_index) { + case 0 : pass = "diff" break; + case 2 : pass = "norm" break; } + + _3d_pre_setup(_outSurf, _dim, _pos, _sca, _ldir, _lhgt, _lint, _lclr, _aclr, _lpos, _lrot, _lsca, _proj, _fov, pass, false); + submit_vertex(); + _3d_post_setup(); + + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_3d_plane/node_3d_plane.gml b/scripts/node_3d_plane/node_3d_plane.gml index 182bc86a9..3d59d5bda 100644 --- a/scripts/node_3d_plane/node_3d_plane.gml +++ b/scripts/node_3d_plane/node_3d_plane.gml @@ -1,40 +1,42 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "3D Plane"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) + inputs[| 1] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); - inputs[| 2] = nodeValue(2, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 2] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 3] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_input) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Same as input", "Constant", "Relative to input" ]); + inputs[| 4] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_input) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Same as input", "Constant", "Relative to input" ]) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Constant dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 5] = nodeValue("Constant dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 6] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 7] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 8] = nodeValue(8, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 8] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 9] = nodeValue(9, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 9] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); - inputs[| 10] = nodeValue(10, "Texture scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 10] = nodeValue("Texture scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 11] = nodeValue(11, "Texture shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 11] = nodeValue("Texture shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); input_display_list = [0, @@ -44,9 +46,9 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con ["Texture", false], 10, 11, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); output_display_list = [ 0, 1 @@ -71,8 +73,9 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con var _inSurf = getSingleValue(0, index); _3d_local_transform(_lpos, _lrot, _lsca); - - vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(_inSurf)); + + if(is_surface(_inSurf)) + vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(_inSurf)); _3d_clear_local_transform(); } @@ -123,7 +126,7 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader = sh_vertex_pt; shader_set(shader); @@ -131,8 +134,8 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniUVscale = shader_get_uniform(shader, "UVscale"); uniUVshift = shader_get_uniform(shader, "UVshift"); - shader_set_uniform_f_array(uniUVscale, _uvSca); - shader_set_uniform_f_array(uniUVshift, _uvShf); + shader_set_uniform_f_array_safe(uniUVscale, _uvSca); + shader_set_uniform_f_array_safe(uniUVshift, _uvShf); var cam_view, cam_proj; if(_proj == CAMERA_PROJ.ortho) { @@ -166,7 +169,7 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con matrix_stack_clear(); matrix_set(matrix_world, MATRIX_IDENTITY); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_3d_prim_cone/node_3d_prim_cone.gml b/scripts/node_3d_prim_cone/node_3d_prim_cone.gml index 2bed2c71c..182c5e751 100644 --- a/scripts/node_3d_prim_cone/node_3d_prim_cone.gml +++ b/scripts/node_3d_prim_cone/node_3d_prim_cone.gml @@ -1,51 +1,52 @@ function Node_3D_Cone(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "3D Cone"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 1] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 2] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 3] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 4] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 5] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 6] = nodeValue(6, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 6] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 7] = nodeValue(7, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 7] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 8] = nodeValue(8, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 9] = nodeValue(9, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 8] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 9] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 10] = nodeValue(10, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 10] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 11] = nodeValue(11, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 11] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 12] = nodeValue(12, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 12] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 13] = nodeValue(13, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 13] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); - inputs[| 14] = nodeValue(14, "Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); + inputs[| 14] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); - inputs[| 15] = nodeValue(15, "Textures base", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 15] = nodeValue("Textures base", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 16] = nodeValue(16, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 16] = nodeValue("Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); input_display_list = [0, ["Geometry", false], 14, @@ -55,11 +56,11 @@ function Node_3D_Cone(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons ["Light", false], 5, 6, 7, 8, 9, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 diff --git a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml index b0fb60f7a..79e3be4e8 100644 --- a/scripts/node_3d_prim_cube/node_3d_prim_cube.gml +++ b/scripts/node_3d_prim_cube/node_3d_prim_cube.gml @@ -2,56 +2,57 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons name = "3D Cube"; dimension_index = 1; - inputs[| 0] = nodeValue(0, "Main texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); + inputs[| 0] = nodeValue("Main texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 2] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 3] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 4] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Textures per face", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 5] = nodeValue("Textures per face", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 6] = nodeValue( 6, "Textures 0", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 7] = nodeValue( 7, "Textures 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 8] = nodeValue( 8, "Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 9] = nodeValue( 9, "Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 10] = nodeValue(10, "Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 11] = nodeValue(11, "Textures 5", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 6] = nodeValue("Textures 0", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 7] = nodeValue("Textures 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 8] = nodeValue("Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 9] = nodeValue("Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 10] = nodeValue("Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); + inputs[| 11] = nodeValue("Textures 5", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false); - inputs[| 12] = nodeValue(12, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 12] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 13] = nodeValue(13, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 13] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 14] = nodeValue(14, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 14] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 15] = nodeValue(15, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 15] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 16] = nodeValue(16, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 16] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 17] = nodeValue(17, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 17] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 18] = nodeValue(18, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 18] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 19] = nodeValue(19, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 19] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 20] = nodeValue(20, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 20] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 21] = nodeValue(21, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 21] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); input_display_list = [1, @@ -61,11 +62,11 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons ["Light", false], 13, 14, 15, 16, 17, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function(index) { return submit_vertex(index); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function(index) { return submit_vertex(index); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 @@ -151,7 +152,7 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(_data[6 + i])); matrix_stack_pop(); } - } else { + } else if(is_surface(_inSurf)) { matrix_set(matrix_world, matrix_stack_top()); vertex_submit(PRIMITIVES[? "cube"], pr_trianglelist, surface_get_texture(_inSurf)); } diff --git a/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml b/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml index 6ec372ca9..5723ab574 100644 --- a/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml +++ b/scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.gml @@ -2,55 +2,56 @@ function Node_3D_Cylinder(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) name = "3D Cylinder"; dimension_index = 2; - inputs[| 0] = nodeValue(0, "Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); + inputs[| 0] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); - inputs[| 1] = nodeValue(1, "Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); + inputs[| 1] = nodeValue("Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); - inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 2] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 3] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 4] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 7] = nodeValue(7, "Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 8] = nodeValue(8, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 6] = nodeValue("Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 7] = nodeValue("Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 8] = nodeValue("Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 9] = nodeValue(9, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 9] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 10] = nodeValue(10, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 10] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 11] = nodeValue(11, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 11] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 12] = nodeValue(12, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 12] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 13] = nodeValue(13, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 14] = nodeValue(14, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 13] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 14] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 15] = nodeValue(15, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 15] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 16] = nodeValue(16, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 16] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 17] = nodeValue(17, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 17] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 18] = nodeValue(18, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 18] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); - inputs[| 19] = nodeValue(19, "Taper", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 19] = nodeValue("Taper", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]); input_display_list = [2, @@ -61,11 +62,11 @@ function Node_3D_Cylinder(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) ["Light", false], 10, 11, 12, 13, 14, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 diff --git a/scripts/node_3d_prim_sphere/node_3d_prim_sphere.gml b/scripts/node_3d_prim_sphere/node_3d_prim_sphere.gml index 452a06dea..5314ce00b 100644 --- a/scripts/node_3d_prim_sphere/node_3d_prim_sphere.gml +++ b/scripts/node_3d_prim_sphere/node_3d_prim_sphere.gml @@ -2,49 +2,50 @@ function Node_3D_Sphere(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co name = "3D Sphere"; dimension_index = 1; - inputs[| 0] = nodeValue(0, "Subdivisions", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [8, 4], "Amount of polygon in X and Y axis.") + inputs[| 0] = nodeValue("Subdivisions", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [8, 4], "Amount of polygon in X and Y axis.") .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 2] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 3] = nodeValue("Render rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 4] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Textures", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 5] = nodeValue("Textures", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 6] = nodeValue(6, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 6] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 7] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 8] = nodeValue(8, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 8] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 9] = nodeValue(9, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 9] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 10] = nodeValue(10, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 11] = nodeValue(11, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 10] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 11] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 12] = nodeValue(12, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 12] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 13] = nodeValue(13, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 13] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 14] = nodeValue(14, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 14] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 15] = nodeValue(15, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 15] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); input_display_list = [1, @@ -55,11 +56,11 @@ function Node_3D_Sphere(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co ["Light", false], 7, 8, 9, 10, 11, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D object", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 diff --git a/scripts/node_3d_repeat/node_3d_repeat.gml b/scripts/node_3d_repeat/node_3d_repeat.gml index 0f37eacf1..bafb188e8 100644 --- a/scripts/node_3d_repeat/node_3d_repeat.gml +++ b/scripts/node_3d_repeat/node_3d_repeat.gml @@ -1,67 +1,69 @@ function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "3D Repeat"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 1] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 2] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 3] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) + inputs[| 4] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef( function() { return inputs[| 0].getValue(); }); - inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 6] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 7] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 8] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 9] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 10] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 11] = nodeValue(11, "3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone) + inputs[| 11] = nodeValue("3D object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3object, noone) .setVisible(true, true); - inputs[| 12] = nodeValue(12, "Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Amount of copies to be generated."); + inputs[| 12] = nodeValue("Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Amount of copies to be generated."); - inputs[| 13] = nodeValue(13, "Repeat position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 0, 0 ]) + inputs[| 13] = nodeValue("Repeat position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 14] = nodeValue(14, "Repeat rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) + inputs[| 14] = nodeValue("Repeat rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 15] = nodeValue(15, "Repeat scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) + inputs[| 15] = nodeValue("Repeat scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 16] = nodeValue(16, "Repeat pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Linear", "Circular" ]); + inputs[| 16] = nodeValue("Repeat pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Linear", "Circular" ]) + .rejectArray(); - inputs[| 17] = nodeValue(17, "Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 17] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "x", "y", "z" ]); - inputs[| 18] = nodeValue(18, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 18] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 19] = nodeValue(19, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 360 ]) + inputs[| 19] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 360 ]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 20] = nodeValue(20, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); + inputs[| 20] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]) + .rejectArray(); - inputs[| 21] = nodeValue(21, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) + inputs[| 21] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); input_display_list = [ 0, 11, @@ -72,11 +74,11 @@ function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "3D objects", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); + outputs[| 1] = nodeValue("3D objects", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3object, function() { return submit_vertex(); }); - outputs[| 2] = nodeValue(2, "Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 2] = nodeValue("Normal pass", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); output_display_list = [ 0, 2, 1 @@ -152,7 +154,19 @@ function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor _3d_clear_local_transform(); } - static update = function() { + static step = function() { + var _proj = inputs[| 20].getValue(); + var _patt = inputs[| 16].getValue(); + + inputs[| 13].setVisible(_patt == 0); + + inputs[| 17].setVisible(_patt == 1); + inputs[| 18].setVisible(_patt == 1); + inputs[| 19].setVisible(_patt == 1); + inputs[| 21].setVisible(_proj); + } + + function update(frame = ANIMATOR.current_frame) { var _dim = inputs[| 0].getValue(); var _lpos = inputs[| 1].getValue(); var _lrot = inputs[| 2].getValue(); @@ -171,12 +185,6 @@ function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor var _fov = inputs[| 21].getValue(); var _patt = inputs[| 16].getValue(); - inputs[| 13].setVisible(_patt == 0); - - inputs[| 17].setVisible(_patt == 1); - inputs[| 18].setVisible(_patt == 1); - inputs[| 19].setVisible(_patt == 1); - inputs[| 21].setVisible(_proj); for( var i = 0; i < array_length(output_display_list) - 1; i++ ) { var ind = output_display_list[i]; diff --git a/scripts/node_9slice/node_9slice.gml b/scripts/node_9slice/node_9slice.gml index a4b66f9c4..959906ff7 100644 --- a/scripts/node_9slice/node_9slice.gml +++ b/scripts/node_9slice/node_9slice.gml @@ -1,19 +1,19 @@ function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Nine Slice"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Splice", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) + inputs[| 2] = nodeValue("Splice", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.padding) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Filling modes", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Filling modes", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Scale", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); drag_side = -1; drag_mx = 0; @@ -118,7 +118,7 @@ function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var ww = _dim[0]; var hh = _dim[1]; @@ -178,7 +178,7 @@ function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const } } - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml index 57ef2e424..7f361db9b 100644 --- a/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml +++ b/scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.gml @@ -4,7 +4,7 @@ function Node_VFX_Turbulence(_x, _y, _group = -1) : Node_VFX_effector(_x, _y, _g inputs[| 4].setVisible(false, false); - inputs[| 8] = nodeValue(8, "Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) + inputs[| 8] = nodeValue("Turbulence scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) .setVisible(true, false); array_push(input_display_list, 8); diff --git a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml index ad78af2d4..4e10c48c6 100644 --- a/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml +++ b/scripts/node_VFX_effect_vortex/node_VFX_effect_vortex.gml @@ -4,9 +4,9 @@ function Node_VFX_Vortex(_x, _y, _group = -1) : Node_VFX_effector(_x, _y, _group inputs[| 4].setVisible(false, false); - inputs[| 8] = nodeValue(8, "Attraction force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ); + inputs[| 8] = nodeValue("Attraction force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ); - inputs[| 9] = nodeValue(9, "Clockwise", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); + inputs[| 9] = nodeValue("Clockwise", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ); array_push(input_display_list, 8, 9); diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index 47e8e3f82..46b0b38d5 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -1,5 +1,7 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Effector"; + color = COLORS.node_blend_vfx; + icon = THEME.vfx; previewable = false; node_draw_icon = s_node_vfx_accel; @@ -7,34 +9,40 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) construct h = 80; min_h = h; - inputs[| 0] = nodeValue(0, "Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, -1 ) + inputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, -1 ) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) - .setDisplay(VALUE_DISPLAY.area); + inputs[| 1] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) + .setDisplay(VALUE_DISPLAY.area) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ) - .setDisplay(VALUE_DISPLAY.curve); + inputs[| 2] = nodeValue("Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Falloff distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ); + inputs[| 3] = nodeValue("Falloff distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Effect Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -1, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 4] = nodeValue("Effect Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -1, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ); + inputs[| 5] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Rotate particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.rotation_range); + inputs[| 6] = nodeValue("Rotate particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.rotation_range) + .rejectArray(); - inputs[| 7] = nodeValue(7, "Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector_range); + inputs[| 7] = nodeValue("Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector_range) + .rejectArray(); input_display_list = [ 0, ["Area", false], 1, 2, 3, ["Effect", false], 4, 5, 6, 7, ]; - outputs[| 0] = nodeValue(0, "Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, -1 ); + outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, -1 ); current_data = []; @@ -122,7 +130,7 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) construct if(_dst <= _fads) { var inf = in? 0.5 + _dst / _fads : 0.5 - _dst / _fads; - str = eval_curve_bezier_cubic_t(_fall, clamp(inf, 0., 1.)); + str = eval_curve_x(_fall, clamp(inf, 0., 1.)); } else if(in) str = 1; @@ -131,15 +139,15 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) construct onAffect(part, str); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var val = inputs[| 0].getValue(); outputs[| 0].setValue(val); if(val == -1) return; - for( var i = 0; i < ds_list_size(inputs); i++ ) { + for( var i = 0; i < ds_list_size(inputs); i++ ) current_data[i] = inputs[| i].getValue(); - } + if(!is_array(val) || array_length(val) == 0) return; if(!is_array(val[0])) val = [ val ]; for( var i = 0; i < array_length(val); i++ ) for( var j = 0; j < array_length(val[i]); j++ ) { diff --git a/scripts/node_VFX_group/node_VFX_group.gml b/scripts/node_VFX_group/node_VFX_group.gml index 545ab4069..fd57c606a 100644 --- a/scripts/node_VFX_group/node_VFX_group.gml +++ b/scripts/node_VFX_group/node_VFX_group.gml @@ -1,6 +1,7 @@ function Node_VFX_Group(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) constructor { name = "VFX"; color = COLORS.node_blend_vfx; + icon = THEME.vfx; ungroupable = false; if(!LOADING && !APPENDING && !CLONING) { diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index ae418a454..330988b21 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -1,25 +1,29 @@ function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Renderer"; + color = COLORS.node_blend_vfx; + icon = THEME.vfx; - inputs[| 0] = nodeValue(0, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering."); + inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.") + .rejectArray(); - inputs[| 2] = nodeValue(2, "Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Additive" ]); + inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Additive" ]) + .rejectArray(); data_length = 1; input_fix_len = ds_list_size(inputs); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone ) + inputs[| index] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone ) .setVisible(true, true); } if(!LOADING && !APPENDING) createNewInput(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static refreshDynamicInput = function() { var _l = ds_list_create(); @@ -57,16 +61,12 @@ function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) construct outputs[| 0].setValue(_outSurf); surface_set_target(_outSurf); - switch(_blend) { - case PARTICLE_BLEND_MODE.normal : - draw_clear_alpha(c_white, 0); - gpu_set_blendmode(bm_normal); - break; - case PARTICLE_BLEND_MODE.additive : - draw_clear_alpha(c_black, 0); - gpu_set_blendmode(bm_add); - break; - } + draw_clear_alpha(0, 0); + + if(_blend == PARTICLE_BLEND_MODE.normal) + BLEND_OVER_ALPHA; + else if(_blend == PARTICLE_BLEND_MODE.additive) + BLEND_ADD; var surf_w = surface_get_width(_outSurf); var surf_h = surface_get_height(_outSurf); @@ -74,16 +74,16 @@ function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) construct for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { var parts = inputs[| i].getValue(_time); + if(!is_array(parts) || array_length(parts) == 0) continue; if(!is_array(parts[0])) parts = [ parts ]; for(var j = 0; j < array_length(parts); j++) for(var k = 0; k < array_length(parts[j]); k++) { - if(!parts[j][k].active) continue; parts[j][k].draw(_exact, surf_w, surf_h); } } - gpu_set_blendmode(bm_normal); + BLEND_NORMAL; surface_reset_target(); cacheCurrentFrame(_outSurf); diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index 52411a043..a809c39f3 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -1,15 +1,17 @@ function Node_VFX_Spawner(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _group) constructor { name = "Spawner"; + color = COLORS.node_blend_vfx; + icon = THEME.vfx; - inputs[| input_len + 0] = nodeValue(input_len + 0, "Spawn trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, false) + inputs[| input_len + 0] = nodeValue("Spawn trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, false) .setVisible(true, true); - inputs[| input_len + 1] = nodeValue(input_len + 1, "Step interval", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "How often the 'on step' event is triggered.\nWith 1 being trigger every frame, 2 means triggered once every 2 frames."); + inputs[| input_len + 1] = nodeValue("Step interval", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "How often the 'on step' event is triggered.\nWith 1 being trigger every frame, 2 means triggered once every 2 frames."); - outputs[| 0] = nodeValue(0, "Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, parts ); - outputs[| 1] = nodeValue(1, "On create", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 2] = nodeValue(2, "On step", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 3] = nodeValue(3, "On destroy", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, parts ); + outputs[| 1] = nodeValue("On create", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 2] = nodeValue("On step", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 3] = nodeValue("On destroy", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); array_insert(input_display_list, 0, ["Trigger", true], input_len + 0, input_len + 1); @@ -77,12 +79,8 @@ function Node_VFX_Spawner(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _ var spr = inputs[| 0].getValue(); if(spr == 0) { - if(def_surface == -1 || !surface_exists(def_surface)) { - def_surface = PIXEL_SURFACE; - surface_set_target(def_surface); - draw_clear(c_white); - surface_reset_target(); - } + if(!is_surface(def_surface)) + return; spr = def_surface; } diff --git a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml index bce03ef59..a6978d93b 100644 --- a/scripts/node_alpha_cutoff/node_alpha_cutoff.gml +++ b/scripts/node_alpha_cutoff/node_alpha_cutoff.gml @@ -1,25 +1,41 @@ function Node_Alpha_Cutoff(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Alpha Cutoff"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Any pixel with less alpha (more transparent) than this will be removed.") + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Any pixel with less alpha (more transparent) than this will be removed.") .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + inputs[| 3] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 4; + + input_display_list = [ 4, + ["Surface", true], 0, 2, 3, + ["Cutoff", false], 1, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_alpha_cutoff); shader_set_uniform_f(shader_get_uniform(sh_alpha_cutoff, "cutoff"), _data[1]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_alpha_hash/node_alpha_hash.gml b/scripts/node_alpha_hash/node_alpha_hash.gml index 3c276f672..2a7a58df8 100644 --- a/scripts/node_alpha_hash/node_alpha_hash.gml +++ b/scripts/node_alpha_hash/node_alpha_hash.gml @@ -14,22 +14,22 @@ function Node_Alpha_Hash(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c 15, 47, 7, 39, 13, 45, 5, 37, 63, 31, 55, 23, 61, 29, 53, 21]; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); - shader_set_uniform_f_array(uniform_dit, dither8); + shader_set_uniform_f_array_safe(uniform_dit, dither8); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_alpha_to_grey/node_alpha_to_grey.gml b/scripts/node_alpha_to_grey/node_alpha_to_grey.gml index 79997daef..b0199c78a 100644 --- a/scripts/node_alpha_to_grey/node_alpha_to_grey.gml +++ b/scripts/node_alpha_to_grey/node_alpha_to_grey.gml @@ -1,18 +1,25 @@ function Node_Alpha_Grey(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Alpha to Grey"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 1; - static process_data = function(_outSurf, _data, _output_index, _array_index) { + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 1, + ["Surface", false], 0, + ] + + static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_alpha_grey); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_animate_curve/node_animate_curve.gml b/scripts/node_animate_curve/node_animate_curve.gml index b4c5127fc..8157638cc 100644 --- a/scripts/node_animate_curve/node_animate_curve.gml +++ b/scripts/node_animate_curve/node_animate_curve.gml @@ -1,32 +1,31 @@ function Node_Anim_Curve(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "Anim Curve"; + name = "Evaluate Curve"; update_on_frame = true; previewable = false; w = 96; - - inputs[| 0] = nodeValue(0, "Curve", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01); - inputs[| 1] = nodeValue(1, "Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Curve", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01); + inputs[| 1] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 3] = nodeValue(3, "Maximum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 2] = nodeValue("Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 3] = nodeValue("Maximum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - outputs[| 0] = nodeValue(0, "Curve", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); + outputs[| 0] = nodeValue("Curve", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var curve = _data[0]; var time = _data[1]; var _min = _data[2]; var _max = _data[3]; - var val = eval_curve_bezier_cubic_x(curve, time) * (_max - _min) + _min; + var val = eval_curve_x(curve, time) * (_max - _min) + _min; return val; } static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(s_node_curve, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_curve_eval, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_area/node_area.gml b/scripts/node_area/node_area.gml index 2a08d50b1..ba8955c12 100644 --- a/scripts/node_area/node_area.gml +++ b/scripts/node_area/node_area.gml @@ -6,17 +6,17 @@ function Node_Area(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru w = 96; - inputs[| 0] = nodeValue(0, "Postion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| 0] = nodeValue("Postion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16 ] ) + inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16 ] ) .setDisplay(VALUE_DISPLAY.vector) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, AREA_SHAPE.rectangle ) + inputs[| 2] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, AREA_SHAPE.rectangle ) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Rectangle", "Elipse"]); - outputs[| 0] = nodeValue(0, "Area", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0, AREA_SHAPE.rectangle ]) + outputs[| 0] = nodeValue("Area", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.vector); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { @@ -42,7 +42,7 @@ function Node_Area(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru inputs[| 1].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny); } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { return [_data[0][0], _data[0][1], _data[1][0], _data[1][1], _data[2]]; } diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index df651e677..d78f03a90 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -4,8 +4,9 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { w = 96; - inputs[| 0] = nodeValue( 0, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Any", "Surface", "Number", "Text" ]); + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Any", "Surface", "Number", "Color", "Text" ]) + .rejectArray(); array_adjust_tool = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var _h = ui(48); @@ -30,7 +31,7 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var bxc = bx + bw / 2 - (string_width("Add") + ui(64)) / 2; var byc = by + bh / 2; draw_sprite_ui(THEME.add, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light); - draw_text(bxc + ui(48), byc, "Add"); + draw_text(bxc + ui(48), byc, get_text("add", "Add")); var bx = _x + bw + ui(8); var amo = attributes[? "size"]; @@ -58,22 +59,27 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { input_display_list_len = array_length(input_display_list); data_length = 1; - outputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); + outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); attributes[? "size"] = 1; - static createNewInput = function() { - var index = ds_list_size(inputs); + static getType = function() { var _type = inputs[| 0].getValue(); - var _typ = VALUE_TYPE.any; switch(_type) { - case 1 : _typ = VALUE_TYPE.surface; break; - case 2 : _typ = VALUE_TYPE.float; break; - case 3 : _typ = VALUE_TYPE.text; break; + case 1 : return VALUE_TYPE.surface; + case 2 : return VALUE_TYPE.float; + case 3 : return VALUE_TYPE.color; + case 4 : return VALUE_TYPE.text; + default : return VALUE_TYPE.any; } + } + + static createNewInput = function() { + var index = ds_list_size(inputs); + var _typ = getType(); - inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, _typ, -1 ) + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, _typ, -1 ) .setVisible(true, true); array_push(input_display_list, index); @@ -103,6 +109,7 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { input_display_list = []; for( var i = 0; i < ds_list_size(_l); i++ ) { _l[| i].index = i; + _l[| i].setVisible(i < ds_list_size(_l) - 1); array_push(input_display_list, i); if(i >= input_fix_len && _l[| i].value_from == noone) @@ -117,25 +124,20 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { lastNode = createNewInput(); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index != 0) return; - - var _type = inputs[| 0].getValue(); - var _typ = VALUE_TYPE.any; - - switch(_type) { - case 1 : _typ = VALUE_TYPE.surface; break; - case 2 : _typ = VALUE_TYPE.float; break; - case 3 : _typ = VALUE_TYPE.text; break; - } + var _typ = getType(); for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { - if(_type) inputs[| i].type = _typ; + if(_typ != VALUE_TYPE.any) + inputs[| i].type = _typ; inputs[| i].resetDisplay(); if(_typ && inputs[| i].value_from && (value_bit(inputs[| i].value_from.type) & value_bit(_typ) == 0)) inputs[| i].removeFrom(); } + + refreshDynamicInput(); } static onValueFromUpdate = function(index) { @@ -144,15 +146,8 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { refreshDynamicInput(); } - static update = function() { - var _type = inputs[| 0].getValue(); - var _typ = VALUE_TYPE.any; - - switch(_type) { - case 1 : _typ = VALUE_TYPE.surface; break; - case 2 : _typ = VALUE_TYPE.float; break; - case 3 : _typ = VALUE_TYPE.text; break; - } + static update = function(frame = ANIMATOR.current_frame) { + var _typ = getType(); outputs[| 0].type = _typ; var res = array_create(ds_list_size(inputs) - input_fix_len - 1); @@ -160,10 +155,10 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { res[ind++] = inputs[| i].getValue(); - inputs[| i].type = inputs[| i].value_from? inputs[| i].value_from.type : VALUE_TYPE.any; + inputs[| i].type = inputs[| i].value_from? inputs[| i].value_from.type : _typ; - if(i == 0 && _type == 0) - outputs[| 0].type = inputs[| i].value_from? inputs[| i].value_from.type : VALUE_TYPE.any; + if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from) + outputs[| 0].type = inputs[| i].value_from.type; } outputs[| 0].setValue(res); diff --git a/scripts/node_array_add/node_array_add.gml b/scripts/node_array_add/node_array_add.gml index 8ebebe591..916f84e86 100644 --- a/scripts/node_array_add/node_array_add.gml +++ b/scripts/node_array_add/node_array_add.gml @@ -6,17 +6,18 @@ function Node_Array_Add(_x, _y, _group = -1) : Node(_x, _y, _group) constructor h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) + inputs[| 1] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "Combine member", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 2] = nodeValue("Combine member", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); + outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _arr = inputs[| 0].getValue(); var _val = inputs[| 1].getValue(); var _app = inputs[| 2].getValue(); diff --git a/scripts/node_array_get/node_array_get.gml b/scripts/node_array_get/node_array_get.gml index 11608d63f..dc6e62eb9 100644 --- a/scripts/node_array_get/node_array_get.gml +++ b/scripts/node_array_get/node_array_get.gml @@ -6,28 +6,33 @@ function Node_Array_Get(_x, _y, _group = -1) : Node(_x, _y, _group) constructor h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "Overflow", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Clamp", "Loop", "Ping Pong"]); + inputs[| 2] = nodeValue("Overflow", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Clamp", "Loop", "Ping Pong"]) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function() { - var _arr = inputs[| 0].getValue(); - + static step = function() { inputs[| 0].type = VALUE_TYPE.any; outputs[| 0].type = VALUE_TYPE.any; + if(inputs[| 0].value_from != noone) { + inputs[| 0].type = inputs[| 0].value_from.type; + outputs[| 0].type = inputs[| 0].type; + } + } + + static getArray = function(_arr, index, _ovf) { if(!is_array(_arr)) return; + if(is_array(index)) return; - var index = inputs[| 1].getValue(); - var _len = array_length(_arr); - var _ovf = inputs[| 2].getValue(); + var _len = array_length(_arr); switch(_ovf) { case 0 : @@ -45,12 +50,25 @@ function Node_Array_Get(_x, _y, _group = -1) : Node(_x, _y, _group) constructor break; } - if(inputs[| 0].value_from != noone) { - inputs[| 0].type = inputs[| 0].value_from.type; - outputs[| 0].type = inputs[| 0].type; - } + return array_safe_get(_arr, index); + } + + static update = function(frame = ANIMATOR.current_frame) { + var _arr = inputs[| 0].getValue(); - outputs[| 0].setValue(_arr[index]); + if(!is_array(_arr)) return; + + var index = inputs[| 1].getValue(); + var _ovf = inputs[| 2].getValue(); + var res = is_array(index)? array_create(array_length(index)) : 0; + + if(is_array(index)) { + for( var i = 0; i < array_length(index); i++ ) + res[i] = getArray(_arr, index[i], _ovf); + } else + res = getArray(_arr, index, _ovf); + + outputs[| 0].setValue(res); } static onDrawNode = function(xx, yy, _mx, _my, _s) { @@ -58,7 +76,6 @@ function Node_Array_Get(_x, _y, _group = -1) : Node(_x, _y, _group) constructor var idx = inputs[| 1].getValue(); var str = string(idx); - var bbox = drawGetBbox(xx, yy, _s); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index 83b428af8..26e91258c 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -6,12 +6,12 @@ function Node_Array_Length(_x, _y, _group = -1) : Node(_x, _y, _group) construct h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); + outputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - function update() { + function update(frame = ANIMATOR.current_frame) { var _arr = inputs[| 0].getValue(); if(!is_array(_arr) || array_length(_arr) == 0) { @@ -19,22 +19,7 @@ function Node_Array_Length(_x, _y, _group = -1) : Node(_x, _y, _group) construct return 0; } - var nested = false; - for( var i = 0; i < array_length(_arr); i++ ) { - nested |= is_array(_arr[i]); - } - - if(!nested) { - outputs[| 0].setValue(array_length(_arr)); - return 0; - } - - var len = []; - for( var i = 0; i < array_length(_arr); i++ ) { - len[i] = is_array(_arr[i])? array_length(_arr[i]) : 1; - } - - outputs[| 0].setValue(len); + outputs[| 0].setValue(array_length(_arr)); } static onDrawNode = function(xx, yy, _mx, _my, _s) { diff --git a/scripts/node_array_range/node_array_range.gml b/scripts/node_array_range/node_array_range.gml index d2e179708..366dbb1e3 100644 --- a/scripts/node_array_range/node_array_range.gml +++ b/scripts/node_array_range/node_array_range.gml @@ -4,13 +4,18 @@ function Node_Array_Range(_x, _y, _group = -1) : Node(_x, _y, _group) constructo w = 96; - inputs[| 0] = nodeValue(0, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 1] = nodeValue(1, "End", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 10); - inputs[| 2] = nodeValue(2, "Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 0] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); + inputs[| 1] = nodeValue("End", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 10) + .rejectArray(); - static update = function() { + inputs[| 2] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .rejectArray(); + + outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); + + static update = function(frame = ANIMATOR.current_frame) { var st = inputs[| 0].getValue(); var ed = inputs[| 1].getValue(); var step = inputs[| 2].getValue(); 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 93310013c..090f5e119 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -29,20 +29,22 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc w = 128; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_load, ["*.ase, *.aseprite", ""]); - inputs[| 1] = nodeValue(1, "Generate layers", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Generate layers", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { refreshLayers(); }, "Generate"] ); - inputs[| 2] = nodeValue(2, "Current tag", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + inputs[| 2] = nodeValue("Current tag", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - outputs[| 0] = nodeValue(0, "Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); + outputs[| 1] = nodeValue("Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); - outputs[| 2] = nodeValue(2, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") - .setVisible(true, true); + outputs[| 2] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, ""); + + outputs[| 3] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) + .setDisplay(VALUE_DISPLAY.palette); hold_visibility = true; layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { @@ -161,7 +163,6 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc layers = []; tags = []; _tag_delay = 0; - palette = []; path_current = ""; first_update = false; @@ -209,7 +210,7 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); if(ext != ".ase" && ext != ".aseprite") return false; @@ -239,9 +240,14 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc var g = pck[k][? "Green"]; var b = pck[k][? "Blue"]; var a = pck[k][? "Alpha"]; - array_push(plt, [r, g, b, a]) + array_push(plt, [r, g, b, a]); } content[? "Palette"] = plt; + + var p_arr = []; + for( var i = 0; i < array_length(plt); i++ ) + array_push(p_arr, make_color_rgb(plt[i][0], plt[i][1], plt[i][2])); + outputs[| 3].setValue(p_arr); break; case 0x2004: //layer var name = chunk[? "Name"]; @@ -269,7 +275,7 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc return true; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -282,7 +288,7 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc } } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); var current_tag = inputs[| 2].getValue(); if(path_current != path) updatePaths(path); diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index 106a393cc..a02ff17b4 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -4,12 +4,14 @@ function Node_ASE_layer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor always_output = true; previewable = false; - inputs[| 0] = nodeValue(0, "ASE data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) - .setVisible(false, true); + inputs[| 0] = nodeValue("ASE data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) + .setVisible(false, true) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Use cel dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 1] = nodeValue("Use cel dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); layer_object = noone; _name = ""; @@ -33,7 +35,7 @@ function Node_ASE_layer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var data = inputs[| 0].getValue(); if(data == noone) return; @@ -70,9 +72,9 @@ function Node_ASE_layer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor surface_set_target(surf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface(_inSurf, xx, yy); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } } \ No newline at end of file diff --git a/scripts/node_atlas/node_atlas.gml b/scripts/node_atlas/node_atlas.gml index 4ca3c917e..d32c4cf2a 100644 --- a/scripts/node_atlas/node_atlas.gml +++ b/scripts/node_atlas/node_atlas.gml @@ -3,21 +3,24 @@ function Node_Atlas(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_dim = shader_get_uniform(sh_atlas, "dimension"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 1; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_atlas); - shader_set_uniform_f_array(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_average/node_average.gml b/scripts/node_average/node_average.gml index e1a4aa4dd..362d12443 100644 --- a/scripts/node_average/node_average.gml +++ b/scripts/node_average/node_average.gml @@ -4,9 +4,21 @@ function Node_Average(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons shader = sh_average; uniform_dim = shader_get_uniform(shader, "dimension"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 2] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + input_display_list = [ 3, + ["Surface", false], 0, 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var inSurf = _data[0]; @@ -18,16 +30,16 @@ function Node_Average(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons side = power(2, lop); if(side / 2 >= 1) { - var _Surf = [ surface_create(side, side), surface_create(side / 2, side / 2) ]; + var _Surf = [ surface_create_valid(side, side), surface_create_valid(side / 2, side / 2) ]; var _ind = 1; gpu_set_tex_filter(true); surface_set_target(_Surf[0]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_stretched(inSurf, 0, 0, side, side); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); for( var i = 0; i < lop; i++ ) { @@ -41,8 +53,10 @@ function Node_Average(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons side /= 2; } gpu_set_tex_filter(false); - cc = surface_getpixel(_Surf[!_ind], 0, 0); + + surface_free(_Surf[0]); + surface_free(_Surf[1]); } else cc = surface_getpixel(inSurf, 0, 0); @@ -50,6 +64,8 @@ function Node_Average(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons draw_clear(cc); surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_bevel/node_bevel.gml b/scripts/node_bevel/node_bevel.gml index eb84e3761..9326458ed 100644 --- a/scripts/node_bevel/node_bevel.gml +++ b/scripts/node_bevel/node_bevel.gml @@ -8,22 +8,30 @@ function Node_Bevel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_hei = shader_get_uniform(shader, "height"); uniform_slp = shader_get_uniform(shader, "slope"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); - inputs[| 2] = nodeValue(2, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 2] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) + inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Slope", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Slope", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Smooth", "Circular" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", true], 0, + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 7, + ["Surface", true], 0, 5, 6, ["Bevel", false], 4, 1, ["Transform", false], 2, 3, ]; @@ -36,21 +44,23 @@ function Node_Bevel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_hei, _hei); - shader_set_uniform_f_array(uniform_shf, _shf); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_shf, _shf); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_i(uniform_slp, _slp); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blend/node_blend.gml b/scripts/node_blend/node_blend.gml index a5779dffc..7ccc09f90 100644 --- a/scripts/node_blend/node_blend.gml +++ b/scripts/node_blend/node_blend.gml @@ -17,31 +17,37 @@ function Node_create_Blend(_x, _y, _group = -1, _param = "") { function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Blend"; - inputs[| 0] = nodeValue(0, "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); - inputs[| 1] = nodeValue(1, "Foreground", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); + inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); + inputs[| 1] = nodeValue("Foreground", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); - inputs[| 2] = nodeValue(2, "Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, BLEND_TYPES ); - inputs[| 3] = nodeValue(3, "Opacity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 3] = nodeValue("Opacity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 5] = nodeValue(5, "Tiling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 5] = nodeValue("Tiling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Stretch", "Tile" ]); - inputs[| 6] = nodeValue(6, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Background", "Forground", "Mask", "Maximum", "Constant" ]); + inputs[| 6] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Background", "Forground", "Mask", "Maximum", "Constant" ]) + .rejectArray(); - inputs[| 7] = nodeValue(7, "Constant dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 7] = nodeValue("Constant dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + inputs[| 9] = nodeValue("Preserve alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - input_display_list = [ + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 8, ["Surfaces", true], 0, 1, 4, 6, 7, - ["Blend", false], 2, 3, + ["Blend", false], 2, 3, 9, ["Transform", false], 5, ] @@ -55,6 +61,7 @@ function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr var _outp = _data[6]; var _out_dim = _data[7]; + var _pre_alp = _data[9]; inputs[| 7].setVisible(_outp == 4); var ww = 1, hh = 1; @@ -86,7 +93,7 @@ function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - draw_surface_blend(_back, _fore, _type, _opacity, _mask, _tile); + draw_surface_blend(_back, _fore, _type, _opacity, _pre_alp, _mask, _tile); surface_reset_target(); return _outSurf; diff --git a/scripts/node_bloom/node_bloom.gml b/scripts/node_bloom/node_bloom.gml index b2e6506c6..6b1b96244 100644 --- a/scripts/node_bloom/node_bloom.gml +++ b/scripts/node_bloom/node_bloom.gml @@ -8,24 +8,34 @@ function Node_Bloom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_umsk = shader_get_uniform(shader, "useMask"); uniform_mask = shader_get_sampler_index(shader, "mask"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.") + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.") .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 2] = nodeValue(2, "Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5, "How bright a pixel should be to start blooming.") + inputs[| 2] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5, "How bright a pixel should be to start blooming.") .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .25, "Blend intensity.") + inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .25, "Blend intensity.") .setDisplay(VALUE_DISPLAY.slider, [ 0, 2, 0.01]); - inputs[| 4] = nodeValue(4, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 4] = nodeValue("Bloom mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", true], 0, 4, - ["Bloom", false], 1, 2, 3, + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + input_display_list = [ 7, + ["Surface", true], 0, 5, 6, + ["Bloom", false], 1, 2, 3, 4, ] - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + surface_blur_init(); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _size = _data[1]; @@ -47,27 +57,28 @@ function Node_Bloom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr shader_reset(); surface_reset_target(); - pass1 = surface_apply_gaussian(pass1, _size, true, c_black, 1); + var pass1blur = surface_apply_gaussian(pass1, _size, true, c_black, 1); + surface_free(pass1); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var uniform_foreground = shader_get_sampler_index(sh_blend_add_alpha_adj, "fore"); var uniform_opacity = shader_get_uniform(sh_blend_add_alpha_adj, "opacity"); shader_set(sh_blend_add_alpha_adj); - texture_set_stage(uniform_foreground, surface_get_texture(pass1)); + texture_set_stage(uniform_foreground, surface_get_texture(pass1blur)); shader_set_uniform_f(uniform_opacity, _stre); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); - surface_free(pass1); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); return _outSurf; } diff --git a/scripts/node_blur/node_blur.gml b/scripts/node_blur/node_blur.gml index 46d8a2443..6cb5045f2 100644 --- a/scripts/node_blur/node_blur.gml +++ b/scripts/node_blur/node_blur.gml @@ -1,39 +1,53 @@ function Node_Blur(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Blur"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 2] = nodeValue(2, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - inputs[| 3] = nodeValue(3, "Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Replace all color while keeping the alpha. Used to\nfix grey outline when bluring transparent pixel."); + inputs[| 3] = nodeValue("Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Replace all color while keeping the alpha. Used to\nfix grey outline when bluring transparent pixel."); - inputs[| 4] = nodeValue(4, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 4] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 2, + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 7, + ["Surface", true], 0, 2, 5, 6, ["Blur", false], 1, 3, 4, ]; - static process_data = function(_outSurf, _data, _output_index, _array_index) { + surface_blur_init(); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _size = _data[1]; var _clamp = _data[2]; var _isovr = _data[3]; + var _mask = _data[5]; + var _mix = _data[6]; var _overc = _isovr? _data[4] : noone; inputs[| 4].setVisible(_isovr); surface_set_target(_outSurf); draw_clear_alpha(_isovr? _overc : 0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(surface_apply_gaussian(_data[0], _size, false, c_white, _clamp, _overc), 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_bokeh/node_blur_bokeh.gml b/scripts/node_blur_bokeh/node_blur_bokeh.gml index 051a39249..20eec9f1c 100644 --- a/scripts/node_blur_bokeh/node_blur_bokeh.gml +++ b/scripts/node_blur_bokeh/node_blur_bokeh.gml @@ -5,18 +5,34 @@ function Node_Blur_Bokeh(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c uniform_dim = shader_get_uniform(shader, "dimension"); uniform_str = shader_get_uniform(shader, "strength"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static process_data = function(_outSurf, _data, _output_index, _array_index) { - var _str = _data[1]; + inputs[| 3] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 4; + + input_display_list = [ 4, + ["Surface", true], 0, 2, 3, + ["Blur", false], 1, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var _str = _data[1]; + var _mask = _data[2]; + var _mix = _data[3]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); @@ -24,9 +40,11 @@ function Node_Blur_Bokeh(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_contrast/node_blur_contrast.gml b/scripts/node_blur_contrast/node_blur_contrast.gml index 3a2973914..7565f9ad7 100644 --- a/scripts/node_blur_contrast/node_blur_contrast.gml +++ b/scripts/node_blur_contrast/node_blur_contrast.gml @@ -7,21 +7,37 @@ function Node_Blur_Contrast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group uniform_tes = shader_get_uniform(shader, "treshold"); uniform_dir = shader_get_uniform(shader, "direction"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 2] = nodeValue(2, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Brightness different to be blur together.") + inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Brightness different to be blur together.") .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - pass = PIXEL_SURFACE; + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["Blur", false], 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + pass = surface_create(1, 1); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _surf = _data[0]; var _size = _data[1]; var _tres = _data[2]; + var _mask = _data[3]; + var _mix = _data[4]; var ww = surface_get_width(_surf); var hh = surface_get_height(_surf); @@ -30,27 +46,29 @@ function Node_Blur_Contrast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group surface_set_target(pass); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ ww, hh ]); + shader_set_uniform_f_array_safe(uniform_dim, [ ww, hh ]); shader_set_uniform_f(uniform_siz, _size); shader_set_uniform_f(uniform_tes, _tres); shader_set_uniform_i(uniform_dir, 0); draw_surface_safe(_surf, 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_dir, 1); draw_surface_safe(pass, 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_directional/node_blur_directional.gml b/scripts/node_blur_directional/node_blur_directional.gml index 15dde909e..a8b38ee66 100644 --- a/scripts/node_blur_directional/node_blur_directional.gml +++ b/scripts/node_blur_directional/node_blur_directional.gml @@ -5,14 +5,28 @@ function Node_Blur_Directional(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr uniform_str = shader_get_uniform(shader, "strength"); uniform_dir = shader_get_uniform(shader, "direction"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) .setDisplay(VALUE_DISPLAY.slider, [0, 0.1, 0.001]); - inputs[| 2] = nodeValue(2, "Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["Blur", false], 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var _surf = outputs[| 0].getValue(); @@ -27,12 +41,14 @@ function Node_Blur_Directional(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr inputs[| 2].drawOverlay(active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my, _snx, _sny); } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _str = _data[1]; var _dir = _data[2]; + var _mask = _data[3]; + var _mix = _data[4]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_str, _str); @@ -40,9 +56,11 @@ function Node_Blur_Directional(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_radial/node_blur_radial.gml b/scripts/node_blur_radial/node_blur_radial.gml index 1a62f15e9..5fdce40f1 100644 --- a/scripts/node_blur_radial/node_blur_radial.gml +++ b/scripts/node_blur_radial/node_blur_radial.gml @@ -7,22 +7,30 @@ function Node_Blur_Radial(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_str = shader_get_uniform(shader, "strength"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 2] = nodeValue(2, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 3, + inputs[| 5] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 6] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 6; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 6, + ["Surface", true], 0, 3, 4, 5, ["Blur", false], 1, 2, ]; @@ -35,29 +43,33 @@ function Node_Blur_Radial(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _str = _data[1]; var _cen = _data[2]; var _sam = _data[3]; + var _mask = _data[3]; + var _mix = _data[4]; _cen[0] /= surface_get_width(_outSurf); _cen[1] /= surface_get_height(_outSurf); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_outSurf), surface_get_height(_outSurf)); shader_set_uniform_f(uniform_str, abs(_str)); - shader_set_uniform_f_array(uniform_cen, _cen); + shader_set_uniform_f_array_safe(uniform_cen, _cen); shader_set_uniform_i(uniform_sam, _sam); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_simple/node_blur_simple.gml b/scripts/node_blur_simple/node_blur_simple.gml index ac5cbc5d2..ec27d562e 100644 --- a/scripts/node_blur_simple/node_blur_simple.gml +++ b/scripts/node_blur_simple/node_blur_simple.gml @@ -11,39 +11,49 @@ function Node_Blur_Simple(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_ovr = shader_get_uniform(shader, "overrideColor"); uniform_ovc = shader_get_uniform(shader, "overColor"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 2] = nodeValue(2, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - inputs[| 3] = nodeValue(3, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 3] = nodeValue("Blur mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 4] = nodeValue(4, "Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Replace all color while keeping the alpha. Used to\nfix grey outline when bluring transparent pixel."); + inputs[| 4] = nodeValue("Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Replace all color while keeping the alpha. Used to\nfix grey outline when bluring transparent pixel."); - inputs[| 5] = nodeValue(5, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - input_display_list = [ - ["Surface", false], 0, 3, 2, - ["Blur", false], 1, 4, 5, + inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + input_display_list = [ 8, + ["Surface", true], 0, 2, 6, 7, + ["Blur", false], 1, 3, 4, 5, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { if(!is_surface(_data[0])) return _outSurf; var _size = _data[1]; var _samp = _data[2]; var _mask = _data[3]; var _isovr = _data[4]; var _overc = _data[5]; + var _msk = _data[6]; + var _mix = _data[7]; inputs[| 5].setVisible(_isovr); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); @@ -51,7 +61,7 @@ function Node_Blur_Simple(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) shader_set_uniform_i(uniform_sam, _samp); shader_set_uniform_i(uniform_ovr, _isovr); - shader_set_uniform_f_array(uniform_ovc, colToVec4(_overc)); + shader_set_uniform_f_array_safe(uniform_ovc, colToVec4(_overc)); shader_set_uniform_i(uniform_umk, is_surface(_mask)); if(is_surface(_mask)) @@ -60,9 +70,11 @@ function Node_Blur_Simple(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _msk, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_blur_zoom/node_blur_zoom.gml b/scripts/node_blur_zoom/node_blur_zoom.gml index 9b1dbbcab..fffa329da 100644 --- a/scripts/node_blur_zoom/node_blur_zoom.gml +++ b/scripts/node_blur_zoom/node_blur_zoom.gml @@ -10,26 +10,34 @@ function Node_Blur_Zoom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_umk = shader_get_uniform(shader, "useMask"); uniform_msk = shader_get_sampler_index(shader, "mask"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); + inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); - inputs[| 2] = nodeValue(2, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - inputs[| 4] = nodeValue(4, "Zoom mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 4] = nodeValue("Zoom mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Start", "Middle", "End" ]); - inputs[| 5] = nodeValue(5, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 5] = nodeValue("Blur mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 3, + inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 8, + ["Surface", true], 0, 3, 6, 7, ["Blur", false], 1, 2, 4, 5 ]; @@ -48,16 +56,18 @@ function Node_Blur_Zoom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var _sam = _data[3]; var _blr = _data[4]; var _msk = _data[5]; + var _mask = _data[6]; + var _mix = _data[7]; _cen[0] /= surface_get_width(_outSurf); _cen[1] /= surface_get_height(_outSurf); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_str, _str); - shader_set_uniform_f_array(uniform_cen, _cen); + shader_set_uniform_f_array_safe(uniform_cen, _cen); shader_set_uniform_i(uniform_blr, _blr); shader_set_uniform_i(uniform_sam, _sam); @@ -68,9 +78,11 @@ function Node_Blur_Zoom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _mask, _mix); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_boolean/node_boolean.gml b/scripts/node_boolean/node_boolean.gml index 18c41c73a..b48916114 100644 --- a/scripts/node_boolean/node_boolean.gml +++ b/scripts/node_boolean/node_boolean.gml @@ -6,18 +6,18 @@ function Node_Boolean(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; min_h = 32 + 24 * 1; - inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Boolean", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Boolean", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { return _data[0]; } static onDrawNode = function(xx, yy, _mx, _my, _s) { draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); - var str = inputs[| 0].getValue()? "True" : "False"; + var str = inputs[| 0].getValue()? get_text("true", "True") : get_text("false", "False"); var bbox = drawGetBbox(xx, yy, _s); var ss = string_scale(str, bbox.w, bbox.h); diff --git a/scripts/node_bw/node_bw.gml b/scripts/node_bw/node_bw.gml index 6f92d7603..b3c56adb6 100644 --- a/scripts/node_bw/node_bw.gml +++ b/scripts/node_bw/node_bw.gml @@ -5,21 +5,35 @@ function Node_BW(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) construct uniform_exp = shader_get_uniform(shader, "brightness"); uniform_con = shader_get_uniform(shader, "contrast"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ -1, 4, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["BW", false], 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _exp = _data[1]; var _con = _data[2]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_exp, _exp); @@ -27,9 +41,11 @@ function Node_BW(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) construct draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_camera/node_camera.gml b/scripts/node_camera/node_camera.gml index a577c1716..e1f84def6 100644 --- a/scripts/node_camera/node_camera.gml +++ b/scripts/node_camera/node_camera.gml @@ -12,20 +12,20 @@ function Node_Camera(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uni_sam_mod = shader_get_uniform(shader, "sampleMode"); uni_blur = shader_get_uniform(shader, "blur"); - inputs[| 0] = nodeValue(0, "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) + inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, function() { return getDimension(0); }); - inputs[| 2] = nodeValue(2, "Zoom", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Zoom", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0.01, 4, 0.01 ]); - inputs[| 3] = nodeValue(3, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ - ["Surface", false], 0, 3, + ["Surface", true], 0, 3, ["Camera", false], 1, 2, ["Elements", true], ]; @@ -38,9 +38,9 @@ function Node_Camera(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); - inputs[| index + 0] = nodeValue( index + 0, "Element " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| index + 0] = nodeValue("Element " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| index + 1] = nodeValue( index + 1, "Parallax " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] ) + inputs[| index + 1] = nodeValue("Parallax " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); @@ -111,6 +111,7 @@ function Node_Camera(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const } static process_data = function(_outSurf, _data, _output_index, _array_index) { + if(!is_surface(_data[0])) return; var _area = _data[1]; var _zoom = _data[2]; var _samp = _data[3]; @@ -118,14 +119,14 @@ function Node_Camera(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const var _dw = round(surface_valid_size(_area[2]) * 2); var _dh = round(surface_valid_size(_area[3]) * 2); _outSurf = surface_verify(_outSurf, _dw, _dh); - var pingpong = [ surface_create(_dw, _dh), surface_create(_dw, _dh) ]; + var pingpong = [ surface_create_valid(_dw, _dh), surface_create_valid(_dw, _dh) ]; var ppInd = 0; surface_set_target(pingpong[0]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface(_data[0], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); surface_set_target(pingpong[1]); @@ -169,9 +170,9 @@ function Node_Camera(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface(pingpong[ppInd], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); surface_free(pingpong[0]); diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index b95adc47a..41ad1e1e8 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -1,37 +1,48 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Canvas"; color = COLORS.node_blend_canvas; + preview_channel = 1; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black ); - inputs[| 2] = nodeValue(2, "Brush size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) + inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black ); + inputs[| 2] = nodeValue("Brush size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 3] = nodeValue(3, "Fill threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.) + inputs[| 3] = nodeValue("Fill threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Fill type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Fill type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["4 connect", "8 connect", "Entire canvas"]); - inputs[| 5] = nodeValue(5, "Draw preview overlay", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 5] = nodeValue("Draw preview overlay", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 6] = nodeValue(6, "Brush", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1); + inputs[| 6] = nodeValue("Brush", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1); - inputs[| 7] = nodeValue(7, "Surface amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + inputs[| 7] = nodeValue("Surface amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 8] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1); + + inputs[| 9] = nodeValue("Background alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1.) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 10] = nodeValue("Render background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", false], 0, ["Brush", false], 6, 1, 2, ["Fill", false], 3, 4, - ["Preview", false], 5 + ["Display", false], 5, 8, 9, 10, ]; + canvas_surface = surface_create(1, 1); surface_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2); + surface_w = 1; + surface_h = 1; tools = [ [ "Pencil", THEME.canvas_tools_pencil ], @@ -41,21 +52,64 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { [ "Fill", THEME.canvas_tools_bucket ], ]; - mouse_cur_x = 0; - mouse_cur_y = 0; - mouse_pre_x = 0; - mouse_pre_y = 0; - mouse_pre_draw_x = 0; - mouse_pre_draw_y = 0; - - mouse_holding = false; - draw_stack = ds_list_create(); function surface_update() { - var _surf = outputs[| 0].getValue(); - buffer_get_surface(surface_buffer, _surf, 0); + buffer_delete(surface_buffer); + + surface_w = surface_get_width(canvas_surface); + surface_h = surface_get_height(canvas_surface); + surface_buffer = buffer_create(surface_w * surface_h * 4, buffer_fixed, 4); + buffer_get_surface(surface_buffer, canvas_surface, 0); + triggerRender(); + apply_surface(); + } + + function apply_surface() { + var _dim = inputs[| 0].getValue(); + var _bg = inputs[| 8].getValue(); + var _bga = inputs[| 9].getValue(); + var _bgr = inputs[| 10].getValue(); + + var _outSurf = outputs[| 0].getValue(); + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + + if(!is_surface(canvas_surface)) + canvas_surface = surface_create_from_buffer(_dim[0], _dim[1], surface_buffer); + else if(surface_size_to(canvas_surface, _dim[0], _dim[1])) { + buffer_delete(surface_buffer); + surface_buffer = buffer_create(_dim[0] * _dim[1] * 4, buffer_fixed, 4); + } + + surface_set_target(_outSurf); + draw_clear_alpha(0, 0); + BLEND_OVER_ALPHA + if(_bgr && is_surface(_bg)) + draw_surface_stretched_ext(_bg, 0, 0, _dim[0], _dim[1], c_white, _bga); + draw_surface(canvas_surface, 0, 0); + BLEND_NORMAL + surface_reset_target(); + + outputs[| 0].setValue(_outSurf); + + ///// + + var _surf_prev = outputs[| 1].getValue(); + _surf_prev = surface_verify(_surf_prev, _dim[0], _dim[1]); + outputs[| 1].setValue(_surf_prev); + + surface_set_target(_surf_prev); + draw_clear_alpha(0, 0); + BLEND_OVER_ALPHA; + + if(is_surface(_bg)) + draw_surface_stretched_ext(_bg, 0, 0, _dim[0], _dim[1], c_white, _bga); + draw_surface(canvas_surface, 0, 0); + + BLEND_NORMAL; + + surface_reset_target(); } function draw_point_size(_x, _y, _siz, _brush) { @@ -177,134 +231,117 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } - function color_diff(c1, c2) { - var _c1_r = c1 & 255; - var _c1_g = (c1 >> 8) & 255; - var _c1_b = (c1 >> 16) & 255; - var _c1_a = (c1 >> 24) & 255; + function get_color_buffer(_x, _y) { + var pos = (surface_w * _y + _x) * 4; + if(pos > buffer_get_size(surface_buffer)) { + print("Error buffer overflow " + string(pos) + "/" + string(buffer_get_size(surface_buffer))); + return 0; + } - var _c2_r = c2 & 255; - var _c2_g = (c2 >> 8) & 255; - var _c2_b = (c2 >> 16) & 255; - var _c2_a = (c2 >> 24) & 255; - - var dist = sqrt( - sqr(_c1_r - _c2_r) + - sqr(_c1_g - _c2_g) + - sqr(_c1_b - _c2_b) + - sqr(_c1_a - _c2_a) - ); - - return dist / 510; - } - - function get_color_buffer(_x, _y, w, h) { - buffer_seek(surface_buffer, buffer_seek_start, (w * _y + _x) * 4); + buffer_seek(surface_buffer, buffer_seek_start, pos); var c = buffer_read(surface_buffer, buffer_u32); return c; } + function ff_fillable(colorBase, colorFill, _x, _y, _thres) { + var d = color_diff(colorBase, get_color_buffer(_x, _y)); + return d <= _thres && d != colorFill; + } + function flood_fill_scanline(_x, _y, _surf, _thres, _corner = false) { - var w = surface_get_width(_surf); - var h = surface_get_height(_surf); + surface_update(); - var _c0 = draw_get_color() + (255 << 24); - var _c1 = get_color_buffer(_x, _y, w, h); - if(color_diff(_c0, _c1) <= _thres) return; + var colorFill = draw_get_color() + (255 << 24); + var colorBase = get_color_buffer(_x, _y); + + if(colorFill == colorBase) return; var x1, y1, x_start; var spanAbove, spanBelow; - var stack = ds_stack_create(); - ds_stack_push(stack, [_x, _y]); - while(!ds_stack_empty(stack)) { - var pos = ds_stack_pop(stack); + var queue = ds_queue_create(); + ds_queue_enqueue(queue, [_x, _y]); + + while(!ds_queue_empty(queue)) { + var pos = ds_queue_dequeue(queue); x1 = pos[0]; y1 = pos[1]; - while(x1 >= 0 && color_diff(_c1, get_color_buffer(x1, y1, w, h)) <= _thres) { + var colorCurr = get_color_buffer(x1, y1); + //print("Searching " + string(x1) + ", " + string(y1) + ": " + string(colorCurr)); + + if(colorCurr == colorFill) continue; //Color in queue already filled + + while(x1 >= 0 && ff_fillable(colorBase, colorFill, x1, y1, _thres)) //Shift left x1--; - } x1++; x_start = x1; - spanAbove = 0; - spanBelow = 0; + spanAbove = false; + spanBelow = false; - while(x1 < w && color_diff(_c1, get_color_buffer(x1, y1, w, h)) <= _thres) { + while(x1 < surface_w && ff_fillable(colorBase, colorFill, x1, y1, _thres)) { draw_point(x1, y1); - buffer_seek(surface_buffer, buffer_seek_start, (w * y1 + x1) * 4); - buffer_write(surface_buffer, buffer_u32, _c0); + buffer_seek(surface_buffer, buffer_seek_start, (surface_w * y1 + x1) * 4); + buffer_write(surface_buffer, buffer_u32, colorFill); + //print("> Filling " + string(x1) + ", " + string(y1) + ": " + string(get_color_buffer(x1, y1))); + if(y1 > 0) { if(x1 == x_start && x1 > 0 && _corner) { - var _delta = color_diff(_c1, get_color_buffer(x1 - 1, y1 - 1, w, h)); - if(!spanAbove && _delta <= _thres) { - ds_stack_push(stack, [x1 - 1, y1 - 1]); - spanAbove = 1; - } else if(spanAbove && _delta > _thres) { - spanAbove = 0; + if(!spanAbove && ff_fillable(colorBase, colorFill, x1 - 1, y1 - 1, _thres)) { + ds_queue_enqueue(queue, [x1 - 1, y1 - 1]); + spanAbove = true; } } - var _delta = color_diff(_c1, get_color_buffer(x1, y1 - 1, w, h)); - if(!spanAbove && _delta <= _thres) { - ds_stack_push(stack, [x1, y1 - 1]); - spanAbove = 1; - } else if(spanAbove && _delta > _thres) { - spanAbove = 0; + if(ff_fillable(colorBase, colorFill, x1, y1 - 1, _thres)) { + ds_queue_enqueue(queue, [x1, y1 - 1]); } } - if(y1 < h - 1) { + if(y1 < surface_h - 1) { if(x1 == x_start && x1 > 0 && _corner) { - var _delta = color_diff(_c1, get_color_buffer(x1 - 1, y1 + 1, w, h)); - if(!spanBelow && _delta <= _thres) { - ds_stack_push(stack, [x1 - 1, y1 + 1]); - spanBelow = 1; - } else if(spanBelow && _delta > _thres) { - spanBelow = 0; + if(!spanBelow && ff_fillable(colorBase, colorFill, x1 - 1, y1 + 1, _thres)) { + ds_queue_enqueue(queue, [x1 - 1, y1 + 1]); + spanBelow = true; } } - var _delta = color_diff(_c1, get_color_buffer(x1, y1 + 1, w, h)); - if(!spanBelow && _delta <= _thres) { - ds_stack_push(stack, [x1, y1 + 1]); - spanBelow = 1; - } else if(spanBelow && _delta > _thres) { - spanBelow = 0; + if(ff_fillable(colorBase, colorFill, x1, y1 + 1, _thres)) { + ds_queue_enqueue(queue, [x1, y1 + 1]); } } x1++; } - if(x1 < w - 1 && _corner) { - var _delta = color_diff(_c1, get_color_buffer(x1, y1 - 1, w, h)); - if(!spanAbove && _delta <= _thres) { - ds_stack_push(stack, [x1, y1 - 1]); - spanAbove = 1; - } else if(spanAbove && _delta > _thres) { - spanAbove = 0; + if(x1 < surface_w - 1 && _corner) { + if(y1 > 0) { + if(!spanAbove && ff_fillable(colorBase, colorFill, x1 + 1, y1 - 1, _thres)) { + ds_queue_enqueue(queue, [x1 + 1, y1 - 1]); + spanAbove = true; + } } - var _delta = color_diff(_c1, get_color_buffer(x1, y1 + 1, w, h)); - if(!spanBelow && _delta <= _thres) { - ds_stack_push(stack, [x1, y1 + 1]); - spanBelow = 1; - } else if(spanBelow && _delta > _thres) { - spanBelow = 0; + if(y1 < surface_h - 1) { + if(!spanBelow && ff_fillable(colorBase, colorFill, x1 + 1, y1 + 1, _thres)) { + ds_queue_enqueue(queue, [x1 + 1, y1 + 1]); + spanBelow = true; + } } } } + + surface_update(); } function canvas_fill(_x, _y, _surf, _thres) { var w = surface_get_width(_surf); var h = surface_get_height(_surf); - var _c1 = get_color_buffer(_x, _y, w, h); + var _c1 = get_color_buffer(_x, _y); for( var i = 0; i < w; i++ ) { for( var j = 0; j < h; j++ ) { @@ -313,7 +350,7 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { continue; } - var _c2 = get_color_buffer(i, j, w, h); + var _c2 = get_color_buffer(i, j); if(color_diff(_c1, _c2) <= _thres) draw_point(i, j); } @@ -322,10 +359,19 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { surface_update(); } + mouse_cur_x = 0; + mouse_cur_y = 0; + mouse_pre_x = 0; + mouse_pre_y = 0; + mouse_pre_draw_x = 0; + mouse_pre_draw_y = 0; + + mouse_holding = false; + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { if(!active) return; - if(keyboard_check(vk_alt)) return; + var _dim = inputs[| 0].getValue(); var _col = inputs[| 1].getValue(); var _siz = inputs[| 2].getValue(); var _thr = inputs[| 3].getValue(); @@ -333,15 +379,13 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var _prev = inputs[| 5].getValue(); var _brush = inputs[| 6].getValue(); - var _surf = outputs[| 0].getValue(); - var _surf_prev = outputs[| 1].getValue(); - var _surf_w = surface_get_width(_surf); - var _surf_h = surface_get_height(_surf); + if(!surface_exists(canvas_surface)) + apply_surface(); + + var _surf_w = surface_get_width(canvas_surface); + var _surf_h = surface_get_height(canvas_surface); - if(!surface_exists(_surf)) return; - if(!surface_exists(_surf_prev)) return; - - surface_set_target(_surf); + surface_set_target(canvas_surface); draw_set_color(_col); var _tool = PANEL_PREVIEW.tool_index; @@ -351,9 +395,14 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { mouse_cur_y = round((_my - _y) / _s - 0.5); if(_tool == 0 || _tool == 1) { - if(_tool == 1) gpu_set_blendmode(bm_subtract); + if(_tool == 0) BLEND_OVER_ALPHA; - if(keyboard_check(vk_shift) && key_mod_press(CTRL)) { + if(_tool == 1) { + gpu_set_blendmode(bm_subtract); + gpu_set_colorwriteenable(false, false, false, true); + } + + if(key_mod_press(SHIFT) && key_mod_press(CTRL)) { var aa = point_direction(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y); var dd = point_distance(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y); var _a = round(aa / 45) * 45; @@ -367,7 +416,7 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); mouse_holding = true; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush); mouse_holding = false; } @@ -377,14 +426,19 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } if(mouse_holding && mouse_click(mb_left, active)) { - draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); - draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush); + if(mouse_pre_draw_x != mouse_cur_x || mouse_pre_draw_y != mouse_cur_y) { + draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); + draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush); + } mouse_pre_draw_x = mouse_cur_x; mouse_pre_draw_y = mouse_cur_y; } - if(_tool == 1) gpu_set_blendmode(bm_normal); + BLEND_NORMAL; + + if(_tool == 1) + gpu_set_colorwriteenable(true, true, true, true); if(mouse_release(mb_left)) { surface_update(); @@ -393,9 +447,10 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { mouse_pre_x = mouse_cur_x; mouse_pre_y = mouse_cur_y; - + apply_surface(); + } else if(_tool == 2 || _tool == 3) { - if(mouse_holding && keyboard_check(vk_shift)) { + if(mouse_holding && key_mod_press(SHIFT)) { var ww = mouse_cur_x - mouse_pre_x; var hh = mouse_cur_y - mouse_pre_y; var ss = max(abs(ww), abs(hh)); @@ -412,26 +467,29 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } if(mouse_release(mb_left)) { - if(_tool == 2) { + BLEND_OVER_ALPHA; + if(_tool == 2) draw_rect_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); - } else if(_tool == 3) { + else if(_tool == 3) draw_ellp_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); - } + BLEND_NORMAL; surface_update(); mouse_holding = false; } + apply_surface(); + } else if(_tool == 4) { if(point_in_rectangle(mouse_cur_x, mouse_cur_y, 0, 0, _surf_w - 1, _surf_h - 1) && mouse_press(mb_left)) { switch(_fill_type) { case 0 : - flood_fill_scanline(mouse_cur_x, mouse_cur_y, _surf, _thr, false); + flood_fill_scanline(mouse_cur_x, mouse_cur_y, canvas_surface, _thr, false); break; case 1 : - flood_fill_scanline(mouse_cur_x, mouse_cur_y, _surf, _thr, true); + flood_fill_scanline(mouse_cur_x, mouse_cur_y, canvas_surface, _thr, true); break; case 2 : - canvas_fill(mouse_cur_x, mouse_cur_y, _surf, _thr); + canvas_fill(mouse_cur_x, mouse_cur_y, canvas_surface, _thr); break; } @@ -441,34 +499,41 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { surface_reset_target(); - surface_set_target(_surf_prev); - draw_clear_alpha(0, 0); - draw_surface_safe(_surf, 0, 0); - - draw_set_color(_col); - - if(_tool == 0 || _tool == 1) { - if(_tool == 1) gpu_set_blendmode(bm_subtract); - - if(keyboard_check(vk_shift)) - draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush); - else - draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); - - if(_tool == 1) gpu_set_blendmode(bm_normal); - } else if (_tool == 2 || _tool == 3) { - if(mouse_holding) { - if(_tool == 2) - draw_rect_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); - else if(_tool == 3) - draw_ellp_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); - } - } - - surface_reset_target(); - #region preview - if(_prev) draw_surface_ext(_surf_prev, _x, _y, _s, _s, 0, c_white, 1); + var _bg = inputs[| 8].getValue(); + var _bga = inputs[| 9].getValue(); + + var _surf_prev = outputs[| 1].getValue(); + _surf_prev = surface_verify(_surf_prev, _dim[0], _dim[1]); + outputs[| 1].setValue(_surf_prev); + + surface_set_target(_surf_prev); + draw_clear_alpha(0, 0); + BLEND_OVER_ALPHA; + + if(is_surface(_bg)) + draw_surface_stretched_ext(_bg, 0, 0, _dim[0], _dim[1], c_white, _bga); + draw_surface(canvas_surface, 0, 0); + + draw_set_color(_col); + if(_tool == 0 || _tool == 1) { + if(key_mod_press(SHIFT)) + draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush); + else + draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); + + if(_tool == 1) gpu_set_blendmode(bm_normal); + } else if (_tool == 2 || _tool == 3) { + if(mouse_holding) { + if(_tool == 2) + draw_rect_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); + else if(_tool == 3) + draw_ellp_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush); + } + } + + BLEND_NORMAL; + surface_reset_target(); if (_tool == 2 || _tool == 3) { if(mouse_holding) { @@ -492,29 +557,16 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { #endregion } - static update = function() { - var _dim = inputs[| 0].getValue(); - + static step = function() { var _outSurf = outputs[| 0].getValue(); - if(!is_surface(_outSurf)) { - _outSurf = surface_create_valid(_dim[0], _dim[1]); - outputs[| 0].setValue(_outSurf); - - buffer_set_surface(surface_buffer, _outSurf, 0); - } else { - if(surface_size_to(_outSurf, _dim[0], _dim[1])) { - buffer_delete(surface_buffer); - surface_buffer = -1; - surface_buffer = buffer_create(surface_get_width(_outSurf) * surface_get_height(_outSurf) * 4, buffer_fixed, 2); - } - } + if(is_surface(_outSurf)) return; - var _outSurf = outputs[| 1].getValue(); - if(!is_surface(_outSurf)) { - _outSurf = surface_create_valid(_dim[0], _dim[1]); - outputs[| 1].setValue(_outSurf); - } else - surface_size_to(_outSurf, _dim[0], _dim[1]); + _outSurf = surface_create_from_buffer(surface_w, surface_h, surface_buffer); + outputs[| 0].setValue(_outSurf); + } + + static update = function(frame = ANIMATOR.current_frame) { + apply_surface(); } static doSerialize = function(_map) { @@ -524,7 +576,8 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { static postDeserialize = function() { if(!ds_map_exists(load_map, "surface")) return; surface_buffer = buffer_base64_decode(load_map[? "surface"]); - var _outSurf = outputs[| 0].getValue(); - buffer_set_surface(surface_buffer, _outSurf, 0); + + buffer_set_surface(surface_buffer, canvas_surface, 0); + surface_update(); } } \ No newline at end of file diff --git a/scripts/node_channels/node_channels.gml b/scripts/node_channels/node_channels.gml index f9517cb48..27a801282 100644 --- a/scripts/node_channels/node_channels.gml +++ b/scripts/node_channels/node_channels.gml @@ -1,22 +1,22 @@ function Node_RGB_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "RGB Extract"; + name = "RGBA Extract"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Output type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Output type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Channel value", "Greyscale"]); - outputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 3] = nodeValue(3, "Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, output_index) { var _out = _data[1]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; switch(output_index) { case 0 : shader_set(_out? sh_channel_R_grey : sh_channel_R); break; case 1 : shader_set(_out? sh_channel_G_grey : sh_channel_G); break; @@ -25,7 +25,7 @@ function Node_RGB_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) } draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_channels_hsv/node_channels_hsv.gml b/scripts/node_channels_hsv/node_channels_hsv.gml index 4722fa2be..ce9857f63 100644 --- a/scripts/node_channels_hsv/node_channels_hsv.gml +++ b/scripts/node_channels_hsv/node_channels_hsv.gml @@ -1,16 +1,16 @@ function Node_HSV_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "HSV Extract"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 2] = nodeValue(2, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, output_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; switch(output_index) { case 0 : shader_set(sh_channel_H); break; case 1 : shader_set(sh_channel_S); break; @@ -18,7 +18,7 @@ function Node_HSV_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) } draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_checkerboard/node_checkerboard.gml b/scripts/node_checkerboard/node_checkerboard.gml index 4c2cde4f2..ba7a4ed13 100644 --- a/scripts/node_checkerboard/node_checkerboard.gml +++ b/scripts/node_checkerboard/node_checkerboard.gml @@ -10,23 +10,23 @@ function Node_Checker(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons uniform_col1 = shader_get_uniform(shader, "col1"); uniform_col2 = shader_get_uniform(shader, "col2"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) + inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 0.1]); - inputs[| 2] = nodeValue(2, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) + inputs[| 3] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 5] = nodeValue(5, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 4] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 5] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, @@ -60,8 +60,8 @@ function Node_Checker(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f(uniform_angle, degtorad(_ang)); shader_set_uniform_f(uniform_amount, _amo); - shader_set_uniform_f_array(uniform_col1, colToVec4(_col1)); - shader_set_uniform_f_array(uniform_col2, colToVec4(_col2)); + shader_set_uniform_f_array_safe(uniform_col1, colToVec4(_col1)); + shader_set_uniform_f_array_safe(uniform_col2, colToVec4(_col2)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); surface_reset_target(); diff --git a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml index 8cb7dddad..aa37d54f7 100644 --- a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml +++ b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml @@ -6,16 +6,19 @@ function Node_Chromatic_Aberration(_x, _y, _group = -1) : Node_Processor(_x, _y, uniform_cen = shader_get_uniform(shader, "center"); uniform_str = shader_get_uniform(shader, "strength"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [-16, 16, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var pos = inputs[| 1].getValue(); @@ -28,19 +31,19 @@ function Node_Chromatic_Aberration(_x, _y, _group = -1) : Node_Processor(_x, _y, static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var center = _data[1]; var stren = _data[2]; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); - shader_set_uniform_f_array(uniform_cen, center); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index e5c4d6205..487fcbb30 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -3,6 +3,61 @@ enum COLLECTION_TAG { loop = 2 } +function groupNodes(nodeArray, _group = noone, record = true, check_connect = true) { + UNDO_HOLDING = true; + + if(_group == noone) { + var cx = 0; + var cy = 0; + for(var i = 0; i < array_length(nodeArray); i++) { + var _node = nodeArray[i]; + cx += _node.x; + cy += _node.y; + } + cx = round(cx / array_length(nodeArray) / 32) * 32; + cy = round(cy / array_length(nodeArray) / 32) * 32; + + _group = new Node_Group(cx, cy, PANEL_GRAPH.getCurrentContext()); + } + + var _content = []; + + for(var i = 0; i < array_length(nodeArray); i++) { + _group.add(nodeArray[i]); + _content[i] = nodeArray[i]; + } + + var _io = []; + if(check_connect) + for(var i = 0; i < array_length(nodeArray); i++) + array_append(_io, nodeArray[i].checkConnectGroup()); + + UNDO_HOLDING = false; + if(record) recordAction(ACTION_TYPE.group, _group, { io: _io, content: _content }); + + return _group; +} + +function upgroupNode(collection, record = true) { + UNDO_HOLDING = true; + var _content = []; + var _io = []; + while(!ds_list_empty(collection.nodes)) { + var remNode = collection.nodes[| 0]; + if(remNode.destroy_when_upgroup) + array_push(_io, remNode); + else + array_push(_content, remNode); + + collection.remove(remNode); + } + + nodeDelete(collection); + UNDO_HOLDING = false; + + if(record) recordAction(ACTION_TYPE.ungroup, collection, { io: _io, content: _content }); +} + function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { nodes = ds_list_create(); ungroupable = true; @@ -10,6 +65,8 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor custom_input_index = 0; custom_output_index = 0; + metadata = new MetaDataManager(); + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { for(var i = custom_input_index; i < ds_list_size(inputs); i++) { var _in = inputs[| i]; @@ -65,20 +122,13 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor recordAction(ACTION_TYPE.group_removed, self, _node); - switch(instanceof(_node)) { - case "Node_Group_Input" : - case "Node_Group_Output" : - case "Node_Iterator_Input" : - case "Node_Iterator_Output" : - case "Node_Iterator_Index" : - nodeDelete(_node); - break; - default : - _node.group = group; - } - - _node.x += x; - _node.y += y; + if(struct_has(_node, "ungroup")) + _node.ungroup(); + + if(_node.destroy_when_upgroup) + nodeDelete(_node); + else + _node.group = group; } static clearCache = function() { @@ -90,9 +140,8 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor static inspectorGroupUpdate = function() { for(var i = 0; i < ds_list_size(nodes); i++) { var _node = nodes[| i]; - if(_node.inspectorUpdate == noone) continue; - - _node.inspectorUpdate(); + if(_node.hasInspectorUpdate() == noone) + _node.inspectorUpdate(); } } @@ -105,7 +154,7 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor for(var i = 0; i < ds_list_size(nodes); i++) { var n = nodes[| i]; n.stepBegin(); - if(n.inspectorUpdate != noone) + if(n.hasInspectorUpdate()) inspectorUpdate = inspectorGroupUpdate; if(!n.use_cache) continue; @@ -208,10 +257,37 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor ds_priority_destroy(ar); } - static onDestroy = function() { - for( var i = 0; i < ds_list_size(nodes); i++ ) { - nodes[| i].destroy(); + static onClone = function(target = PANEL_GRAPH.getCurrentContext()) { + var dups = ds_list_create(); + + for(var i = 0; i < ds_list_size(nodes); i++) { + var _node = nodes[| i]; + var _cnode = _node.clone(target); + ds_list_add(dups, _cnode); + + APPEND_MAP[? _node.node_id] = _cnode.node_id; } + + APPENDING = true; + for(var i = 0; i < ds_list_size(dups); i++) { + var _node = dups[| i]; + _node.connect(); + } + APPENDING = false; + + ds_list_destroy(dups); + } + + static enable = function() { + active = true; + for( var i = 0; i < ds_list_size(nodes); i++ ) + nodes[| i].enable(); + } + + static disable = function() { + active = false; + for( var i = 0; i < ds_list_size(nodes); i++ ) + nodes[| i].disable(); } static resetAllRenderStatus = function() { diff --git a/scripts/node_color/node_color.gml b/scripts/node_color/node_color.gml index 733c58781..c43aff071 100644 --- a/scripts/node_color/node_color.gml +++ b/scripts/node_color/node_color.gml @@ -4,11 +4,11 @@ function Node_Color(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr w = 96; - inputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { return _data[0]; } @@ -18,7 +18,10 @@ function Node_Color(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr var col = inputs[| 0].getValue(); - if(is_array(col)) return; + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } draw_set_color(col); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0); diff --git a/scripts/node_color_adjustment/node_color_adjustment.gml b/scripts/node_color_adjustment/node_color_adjustment.gml index 03ec19f21..1c8e73b46 100644 --- a/scripts/node_color_adjustment/node_color_adjustment.gml +++ b/scripts/node_color_adjustment/node_color_adjustment.gml @@ -16,39 +16,42 @@ function Node_Color_adjust(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_mask_use = shader_get_uniform(shader, "use_mask"); uniform_mask = shader_get_sampler_index(shader, "mask"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 2] = nodeValue("Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 3] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 4] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 5] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 6] = nodeValue(6, "Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 6] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 7] = nodeValue(7, "Blend alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 7] = nodeValue("Blend alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 8] = nodeValue(8, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 8] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 9] = nodeValue(9, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 9] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 10] = nodeValue(10, "Exposure", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 10] = nodeValue("Exposure", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 4, 0.01]); - - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - input_display_list = [0, 8, + inputs[| 11] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 11; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [11, 0, 8, ["Brightness", false], 1, 10, 2, ["HSV", false], 3, 4, 5, ["Color blend", false], 6, 7, 9 @@ -69,7 +72,7 @@ function Node_Color_adjust(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_mask_use, _m != DEF_SURFACE); @@ -82,7 +85,7 @@ function Node_Color_adjust(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) shader_set_uniform_f(uniform_sat, _sat); shader_set_uniform_f(uniform_val, _val); - shader_set_uniform_f_array(uniform_bl, [color_get_red(_bl) / 255, color_get_green(_bl) / 255, color_get_blue(_bl) / 255, 1.0]); + shader_set_uniform_f_array_safe(uniform_bl, [color_get_red(_bl) / 255, color_get_green(_bl) / 255, color_get_blue(_bl) / 255, 1.0]); shader_set_uniform_f(uniform_bla, _bla); gpu_set_colorwriteenable(1, 1, 1, 0); @@ -91,7 +94,7 @@ function Node_Color_adjust(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) if(is_surface(_data[0])) draw_surface_ext_safe(_data[0], 0, 0, 1, 1, 0, c_white, _alp); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_color_data/node_color_data.gml b/scripts/node_color_data/node_color_data.gml index cdd9b372a..8169dbf1a 100644 --- a/scripts/node_color_data/node_color_data.gml +++ b/scripts/node_color_data/node_color_data.gml @@ -4,23 +4,23 @@ function Node_Color_Data(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c w = 96; - inputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 0].setVisible(true, true); - outputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 3] = nodeValue(3, "Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 4] = nodeValue(4, "Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 5] = nodeValue(5, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 3] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 4] = nodeValue("Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 5] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 6] = nodeValue(6, "Brightness", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 6] = nodeValue("Brightness", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var c = _data[0]; - switch(index) { + switch(_output_index) { case 0 : return color_get_red(c) / 255; case 1 : return color_get_green(c) / 255; case 2 : return color_get_blue(c) / 255; diff --git a/scripts/node_color_from_hsv/node_color_from_hsv.gml b/scripts/node_color_from_hsv/node_color_from_hsv.gml index 1a94dcd7e..fb36cf9c4 100644 --- a/scripts/node_color_from_hsv/node_color_from_hsv.gml +++ b/scripts/node_color_from_hsv/node_color_from_hsv.gml @@ -1,33 +1,39 @@ -function Node_Color_HSV(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { +function Node_Color_HSV(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "HSV Color"; previewable = false; w = 96; - - inputs[| 0] = nodeValue(0, "Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); - static update = function() { - outputs[| 0].setValue(make_color_hsv(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); + static process_data = function(_outSurf, _data, _output_index, _array_index) { + return make_color_hsv(_data[0] * 255, _data[1] * 255, _data[2] * 255); } static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); if(bbox.h < 1) return; - draw_set_color(outputs[| 0].getValue()); + var col = outputs[| 0].getValue(); + + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } + + draw_set_color(col); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0); } } \ No newline at end of file diff --git a/scripts/node_color_from_rgb/node_color_from_rgb.gml b/scripts/node_color_from_rgb/node_color_from_rgb.gml index 101104925..370b7ad16 100644 --- a/scripts/node_color_from_rgb/node_color_from_rgb.gml +++ b/scripts/node_color_from_rgb/node_color_from_rgb.gml @@ -1,33 +1,39 @@ -function Node_Color_RGB(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { +function Node_Color_RGB(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "RGB Color"; previewable = false; w = 96; - - inputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); - static update = function() { - outputs[| 0].setValue(make_color_rgb(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); + static process_data = function(_outSurf, _data, _output_index, _array_index) { + return make_color_rgb(_data[0] * 255, _data[1] * 255, _data[2] * 255); } static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); if(bbox.h < 1) return; - draw_set_color(outputs[| 0].getValue()); + var col = outputs[| 0].getValue(); + + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } + + draw_set_color(col); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0); } } \ No newline at end of file diff --git a/scripts/node_color_remove/node_color_remove.gml b/scripts/node_color_remove/node_color_remove.gml index acffde17b..ec33885f1 100644 --- a/scripts/node_color_remove/node_color_remove.gml +++ b/scripts/node_color_remove/node_color_remove.gml @@ -4,46 +4,66 @@ function Node_Color_Remove(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) shader = sh_color_remove; uniform_from = shader_get_uniform(shader, "colorFrom"); uniform_from_count = shader_get_uniform(shader, "colorFrom_amo"); + uniform_invert = shader_get_uniform(shader, "invert"); uniform_ter = shader_get_uniform(shader, "treshold"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ]) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ]) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 2] = nodeValue(2, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + inputs[| 6] = nodeValue("Invert", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Keep the selected colors and remove the rest."); + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["Remove", false], 1, 2, 6, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { - var fr = _data[1]; - var tr = _data[2]; + var frm = _data[1]; + var thr = _data[2]; + var inv = _data[6]; - var _colors = array_create(array_length(fr) * 4); - for(var i = 0; i < array_length(fr); i++) { - _colors[i * 4 + 0] = color_get_red(fr[i]) / 255; - _colors[i * 4 + 1] = color_get_green(fr[i]) / 255; - _colors[i * 4 + 2] = color_get_blue(fr[i]) / 255; + var _colors = array_create(array_length(frm) * 4); + for(var i = 0; i < array_length(frm); i++) { + _colors[i * 4 + 0] = color_get_red(frm[i]) / 255; + _colors[i * 4 + 1] = color_get_green(frm[i]) / 255; + _colors[i * 4 + 2] = color_get_blue(frm[i]) / 255; _colors[i * 4 + 3] = 1; } surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_from, _colors); - shader_set_uniform_i(uniform_from_count, array_length(fr)); - - shader_set_uniform_f(uniform_ter, tr); + shader_set_uniform_f_array_safe(uniform_from, _colors); + shader_set_uniform_i(uniform_from_count, array_length(frm)); + shader_set_uniform_f(uniform_ter, thr); + shader_set_uniform_i(uniform_invert, inv); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_color_replacement/node_color_replacement.gml b/scripts/node_color_replacement/node_color_replacement.gml index f2ce40a65..7ba834aa0 100644 --- a/scripts/node_color_replacement/node_color_replacement.gml +++ b/scripts/node_color_replacement/node_color_replacement.gml @@ -13,31 +13,40 @@ function Node_Color_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group uniform_inv = shader_get_uniform(shader, "inverted"); uniform_hrd = shader_get_uniform(shader, "hardReplace"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Palette from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ], "Color to be replaced.") + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Palette from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ], "Color to be replaced.") .setDisplay(VALUE_DISPLAY.palette); - inputs[| 2] = nodeValue(2, "Palette to", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ], "Palette to be replaced to.") + inputs[| 2] = nodeValue("Palette to", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ], "Palette to be replaced to.") .setDisplay(VALUE_DISPLAY.palette); - inputs[| 3] = nodeValue(3, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Set others to black", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Set pixel that doesn't match any color in 'palette from' to black."); + inputs[| 4] = nodeValue("Set others to black", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Set pixel that doesn't match any color in 'palette from' to black."); - inputs[| 5] = nodeValue(5, "Multiply alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 5] = nodeValue("Multiply alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 6] = nodeValue(6, "Hard replace", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Completely override pixel with new color instead of blending between it."); + inputs[| 6] = nodeValue("Hard replace", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Completely override pixel with new color instead of blending between it."); - input_display_list = [0, + inputs[| 7] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 8] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 9; + + input_display_list = [ 9, + ["Surface", true], 0, 7, 8, ["Palette", false], 1, 2, ["Comparison", false], 3, 5, ["Render", false], 4, 6 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var fr = _data[1]; var to = _data[2]; var tr = _data[3]; @@ -63,15 +72,15 @@ function Node_Color_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_from, _colorFrom); + shader_set_uniform_f_array_safe(uniform_from, _colorFrom); shader_set_uniform_i(uniform_from_count, array_length(fr)); shader_set_uniform_i(uniform_alp, alp); shader_set_uniform_i(uniform_hrd, hrd); - shader_set_uniform_f_array(uniform_to, _colorTo); + shader_set_uniform_f_array_safe(uniform_to, _colorTo); shader_set_uniform_i(uniform_to_count, array_length(to)); shader_set_uniform_f(uniform_ter, tr); shader_set_uniform_i(uniform_inv, in); @@ -82,6 +91,8 @@ function Node_Color_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group BLEND_NORMAL surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_color_sampler/node_color_sampler.gml b/scripts/node_color_sampler/node_color_sampler.gml index 3364e5205..c0057fdcf 100644 --- a/scripts/node_color_sampler/node_color_sampler.gml +++ b/scripts/node_color_sampler/node_color_sampler.gml @@ -2,16 +2,16 @@ function Node_Sampler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons name = "Sampler"; w = 96; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Sampling size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Size of square around the position to sample and average pixel color.") + inputs[| 2] = nodeValue("Sampling size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Size of square around the position to sample and average pixel color.") .setDisplay(VALUE_DISPLAY.slider, [1, 3, 1]); - outputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); static getPreviewValue = function() { return inputs[| 0]; } @@ -45,7 +45,7 @@ function Node_Sampler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons draw_rectangle(x0, y0, x1, y1, true); } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var _surf = _data[0]; var _pos = _data[1]; var _sam = _data[2]; @@ -86,10 +86,14 @@ function Node_Sampler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons if(bbox.h <= 0) return; - var c = outputs[| 0].getValue(); - if(is_array(c)) c = c[0]; + var col = outputs[| 0].getValue(); - draw_set_color(c); + if(is_array(col)) { + drawPalette(col, bbox.x0, bbox.y0, bbox.w, bbox.h); + return; + } + + draw_set_color(col); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0); } } \ No newline at end of file diff --git a/scripts/node_colorize/node_colorize.gml b/scripts/node_colorize/node_colorize.gml index 0cad98713..f09ae4877 100644 --- a/scripts/node_colorize/node_colorize.gml +++ b/scripts/node_colorize/node_colorize.gml @@ -3,54 +3,67 @@ function Node_Colorize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con shader = sh_colorize; uniform_grad_blend = shader_get_uniform(shader, "gradient_blend"); - uniform_color = shader_get_uniform(shader, "gradient_color"); - uniform_time = shader_get_uniform(shader, "gradient_time"); - uniform_shift = shader_get_uniform(shader, "gradient_shift"); - uniform_key = shader_get_uniform(shader, "keys"); + uniform_color = shader_get_uniform(shader, "gradient_color"); + uniform_time = shader_get_uniform(shader, "gradient_time"); + uniform_shift = shader_get_uniform(shader, "gradient_shift"); + uniform_key = shader_get_uniform(shader, "keys"); + uniform_alpha = shader_get_uniform(shader, "multiply_alpha"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_black), new gradientKey(1, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 2] = nodeValue(2, "Gradient shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("Gradient shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, .01 ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + inputs[| 6] = nodeValue("Multiply alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["Colorize", false], 1, 2, 6, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { - var _gra = _data[1]; - var _gra_data = inputs[| 1].getExtraData(); - var _gra_shift = _data[2]; + var _gra = _data[1]; + var _gra_data = inputs[| 1].getExtraData(); + var _gra_shift = _data[2]; + var _alpha = _data[6]; - var _grad_color = []; - var _grad_time = []; - - for(var i = 0; i < ds_list_size(_gra); i++) { - _grad_color[i * 4 + 0] = color_get_red(_gra[| i].value) / 255; - _grad_color[i * 4 + 1] = color_get_green(_gra[| i].value) / 255; - _grad_color[i * 4 + 2] = color_get_blue(_gra[| i].value) / 255; - _grad_color[i * 4 + 3] = 1; - _grad_time[i] = _gra[| i].time; - } + var _grad = gradient_to_array(_gra); + var _grad_color = _grad[0]; + var _grad_time = _grad[1]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); - shader_set_uniform_f_array(uniform_color, _grad_color); - shader_set_uniform_f_array(uniform_time, _grad_time); + shader_set_uniform_f_array_safe(uniform_color, _grad_color); + shader_set_uniform_f_array_safe(uniform_time, _grad_time); shader_set_uniform_f(uniform_shift, _gra_shift); - shader_set_uniform_i(uniform_key, ds_list_size(_gra)); + shader_set_uniform_i(uniform_key, array_length(_gra)); + shader_set_uniform_i(uniform_alpha, _alpha); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_combine_hsv/node_combine_hsv.gml b/scripts/node_combine_hsv/node_combine_hsv.gml index 689269618..2a0ece7ba 100644 --- a/scripts/node_combine_hsv/node_combine_hsv.gml +++ b/scripts/node_combine_hsv/node_combine_hsv.gml @@ -6,11 +6,11 @@ function Node_Combine_HSV(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_s = shader_get_sampler_index(shader, "samS"); uniform_v = shader_get_sampler_index(shader, "samV"); - inputs[| 0] = nodeValue(0, "Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 2] = nodeValue(2, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _h = _data[0]; @@ -19,7 +19,7 @@ function Node_Combine_HSV(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); texture_set_stage(uniform_h, surface_get_texture(_h)); @@ -29,7 +29,7 @@ function Node_Combine_HSV(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_combine_rgb/node_combine_rgb.gml b/scripts/node_combine_rgb/node_combine_rgb.gml index 28e4240f7..b781423b5 100644 --- a/scripts/node_combine_rgb/node_combine_rgb.gml +++ b/scripts/node_combine_rgb/node_combine_rgb.gml @@ -10,19 +10,19 @@ function Node_Combine_RGB(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_usea = shader_get_uniform(shader, "useA"); uniform_mode = shader_get_uniform(shader, "mode"); - inputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 3] = nodeValue(3, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 4] = nodeValue(4, "Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Sampling", false], 4, - ["Surface", false], 0, 1, 2, 3, + ["Surface", true], 0, 1, 2, 3, ] static process_data = function(_outSurf, _data, _output_index, _array_index) { @@ -34,7 +34,7 @@ function Node_Combine_RGB(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); texture_set_stage(uniform_r, surface_get_texture(_r)); @@ -48,7 +48,7 @@ function Node_Combine_RGB(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_compare/node_compare.gml b/scripts/node_compare/node_compare.gml index 748beff59..6d6c6581d 100644 --- a/scripts/node_compare/node_compare.gml +++ b/scripts/node_compare/node_compare.gml @@ -29,17 +29,16 @@ function Node_Compare(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { w = 96; - - inputs[| 0] = nodeValue(0, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Equal", "Not equal", "Greater", "Greater or equal", "Lesser", "Lesser or equal" ]); - inputs[| 1] = nodeValue(1, "a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); static _eval = function(mode, a, b) { switch(mode) { @@ -55,7 +54,7 @@ function Node_Compare(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { return 0; } - function update() { + function update(frame = ANIMATOR.current_frame) { var mode = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var b = inputs[| 2].getValue(); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 03f33ea91..608bb9c13 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -20,13 +20,13 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_rot = shader_get_uniform(shader, "rotation"); uniform_for = shader_get_sampler_index(shader, "fore"); - inputs[| 0] = nodeValue(0, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) + inputs[| 0] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.padding); - inputs[| 1] = nodeValue(1, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, COMPOSE_OUTPUT_SCALING.first) + inputs[| 1] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, COMPOSE_OUTPUT_SCALING.first) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "First surface", "Largest surface", "Constant" ]); - inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 2] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); @@ -42,6 +42,7 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co layer_remove = -1; layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1; + if(array_length(current_data) != ds_list_size(inputs)) return; var lh = 32; var _h = 8 + max(1, amo) * (lh + 4) + 8; @@ -207,16 +208,16 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); - inputs[| index + 0] = nodeValue( index + 0, _s? ("Surface " + string(_s)) : "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| index + 0] = nodeValue(_s? ("Surface " + string(_s)) : "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| index + 1] = nodeValue( index + 1, "Position " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| index + 1] = nodeValue("Position " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return [ overlay_w, overlay_h ]; }); - inputs[| index + 2] = nodeValue( index + 2, "Rotation " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| index + 2] = nodeValue("Rotation " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| index + 3] = nodeValue( index + 3, "Scale " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) + inputs[| index + 3] = nodeValue("Scale " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) .setDisplay(VALUE_DISPLAY.vector); array_push(input_display_list, index + 0); @@ -233,9 +234,9 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co //function getInput() { return inputs[| ds_list_size(inputs) - data_length]; } - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ]; + temp_surf = [ surface_create(1, 1), surface_create(1, 1) ]; surf_dragging = -1; input_dragging = -1; @@ -267,11 +268,6 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var x1 = _x + (ww - pad[0]) * _s; var y0 = _y + pad[1] * _s; var y1 = _y + (hh - pad[3]) * _s; - draw_set_color(COLORS._main_accent); - draw_line(x0, y0, x0, y1); - draw_line(x1, y0, x1, y1); - draw_line(x0, y0, x1, y0); - draw_line(x0, y1, x1, y1); if(input_dragging > -1) { if(drag_type == NODE_COMPOSE_DRAG.move) { @@ -350,14 +346,16 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co if(inputs[| input_dragging].setValue(sa)) UNDO_HOLDING = true; } else if(drag_type == NODE_COMPOSE_DRAG.scale) { - var _surf = inputs[| surf_dragging].getValue(); + var _surf = inputs[| surf_dragging + 0].getValue(); + var _rot = inputs[| surf_dragging + 2].getValue(); var _sw = surface_get_width(_surf); var _sh = surface_get_width(_surf); - var sca_x = dragging_sx + (_mx - dragging_mx) / _s / _sw; - var sca_y = dragging_sy + (_my - dragging_my) / _s / _sh; + var _p = point_rotate(_mx - dragging_mx, _my - dragging_my, 0, 0, -_rot); + var sca_x = _p[0] / _s / _sw * 2; + var sca_y = _p[1] / _s / _sh * 2; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { sca_x = min(sca_x, sca_y); sca_y = min(sca_x, sca_y); } @@ -389,46 +387,59 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var index = input_fix_len + i * data_length; var _surf = current_data[index + 0]; var _pos = current_data[index + 1]; + var _rot = current_data[index + 2]; + var _sca = current_data[index + 3]; if(!_surf || is_array(_surf)) continue; - var _ww = surface_get_width(_surf); - var _hh = surface_get_height(_surf); + var _ww = surface_get_width(_surf); + var _hh = surface_get_height(_surf); + var _sw = _ww * _sca[0]; + var _sh = _hh * _sca[1]; + + var cx = _pos[0] + _ww / 2; + var cy = _pos[1] + _hh / 2; + + var _d0 = point_rotate(cx - _sw / 2, cy - _sh / 2, cx, cy, _rot); + var _d1 = point_rotate(cx - _sw / 2, cy + _sh / 2, cx, cy, _rot); + var _d2 = point_rotate(cx + _sw / 2, cy - _sh / 2, cx, cy, _rot); + var _d3 = point_rotate(cx + _sw / 2, cy + _sh / 2, cx, cy, _rot); + var _rr = point_rotate(cx, cy - _sh / 2 - 1, cx, cy, _rot); + + _d0[0] = overlay_x(_d0[0], _x, _s); _d0[1] = overlay_y(_d0[1], _y, _s); + _d1[0] = overlay_x(_d1[0], _x, _s); _d1[1] = overlay_y(_d1[1], _y, _s); + _d2[0] = overlay_x(_d2[0], _x, _s); _d2[1] = overlay_y(_d2[1], _y, _s); + _d3[0] = overlay_x(_d3[0], _x, _s); _d3[1] = overlay_y(_d3[1], _y, _s); + _rr[0] = overlay_x(_rr[0], _x, _s); _rr[1] = overlay_y(_rr[1], _y, _s); - var _dx0 = _x + _pos[0] * _s; - var _dy0 = _y + _pos[1] * _s; - var _dx1 = _dx0 + _ww * _s; - var _dy1 = _dy0 + _hh * _s; var _borcol = COLORS.node_composite_overlay_border; - var _rx = (_dx0 + _dx1) / 2; - var _ry = _dy0 - 16; var _ri = 0; - - var _sx = _dx1; - var _sy = _dy1; var _si = 0; if(!sel) continue; - if(point_in_circle(_mx, _my, _sx, _sy, 12)) { + if(point_in_circle(_mx, _my, _d3[0], _d3[1], 12)) { hovering = index; hovering_type = NODE_COMPOSE_DRAG.scale; _si = 1; - } else if(point_in_rectangle(_mx, _my, _dx0, _dy0, _dx1, _dy1)) { + } else if(point_in_rectangle_points(_mx, _my, _d0[0], _d0[1], _d1[0], _d1[1], _d2[0], _d2[1], _d3[0], _d3[1])) { hovering = index; hovering_type = NODE_COMPOSE_DRAG.move; - } else if(point_in_circle(_mx, _my, _rx, _ry, 12)) { + } else if(point_in_circle(_mx, _my, _rr[0], _rr[1], 12)) { hovering = index; hovering_type = NODE_COMPOSE_DRAG.rotate; _ri = 1; } - draw_sprite_ui_uniform(THEME.anchor_rotate, _ri, _rx, _ry); - draw_sprite_ui_uniform(THEME.anchor_scale, _si, _sx, _sy); + draw_sprite_ui_uniform(THEME.anchor_rotate, _ri, _rr[0], _rr[1],,,, _rot); + draw_sprite_ui_uniform(THEME.anchor_scale, _si, _d3[0], _d3[1],,,, _rot); draw_set_color(_borcol); - draw_rectangle(_dx0, _dy0, _dx1, _dy1, true); + draw_line(_d0[0], _d0[1], _d1[0], _d1[1]); + draw_line(_d0[0], _d0[1], _d2[0], _d2[1]); + draw_line(_d3[0], _d3[1], _d1[0], _d1[1]); + draw_line(_d3[0], _d3[1], _d2[0], _d2[1]); } if(hovering != -1) { @@ -444,9 +455,28 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var _dx1 = _dx0 + _ww * _s; var _dy1 = _dy0 + _hh * _s; + var _sw = _ww * _sca[0]; + var _sh = _hh * _sca[1]; + + var cx = _pos[0] + _ww / 2; + var cy = _pos[1] + _hh / 2; + + var _d0 = point_rotate(cx - _sw / 2, cy - _sh / 2, cx, cy, _rot); + var _d1 = point_rotate(cx - _sw / 2, cy + _sh / 2, cx, cy, _rot); + var _d2 = point_rotate(cx + _sw / 2, cy - _sh / 2, cx, cy, _rot); + var _d3 = point_rotate(cx + _sw / 2, cy + _sh / 2, cx, cy, _rot); + + _d0[0] = overlay_x(_d0[0], _x, _s); _d0[1] = overlay_y(_d0[1], _y, _s); + _d1[0] = overlay_x(_d1[0], _x, _s); _d1[1] = overlay_y(_d1[1], _y, _s); + _d2[0] = overlay_x(_d2[0], _x, _s); _d2[1] = overlay_y(_d2[1], _y, _s); + _d3[0] = overlay_x(_d3[0], _x, _s); _d3[1] = overlay_y(_d3[1], _y, _s); + if(hovering_type == NODE_COMPOSE_DRAG.move) { draw_set_color(COLORS._main_accent); - draw_rectangle_border(_dx0, _dy0, _dx1, _dy1, 2); + draw_line_round(_d0[0], _d0[1], _d1[0], _d1[1], 2); + draw_line_round(_d0[0], _d0[1], _d2[0], _d2[1], 2); + draw_line_round(_d3[0], _d3[1], _d1[0], _d1[1], 2); + draw_line_round(_d3[0], _d3[1], _d2[0], _d2[1], 2); if(mouse_press(mb_left, active)) { surf_dragging = hovering; @@ -474,8 +504,8 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co drag_type = hovering_type; dragging_sx = _sca[0]; dragging_sy = _sca[1]; - dragging_mx = _mx; - dragging_my = _my; + dragging_mx = _dx0 + _ww / 2 * _s; + dragging_my = _dy0 + _hh / 2 * _s; } } } @@ -535,7 +565,9 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var imageAmo = (ds_list_size(inputs) - input_fix_len) / data_length; var _vis = attributes[? "layer_visible"]; - BLEND_OVERRIDE + surface_set_target(_outSurf); + draw_clear_alpha(0, 0); + BLEND_OVER_ALPHA; for(var i = 0; i < imageAmo; i++) { var vis = _vis[| i]; if(!vis) continue; @@ -548,28 +580,19 @@ function Node_Composite(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co if(!_s || is_array(_s)) continue; - surface_set_target(temp_surf[bg]); - shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_s) / ww, surface_get_height(_s) / hh ]); - shader_set_uniform_f_array(uniform_pos, [ _pos[0] / ww, _pos[1] / hh]); - shader_set_uniform_f_array(uniform_sca, _sca) - shader_set_uniform_f(uniform_rot, degtorad(_rot)); - texture_set_stage(uniform_for, surface_get_texture(_s)); - - draw_surface_safe(temp_surf[!bg], 0, 0); - shader_reset(); - surface_reset_target(); + var _ww = surface_get_width(_s); + var _hh = surface_get_height(_s); + var _sw = _ww * _sca[0]; + var _sh = _hh * _sca[1]; - res_index = bg; - bg = !bg; + var cx = _pos[0] + _ww / 2; + var cy = _pos[1] + _hh / 2; + + var _d0 = point_rotate(cx - _sw / 2, cy - _sh / 2, cx, cy, _rot); + + draw_surface_ext_safe(_s, _d0[0], _d0[1], _sca[0], _sca[1], _rot); } - BLEND_NORMAL - - surface_set_target(_outSurf); - draw_clear_alpha(0, 0); - BLEND_OVERRIDE - draw_surface_safe(temp_surf[res_index], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index 14372130f..2a5d0db2b 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -5,31 +5,37 @@ function Node_Condition(_x, _y, _group = -1) : Node(_x, _y, _group) constructor w = 96; - inputs[| 0] = nodeValue( 0, "Check value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| 0] = nodeValue("Check value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); - inputs[| 1] = nodeValue( 1, "Condition", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Equal", "Not equal", "Less", "Less or equal", "Greater", "Greater or equal"]); - inputs[| 2] = nodeValue( 2, "Compare to", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ); + inputs[| 1] = nodeValue("Condition", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Equal", "Not equal", "Less", "Less or equal", "Greater", "Greater or equal"]) + .rejectArray(); + + inputs[| 2] = nodeValue("Compare to", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + .rejectArray(); - inputs[| 3] = nodeValue( 3, "True", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) + inputs[| 3] = nodeValue("True", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) .setVisible(true, true); - inputs[| 4] = nodeValue( 4, "False", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) + + inputs[| 4] = nodeValue("False", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 ) .setVisible(true, true); - inputs[| 5] = nodeValue( 5, "Eval mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Boolean", "Comparison"]); + inputs[| 5] = nodeValue("Eval mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Boolean", "Comparison"]) + .rejectArray(); - inputs[| 6] = nodeValue( 6, "Boolean", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) - .setVisible(true, true); + inputs[| 6] = nodeValue("Boolean", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) + .setVisible(true, true) + .rejectArray(); input_display_list = [ 5, ["Condition", false], 0, 1, 2, 6, ["Result", true], 3, 4 ] - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - outputs[| 1] = nodeValue(1, "Bool", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); + outputs[| 1] = nodeValue("Bool", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false); static step = function() { var _mode = inputs[| 5].getValue(); @@ -40,7 +46,7 @@ function Node_Condition(_x, _y, _group = -1) : Node(_x, _y, _group) constructor inputs[| 6].setVisible(!_mode); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _true = inputs[| 3].getValue(); var _fals = inputs[| 4].getValue(); diff --git a/scripts/node_convolution/node_convolution.gml b/scripts/node_convolution/node_convolution.gml index 617f2045b..bdac5ac15 100644 --- a/scripts/node_convolution/node_convolution.gml +++ b/scripts/node_convolution/node_convolution.gml @@ -6,17 +6,26 @@ function Node_Convolution(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_ker = shader_get_uniform(shader, "kernel"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Kernel", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, array_create(9)) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Kernel", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, array_create(9)) .setDisplay(VALUE_DISPLAY.kernel); - inputs[| 2] = nodeValue(2, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 2, + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 5, + ["Surface", true], 0, 2, 3, 4, ["Kernel", false], 1, ]; @@ -26,18 +35,20 @@ function Node_Convolution(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_outSurf), surface_get_height(_outSurf)); - shader_set_uniform_f_array(uniform_ker, _ker); + shader_set_uniform_f_array_safe(uniform_ker, _ker); shader_set_uniform_i(uniform_sam, _sam); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_corner/node_corner.gml b/scripts/node_corner/node_corner.gml index d083ff583..c140f9edc 100644 --- a/scripts/node_corner/node_corner.gml +++ b/scripts/node_corner/node_corner.gml @@ -7,12 +7,25 @@ function Node_Corner(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_dim = shader_get_uniform(sh_corner, "dimension"); uniform_rad = shader_get_uniform(sh_corner, "rad"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) + inputs[| 1] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) .setDisplay(VALUE_DISPLAY.slider, [2, 16, 1]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 3] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 4; + + input_display_list = [ 4, + ["Surface", true], 0, 2, 3, + ["Corner", false], 1, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var wd = _data[1]; @@ -21,31 +34,33 @@ function Node_Corner(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(temp); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_corner_erode); - shader_set_uniform_f_array(uniform_er_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_er_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); shader_set_uniform_f(uniform_er_size, wd); draw_surface_safe(_data[0], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; shader_reset(); surface_reset_target(); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_corner); - shader_set_uniform_f_array(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); shader_set_uniform_f(uniform_rad, wd); draw_surface_safe(temp, 0, 0); - BLEND_NORMAL + BLEND_NORMAL; shader_reset(); surface_reset_target(); - surface_free(temp); + + _outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_counter/node_counter.gml b/scripts/node_counter/node_counter.gml index 9d493e3ca..697713699 100644 --- a/scripts/node_counter/node_counter.gml +++ b/scripts/node_counter/node_counter.gml @@ -1,19 +1,21 @@ function Node_Counter(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "Counter"; + name = "Frame Index"; update_on_frame = true; previewable = false; w = 96; + inputs[| 0] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 0] = nodeValue(0, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 1] = nodeValue(1, "Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 2] = nodeValue(2, "Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, @"Counting mode + inputs[| 1] = nodeValue("Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + + inputs[| 2] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, @"Counting mode - Frame count: Count value up/down per frame. - Animation progress: Count from 0 (first frame) to 1 (last frame). ") - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Frame count", "Animation progress"]); + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Frame count", "Animation progress"]) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Counter", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); input_display_list = [ 2, 0, 1 @@ -24,10 +26,10 @@ function Node_Counter(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons inputs[| 0].setVisible(mode == 0); } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var time = ANIMATOR.current_frame; - var mode = inputs[| 2].getValue(); - var val; + var mode = _data[2]; + var val = 0; switch(mode) { case 0 : val = _data[0] + time * _data[1]; break; diff --git a/scripts/node_crop/node_crop.gml b/scripts/node_crop/node_crop.gml index 4a9993d14..86eba3b19 100644 --- a/scripts/node_crop/node_crop.gml +++ b/scripts/node_crop/node_crop.gml @@ -2,13 +2,20 @@ function Node_Crop(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru name = "Crop"; preview_alpha = 0.5; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Crop", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) + inputs[| 1] = nodeValue("Crop", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.padding) .setUnitRef(function(index) { return getDimension(index); }); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 2; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 2, + ["Surface", false], 0, 1, + ] drag_side = -1; drag_mx = 0; @@ -107,11 +114,11 @@ function Node_Crop(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(_inSurf, -_crop[2], -_crop[1]); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index 40b9a2304..ff99da47d 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -30,14 +30,16 @@ function Node_CSV_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc w = 128; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, ["*.csv", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, ["*.csv", ""]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Convert to number", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 1] = nodeValue("Convert to number", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - outputs[| 1] = nodeValue(1, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") + outputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); content = ""; @@ -58,7 +60,7 @@ function Node_CSV_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); if(ext != ".csv") return false; @@ -89,14 +91,14 @@ function Node_CSV_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc return true; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); update(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_csv_file_write/node_csv_file_write.gml b/scripts/node_csv_file_write/node_csv_file_write.gml index c7f25dc1d..a29906ffc 100644 --- a/scripts/node_csv_file_write/node_csv_file_write.gml +++ b/scripts/node_csv_file_write/node_csv_file_write.gml @@ -15,14 +15,14 @@ function Node_CSV_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constru w = 128; + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_save, ["*.csv", ""]) + .rejectArray(); - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_save, ["*.csv", ""]); - - inputs[| 1] = nodeValue(1, "Content", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, "") + inputs[| 1] = nodeValue("Content", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, "") .setDisplay(true); - static update = function() { + static writeFile = function() { var path = inputs[| 0].getValue(); if(path == "") return; if(filename_ext(path) != ".csv") @@ -48,6 +48,9 @@ function Node_CSV_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constru file_text_close(f); } + static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static onInspectorUpdate = function() { writeFile(); } + function onDrawNode(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); diff --git a/scripts/node_de_corner/node_de_corner.gml b/scripts/node_de_corner/node_de_corner.gml index 2c2eabc2f..615af2d37 100644 --- a/scripts/node_de_corner/node_de_corner.gml +++ b/scripts/node_de_corner/node_de_corner.gml @@ -6,21 +6,28 @@ function Node_De_Corner(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_sol = shader_get_uniform(shader, "solid"); uniform_tol = shader_get_uniform(shader, "tolerance"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 1; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 1, + ["Surface", false], 0, + ] static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_de_stray/node_de_stray.gml b/scripts/node_de_stray/node_de_stray.gml index 865a50869..6c79bb969 100644 --- a/scripts/node_de_stray/node_de_stray.gml +++ b/scripts/node_de_stray/node_de_stray.gml @@ -5,25 +5,32 @@ function Node_De_Stray(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_dim = shader_get_uniform(shader, "dimension"); uniform_tol = shader_get_uniform(shader, "tolerance"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 2; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 2, + ["Surface", false], 0, 1, + ] static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); shader_set_uniform_f(uniform_tol, _data[1]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_dilate/node_dilate.gml b/scripts/node_dilate/node_dilate.gml index b06c9a00f..18a8c59c3 100644 --- a/scripts/node_dilate/node_dilate.gml +++ b/scripts/node_dilate/node_dilate.gml @@ -8,23 +8,32 @@ function Node_Dilate(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_rad = shader_get_uniform(shader, "radius"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [-3, 3, 0.01]); - inputs[| 3] = nodeValue(3, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); + inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); - inputs[| 4] = nodeValue(4, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 4] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 4, + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 7, + ["Surface", true], 0, 4, 5, 6, ["Dilate", false], 1, 2, 3, ]; @@ -37,10 +46,10 @@ function Node_Dilate(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var center = _data[1]; var stren = _data[2]; @@ -48,17 +57,19 @@ function Node_Dilate(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const var sam = _data[4]; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); - shader_set_uniform_f_array(uniform_cen, center); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); shader_set_uniform_f(uniform_rad, rad); shader_set_uniform_i(uniform_sam, sam); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 890b2c877..0a628511a 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -12,41 +12,49 @@ function Node_Displace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_it = shader_get_uniform(shader, "iterate"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Displace map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Displace map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [1, 0], "Vector to displace pixel by." ) + inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [1, 0], "Vector to displace pixel by." ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 4] = nodeValue(4, "Mid value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0., "Brightness value to be use as a basis for 'no displacement'.") + inputs[| 4] = nodeValue("Mid value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0., "Brightness value to be use as a basis for 'no displacement'.") .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Color data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, @"Use color data set extra information. + inputs[| 5] = nodeValue("Color data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, @"Use color data set extra information. - Ignore: Don't use color data. - Vector: Use red as X displacement, green as Y displacement. - Angle: Use red as angle, green as distance.") .setDisplay(VALUE_DISPLAY.enum_button, [ "Ignore", "Vector", "Angle" ]); - inputs[| 6] = nodeValue(6, "Iterate", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, @"If not set, then strength value is multiplied directly to the displacement. + inputs[| 6] = nodeValue("Iterate", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, @"If not set, then strength value is multiplied directly to the displacement. If set, then strength value control how many times the effect applies on itself."); - inputs[| 7] = nodeValue(7, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 7] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - input_display_list = [ - ["Surface", true], 0, 7, + inputs[| 8] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 9] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 10] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 10; + + input_display_list = [ 10, + ["Surface", true], 0, 7, 8, 9, ["Displace", false], 1, 3, 4, ["Color", false], 5, 2, - ["Algorithm", true], 6 + ["Algorithm", true], 6 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { switch(_data[5]) { case 0 : inputs[| 2].setVisible(true); @@ -63,13 +71,13 @@ If set, then strength value control how many times the effect applies on itself. surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); texture_set_stage(displace_map_sample, surface_get_texture(_data[1])); - shader_set_uniform_f_array(uniform_dim, [ww, hh]); - shader_set_uniform_f_array(uniform_map_dim, [mw, mh]); - shader_set_uniform_f_array(uniform_position, _data[2]); + shader_set_uniform_f_array_safe(uniform_dim, [ww, hh]); + shader_set_uniform_f_array_safe(uniform_map_dim, [mw, mh]); + shader_set_uniform_f_array_safe(uniform_position, _data[2]); shader_set_uniform_f(uniform_strength, _data[3]); shader_set_uniform_f(uniform_mid, _data[4]); shader_set_uniform_i(uniform_rg, _data[5]); @@ -78,9 +86,11 @@ If set, then strength value control how many times the effect applies on itself. draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[8], _data[9]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_display_image/node_display_image.gml b/scripts/node_display_image/node_display_image.gml index dd5fd7777..dda5f6544 100644 --- a/scripts/node_display_image/node_display_image.gml +++ b/scripts/node_display_image/node_display_image.gml @@ -29,15 +29,16 @@ function Node_Display_Image(_x, _y, _group = -1) : Node(_x, _y, _group) construc always_output = true; auto_height = false; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, ["*.png", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, ["*.png", ""]) + .rejectArray(); spr = noone; path_current = ""; first_update = false; - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -48,7 +49,7 @@ function Node_Display_Image(_x, _y, _group = -1) : Node(_x, _y, _group) construc path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); switch(ext) { @@ -70,7 +71,7 @@ function Node_Display_Image(_x, _y, _group = -1) : Node(_x, _y, _group) construc return false; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_display_text/node_display_text.gml b/scripts/node_display_text/node_display_text.gml index 73c415474..8638b33a4 100644 --- a/scripts/node_display_text/node_display_text.gml +++ b/scripts/node_display_text/node_display_text.gml @@ -15,17 +15,22 @@ function Node_Display_Text(_x, _y, _group = -1) : Node(_x, _y, _group) construct name_hover = false; draw_scale = 1; - inputs[| 0] = nodeValue(0, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "Text"); + inputs[| 1] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "Text") + .rejectArray(); - inputs[| 2] = nodeValue(2, "Style", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2) + inputs[| 2] = nodeValue("Style", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Header", "Sub header", "Normal"]) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.75) + inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.75) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Line width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1000000); + inputs[| 4] = nodeValue("Line width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1000000) + .rejectArray(); input_display_list = [1, ["Styling", false], 2, 0, 3, 4]; @@ -200,7 +205,7 @@ function Node_Display_Text(_x, _y, _group = -1) : Node(_x, _y, _group) construct array_push(_lines, ss); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 1 || index == 4) line_update(inputs[| 1].getValue(), inputs[| 4].getValue()); } diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 0dd143a85..95d6e4b9f 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -16,27 +16,36 @@ function Node_Dither(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const name = "Dither"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 2] = nodeValue(2, "Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "2 x 2 Bayer", "4 x 4 Bayer", "8 x 8 Bayer", "Custom" ]); - inputs[| 3] = nodeValue(3, "Dither map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) + inputs[| 3] = nodeValue("Dither map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) .setVisible(false); - inputs[| 4] = nodeValue(4, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 4] = nodeValue("Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [1, 5, 0.1]); - inputs[| 5] = nodeValue(5, "Contrast map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 5] = nodeValue("Contrast map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 6] = nodeValue(6, "Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 6] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Color", "Alpha" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 7] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ 0, + inputs[| 8] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 9; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 9, + ["Surface", true], 0, 7, 8, ["Pattern", false], 2, 3, ["Dither", false], 6, 1, 4, 5 ] @@ -82,32 +91,32 @@ function Node_Dither(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ] ); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ] ); switch(_typ) { case 0 : shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 2); - shader_set_uniform_f_array(uniform_dither, dither2); + shader_set_uniform_f_array_safe(uniform_dither, dither2); break; case 1 : shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 4); - shader_set_uniform_f_array(uniform_dither, dither4); + shader_set_uniform_f_array_safe(uniform_dither, dither4); break; case 2 : shader_set_uniform_i(uniform_map_use, 0); shader_set_uniform_f(uniform_dither_size, 8); - shader_set_uniform_f_array(uniform_dither, dither8); + shader_set_uniform_f_array_safe(uniform_dither, dither8); break; case 3 : if(is_surface(_map)) { shader_set_uniform_i(uniform_map_use, 1); - shader_set_uniform_f_array(uniform_map_dim, [ surface_get_width(_map), surface_get_height(_map) ]); + shader_set_uniform_f_array_safe(uniform_map_dim, [ surface_get_width(_map), surface_get_height(_map) ]); texture_set_stage(uniform_map, surface_get_texture(_map)); } break; @@ -118,16 +127,18 @@ function Node_Dither(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const texture_set_stage(uniform_con_map, surface_get_texture(_conMap)); shader_set_uniform_f(uniform_constrast, _con); - shader_set_uniform_f_array(uniform_color, _colors); + shader_set_uniform_f_array_safe(uniform_color, _colors); shader_set_uniform_i(uniform_key, array_length(_pal)); } draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_edge_detect/node_edge_detect.gml b/scripts/node_edge_detect/node_edge_detect.gml index 63f5b357d..4c7eab330 100644 --- a/scripts/node_edge_detect/node_edge_detect.gml +++ b/scripts/node_edge_detect/node_edge_detect.gml @@ -6,17 +6,26 @@ function Node_Edge_Detect(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_filter = shader_get_uniform(shader, "filter"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Sobel", "Prewitt", "Laplacian"] ); - inputs[| 2] = nodeValue(2, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 2, + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 5, + ["Surface", true], 0, 2, 3, 4, ["Edge detect", false], 1, ]; @@ -26,18 +35,20 @@ function Node_Edge_Detect(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); shader_set_uniform_i(uniform_filter, ft); shader_set_uniform_i(uniform_sam, ov); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_equation/node_equation.gml b/scripts/node_equation/node_equation.gml index 34938c993..baacbfcff 100644 --- a/scripts/node_equation/node_equation.gml +++ b/scripts/node_equation/node_equation.gml @@ -6,18 +6,18 @@ function Node_Equation(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con w = 96; - inputs[| 0] = nodeValue(1, "Equation", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + inputs[| 0] = nodeValue("Equation", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue( index + 0, "Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - inputs[| index + 1] = nodeValue( index + 1, "Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| index + 1] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); inputs[| index + 1].editWidget.interactable = false; } - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); argument_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { argument_renderer.x = _x; @@ -37,7 +37,7 @@ function Node_Equation(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con _jName.editWidget.draw(tx, ty, ui(128), _th, _jName.showValue(), _m, _jName.display_type); draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text_sub); - draw_text_add(tx + ui(128 + 12), ty + ui(6), "="); + draw_text_over(tx + ui(128 + 12), ty + ui(6), "="); var _jValue = inputs[| i + 1]; _jValue.editWidget.setActiveFocus(_focus, _hover); @@ -100,7 +100,7 @@ function Node_Equation(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con createNewInput(); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index < input_fix_len) return; if(LOADING || APPENDING) return; @@ -111,7 +111,7 @@ function Node_Equation(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con refreshDynamicInput(); } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var eq = _data[0]; var params = {}; diff --git a/scripts/node_erode/node_erode.gml b/scripts/node_erode/node_erode.gml index a6f354454..825a936cd 100644 --- a/scripts/node_erode/node_erode.gml +++ b/scripts/node_erode/node_erode.gml @@ -7,34 +7,49 @@ function Node_Erode(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_bor = shader_get_uniform(shader, "border"); uniform_alp = shader_get_uniform(shader, "alpha"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); - inputs[| 2] = nodeValue(2, "Preserve border",self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 2] = nodeValue("Preserve border",self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 3] = nodeValue(3, "Use alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 3] = nodeValue("Use alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 5] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 6] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 6; + + input_display_list = [ 6, + ["Surface", true], 0, 4, 5, + ["Erode", false], 1, 2, 3, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var wd = _data[1]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); shader_set_uniform_f(uniform_size, wd); shader_set_uniform_i(uniform_bor, _data[2]? 1 : 0); shader_set_uniform_i(uniform_alp, _data[3]? 1 : 0); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index ca0dc69a5..ade40f928 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -26,22 +26,25 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { playing = false; played = 0; - inputs[| 0] = nodeValue(0, "Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Paths", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + inputs[| 1] = nodeValue("Paths", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_save, ["*.png", ""]) - .setVisible(true); + .setVisible(true) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Template", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "%d%n") - .setDisplay(VALUE_DISPLAY.export_format); + inputs[| 2] = nodeValue("Template", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "%d%n") + .setDisplay(VALUE_DISPLAY.export_format) + .rejectArray(); - format_single = ["Single image (.png)", "Image sequence (.png)", "Animated gif (.gif)"]; - format_array = ["Multiple image (.png)", "Image sequence (.png)", "Animated gif (.gif)"]; + format_single = ["Single image", "Image sequence", "Animated"]; + format_array = ["Multiple images", "Image sequences", "Animated"]; - inputs[| 3] = nodeValue(3, "Format", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Single image (.png)", "Image sequence (.png)", "Animated gif (.gif)"]); + inputs[| 3] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, format_single) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Template guides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Template guides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.label, @"%d Directory %1d Goes up 1 level @@ -49,34 +52,87 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { %f Frame %i Array index" ); - inputs[| 5] = nodeValue(5, "Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) - .setVisible(false); + inputs[| 5] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .setVisible(false) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Frame optimization", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) - .setVisible(false); + inputs[| 6] = nodeValue("Frame optimization", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .setVisible(false) + .rejectArray(); - inputs[| 7] = nodeValue(7, "Color merge", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.02) + inputs[| 7] = nodeValue("Color merge", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.02) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) - .setVisible(false); + .setVisible(false) + .rejectArray(); - inputs[| 8] = nodeValue(8, "Framerate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 30) + inputs[| 8] = nodeValue("Framerate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 30) + .rejectArray(); + format_image = [ ".png", ".jpg", ".webp" ]; + format_animation = [ ".gif", ".webp" ]; + + inputs[| 9] = nodeValue("Format", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, format_image) + .rejectArray(); + + inputs[| 10] = nodeValue("Quality", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 80) + .setDisplay(VALUE_DISPLAY.slider, [0, 100, 1]) + .rejectArray(); + input_display_list = [ - ["Export", false], 0, 1, 2, 4, - ["Format settings", false], 3, - ["Gif settings", false], 8, 5, 6, 7 + ["Export", false], 0, 1, 2, 4, + ["Format ", false], 3, 9, + ["Settings", false], 8, 5, 6, 7, 10, ]; + directory = DIRECTORY + "temp\\" + string(irandom_range(100000, 999999)); + converter = working_directory + "ImageMagick\\convert.exe"; + magick = working_directory + "ImageMagick\\magick.exe"; + webp = working_directory + "webp\\bin\\webpmux.exe"; + static onValueUpdate = function(_index) { var form = inputs[| 3].getValue(); + if(_index == 3) + inputs[| 9].setValue(0); + if(_index == 3 && form == 1) inputs[| 2].setValue("%d%n%3f%i"); + } + + static renderWebp = function(temp_path, target_path) { + var _path = file_find_first(temp_path + "*.png", 0); + var frames = []; - inputs[| 5].setVisible(form == 2); - inputs[| 6].setVisible(form == 2); - inputs[| 7].setVisible(form == 2); - inputs[| 8].setVisible(form == 2); + while(_path != "") { + var _frame = "\"" + temp_path + string_replace_all(_path, ".png", "") + ".webp\""; + var _pathTemp = "\"" + temp_path + _path + "\""; + var shell_cmd = _pathTemp + " -define webp:lossless=true " + _frame; + + array_push(frames, _frame); + execute_shell(magick, shell_cmd); + + _path = file_find_next(); + } + + var rate = inputs[| 8].getValue(); + var framerate = round(1 / rate * 1000); + + var cmd = ""; + + for( var i = 0; i < array_length(frames); i++ ) + cmd += "-frame " + frames[i] + " +" + string(framerate) + "+0+0+1 "; + + cmd += "-bgcolor 0,0,0,0 "; + cmd += "-o \"" + target_path + "\""; + + execute_shell(webp, cmd); + + var noti = log_message("EXPORT", "Export webp as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive); + noti.path = filename_dir(target_path); + noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); + + PANEL_MENU.setNotiIcon(THEME.noti_icon_tick); } static renderGif = function(temp_path, target_path) { @@ -85,7 +141,6 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var fuzz = inputs[| 7].getValue(); var rate = inputs[| 8].getValue(); - var converter = working_directory + "ImageMagick\\convert.exe"; var framerate = 100 / rate; var loop_str = loop? 0 : 1; @@ -95,8 +150,6 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { " -loop " + string(loop_str); if(opti) { - var first_image = string_replace(temp_path, "*", "100000"); - shell_cmd += " -fuzz " + string(fuzz * 100) + "%" + " -layers OptimizeFrame" + " -layers OptimizeTransparency"; @@ -105,7 +158,7 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { shell_cmd += " " + temp_path + " " + target_path; - execute_shell_simple(converter, shell_cmd,, 0); + execute_shell(converter, shell_cmd); var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive); noti.path = filename_dir(target_path); @@ -178,14 +231,54 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } - if(form == NODE_EXPORT_FORMAT.single || form == NODE_EXPORT_FORMAT.sequence) - s += ".png"; - else - s += ".gif"; + s += ".png"; return s; } + static save_surface = function(_surf, _path) { + var form = inputs[| 3].getValue(); + + if(form == NODE_EXPORT_FORMAT.gif) { + surface_save(_surf, _path); + return _path; + } + + var extd = inputs[| 9].getValue(); + var qual = inputs[| 10].getValue(); + var ext = array_safe_get(format_image, extd, ".png"); + + var _pathOut = _path; + var _pathTemp = directory + "\\" + string(irandom_range(10000, 99999)) + ".png"; + + switch(ext) { + case ".png": + surface_save(_surf, _path); + break; + case ".jpg": + surface_save(_surf, _pathTemp); + + _pathOut = "\"" + string_replace_all(_path, ".png", "") + ".jpg\""; + _pathTemp = "\"" + _pathTemp + "\""; + var shell_cmd = _pathTemp + " -quality " + string(qual) + " " + _pathOut; + + print(shell_cmd) + execute_shell(magick, shell_cmd); + break; + case ".webp": + surface_save(_surf, _pathTemp); + + _pathOut = "\"" + string_replace_all(_path, ".png", "") + ".webp\""; + _pathTemp = "\"" + _pathTemp + "\""; + var shell_cmd = _pathTemp + " -quality " + string(qual) + " -define webp:lossless=true " + _pathOut; + + execute_shell(magick, shell_cmd); + break; + } + + return _pathOut; + } + static export = function() { var surf = inputs[| 0].getValue(); var path = inputs[| 1].getValue(); @@ -201,18 +294,18 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(!is_surface(_surf)) continue; if(form == NODE_EXPORT_FORMAT.gif) { - p = DIRECTORY + "temp\\" + string(i) + "\\" + string(100000 + ANIMATOR.current_frame) + ".png"; - } else if(form == NODE_EXPORT_FORMAT.single || form == NODE_EXPORT_FORMAT.sequence) { + p = directory + "\\" + string(i) + "\\" + string(100000 + ANIMATOR.current_frame) + ".png"; + } else { if(is_array(path) && array_length(path) == array_length(surf)) p = pathString(path[ safe_mod(i, array_length(path)) ], suff, i); else p = pathString(path, suff, i); } - surface_save(_surf, p); + p = save_surface(_surf, p); } - if(form == NODE_EXPORT_FORMAT.single || form == NODE_EXPORT_FORMAT.sequence) { + if(form != NODE_EXPORT_FORMAT.gif) { var noti = log_message("EXPORT", "Export " + string(array_length(surf)) + " images complete.", THEME.noti_icon_tick, COLORS._main_value_positive); noti.path = filename_dir(p); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); @@ -224,13 +317,13 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(is_array(path)) p = path[0]; if(form == NODE_EXPORT_FORMAT.gif) - p = DIRECTORY + "temp\\" + string(100000 + ANIMATOR.current_frame) + ".png"; + p = directory + "\\" + string(100000 + ANIMATOR.current_frame) + ".png"; else p = pathString(p, suff); - surface_save(surf, p); + p = save_surface(surf, p); - if(form == NODE_EXPORT_FORMAT.single || form == NODE_EXPORT_FORMAT.sequence) { + if(form != NODE_EXPORT_FORMAT.gif) { var noti = log_message("EXPORT", "Export image as " + p, THEME.noti_icon_tick, COLORS._main_value_positive); noti.path = filename_dir(p); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); @@ -240,7 +333,30 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } - static inspectorUpdate = function() { + inspUpdateTooltip = "Export"; + inspUpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; + + insp2UpdateTooltip = "Export All"; + insp2UpdateIcon = [ THEME.play_all, 0, COLORS._main_value_positive ]; + + static onInspectorUpdate = function() { + initExport(); + } + + static onInspector2Update = function() { + var key = ds_map_find_first(NODE_MAP); + repeat(ds_map_size(NODE_MAP)) { + var node = NODE_MAP[? key]; + key = ds_map_find_next(NODE_MAP, key); + + if(!node.active) continue; + if(instanceof(node) != "Node_Export") continue; + + node.initExport(); + } + } + + static initExport = function() { if(LOADING || APPENDING) return; if(playing) return; @@ -260,17 +376,43 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { ANIMATOR.is_playing = true; ANIMATOR.rendering = true; - if(directory_exists(DIRECTORY + "temp")) - directory_destroy(DIRECTORY + "temp"); + if(directory_exists(directory)) + directory_destroy(directory); + directory_create(directory); } - static update = function() { + static step = function() { var surf = inputs[| 0].getValue(); - if(is_array(surf)) inputs[| 3].display_data = format_array; - else inputs[| 3].display_data = format_single; + if(is_array(surf)) { + inputs[| 3].display_data = format_array; + inputs[| 3].editWidget.data_list = format_array; + } else { + inputs[| 3].display_data = format_single; + inputs[| 3].editWidget.data_list = format_single; + } var anim = inputs[| 3].getValue(); - if(!anim) return; + var extn = inputs[| 9].getValue(); + + inputs[| 5].setVisible(anim == 2); + inputs[| 6].setVisible(anim == 2); + inputs[| 7].setVisible(anim == 2); + inputs[| 8].setVisible(anim == 2); + + if(anim == NODE_EXPORT_FORMAT.gif) { + inputs[| 9].display_data = format_animation; + inputs[| 9].editWidget.data_list = format_animation; + inputs[| 10].setVisible(extn == 1); + } else { + inputs[| 9].display_data = format_image; + inputs[| 9].editWidget.data_list = format_image; + inputs[| 10].setVisible(extn != 0); + } + } + + static update = function(frame = ANIMATOR.current_frame) { + var anim = inputs[| 3].getValue(); + if(anim == NODE_EXPORT_FORMAT.single) return; if(!ANIMATOR.is_playing) { playing = false; @@ -284,29 +426,44 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(ANIMATOR.current_frame < ANIMATOR.frames_total - 1) return; - - ANIMATOR.is_playing = false; - playing = false; - - if(anim != 2) + + if(anim != NODE_EXPORT_FORMAT.gif) return; + var surf = inputs[| 0].getValue(); var path = inputs[| 1].getValue(); var suff = inputs[| 2].getValue(); + var extd = inputs[| 9].getValue(); var temp_path, target_path; if(is_array(surf)) { for(var i = 0; i < array_length(surf); i++) { - temp_path = "\"" + DIRECTORY + "temp\\" + string(i) + "\\" + "*.png\""; + temp_path = directory + "\\" + string(i) + "\\" + "*.png"; if(is_array(path)) target_path = pathString(path[ safe_mod(i, array_length(path)) ], suff, i); else target_path = pathString(path, suff, i); - renderGif(temp_path, "\"" + target_path + "\""); + + if(extd == 0) { + target_path = string_replace(target_path, ".png", ".gif"); + renderGif("\"" + temp_path + "\"", "\"" + target_path + "\""); + } else if(extd == 1) { + target_path = string_replace(target_path, ".png", ".webp"); + renderWebp(temp_path, target_path); + } } } else { - target_path = "\"" + pathString(path, suff) + "\""; - renderGif("\"" + DIRECTORY + "temp\\*.png\"", target_path); + target_path = pathString(path, suff); + + if(extd == 0) { + target_path = string_replace(target_path, ".png", ".gif"); + renderGif("\"" + directory + "\\*.png\"", "\"" + target_path + "\""); + } else if(extd == 1) { + target_path = string_replace(target_path, ".png", ".webp"); + renderWebp(directory + "\\", target_path); + } } + + //directory_destroy(directory); } } \ No newline at end of file diff --git a/scripts/node_feedback_input/node_feedback_input.gml b/scripts/node_feedback_input/node_feedback_input.gml index 1d6573154..6ffffd027 100644 --- a/scripts/node_feedback_input/node_feedback_input.gml +++ b/scripts/node_feedback_input/node_feedback_input.gml @@ -21,5 +21,5 @@ function Node_Feedback_Input(_x, _y, _group = -1) : Node_Group_Input(_x, _y, _gr return outputs[| 0].getValueDefault(); } - outputs[| 1] = nodeValue(1, "Feedback loop", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); + outputs[| 1] = nodeValue("Feedback loop", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); } \ No newline at end of file diff --git a/scripts/node_feedback_output/node_feedback_output.gml b/scripts/node_feedback_output/node_feedback_output.gml index 2fae522ab..e9c12c98a 100644 --- a/scripts/node_feedback_output/node_feedback_output.gml +++ b/scripts/node_feedback_output/node_feedback_output.gml @@ -6,12 +6,12 @@ function Node_Feedback_Output(_x, _y, _group = -1) : Node_Group_Output(_x, _y, _ h = 32 + 24 * 2; min_h = h; - inputs[| 2] = nodeValue(2, "Feedback loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, -1) + inputs[| 2] = nodeValue("Feedback loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, -1) .setVisible(true, true); cache_value = -1; - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(inputs[| 0].value_from == noone) return; if(ANIMATOR.current_frame == ANIMATOR.frames_total - 1) { cache_value = noone; diff --git a/scripts/node_flip/node_flip.gml b/scripts/node_flip/node_flip.gml index 0e9d3fc9c..b3820ea3b 100644 --- a/scripts/node_flip/node_flip.gml +++ b/scripts/node_flip/node_flip.gml @@ -4,29 +4,33 @@ function Node_Flip(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru shader = sh_flip; uniform_axs = shader_get_uniform(shader, "axis"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]); - input_display_list = [ - ["Surface", false], 0, + inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 2; + + input_display_list = [ 2, + ["Surface", true], 0, ["Flip", false], 1, ] - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _axis = _data[1]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_axs, _axis); draw_surface_safe(_data[0], 0, 0); shader_reset(); - - BLEND_NORMAL + + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index 4e1c27807..232cc434e 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -1,5 +1,5 @@ function Node_Frame(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { - name = "Empty frame"; + name = "Frame"; w = 240; h = 160; bg_spr = THEME.node_frame_bg; @@ -13,10 +13,12 @@ function Node_Frame(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { auto_height = false; name_hover = false; - inputs[| 0] = nodeValue(0, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 240, 160 ] ) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 240, 160 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ) + .rejectArray(); static step = function() { var si = inputs[| 0].getValue(); @@ -31,7 +33,7 @@ function Node_Frame(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { draw_set_text(f_h5, fa_right, fa_bottom, COLORS._main_text); draw_set_alpha(name_hover? 0.5 : 0.25); - draw_text_cut(xx + (w - 8) * _s, yy + (h - 8) * _s, name, w * _s); + draw_text_cut(xx + (w - 8) * _s, yy + (h - 8) * _s, display_name, w * _s); draw_set_alpha(1); } @@ -87,15 +89,15 @@ function Node_Frame(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var xx = x * _s + _x + w * _s; var yy = y * _s + _y + h * _s; draw_set_font(f_h5); - var ww = (string_width(name) + 16) / _s; - var hh = (string_height(name) + 16) / _s; + var ww = min(w * _s, string_width(display_name) + 16); + var hh = string_height(display_name) + 16; var _x0 = xx - ww; var _y0 = yy - hh; var hover = point_in_rectangle(_mx, _my, _x0, _y0, xx, yy) && !point_in_rectangle(_mx, _my, xx - 16 * _s, yy - 16 * _s, xx, yy); name_hover = hover; - //print(string(_my) + ", " + string(_y0)); + //print(string(_my) + ": " + string(_y0) + ", " + string(yy)); return hover; } diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index 436eff581..4d87c61fe 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -1,15 +1,72 @@ -function Node_Global(_x, _y) constructor { +function variable_editor(nodeVal) constructor { + value = nodeVal; + + val_type = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text ]; + display_list = [ + /*Integer*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ], + /*Float*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ], + /*Boolean*/ [ "Default" ], + /*Color*/ [ "Default", "Gradient", "Palette" ], + /*Path*/ [ "Default", ], + /*Curve*/ [ "Default", ], + /*Text*/ [ "Default", ], + ] + + tb_name = new textArea(TEXTBOX_INPUT.text, function(str) { value.name = str; }); + + sc_type = new scrollBox([ "Integer", "Float", "Boolean", "Color", "Path", "Curve", "Text" ], function(val) { + value.type = val_type[val]; + value.resetDisplay(); + + sc_disp.data_list = display_list[val]; + } ); + + sc_disp = new scrollBox(display_list[0], function(val) { + switch(val) { + case "Default" : value.setDisplay(VALUE_DISPLAY._default); break; + case "Range" : value.setDisplay(VALUE_DISPLAY.range); break; + case "Rotation" : value.setDisplay(VALUE_DISPLAY.rotation); break; + case "Rotation range" : value.setDisplay(VALUE_DISPLAY.rotation_range); break; + case "Slider" : + value.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + break; + case "Slider range" : + value.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); + break; + case "Padding" : value.setDisplay(VALUE_DISPLAY.padding); break; + case "Vector" : value.setDisplay(VALUE_DISPLAY.vector); break; + case "Vector range" : value.setDisplay(VALUE_DISPLAY.vector_range); break; + case "Area" : value.setDisplay(VALUE_DISPLAY.area); break; + case "Gradient" : value.setDisplay(VALUE_DISPLAY.gradient); break; + case "Palette" : value.setDisplay(VALUE_DISPLAY.palette); break; + } + } ); + + static refreshInput = function() { + + } +} + +function Node_Global() constructor { name = "Global variable"; - x = _x; - y = _y; + x = 0; + y = 0; use_cache = false; inputs = ds_list_create(); outputs = ds_list_create(); + value = ds_map_create(); input_display_list = -1; - inputs[| 0] = nodeValue(0, "Default Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ); - inputs[| 0].setDisplay(VALUE_DISPLAY.vector); + inputs[| 0] = nodeValue("Default Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 32 ] ) + .setDisplay(VALUE_DISPLAY.vector); + + static step = function() { + for( var i = 0; i < ds_list_size(inputs); i++ ) { + var val = inputs[| i].getValue(); + value[? inputs[| i].name] = val; + } + } static serialize = function() { var _map = ds_map_create(); diff --git a/scripts/node_glow/node_glow.gml b/scripts/node_glow/node_glow.gml index 0ab8594d1..334e92fcc 100644 --- a/scripts/node_glow/node_glow.gml +++ b/scripts/node_glow/node_glow.gml @@ -6,19 +6,35 @@ function Node_Glow(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru uniform_size = shader_get_uniform(shader, "borderSize"); uniform_colr = shader_get_uniform(shader, "borderColor"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Border", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Border", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 4, 1]); - inputs[| 2] = nodeValue(2, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 1]); - inputs[| 3] = nodeValue(3, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 4] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + input_display_list = [ 7, + ["Surface", true], 0, 5, 6, + ["Glow", false], 1, 2, 3, 4, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + surface_blur_init(); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _border = _data[1]; @@ -30,32 +46,31 @@ function Node_Glow(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru surface_set_target(pass1); draw_clear_alpha(c_black, 1); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); shader_set_uniform_f(uniform_size, _size + _border); - shader_set_uniform_f_array(uniform_colr, [ 1., 1., 1., 1. ]); + shader_set_uniform_f_array_safe(uniform_colr, [ 1., 1., 1., 1. ]); if(is_surface(_data[0])) draw_surface_safe(_data[0], 0, 0); shader_reset(); surface_reset_target(); - pass1 = surface_apply_gaussian(pass1, _size, false, c_black, 0); - surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_lum2alpha); - shader_set_uniform_f_array(shader_get_uniform(sh_lum2alpha, "color"), colToVec4(cl)); - draw_surface_ext_safe(pass1, 0, 0, 1, 1, 0, c_white, _stre); + shader_set_uniform_f_array_safe(shader_get_uniform(sh_lum2alpha, "color"), colToVec4(cl)); + draw_surface_ext_safe(surface_apply_gaussian(pass1, _size, false, c_black, 0), 0, 0, 1, 1, 0, c_white, _stre); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; draw_surface_safe(_data[0], 0, 0); surface_reset_target(); - surface_free(pass1); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 597898b7f..a94b4798b 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -15,32 +15,32 @@ function Node_Gradient(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_radius = shader_get_uniform(shader, "radius"); uniform_radius_shf = shader_get_uniform(shader, "shift"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 2] = nodeValue(2, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]); - inputs[| 3] = nodeValue(3, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 4] = nodeValue(4, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5); + inputs[| 4] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5); - inputs[| 5] = nodeValue(5, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 5] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [-2, 2, 0.01]); - inputs[| 6] = nodeValue(6, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [def_surf_size / 2, def_surf_size / 2]) + inputs[| 6] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [def_surf_size / 2, def_surf_size / 2]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 7] = nodeValue(7, "Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 7] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 8] = nodeValue(8, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 8] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, 8, @@ -67,16 +67,10 @@ function Node_Gradient(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con var _cnt = _data[6]; var _lop = _data[7]; var _msk = _data[8]; - var _grad_color = []; - var _grad_time = []; - for(var i = 0; i < ds_list_size(_gra); i++) { - _grad_color[i * 4 + 0] = color_get_red(_gra[| i].value) / 255; - _grad_color[i * 4 + 1] = color_get_green(_gra[| i].value) / 255; - _grad_color[i * 4 + 2] = color_get_blue(_gra[| i].value) / 255; - _grad_color[i * 4 + 3] = 1; - _grad_time[i] = _gra[| i].time; - } + var _grad = gradient_to_array(_gra); + var _grad_color = _grad[0]; + var _grad_time = _grad[1]; if(_typ == 0 || _typ == 2) { inputs[| 3].setVisible(true); @@ -90,24 +84,24 @@ function Node_Gradient(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con draw_clear_alpha(0, 0); shader_set(shader); shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); - shader_set_uniform_f_array(uniform_grad, _grad_color); - shader_set_uniform_f_array(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, ds_list_size(_gra)); + shader_set_uniform_f_array_safe(uniform_grad, _grad_color); + shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); + shader_set_uniform_i(uniform_grad_key, array_length(_gra)); shader_set_uniform_i(uniform_grad_loop, _lop); - shader_set_uniform_f_array(uniform_center, [_cnt[0] / _dim[0], _cnt[1] / _dim[1]]); + shader_set_uniform_f_array_safe(uniform_center, [_cnt[0] / _dim[0], _cnt[1] / _dim[1]]); shader_set_uniform_i(uniform_type, _typ); shader_set_uniform_f(uniform_angle, degtorad(_ang)); shader_set_uniform_f(uniform_radius, _rad * sqrt(2)); shader_set_uniform_f(uniform_radius_shf, _shf); - BLEND_OVERRIDE + BLEND_OVERRIDE; if(is_surface(_msk)) draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], c_white, 1); else draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; shader_reset(); surface_reset_target(); diff --git a/scripts/node_gradient_output/node_gradient_output.gml b/scripts/node_gradient_output/node_gradient_output.gml index a4e4e3029..3a3e1397f 100644 --- a/scripts/node_gradient_output/node_gradient_output.gml +++ b/scripts/node_gradient_output/node_gradient_output.gml @@ -1,34 +1,37 @@ -function Node_Gradient_Out(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { +function Node_Gradient_Out(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Gradient"; previewable = false; w = 96; - inputs[| 0] = nodeValue(0, "Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 1] = nodeValue(1, "Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Position to sample a color from the gradient.") + inputs[| 1] = nodeValue("Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Position to sample a color from the gradient.") .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .rejectArray(); - outputs[| 0] = nodeValue(0, "Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) + outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - outputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); + outputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); _pal = -1; - static update = function() { - var pal = inputs[| 0].getValue(); - var pos = inputs[| 1].getValue(); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var pal = _data[0]; + var pos = _data[1]; - outputs[| 0].setValue(pal); - outputs[| 1].setValue(gradient_eval(pal, pos)); + if(_output_index == 0) return pal; + if(_output_index == 1) return gradient_eval(pal, pos); + return 0; } static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); if(bbox.h < 1) return; - draw_gradient(bbox.x0, bbox.y0, bbox.w, bbox.h, inputs[| 0].getValue(), inputs[| 0].extra_data[| 0]); + var grad = getSingleValue(0); + draw_gradient(bbox.x0, bbox.y0, bbox.w, bbox.h, grad, inputs[| 0].extra_data[| 0]); } } \ No newline at end of file diff --git a/scripts/node_gradient_points/node_gradient_points.gml b/scripts/node_gradient_points/node_gradient_points.gml index 1a5d919f8..a1f3f6e9c 100644 --- a/scripts/node_gradient_points/node_gradient_points.gml +++ b/scripts/node_gradient_points/node_gradient_points.gml @@ -6,35 +6,40 @@ function Node_Gradient_Points(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro uniform_cen = shader_get_uniform(shader, "center"); uniform_col = shader_get_uniform(shader, "color"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Center 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| 1] = nodeValue("Center 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 2] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); - inputs[| 3] = nodeValue(3, "Center 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) + inputs[| 3] = nodeValue("Center 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 4] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); - inputs[| 5] = nodeValue(5, "Center 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) + inputs[| 5] = nodeValue("Center 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 6] = nodeValue(6, "Color 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 6] = nodeValue("Color 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); - inputs[| 7] = nodeValue(7, "Center 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) + inputs[| 7] = nodeValue("Center 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 8] = nodeValue(8, "Color 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 8] = nodeValue("Color 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 9] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); + + inputs[| 10] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ] ) + .setDisplay(VALUE_DISPLAY.palette); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ - ["Output", true], 0, + ["Output", true], 0, ["Positions", false], 1, 3, 5, 7, - ["Colors", false], 2, 4, 6, 8, + ["Colors", false], 9, 10, 2, 4, 6, 8, ]; static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { @@ -44,11 +49,25 @@ function Node_Gradient_Points(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro if(inputs[| 7].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; } + static step = function() { + var _usePal = inputs[| 9].getValue(); + + inputs[| 10].setVisible(_usePal, _usePal); + + inputs[| 2].setVisible(!_usePal, !_usePal); + inputs[| 4].setVisible(!_usePal, !_usePal); + inputs[| 6].setVisible(!_usePal, !_usePal); + inputs[| 8].setVisible(!_usePal, !_usePal); + } + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); - + + var _usePal = _data[9]; + var _pal = _data[10]; + var _1cen = _data[1]; var _1col = _data[2]; var _2cen = _data[3]; @@ -58,12 +77,20 @@ function Node_Gradient_Points(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro var _4cen = _data[7]; var _4col = _data[8]; + var colArr = []; + + if(_usePal) { + for( var i = 0; i < 4; i++ ) + colArr = array_append(colArr, colorArrayFromReal(array_safe_get(_pal, i, c_black))); + } else + colArr = array_merge(colorArrayFromReal(_1col), colorArrayFromReal(_2col), colorArrayFromReal(_3col), colorArrayFromReal(_4col)) + surface_set_target(_outSurf); draw_clear_alpha(0, 0); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [_dim[0], _dim[1]]); - shader_set_uniform_f_array(uniform_cen, array_merge(_1cen, _2cen, _3cen, _4cen)); - shader_set_uniform_f_array(uniform_col, array_merge(colorArrayFromReal(_1col), colorArrayFromReal(_2col), colorArrayFromReal(_3col), colorArrayFromReal(_4col))); + shader_set_uniform_f_array_safe(uniform_dim, [_dim[0], _dim[1]]); + shader_set_uniform_f_array_safe(uniform_cen, array_merge(_1cen, _2cen, _3cen, _4cen)); + shader_set_uniform_f_array_safe(uniform_col, colArr); draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], c_white, 1); shader_reset(); diff --git a/scripts/node_grey_to_alpha/node_grey_to_alpha.gml b/scripts/node_grey_to_alpha/node_grey_to_alpha.gml index 0742c1f9c..8bdd48b66 100644 --- a/scripts/node_grey_to_alpha/node_grey_to_alpha.gml +++ b/scripts/node_grey_to_alpha/node_grey_to_alpha.gml @@ -5,12 +5,20 @@ function Node_Grey_Alpha(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c uniform_rep = shader_get_uniform(shader, "replace"); uniform_col = shader_get_uniform(shader, "color"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Replace color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Replace output with solid color."); - inputs[| 2] = nodeValue(2, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 1] = nodeValue("Replace color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Replace output with solid color."); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 3, + ["Surface", false], 0, 1, 2, + ] static step = function() { var _replace = inputs[| 1].getValue(); @@ -23,15 +31,15 @@ function Node_Grey_Alpha(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_rep, _replace); - shader_set_uniform_f_array(uniform_col, colToVec4(_color)); + shader_set_uniform_f_array_safe(uniform_col, colToVec4(_color)); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_greyscale/node_greyscale.gml b/scripts/node_greyscale/node_greyscale.gml index 72f9090fb..41cfcf0bf 100644 --- a/scripts/node_greyscale/node_greyscale.gml +++ b/scripts/node_greyscale/node_greyscale.gml @@ -5,22 +5,35 @@ function Node_Greyscale(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_exp = shader_get_uniform(shader, "brightness"); uniform_con = shader_get_uniform(shader, "contrast"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ -1, 4, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + input_display_list = [ 5, + ["Surface", true], 0, 3, 4, + ["Greyscale", false], 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _exp = _data[1]; var _con = _data[2]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_exp, _exp); @@ -28,9 +41,11 @@ function Node_Greyscale(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_grid/node_grid.gml b/scripts/node_grid/node_grid.gml index 68e75f290..32b877303 100644 --- a/scripts/node_grid/node_grid.gml +++ b/scripts/node_grid/node_grid.gml @@ -15,34 +15,34 @@ function Node_Grid(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru uniform_col2 = shader_get_uniform(shader, "col2"); uniform_sam = shader_get_uniform(shader, "useSampler"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) + inputs[| 2] = nodeValue("Tiling", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 3] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 0.5, 0.01]); - inputs[| 4] = nodeValue(4, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 5] = nodeValue(5, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 6] = nodeValue(6, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 5] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 6] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 7] = nodeValue(7, "Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 7] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 8] = nodeValue(8, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 8] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [-0.5, 0.5, 0.01]); - inputs[| 9] = nodeValue(9, "Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 9] = nodeValue("Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, ["X", "Y"]); - inputs[| 10] = nodeValue(10, "Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 10] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); input_display_list = [ ["Output", false], 0, @@ -50,7 +50,7 @@ function Node_Grid(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru ["Render", false], 5, 6, 7, 10 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -77,15 +77,15 @@ function Node_Grid(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru shader_set(shader); shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f(uniform_dim, _dim[0], _dim[1]); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_f(uniform_wid, _wid); shader_set_uniform_f(uniform_ang, degtorad(_ang)); shader_set_uniform_f(uniform_sam, is_surface(_sam)); shader_set_uniform_f(uniform_shf, _shf); shader_set_uniform_i(uniform_shx, _shx); shader_set_uniform_i(uniform_hgt, _hgt); - shader_set_uniform_f_array(uniform_col1, colToVec4(_col1)); - shader_set_uniform_f_array(uniform_col2, colToVec4(_col2)); + shader_set_uniform_f_array_safe(uniform_col1, colToVec4(_col1)); + shader_set_uniform_f_array_safe(uniform_col2, colToVec4(_col2)); if(is_surface(_sam)) draw_surface_stretched(_sam, 0, 0, _dim[0], _dim[1]); diff --git a/scripts/node_grid_hex/node_grid_hex.gml b/scripts/node_grid_hex/node_grid_hex.gml index c66475467..fe47ec184 100644 --- a/scripts/node_grid_hex/node_grid_hex.gml +++ b/scripts/node_grid_hex/node_grid_hex.gml @@ -11,25 +11,25 @@ function Node_Grid_Hex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_clr0 = shader_get_uniform(shader, "color0"); uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 4] = nodeValue(4, "Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 4] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 5] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 6] = nodeValue(6, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 6] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); input_display_list = [ ["Output", false], 0, @@ -37,7 +37,7 @@ function Node_Grid_Hex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con ["Render", false], 5, 6, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -64,8 +64,8 @@ function Node_Grid_Hex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con shader_set_uniform_f(uniform_rot, degtorad(_rot)); shader_set_uniform_f(uniform_thk, _thk); - shader_set_uniform_f_array(uniform_clr0, colToVec4(_clr0)); - shader_set_uniform_f_array(uniform_clr1, colToVec4(_clr1)); + shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); + shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); diff --git a/scripts/node_grid_tri/node_grid_tri.gml b/scripts/node_grid_tri/node_grid_tri.gml index bfa7d01d5..7352a1f8c 100644 --- a/scripts/node_grid_tri/node_grid_tri.gml +++ b/scripts/node_grid_tri/node_grid_tri.gml @@ -11,25 +11,25 @@ function Node_Grid_Tri(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con uniform_clr0 = shader_get_uniform(shader, "color0"); uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 4] = nodeValue(4, "Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 4] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 5] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 6] = nodeValue(6, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 6] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); input_display_list = [ ["Output", false], 0, @@ -37,7 +37,7 @@ function Node_Grid_Tri(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con ["Render", false], 5, 6, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -64,8 +64,8 @@ function Node_Grid_Tri(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con shader_set_uniform_f(uniform_rot, degtorad(_rot)); shader_set_uniform_f(uniform_thk, _thk); - shader_set_uniform_f_array(uniform_clr0, colToVec4(_clr0)); - shader_set_uniform_f_array(uniform_clr1, colToVec4(_clr1)); + shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); + shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index a4286f2be..b1e86a80f 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -1,5 +1,6 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Input"; + destroy_when_upgroup = true; color = COLORS.node_blend_collection; previewable = false; auto_height = false; @@ -26,40 +27,47 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo /*Any*/ [ "Default", ], ] - inputs[| 0] = nodeValue(0, "Display type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, display_list[0]); + inputs[| 0] = nodeValue("Display type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, display_list[0]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 1]) + inputs[| 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 1]) .setDisplay(VALUE_DISPLAY.vector) - .setVisible(false); + .setVisible(false) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Input type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Integer", "Float", "Boolean", "Color", "Surface", "Path", "Curve", "Text", "Object", "Node", "3D object", "Any" ]); + inputs[| 2] = nodeValue("Input type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Integer", "Float", "Boolean", "Color", "Surface", "Path", "Curve", "Text", "Object", "Node", "3D object", "Any" ]) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Enum label", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") - .setVisible(false); + inputs[| 3] = nodeValue("Enum label", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + .setVisible(false) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Vector size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Vector size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "2", "3", "4" ]) - .setVisible(false); + .setVisible(false) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 5] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Display gizmo", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 6] = nodeValue("Display gizmo", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); input_display_list = [ ["Display", false], 5, 6, ["Data", false], 2, 0, 4, 1, 3, ]; - outputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { if(inParent.isArray()) return; inParent.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(is_undefined(inParent)) return; var _dtype = inputs[| 0].getValue(); @@ -76,6 +84,7 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo _to.removeFrom(); } + inputs[| 0].display_data = display_list[_val_type]; inputs[| 0].editWidget.data_list = display_list[_val_type]; inputs[| 0].setValue(0); _dtype = 0; @@ -88,7 +97,7 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo var _val = inParent.getValue(); switch(_dtype) { - case "Range" : inParent.setDisplay(VALUE_DISPLAY.range, [_range[0], _range[1], 0.01]); break; + case "Range" : inParent.setDisplay(VALUE_DISPLAY.range); break; case "Slider" : inParent.setDisplay(VALUE_DISPLAY.slider, [_range[0], _range[1], 0.01]); break; case "Slider range" : inParent.setDisplay(VALUE_DISPLAY.slider_range, [_range[0], _range[1], 0.01]); break; @@ -141,7 +150,10 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo inParent.setDisplay(VALUE_DISPLAY.palette); break; - case "Gradient": inParent.setDisplay(VALUE_DISPLAY.gradient); break; + case "Gradient": + inParent.animator = new valueAnimator([ new gradientKey(0, c_white) ], inParent); + inParent.setDisplay(VALUE_DISPLAY.gradient); + break; default: inParent.setDisplay(VALUE_DISPLAY._default); break; } @@ -158,8 +170,11 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo } else { input_fix_len = inputs[| 5].getValue(); } - - inParent = nodeValue(ds_list_size(group.inputs), "Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) + + if(!is_undefined(inParent)) + ds_list_remove(group.inputs, inParent); + + inParent = nodeValue("Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) .setVisible(true, true); inParent.from = self; @@ -181,10 +196,10 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo static step = function() { if(is_undefined(inParent)) return; - inParent.name = name; + inParent.name = display_name; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(is_undefined(inParent)) return; var _dtype = inputs[| 0].getValue(); @@ -214,8 +229,10 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo static postDeserialize = function() { createInput(false); + var _inputs = load_map[? "inputs"]; inputs[| 5].applyDeserialize(_inputs[| 5], load_scale); + group.sortIO(); inputs[| 2].applyDeserialize(_inputs[| 2], load_scale); onValueUpdate(2); @@ -259,7 +276,17 @@ function Node_Group_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructo static onDestroy = function() { if(is_undefined(inParent)) return; - ds_list_remove(group.inputs, inParent); } + + static ungroup = function() { + var fr = inParent.value_from; + + for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { + var to = outputs[| 0].value_to[| i]; + if(to.value_from != outputs[| 0]) continue; + + to.setFrom(fr); + } + } } \ No newline at end of file diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index a06bab27c..6e7897163 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -1,5 +1,6 @@ function Node_Group_Output(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Output"; + destroy_when_upgroup = true; color = COLORS.node_blend_collection; previewable = false; auto_height = false; @@ -8,15 +9,16 @@ function Node_Group_Output(_x, _y, _group = -1) : Node(_x, _y, _group) construct h = 32 + 24; min_h = h; - inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) + inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 1] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .rejectArray(); outParent = undefined; output_index = -1; - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(is_undefined(outParent)) return; group.sortIO(); @@ -59,7 +61,10 @@ function Node_Group_Output(_x, _y, _group = -1) : Node(_x, _y, _group) construct output_index = inputs[| 1].getValue(); } - outParent = nodeValue(ds_list_size(group.outputs), "Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.any, -1) + if(!is_undefined(outParent)) + ds_list_remove(group.outputs, outParent); + + outParent = nodeValue("Value", group, JUNCTION_CONNECT.output, VALUE_TYPE.any, -1) .setVisible(true, true); outParent.from = self; @@ -77,7 +82,7 @@ function Node_Group_Output(_x, _y, _group = -1) : Node(_x, _y, _group) construct static step = function() { if(is_undefined(outParent)) return; - outParent.name = name; + outParent.name = display_name; inputs[| 0].type = VALUE_TYPE.any; if(inputs[| 0].value_from != noone) { @@ -100,10 +105,25 @@ function Node_Group_Output(_x, _y, _group = -1) : Node(_x, _y, _group) construct static postDeserialize = function() { createOutput(false); + + var _inputs = load_map[? "inputs"]; + inputs[| 1].applyDeserialize(_inputs[| 1], load_scale); + group.sortIO(); } static onDestroy = function() { if(is_undefined(outParent)) return; ds_list_delete(group.outputs, ds_list_find_index(group.outputs, outParent)); } + + static ungroup = function() { + var fr = inputs[| 0].value_from; + + for( var i = 0; i < ds_list_size(outParent.value_to); i++ ) { + var to = outParent.value_to[| i]; + if(to.value_from != outParent) continue; + + to.setFrom(fr); + } + } } \ No newline at end of file diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index b897e2bfb..a8c78771e 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -25,14 +25,15 @@ function Node_Image(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { color = COLORS.node_blend_input; always_output = true; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, ["*.png", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, ["*.png", ""]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) .setDisplay(VALUE_DISPLAY.padding); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); spr = noone; @@ -53,7 +54,7 @@ function Node_Image(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); switch(ext) { @@ -76,14 +77,14 @@ function Node_Image(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { return false; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); update(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); var pad = inputs[| 1].getValue(); if(path == "") return; @@ -100,9 +101,9 @@ function Node_Image(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { surface_set_target(_outsurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite(spr, 0, pad[2], pad[1]); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); if(!first_update) return; @@ -122,7 +123,8 @@ function Node_Image(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { _splice.inputs[| 0].setFrom(outputs[| 0], false); _splice.inputs[| 1].setValue([ww, hh]); _splice.inputs[| 2].setValue(amo); - _splice.inputs[| 3].setValue(amo); + _splice.inputs[| 3].setValue([ amo, 1 ]); + _splice.inspectorUpdate(); ds_list_add(PANEL_GRAPH.nodes_select_list, self); ds_list_add(PANEL_GRAPH.nodes_select_list, _splice); diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index 2e816448d..9d5a7f113 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -39,25 +39,30 @@ function Node_Image_Animated(_x, _y, _group = -1) : Node(_x, _y, _group) constru update_on_frame = true; always_output = true; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) .setDisplay(VALUE_DISPLAY.path_array, ["*.png", ""]); - inputs[| 1] = nodeValue(1, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) - .setDisplay(VALUE_DISPLAY.padding); + inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + .setDisplay(VALUE_DISPLAY.padding) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Stretch frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 2] = nodeValue("Stretch frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Frame duration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); - inputs[| 4] = nodeValue(4, "Animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Loop", "Ping pong", "Hold last frame", "Hide"]); + inputs[| 3] = nodeValue("Frame duration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Loop", "Ping pong", "Hold last frame", "Hide"]) + .rejectArray(); + + inputs[| 5] = nodeValue("Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { if(array_length(spr) == 0) return; ANIMATOR.frames_total = array_length(spr); }, "Match length"] ); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Image", false], 0, 1, @@ -108,14 +113,14 @@ function Node_Image_Animated(_x, _y, _group = -1) : Node(_x, _y, _group) constru return true; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); update(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(is_array(path) && !array_equals(path, path_loaded)) @@ -140,36 +145,36 @@ function Node_Image_Animated(_x, _y, _group = -1) : Node(_x, _y, _group) constru surfs = surface_verify(surfs, ww, hh); outputs[| 0].setValue(surfs); - var frame = floor(ANIMATOR.current_frame / spd); + var _frame = floor(ANIMATOR.current_frame / spd); switch(_end) { case ANIMATION_END.loop : - frame = safe_mod(frame, array_length(spr)); + _frame = safe_mod(_frame, array_length(spr)); break; case ANIMATION_END.ping : - frame = safe_mod(frame, array_length(spr) * 2 - 2); - if(frame >= array_length(spr)) - frame = array_length(spr) * 2 - 2 - frame; + _frame = safe_mod(_frame, array_length(spr) * 2 - 2); + if(_frame >= array_length(spr)) + _frame = array_length(spr) * 2 - 2 - _frame; break; case ANIMATION_END.hold : - frame = min(frame, array_length(spr) - 1); + _frame = min(_frame, array_length(spr) - 1); break; } - var curr_w = sprite_get_width(spr[frame]); - var curr_h = sprite_get_height(spr[frame]); + var curr_w = sprite_get_width(spr[_frame]); + var curr_h = sprite_get_height(spr[_frame]); var curr_x = pad[2] + (ww - curr_w) / 2; var curr_y = pad[1] + (hh - curr_h) / 2; surface_set_target(surfs); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; if(_end == ANIMATION_END.hide) { - if(frame < array_length(spr)) - draw_sprite(spr[frame], 0, curr_x, curr_y); + if(_frame < array_length(spr)) + draw_sprite(spr[_frame], 0, curr_x, curr_y); } else - draw_sprite(spr[frame], 0, curr_x, curr_y); - BLEND_NORMAL + draw_sprite(spr[_frame], 0, curr_x, curr_y); + BLEND_NORMAL; surface_reset_target(); } } \ No newline at end of file diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 7a9884c0f..e241fca15 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -30,10 +30,10 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor update_on_frame = true; always_output = true; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_load, ["*.gif", ""]); - inputs[| 1] = nodeValue(1, "Set animation length to gif", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Set animation length to gif", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { if(!spr) return; if(!sprite_exists(spr)) return; @@ -41,8 +41,8 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor ANIMATOR.framerate = 12; }, "Match length"] ); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); spr = noone; @@ -59,7 +59,7 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor return false; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -70,7 +70,7 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); switch(ext) { @@ -107,7 +107,7 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); @@ -123,9 +123,9 @@ function Node_Image_gif(_x, _y, _group = -1) : Node(_x, _y, _group) constructor surface_set_target(_outsurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite(spr, ANIMATOR.current_frame, 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index bc5576342..b106fc92a 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -6,11 +6,9 @@ function Node_create_Image_Sequence(_x, _y, _group = -1) { } var node = new Node_Image_Sequence(_x, _y, _group); - var paths = paths_to_array(path); + var paths = string_splice(path, "\n"); node.inputs[| 0].setValue(paths); node.doUpdate(); - - //ds_list_add(PANEL_GRAPH.nodes_list, node); return node; } @@ -18,8 +16,6 @@ function Node_create_Image_Sequence_path(_x, _y, _path) { var node = new Node_Image_Sequence(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(_path); node.doUpdate(); - - //ds_list_add(PANEL_GRAPH.nodes_list, node); return node; } @@ -40,31 +36,33 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru color = COLORS.node_blend_input; always_output = true; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) .setDisplay(VALUE_DISPLAY.path_array, ["*.png", ""]); - inputs[| 1] = nodeValue(1, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) - .setDisplay(VALUE_DISPLAY.padding); + inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + .setDisplay(VALUE_DISPLAY.padding) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Canvas size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Individual", "Minimum", "Maximum" ]); + inputs[| 2] = nodeValue("Canvas size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Individual", "Minimum", "Maximum" ]) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Sizing method", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Padding / Crop", "Scale" ]); + inputs[| 3] = nodeValue("Sizing method", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Padding / Crop", "Scale" ]) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Edit", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Edit", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { - with(dialogCall(o_dialog_image_array_edit, WIN_W / 2, WIN_H / 2)) { + with(dialogCall(o_dialog_image_array_edit, WIN_W / 2, WIN_H / 2)) target = other; - } }, "Edit array" ]); input_display_list = [ ["Sequence settings", false], 4, 0, 1, 2, 3 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [ PIXEL_SURFACE ]); - outputs[| 1] = nodeValue(1, "Paths", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, [] ). + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []); + outputs[| 1] = nodeValue("Paths", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, [] ). setVisible(true, true); path_loaded = []; @@ -87,7 +85,7 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru return false; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -95,6 +93,7 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru } function updatePaths(paths) { + print(paths); for(var i = 0; i < array_length(spr); i++) { if(spr[i] && sprite_exists(spr[i])) sprite_delete(spr[i]); @@ -117,9 +116,10 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru return true; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; + if(!is_array(path)) path = [ path ]; if(!array_equals(path, path_loaded)) updatePaths(path); @@ -169,9 +169,9 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru surfs[i] = surface_verify(array_safe_get(surfs, i), ww, hh); surface_set_target(surfs[i]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite(_spr, 0, pad[2], pad[1]); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); break; case CANVAS_SIZE.maximum : @@ -187,9 +187,9 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru surface_set_target(surfs[i]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite_ext(_spr, 0, sw, sh, ss, ss, 0, c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } else { var xx = (ww - _w) / 2; @@ -197,9 +197,9 @@ function Node_Image_Sequence(_x, _y, _group = -1) : Node(_x, _y, _group) constru surface_set_target(surfs[i]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite(_spr, 0, xx, yy); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } break; diff --git a/scripts/node_image_sheet/node_image_sheet.gml b/scripts/node_image_sheet/node_image_sheet.gml index ffcb8d058..147140f06 100644 --- a/scripts/node_image_sheet/node_image_sheet.gml +++ b/scripts/node_image_sheet/node_image_sheet.gml @@ -3,33 +3,33 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo surf_array = []; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).rejectArray(); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Sprite size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 32 ]) + inputs[| 1] = nodeValue("Sprite size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 32 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Row", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); //unused - inputs[| 3] = nodeValue(3, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 1, 1 ]) + inputs[| 2] = nodeValue("Row", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); //unused + inputs[| 3] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Offset", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ]) + inputs[| 4] = nodeValue("Offset", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ]) + inputs[| 5] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 6] = nodeValue(6, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + inputs[| 6] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) .setDisplay(VALUE_DISPLAY.padding); - inputs[| 7] = nodeValue(7, "Output", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 7] = nodeValue("Output", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Animation", "Array"]); - inputs[| 8] = nodeValue(8, "Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 8] = nodeValue("Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 9] = nodeValue(9, "Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 9] = nodeValue("Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical"]); - inputs[| 10] = nodeValue(10, "Auto fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 10] = nodeValue("Auto fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { var _sur = inputs[| 0].getValue(); if(!is_surface(_sur) || _sur == DEF_SURFACE) return; @@ -55,13 +55,13 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo inspectorUpdate(); }, "Auto fill"] ); - inputs[| 11] = nodeValue(11, "Sync animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 11] = nodeValue("Sync animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { var _amo = inputs[| 3].getValue(); ANIMATOR.frames_total = max(1, _amo[0] * _amo[1]); }, "Sync frames"] ); - inputs[| 12] = nodeValue(12, "Filter empty output", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 12] = nodeValue("Filter empty output", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); input_display_list = [ ["Sprite", false], 0, 1, 6, 10, @@ -69,7 +69,7 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo ["Output", false], 7, 8, 12, 11 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); drag_type = 0; drag_sx = 0; @@ -111,13 +111,14 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo var _out = inputs[| 7].getValue(); var _spc = inputs[| 5].getValue(); + if(drag_type == 0) { curr_dim = inputs[| 1].getValue(); curr_amo = inputs[| 3].getValue(); curr_off = inputs[| 4].getValue(); } - var _amo = curr_amo[0] * curr_amo[1]; + var _amo = array_safe_get(curr_amo, 0) * array_safe_get(curr_amo, 1); for(var i = _amo - 1; i >= 0; i--) { if(!array_safe_get(sprite_valid, i, true)) @@ -198,7 +199,7 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo var dim = [_dx, _dy]; curr_dim = dim; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { dim[0] = max(_dx, _dy); dim[1] = max(_dx, _dy); } @@ -253,10 +254,9 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo var _out = inputs[| 7].getValue(); inputs[| 11].setVisible(!_out); inputs[| 8].setVisible(!_out); - inputs[| 12].setVisible( _out); } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var _inSurf = inputs[| 0].getValue(); if(!is_surface(_inSurf)) return; @@ -279,7 +279,7 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo curr_off = _off; var filSize = 4; - var _empS = surface_create(filSize, filSize); + var _empS = surface_create_valid(filSize, filSize); var _buff = buffer_create(filSize * filSize * 4, buffer_fixed, 2); surf_array = []; @@ -294,18 +294,18 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo surface_set_target(_s); draw_clear_alpha(c_black, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_part(_inSurf, _spr_pos[0], _spr_pos[1], _dim[0], _dim[1], _pad[2], _pad[1]); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); if(_filt) { gpu_set_tex_filter(true); surface_set_target(_empS); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_stretched(_s, 0, 0, filSize, filSize); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); gpu_set_tex_filter(false); @@ -336,7 +336,7 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo surface_free(_empS); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _out = inputs[| 7].getValue(); if(_out == 1) { outputs[| 0].setValue(surf_array); @@ -346,7 +346,10 @@ function Node_Image_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) constructo var _spd = inputs[| 8].getValue(); update_on_frame = true; - var ind = safe_mod(ANIMATOR.current_frame * _spd, array_length(surf_array)); - outputs[| 0].setValue(surf_array[ind]); + + if(array_length(surf_array)) { + var ind = safe_mod(ANIMATOR.current_frame * _spd, array_length(surf_array)); + outputs[| 0].setValue(surf_array[ind]); + } } } \ No newline at end of file diff --git a/scripts/node_invert/node_invert.gml b/scripts/node_invert/node_invert.gml index 620e1dd4c..8264591df 100644 --- a/scripts/node_invert/node_invert.gml +++ b/scripts/node_invert/node_invert.gml @@ -1,22 +1,36 @@ function Node_Invert(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Invert"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static process_data = function(_outSurf, _data, _output_index, _array_index) { + inputs[| 2] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + input_display_list = [ 3, + ["Surface", true], 0, 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_invert); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_iterate/node_iterate.gml b/scripts/node_iterate/node_iterate.gml index b5822ad1a..c3574b2ed 100644 --- a/scripts/node_iterate/node_iterate.gml +++ b/scripts/node_iterate/node_iterate.gml @@ -11,7 +11,7 @@ function Node_Iterate(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) con iterated = 0; - inputs[| 0] = nodeValue( 0, "Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ); + inputs[| 0] = nodeValue("Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ); custom_input_index = ds_list_size(inputs); loop_start_time = 0; @@ -35,7 +35,7 @@ function Node_Iterate(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) con n.initLoop(); } - printIf(global.RENDER_LOG, "LOOP INIT"); + printIf(global.RENDER_LOG, " > Loop begin"); } static getNextNodes = function() { @@ -53,6 +53,8 @@ function Node_Iterate(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) con static iterationStatus = function() { var iter = true; + var maxIter = inputs[| 0].getValue(); + if(!is_real(maxIter)) maxIter = 1; for( var i = 0; i < ds_list_size(outputs); i++ ) { var _out = outputs[| i].from; iter &= _out.rendered; @@ -61,10 +63,10 @@ function Node_Iterate(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) con if(iter) { iterated++; - if(iterated == inputs[| 0].getValue()) { + if(iterated == maxIter) { render_time = get_timer() - loop_start_time; return ITERATION_STATUS.complete; - } else if(iterated > inputs[| 0].getValue()) + } else if(iterated > maxIter) return ITERATION_STATUS.complete; resetAllRenderStatus(); diff --git a/scripts/node_iterator_index/node_iterator_index.gml b/scripts/node_iterator_index/node_iterator_index.gml index 59dae487c..a4f7ce695 100644 --- a/scripts/node_iterator_index/node_iterator_index.gml +++ b/scripts/node_iterator_index/node_iterator_index.gml @@ -1,14 +1,15 @@ function Node_Iterator_Index(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Index"; + destroy_when_upgroup = true; color = COLORS.node_blend_loop; previewable = false; w = 96; min_h = 80; - outputs[| 0] = nodeValue(0, "Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); + outputs[| 0] = nodeValue("Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(!variable_struct_exists(group, "iterated")) return; outputs[| 0].setValue(group.iterated); } diff --git a/scripts/node_iterator_input/node_iterator_input.gml b/scripts/node_iterator_input/node_iterator_input.gml index 36a46a00a..bc24301c8 100644 --- a/scripts/node_iterator_input/node_iterator_input.gml +++ b/scripts/node_iterator_input/node_iterator_input.gml @@ -8,6 +8,8 @@ function Node_Iterator_Input(_x, _y, _group = -1) : Node_Group_Input(_x, _y, _gr h = 32 + 24 * 2; min_h = h; + cache_value = -1; + outputs[| 0].getValueDefault = method(outputs[| 0], outputs[| 0].getValueRecursive); //Get value from outside loop outputs[| 0].getValueRecursive = function() { //show_debug_message("iteration " + string(group.iterated)); @@ -27,5 +29,5 @@ function Node_Iterator_Input(_x, _y, _group = -1) : Node_Group_Input(_x, _y, _gr return [ _node_output.node.cache_value, inParent ]; } - outputs[| 1] = nodeValue(1, "Loop entrance", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); + outputs[| 1] = nodeValue("Loop entrance", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); } \ No newline at end of file diff --git a/scripts/node_iterator_output/node_iterator_output.gml b/scripts/node_iterator_output/node_iterator_output.gml index 601d7a394..a91fba4af 100644 --- a/scripts/node_iterator_output/node_iterator_output.gml +++ b/scripts/node_iterator_output/node_iterator_output.gml @@ -6,20 +6,42 @@ function Node_Iterator_Output(_x, _y, _group = -1) : Node_Group_Output(_x, _y, _ h = 32 + 24 * 2; min_h = h; - inputs[| 2] = nodeValue(2, "Loop exit", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, -1) + inputs[| 0].setFrom_condition = function(_valueFrom) { + if(instanceof(_valueFrom.node) != "Node_Iterator_Input") return true; + if(inputs[| 2].value_from == noone) return true; + if(inputs[| 2].value_from.node == _valueFrom.node) { + noti_warning("setFrom: Immediate cycle disallowed",, self); + return false; + } + return true; + } + + inputs[| 2] = nodeValue("Loop exit", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, -1) .setVisible(true, true); + inputs[| 2].setFrom_condition = function(_valueFrom) { + if(instanceof(_valueFrom.node) != "Node_Iterator_Input") return true; + if(inputs[| 0].value_from == noone) return true; + if(inputs[| 0].value_from.node == _valueFrom.node) { + noti_warning("setFrom: Immediate cycle disallowed",, self); + return false; + } + return true; + } + cache_value = -1; static getNextNodes = function() { var _node_it = group; + if(!struct_has(_node_it, "iterationStatus")) return; var _ren = _node_it.iterationStatus(); if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? printIf(global.RENDER_LOG, " > Loop restart: iteration " + string(group.iterated)); __nodeLeafList(group.nodes, RENDER_QUEUE); - var loopEnt = inputs[| 2].value_from.node; - ds_queue_enqueue(RENDER_QUEUE, loopEnt); + + //var loopEnt = inputs[| 2].value_from.node; + //ds_queue_enqueue(RENDER_QUEUE, loopEnt); } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop printIf(global.RENDER_LOG, " > Loop completed"); group.setRenderStatus(true); @@ -40,38 +62,47 @@ function Node_Iterator_Output(_x, _y, _group = -1) : Node_Group_Output(_x, _y, _ cache_value = noone; } - static update = function() { - if(inputs[| 0].value_from == noone) return; + static cloneValue = function(_prev_val, _val) { + if(inputs[| 0].value_from == noone) return _prev_val; - var _val_get = inputs[| 0].getValue(); var _arr = inputs[| 0].value_from.isArray(); - var is_surf = inputs[| 0].type == VALUE_TYPE.surface; + var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface; - if(is_array(cache_value)) { - for( var i = 0; i < array_length(cache_value); i++ ) { - if(is_surface(cache_value[i])) - surface_free(cache_value[i]); + if(is_array(_prev_val)) { + for( var i = 0; i < array_length(_prev_val); i++ ) { + if(is_surf && is_surface(_prev_val[i])) + surface_free(_prev_val[i]); } - } else if(is_surface(cache_value)) - surface_free(cache_value); + } else if(is_surf && is_surface(_prev_val)) + surface_free(_prev_val); + var _new_val = 0; if(_arr) { - var amo = array_length(_val_get); - cache_value = array_create(amo); + var amo = array_length(_val); + _new_val = array_create(amo); if(is_surf) { for( var i = 0; i < amo; i++ ) { - if(is_surface(_val_get[i])) - cache_value[i] = surface_clone(_val_get[i]); + if(is_surface(_val[i])) + _new_val[i] = surface_clone(_val[i]); } } else - cache_value = _val_get; + _new_val = _val; } else { if(is_surf) { - if(is_surface(_val_get)) - cache_value = surface_clone(_val_get); + if(is_surface(_val)) + _new_val = surface_clone(_val); } else - cache_value = _val_get; + _new_val = _val; } + + return _new_val; + } + + static update = function(frame = ANIMATOR.current_frame) { + if(inputs[| 0].value_from == noone) return; + + var _val = inputs[| 0].getValue(); + cache_value = cloneValue(cache_value, _val); } } \ No newline at end of file diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index 0c427f886..63a5217f5 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -30,10 +30,11 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru w = 128; - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, ["*.json", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, ["*.json", ""]) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") + outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); data_length = 1; @@ -41,10 +42,10 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + inputs[| index] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) .setVisible(true, true); - outputs[| index] = nodeValue( index, "Values", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) + outputs[| index] = nodeValue("Values", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0 ) .setVisible(true, true); } if(!LOADING && !APPENDING) createNewInput(); @@ -63,7 +64,7 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru return false; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -98,7 +99,7 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru createNewInput(); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index < input_fix_len) return; if(LOADING || APPENDING) return; @@ -109,7 +110,7 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); if(ext != ".json") return false; @@ -125,7 +126,7 @@ function Node_Json_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru return true; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index 559ab96e9..ed78789c7 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -5,16 +5,16 @@ function Node_Json_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr w = 128; - - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_save, ["*.json", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_save, ["*.json", ""]) + .rejectArray(); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue( index + 0, "Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| index + 0] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - inputs[| index + 1] = nodeValue( index + 1, "value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) - .setVisible(false, true); + inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) + .setVisible(false, false); array_push(input_display_list, index + 0); array_push(input_display_list, index + 1); @@ -41,7 +41,7 @@ function Node_Json_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { if(inputs[| i].getValue() != "") { ds_list_add(_in, inputs[| i + 0]); - ds_list_add(_in, inputs[| i + 1]); + ds_list_add(_in, inputs[| i + 1].setVisible(false, true)); array_push(input_display_list, i + 0); array_push(input_display_list, i + 1); @@ -60,7 +60,7 @@ function Node_Json_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr createNewInput(); } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index < input_fix_len) return; if(LOADING || APPENDING) return; @@ -71,7 +71,7 @@ function Node_Json_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr refreshDynamicInput(); } - static update = function() { + static writeFile = function() { var path = inputs[| 0].getValue(); if(path == "") return; if(filename_ext(path) != ".json") @@ -90,6 +90,9 @@ function Node_Json_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr json_save_struct(path, cont); } + static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static onInspectorUpdate = function() { writeFile(); } + function onDrawNode(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); diff --git a/scripts/node_lerp/node_lerp.gml b/scripts/node_lerp/node_lerp.gml index ac46266d5..533498896 100644 --- a/scripts/node_lerp/node_lerp.gml +++ b/scripts/node_lerp/node_lerp.gml @@ -5,14 +5,14 @@ function Node_Lerp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru w = 96; - inputs[| 0] = nodeValue(1, "a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 1] = nodeValue(2, "b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 2] = nodeValue(3, "Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 1] = nodeValue("b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 2] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]); - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { return lerp(_data[0], _data[1], _data[2]); } diff --git a/scripts/node_level/node_level.gml b/scripts/node_level/node_level.gml index 523dea5c7..c6432a736 100644 --- a/scripts/node_level/node_level.gml +++ b/scripts/node_level/node_level.gml @@ -13,24 +13,32 @@ function Node_Level(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_amin = shader_get_uniform(shader, "amin"); uniform_amax = shader_get_uniform(shader, "amax"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "White", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 1] = nodeValue("White", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.slider_range, [ 0, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 2] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.slider_range, [ 0, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 3] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.slider_range, [ 0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 4] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.slider_range, [ 0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.slider_range, [ 0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); level_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var _h = 128; @@ -65,9 +73,10 @@ function Node_Level(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr return _h; }); - input_display_list = [ + input_display_list = [ 8, level_renderer, - ["Level", false], 0, 1, + ["Surface", true], 0, 6, 7, + ["Level", false], 1, ["Channel", true], 2, 3, 4, 5 ]; histogramInit(); @@ -85,7 +94,7 @@ function Node_Level(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr } } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _wmin = min(_data[1][0], _data[1][1]); var _wmax = max(_data[1][0], _data[1][1]); var _rmin = min(_data[2][0], _data[2][1]); @@ -99,7 +108,7 @@ function Node_Level(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_wmin, _wmin); @@ -116,9 +125,11 @@ function Node_Level(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); + return _outSurf; } } diff --git a/scripts/node_level_selector/node_level_selector.gml b/scripts/node_level_selector/node_level_selector.gml index 4a9f84e20..925899e3e 100644 --- a/scripts/node_level_selector/node_level_selector.gml +++ b/scripts/node_level_selector/node_level_selector.gml @@ -5,15 +5,23 @@ function Node_Level_Selector(_x, _y, _group = -1) : Node_Processor(_x, _y, _grou uniform_middle = shader_get_uniform(shader, "middle"); uniform_range = shader_get_uniform(shader, "range"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Mid point", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("Mid point", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 2] = nodeValue(2, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 2] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); level_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { var _h = 128; @@ -50,9 +58,10 @@ function Node_Level_Selector(_x, _y, _group = -1) : Node_Processor(_x, _y, _grou return _h; }); - input_display_list = [ + input_display_list = [ 5, level_renderer, - ["Level", false], 0, 1, 2, + ["Surface", true], 0, 3, 4, + ["Level", false], 1, 2, ]; histogramInit(); @@ -69,13 +78,13 @@ function Node_Level_Selector(_x, _y, _group = -1) : Node_Processor(_x, _y, _grou } } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _middle = _data[1]; var _range = _data[2]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_middle, _middle); @@ -84,9 +93,11 @@ function Node_Level_Selector(_x, _y, _group = -1) : Node_Processor(_x, _y, _grou draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index 7e4018fcd..ab92514f4 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -1,40 +1,40 @@ function Node_Line(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Line"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Backgroud", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 1] = nodeValue("Backgroud", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 2] = nodeValue(2, "Segment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 2] = nodeValue("Segment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 3] = nodeValue(3, "Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ]) + inputs[| 3] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 4] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 0.01]); - inputs[| 5] = nodeValue(5, "Random seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 5] = nodeValue("Random seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 6] = nodeValue(6, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 6] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 7] = nodeValue(7, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, 0, "Draw line along path.") + inputs[| 7] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, 0, "Draw line along path.") .setVisible(true, true); - inputs[| 8] = nodeValue(8, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1], "Range of the path to draw.") + inputs[| 8] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1], "Range of the path to draw.") .setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); - inputs[| 9] = nodeValue(9, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 9] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY._default, 1 / 64); - inputs[| 10] = nodeValue(10, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 10] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 11] = nodeValue(11, "Width over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); + inputs[| 11] = nodeValue("Width over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); - inputs[| 12] = nodeValue(12, "Span width over path", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Apply the full 'width over length' to the trimmed path."); + inputs[| 12] = nodeValue("Span width over path", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Apply the full 'width over length' to the trimmed path."); input_display_list = [ ["Output", true], 0, 1, @@ -44,7 +44,7 @@ function Node_Line(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru ["Render", false], 10 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; @@ -66,7 +66,7 @@ function Node_Line(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru var _rtStr = min(_ratio[0], _ratio[1]); var _rtLen = max(_ratio[0], _ratio[1]) - _rtStr; - var _use_path = _pat != 0 && instanceof(_pat) == "Node_Path"; + var _use_path = _pat != noone && struct_has(_pat, "getPointRatio"); if(_ang < 0) _ang = 360 + _ang; inputs[| 6].setVisible(!_use_path); @@ -109,7 +109,7 @@ function Node_Line(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru } _nw = random_range(_wid[0], _wid[1]); - _nw *= eval_curve_bezier_cubic_x(_widc, _widap? _prog_curr / _rtLen : _prog_curr); + _nw *= eval_curve_x(_widc, _widap? _prog_curr / _rtLen : _prog_curr); if(_total <= _prog_curr - _prog) { _na = point_direction(_ox, _oy, _nx, _ny) + 90; @@ -170,7 +170,7 @@ function Node_Line(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru _sedIndex++; _nw = random_range(_wid[0], _wid[1]); - _nw *= eval_curve_bezier_cubic_x(_widc, _prog_curr); + _nw *= eval_curve_x(_widc, _prog_curr); if(_prog_curr > _prog) { draw_set_color(gradient_eval(_color, _prog_eli / _rtLen, ds_list_get(_col_data, 0))); diff --git a/scripts/node_local_analyze/node_local_analyze.gml b/scripts/node_local_analyze/node_local_analyze.gml index d6db396cc..2273eb521 100644 --- a/scripts/node_local_analyze/node_local_analyze.gml +++ b/scripts/node_local_analyze/node_local_analyze.gml @@ -8,24 +8,32 @@ function Node_Local_Analyze(_x, _y, _group = -1) : Node_Processor(_x, _y, _group uniform_sha = shader_get_uniform(shader, "shape"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Average (Blur)", "Maximum", "Minimum" ]); - inputs[| 2] = nodeValue(2, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [ 1, 16, 1]); - inputs[| 3] = nodeValue(3, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - inputs[| 4] = nodeValue(4, "Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Square", "Circle", "Diamond" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 3, + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 7, + ["Surface", true], 0, 3, 5, 6, ["Effect", false], 1, 2, 4, ]; @@ -37,7 +45,7 @@ function Node_Local_Analyze(_x, _y, _group = -1) : Node_Processor(_x, _y, _group surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); @@ -48,9 +56,11 @@ function Node_Local_Analyze(_x, _y, _group = -1) : Node_Processor(_x, _y, _group draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index bd44dc992..a002298e5 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -2,34 +2,33 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo name = "Lua Compute"; previewable = false; - inputs[| 0] = nodeValue(0, "Function name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "render" + string(irandom_range(100000, 999999))); + inputs[| 0] = nodeValue("Function name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "render" + string(irandom_range(100000, 999999))); - inputs[| 1] = nodeValue(1, "Return type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Return type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "String" ]); - inputs[| 2] = nodeValue(2, "Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 2] = nodeValue("Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "", o_dialog_lua_reference) .setDisplay(VALUE_DISPLAY.code); - inputs[| 3] = nodeValue(3, "Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) + inputs[| 3] = nodeValue("Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) .setVisible(false, true); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue( index + 0, "Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - inputs[| index + 1] = nodeValue( index + 1, "Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "String", "Surface" ]); inputs[| index + 1].editWidget.interactable = false; - inputs[| index + 2] = nodeValue( index + 2, "Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); inputs[| index + 2].editWidget.interactable = false; - } - outputs[| 0] = nodeValue(0, "Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 0] = nodeValue("Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 1] = nodeValue(1, "Return value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, 0); + outputs[| 1] = nodeValue("Return value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, 0); luaArgumentRenderer(); @@ -49,6 +48,7 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo lua_state = lua_create(); + error_notification = noone; compiled = false; if(!LOADING && !APPENDING) createNewInput(); @@ -63,6 +63,15 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo doStepBegin(); value_validation[VALIDATION.error] = !compiled; + if(!compiled && error_notification == noone) { + error_notification = noti_error("Lua node [" + string(name) + "] not compiled."); + error_notification.onClick = function() { PANEL_GRAPH.focusNode(self); }; + } + + if(compiled && error_notification != noone) { + noti_remove(error_notification); + error_notification = noone; + } var _type = inputs[| 1].getValue(); switch(_type) { @@ -115,7 +124,7 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo if(index == 0 || index == 2) compiled = false; } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 0 || index == 2) compiled = false; if(index == 3) { @@ -130,11 +139,11 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo if(index < input_fix_len) return; if(LOADING || APPENDING) return; - if((index - input_fix_len) % data_length == 0) { //Variable name - inputs[| index + 2].name = inputs[| index].getValue(); - compiled = false; - } else if((index - input_fix_len) % data_length == 1) { //Variable type + compiled = false; + + if((index - input_fix_len) % data_length == 1) { //Variable type var type = inputs[| index].getValue(); + switch(type) { case 0 : inputs[| index + 1].type = VALUE_TYPE.float; break; case 1 : inputs[| index + 1].type = VALUE_TYPE.text; break; @@ -142,13 +151,19 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo } inputs[| index + 1].setDisplay(VALUE_DISPLAY._default); - compiled = false; } refreshDynamicInput(); } - static update = function() { + static step = function() { + for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { + var name = inputs[| i + 0].getValue(); + inputs[| i + 2].name = name; + } + } + + static update = function(frame = ANIMATOR.current_frame) { if(!compiled) return; var _func = inputs[| 0].getValue(); @@ -169,7 +184,7 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo outputs[| 1].setValue(res); } - static inspectorUpdate = function() { //compile + static onInspectorUpdate = function() { //compile var _func = inputs[| 0].getValue(); var _code = inputs[| 2].getValue(); argument_name = []; @@ -183,9 +198,9 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo if(i) lua_code += ", " lua_code += argument_name[i]; } - lua_code += ")"; + lua_code += ")\n"; lua_code += _code; - lua_code += "end"; + lua_code += "\nend"; lua_add_code(getState(), lua_code); @@ -209,5 +224,25 @@ function Node_Lua_Compute(_x, _y, _group = -1) : Node(_x, _y, _group) constructo static doApplyDeserialize = function() { refreshDynamicInput(); + + for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { + var name = inputs[| i + 0].getValue(); + var type = inputs[| i + 1].getValue(); + + inputs[| i + 2].name = name; + + switch(type) { + case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; + case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; + case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; + } + + inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); + } + } + + static onDestroy = function() { + if(error_notification != noone) + noti_remove(error_notification); } } \ No newline at end of file diff --git a/scripts/node_lua_global/node_lua_global.gml b/scripts/node_lua_global/node_lua_global.gml index 97f47a19f..39a19b74f 100644 --- a/scripts/node_lua_global/node_lua_global.gml +++ b/scripts/node_lua_global/node_lua_global.gml @@ -3,16 +3,16 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor preview_channel = 1; previewable = false; - inputs[| 0] = nodeValue(0, "Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 0] = nodeValue("Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "", o_dialog_lua_reference) .setDisplay(VALUE_DISPLAY.code); - inputs[| 1] = nodeValue(1, "Run order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Run order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "On start", "Every frame" ]); - inputs[| 2] = nodeValue(2, "Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) + inputs[| 2] = nodeValue("Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) .setVisible(false, true); - outputs[| 0] = nodeValue(0, "Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 0] = nodeValue("Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); input_display_list = [ ["Main", false], 2, 1, 0, @@ -20,6 +20,7 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor lua_state = lua_create(); + error_notification = noone; compiled = false; static stepBegin = function() { @@ -34,6 +35,15 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor doStepBegin(); value_validation[VALIDATION.error] = !compiled; + if(!compiled && error_notification == noone) { + error_notification = noti_error("Lua node [" + string(name) + "] not compiled."); + error_notification.onClick = function() { PANEL_GRAPH.focusNode(self); }; + } + + if(compiled && error_notification != noone) { + noti_remove(error_notification); + error_notification = noone; + } } static getState = function() { @@ -46,11 +56,11 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor if(index == 0 || index == 2) compiled = false; } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 0 || index == 2) compiled = false; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(!compiled) return; var _code = inputs[| 0].getValue(); @@ -62,7 +72,7 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } } - static inspectorUpdate = function() { //compile + static onInspectorUpdate = function() { //compile var _code = inputs[| 0].getValue(); compiled = true; @@ -74,4 +84,9 @@ function Node_Lua_Global(_x, _y, _group = -1) : Node(_x, _y, _group) constructor doUpdate(); } + + static onDestroy = function() { + if(error_notification != noone) + noti_remove(error_notification); + } } \ No newline at end of file diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index 8351feabc..fe04063d0 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -2,33 +2,33 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo name = "Lua Surface"; preview_channel = 1; - inputs[| 0] = nodeValue(0, "Function name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "render" + string(irandom_range(100000, 999999))); + inputs[| 0] = nodeValue("Function name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "render" + string(irandom_range(100000, 999999))); - inputs[| 1] = nodeValue(1, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ def_surf_size, def_surf_size ]) + inputs[| 1] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ def_surf_size, def_surf_size ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 2] = nodeValue("Lua code", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "", o_dialog_lua_reference) .setDisplay(VALUE_DISPLAY.code); - inputs[| 3] = nodeValue(3, "Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) + inputs[| 3] = nodeValue("Execution thread", self, JUNCTION_CONNECT.input, VALUE_TYPE.node, noone) .setVisible(false, true); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue( index + 0, "Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - inputs[| index + 1] = nodeValue( index + 1, "Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "String", "Surface" ]); inputs[| index + 1].editWidget.interactable = false; - inputs[| index + 2] = nodeValue( index + 2, "Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setVisible(true, true); inputs[| index + 2].editWidget.interactable = false; } - outputs[| 0] = nodeValue(0, "Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); + outputs[| 0] = nodeValue("Execution thread", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); - outputs[| 1] = nodeValue(1, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 1] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); luaArgumentRenderer(); @@ -48,6 +48,7 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo lua_state = lua_create(); + error_notification = noone; compiled = false; if(!LOADING && !APPENDING) createNewInput(); @@ -62,6 +63,15 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo doStepBegin(); value_validation[VALIDATION.error] = !compiled; + if(!compiled && error_notification == noone) { + error_notification = noti_error("Lua node [" + string(name) + "] not compiled."); + error_notification.onClick = function() { PANEL_GRAPH.focusNode(self); }; + } + + if(compiled && error_notification != noone) { + noti_remove(error_notification); + error_notification = noone; + } } static getState = function() { @@ -119,7 +129,7 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo if(index == 0 || index == 2) compiled = false; } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 0 || index == 2) compiled = false; if(index == 3) { @@ -134,11 +144,11 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo if(index < input_fix_len) return; if(LOADING || APPENDING) return; - if((index - input_fix_len) % data_length == 0) { //Variable name - inputs[| index + 2].name = inputs[| index].getValue(); - compiled = false; - } else if((index - input_fix_len) % data_length == 1) { //Variable type + compiled = false; + + if((index - input_fix_len) % data_length == 1) { //Variable type var type = inputs[| index].getValue(); + switch(type) { case 0 : inputs[| index + 1].type = VALUE_TYPE.float; break; case 1 : inputs[| index + 1].type = VALUE_TYPE.text; break; @@ -146,13 +156,19 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo } inputs[| index + 1].setDisplay(VALUE_DISPLAY._default); - compiled = false; } refreshDynamicInput(); } - static update = function() { + static step = function() { + for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { + var name = inputs[| i + 0].getValue(); + inputs[| i + 2].name = name; + } + } + + static update = function(frame = ANIMATOR.current_frame) { if(!compiled) return; var _func = inputs[| 0].getValue(); @@ -177,7 +193,7 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo outputs[| 1].setValue(_outSurf); } - static inspectorUpdate = function() { //compile + static onInspectorUpdate = function() { //compile var _func = inputs[| 0].getValue(); var _code = inputs[| 2].getValue(); argument_name = []; @@ -217,5 +233,25 @@ function Node_Lua_Surface(_x, _y, _group = -1) : Node(_x, _y, _group) constructo static doApplyDeserialize = function() { refreshDynamicInput(); + + for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) { + var name = inputs[| i + 0].getValue(); + var type = inputs[| i + 1].getValue(); + + inputs[| i + 2].name = name; + + switch(type) { + case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break; + case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break; + case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break; + } + + inputs[| i + 2].setDisplay(VALUE_DISPLAY._default); + } + } + + static onDestroy = function() { + if(error_notification != noone) + noti_remove(error_notification); } } \ No newline at end of file diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index b17faf787..b73469e75 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -15,6 +15,9 @@ enum MATH_OPERATOR { floor, ceiling, round, + + lerp, + abs } function Node_create_Math(_x, _y, _group = -1, _param = "") { @@ -37,6 +40,9 @@ function Node_create_Math(_x, _y, _group = -1, _param = "") { case "floor" : node.inputs[| 0].setValue(MATH_OPERATOR.floor); break; case "ceiling" : node.inputs[| 0].setValue(MATH_OPERATOR.ceiling); break; case "round" : node.inputs[| 0].setValue(MATH_OPERATOR.round); break; + + case "lerp" : node.inputs[| 0].setValue(MATH_OPERATOR.lerp); break; + case "abs" : node.inputs[| 0].setValue(MATH_OPERATOR.abs); break; } //ds_list_add(PANEL_GRAPH.nodes_list, node); @@ -50,63 +56,54 @@ function Node_Math(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { w = 96; - - inputs[| 0] = nodeValue(0, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ /* 0 - 9*/ "Add", "Subtract", "Multiply", "Divide", "Power", "Root", "Sin", "Cos", "Tan", "Modulo", - /*10 - 12*/ "Floor", "Ceil", "Round" ]); + /*10 - 20*/ "Floor", "Ceil", "Round", "Lerp", "Abs" ]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("a", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("b", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 3] = nodeValue(3, "Degree angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 3] = nodeValue("Degree angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 4] = nodeValue(4, "To integer", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 4] = nodeValue("To integer", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + inputs[| 5] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - static _eval = function(mode, a, b) { - var deg = inputs[| 3].getValue(); + input_display_list = [ + 0, 1, 2, 5, 3, 4, + ] - switch(mode) { - case MATH_OPERATOR.add : - if(is_real(a) && is_real(b)) return a + b; - else if(is_string(a) || is_string(b)) return string(a) + string(b); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + + use_mod = 0; + use_deg = false; + + static _eval = function(a, b, c = 0) { + switch(use_mod) { + case MATH_OPERATOR.add : return a + b; + case MATH_OPERATOR.subtract : return a - b; + case MATH_OPERATOR.multiply : return a * b; + case MATH_OPERATOR.divide : return b == 0? 0 : a / b; - case MATH_OPERATOR.subtract : - if(is_real(a) && is_real(b)) return a - b; - else if(is_string(a) || is_string(b)) return string_replace(string(a), string(b), ""); - - case MATH_OPERATOR.multiply : - if(is_real(a) && is_real(b)) return a * b; - else if(is_string(a) || is_real(b)) { - var s = ""; - repeat(b) s += a; - return s; - } else if(is_string(b) || is_real(a)) { - var s = ""; - repeat(a) s += b; - return s; - } - - case MATH_OPERATOR.divide : - if(is_real(a) && is_real(b)) return b == 0? 0 : a / b; - else if(is_string(a) || is_string(b)) return string_replace_all(string(a), string(b), ""); + case MATH_OPERATOR.power : return power(a, b); + case MATH_OPERATOR.root : return b == 0? 0 : power(a, 1 / b); - case MATH_OPERATOR.power : if(is_real(a) && is_real(b)) return power(a, b); - case MATH_OPERATOR.root : if(is_real(a) && is_real(b)) return b == 0? 0 : power(a, 1 / b); + case MATH_OPERATOR.sin : return sin(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.cos : return cos(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.tan : return tan(use_deg? degtorad(a) : a) * b; + case MATH_OPERATOR.modulo : return safe_mod(a, b); - case MATH_OPERATOR.sin : if(is_real(a) && is_real(b)) return sin(deg? degtorad(a) : a) * b; - case MATH_OPERATOR.cos : if(is_real(a) && is_real(b)) return cos(deg? degtorad(a) : a) * b; - case MATH_OPERATOR.tan : if(is_real(a) && is_real(b)) return tan(deg? degtorad(a) : a) * b; - case MATH_OPERATOR.modulo : if(is_real(a) && is_real(b)) return safe_mod(a, b); + case MATH_OPERATOR.floor : return floor(a); + case MATH_OPERATOR.ceiling : return ceil(a); + case MATH_OPERATOR.round : return round(a); - case MATH_OPERATOR.floor : if(is_real(a)) return floor(a); - case MATH_OPERATOR.ceiling : if(is_real(a)) return ceil(a); - case MATH_OPERATOR.round : if(is_real(a)) return round(a); + case MATH_OPERATOR.lerp : return lerp(a, b, c); + case MATH_OPERATOR.abs : return abs(a); } return 0; } @@ -141,6 +138,7 @@ function Node_Math(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } inputs[| 2].name = "b"; + inputs[| 5].setVisible(false); switch(mode) { case MATH_OPERATOR.add : @@ -161,36 +159,53 @@ function Node_Math(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { case MATH_OPERATOR.floor : case MATH_OPERATOR.ceiling : case MATH_OPERATOR.round : + case MATH_OPERATOR.abs : inputs[| 2].setVisible(false); break; + case MATH_OPERATOR.lerp : + inputs[| 5].setVisible(true); + break; default: return; } } - function update() { - var mode = inputs[| 0].getValue(); - var a = inputs[| 1].getValue(); - var b = inputs[| 2].getValue(); - + function evalArray(a, b, c = 0) { var as = is_array(a); var bs = is_array(b); - var al = as? array_length(a) : 0; - var bl = bs? array_length(b) : 0; + var cs = is_array(c); - var val = 0; - if(!as && !bs) - val = _eval(mode, a, b); - else if(!as && bs) { - for( var i = 0; i < bl; i++ ) - val[i] = _eval(mode, a, b[i]); - } else if(as && !bs) { - for( var i = 0; i < al; i++ ) - val[i] = _eval(mode, a[i], b); - } else { - for( var i = 0; i < max(al, bl); i++ ) - val[i] = _eval(mode, array_safe_get(a, i), array_safe_get(b, i)); - } + if(!as && !bs && !cs) + return _eval(a, b, c); + if(!as) a = [ a ]; + if(!bs) b = [ b ]; + if(!cs) c = [ c ]; + + var al = array_length(a); + var bl = array_length(b); + var cl = array_length(c); + + var amo = max(al, bl, cl); + var val = array_create(amo); + + for( var i = 0; i < amo; i++ ) + val[i] = evalArray( + array_safe_get(a, i,, ARRAY_OVERFLOW.loop), + array_safe_get(b, i,, ARRAY_OVERFLOW.loop), + array_safe_get(c, i,, ARRAY_OVERFLOW.loop), + ); + + return val; + } + + function update(frame = ANIMATOR.current_frame) { + use_mod = inputs[| 0].getValue(); + var a = inputs[| 1].getValue(); + var b = inputs[| 2].getValue(); + use_deg = inputs[| 3].getValue(); + var c = inputs[| 5].getValue(); + + var val = evalArray(a, b, c); outputs[| 0].setValue(val); } @@ -213,6 +228,9 @@ function Node_Math(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { case MATH_OPERATOR.floor : str = "floor"; break; case MATH_OPERATOR.ceiling : str = "ceil"; break; case MATH_OPERATOR.round : str = "round"; break; + + case MATH_OPERATOR.lerp : str = "lerp"; break; + case MATH_OPERATOR.abs : str = "abs"; break; default: return; } diff --git a/scripts/node_mirror/node_mirror.gml b/scripts/node_mirror/node_mirror.gml index 7c325ce02..33b52549c 100644 --- a/scripts/node_mirror/node_mirror.gml +++ b/scripts/node_mirror/node_mirror.gml @@ -1,17 +1,26 @@ function Node_Mirror(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Mirror"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "Mirror mask", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 1] = nodeValue("Mirror mask", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 3, + ["Surface", false], 0, + ["Mirror", false], 1, 2, + ] static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var _pos = inputs[| 1].getValue(); @@ -38,7 +47,7 @@ function Node_Mirror(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader = _output_index? sh_mirror_mask : sh_mirror; uniform_dim = shader_get_uniform(shader, "dimension"); @@ -46,13 +55,13 @@ function Node_Mirror(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_ang = shader_get_uniform(shader, "angle"); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, _dim); - shader_set_uniform_f_array(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_pos, _pos); shader_set_uniform_f(uniform_ang, degtorad(_ang)); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_noise/node_noise.gml b/scripts/node_noise/node_noise.gml index 076e5fc1e..b49541cd0 100644 --- a/scripts/node_noise/node_noise.gml +++ b/scripts/node_noise/node_noise.gml @@ -4,17 +4,17 @@ function Node_Noise(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr shader = sh_noise; uniform_sed = shader_get_uniform(shader, "seed"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); + inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); input_display_list = [ ["Output", false], 0, ["Noise", false], 1, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; diff --git a/scripts/node_noise_ani/node_noise_ani.gml b/scripts/node_noise_ani/node_noise_ani.gml index 881b7f57e..342a66f45 100644 --- a/scripts/node_noise_ani/node_noise_ani.gml +++ b/scripts/node_noise_ani/node_noise_ani.gml @@ -7,19 +7,19 @@ function Node_Noise_Aniso(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_pos = shader_get_uniform(shader, "position"); uniform_ang = shader_get_uniform(shader, "angle"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 16 ]) + inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 16 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999)); + inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999)); - inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 3] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 4] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); input_display_list = [ @@ -27,7 +27,7 @@ function Node_Noise_Aniso(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) ["Noise", false], 2, 1, 3, 4 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -44,7 +44,7 @@ function Node_Noise_Aniso(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f_array(uniform_noi, _amo); + shader_set_uniform_f_array_safe(uniform_noi, _amo); shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f(uniform_sed, _sed); shader_set_uniform_f(uniform_ang, degtorad(_ang)); diff --git a/scripts/node_noise_cell/node_noise_cell.gml b/scripts/node_noise_cell/node_noise_cell.gml index f4362d74f..75055a73f 100644 --- a/scripts/node_noise_cell/node_noise_cell.gml +++ b/scripts/node_noise_cell/node_noise_cell.gml @@ -1,32 +1,32 @@ function Node_Cellular(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Cellular Noise"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4); + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4); - inputs[| 3] = nodeValue(3, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 4] = nodeValue(4, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Point", "Edge", "Cell", "Crystal" ]); - inputs[| 5] = nodeValue(5, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 5] = nodeValue("Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 6] = nodeValue(6, "Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 6] = nodeValue("Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Radial" ]); - inputs[| 7] = nodeValue(7, "Middle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 7] = nodeValue("Middle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [0., 1., 0.01]); - inputs[| 8] = nodeValue(8, "Radial scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) + inputs[| 8] = nodeValue("Radial scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) .setDisplay(VALUE_DISPLAY.slider, [1., 10., 0.01]); - inputs[| 9] = nodeValue(9, "Radial shatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 9] = nodeValue("Radial shatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [-10., 10., 0.01]) .setVisible(false); @@ -37,7 +37,7 @@ function Node_Cellular(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con ["Rendering", false], 5, 7 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -82,9 +82,9 @@ function Node_Cellular(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_dim, _dim); shader_set_uniform_f(uniform_tim, _tim); - shader_set_uniform_f_array(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_pos, _pos); shader_set_uniform_f(uniform_sca, _sca); shader_set_uniform_f(uniform_con, _con); shader_set_uniform_f(uniform_mid, _mid); diff --git a/scripts/node_noise_grid/node_noise_grid.gml b/scripts/node_noise_grid/node_noise_grid.gml index 5552303a3..c974bc0ff 100644 --- a/scripts/node_noise_grid/node_noise_grid.gml +++ b/scripts/node_noise_grid/node_noise_grid.gml @@ -11,24 +11,24 @@ function Node_Grid_Noise(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c uniform_sam = shader_get_uniform(shader, "useSampler"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ]) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 4] = nodeValue(4, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 4] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [-2, 2, 0.01]); - inputs[| 5] = nodeValue(5, "Texture sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 5] = nodeValue("Texture sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 6] = nodeValue(6, "Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 6] = nodeValue("Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]); input_display_list = [ @@ -37,7 +37,7 @@ function Node_Grid_Noise(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c ["Render", false], 5, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -57,9 +57,9 @@ function Node_Grid_Noise(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c surface_set_target(_outSurf); draw_clear_alpha(0, 0); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, _dim); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_i(uniform_sam, is_surface(_sam)); shader_set_uniform_f(uniform_shf, _shf); shader_set_uniform_i(uniform_shfax, _shfAx); diff --git a/scripts/node_noise_grid_hex/node_noise_grid_hex.gml b/scripts/node_noise_grid_hex/node_noise_grid_hex.gml index 3978bd4cb..fe47ec184 100644 --- a/scripts/node_noise_grid_hex/node_noise_grid_hex.gml +++ b/scripts/node_noise_grid_hex/node_noise_grid_hex.gml @@ -1,68 +1,73 @@ -function Node_Noise_Hex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "Hexagonal Noise"; +function Node_Grid_Hex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { + name = "Hexagonal Grid"; - shader = sh_noise_grid_hex; + shader = sh_grid_hex; uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_sed = shader_get_uniform(shader, "seed"); uniform_pos = shader_get_uniform(shader, "position"); uniform_sca = shader_get_uniform(shader, "scale"); - uniform_ang = shader_get_uniform(shader, "angle"); + uniform_rot = shader_get_uniform(shader, "angle"); + uniform_thk = shader_get_uniform(shader, "thick"); - uniform_sam = shader_get_uniform(shader, "useSampler"); - uniform_samTyp = shader_get_uniform(shader, "sampleMode"); + uniform_clr0 = shader_get_uniform(shader, "color0"); + uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0] ) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ] ) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 4] = nodeValue(4, "Texture sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - - inputs[| 5] = nodeValue(5, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); + inputs[| 4] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + + inputs[| 6] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); input_display_list = [ - ["Output", false], 0, - ["Noise", false], 1, 2, 3, - ["Texture", false], 4, 5 + ["Output", false], 0, + ["Pattern", false], 1, 2, 3, 4, + ["Render", false], 5, 6, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { - inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; - var _sed = _data[1]; - var _pos = _data[2]; - var _sca = _data[3]; - var _sam = _data[4]; - var _samTyp = _data[5]; + var _pos = _data[1]; + var _sca = _data[2]; + var _rot = _data[3]; + var _thk = _data[4]; + + var _clr0 = _data[5]; + var _clr1 = _data[6]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); surface_set_target(_outSurf); draw_clear_alpha(0, 0); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [_dim[0], _dim[1]]); - shader_set_uniform_f(uniform_sed, _sed); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); - shader_set_uniform_i(uniform_sam, is_surface(_sam)); - shader_set_uniform_i(uniform_samTyp, _samTyp); + shader_set_uniform_f(uniform_dim, _dim[0], _dim[1]); + shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); + shader_set_uniform_f(uniform_sca, _sca[0], _sca[1]); + shader_set_uniform_f(uniform_rot, degtorad(_rot)); + shader_set_uniform_f(uniform_thk, _thk); - if(is_surface(_sam)) - draw_surface_stretched(_sam, 0, 0, _dim[0], _dim[1]); - else - draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); + shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); + shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); + + draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); surface_reset_target(); diff --git a/scripts/node_noise_grid_tri/node_noise_grid_tri.gml b/scripts/node_noise_grid_tri/node_noise_grid_tri.gml index b06ea73a6..7352a1f8c 100644 --- a/scripts/node_noise_grid_tri/node_noise_grid_tri.gml +++ b/scripts/node_noise_grid_tri/node_noise_grid_tri.gml @@ -1,68 +1,73 @@ -function Node_Noise_Tri(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "Triangle Noise"; +function Node_Grid_Tri(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { + name = "Triangle Grid"; - shader = sh_noise_grid_tri; + shader = sh_grid_tri; uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_sed = shader_get_uniform(shader, "seed"); uniform_pos = shader_get_uniform(shader, "position"); uniform_sca = shader_get_uniform(shader, "scale"); - uniform_ang = shader_get_uniform(shader, "angle"); + uniform_rot = shader_get_uniform(shader, "angle"); + uniform_thk = shader_get_uniform(shader, "thick"); - uniform_sam = shader_get_uniform(shader, "useSampler"); - uniform_samTyp = shader_get_uniform(shader, "sampleMode"); + uniform_clr0 = shader_get_uniform(shader, "color0"); + uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0] ) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ] ) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 4] = nodeValue(4, "Texture sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - - inputs[| 5] = nodeValue(5, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); + inputs[| 4] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 5] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + + inputs[| 6] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); input_display_list = [ - ["Output", false], 0, - ["Noise", false], 1, 2, 3, - ["Texture", false], 4, 5, + ["Output", false], 0, + ["Pattern", false], 1, 2, 3, 4, + ["Render", false], 5, 6, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { - inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; - var _sed = _data[1]; - var _pos = _data[2]; - var _sca = _data[3]; - var _sam = _data[4]; - var _samTyp = _data[5]; + var _pos = _data[1]; + var _sca = _data[2]; + var _rot = _data[3]; + var _thk = _data[4]; + + var _clr0 = _data[5]; + var _clr1 = _data[6]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); surface_set_target(_outSurf); draw_clear_alpha(0, 0); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [_dim[0], _dim[1]]); - shader_set_uniform_f(uniform_sed, _sed); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); - shader_set_uniform_i(uniform_sam, is_surface(_sam)); - shader_set_uniform_i(uniform_samTyp, _samTyp); + shader_set_uniform_f(uniform_dim, _dim[0], _dim[1]); + shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); + shader_set_uniform_f(uniform_sca, _sca[0], _sca[1]); + shader_set_uniform_f(uniform_rot, degtorad(_rot)); + shader_set_uniform_f(uniform_thk, _thk); - if(is_surface(_sam)) - draw_surface_stretched(_sam, 0, 0, _dim[0], _dim[1]); - else - draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); + shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); + shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); + + draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); surface_reset_target(); diff --git a/scripts/node_noise_simplex/node_noise_simplex.gml b/scripts/node_noise_simplex/node_noise_simplex.gml index 6aadd77f9..f76913bfe 100644 --- a/scripts/node_noise_simplex/node_noise_simplex.gml +++ b/scripts/node_noise_simplex/node_noise_simplex.gml @@ -6,16 +6,16 @@ function Node_Noise_Simplex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group uniform_sca = shader_get_uniform(shader, "scale"); uniform_itr = shader_get_uniform(shader, "iteration"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0, 0] ) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0, 0] ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [2, 2] ) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [2, 2] ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) + inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 1]); input_display_list = [ @@ -23,7 +23,7 @@ function Node_Noise_Simplex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group ["Noise", false], 1, 2, 3, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; @@ -35,8 +35,8 @@ function Node_Noise_Simplex(_x, _y, _group = -1) : Node_Processor(_x, _y, _group surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_i(uniform_itr, _itr); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); diff --git a/scripts/node_normal/node_normal.gml b/scripts/node_normal/node_normal.gml index f52830360..4f05e61a2 100644 --- a/scripts/node_normal/node_normal.gml +++ b/scripts/node_normal/node_normal.gml @@ -5,13 +5,21 @@ function Node_Normal(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_hei = shader_get_uniform(sh_normal, "height"); uniform_smt = shader_get_uniform(sh_normal, "smooth"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 1] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 2] = nodeValue(2, "Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal pixel in normal calculation, which leads to smoother output."); + inputs[| 2] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal pixel in normal calculation, which leads to smoother output."); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + input_display_list = [ 3, + ["Surface", false], 0, + ["Normal", false], 1, 2, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _hei = _data[1]; @@ -19,17 +27,17 @@ function Node_Normal(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_normal); shader_set_uniform_f(uniform_hei, _hei); shader_set_uniform_i(uniform_smt, _smt); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_normal_light/node_normal_light.gml b/scripts/node_normal_light/node_normal_light.gml index 0fde6a8ea..2a8fa5830 100644 --- a/scripts/node_normal_light/node_normal_light.gml +++ b/scripts/node_normal_light/node_normal_light.gml @@ -11,33 +11,36 @@ function Node_Normal_Light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_light_int = shader_get_uniform(sh_normal_light, "lightIntensity"); uniform_light_typ = shader_get_uniform(sh_normal_light, "lightType"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Normal map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Normal map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 2] = nodeValue(2, "Normal intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 2] = nodeValue("Normal intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 3] = nodeValue(3, "Ambient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 3] = nodeValue("Ambient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 4] = nodeValue(4, "Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, -1 ]) + inputs[| 4] = nodeValue("Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, -1 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 5] = nodeValue(5, "Light range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); + inputs[| 5] = nodeValue("Light range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); - inputs[| 6] = nodeValue(6, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 32); + inputs[| 6] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 32); - inputs[| 7] = nodeValue(7, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 7] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 8] = nodeValue(8, "Light type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 8] = nodeValue("Light type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, ["Point", "Sun"]); - input_display_list = [ 0, + inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 9; + + input_display_list = [ 9, 0, ["Normal", false], 1, 2, ["Light", false], 3, 8, 4, 5, 6, 7 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var pos = inputs[| 4].getValue(); @@ -61,23 +64,23 @@ function Node_Normal_Light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_normal_light); texture_set_stage(uniform_map, surface_get_texture(_map)); shader_set_uniform_f(uniform_hei, _hei); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); - shader_set_uniform_f_array(uniform_amb, [color_get_red(_amb) / 255, color_get_green(_amb) / 255, color_get_blue(_amb) / 255]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_amb, [color_get_red(_amb) / 255, color_get_green(_amb) / 255, color_get_blue(_amb) / 255]); - shader_set_uniform_f_array(uniform_light_pos, [ _light_pos[0], _light_pos[1], _light_pos[2] / 100, _light_ran ] ); - shader_set_uniform_f_array(uniform_light_col, [color_get_red(_light_col) / 255, color_get_green(_light_col) / 255, color_get_blue(_light_col) / 255]); + shader_set_uniform_f_array_safe(uniform_light_pos, [ _light_pos[0], _light_pos[1], _light_pos[2] / 100, _light_ran ] ); + shader_set_uniform_f_array_safe(uniform_light_col, [color_get_red(_light_col) / 255, color_get_green(_light_col) / 255, color_get_blue(_light_col) / 255]); shader_set_uniform_f(uniform_light_int, _light_int); shader_set_uniform_i(uniform_light_typ, _light_typ); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index f2b25335b..5094981cb 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -16,35 +16,44 @@ function Node_Outline(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons uniform_out_only = shader_get_uniform(shader, "outline_only"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); - inputs[| 2] = nodeValue(2, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 2] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 3] = nodeValue(3, "Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Blend outline color with the original color."); + inputs[| 3] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Blend outline color with the original color."); - inputs[| 4] = nodeValue(4, "Blend alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 4] = nodeValue("Blend alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 5] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_button, ["Inside", "Outside"]); - inputs[| 6] = nodeValue(6, "Anti alising", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0); + inputs[| 6] = nodeValue("Anti alising", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0); - inputs[| 7] = nodeValue(7, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 7] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - inputs[| 8] = nodeValue(8, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Shift outline inside, outside the shape."); - - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 8] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Shift outline inside, outside the shape."); - outputs[| 1] = nodeValue(1, "Outline", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 9] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ 0, + inputs[| 10] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 11] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 11; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + outputs[| 1] = nodeValue("Outline", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 11, + ["Surface", true], 0, 9, 10, ["Outline", false], 1, 5, 7, 8, ["Render", false], 2, 3, 4, 6, ]; - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var ww = surface_get_width(_data[0]); var hh = surface_get_height(_data[0]); var wd = _data[1]; @@ -59,13 +68,13 @@ function Node_Outline(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ww, hh]); + shader_set_uniform_f_array_safe(uniform_dim, [ww, hh]); shader_set_uniform_f(uniform_border_start, bst); shader_set_uniform_f(uniform_border_size, wd); - shader_set_uniform_f_array(uniform_border_color, [color_get_red(cl) / 255, color_get_green(cl) / 255, color_get_blue(cl) / 255, 1.0]); + shader_set_uniform_f_array_safe(uniform_border_color, [color_get_red(cl) / 255, color_get_green(cl) / 255, color_get_blue(cl) / 255, 1.0]); shader_set_uniform_i(uniform_side, side); shader_set_uniform_i(uniform_aa, aa); @@ -77,9 +86,11 @@ function Node_Outline(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[9], _data[10]); + return _outSurf; } diff --git a/scripts/node_padding/node_padding.gml b/scripts/node_padding/node_padding.gml index e6864f5bc..4deeaab52 100644 --- a/scripts/node_padding/node_padding.gml +++ b/scripts/node_padding/node_padding.gml @@ -2,21 +2,24 @@ function Node_Padding(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons name = "Padding"; dimension_index = -1; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) .setDisplay(VALUE_DISPLAY.padding) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Fill method", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Fill method", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Solid" ]); - inputs[| 3] = nodeValue(3, "Fill color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 3] = nodeValue("Fill color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 4; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - input_display_list = [ - ["Surface", false], 0, + input_display_list = [ 4, + ["Surface", true], 0, ["Padding", false], 1, 2, 3 ]; @@ -39,13 +42,13 @@ function Node_Padding(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons surface_set_target(_outSurf); if(fill == 0) { draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; } else if(fill == 1) { draw_clear_alpha(fillClr, 1); } draw_surface_safe(_data[0], padding[2], padding[1]); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } return _outSurf; diff --git a/scripts/node_palette/node_palette.gml b/scripts/node_palette/node_palette.gml index 542fb339e..75c92a3d4 100644 --- a/scripts/node_palette/node_palette.gml +++ b/scripts/node_palette/node_palette.gml @@ -1,40 +1,43 @@ -function Node_Palette(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { +function Node_Palette(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Palette"; previewable = false; - w = 96; - - inputs[| 0] = nodeValue(0, "Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) + inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 1] = nodeValue(1, "Trim range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ]) + inputs[| 1] = nodeValue("Trim range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ]) .setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) + outputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) .setDisplay(VALUE_DISPLAY.palette); input_display_list = [0, ["Trim", true], 1 ]; - static update = function() { - var pal = inputs[| 0].getValue(); - var ran = inputs[| 1].getValue(); + static process_data = function(_outSurf, _data, _output_index, _array_index) { + var pal = _data[0]; + var ran = _data[1]; - var st = floor(min(ran[0], ran[1]) * array_length(pal)); - var en = floor(max(ran[0], ran[1]) * array_length(pal)); - var len = max(1, en - st); - var ar = array_create(len); - array_copy(ar, 0, pal, min(array_length(pal) - len, st), len); - outputs[| 0].setValue(ar); + var st = floor(clamp(min(ran[0], ran[1]), 0, 1) * array_length(pal)); + var en = floor(clamp(max(ran[0], ran[1]), 0, 1) * array_length(pal)); + var ar = []; + + for( var i = st; i < en; i++ ) + ar[i] = array_safe_get(pal, i); + + return ar; } static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); if(bbox.h < 1) return; - drawPalette(outputs[| 0].getValue(), bbox.x0, bbox.y0, bbox.w, bbox.h); + var pal = outputs[| 0].getValue(); + if(array_length(pal) && is_array(pal[0])) return; + + drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index a942c2630..eceed589e 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -1,23 +1,29 @@ -function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { +function Node_Palette_Extract(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Palette Extract"; w = 96; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Max colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 5, "Amount of color in a palette."); + inputs[| 1] = nodeValue("Max colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 5, "Amount of color in a palette.") + .rejectArray(); - inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999), "Random seed to be used to initialize K-mean algorithm."); + inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999), "Random seed to be used to initialize K-mean algorithm.") + .rejectArray(); - inputs[| 3] = nodeValue(3, "Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "K-mean", "Frequency", "All colors" ]); + inputs[| 3] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "K-mean", "Frequency", "All colors" ]) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ]) + inputs[| 4] = nodeValue("Animated surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .rejectArray(); + + outputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ]) .setDisplay(VALUE_DISPLAY.palette); static getPreviewValue = function() { return inputs[| 0]; } input_display_list = [ - ["Surface", false], 0, + ["Surface", true], 0, 4, ["Palette", false], 3, 1, 2, ] @@ -54,7 +60,7 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro } function extractKmean(_surfFull, _size, _seed, space = 0) { - var _surf = surface_create(min(32, surface_get_width(_surfFull)), min(32, surface_get_height(_surfFull))); + var _surf = surface_create_valid(min(32, surface_get_width(_surfFull)), min(32, surface_get_height(_surfFull))); _size = max(1, _size); var ww = surface_get_width(_surf); @@ -62,11 +68,11 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro surface_set_target(_surf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; gpu_set_texfilter(true); draw_surface_stretched(_surfFull, 0, 0, ww, hh); gpu_set_texfilter(false); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); var c_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); @@ -172,8 +178,31 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro return palette; } - function extractFrequence(_surfFull, _size, _all = false) { - var _surf = surface_create(min(32, surface_get_width(_surfFull)), min(32, surface_get_height(_surfFull))); + function extractAll(_surfFull) { + var ww = surface_get_width(_surfFull); + var hh = surface_get_height(_surfFull); + + var c_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); + + buffer_get_surface(c_buffer, _surfFull, 0); + buffer_seek(c_buffer, buffer_seek_start, 0); + + var palette = []; + + for( var i = 0; i < ww * hh; i++ ) { + var c = buffer_read(c_buffer, buffer_u32) & ~(0b11111111 << 24); + c = make_color_rgb(color_get_red(c), color_get_green(c), color_get_blue(c)); + if(!array_exists(palette, c)) + array_push(palette, c); + } + + buffer_delete(c_buffer); + return palette; + } + + function extractFrequence(_surfFull, _size) { + var msize = 128; + var _surf = surface_create_valid(min(msize, surface_get_width(_surfFull)), min(msize, surface_get_height(_surfFull))); _size = max(1, _size); var ww = surface_get_width(_surf); @@ -181,11 +210,9 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro surface_set_target(_surf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE - gpu_set_texfilter(true); + BLEND_OVERRIDE; draw_surface_stretched(_surfFull, 0, 0, ww, hh); - gpu_set_texfilter(false); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); var c_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); @@ -194,10 +221,12 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro buffer_get_surface(c_buffer, _surf, 0); buffer_seek(c_buffer, buffer_seek_start, 0); - var clrs = ds_map_create(); + var palette = []; + var clrs = ds_map_create(); for( var i = 0; i < ww * hh; i++ ) { var c = buffer_read(c_buffer, buffer_u32) & ~(0b11111111 << 24); + c = make_color_rgb(color_get_red(c), color_get_green(c), color_get_blue(c)); if(ds_map_exists(clrs, c)) clrs[? c]++; else @@ -205,34 +234,22 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro } buffer_delete(c_buffer); - var palette = []; - if(_all) { - var amo = ds_map_size(clrs); - var k = ds_map_find_first(clrs); - repeat(amo) { - array_push(palette, k); - k = ds_map_find_next(clrs, k); - } - sortPalette(palette); - } else { - var pr = ds_priority_create(); + var pr = ds_priority_create(); + var amo = ds_map_size(clrs); + var k = ds_map_find_first(clrs); - var amo = ds_map_size(clrs); - var k = ds_map_find_first(clrs); - repeat(amo) { - ds_priority_add(pr, k, clrs[? k]); - k = ds_map_find_next(clrs, k); - } - - for( var i = 0; i < _size; i++ ) { - if(ds_priority_empty(pr)) break; - array_push(palette, ds_priority_delete_max(pr)); - } - - ds_priority_destroy(pr); + repeat(amo) { + ds_priority_add(pr, k, clrs[? k]); + k = ds_map_find_next(clrs, k); } + for( var i = 0; i < _size; i++ ) { + if(ds_priority_empty(pr)) break; + array_push(palette, ds_priority_delete_max(pr)); + } + + ds_priority_destroy(pr); ds_map_destroy(clrs); return palette; } @@ -244,18 +261,43 @@ function Node_Palette_Extract(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro inputs[| 2].setVisible(_algo == 0); } - function process_data(_output, _data, index = 0) { - var _surf = _data[0]; - var _size = _data[1]; - var _seed = _data[2]; - var _algo = _data[3]; - + static extractPalette = function(_surf, _algo, _size, _seed) { if(!is_surface(_surf)) return []; - if(_algo == 0) - return extractKmean(_surf, _size, _seed); - else - return extractFrequence(_surf, _size, _algo == 2); + switch(_algo) { + case 0 : return extractKmean(_surf, _size, _seed); + case 1 : return extractFrequence(_surf, _size); + case 2 : return extractAll(_surf); + } + + return []; + } + + static extractPalettes = function() { + var _surf = inputs[| 0].getValue(); + var _size = inputs[| 1].getValue(); + var _seed = inputs[| 2].getValue(); + var _algo = inputs[| 3].getValue(); + var res = []; + + if(is_surface(_surf)) { + res = extractPalette(_surf, _algo, _size, _seed); + } else if(is_array(_surf)) { + res = array_create(array_length(_surf)); + for( var i = 0; i < array_length(_surf); i++ ) + res[i] = extractPalette(_surf[i], _algo, _size, _seed); + } + + outputs[| 0].setValue(res); + } + + static onInspectorUpdate = function() { extractPalettes(); } + static onValueUpdate = function() { extractPalettes(); } + static onValueFromUpdate = function() { extractPalettes(); } + + function update() { + var willUpdate = inputs[| 4].getValue(); + if(willUpdate) extractPalettes(); } static onDrawNode = function(xx, yy, _mx, _my, _s) { diff --git a/scripts/node_palette_replacement/node_palette_replacement.gml b/scripts/node_palette_replacement/node_palette_replacement.gml index 795230a80..fdb203a2f 100644 --- a/scripts/node_palette_replacement/node_palette_replacement.gml +++ b/scripts/node_palette_replacement/node_palette_replacement.gml @@ -1,87 +1,65 @@ -function Node_Palette_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { - name = "Palette replace"; +function Node_Palette_Replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { + name = "Palette Replace"; - shader = sh_palette_replace; - uniform_from = shader_get_uniform(shader, "colorFrom"); - uniform_from_count = shader_get_uniform(shader, "colorFrom_amo"); + w = 96; - uniform_to = shader_get_uniform(shader, "colorTo"); - uniform_to_count = shader_get_uniform(shader, "colorTo_amo"); + inputs[| 0] = nodeValue("Palette in", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ] ) + .setDisplay(VALUE_DISPLAY.palette) + .setVisible(true, true); - uniform_ter = shader_get_uniform(shader, "treshold"); - uniform_alp = shader_get_uniform(shader, "alphacmp"); - uniform_inv = shader_get_uniform(shader, "inverted"); - uniform_hrd = shader_get_uniform(shader, "hardReplace"); - - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Palette from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ]) + inputs[| 1] = nodeValue("Palette from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ] ) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 2] = nodeValue(2, "Palette to", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) + inputs[| 2] = nodeValue("Palette to", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 3] = nodeValue(3, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Set others to black", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - - inputs[| 5] = nodeValue(5, "Multiply alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - - inputs[| 6] = nodeValue(6, "Hard replace", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - - input_display_list = [0, - ["Palette", false], 1, 2, - ["Comparison", false], 3, 5, - ["Render", false], 4, 6 + input_display_list = [ 0, + ["Palette", false], 1, 2, 3, ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ] ) + .setDisplay(VALUE_DISPLAY.palette); static process_data = function(_outSurf, _data, _output_index, _array_index) { - var fr = _data[1]; - var to = _data[2]; - var tr = _data[3]; - var in = _data[4]; - var alp = _data[5]; - var hrd = _data[6]; + var pal = _data[0]; + var pfr = _data[1]; + var pto = _data[2]; + var thr = _data[3]; + var palo = []; - var _colorFrom = array_create(array_length(fr) * 4); - for(var i = 0; i < array_length(fr); i++) { - _colorFrom[i * 4 + 0] = color_get_red(fr[i]) / 255; - _colorFrom[i * 4 + 1] = color_get_green(fr[i]) / 255; - _colorFrom[i * 4 + 2] = color_get_blue(fr[i]) / 255; - _colorFrom[i * 4 + 3] = 1; + for( var i = 0; i < array_length(pal); i++ ) { + var c = pal[i]; + + var fromValue = 999; + var fromIndex = -1; + for( var j = 0; j < array_length(pfr); j++ ) { + var fr = pfr[j]; + + var dist = color_diff(c, fr); + if(dist <= thr && dist < fromValue) { + fromValue = dist; + fromIndex = j; + } + } + + if(fromIndex == -1) + palo[i] = c; + else + palo[i] = array_safe_get(pto, fromIndex, c, ARRAY_OVERFLOW.loop); } - var _colorTo = array_create(array_length(to) * 4); - for(var i = 0; i < array_length(to); i++) { - _colorTo[i * 4 + 0] = color_get_red(to[i]) / 255; - _colorTo[i * 4 + 1] = color_get_green(to[i]) / 255; - _colorTo[i * 4 + 2] = color_get_blue(to[i]) / 255; - _colorTo[i * 4 + 3] = 1; - } + return palo; + } + + static onDrawNode = function(xx, yy, _mx, _my, _s) { + var bbox = drawGetBbox(xx, yy, _s); + if(bbox.h < 1) return; - surface_set_target(_outSurf); - draw_clear_alpha(0, 0); - BLEND_OVERRIDE - - shader_set(shader); - shader_set_uniform_f_array(uniform_from, _colorFrom); - shader_set_uniform_i(uniform_from_count, array_length(fr)); - shader_set_uniform_i(uniform_alp, alp); - shader_set_uniform_i(uniform_hrd, hrd); - - shader_set_uniform_f_array(uniform_to, _colorTo); - shader_set_uniform_i(uniform_to_count, array_length(to)); - shader_set_uniform_f(uniform_ter, tr); - shader_set_uniform_i(uniform_inv, in); - - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL - surface_reset_target(); - - return _outSurf; + var pal = outputs[| 0].getValue(); + if(array_length(pal) && is_array(pal[0])) return; + drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 6e8fa4d9b..be1b5f5b9 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -2,21 +2,33 @@ function Node_Particle(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _gro name = "Particle"; use_cache = true; - inputs[| input_len + 0] = nodeValue(input_len + 0, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 3].setDisplay(VALUE_DISPLAY.area, function() { return inputs[| input_len + 0].getValue(); }); + + inputs[| input_len + 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| input_len + 1] = nodeValue(input_len + 1, "Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering."); + inputs[| input_len + 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering."); - inputs[| input_len + 2] = nodeValue(input_len + 2, "Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| input_len + 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Additive" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); array_insert(input_display_list, 0, ["Output", true], input_len + 0); array_push(input_display_list, input_len + 1, input_len + 2); def_surface = -1; + static onValueUpdate = function(index = 0) { + if(index == input_len + 0) { + var _dim = inputs[| input_len + 0].getValue(); + var _outSurf = outputs[| 0].getValue(); + + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + outputs[| 0].setValue(_outSurf); + } + } + static onStep = function() { if(!ANIMATOR.frame_progress) return; @@ -25,7 +37,7 @@ function Node_Particle(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _gro return; } - if(!ANIMATOR.is_playing) return; + RETURN_ON_REST if(ANIMATOR.current_frame == 0) { reset(); @@ -45,16 +57,12 @@ function Node_Particle(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _gro outputs[| 0].setValue(_outSurf); surface_set_target(_outSurf); - switch(_blend) { - case PARTICLE_BLEND_MODE.normal : - draw_clear_alpha(c_white, 0); - gpu_set_blendmode(bm_normal); - break; - case PARTICLE_BLEND_MODE.additive : - draw_clear_alpha(c_black, 0); - gpu_set_blendmode(bm_add); - break; - } + draw_clear_alpha(0, 0); + + if(_blend == PARTICLE_BLEND_MODE.normal) + BLEND_OVER_ALPHA; + else if(_blend == PARTICLE_BLEND_MODE.additive) + BLEND_ADD; var surf_w = surface_get_width(_outSurf); var surf_h = surface_get_height(_outSurf); @@ -63,7 +71,7 @@ function Node_Particle(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _gro parts[i].draw(_exact, surf_w, surf_h); } - gpu_set_blendmode(bm_normal); + BLEND_NORMAL; surface_reset_target(); cacheCurrentFrame(_outSurf); diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index f3f4cfe8c..cbc474d50 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -4,14 +4,15 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { w = 96; - - inputs[| 0] = nodeValue(0, "Path progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Path progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 1] = nodeValue(1, "Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 1] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Progress mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, ["Entire line", "Segment"]); + inputs[| 2] = nodeValue("Progress mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, ["Entire line", "Segment"]) + .rejectArray(); input_display_list = [ ["Path", false], 0, 2, 1, @@ -24,21 +25,21 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function createAnchor(_x, _y) { var index = ds_list_size(inputs); - inputs[| index] = nodeValue(index, "Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ _x, _y, 0, 0, 0, 0 ]) + inputs[| index] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ _x, _y, 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); array_push(input_display_list, index); return inputs[| index]; } - outputs[| 0] = nodeValue(0, "Position out", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ]) + outputs[| 0] = nodeValue("Position out", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - outputs[| 1] = nodeValue(1, "Path data", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); + outputs[| 1] = nodeValue("Path data", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); tools = [ - [ "Anchor add / remove (ctrl)", THEME.path_tools_add ], - [ "Edit Control point (shift)", THEME.path_tools_anchor ], + [ "Anchor add / remove (+ Shift)", THEME.path_tools_add ], + [ "Edit Control point", THEME.path_tools_anchor ], [ "Rectangle path", THEME.path_tools_rectangle ], [ "Circle path", THEME.path_tools_circle ], ]; @@ -53,7 +54,7 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { drag_point_sx = 0; drag_point_sy = 0; - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 2) { var type = inputs[| 2].getValue(); if(type == 0) @@ -118,6 +119,12 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { miny = value_snap(miny, _sny); maxy = value_snap(maxy, _sny); + if(key_mod_press(SHIFT)) { + var n = max(maxx - minx, maxy - miny); + maxx = minx + n; + maxy = miny + n; + } + var a = []; for( var i = 0; i < 4; i++ ) a[i] = inputs[| input_fix_len + i].getValue(); @@ -147,6 +154,12 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { miny = value_snap(miny, _sny); maxy = value_snap(maxy, _sny); + if(key_mod_press(SHIFT)) { + var n = max(maxx - minx, maxy - miny); + maxx = minx + n; + maxy = miny + n; + } + var a = []; for( var i = 0; i < 4; i++ ) a[i] = inputs[| input_fix_len + i].getValue(); @@ -187,7 +200,8 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(mouse_release(mb_left)) drag_point = -1; } - + + var line_hover = -1; draw_set_color(COLORS._main_accent); for(var i = loop? 0 : 1; i < ansize; i++) { var _a0 = 0; @@ -207,7 +221,36 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { _nx = _x + p[0] * _s; _ny = _y + p[1] * _s; - if(j) draw_line(_ox, _oy, _nx, _ny); + if(j) { + if((key_mod_press(CTRL) || PANEL_PREVIEW.tool_index == 0) && distance_to_line(_mx, _my, _ox, _oy, _nx, _ny) < 4) + line_hover = i; + } + + _ox = _nx; + _oy = _ny; + } + } + + for(var i = loop? 0 : 1; i < ansize; i++) { + var _a0 = 0; + var _a1 = 0; + + if(i) { + _a0 = inputs[| input_fix_len + i - 1].getValue(); + _a1 = inputs[| input_fix_len + i].getValue(); + } else { + _a0 = inputs[| input_fix_len + ansize - 1].getValue(); + _a1 = inputs[| input_fix_len + 0].getValue(); + } + + var _ox = 0, _oy = 0, _nx = 0, _ny = 0, p = 0; + for(var j = 0; j < sample; j++) { + p = eval_bezier(j / sample, _a0[0], _a0[1], _a1[0], _a1[1], _a0[0] + _a0[4], _a0[1] + _a0[5], _a1[0] + _a1[2], _a1[1] + _a1[3]); + _nx = _x + p[0] * _s; + _ny = _y + p[1] * _s; + + if(j) + draw_line_width(_ox, _oy, _nx, _ny, 1 + 2 * (line_hover == i)); _ox = _nx; _oy = _ny; @@ -261,7 +304,7 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(anchor_hover != -1) { var _a = inputs[| input_fix_len + anchor_hover].getValue(); - if(keyboard_check(vk_shift) || PANEL_PREVIEW.tool_index == 1) { + if(PANEL_PREVIEW.tool_index == 1) { draw_sprite_ui_uniform(THEME.cursor_path_anchor, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { @@ -285,7 +328,7 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { drag_point_sy = _a[1]; } } - } else if(key_mod_press(CTRL) || PANEL_PREVIEW.tool_index == 0) { + } else if(key_mod_press(SHIFT)) { draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { @@ -317,8 +360,16 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { - drag_point = ds_list_size(inputs) - input_fix_len; - createAnchor(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); + var anc = createAnchor(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); + + if(line_hover == -1) { + drag_point = ds_list_size(inputs) - input_fix_len - 1; + } else { + print(line_hover); + ds_list_remove(inputs, anc); + ds_list_insert(inputs, input_fix_len + line_hover, anc); + drag_point = line_hover; + } drag_type = -1; drag_point_mx = _mx; @@ -388,6 +439,8 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } + static getSegmentCount = function() { return array_length(lengths); } + static getSegmentRatio = function(_rat) { var loop = inputs[| 1].getValue(); var ansize = array_length(lengths); @@ -426,7 +479,7 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(ansize == 0) return [0, 0]; - var pix = clamp(_rat, 0, 1) * length_total; + var pix = frac(_rat) * length_total; var _a0, _a1; for(var i = 0; i < ansize; i++) { @@ -446,18 +499,56 @@ function Node_Path(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { return [0, 0]; } - static update = function() { + cache_boundary = [ [0, 0, 1, 1], 0 ]; + static getBoundary = function() { + if(cache_boundary[1] == current_time) + return cache_boundary[0]; + + var minx = 0, miny = 0, maxx = 0, maxy = 0; + + for(var i = input_fix_len; i < ds_list_size(inputs); i++) { + var p = inputs[| i].getValue(); + if(i == input_fix_len) { + minx = p[0]; + miny = p[1]; + maxx = p[0]; + maxy = p[1]; + } else { + minx = min(minx, p[0]); + miny = min(miny, p[1]); + maxx = max(maxx, p[0]); + maxy = max(maxy, p[1]); + } + } + + cache_boundary[0] = [ minx, miny, maxx, maxy ]; + cache_boundary[1] = current_time; + + return cache_boundary[0]; + } + + static update = function(frame = ANIMATOR.current_frame) { updateLength(); var _rat = inputs[| 0].getValue(); var _typ = inputs[| 2].getValue(); - var _out = [0, 0]; - if(_typ == 0) - _out = getPointRatio(_rat); - else if(_typ == 1) - _out = getSegmentRatio(_rat); - - outputs[| 0].setValue(_out); + if(is_array(_rat)) { + var _out = array_create(array_length(_rat)); + + for( var i = 0; i < array_length(_rat); i++ ) { + if(_typ == 0) _out[i] = getPointRatio(_rat[i]); + else if(_typ == 1) _out[i] = getSegmentRatio(_rat[i]); + } + + outputs[| 0].setValue(_out); + } else { + var _out = [0, 0]; + + if(_typ == 0) _out = getPointRatio(_rat); + else if(_typ == 1) _out = getSegmentRatio(_rat); + + outputs[| 0].setValue(_out); + } } static onDrawNode = function(xx, yy, _mx, _my, _s) { diff --git a/scripts/node_perlin/node_perlin.gml b/scripts/node_perlin/node_perlin.gml index 9c1962ce8..f1e1c43ce 100644 --- a/scripts/node_perlin/node_perlin.gml +++ b/scripts/node_perlin/node_perlin.gml @@ -9,29 +9,29 @@ function Node_Perlin(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_bri = shader_get_uniform(shader, "bright"); uniform_sed = shader_get_uniform(shader, "seed"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 5 ]) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 5 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); + inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); - inputs[| 4] = nodeValue(4, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 4] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 5] = nodeValue(5, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); + inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999)); input_display_list = [ - ["Surface", false], 0, 5, + ["Surface", true], 0, 5, ["Noise", false], 1, 2, 3, 4 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; @@ -45,9 +45,9 @@ function Node_Perlin(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, _dim); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_f(uniform_bri, _bri); shader_set_uniform_f(uniform_sed, _sed); shader_set_uniform_i(uniform_ite, _ite); diff --git a/scripts/node_perlin_smear/node_perlin_smear.gml b/scripts/node_perlin_smear/node_perlin_smear.gml index 1048eb62c..375426434 100644 --- a/scripts/node_perlin_smear/node_perlin_smear.gml +++ b/scripts/node_perlin_smear/node_perlin_smear.gml @@ -8,22 +8,22 @@ function Node_Perlin_Smear(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_ite = shader_get_uniform(shader, "iteration"); uniform_bri = shader_get_uniform(shader, "bright"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 6]) + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 6]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 3] = nodeValue(3, "Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3); + inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3); - inputs[| 4] = nodeValue(4, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 4] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _dim = _data[0]; @@ -36,9 +36,9 @@ function Node_Perlin_Smear(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, _dim); - shader_set_uniform_f_array(uniform_pos, _pos); - shader_set_uniform_f_array(uniform_sca, _sca); + shader_set_uniform_f_array_safe(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_pos, _pos); + shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_f(uniform_bri, _bri); shader_set_uniform_i(uniform_ite, _ite); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index 35f696582..5b45528cc 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -1,5 +1,5 @@ function Node_Pin(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { - name = ""; + name = "Pin"; w = 32; h = 32; @@ -10,12 +10,12 @@ function Node_Pin(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { bg_spr = THEME.node_pin_bg; bg_sel_spr = THEME.node_pin_bg_active; - inputs[| 0] = nodeValue(0, "In", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) + inputs[| 0] = nodeValue("In", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; outputs[| 0].type = inputs[| 0].type; outputs[| 0].value_from = inputs[| 0].value_from; @@ -60,9 +60,9 @@ function Node_Pin(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { active_draw_index = -1; } - if(name != "") { + if(display_name != "") { draw_set_text(f_p0, fa_center, fa_bottom, COLORS._main_text); - draw_text_transformed(xx, yy - 12, name, _s, _s, 0); + draw_text_transformed(xx, yy - 12, display_name, _s, _s, 0); } return drawJunctions(_x, _y, _mx, _my, _s); diff --git a/scripts/node_pixel_cloud/node_pixel_cloud.gml b/scripts/node_pixel_cloud/node_pixel_cloud.gml index e13134975..88331b966 100644 --- a/scripts/node_pixel_cloud/node_pixel_cloud.gml +++ b/scripts/node_pixel_cloud/node_pixel_cloud.gml @@ -7,39 +7,46 @@ function Node_Pixel_Cloud(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_dis = shader_get_uniform(shader, "dist"); uniform_map_use = shader_get_uniform(shader, "useMap"); - uniform_map = shader_get_sampler_index(shader, "strengthMap"); + uniform_map = shader_get_sampler_index(shader, "strengthMap"); - uniform_grad_blend = shader_get_uniform(shader, "gradient_blend"); - uniform_grad = shader_get_uniform(shader, "gradient_color"); - uniform_grad_time = shader_get_uniform(shader, "gradient_time"); - uniform_grad_key = shader_get_uniform(shader, "gradient_keys"); + uniform_grad_blend = shader_get_uniform(shader, "gradient_blend"); + uniform_grad = shader_get_uniform(shader, "gradient_color"); + uniform_grad_time = shader_get_uniform(shader, "gradient_time"); + uniform_grad_key = shader_get_uniform(shader, "gradient_keys"); uniform_alpha = shader_get_uniform(shader, "alpha_curve"); + uniform_alamo = shader_get_uniform(shader, "curve_amount"); + uniform_rnd = shader_get_uniform(shader, "randomAmount"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(100000)); + inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(100000)); - inputs[| 2] = nodeValue(2, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [ 0, 2, 0.01]); - inputs[| 3] = nodeValue(3, "Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 3] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 4] = nodeValue(4, "Color ovre lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 4] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 5] = nodeValue(5, "Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 5] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 6] = nodeValue(6, "Alpha over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11) - .setDisplay(VALUE_DISPLAY.curve); + inputs[| 6] = nodeValue("Alpha over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); - input_display_list = [ + inputs[| 7] = nodeValue("Random blending", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + input_display_list = [ 8, ["Input", true], 0, 1, ["Movement", false], 5, 2, 3, - ["Color", true], 4, 6 + ["Color", true], 4, 6, 7 ] - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _sed = _data[1]; @@ -48,23 +55,18 @@ function Node_Pixel_Cloud(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) var _gra = _data[4]; var _gra_data = inputs[| 4].getExtraData(); - var _grad_color = []; - var _grad_time = []; var _dis = _data[5]; var _alp = _data[6]; + var _rnd = _data[7]; - for(var i = 0; i < ds_list_size(_gra); i++) { - _grad_color[i * 4 + 0] = color_get_red(_gra[| i].value) / 255; - _grad_color[i * 4 + 1] = color_get_green(_gra[| i].value) / 255; - _grad_color[i * 4 + 2] = color_get_blue(_gra[| i].value) / 255; - _grad_color[i * 4 + 3] = 1; - _grad_time[i] = _gra[| i].time; - } + var _grad = gradient_to_array(_gra); + var _grad_color = _grad[0]; + var _grad_time = _grad[1]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_sed, _sed); @@ -78,16 +80,18 @@ function Node_Pixel_Cloud(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) } shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); - shader_set_uniform_f_array(uniform_grad, _grad_color); - shader_set_uniform_f_array(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, ds_list_size(_gra)); + shader_set_uniform_f_array_safe(uniform_grad, _grad_color); + shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); + shader_set_uniform_i(uniform_grad_key, array_length(_gra)); - shader_set_uniform_f_array(uniform_alpha, _alp); + shader_set_uniform_f_array_safe(uniform_alpha, _alp); + shader_set_uniform_i(uniform_alamo, array_length(_alp)); + shader_set_uniform_f(uniform_rnd, _rnd); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_pixel_sort/node_pixel_sort.gml b/scripts/node_pixel_sort/node_pixel_sort.gml index 5eabc04ad..1d43b493d 100644 --- a/scripts/node_pixel_sort/node_pixel_sort.gml +++ b/scripts/node_pixel_sort/node_pixel_sort.gml @@ -7,17 +7,30 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c uniform_tre = shader_get_uniform(shader, "threshold"); uniform_dir = shader_get_uniform(shader, "direction"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); + inputs[| 1] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); - inputs[| 2] = nodeValue(2, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation, 90); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 5] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 6] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 6; + + input_display_list = [ 6, + ["Surface", true], 0, 4, 5, + ["Pixel sort", false], 1, 2, 3, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var _in = _data[0]; @@ -31,14 +44,14 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c var sw = surface_get_width(_outSurf); var sh = surface_get_height(_outSurf); - var pp = [ surface_create(sw, sh), surface_create(sw, sh) ]; + var pp = [ surface_create_valid(sw, sh), surface_create_valid(sw, sh) ]; var sBase, sDraw; surface_set_target(pp[1]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(_in, 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); shader_set(shader); @@ -53,24 +66,26 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c surface_set_target(sBase); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set_uniform_f(uniform_itr, i); draw_surface_safe(sDraw, 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } shader_reset(); surface_set_target(_outSurf); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(sBase, 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); surface_free(pp[0]); surface_free(pp[1]); + _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_polar/node_polar.gml b/scripts/node_polar/node_polar.gml index 52571e223..74e1a9ffc 100644 --- a/scripts/node_polar/node_polar.gml +++ b/scripts/node_polar/node_polar.gml @@ -1,22 +1,36 @@ function Node_Polar(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Polar"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 2] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 3, + ["Surface", false], 0, 1, 2, + ] static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_polar); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_posterize/node_posterize.gml b/scripts/node_posterize/node_posterize.gml index 49fb86b88..2e37464c0 100644 --- a/scripts/node_posterize/node_posterize.gml +++ b/scripts/node_posterize/node_posterize.gml @@ -7,25 +7,28 @@ function Node_Posterize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_color = shader_get_uniform(sh_posterize_palette, "palette"); uniform_key = shader_get_uniform(sh_posterize_palette, "keys"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) + inputs[| 1] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_white ]) .setDisplay(VALUE_DISPLAY.palette); - inputs[| 2] = nodeValue(2, "Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 2] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 3] = nodeValue(3, "Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4) + inputs[| 3] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4) .setDisplay(VALUE_DISPLAY.slider, [2, 16, 1]); - inputs[| 4] = nodeValue(4, "Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.6) + inputs[| 4] = nodeValue("Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.6) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - input_display_list = [ + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + input_display_list = [ 5, ["Effect settings", false], 0, 2, 1, ["Auto color", false], 3, 4 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static step = function() { var _use_pal = inputs[| 2].getValue(); @@ -50,16 +53,16 @@ function Node_Posterize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_posterize_palette); - shader_set_uniform_f_array(uniform_color, _colors); + shader_set_uniform_f_array_safe(uniform_color, _colors); shader_set_uniform_i(uniform_key, array_length(_gra)); - + draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } else { var _colors = _data[3]; @@ -67,7 +70,7 @@ function Node_Posterize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_posterize); shader_set_uniform_i(uniform_colors, _colors); @@ -76,7 +79,7 @@ function Node_Posterize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } diff --git a/scripts/node_random/node_random.gml b/scripts/node_random/node_random.gml index 2a491ec4f..45ee1fdd8 100644 --- a/scripts/node_random/node_random.gml +++ b/scripts/node_random/node_random.gml @@ -5,14 +5,15 @@ function Node_Random(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const w = 96; + inputs[| 0] = nodeValue("seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999)); - inputs[| 0] = nodeValue(0, "seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999)); - inputs[| 1] = nodeValue(1, "from", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 2] = nodeValue(2, "to", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 1] = nodeValue("from", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + inputs[| 2] = nodeValue("to", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - function process_data(_output, _data, index = 0) { + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + + function process_data(_output, _data, _output_index, _array_index = 0) { random_set_seed(_data[0]); return random_range(_data[1], _data[2]); } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 18811dbca..94f9df486 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -356,7 +356,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(values, "Texts"); addNodeObject(values, "Text", s_node_text, "Node_String", [1, Node_String]); addNodeObject(values, "Unicode", s_node_unicode, "Node_Unicode", [1, Node_Unicode]); - addNodeObject(values, "Combine Text", s_node_text_combine, "Node_String_Merge", [1, Node_String_Merge]); + addNodeObject(values, "Combine Text", s_node_text_combine, "Node_Stringrte_Merge", [1, Node_String_Merge]); addNodeObject(values, "Join Text", s_node_text_join, "Node_String_Join", [1, Node_String_Join]).set_version(1120); addNodeObject(values, "Split Text", s_node_text_splice, "Node_String_Split", [1, Node_String_Split]); addNodeObject(values, "Trim Text", s_node_text_trim, "Node_String_Trim", [1, Node_String_Trim]).set_version(1080); diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index 3424f4503..ab67b9cfd 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -1,86 +1,86 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Repeat"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, PIXEL_SURFACE ); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); + inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2); - inputs[| 3] = nodeValue(3, "Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Grid", "Circular" ]); - inputs[| 4] = nodeValue(4, "Repeat position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [def_surf_size / 2, 0]) + inputs[| 4] = nodeValue("Repeat position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [def_surf_size / 2, 0]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function() { return getDimension(); }); - inputs[| 5] = nodeValue(5, "Repeat rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) + inputs[| 5] = nodeValue("Repeat rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 6] = nodeValue(6, "Scale multiply", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 6] = nodeValue("Scale multiply", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 7] = nodeValue(7, "Angle range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 360]) + inputs[| 7] = nodeValue("Angle range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 360]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 8] = nodeValue(8, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 8] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 9] = nodeValue(9, "Start position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0]) + inputs[| 9] = nodeValue("Start position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return inputs[| 1].getValue(); }); - inputs[| 10] = nodeValue(10, "Scale over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); + inputs[| 10] = nodeValue("Scale over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); - inputs[| 11] = nodeValue(11, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone, "Make each copy follow along path." ) + inputs[| 11] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone, "Make each copy follow along path." ) .setVisible(true, true); - inputs[| 12] = nodeValue(12, "Path range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1], "Range of the path to follow.") + inputs[| 12] = nodeValue("Path range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1], "Range of the path to follow.") .setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); - inputs[| 13] = nodeValue(13, "Path shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 13] = nodeValue("Path shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 14] = nodeValue(14, "Color over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 14] = nodeValue("Color over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 15] = nodeValue(15, "Alpha over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); + inputs[| 15] = nodeValue("Alpha over copy", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); - inputs[| 16] = nodeValue(16, "Array select", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Whether to select image from an array in order, or at random." ) + inputs[| 16] = nodeValue("Array select", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Whether to select image from an array in order, or at random." ) .setDisplay(VALUE_DISPLAY.enum_button, [ "Order", "Random" ]); - inputs[| 17] = nodeValue(17, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999) ); + inputs[| 17] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999) ); - inputs[| 18] = nodeValue(18, "Column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + inputs[| 18] = nodeValue("Column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); - inputs[| 19] = nodeValue(19, "Column shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, def_surf_size / 2]) + inputs[| 19] = nodeValue("Column shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, def_surf_size / 2]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function() { return getDimension(); }); - inputs[| 20] = nodeValue(20, "Animator midpoint", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 20] = nodeValue("Animator midpoint", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [-1, 2, 0.01]); - inputs[| 21] = nodeValue(21, "Animator range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 21] = nodeValue("Animator range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 22] = nodeValue(22, "Animator position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 22] = nodeValue("Animator position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 23] = nodeValue(23, "Animator rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 23] = nodeValue("Animator rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 24] = nodeValue(24, "Animator scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 24] = nodeValue("Animator scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 25] = nodeValue(25, "Animator falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_10); + inputs[| 25] = nodeValue("Animator falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_10); - inputs[| 26] = nodeValue(26, "Stack", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Place each copy next to each other, taking surface dimension into account.") + inputs[| 26] = nodeValue("Stack", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Place each copy next to each other, taking surface dimension into account.") .setDisplay(VALUE_DISPLAY.enum_button, [ "None", "X", "Y" ]); - inputs[| 27] = nodeValue(27, "Animator blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 27] = nodeValue("Animator blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 28] = nodeValue(28, "Animator alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 28] = nodeValue("Animator alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Surface", true], 0, 1, 16, 17, @@ -112,7 +112,7 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var px = _x + _spos[0] * _s; var py = _y + _spos[1] * _s; - + if(_pat == 0 || _pat == 1) { if(inputs[| 4].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny)) active = false; @@ -122,11 +122,14 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } - static update = function() { + function update(frame = ANIMATOR.current_frame) { var _inSurf = inputs[| 0].getValue(); - var _dim = inputs[| 1].getValue(); - var _amo = inputs[| 2].getValue(); - var _pat = inputs[| 3].getValue(); + if(is_array(_inSurf) && array_length(_inSurf) == 0) return; + if(!is_array(_inSurf) && !is_surface(_inSurf)) return; + + var _dim = inputs[| 1].getValue(); + var _amo = inputs[| 2].getValue(); + var _pat = inputs[| 3].getValue(); var _spos = inputs[| 9].getValue(); @@ -172,12 +175,12 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { inputs[| 19].setVisible( _pat == 1); inputs[| 26].setVisible( _pat == 0); + var runx, runy, posx, posy, scax, scay, rot; + var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); outputs[| 0].setValue(_outSurf); - - var runx, runy, posx, posy, scax, scay, rot; - + surface_set_target(_outSurf); draw_clear_alpha(0, 0); runx = 0; @@ -212,14 +215,14 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { posy = _spos[1] + lengthdir_y(_arad, aa); } - scax = eval_curve_bezier_cubic_x(_msca, i / (_amo - 1)) * _rsca; + scax = eval_curve_x(_msca, i / (_amo - 1)) * _rsca; scay = scax; rot = _rrot[0] + (_rrot[1] - _rrot[0]) * i / (_amo - 1); var _an_dist = abs(i - _an_mid * (_amo - 1)); var _inf = 0; if(_an_dist < _an_ran * _amo) { - _inf = eval_curve_bezier_cubic_x(_an_fal, _an_dist / (_an_ran * _amo)); + _inf = eval_curve_x(_an_fal, _an_dist / (_an_ran * _amo)); posx += _an_pos[0] * _inf; posy += _an_pos[1] * _inf; rot += _an_rot * _inf; @@ -250,7 +253,7 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { var pos = point_rotate(-sw / 2, -sh / 2, 0, 0, rot); var cc = gradient_eval(_grad, i / (_amo - 1), ds_list_get(_grad_data, 0)); - var aa = eval_curve_bezier_cubic_x(_alph, i / (_amo - 1)); + var aa = eval_curve_x(_alph, i / (_amo - 1)); cc = merge_color(cc, colorMultiply(cc, _an_bld), _inf); aa += _an_alp * _inf; @@ -261,5 +264,7 @@ function Node_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { if(_rsta == 2) runy += _sh / 2; } surface_reset_target(); + + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_rigid_activation/node_rigid_activation.gml b/scripts/node_rigid_activation/node_rigid_activation.gml index a4de50af1..0e201ecef 100644 --- a/scripts/node_rigid_activation/node_rigid_activation.gml +++ b/scripts/node_rigid_activation/node_rigid_activation.gml @@ -1,26 +1,28 @@ function Node_Rigid_Activate(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Activate Physics"; + color = COLORS.node_blend_simulation; + icon = THEME.rigidSim; w = 96; min_h = 96; - inputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) + inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Physics activated", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 1] = nodeValue("Physics activated", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, noone); + outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, noone); input_display_list = [ ["Object", true], 0, ["Activate", false], 1, ] - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _obj = inputs[| 0].getValue(); outputs[| 0].setValue(_obj); - if(!ANIMATOR.is_playing) - return; + RETURN_ON_REST var _act = inputs[| 1].getValue(); diff --git a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml index f53633f46..6178ef48f 100644 --- a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml +++ b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml @@ -1,54 +1,98 @@ function Node_Rigid_Force_Apply(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Apply Force"; + color = COLORS.node_blend_simulation; + icon = THEME.rigidSim; w = 96; min_h = 96; - inputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) + inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Force type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Constant", "Impulse", "Torque" ]); + inputs[| 1] = nodeValue("Force type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Constant", "Impulse", "Torque", "Explode" ]) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Torque", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 3] = nodeValue("Torque", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Apply frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Frame index to apply force."); + inputs[| 4] = nodeValue("Apply frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Frame index to apply force.") + .rejectArray(); - inputs[| 5] = nodeValue(5, "Force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 5] = nodeValue("Force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Scope", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Global", "Local" ]); + inputs[| 6] = nodeValue("Scope", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Global", "Local" ]) + .rejectArray(); + + inputs[| 7] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 16, 0.01]) + .rejectArray(); + + inputs[| 8] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 8) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, noone); + outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, noone); input_display_list = [ ["Object", true], 0, - ["Force", false], 1, 6, 4, 2, 3, 5 + ["Force", false], 1, 6, 4, 2, 3, 5, 8, 7, ] static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var _typ = inputs[| 1].getValue(); - - inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + var _pos = inputs[| 2].getValue(); + var px = _x + _pos[0] * _s; + var py = _y + _pos[1] * _s; + + if(_typ == 0 || _typ == 1) { + var _for = inputs[| 5].getValue(); + + var fx = px + _for[0] * 10 * _s; + var fy = py + _for[1] * 10 * _s; + + draw_set_color(COLORS._main_accent); + draw_set_alpha(0.5); + draw_line_width2(px, py, fx, fy, 8, 2); + draw_set_alpha(1); + + inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| 5].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, THEME.anchor, 10); + } else if(_typ == 3) { + var _rad = inputs[| 8].getValue(); + + draw_set_color(COLORS._main_accent); + draw_set_alpha(0.5); + draw_circle(px, py, _rad * _s, 1); + draw_set_alpha(1); + + inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + inputs[| 8].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); + } else + inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } static step = function() { var _typ = inputs[| 1].getValue(); inputs[| 3].setVisible(_typ == 2); - inputs[| 4].setVisible(_typ == 1 || _typ == 2); + inputs[| 4].setVisible(_typ > 0); inputs[| 5].setVisible(_typ == 0 || _typ == 1); + inputs[| 6].setVisible(_typ != 3); + inputs[| 7].setVisible(_typ == 3); + inputs[| 8].setVisible(_typ == 3); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _obj = inputs[| 0].getValue(); outputs[| 0].setValue(_obj); - if(!ANIMATOR.is_playing) - return; + RETURN_ON_REST var _typ = inputs[| 1].getValue(); @@ -57,8 +101,10 @@ function Node_Rigid_Force_Apply(_x, _y, _group = -1) : Node(_x, _y, _group) cons var _frm = inputs[| 4].getValue(); var _for = inputs[| 5].getValue(); var _sco = inputs[| 6].getValue(); + var _str = inputs[| 7].getValue(); + var _rad = inputs[| 8].getValue(); - if((_typ == 1 || _typ == 2) && ANIMATOR.current_frame != _frm) + if((_typ > 0) && ANIMATOR.current_frame != _frm) return; if(!is_array(_obj)) _obj = [ _obj ]; @@ -83,6 +129,17 @@ function Node_Rigid_Force_Apply(_x, _y, _group = -1) : Node(_x, _y, _group) cons physics_apply_local_impulse(_pos[0], _pos[1], _for[0], _for[1]); else if(_typ == 2) physics_apply_torque(_tor); + else if(_typ == 3) { + var dir = point_direction(_pos[0], _pos[1], phy_com_x, phy_com_y); + var dis = point_distance(_pos[0], _pos[1], phy_com_x, phy_com_y); + + if(dis < _rad) { + var str = _str * sqr(1 - dis / _rad); + var fx = lengthdir_x(str, dir); + var fy = lengthdir_y(str, dir); + physics_apply_impulse(_pos[0], _pos[1], fx, fy); + } + } } } } diff --git a/scripts/node_rigid_global/node_rigid_global.gml b/scripts/node_rigid_global/node_rigid_global.gml index fad9e6571..a2f0ff601 100644 --- a/scripts/node_rigid_global/node_rigid_global.gml +++ b/scripts/node_rigid_global/node_rigid_global.gml @@ -7,16 +7,15 @@ function Node_Rigid_Global(_x, _y, _group = -1) : Node(_x, _y, _group) construct object = noone; - inputs[| 0] = nodeValue(0, "Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ]) + inputs[| 0] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ]) .setDisplay(VALUE_DISPLAY.vector); current_gra = [0, 0]; - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _gra = inputs[| 0].getValue(); - var _sim = inputs[| 1].getValue(); - if(current_gra[0] != _gra[0] || current_gra[1] != _gra[1]) { + if(current_gra[0] != array_safe_get(_gra, 0) || current_gra[1] != array_safe_get(_gra, 1)) { physics_world_gravity(_gra[0], _gra[1]); current_gra[0] = _gra[0]; diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index 5082f766d..3c7835584 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -1,32 +1,42 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Object"; + color = COLORS.node_blend_simulation; + icon = THEME.rigidSim; w = 96; min_h = 96; object = []; - inputs[| 0] = nodeValue(0, "Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 0] = nodeValue("Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Weight", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5); + inputs[| 1] = nodeValue("Weight", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Contact friction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); + inputs[| 2] = nodeValue("Contact friction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Air resistance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); + inputs[| 3] = nodeValue("Air resistance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Rotation resistance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2); + inputs[| 4] = nodeValue("Rotation resistance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Box", "Circle", "Custom" ]); + inputs[| 5] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Box", "Circle", "Custom" ]) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, PIXEL_SURFACE) + inputs[| 6] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone) + .rejectArray(); - inputs[| 7] = nodeValue(7, "Start shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) + inputs[| 7] = nodeValue("Start shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area); inputs[| 7].editWidget.adjust_shape = false; - inputs[| 8] = nodeValue(8, "Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Make object spawn when start."); + inputs[| 8] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Make object spawn when start.") + .rejectArray(); - inputs[| 9] = nodeValue(9, "Generate mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 9] = nodeValue("Generate mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { var _tex = inputs[| 6].getValue(); if(is_array(_tex)) { @@ -37,9 +47,10 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) construct update(); }, "Generate"] ); - inputs[| 10] = nodeValue(10, "Mesh expansion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 10] = nodeValue("Mesh expansion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); + outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, self); input_display_list = [ 8, ["Texture", false], 6, @@ -291,7 +302,7 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) construct var uni_com = shader_get_uniform(sh_mesh_generation, "com"); var uni_dim = shader_get_uniform(sh_mesh_generation, "dimension"); - var temp = surface_create(ww, hh); + var temp = surface_create_valid(ww, hh); surface_set_target(temp); draw_clear_alpha(0, 0); @@ -479,7 +490,7 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) construct } } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index == 5) { var _spos = inputs[| 7].getValue(); var _shape = inputs[| 5].getValue(); @@ -597,7 +608,6 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) construct var fixture = physics_fixture_create(); physics_fixture_set_polygon_shape(fixture); - print(index); for( var i = 0; i < len; i++ ) { var _px0 = fxList[| i]; var _py0 = fyList[| i]; @@ -649,7 +659,7 @@ function Node_Rigid_Object(_x, _y, _group = -1) : Node(_x, _y, _group) construct return object; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { if(ANIMATOR.current_frame == 0) return; if(!isAnimated()) return; 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 2eb258260..61c637cac 100644 --- a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml +++ b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml @@ -1,28 +1,36 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Object Spawner"; + color = COLORS.node_blend_simulation; + icon = THEME.rigidSim; w = 96; min_h = 96; object = []; - inputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) + inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) - .setDisplay(VALUE_DISPLAY.area); + inputs[| 1] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, AREA_DEF) + .setDisplay(VALUE_DISPLAY.area) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Spawn type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Stream", "Burst" ]); + inputs[| 2] = nodeValue("Spawn type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Stream", "Burst" ]) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + inputs[| 3] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + inputs[| 4] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Spawn frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 5] = nodeValue("Spawn frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .rejectArray(); - inputs[| 6] = nodeValue(6, "Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 6] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, self); + outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, self); input_display_list = [ 0, ["Spawn", false], 6, 1, 2, 3, 5, 4, @@ -61,9 +69,8 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = -1) : Node(_x, _y, _group) c } } - static update = function() { - if(!ANIMATOR.is_playing) - return; + static update = function(frame = ANIMATOR.current_frame) { + RETURN_ON_REST var _obj = inputs[| 0].getValue(); if(_obj == noone) return; @@ -86,6 +93,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = -1) : Node(_x, _y, _group) c var _obj = inputs[| 0].getValue(); if(_obj == noone) return; + if(is_array(_obj)) return; var _tex = _obj.inputs[| 6].getValue(); var _spos = _obj.inputs[| 7].getValue(); diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 01e34f926..3f5fdaab1 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -1,18 +1,20 @@ function Node_Rigid_Render(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Render"; + color = COLORS.node_blend_simulation; icon = THEME.rigidSim; - inputs[| 0] = nodeValue(0, "Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, def_surf_size2) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 0] = nodeValue("Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, def_surf_size2) + .setDisplay(VALUE_DISPLAY.vector) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); data_length = 1; input_fix_len = ds_list_size(inputs); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone ) + inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone ) .setVisible(true, true); } if(!LOADING && !APPENDING) createNewInput(); @@ -42,7 +44,7 @@ function Node_Rigid_Render(_x, _y, _group = -1) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _dim = inputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -67,7 +69,15 @@ function Node_Rigid_Render(_x, _y, _group = -1) : Node(_x, _y, _group) construct if(_o == noone || !instance_exists(_o)) continue; if(is_undefined(_o.phy_active)) continue; - draw_surface_ext_safe(_o.surface, _o.phy_position_x, _o.phy_position_y, _o.image_xscale, _o.image_yscale, _o.image_angle); + var ixs = max(0, _o.image_xscale); + var iys = max(0, _o.image_yscale); + var xs = max(0, _o.xscale); + var ys = max(0, _o.yscale); + + var xx = lerp(_o.phy_com_x, _o.phy_position_x, xs); + var yy = lerp(_o.phy_com_y, _o.phy_position_y, ys); + + draw_surface_ext_safe(_o.surface, xx, yy, ixs * xs, iys * ys, _o.image_angle, _o.image_blend, _o.image_alpha); } } } diff --git a/scripts/node_rigid_sim/node_rigid_sim.gml b/scripts/node_rigid_sim/node_rigid_sim.gml index 1d1a52fa4..6f97081a3 100644 --- a/scripts/node_rigid_sim/node_rigid_sim.gml +++ b/scripts/node_rigid_sim/node_rigid_sim.gml @@ -32,8 +32,7 @@ function Node_Rigid_Group(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) } static onStep = function() { - if(!ANIMATOR.is_playing) - return; + RETURN_ON_REST if(ANIMATOR.current_frame == 0) reset(); diff --git a/scripts/node_scale/node_scale.gml b/scripts/node_scale/node_scale.gml index e2e963803..fd735dca8 100644 --- a/scripts/node_scale/node_scale.gml +++ b/scripts/node_scale/node_scale.gml @@ -1,19 +1,23 @@ function Node_Scale(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Scale"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 1] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY._default, 0.01); - inputs[| 2] = nodeValue(2, "Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Upscale", "Scale to fit" ]); - inputs[| 3] = nodeValue(3, "Target dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, def_surf_size2) + inputs[| 3] = nodeValue("Target dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 4; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - input_display_list = [ + input_display_list = [ 4, ["Surface", true], 0, ["Scale", false], 2, 1, 3, ]; @@ -42,9 +46,9 @@ function Node_Scale(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_stretched_safe(_data[0], 0, 0, ww, hh); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_scale_algo/node_scale_algo.gml b/scripts/node_scale_algo/node_scale_algo.gml index 631d7bcc2..95c158d94 100644 --- a/scripts/node_scale_algo/node_scale_algo.gml +++ b/scripts/node_scale_algo/node_scale_algo.gml @@ -13,15 +13,23 @@ function Node_create_Scale_Algo(_x, _y, _group = -1, _param = "") { function Node_Scale_Algo(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Scale Algorithm"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Scale2x", "Scale3x" ]); - inputs[| 2] = nodeValue(2, "Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 3, + ["Surface", false], 0, + ["Scale", false], 1, 2, + ] static process_data = function(_outSurf, _data, _output_index, _array_index) { var inSurf = _data[0]; @@ -53,18 +61,18 @@ function Node_Scale_Algo(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var uniform_dim = shader_get_uniform(shader, "dimension"); var uniform_tol = shader_get_uniform(shader, "tol"); shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ ww, hh ]); + shader_set_uniform_f_array_safe(uniform_dim, [ ww, hh ]); shader_set_uniform_f(uniform_tol, _data[2]); draw_surface_ext_safe(_data[0], 0, 0, sc, sc, 0, c_white, 1); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 53b83edbf..a0766829e 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -1,63 +1,85 @@ function Node_Scatter(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Scatter"; + dimension_index = 1; - shader = sh_blend_normal_dim; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_pos = shader_get_uniform(shader, "position"); - uniform_sca = shader_get_uniform(shader, "scale"); - uniform_rot = shader_get_uniform(shader, "rotation"); - uniform_for = shader_get_sampler_index(shader, "fore"); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8); + inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8); - inputs[| 3] = nodeValue(3, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) + inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) .setDisplay(VALUE_DISPLAY.vector_range); - inputs[| 4] = nodeValue(4, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) + inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 5] = nodeValue(5, "Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) + inputs[| 5] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, function() { return inputs[| 1].getValue(); }); - inputs[| 6] = nodeValue(6, "Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Area", "Border" ]); + inputs[| 6] = nodeValue("Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data" ]); - inputs[| 7] = nodeValue(7, "Point at center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Rotate each copy to face the spawn center."); + inputs[| 7] = nodeValue("Point at center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Rotate each copy to face the spawn center."); - inputs[| 8] = nodeValue(8, "Uniform scaling", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 8] = nodeValue("Uniform scaling", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 9] = nodeValue(9, "Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 9] = nodeValue("Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random" ]); - inputs[| 10] = nodeValue(10, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999)); + inputs[| 10] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999)); - inputs[| 11] = nodeValue(11, "Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 11] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 12] = nodeValue(12, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 12] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]); + + inputs[| 13] = nodeValue("Distribution map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 14] = nodeValue("Distribution data", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, []) + .setDisplay(VALUE_DISPLAY.vector); - input_display_list = [ 0, 1, 10, - ["Scatter", false], 5, 6, 9, 2, + inputs[| 15] = nodeValue("Array surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Spread output", "Mixed" ]); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ + ["Surface", false], 0, 1, 15, 10, + ["Scatter", false], 5, 6, 13, 14, 9, 2, ["Transform", false], 3, 8, 7, 4, ["Render", false], 11, 12 ]; - temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ]; + temp_surf = [ surface_create(1, 1), surface_create(1, 1) ]; static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } + static onValueUpdate = function(index) { + if(index == 15) { + var _arr = inputs[| 15].getValue(); + inputs[| 0].force_array = _arr; + + doUpdate(); + } + } + + static step = function() { + var _dis = inputs[| 6].getValue(); + var _arr = inputs[| 15].getValue(); + inputs[| 0].force_array = _arr; + + inputs[| 13].setVisible(_dis == 2, _dis == 2); + inputs[| 14].setVisible(_dis == 3, _dis == 3); + inputs[| 9].setVisible(_dis != 2); + } + static process_data = function(_outSurf, _data, _output_index, _array_index) { - var _inSurf = _data[0], surf; + var _inSurf = _data[0]; if(_inSurf == 0) return; @@ -68,89 +90,87 @@ function Node_Scatter(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons var _area = _data[5]; - var _dist = _data[6]; - var _scat = _data[9]; + var _dist = _data[ 6]; + var _distMap = _data[13]; + var _distData = _data[14]; + var _scat = _data[ 9]; var _pint = _data[7]; var _unis = _data[8]; var seed = _data[10]; - var color = inputs[| 11].getValue(); + var color = _data[11]; var _bldTyp = inputs[| 11].getExtraData(); var alpha = _data[12]; var _in_w, _in_h; - - _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); - var ww = surface_get_width(_outSurf); - var hh = surface_get_height(_outSurf); - - for(var i = 0; i < 2; i++) { - temp_surf[i] = surface_verify(temp_surf[i], ww, hh); - - surface_set_target(temp_surf[i]); - draw_clear_alpha(0, 0); - surface_reset_target(); - } - - BLEND_OVERRIDE - var _sed = seed; - var res_index = 0, bg = 0; - for(var i = 0; i < _amount; i++) { - var sp = area_get_random_point(_area, _dist, _scat, i, _amount, _sed); _sed += 20; - var _x = sp[0]; - var _y = sp[1]; - - var _scx = random_range_seed(_scale[0], _scale[1], _sed); _sed++; - var _scy = random_range_seed(_scale[2], _scale[3], _sed); _sed++; - if(_unis) _scy = _scx; - - var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + random_range_seed(_rota[0], _rota[1], _sed); _sed++; - - surf = _inSurf; - if(is_array(_inSurf)) - surf = _inSurf[irandom_seed(array_length(_inSurf) - 1, _sed)]; _sed++; - - var sw = surface_get_width(surf); - var sh = surface_get_height(surf); - - if(_dist != AREA_DISTRIBUTION.area || _scat != AREA_SCATTER.uniform) { - _x -= sw / 2; - _y -= sh / 2; - } - - var clr = gradient_eval(color, random_seed(1, _sed), _bldTyp[| 0]); _sed++; - var alp = random_range_seed(alpha[0], alpha[1], _sed); _sed++; - - surface_set_target(temp_surf[bg]); - shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ sw / ww, sh / hh ]); - shader_set_uniform_f_array(uniform_pos, [ _x / ww, _y / hh]); - shader_set_uniform_f_array(uniform_sca, [ _scx, _scy ]) - shader_set_uniform_f(uniform_rot, degtorad(_r)); - texture_set_stage(uniform_for, surface_get_texture(surf)); - - draw_surface_ext_safe(temp_surf[!bg], 0, 0, 1, 1, 0, clr, alp); - shader_reset(); - surface_reset_target(); - - res_index = bg; - bg = !bg; - } - BLEND_NORMAL + var _posDist = []; + if(_dist == 2 && is_surface(_distMap)) + _posDist = get_points_from_dist(_distMap, _amount); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVER_ALPHA; + var _sed = seed; + var res_index = 0, bg = 0; + for(var i = 0; i < _amount; i++) { + var sp = noone, _x = 0, _y = 0; - draw_surface_safe(temp_surf[res_index], 0, 0); + if(_dist < 2) { + sp = area_get_random_point(_area, _dist, _scat, i, _amount, _sed); _sed += 20; + _x = sp[0]; + _y = sp[1]; + } else if(_dist == 2) { + sp = array_safe_get(_posDist, i); + if(!is_array(sp)) continue; + + _x = _area[0] + _area[2] * (sp[0] * 2 - 1.); + _y = _area[1] + _area[3] * (sp[1] * 2 - 1.); + } else if(_dist == 3) { + sp = array_safe_get(_distData, i); + if(!is_array(sp)) continue; + + _x = sp[0]; + _y = sp[1]; + } - BLEND_NORMAL + var _scx = random_range_seed(_scale[0], _scale[1], _sed); _sed++; + var _scy = random_range_seed(_scale[2], _scale[3], _sed); _sed++; + if(_unis) _scy = _scx; + + var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + random_range_seed(_rota[0], _rota[1], _sed); _sed++; + + var surf = _inSurf; + if(is_array(_inSurf)) + surf = _inSurf[irandom_seed(array_length(_inSurf) - 1, _sed)]; _sed++; + + var sw = surface_get_width(surf); + var sh = surface_get_height(surf); + + if(_dist != AREA_DISTRIBUTION.area || _scat != AREA_SCATTER.uniform) { + var p = point_rotate(-sw / 2 * _scx, -sh * _scy / 2, 0, 0, _r); + _x += p[0]; + _y += p[1]; + } + + var clr = gradient_eval(color, random_seed(1, _sed), _bldTyp[| 0]); _sed++; + var alp = random_range_seed(alpha[0], alpha[1], _sed); _sed++; + + draw_surface_ext_safe(surf, _x, _y, _scx, _scy, _r, clr, alp); + //print(string(_x) + ", " + string(_y)) + } + BLEND_NORMAL; surface_reset_target(); return _outSurf; } + static doApplyDeserialize = function() { + var _arr = inputs[| 15].getValue(); + inputs[| 0].force_array = _arr; + + doUpdate(); + } } \ No newline at end of file diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index 10adac39b..301394f35 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -5,41 +5,49 @@ enum NODE_SEP_SHAPE_OUTPUT_TYPE { function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Separate Shape"; + error_update_enabled = true; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) - .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + inputs[| 1] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 2] = nodeValue("Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) + .rejectArray(); - inputs[| 3] = nodeValue(3, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 3] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Ignore blank", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Skip empty and black shape."); + inputs[| 4] = nodeValue("Ignore blank", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Skip empty and black shape.") + .rejectArray(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue(1, "Shape map", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 1] = nodeValue("Shape map", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 2] = nodeValue(2, "Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []); + outputs[| 2] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []); input_display_list = [ ["Shape", false], 0, 1, 4, ["Render", false], 2, 3, ] - temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ]; + temp_surf = [ surface_create(1, 1), surface_create(1, 1) ]; surface_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2); + surface_w = 1; + surface_h = 1; - function get_color_buffer(_x, _y, w, h) { - buffer_seek(surface_buffer, buffer_seek_start, (w * _y + _x) * 4); + function get_color_buffer(_x, _y) { + buffer_seek(surface_buffer, buffer_seek_start, (surface_w * _y + _x) * 4); var c = buffer_read(surface_buffer, buffer_u32); return c; } _prev_type = -1; - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var _inSurf = inputs[| 0].getValue(); var _thres = inputs[| 1].getValue(); var _ovr = inputs[| 2].getValue(); @@ -51,7 +59,9 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru var ww = surface_get_width(_inSurf); var hh = surface_get_height(_inSurf); - + surface_w = ww; + surface_h = hh; + for(var i = 0; i < 2; i++) { temp_surf[i] = surface_verify(temp_surf[i], ww, hh); @@ -71,7 +81,8 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_ite, "ignore"), _ignore); shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_ite, "dimension"), ww, hh); shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_ite, "threshold"), _thres); - texture_set_stage(shader_get_sampler_index(sh_seperate_shape_ite, "map"), surface_get_texture(_inSurf)); + if(is_surface(_inSurf)) + texture_set_stage(shader_get_sampler_index(sh_seperate_shape_ite, "map"), surface_get_texture(_inSurf)); var res_index = 0, iteration = ww + hh; for(var i = 0; i <= iteration; i++) { @@ -80,9 +91,9 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru surface_set_target(temp_surf[bg]); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(temp_surf[fg], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); res_index = bg; @@ -93,15 +104,15 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru var _pixel_surface = surface_create_valid(PREF_MAP[? "shape_separation_max"], 1); surface_set_target(_pixel_surface); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_seperate_shape_counter); texture_set_stage(shader_get_sampler_index(sh_seperate_shape_counter, "surface"), surface_get_texture(temp_surf[res_index])); - shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]); + shader_set_uniform_f_array_safe(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]); shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "maxShape"), PREF_MAP[? "shape_separation_max"]); shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "ignore"), _ignore); draw_sprite_ext(s_fx_pixel, 0, 0, 0, PREF_MAP[? "shape_separation_max"], 1, 0, c_white, 1); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); var px = surface_getpixel(_pixel_surface, 0, 0); @@ -124,7 +135,7 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(sh_seperate_shape_sep); var ccx = surface_getpixel_ext(_pixel_surface, 1 + i, 0); var alpha = (ccx >> 24) & 255; @@ -143,7 +154,7 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru for( var j = min_x; j < max_x; j++ ) for( var k = min_y; k < max_y; k++ ) { - var _sc = get_color_buffer(j, k, ww, hh); + var _sc = get_color_buffer(j, k); if(_sc != ccx) continue; t = min(t, k); @@ -154,16 +165,17 @@ function Node_Seperate_Shape(_x, _y, _group = -1) : Node(_x, _y, _group) constru _boundary[i] = [l, t, r, b]; - texture_set_stage(shader_get_sampler_index(sh_seperate_shape_sep, "original"), surface_get_texture(_inSurf)); + if(is_surface(_inSurf)) + texture_set_stage(shader_get_sampler_index(sh_seperate_shape_sep, "original"), surface_get_texture(_inSurf)); shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_sep, "color"), red, green, blue, alpha); shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_sep, "override"), _ovr); - shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_sep, "overColor"), colToVec4(_ovrclr)); + shader_set_uniform_f_array_safe(shader_get_uniform(sh_seperate_shape_sep, "overColor"), colToVec4(_ovrclr)); draw_surface_safe(temp_surf[res_index], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } - outputs[| 2].setValue(_boundary); + outputs[| 2].setValue(_boundary,,, false); } } \ No newline at end of file diff --git a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml index 371b8a94a..edaa0ff6a 100644 --- a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml +++ b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml @@ -2,12 +2,14 @@ function Node_Sequence_Anim(_x, _y, _group = -1) : Node(_x, _y, _group) construc name = "Array to Anim"; update_on_frame = true; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 1] = nodeValue("Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .rejectArray(); - static update = function() { + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + static update = function(frame = ANIMATOR.current_frame) { var seq = inputs[| 0].getValue(); var spd = inputs[| 1].getValue(); @@ -16,7 +18,7 @@ function Node_Sequence_Anim(_x, _y, _group = -1) : Node(_x, _y, _group) construc return; } - var frame = safe_mod(floor(ANIMATOR.current_frame / spd), array_length(seq)); - outputs[| 0].setValue(seq[frame]); + var _frame = safe_mod(floor(ANIMATOR.current_frame / spd), array_length(seq)); + outputs[| 0].setValue(seq[_frame]); } } \ No newline at end of file diff --git a/scripts/node_shadow/node_shadow.gml b/scripts/node_shadow/node_shadow.gml index 6436b3fc7..b2ae6bd30 100644 --- a/scripts/node_shadow/node_shadow.gml +++ b/scripts/node_shadow/node_shadow.gml @@ -6,28 +6,39 @@ function Node_Shadow(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_size = shader_get_uniform(shader, "borderSize"); uniform_colr = shader_get_uniform(shader, "borderColor"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 2] = nodeValue(2, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5) + inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 2, 0.01]); - inputs[| 3] = nodeValue(3, "Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 4, 4 ]) + inputs[| 3] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 4, 4 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Grow", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 4] = nodeValue("Grow", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 1]); - inputs[| 5] = nodeValue(5, "Blur", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 5] = nodeValue("Blur", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 1]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ 0, + inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 8, + ["Surface", true], 0, 6, 7, ["Shadow", false], 1, 2, 3, 4, 5, ]; + surface_blur_init(); + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var _surf = outputs[| 0].getValue(); if(is_array(_surf)) { @@ -52,29 +63,28 @@ function Node_Shadow(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const surface_set_target(pass1); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); shader_set_uniform_f(uniform_size, _border); - shader_set_uniform_f_array(uniform_colr, [1., 1., 1., 1.0]); + shader_set_uniform_f_array_safe(uniform_colr, [1., 1., 1., 1.0]); draw_surface_safe(_data[0], _shf[0], _shf[1]); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); - pass1 = surface_apply_gaussian(pass1, _size, false, cl); - surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE - draw_surface_ext_safe(pass1, 0, 0, 1, 1, 0, cl, _stre); - BLEND_NORMAL + BLEND_OVERRIDE; + draw_surface_ext_safe(surface_apply_gaussian(pass1, _size, false, cl), 0, 0, 1, 1, 0, cl, _stre); + BLEND_NORMAL; draw_surface_safe(_data[0], 0, 0); surface_reset_target(); - surface_free(pass1); + _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_shadow_cast/node_shadow_cast.gml b/scripts/node_shadow_cast/node_shadow_cast.gml index 611798ca3..2a824eb99 100644 --- a/scripts/node_shadow_cast/node_shadow_cast.gml +++ b/scripts/node_shadow_cast/node_shadow_cast.gml @@ -26,11 +26,11 @@ function Node_Shadow_Cast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) uniform_sld_use = shader_get_uniform(shader, "useSolid"); uniform_solid = shader_get_sampler_index(shader, "solid"); - inputs[| 0] = nodeValue(0, "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Solid", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Solid", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 2] = nodeValue(2, "Light Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 2] = nodeValue("Light Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { var _surf = inputs[| 0].getValue(); @@ -46,49 +46,52 @@ function Node_Shadow_Cast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) return [surface_get_width(_surf), surface_get_height(_surf)]; }, VALUE_UNIT.reference); - inputs[| 3] = nodeValue(3, "Soft light radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 3] = nodeValue("Soft light radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 2, 0.01]); - inputs[| 4] = nodeValue(4, "Light density", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 4] = nodeValue("Light density", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 1]); - inputs[| 5] = nodeValue(5, "Light type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 5] = nodeValue("Light type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Point", "Sun"]); - inputs[| 6] = nodeValue(6, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); + inputs[| 6] = nodeValue("Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); - inputs[| 7] = nodeValue(7, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 7] = nodeValue("Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 8] = nodeValue(8, "Light radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); + inputs[| 8] = nodeValue("Light radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); - inputs[| 9] = nodeValue(9, "Render solid", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 9] = nodeValue("Render solid", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 10] = nodeValue(10, "Use BG color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "If checked, BG color will be used as shadow caster."); + inputs[| 10] = nodeValue("Use BG color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "If checked, BG color will be used as shadow caster."); - inputs[| 11] = nodeValue(11, "BG threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 11] = nodeValue("BG threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 12] = nodeValue(12, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 12] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [0, 2, 0.01]); - inputs[| 13] = nodeValue(13, "Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 13] = nodeValue("Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 1]); - inputs[| 14] = nodeValue(14, "Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.") + inputs[| 14] = nodeValue("Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.") .setDisplay(VALUE_DISPLAY.enum_scroll, ["Quadratic", "Invert quadratic", "Linear"]); - inputs[| 15] = nodeValue(15, "Ambient occlusion", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 15] = nodeValue("Ambient occlusion", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 16, 1]); - inputs[| 16] = nodeValue(16, "Ambient occlusion strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 16] = nodeValue("Ambient occlusion strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 0.2, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 17] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 17; - outputs[| 1] = nodeValue(1, "Light mask", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - input_display_list = [ - ["Surface", false], 0, 1, + outputs[| 1] = nodeValue("Light mask", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 17, + ["Surface", true], 0, 1, ["Light", false], 5, 12, 8, 2, 3, 4, ["Shadow caster", false], 10, 11, ["Render", false], 13, 14, 7, 6, 9, 15, 16, @@ -134,13 +137,13 @@ function Node_Shadow_Cast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_bg), surface_get_height(_bg)); - shader_set_uniform_f_array(uniform_lpos, _pos); - shader_set_uniform_f_array(uniform_lamb, colToVec4(_lamb)); - shader_set_uniform_f_array(uniform_lclr, colToVec4(_lclr)); + shader_set_uniform_f_array_safe(uniform_lpos, _pos); + shader_set_uniform_f_array_safe(uniform_lamb, colToVec4(_lamb)); + shader_set_uniform_f_array_safe(uniform_lclr, colToVec4(_lclr)); shader_set_uniform_f(uniform_lrad, _rad); shader_set_uniform_f(uniform_prad, _lrad); shader_set_uniform_f(uniform_lden, _den); @@ -163,7 +166,7 @@ function Node_Shadow_Cast(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) draw_surface_safe(_bg, 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_simple_shape/node_simple_shape.gml b/scripts/node_simple_shape/node_simple_shape.gml index 9467938a6..4d5f11a02 100644 --- a/scripts/node_simple_shape/node_simple_shape.gml +++ b/scripts/node_simple_shape/node_simple_shape.gml @@ -30,54 +30,59 @@ function Node_Shape(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_stRad = shader_get_uniform(shader, "stRad"); uniform_edRad = shader_get_uniform(shader, "edRad"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Backgroud", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 1] = nodeValue("Backgroud", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 2] = nodeValue(2, "Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Rectangle", "Ellipse", "Regular polygon", "Star", "Arc", "Teardrop", "Cross", "Leaf" ]); - inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) + inputs[| 3] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, def_surf_size / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, function() { return inputs[| 0].getValue(); }); - inputs[| 4] = nodeValue(4, "Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3) + inputs[| 4] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3) .setVisible(false); - inputs[| 5] = nodeValue(5, "Inner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 5] = nodeValue("Inner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(false); - inputs[| 6] = nodeValue(6, "Anti alising", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 6] = nodeValue("Anti alising", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 7] = nodeValue(7, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 7] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 8] = nodeValue(8, "Angle range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 180 ]) + inputs[| 8] = nodeValue("Angle range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 180 ]) .setDisplay(VALUE_DISPLAY.rotation_range); - inputs[| 9] = nodeValue(9, "Corner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 9] = nodeValue("Corner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 0.5, 0.01]); - inputs[| 10] = nodeValue(10, "Shape color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 10] = nodeValue("Shape color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 11] = nodeValue(11, "Background color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 11] = nodeValue("Background color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 12] = nodeValue(12, "Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 12] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 13] = nodeValue(13, "Start radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) + inputs[| 13] = nodeValue("Start radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setVisible(false); - - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + + inputs[| 14] = nodeValue("Shape path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone) + .setVisible(true, true); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Surface", false], 0, 6, - ["Shape", false], 2, 3, 9, 4, 13, 5, 7, 8, - ["Render", true], 10, 1, 11, 12 + ["Shape", false], 2, 14, 3, 9, 4, 13, 5, 7, 8, + ["Render", true], 10, 1, 11, 12 ]; static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + var _path = inputs[| 14].getValue(); + if(_path != noone && struct_has(_path, "getPointRatio")) return; inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } @@ -90,12 +95,68 @@ function Node_Shape(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr var _corner = _data[9]; var _color = _data[10]; var _df = _data[12]; + var _path = _data[14]; var _bgcol = _bg? colToVec4(_data[11]) : [0, 0, 0, 0]; inputs[| 11].setVisible(_bg); + inputs[| 3].setVisible(true); + inputs[| 9].setVisible(true); + inputs[| 4].setVisible(true); + inputs[| 13].setVisible(true); + inputs[| 5].setVisible(true); + inputs[| 7].setVisible(true); + inputs[| 8].setVisible(true); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + if(_path != noone && struct_has(_path, "getPointRatio")) { + inputs[| 3].setVisible(false); + inputs[| 9].setVisible(false); + inputs[| 4].setVisible(false); + inputs[| 13].setVisible(false); + inputs[| 5].setVisible(false); + inputs[| 7].setVisible(false); + inputs[| 8].setVisible(false); + + surface_set_target(_outSurf); + if(_bg) draw_clear_alpha(0, 1); + else draw_clear_alpha(0, 0); + + var points = []; + var segCount = _path.getSegmentCount(); + if(segCount > 1) { + var quality = 8; + var sample = quality * segCount; + + for( var i = 0; i < sample; i++ ) { + var t = i / sample; + var pos = _path.getPointRatio(t); + + array_push(points, pos); + } + + var triangles = polygon_triangulate(points); + + draw_set_color(_color); + + draw_primitive_begin(pr_trianglelist); + for( var i = 0; i < array_length(triangles); i++ ) { + var tri = triangles[i]; + var p0 = tri[0]; + var p1 = tri[1]; + var p2 = tri[2]; + + draw_vertex(p0[0], p0[1]); + draw_vertex(p1[0], p1[1]); + draw_vertex(p2[0], p2[1]); + } + draw_primitive_end(); + } + surface_reset_target(); + + return _outSurf; + } + surface_set_target(_outSurf); if(_bg) draw_clear_alpha(0, 1); else draw_clear_alpha(0, 0); @@ -145,7 +206,7 @@ function Node_Shape(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr var center = degtorad(ar[0] + ar[1]) / 2; var range = degtorad(ar[0] - ar[1]) / 2; shader_set_uniform_f(uniform_angle, center); - shader_set_uniform_f_array(uniform_arange, [ sin(range), cos(range) ] ); + shader_set_uniform_f_array_safe(uniform_arange, [ sin(range), cos(range) ] ); shader_set_uniform_f(uniform_inner, _data[5] / 2); break; case NODE_SHAPE_TYPE.teardrop : @@ -178,15 +239,15 @@ function Node_Shape(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr break; } - shader_set_uniform_f_array(uniform_dim, _dim); + shader_set_uniform_f_array_safe(uniform_dim, _dim); shader_set_uniform_i(uniform_shape, _shape); - shader_set_uniform_f_array(uniform_bgCol, _bgcol); + shader_set_uniform_f_array_safe(uniform_bgCol, _bgcol); shader_set_uniform_i(uniform_aa, _aa); shader_set_uniform_i(uniform_drawDF, _df); shader_set_uniform_f(uniform_corner, _corner); - shader_set_uniform_f_array(uniform_cent, [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]); - shader_set_uniform_f_array(uniform_scal, [ _posit[2] / _dim[0], _posit[3] / _dim[1] ]); + shader_set_uniform_f_array_safe(uniform_cent, [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]); + shader_set_uniform_f_array_safe(uniform_scal, [ _posit[2] / _dim[0], _posit[3] / _dim[1] ]); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, _color, 1); shader_reset(); diff --git a/scripts/node_skew/node_skew.gml b/scripts/node_skew/node_skew.gml index ebcbeb09c..0f790d305 100644 --- a/scripts/node_skew/node_skew.gml +++ b/scripts/node_skew/node_skew.gml @@ -8,29 +8,37 @@ function Node_Skew(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru uniform_amo = shader_get_uniform(shader, "amount"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]); - inputs[| 2] = nodeValue(2, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Wrap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 3] = nodeValue("Wrap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 4] = nodeValue(4, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) + inputs[| 4] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) .setDisplay(VALUE_DISPLAY.vector, button(function() { centerAnchor(); }) .setIcon(THEME.anchor) .setTooltip("Set to center")); - inputs[| 5] = nodeValue(5, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 5] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - input_display_list = [ - ["Surface", false], 0, 5, + inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 8] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 8; + + input_display_list = [ 8, + ["Surface", true], 0, 5, 6, 7, ["Skew", false], 1, 2, 4, ] - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static centerAnchor = function() { if(!is_surface(current_data[0])) return; @@ -53,7 +61,7 @@ function Node_Skew(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); @@ -64,9 +72,11 @@ function Node_Skew(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_solid/node_solid.gml b/scripts/node_solid/node_solid.gml index 2d71d402e..00b524465 100644 --- a/scripts/node_solid/node_solid.gml +++ b/scripts/node_solid/node_solid.gml @@ -1,21 +1,22 @@ function Node_Solid(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Solid"; - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 2] = nodeValue(2, "Empty", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 2] = nodeValue("Empty", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 3] = nodeValue(3, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 4] = nodeValue(4, "Use mask dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 4] = nodeValue("Use mask dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ - 0, 3, 4, 1, 2 + ["Output", false], 0, 3, 4, + ["Solid", false], 1, 2, ]; static process_data = function(_outSurf, _data, _output_index, _array_index) { @@ -30,17 +31,21 @@ function Node_Solid(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr _dim = [ surface_get_width(_msk), surface_get_height(_msk) ]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + if(_emp) { + surface_set_target(_outSurf); + draw_clear_alpha(0, 0); + surface_reset_target(); + return _outSurf; + } surface_set_target(_outSurf); draw_clear_alpha(0, 0); - if(!_emp) { - shader_set(sh_solid); - if(is_surface(_msk)) - draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, 1); - else - draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _col, 1); - shader_reset(); - } + shader_set(sh_solid); + if(is_surface(_msk)) + draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, 1); + else + draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _col, 1); + shader_reset(); surface_reset_target(); return _outSurf; diff --git a/scripts/node_sprite_sheet/node_sprite_sheet.gml b/scripts/node_sprite_sheet/node_sprite_sheet.gml index 3231a84aa..c5a3d7311 100644 --- a/scripts/node_sprite_sheet/node_sprite_sheet.gml +++ b/scripts/node_sprite_sheet/node_sprite_sheet.gml @@ -13,22 +13,27 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co name = "Render Spritesheet"; anim_drawn = array_create(ANIMATOR.frames_total + 1, false); - inputs[| 0] = nodeValue(0, "Sprites", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 0] = nodeValue("Sprites", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 1] = nodeValue(1, "Sprite set", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Animation", "Sprite array" ]); + inputs[| 1] = nodeValue("Sprite set", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Animation", "Sprite array" ]) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Frame step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Number of frames until next sprite. Can be seen as (Step - 1) frame skip."); + inputs[| 2] = nodeValue("Frame step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Number of frames until next sprite. Can be seen as (Step - 1) frame skip.") + .rejectArray(); - inputs[| 3] = nodeValue(3, "Packing type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical", "Grid" ]); + inputs[| 3] = nodeValue("Packing type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical", "Grid" ]) + .rejectArray(); - inputs[| 4] = nodeValue(4, "Grid column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + inputs[| 4] = nodeValue("Grid column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4) + .rejectArray(); - inputs[| 5] = nodeValue(5, "Alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "First", "Middle", "Last" ]); + inputs[| 5] = nodeValue("Alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "First", "Middle", "Last" ]) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static step = function() { var grup = inputs[| 1].getValue(); @@ -38,7 +43,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co inputs[| 4].setVisible(pack == SPRITE_STACK.grid); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var inpt = inputs[| 0].getValue(); var grup = inputs[| 1].getValue(); var skip = inputs[| 2].getValue(); @@ -48,7 +53,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co var oupt = outputs[| 0].getValue(); - if(grup != SPRITE_ANIM_GROUP.animation) return; + if(grup != SPRITE_ANIM_GROUP.animation) { + onInspectorUpdate(); + return; + } if(safe_mod(ANIMATOR.current_frame, skip) != 0) return; if(array_length(anim_drawn) != ANIMATOR.frames_total) @@ -73,6 +81,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co var oo = noone; if(!is_array(oupt)) oo = oupt; else oo = oupt[i]; + if(!is_surface(oo)) break; var ww = surface_get_width(oo); var hh = surface_get_height(oo); @@ -80,13 +89,13 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co var _w = surface_get_width(inpt[i]); var _h = surface_get_height(inpt[i]); - var frame = floor(ANIMATOR.current_frame / skip); + var _frame = floor(ANIMATOR.current_frame / skip); surface_set_target(oo); - BLEND_OVERRIDE + BLEND_OVERRIDE; switch(pack) { case SPRITE_STACK.horizontal : - var px = frame * _w; + var px = _frame * _w; switch(alig) { case 0 : draw_surface_safe(inpt[i], px, py); @@ -100,7 +109,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co } break; case SPRITE_STACK.vertical : - var py = frame * _h; + var py = _frame * _h; switch(alig) { case 0 : draw_surface_safe(inpt[i], px, py); @@ -115,8 +124,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co break; case SPRITE_STACK.grid : var col = inputs[| 4].getValue(); - var _row = floor(frame / col); - var _col = safe_mod(frame, col); + var _row = floor(_frame / col); + var _col = safe_mod(_frame, col); px = _col * _w; py = _row * _h; @@ -126,17 +135,28 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co } drawn = true; - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } - if(drawn) { + if(drawn) anim_drawn[ANIMATOR.current_frame] = true; - //print(string(ANIMATOR.current_frame) + ": " + string(drawn)); + } + + static onInspectorUpdate = function() { + var key = ds_map_find_first(NODE_MAP); + repeat(ds_map_size(NODE_MAP)) { + var node = NODE_MAP[? key]; + key = ds_map_find_next(NODE_MAP, key); + + if(!node.active) continue; + if(instanceof(node) != "Node_Render_Sprite_Sheet") continue; + + node.initRender(); } } - static inspectorUpdate = function() { + static initRender = function() { for(var i = 0; i < array_length(anim_drawn); i++) anim_drawn[i] = false; var inpt = inputs[| 0].getValue(); @@ -238,7 +258,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co surface_set_target(_surf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; switch(pack) { case SPRITE_STACK.horizontal : var px = 0; @@ -314,7 +334,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = -1) : Node(_x, _y, _group) co } break; } - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); outputs[| 0].setValue(_surf); } else diff --git a/scripts/node_sprite_stack/node_sprite_stack.gml b/scripts/node_sprite_stack/node_sprite_stack.gml index fb6329db6..63ceeb543 100644 --- a/scripts/node_sprite_stack/node_sprite_stack.gml +++ b/scripts/node_sprite_stack/node_sprite_stack.gml @@ -2,31 +2,31 @@ function Node_Sprite_Stack(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) name = "Sprite Stack"; dimension_index = 1; - inputs[| 0] = nodeValue(0, "Base shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 0] = nodeValue("Base shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) + inputs[| 1] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 2] = nodeValue(2, "Stack amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + inputs[| 2] = nodeValue("Stack amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); - inputs[| 3] = nodeValue(3, "Stack shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 1 ] ) + inputs[| 3] = nodeValue("Stack shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 1 ] ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 4] = nodeValue(4, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ] ) + inputs[| 4] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 5] = nodeValue(5, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 5] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 6] = nodeValue(6, "Stack blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + inputs[| 6] = nodeValue("Stack blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); - inputs[| 7] = nodeValue(7, "Alpha end", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1, "Alpha value for the last copy." ) + inputs[| 7] = nodeValue("Alpha end", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1, "Alpha value for the last copy." ) .setDisplay(VALUE_DISPLAY.slider, [0, 1, .01]); - inputs[| 8] = nodeValue(8, "Move base", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make each copy move the original image." ); + inputs[| 8] = nodeValue("Move base", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make each copy move the original image." ); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, 1, diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index 5f330d169..a7ff74a23 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -1,25 +1,28 @@ -function Node_Stack(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { +function Node_Stack(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { name = "Stack"; - inputs[| 0] = nodeValue(0, "Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical", "On top" ]); + inputs[| 0] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical", "On top" ]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Align", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) - .setDisplay(VALUE_DISPLAY.enum_button, [ "Start", "Middle", "End"]); + inputs[| 1] = nodeValue("Align", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Start", "Middle", "End"]) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 2] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .rejectArray(); input_fix_len = ds_list_size(inputs); data_length = 1; static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 ) .setVisible(true, true); } if(!LOADING && !APPENDING) createNewInput(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static refreshDynamicInput = function() { var _l = ds_list_create(); @@ -53,71 +56,82 @@ function Node_Stack(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr inputs[| 2].setVisible(_axis != 2); } - static process_data = function(_outSurf, _data, _output_index, _array_index) { - var _axis = _data[0]; - var _alig = _data[1]; - var _spac = _data[2]; + static update = function(frame = ANIMATOR.current_frame) { + var _axis = inputs[| 0].getValue(); + var _alig = inputs[| 1].getValue(); + var _spac = inputs[| 2].getValue(); var ww = 0; var hh = 0; - for( var i = input_fix_len; i < array_length(_data) - 1; i++ ) { - if(!is_surface(_data[i])) continue; - var sw = surface_get_width(_data[i]); - var sh = surface_get_height(_data[i]); + for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + var _surf = inputs[| i].getValue(); + if(!is_array(_surf)) _surf = [ _surf ]; - if(_axis == 0) { - ww += sw + (i > input_fix_len) * _spac; - hh = max(hh, sh); - } else if(_axis == 1) { - ww = max(ww, sw); - hh += sh + (i > input_fix_len) * _spac; - } else if(_axis == 2) { - ww = max(ww, sw); - hh = max(hh, sh); + for( var j = 0; j < array_length(_surf); j++ ) { + if(!is_surface(_surf[j])) continue; + var sw = surface_get_width(_surf[j]); + var sh = surface_get_height(_surf[j]); + + if(_axis == 0) { + ww += sw + (i > input_fix_len && j == array_length(_surf) - 1) * _spac; + hh = max(hh, sh); + } else if(_axis == 1) { + ww = max(ww, sw); + hh += sh + (i > input_fix_len && j == array_length(_surf) - 1) * _spac; + } else if(_axis == 2) { + ww = max(ww, sw); + hh = max(hh, sh); + } } } + var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, ww, hh); + outputs[| 0].setValue(_outSurf); + surface_set_target(_outSurf); draw_clear_alpha(0, 0); - //BLEND_OVERRIDE + //BLEND_OVERRIDE; var sx = 0, sy = 0; - for( var i = input_fix_len; i < array_length(_data) - 1; i++ ) { - if(!is_surface(_data[i])) continue; - var sw = surface_get_width(_data[i]); - var sh = surface_get_height(_data[i]); - - if(_axis == 0) { - switch(_alig) { - case fa_left: sy = 0; break; - case fa_center: sy = hh / 2 - sh / 2; break; - case fa_right: sy = hh - sh; break; + for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { + var _surf = inputs[| i].getValue(); + if(!is_array(_surf)) _surf = [ _surf ]; + + for( var j = 0; j < array_length(_surf); j++ ) { + if(!is_surface(_surf[j])) continue; + var sw = surface_get_width(_surf[j]); + var sh = surface_get_height(_surf[j]); + + if(_axis == 0) { + switch(_alig) { + case fa_left: sy = 0; break; + case fa_center: sy = hh / 2 - sh / 2; break; + case fa_right: sy = hh - sh; break; + } + } else if(_axis == 1) { + switch(_alig) { + case fa_left: sx = 0; break; + case fa_center: sx = ww / 2 - sw / 2; break; + case fa_right: sx = ww - sw; break; + } + } else if(_axis == 2) { + sx = ww / 2 - sw / 2; + sy = hh / 2 - sh / 2; } - } else if(_axis == 1) { - switch(_alig) { - case fa_left: sx = 0; break; - case fa_center: sx = ww / 2 - sw / 2; break; - case fa_right: sx = ww - sw; break; - } - } else if(_axis == 2) { - sx = ww / 2 - sw / 2; - sy = hh / 2 - sh / 2; + + draw_surface_safe(_surf[j], sx, sy); + + if(_axis == 0) + sx += sw + _spac; + else if(_axis == 1) + sy += sh + _spac; } - - draw_surface_safe(_data[i], sx, sy); - - if(_axis == 0) - sx += sw + _spac; - else if(_axis == 1) - sy += sh + _spac; } - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); - - return _outSurf; } static postDeserialize = function() { diff --git a/scripts/node_statistic/node_statistic.gml b/scripts/node_statistic/node_statistic.gml index c7d05fab7..8a5b439c9 100644 --- a/scripts/node_statistic/node_statistic.gml +++ b/scripts/node_statistic/node_statistic.gml @@ -28,22 +28,22 @@ function Node_Statistic(_x, _y, _group = -1) : Node(_x, _y, _group) constructor w = 96; - - inputs[| 0] = nodeValue(0, "Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ - "Sum", "Mean", "Median", "Max", "Min"]); + "Sum", "Mean", "Median", "Max", "Min"]) + .rejectArray(); input_fix_len = ds_list_size(inputs); data_length = 1; static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, -1 ) + inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, -1 ) .setVisible(true, true); } if(!LOADING && !APPENDING) createNewInput(); - outputs[| 0] = nodeValue(0, "Statistic", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1); + outputs[| 0] = nodeValue("Statistic", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1); static refreshDynamicInput = function() { var _l = ds_list_create(); @@ -76,7 +76,7 @@ function Node_Statistic(_x, _y, _group = -1) : Node(_x, _y, _group) constructor refreshDynamicInput(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var type = inputs[| 0].getValue(); var res = 0; diff --git a/scripts/node_string/node_string.gml b/scripts/node_string/node_string.gml index bb8213454..bdc6ff7fb 100644 --- a/scripts/node_string/node_string.gml +++ b/scripts/node_string/node_string.gml @@ -4,8 +4,8 @@ function Node_String(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const w = 96; - inputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - outputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); function process_data(_output, _data, _index = 0) { return _data[0]; diff --git a/scripts/node_string_get_char/node_string_get_char.gml b/scripts/node_string_get_char/node_string_get_char.gml index e5e8a76bf..d1c11ff9b 100644 --- a/scripts/node_string_get_char/node_string_get_char.gml +++ b/scripts/node_string_get_char/node_string_get_char.gml @@ -5,12 +5,12 @@ function Node_String_Get_Char(_x, _y, _group = -1) : Node_Processor(_x, _y, _gro w = 96; - inputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 1] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); - outputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); function process_data(_output, _data, _index = 0) { return string_char_at(_data[0], _data[1]); diff --git a/scripts/node_string_merge/node_string_merge.gml b/scripts/node_string_merge/node_string_merge.gml index a41a05502..30ef94b36 100644 --- a/scripts/node_string_merge/node_string_merge.gml +++ b/scripts/node_string_merge/node_string_merge.gml @@ -4,11 +4,11 @@ function Node_String_Merge(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) w = 96; - inputs[| 0] = nodeValue(0, "Text A", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + inputs[| 0] = nodeValue("Text A", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - inputs[| 1] = nodeValue(1, "Text B", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + inputs[| 1] = nodeValue("Text B", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); - outputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); function process_data(_output, _data, _index = 0) { return string(_data[0]) + string(_data[1]); diff --git a/scripts/node_string_split/node_string_split.gml b/scripts/node_string_split/node_string_split.gml index ffe7dff2d..c303b5315 100644 --- a/scripts/node_string_split/node_string_split.gml +++ b/scripts/node_string_split/node_string_split.gml @@ -5,11 +5,11 @@ function Node_String_Split(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) w = 96; - inputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Delimiter", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, " ", "Character that used to split text,\nleave blank to create character array."); + inputs[| 1] = nodeValue("Delimiter", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, " ", "Character that used to split text,\nleave blank to create character array."); - outputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); function process_data(_output, _data, _index = 0) { if(_data[1] == "") diff --git a/scripts/node_string_trim/node_string_trim.gml b/scripts/node_string_trim/node_string_trim.gml index 0a5e829b5..69847e15a 100644 --- a/scripts/node_string_trim/node_string_trim.gml +++ b/scripts/node_string_trim/node_string_trim.gml @@ -5,12 +5,12 @@ function Node_String_Trim(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) w = 96; - inputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Head", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); - inputs[| 2] = nodeValue(2, "Tail", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 1] = nodeValue("Head", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 2] = nodeValue("Tail", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); - outputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); function process_data(_output, _data, _index = 0) { var str = _data[0]; diff --git a/scripts/node_stripe/node_stripe.gml b/scripts/node_stripe/node_stripe.gml index 446bd5295..c77ff5e12 100644 --- a/scripts/node_stripe/node_stripe.gml +++ b/scripts/node_stripe/node_stripe.gml @@ -18,34 +18,34 @@ function Node_Stripe(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_clr0 = shader_get_uniform(shader, "color0"); uniform_clr1 = shader_get_uniform(shader, "color1"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 0.1]); - inputs[| 2] = nodeValue(2, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 2] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 3] = nodeValue(3, "Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Smoothly blend between each stripe."); + inputs[| 3] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Smoothly blend between each stripe."); - inputs[| 4] = nodeValue(4, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) + inputs[| 4] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 5] = nodeValue(5, "Random", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 5] = nodeValue("Random", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 6] = nodeValue(6, "Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 6] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 7] = nodeValue(7, "Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) + inputs[| 7] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ new gradientKey(0, c_white) ] ) .setDisplay(VALUE_DISPLAY.gradient); - inputs[| 8] = nodeValue(8, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 8] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 9] = nodeValue(9, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 9] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", true], 0, @@ -81,7 +81,7 @@ function Node_Stripe(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const var _gra = _data[7]; var _gra_data = inputs[| 7].getExtraData(); - var _g = getGradientData(_gra, _gra_data); + var _g = gradient_to_array(_gra); var _grad_color = _g[0]; var _grad_time = _g[1]; @@ -96,14 +96,14 @@ function Node_Stripe(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const shader_set_uniform_f(uniform_blend, _bnd); shader_set_uniform_f(uniform_rand, _rnd); - shader_set_uniform_f_array(uniform_clr0, colToVec4(_clr0)); - shader_set_uniform_f_array(uniform_clr1, colToVec4(_clr1)); + shader_set_uniform_f_array_safe(uniform_clr0, colToVec4(_clr0)); + shader_set_uniform_f_array_safe(uniform_clr1, colToVec4(_clr1)); shader_set_uniform_i(uniform_grad_use, _grad_use); shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); - shader_set_uniform_f_array(uniform_grad, _grad_color); - shader_set_uniform_f_array(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, ds_list_size(_gra)); + shader_set_uniform_f_array_safe(uniform_grad, _grad_color); + shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); + shader_set_uniform_i(uniform_grad_key, array_length(_gra)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index 5fca2682c..831ad6a4a 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -3,16 +3,16 @@ function Node_Surface_data(_x, _y, _group = -1) : Node(_x, _y, _group) construct color = COLORS.node_blend_number; previewable = false; - inputs[| 0] = nodeValue(0, "Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, [ 1, 1 ]) + outputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - outputs[| 1] = nodeValue(1, "Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); + outputs[| 1] = nodeValue("Array length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); w = 96; - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _insurf = inputs[| 0].getValue(); if(is_array(_insurf)) { var len = array_length(_insurf); diff --git a/scripts/node_switch/node_switch.gml b/scripts/node_switch/node_switch.gml index 4d59e5202..b6b1dee8e 100644 --- a/scripts/node_switch/node_switch.gml +++ b/scripts/node_switch/node_switch.gml @@ -5,24 +5,25 @@ function Node_Switch(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { w = 96; - inputs[| 0] = nodeValue( 0, "Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) - .setVisible(true, true); + inputs[| 0] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + .setVisible(true, true) + .rejectArray(); - inputs[| 1] = nodeValue( 1, "Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) + inputs[| 1] = nodeValue("Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) .setVisible(false, true); static createNewInput = function() { var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue( index + 0, "Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| index + 0] = nodeValue("Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - inputs[| index + 1] = nodeValue( index + 1, "value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) + inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) .setVisible(false, true); array_push(input_display_list, index + 0); array_push(input_display_list, index + 1); } - outputs[| 0] = nodeValue(0, "Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); input_display_list = [ 0, ["Inputs", false], 1 @@ -76,7 +77,7 @@ function Node_Switch(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { } } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { if(index < input_fix_len) return; if(LOADING || APPENDING) return; @@ -87,7 +88,7 @@ function Node_Switch(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { refreshDynamicInput(); } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var sele = inputs[| 0].getValue(); var _res = inputs[| 1].getValue(); diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index 0602f66cb..122c7e217 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -2,35 +2,35 @@ function Node_Text(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru name = "Draw Text"; font = f_p0; - inputs[| 0] = nodeValue(0, "Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - inputs[| 1] = nodeValue(1, "Font", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + inputs[| 1] = nodeValue("Font", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_font); - inputs[| 2] = nodeValue(2, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); + inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); - inputs[| 3] = nodeValue(3, "Anti-Aliasing ", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 3] = nodeValue("Anti-Aliasing ", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 4] = nodeValue(4, "Character range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 128 ]) + inputs[| 4] = nodeValue("Character range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 32, 128 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 5] = nodeValue(5, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 6] = nodeValue(6, "Fixed dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 6] = nodeValue("Fixed dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector) .setVisible(true, false); - inputs[| 7] = nodeValue(7, "Horizontal alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 7] = nodeValue("Horizontal alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_button, [ THEME.inspector_text_halign, THEME.inspector_text_halign, THEME.inspector_text_halign]); - inputs[| 8] = nodeValue(8, "Vertical alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 8] = nodeValue("Vertical alignment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_button, [ THEME.inspector_text_valign, THEME.inspector_text_valign, THEME.inspector_text_valign ]); - inputs[| 9] = nodeValue(9, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) + inputs[| 9] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Fixed", "Dynamic" ]); - inputs[| 10] = nodeValue(10, "Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) + inputs[| 10] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) .setDisplay(VALUE_DISPLAY.padding); input_display_list = [ @@ -39,7 +39,7 @@ function Node_Text(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru ["Font properties", false], 1, 2, 3, 4 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); _font_current = ""; _size_current = 0; @@ -97,7 +97,7 @@ function Node_Text(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; if(_dim[0] != 0 && _dim[1] != 0) { var _hali = _data[7]; @@ -122,7 +122,7 @@ function Node_Text(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru draw_text(_padd[PADDING.left], _padd[PADDING.up], str); } - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_text_file_read/node_text_file_read.gml b/scripts/node_text_file_read/node_text_file_read.gml index 385c6b875..1454d8d73 100644 --- a/scripts/node_text_file_read/node_text_file_read.gml +++ b/scripts/node_text_file_read/node_text_file_read.gml @@ -29,12 +29,12 @@ function Node_Text_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru w = 128; + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_load, ["*.txt", ""]) + .rejectArray(); - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, ["*.txt", ""]); - - outputs[| 0] = nodeValue(0, "Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - outputs[| 1] = nodeValue(1, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") + outputs[| 0] = nodeValue("Content", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); + outputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); content = ""; @@ -51,7 +51,7 @@ function Node_Text_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru return false; } - static inspectorUpdate = function() { + static onInspectorUpdate = function() { var path = inputs[| 0].getValue(); if(path == "") return; updatePaths(path); @@ -62,7 +62,7 @@ function Node_Text_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru path = try_get_path(path); if(path == -1) return false; - var ext = filename_ext(path); + var ext = string_lower(filename_ext(path)); var _name = string_replace(filename_name(path), filename_ext(path), ""); switch(ext) { @@ -82,7 +82,7 @@ function Node_Text_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) constru return false; } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_text_file_write/node_text_file_write.gml b/scripts/node_text_file_write/node_text_file_write.gml index 3412ddda2..565aa660a 100644 --- a/scripts/node_text_file_write/node_text_file_write.gml +++ b/scripts/node_text_file_write/node_text_file_write.gml @@ -5,14 +5,14 @@ function Node_Text_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr w = 128; - - inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_save, ["*.txt", ""]); + inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") + .setDisplay(VALUE_DISPLAY.path_save, ["*.txt", ""]) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Content", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") + inputs[| 1] = nodeValue("Content", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(true, true); - static update = function() { + static writeFile = function() { var path = inputs[| 0].getValue(); if(path == "") return; if(filename_ext(path) != ".txt") @@ -21,10 +21,13 @@ function Node_Text_File_Write(_x, _y, _group = -1) : Node(_x, _y, _group) constr var cont = inputs[| 1].getValue(); var f = file_text_open_write(path); - file_text_write_string(f, cont); + file_text_write_string(f, string(cont)); file_text_close(f); } + static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static onInspectorUpdate = function() { writeFile(); } + function onDrawNode(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); diff --git a/scripts/node_texture_remap/node_texture_remap.gml b/scripts/node_texture_remap/node_texture_remap.gml index 67f59041e..cf5f9cbd0 100644 --- a/scripts/node_texture_remap/node_texture_remap.gml +++ b/scripts/node_texture_remap/node_texture_remap.gml @@ -4,25 +4,32 @@ function Node_Texture_Remap(_x, _y, _group = -1) : Node_Processor(_x, _y, _group shader = sh_texture_remap; uniform_map = shader_get_sampler_index(shader, "map"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "RG Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0, "Displacement map where red retermine the X position, and green determine the Y position."); + inputs[| 1] = nodeValue("RG Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0, "Displacement map where red retermine the X position, and green determine the Y position."); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 2; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 2, + ["Surface", false], 0, 1, + ] static process_data = function(_outSurf, _data, _output_index, _array_index) { if(!is_surface(_data[1])) return _outSurf; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); texture_set_stage(uniform_map, surface_get_texture(_data[1])); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_threshold/node_threshold.gml b/scripts/node_threshold/node_threshold.gml index ad47c5267..a7e4327c6 100644 --- a/scripts/node_threshold/node_threshold.gml +++ b/scripts/node_threshold/node_threshold.gml @@ -6,31 +6,40 @@ function Node_Threshold(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co uniform_thr = shader_get_uniform(shader, "thr"); uniform_smt = shader_get_uniform(shader, "smooth"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 1] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "Brightness", "Alpha" ]); - inputs[| 2] = nodeValue(2, "Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - inputs[| 3] = nodeValue(3, "Smoothness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 3] = nodeValue("Smoothness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ 0, - ["Threshold", false], 1, 2, 3 + inputs[| 5] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 6] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 6; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 6, + ["Surface", true], 0, 4, 5, + ["Threshold", false], 1, 2, 3, ]; - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { var _mode = _data[1]; var _thr = _data[2]; var _smt = _data[3]; surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; shader_set(shader); shader_set_uniform_i(uniform_mde, _mode); @@ -40,9 +49,11 @@ function Node_Threshold(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]); + return _outSurf; } } diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index 3f1e1e059..d46547dbc 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -7,15 +7,22 @@ function Node_Time_Remap(_x, _y, _group = -1) : Node(_x, _y, _group) constructor uniform_min = shader_get_uniform(shader, "vMin"); uniform_max = shader_get_uniform(shader, "vMax"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) + .rejectArray(); - inputs[| 1] = nodeValue(1, "Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) + .rejectArray(); - inputs[| 2] = nodeValue(2, "Max life", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3); + inputs[| 2] = nodeValue("Max life", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3) + .rejectArray(); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - static update = function() { + input_display_list = [ + ["Surface", false], 0, 1, 2, + ] + + static update = function(frame = ANIMATOR.current_frame) { if(array_length(cached_output) != ANIMATOR.frames_total + 1) return; @@ -35,12 +42,12 @@ function Node_Time_Remap(_x, _y, _group = -1) : Node(_x, _y, _group) constructor texture_set_stage(uniform_map, surface_get_texture(_map)); for(var i = 0; i <= _life; i++) { - var frame = clamp(ANIMATOR.current_frame - i, 0, ANIMATOR.frames_total - 1); + var _frame = clamp(ANIMATOR.current_frame - i, 0, ANIMATOR.frames_total - 1); - if(is_surface(cached_output[frame])) { + if(is_surface(cached_output[_frame])) { shader_set_uniform_f(uniform_min, i * ste); shader_set_uniform_f(uniform_max, i * ste + ste); - draw_surface_safe(cached_output[frame], 0, 0); + draw_surface_safe(cached_output[_frame], 0, 0); } } diff --git a/scripts/node_timeline_preview/node_timeline_preview.gml b/scripts/node_timeline_preview/node_timeline_preview.gml index 1c5bf5f41..104230e10 100644 --- a/scripts/node_timeline_preview/node_timeline_preview.gml +++ b/scripts/node_timeline_preview/node_timeline_preview.gml @@ -8,9 +8,9 @@ function Node_Timeline_Preview(_x, _y, _group = -1) : Node(_x, _y, _group) const PANEL_ANIMATION.timeline_preview = self; - inputs[| 0] = nodeValue(0, "Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _inSurf = inputs[| 0].getValue(); if(_inSurf == 0) return; diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index dae10c87b..db7f017e2 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -2,22 +2,22 @@ function Node_Trail(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr name = "Trail"; use_cache = true; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Max life", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3); - inputs[| 2] = nodeValue(2, "Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); - inputs[| 3] = nodeValue(3, "Alpha decrease", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Max life", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3); + inputs[| 2] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + inputs[| 3] = nodeValue("Alpha decrease", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 4] = nodeValue(4, "Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, BLEND_TYPES ); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Trail settings", false], 0, 1, 2, 4, 3 ]; - temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ]; + temp_surf = [ surface_create(1, 1), surface_create(1, 1) ]; static process_data = function(_outSurf, _data, _output_index, _array_index) { if(!inputs[| 0].value_from) @@ -61,9 +61,9 @@ function Node_Trail(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_safe(temp_surf[res_index], 0, 0); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); cacheCurrentFrame(_data[0]); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 940d51216..63315c03c 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -7,47 +7,50 @@ enum OUTPUT_SCALING { function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Transform"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - inputs[| 1] = nodeValue(1, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [1, 1]) + inputs[| 1] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [1, 1]) .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) + inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); - inputs[| 3] = nodeValue(3, "Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) + inputs[| 3] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) .setDisplay(VALUE_DISPLAY.vector, button(function() { centerAnchor(); }) .setIcon(THEME.anchor) .setTooltip("Set to center")); - inputs[| 4] = nodeValue(4, "Relative anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + inputs[| 4] = nodeValue("Relative anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); - inputs[| 5] = nodeValue(5, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 5] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - inputs[| 6] = nodeValue(6, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) + inputs[| 6] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 7] = nodeValue(7, "Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Repeat the surface to fill the screen."); + inputs[| 7] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Repeat the surface to fill the screen."); - inputs[| 8] = nodeValue(8, "Rotate by velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Make the surface rotates to follow its movement.") + inputs[| 8] = nodeValue("Rotate by velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Make the surface rotates to follow its movement.") .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); - inputs[| 9] = nodeValue(9, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_input) + inputs[| 9] = nodeValue("Output dimension type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_input) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Same as input", "Constant", "Relative to input" ]); - inputs[| 10] = nodeValue(10, "Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Round position to the closest integer value to avoid jittering."); + inputs[| 10] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Round position to the closest integer value to avoid jittering."); - input_display_list = [ 0, + inputs[| 11] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 11; + + input_display_list = [ 11, 0, ["Output", true], 9, 1, 7, ["Position", false], 2, 10, ["Rotation", false], 3, 5, 8, ["Scale", false], 6 ]; - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); vel = 0; prev_pos = [0, 0]; @@ -184,7 +187,7 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co surface_set_target(_s); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; if(is_surface(ins)) { var draw_x, draw_y; @@ -198,24 +201,24 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co draw_surface_tiled_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], c_white, 1); } - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); var _cc = point_rotate(-_px, -_py, _ww / 2, _hh / 2, rot); surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_ext_safe(_s, _cc[0], _cc[1], 1, 1, rot, c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); surface_free(_s); } else { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var draw_x, draw_y; draw_x = pos[0]; @@ -227,7 +230,7 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co } draw_surface_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], rot, c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); } @@ -326,12 +329,12 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co #endregion - if(overlay_dragging && overlay_dragging < 3) { + if(overlay_dragging && overlay_dragging < 3) { //Transform var px = _mx - overlay_drag_mx; var py = _my - overlay_drag_my; var pos_x, pos_y; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { var ang = round(point_direction(overlay_drag_mx, overlay_drag_my, _mx, _my) / 45) * 45; var dist = point_distance(overlay_drag_mx, overlay_drag_my, _mx, _my) / _s; @@ -352,11 +355,12 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var nanx = pos_x / ww; var nany = pos_y / hh; - if(keyboard_check(vk_alt)) { - var anchorUpdate = inputs[| 3].setValue([ nanx, nany ]); - var posUpdate = inputs[| 2].setValue([ overlay_drag_px + pos_x, overlay_drag_py + pos_y ]); + if(key_mod_press(ALT)) { + var modi = false; + modi |= inputs[| 3].setValue([ nanx, nany ]); + modi |= inputs[| 2].setValue([ overlay_drag_px + pos_x, overlay_drag_py + pos_y ]); - if(anchorUpdate || posUpdate) + if(modi) UNDO_HOLDING = true; } else { if(inputs[| 3].setValue([ nanx, nany ])) @@ -409,7 +413,7 @@ function Node_Transform(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var _sw = overlay_drag_sx + sw; var _sh = overlay_drag_sy + sh; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { _sw = max(_sw, _sh); _sh = _sw; } diff --git a/scripts/node_transform_single/node_transform_single.gml b/scripts/node_transform_single/node_transform_single.gml index f65010d14..4b6837a3b 100644 --- a/scripts/node_transform_single/node_transform_single.gml +++ b/scripts/node_transform_single/node_transform_single.gml @@ -1,17 +1,17 @@ function Node_Transform_Single(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Transform single"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Position x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 2] = nodeValue(2, "Position y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 3] = nodeValue(3, "Anchor x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 4] = nodeValue(4, "Anchor y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); - inputs[| 5] = nodeValue(5, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); - inputs[| 6] = nodeValue(6, "Scale x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 7] = nodeValue(7, "Scale y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 1] = nodeValue("Position x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 2] = nodeValue("Position y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 3] = nodeValue("Anchor x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 4] = nodeValue("Anchor y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); + inputs[| 5] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 6] = nodeValue("Scale x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); + inputs[| 7] = nodeValue("Scale y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); static process_data = function(_outSurf, _data, _output_index, _array_index) { var pos_x = _data[1]; @@ -29,11 +29,11 @@ function Node_Transform_Single(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_ext_safe(_data[0], pos_x + origin[0] - psc_x, pos_y + origin[1] - psc_y, sca_x, sca_y, rot, c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; @@ -112,7 +112,7 @@ function Node_Transform_Single(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr var py = value_snap(_my - overlay_drag_my, _sny); var pos_x, pos_y; - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { var ang = round(point_direction(overlay_drag_mx, overlay_drag_my, _mx, _my) / 45) * 45; var dist = point_distance(overlay_drag_mx, overlay_drag_my, _mx, _my) / _s; diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index a718fbebf..68c4b9041 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -5,9 +5,10 @@ function Node_Tunnel_In(_x, _y, _group = -1) : Node(_x, _y, _group) constructor w = 96; - inputs[| 0] = nodeValue( 0, "Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + .rejectArray(); - inputs[| 1] = nodeValue( 1, "Value in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, noone ) + inputs[| 1] = nodeValue("Value in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, noone ) .setVisible(true, true); error_notification = noone; @@ -25,6 +26,7 @@ function Node_Tunnel_In(_x, _y, _group = -1) : Node(_x, _y, _group) constructor repeat(amo) { if(TUNNELS_OUT[? k] == _key && ds_map_exists(NODE_MAP, k)) { var node = NODE_MAP[? k]; + if(node.group != group) continue; draw_set_color(COLORS.node_blend_tunnel); draw_set_alpha(0.35); @@ -37,7 +39,7 @@ function Node_Tunnel_In(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } static onClone = function() { onValueUpdate(); } - static update = function() { onValueUpdate(); } + static update = function(frame = ANIMATOR.current_frame) { onValueUpdate(); } static resetMap = function() { var _key = inputs[| 0].getValue(); @@ -67,7 +69,7 @@ function Node_Tunnel_In(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } } - static onValueUpdate = function(index) { + static onValueUpdate = function(index = 0) { var _key = inputs[| 0].getValue(); resetMap(); @@ -124,4 +126,11 @@ function Node_Tunnel_In(_x, _y, _group = -1) : Node(_x, _y, _group) constructor var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } + + static postConnect = function() { onValueUpdate(); } + + static onDestroy = function() { + if(error_notification != noone) + noti_remove(error_notification); + } } \ No newline at end of file diff --git a/scripts/node_tunnel_out/node_tunnel_out.gml b/scripts/node_tunnel_out/node_tunnel_out.gml index 446a1cb13..964fe494d 100644 --- a/scripts/node_tunnel_out/node_tunnel_out.gml +++ b/scripts/node_tunnel_out/node_tunnel_out.gml @@ -5,9 +5,10 @@ function Node_Tunnel_Out(_x, _y, _group = -1) : Node(_x, _y, _group) constructor w = 96; - inputs[| 0] = nodeValue( 0, "Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) + .rejectArray(); - outputs[| 0] = nodeValue( 0, "Value out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone ); + outputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone ); static isRenderable = function(trigger = false) { return false; } @@ -22,6 +23,8 @@ function Node_Tunnel_Out(_x, _y, _group = -1) : Node(_x, _y, _group) constructor if(!ds_map_exists(TUNNELS_IN, _key)) return; var node = TUNNELS_IN[? _key].node; + if(node.group != group) return; + draw_set_color(COLORS.node_blend_tunnel); draw_set_alpha(0.35); draw_line_width(xx + w * _s / 2, yy + h * _s / 2, _x + (node.x + node.w / 2) * _s, _y + (node.y + node.h / 2) * _s, 6 * _s); @@ -47,7 +50,7 @@ function Node_Tunnel_Out(_x, _y, _group = -1) : Node(_x, _y, _group) constructor } } - static update = function() { + static update = function(frame = ANIMATOR.current_frame) { var _key = inputs[| 0].getValue(); if(ds_map_exists(TUNNELS_IN, _key)) @@ -62,4 +65,6 @@ function Node_Tunnel_Out(_x, _y, _group = -1) : Node(_x, _y, _group) constructor var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); } + + static postConnect = function() { onValueUpdate(); } } \ No newline at end of file diff --git a/scripts/node_twirl/node_twirl.gml b/scripts/node_twirl/node_twirl.gml index 3eac9e0fc..34789e57c 100644 --- a/scripts/node_twirl/node_twirl.gml +++ b/scripts/node_twirl/node_twirl.gml @@ -8,24 +8,32 @@ function Node_Twirl(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr uniform_rad = shader_get_uniform(shader, "radius"); uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) + inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, [-10, 10, 0.01]); - inputs[| 3] = nodeValue(3, "Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); + inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16); - inputs[| 4] = nodeValue(4, "Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") + inputs[| 4] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - input_display_list = [ - ["Surface", false], 0, 4, + inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); + + inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 7; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 7, + ["Surface", true], 0, 4, 5, 6, ["Twirl", false], 1, 2, 3, ]; @@ -38,10 +46,10 @@ function Node_Twirl(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static process_data = function(_outSurf, _data, _output_index, _array_index) { + static process_data = function(_outSurf, _data, _output_index, _array_index) { surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; var center = _data[1]; var stren = _data[2]; @@ -49,17 +57,19 @@ function Node_Twirl(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr var sam = _data[4]; shader_set(shader); - shader_set_uniform_f_array(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); - shader_set_uniform_f_array(uniform_cen, center); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); shader_set_uniform_f(uniform_rad, rad); shader_set_uniform_i(uniform_sam, sam); draw_surface_safe(_data[0], 0, 0); shader_reset(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); + _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); + return _outSurf; } } \ No newline at end of file diff --git a/scripts/node_unicode/node_unicode.gml b/scripts/node_unicode/node_unicode.gml index fac0b647e..9732fa778 100644 --- a/scripts/node_unicode/node_unicode.gml +++ b/scripts/node_unicode/node_unicode.gml @@ -6,9 +6,9 @@ function Node_Unicode(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; - inputs[| 0] = nodeValue(0, "Unicode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 64); + inputs[| 0] = nodeValue("Unicode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 64); - outputs[| 0] = nodeValue(0, "Character", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, 0); + outputs[| 0] = nodeValue("Character", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, 0); function process_data(_output, _data, index = 0) { return chr(_data[0]); diff --git a/scripts/node_vector/node_vector.gml b/scripts/node_vector/node_vector.gml index 13b3f975d..7c11524be 100644 --- a/scripts/node_vector/node_vector.gml +++ b/scripts/node_vector/node_vector.gml @@ -6,10 +6,10 @@ function Node_Number(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const w = 96; min_h = 32 + 24 * 1; - inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var __ax = inputs[| 0].getValue(); @@ -18,7 +18,7 @@ function Node_Number(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { return _data[0]; } @@ -40,12 +40,12 @@ function Node_Vector2(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; min_h = 32 + 24 * 2; - inputs[| 0] = nodeValue(0, "x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ]) + outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); drag_type = 0; @@ -103,7 +103,7 @@ function Node_Vector2(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons } } - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var vec = [ _data[0], _data[1] ]; return vec; } @@ -127,17 +127,17 @@ function Node_Vector3(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; min_h = 32 + 24 * 3; - inputs[| 0] = nodeValue(0, "x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ]) + outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var vec = [ _data[0], _data[1], _data[2] ]; return vec; } @@ -161,19 +161,19 @@ function Node_Vector4(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; min_h = 32 + 24 * 4; - inputs[| 0] = nodeValue(0, "x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 1] = nodeValue(1, "y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 2] = nodeValue(2, "z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - inputs[| 3] = nodeValue(3, "w", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) + outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); - function process_data(_output, _data, index = 0) { + function process_data(_output, _data, _output_index, _array_index = 0) { var vec = [ _data[0], _data[1], _data[2], _data[3] ]; return vec; } @@ -197,17 +197,17 @@ function Node_Vector_Split(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) w = 96; min_h = 32 + 24 * 4; - inputs[| 0] = nodeValue(0, "Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) + inputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector) .setVisible(true, true); - outputs[| 0] = nodeValue(0, "x", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 1] = nodeValue(1, "y", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 2] = nodeValue(2, "z", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - outputs[| 3] = nodeValue(3, "w", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); - function process_data(_output, _data, _index = 0) { - return array_safe_get(_data[0], _index); + function process_data(_output, _data, _output_index, _array_index = 0) { + return array_safe_get(_data[0], _output_index); } static onDrawNode = function(xx, yy, _mx, _my, _s) { diff --git a/scripts/node_wiggler/node_wiggler.gml b/scripts/node_wiggler/node_wiggler.gml index 6fb25e560..9c2d58105 100644 --- a/scripts/node_wiggler/node_wiggler.gml +++ b/scripts/node_wiggler/node_wiggler.gml @@ -5,19 +5,18 @@ function Node_Wiggler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons w = 96; - - inputs[| 0] = nodeValue(0, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) + inputs[| 0] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 ) + inputs[| 1] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 ) .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); - inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999) ); + inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999) ); - inputs[| 3] = nodeValue(3, "Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) + inputs[| 3] = nodeValue("Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) .setDisplay(VALUE_DISPLAY.enum_scroll, ["Number", "Graph"]) - outputs[| 0] = nodeValue(0, "Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); + outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); input_display_list = [ ["Display", true], 3, @@ -26,31 +25,30 @@ function Node_Wiggler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons random_value = array_create(64, 0); - static onValueUpdate = function(index) { - var ran = inputs[| 0].getValue(); - var fre = inputs[| 1].getValue(); - var sed = inputs[| 2].getValue(); + static onValueUpdate = function(index = 0) { + var ran = getSingleValue(0); + var fre = getSingleValue(1); + var sed = getSingleValue(2); var step = ANIMATOR.frames_total / 64; - for( var i = 0; i < 64; i++ ) { + for( var i = 0; i < 64; i++ ) random_value[i] = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, step * i, sed, 0, ANIMATOR.frames_total); - } } - function process_data(_output, _data, index = 0) { - var ran = inputs[| 0].getValue(); - var fre = inputs[| 1].getValue(); - var sed = inputs[| 2].getValue(); + function process_data(_output, _data, _output_index, _array_index = 0) { + var ran = _data[0]; + var fre = _data[1]; + var sed = _data[2]; var time = ANIMATOR.current_frame; return getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, time, sed, 0, ANIMATOR.frames_total); } static onDrawNode = function(xx, yy, _mx, _my, _s) { - var ran = inputs[| 0].getValue(); - var fre = inputs[| 1].getValue(); - var sed = inputs[| 2].getValue(); - var disp = inputs[| 3].getValue(); + var ran = current_data[0]; + var fre = current_data[1]; + var sed = current_data[2]; + var disp = current_data[3]; var time = ANIMATOR.current_frame; var total_time = ANIMATOR.frames_total; diff --git a/scripts/node_wrap/node_wrap.gml b/scripts/node_wrap/node_wrap.gml index 7949897be..043eacab2 100644 --- a/scripts/node_wrap/node_wrap.gml +++ b/scripts/node_wrap/node_wrap.gml @@ -1,25 +1,33 @@ function Node_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Warp"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Top left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| 1] = nodeValue("Top left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 2] = nodeValue(2, "Top right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) + inputs[| 2] = nodeValue("Top right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, 0 ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Bottom left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) + inputs[| 3] = nodeValue("Bottom left", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, def_surf_size ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 4] = nodeValue(4, "Bottom right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) + inputs[| 4] = nodeValue("Bottom right", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size, def_surf_size ] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 5, + ["Surface", false], 0, + ["Wrap", false], 1, 2, 3, 4 + ] drag_side = -1; drag_mx = 0; @@ -170,7 +178,7 @@ function Node_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_set_color(c_white); var tex = surface_get_texture(_data[0]); @@ -213,7 +221,7 @@ function Node_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru } draw_primitive_end(); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_wrap_area/node_wrap_area.gml b/scripts/node_wrap_area/node_wrap_area.gml index 7ae8691a3..628ea49e3 100644 --- a/scripts/node_wrap_area/node_wrap_area.gml +++ b/scripts/node_wrap_area/node_wrap_area.gml @@ -1,11 +1,20 @@ function Node_Wrap_Area(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { name = "Area Warp"; - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, function() { return getDimension(0); }); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 2; + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 2, + ["Surface", false], 0, + ["Area", false], 1, + ] static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); @@ -29,11 +38,11 @@ function Node_Wrap_Area(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co surface_set_target(_outSurf); draw_clear_alpha(0, 0); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_surface_ext_safe(_inSurf, cx - cw, cy - ch, ww, hh, 0, c_white, 1); - BLEND_NORMAL + BLEND_NORMAL; surface_reset_target(); return _outSurf; diff --git a/scripts/node_wrap_mesh/node_wrap_mesh.gml b/scripts/node_wrap_mesh/node_wrap_mesh.gml index 99c99c77d..7ed297a4b 100644 --- a/scripts/node_wrap_mesh/node_wrap_mesh.gml +++ b/scripts/node_wrap_mesh/node_wrap_mesh.gml @@ -7,33 +7,38 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co links : ds_list_create() } - inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - inputs[| 1] = nodeValue(1, "Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8, "Amount of grid subdivision. Higher number means more grid, detail.") + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + + inputs[| 1] = nodeValue("Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8, "Amount of grid subdivision. Higher number means more grid, detail.") .setDisplay(VALUE_DISPLAY.slider, [ 2, 32, 1 ] ); - inputs[| 2] = nodeValue(2, "Spring force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) + inputs[| 2] = nodeValue("Spring force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ] ); - inputs[| 3] = nodeValue(3, "Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { setTriangle(); doUpdate(); }, "Generate"] ); - inputs[| 4] = nodeValue(4, "Diagonal link", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal link to prevent drastic grid deformation."); + inputs[| 4] = nodeValue("Diagonal link", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal link to prevent drastic grid deformation."); + inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 5; + control_index = ds_list_size(inputs); function createControl() { var index = ds_list_size(inputs); - inputs[| index] = nodeValue(index, "Control point", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ PUPPET_FORCE_MODE.move, 16, 16, 8, 0, 8, 8]) + inputs[| index] = nodeValue("Control point", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ PUPPET_FORCE_MODE.move, 16, 16, 8, 0, 8, 8]) .setDisplay(VALUE_DISPLAY.puppet_control) array_push(input_display_list, index); return inputs[| index]; } - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); - outputs[| 1] = nodeValue(1, "Mesh data", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, data); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - input_display_list = [ + outputs[| 1] = nodeValue("Mesh data", self, JUNCTION_CONNECT.output, VALUE_TYPE.object, data); + + input_display_list = [ 5, ["Mesh", false], 0, 1, 2, 4, 3, ["Control points", false], ]; @@ -41,8 +46,8 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co input_display_index = array_length(input_display_list); tools = [ - [ "Add / Remove control point", THEME.control_edit ], - [ "Pin, unpin mesh", [THEME.control_pin, THEME.control_unpin] ] + [ "Add / Remove (+ Shift) control point", THEME.control_add ], + [ "Pin / unpin (+ Shift) mesh", THEME.control_pin ] ]; attributes[? "pin"] = ds_map_create(); @@ -68,10 +73,14 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co } var _tool = PANEL_PREVIEW.tool_index; - var _sub_tool = PANEL_PREVIEW.tool_sub_index; if(!active) return; if(_tool == 0) { + if(key_mod_press(SHIFT)) + draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16); + else + draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16); + if(mouse_press(mb_left)) { if(hover == -1) { var i = createControl(); @@ -81,7 +90,7 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co i.drag_sy = 0; i.drag_mx = _mx; i.drag_my = _my; - } else { + } else if(key_mod_press(SHIFT)) { ds_list_delete(inputs, hover); array_delete(input_display_list, input_display_index + hover - control_index, 1); } @@ -90,6 +99,8 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co control(input_display_list); } } else if(_tool == 1) { + draw_sprite_ui_uniform(key_mod_press(SHIFT)? THEME.cursor_path_remove : THEME.cursor_path_add, 0, _mx + 16, _my + 16); + draw_set_color(COLORS._main_accent); var rad = 16; draw_circle(_mx, _my, rad, true); @@ -101,11 +112,11 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var t = data.tris[| j]; if(point_in_circle(t.p0.x, t.p0.y, _xx, _yy, rad / _s)) - t.p0.setPin(!_sub_tool); + t.p0.setPin(!key_mod_press(SHIFT)); if(point_in_circle(t.p1.x, t.p1.y, _xx, _yy, rad / _s)) - t.p1.setPin(!_sub_tool); + t.p1.setPin(!key_mod_press(SHIFT)); if(point_in_circle(t.p2.x, t.p2.y, _xx, _yy, rad / _s)) - t.p2.setPin(!_sub_tool); + t.p2.setPin(!key_mod_press(SHIFT)); } } } @@ -275,8 +286,8 @@ function Node_Mesh_Warp(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co var uniform_dim = shader_get_uniform(sh_content_sampler, "dimension"); var uniform_sam = shader_get_uniform(sh_content_sampler, "sampler"); - shader_set_uniform_f_array(uniform_dim, [ww, hh]); - shader_set_uniform_f_array(uniform_sam, [gw, gh]); + shader_set_uniform_f_array_safe(uniform_dim, [ww, hh]); + shader_set_uniform_f_array_safe(uniform_sam, [gw, gh]); draw_surface_safe(surf, 0, 0); shader_reset(); surface_reset_target(); diff --git a/scripts/node_zigzag/node_zigzag.gml b/scripts/node_zigzag/node_zigzag.gml index c7fc1e096..fdf41db31 100644 --- a/scripts/node_zigzag/node_zigzag.gml +++ b/scripts/node_zigzag/node_zigzag.gml @@ -9,22 +9,22 @@ function Node_Zigzag(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const uniform_col1 = shader_get_uniform(shader, "col1"); uniform_col2 = shader_get_uniform(shader, "col2"); - inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue(1, "Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) + inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.slider, [1, 16, 0.1]); - inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) + inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) .setDisplay(VALUE_DISPLAY.vector) .setUnitRef(function(index) { return getDimension(index); }); - inputs[| 3] = nodeValue(3, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); - inputs[| 4] = nodeValue(4, "Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 3] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); + inputs[| 4] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); - inputs[| 5] = nodeValue(5, "Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 5] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", false], 0, @@ -52,8 +52,8 @@ function Node_Zigzag(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const shader_set(shader); shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f(uniform_amo, _amo); - shader_set_uniform_f_array(uniform_col1, colToVec4(_col1)); - shader_set_uniform_f_array(uniform_col2, colToVec4(_col2)); + shader_set_uniform_f_array_safe(uniform_col1, colToVec4(_col1)); + shader_set_uniform_f_array_safe(uniform_col2, colToVec4(_col2)); shader_set_uniform_i(uniform_bnd, _bnd); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index ee00b75ca..de1b81cea 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -21,8 +21,15 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { onModifySingle[2] = function(val) { onModifyIndex(2, val); } onModifySingle[3] = function(val) { onModifyIndex(3, val); } - for(var i = 0; i < 4; i++) - tb[i] = new textBox(TEXTBOX_INPUT.float, onModifySingle[i]); + for(var i = 0; i < 4; i++) { + tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); + tb[i].slidable = true; + } + + static setSlideSpeed = function(speed) { + for(var i = 0; i < 4; i++) + tb[i].slide_speed = speed; + } static setInteract = function(interactable = noone) { self.interactable = interactable; diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 9d9575632..464f6c382 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -178,7 +178,7 @@ function Panel_Collection() : PanelContent() constructor { } else draw_sprite_ui_uniform(THEME.group, 0, _boxx + grid_size / 2, yy + grid_size / 2, 1, c_white); - if(mode == 0 && meta != noone) { + if(meta != noone && mode == 0) { if(meta.steam) { draw_sprite_ui_uniform(THEME.steam, 0, _boxx + ui(12), yy + ui(12), 1, COLORS._main_icon_dark, 1); if(meta.author_steam_id == STEAM_USER_ID) diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index ef8c71294..950fb6461 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -36,7 +36,7 @@ function Panel_Menu() : PanelContent() constructor { instance_destroy(addon_key_displayer); return; } - + instance_create_depth(0, 0, 0, addon_key_displayer); }] ]); diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index acaceca76..b5250c3f2 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -6,18 +6,20 @@ function rangeBox(_type, _onModify) : widget() constructor { b_link.icon = THEME.value_link; onModifyIndex = function(index, val) { + var modi = false; + if(linked) { for( var i = 0; i < 2; i++ ) - onModify(i, toNumber(val)); - return; + modi |= onModify(i, toNumber(val)); + return modi; } - onModify(index, toNumber(val)); + return onModify(index, toNumber(val)); } label = [ "min", "max" ]; - onModifySingle[0] = function(val) { onModifyIndex(0, toNumber(val)); } - onModifySingle[1] = function(val) { onModifyIndex(1, toNumber(val)); } + onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } + onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } extras = -1; @@ -26,6 +28,11 @@ function rangeBox(_type, _onModify) : widget() constructor { tb[i].slidable = true; } + static setSlideSpeed = function(speed) { + for(var i = 0; i < 2; i++) + tb[i].slide_speed = speed; + } + static setInteract = function(interactable = noone) { self.interactable = interactable; b_link.interactable = interactable; @@ -73,10 +80,10 @@ function rangeBox(_type, _onModify) : widget() constructor { for(var i = 0; i < 2; i++) { tb[i].hover = hover; tb[i].active = active; - + var bx = _x + ww * i; tb[i].draw(bx + ui(44), _y, ww - ui(44), _h, _data[i], _m); - + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub); draw_text(bx + ui(8), _y + _h / 2, label[i]); } diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index e0ce1e8cb..b3afd9236 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -9,6 +9,8 @@ function rotator(_onModify, _step = -1) : widget() constructor { real_val = 0; tb_value = new textBox(TEXTBOX_INPUT.number, onModify); + tb_value.slidable = true; + tb_value.slide_speed = 1; static setInteract = function(interactable = noone) { self.interactable = interactable; @@ -52,8 +54,8 @@ function rotator(_onModify, _step = -1) : widget() constructor { draw_sprite_ui_uniform(THEME.rotator_knob, 1, px, py); if(val != drag_sv) { - onModify(val); - UNDO_HOLDING = true; + if(onModify(val)) + UNDO_HOLDING = true; } drag_sa = point_direction(_x, knob_y, _m[0], _m[1]); diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index 4e6337437..bc836cd46 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -6,11 +6,13 @@ function rotatorRange(_onModify) : widget() constructor { drag_sa = 0; drag_sc = 0; - tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(0, val); } ); + tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ); tb_min.slidable = true; + tb_min.slide_speed = 1; - tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(1, val); } ); + tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ); tb_max.slidable = true; + tb_max.slide_speed = 1; static setInteract = function(interactable = noone) { self.interactable = interactable; @@ -87,15 +89,17 @@ function rotatorRange(_onModify) : widget() constructor { var val, real_val; if(dragging == 2) { + var modi = false; real_val[0] = round(delta + drag_sv[0]); val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0]; - onModify(0, val); + modi |= onModify(0, val); real_val[1] = round(delta + drag_sv[1]); val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1]; - onModify(1, val); + modi |= onModify(1, val); - UNDO_HOLDING = true; + if(modi) + UNDO_HOLDING = true; } else { var _o = _data[dragging]; real_val = round(delta + drag_sv); @@ -104,14 +108,16 @@ function rotatorRange(_onModify) : widget() constructor { draw_sprite_ui_uniform(THEME.rotator_knob, 1, px[dragging], py[dragging]); if(_data[dragging] != val) { - onModify(dragging, val); + var modi = false; + modi |= onModify(dragging, val); - if(keyboard_check(vk_alt)) { + if(key_mod_press(ALT)) { var dt = val - _o; - onModify(!dragging, _data[!dragging] - dt); + modi |= onModify(!dragging, _data[!dragging] - dt); } - UNDO_HOLDING = true; + if(modi) + UNDO_HOLDING = true; } drag_sv = real_val; diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index fca9195a9..b1c99d9ba 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -52,6 +52,15 @@ function scrollBox(_data, _onModify) : widget() constructor { trigger(); if(mouse_click(mb_left, active)) draw_sprite_stretched(THEME.textbox, 2, _x, _y, w, _h); + + if(is_array(data_list) && key_mod_press(SHIFT)) { + var ind = array_find(data_list, _text); + var len = array_length(data_list); + if(len) { + if(mouse_wheel_down()) onModify((ind + 1 + len) % len); + if(mouse_wheel_up()) onModify((ind - 1 + len) % len); + } + } } else { draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, w, _h, c_white, 0.5 + 0.5 * interactable); if(mouse_press(mb_left)) deactivate(); diff --git a/scripts/scrollPane/scrollPane.gml b/scripts/scrollPane/scrollPane.gml index 2cc4f6fbf..9ffb90bdd 100644 --- a/scripts/scrollPane/scrollPane.gml +++ b/scripts/scrollPane/scrollPane.gml @@ -54,7 +54,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { scroll_y = round(scroll_y_raw); draw_surface_safe(surface, x, y); - if(active && point_in_rectangle(mx, my, 0, 0, surface_w, surface_h)) { + if(active && !key_mod_press(SHIFT) && point_in_rectangle(mx, my, 0, 0, surface_w, surface_h)) { if(mouse_wheel_down()) scroll_y_to -= scroll_step; if(mouse_wheel_up()) scroll_y_to += scroll_step; } @@ -100,9 +100,23 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { if(mouse_release(mb_left)) is_scrolling = false; } - - draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, bg_col, 1); - draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bar_x, bar_y, bar_w, bar_h, bar_col, 1); + + var bx0 = clamp(bar_x, scr_x, scr_x + scr_w); + var bx1 = clamp(bar_x + bar_w, scr_x, scr_x + scr_w); + var ww = bx1 - bx0; + + var by0 = clamp(bar_y, scr_y, scr_y + scr_h); + var by1 = clamp(bar_y + bar_h, scr_y, scr_y + scr_h); + var hh = by1 - by0; + + draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, bg_col, 1); + draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bx0, by0, ww, hh, bar_col, 1); + + //draw_set_color(c_white); + //draw_rectangle(scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2, 0); + //draw_set_color(c_red); + //draw_circle(mx, my, 2, false); + if(active && point_in_rectangle(mx, my, scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2) || is_scrolling) { draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bar_x, bar_y, bar_w, bar_h, bar_hcol, 1); if(mouse_press(mb_left, active)) { diff --git a/scripts/shell_helper/shell_helper.gml b/scripts/shell_helper/shell_helper.gml index ba5e170fa..f356f3b1f 100644 --- a/scripts/shell_helper/shell_helper.gml +++ b/scripts/shell_helper/shell_helper.gml @@ -1,4 +1,4 @@ function shellOpenExplorer(path) { var _windir = environment_get_variable("WINDIR") + "/explorer.exe"; - execute_shell_simple(_windir, path); + execute_shell(_windir, path); } \ No newline at end of file diff --git a/scripts/slider/slider.gml b/scripts/slider/slider.gml index 474f2d1c7..48204d43e 100644 --- a/scripts/slider/slider.gml +++ b/scripts/slider/slider.gml @@ -16,7 +16,11 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg hdw = ui(20); - tb_value = new textBox(TEXTBOX_INPUT.float, onApply); + tb_value = new textBox(TEXTBOX_INPUT.number, onApply); + + static setSlideSpeed = function(speed) { + tb_value.slide_speed = speed; + } static setInteract = function(interactable = noone) { self.interactable = interactable; @@ -72,9 +76,10 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg if(key_mod_press(CTRL)) val = round(val); - if(onModify != noone) - onModify(val); - UNDO_HOLDING = true; + if(onModify != noone) { + if(onModify(val)) + UNDO_HOLDING = true; + } if(mouse_release(mb_left)) { dragging = false; diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index 908c2db9f..f394e6419 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -9,13 +9,16 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { drag_mx = 0; drag_sx = 0; - tb_value_min = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(0, clamp(val, minn, maxx)); }); - tb_value_max = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(1, clamp(val, minn, maxx)); }); + tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, minn, maxx)); }); + tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, minn, maxx)); }); tb_value_min.slidable = true; tb_value_max.slidable = true; - tb_value_min.slide_speed = 0.01; - tb_value_max.slide_speed = 0.01; + + static setSlideSpeed = function(speed) { + tb_value_min.slide_speed = speed; + tb_value_max.slide_speed = speed; + } static setInteract = function(interactable = noone) { self.interactable = interactable; @@ -67,8 +70,8 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { if(key_mod_press(CTRL)) val = round(val); - onModify(dragging, val); - UNDO_HOLDING = true; + if(onModify(dragging, val)) + UNDO_HOLDING = true; if(mouse_release(mb_left)) { UNDO_HOLDING = false; diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 789f57e02..6907cc0de 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -1,6 +1,7 @@ enum TEXT_AREA_FORMAT { _default, - code + code, + delimiter } function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onModify, _extras) constructor { @@ -74,11 +75,6 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod _input_text_line = []; draw_set_font(font); - if(string_pos("\n", _input_text) == 0) { - array_push(_input_text_line, _input_text); - return; - } - var _txtLines = string_splice(_input_text, "\n"); var ss = ""; @@ -220,7 +216,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod apply(); if(keyboard_check_pressed(vk_home)) { - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -236,7 +232,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod } } else if(keyboard_check_pressed(vk_end)) { - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -283,6 +279,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod draw_text(ch_x, ch_y, _str); else if(format == TEXT_AREA_FORMAT.code) draw_code(ch_x, ch_y, _str); + else if(format == TEXT_AREA_FORMAT.delimiter) + draw_text_delimiter(ch_x, ch_y, _str); ch_y += line_height(); } @@ -389,7 +387,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod #region cursor if(KEYBOARD_PRESSED == vk_left) { - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -405,7 +403,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod } } if(KEYBOARD_PRESSED == vk_right) { - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -447,7 +445,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod _target = _char; } - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -481,7 +479,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod _target = _char; } - if(keyboard_check(vk_shift)) { + if(key_mod_press(SHIFT)) { if(cursor_select == -1) cursor_select = cursor; } else @@ -530,7 +528,12 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod } if(char_run <= cursor && cursor <= char_run + _l) { - cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_run)); + if(format == TEXT_AREA_FORMAT.delimiter) { + var str_cur = string_copy(_str, 1, cursor - char_run); + str_cur = string_replace_all(str_cur, " ", ""); + cursor_pos_x_to = ch_x + string_width(str_cur); + } else + cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_run)); cursor_pos_y_to = ch_y; cursor_line = i; } diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index 1524c8b3a..f7dbb4a26 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -9,19 +9,20 @@ function vectorBox(_size, _type, _onModify, _unit = noone) : widget() constructo onModifyIndex = function(index, val) { if(linked) { + var modi = false; for( var i = 0; i < size; i++ ) - onModify(i, toNumber(val)); - return; + modi |= onModify(i, toNumber(val)); + return modi; } - onModify(index, toNumber(val)); + return onModify(index, toNumber(val)); } axis = [ "x", "y", "z", "w" ]; - onModifySingle[0] = function(val) { onModifyIndex(0, val); } - onModifySingle[1] = function(val) { onModifyIndex(1, val); } - onModifySingle[2] = function(val) { onModifyIndex(2, val); } - onModifySingle[3] = function(val) { onModifyIndex(3, val); } + onModifySingle[0] = function(val) { return onModifyIndex(0, val); } + onModifySingle[1] = function(val) { return onModifyIndex(1, val); } + onModifySingle[2] = function(val) { return onModifyIndex(2, val); } + onModifySingle[3] = function(val) { return onModifyIndex(3, val); } extras = -1; @@ -30,6 +31,11 @@ function vectorBox(_size, _type, _onModify, _unit = noone) : widget() constructo tb[i].slidable = true; } + static setSlideSpeed = function(speed) { + for(var i = 0; i < size; i++) + tb[i].slide_speed = speed; + } + static setInteract = function(interactable) { self.interactable = interactable; b_link.interactable = interactable; diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 77033b119..d9d0b2f26 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -9,20 +9,21 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const onModifyIndex = function(index, val) { if(linked) { - onModify(floor(index / 2) * 2 + 0, toNumber(val)); - onModify(floor(index / 2) * 2 + 1, toNumber(val)); - return; + var modi = false; + modi |= onModify(floor(index / 2) * 2 + 0, toNumber(val)); + modi |= onModify(floor(index / 2) * 2 + 1, toNumber(val)); + return modi; } - onModify(index, toNumber(val)); + return onModify(index, toNumber(val)); } axis = [ "x", "y", "z", "w"]; label = []; - onModifySingle[0] = function(val) { onModifyIndex(0, toNumber(val)); } - onModifySingle[1] = function(val) { onModifyIndex(1, toNumber(val)); } - onModifySingle[2] = function(val) { onModifyIndex(2, toNumber(val)); } - onModifySingle[3] = function(val) { onModifyIndex(3, toNumber(val)); } + onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } + onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } + onModifySingle[2] = function(val) { return onModifyIndex(2, toNumber(val)); } + onModifySingle[3] = function(val) { return onModifyIndex(3, toNumber(val)); } extras = -1; @@ -33,6 +34,11 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const label[i] = (i % 2? "max " : "min ") + axis[floor(i / 2)]; } + static setSlideSpeed = function(speed) { + for(var i = 0; i < size; i++) + tb[i].slide_speed = speed; + } + static setInteract = function(interactable = noone) { self.interactable = interactable; b_link.interactable = interactable; diff --git a/shaders/sh_blend_add/sh_blend_add.fsh b/shaders/sh_blend_add/sh_blend_add.fsh index e87b8bbbe..8c3fdfa2f 100644 --- a/shaders/sh_blend_add/sh_blend_add.fsh +++ b/shaders/sh_blend_add/sh_blend_add.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -34,5 +35,6 @@ void main() { _col1.rgb *= _col1.a; vec4 res = _col0 + _col1; + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_contrast/sh_blend_contrast.fsh b/shaders/sh_blend_contrast/sh_blend_contrast.fsh index 0abe768bf..e353b58d2 100644 --- a/shaders/sh_blend_contrast/sh_blend_contrast.fsh +++ b/shaders/sh_blend_contrast/sh_blend_contrast.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -34,6 +35,7 @@ void main() { float lum = dot(_col1.rgb, vec3(0.2126, 0.7152, 0.0722)); vec4 blend = lum > 0.5? (vec4(1.) - (vec4(1.) - _col0) * (vec4(1.) - _col1) * 2.) : (_col0 * _col1 * 2.); vec4 res = mix(_col0, blend, opacity); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_luma/sh_blend_luma.fsh b/shaders/sh_blend_luma/sh_blend_luma.fsh index 471927cd6..73c5e185a 100644 --- a/shaders/sh_blend_luma/sh_blend_luma.fsh +++ b/shaders/sh_blend_luma/sh_blend_luma.fsh @@ -21,18 +21,18 @@ float sampleMask() { float hue2rgb( in float m1, in float m2, in float hue) { if (hue < 0.0) - hue += 1.0; - else if (hue > 1.0) - hue -= 1.0; + hue += 1.0; + else if (hue > 1.0) + hue -= 1.0; - if ((6.0 * hue) < 1.0) + if ((6.0 * hue) < 1.0) return m1 + (m2 - m1) * hue * 6.0; - else if ((2.0 * hue) < 1.0) - return m2; - else if ((3.0 * hue) < 2.0) - return m1 + (m2 - m1) * ((2.0 / 3.0) - hue) * 6.0; - else - return m1; + else if ((2.0 * hue) < 1.0) + return m2; + else if ((3.0 * hue) < 2.0) + return m1 + (m2 - m1) * ((2.0 / 3.0) - hue) * 6.0; + else + return m1; } vec3 hsl2rgb( in vec3 hsl ) { @@ -53,8 +53,8 @@ vec3 hsl2rgb( in vec3 hsl ) { g = hue2rgb(m1, m2, hsl.x); b = hue2rgb(m1, m2, hsl.x - 1. / 3.); } - - return vec3( r, g, b ); + + return vec3( r, g, b ); } vec3 rgb2hsl( in vec3 c ){ @@ -70,9 +70,9 @@ vec3 rgb2hsl( in vec3 c ){ l = ( cMax + cMin ) / 2.0; if ( cMax > cMin ) { float cDelta = cMax - cMin; - + s = l < .5 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); - + if ( r == cMax ) h = ( g - b ) / cDelta; else if ( g == cMax ) @@ -105,5 +105,5 @@ void main() { vec4 res = vec4(hsl2rgb(_hsl0), _col0.a); if(preserveAlpha == 1) res.a = _col0.a; - gl_FragColor = res; + gl_FragColor = res; } diff --git a/shaders/sh_blend_max/sh_blend_max.fsh b/shaders/sh_blend_max/sh_blend_max.fsh index 7c5074ab9..2a746a8dc 100644 --- a/shaders/sh_blend_max/sh_blend_max.fsh +++ b/shaders/sh_blend_max/sh_blend_max.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -36,6 +37,7 @@ void main() { res.g = max(_col0.g, _col1.g); res.b = max(_col0.b, _col1.b); res.a = max(_col0.a, _col1.a); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_min/sh_blend_min.fsh b/shaders/sh_blend_min/sh_blend_min.fsh index ab700f2d6..c323fd0fb 100644 --- a/shaders/sh_blend_min/sh_blend_min.fsh +++ b/shaders/sh_blend_min/sh_blend_min.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -36,6 +37,7 @@ void main() { res.g = min(_col0.g, _col1.g); res.b = min(_col0.b, _col1.b); res.a = min(_col0.a, _col1.a); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_multiply/sh_blend_multiply.fsh b/shaders/sh_blend_multiply/sh_blend_multiply.fsh index bb8e5ea6e..66e6106e8 100644 --- a/shaders/sh_blend_multiply/sh_blend_multiply.fsh +++ b/shaders/sh_blend_multiply/sh_blend_multiply.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -32,6 +33,7 @@ void main() { _col1.a *= opacity * sampleMask(); vec4 res = (_col0 * (1. - opacity)) + (_col0 * _col1 * opacity); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_normal/sh_blend_normal.fsh b/shaders/sh_blend_normal/sh_blend_normal.fsh index b242508aa..eabceae4d 100644 --- a/shaders/sh_blend_normal/sh_blend_normal.fsh +++ b/shaders/sh_blend_normal/sh_blend_normal.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -34,6 +35,7 @@ void main() { float al = _col0.a + _col1.a * (1. - _col0.a); vec4 res = ((_col0 * _col0.a) + (_col1 * _col1.a * (1. - _col0.a))) / al; res.a = al; + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_overlay/sh_blend_overlay.fsh b/shaders/sh_blend_overlay/sh_blend_overlay.fsh index a9277c6b3..8d569a0ea 100644 --- a/shaders/sh_blend_overlay/sh_blend_overlay.fsh +++ b/shaders/sh_blend_overlay/sh_blend_overlay.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -34,6 +35,7 @@ void main() { float lum = dot(_col1.rgb, vec3(0.2126, 0.7152, 0.0722)); vec4 blend = lum > 0.5? (1. - (1. - 2. * (_col1 - 0.5)) * (1. - _col0)) : ((2. * _col1) * _col0); vec4 res = mix(_col0, blend, opacity); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_screen/sh_blend_screen.fsh b/shaders/sh_blend_screen/sh_blend_screen.fsh index 1fabdbb3a..6e32cf697 100644 --- a/shaders/sh_blend_screen/sh_blend_screen.fsh +++ b/shaders/sh_blend_screen/sh_blend_screen.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -36,6 +37,7 @@ void main() { _col1.rgb *= _col1.a; vec4 res = vec4(1.) - (vec4(1.) - _col0) * (vec4(1.) - _col1); + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; } diff --git a/shaders/sh_blend_subtract/sh_blend_subtract.fsh b/shaders/sh_blend_subtract/sh_blend_subtract.fsh index 1a4cb354e..60625511a 100644 --- a/shaders/sh_blend_subtract/sh_blend_subtract.fsh +++ b/shaders/sh_blend_subtract/sh_blend_subtract.fsh @@ -8,6 +8,7 @@ uniform vec2 dimension; uniform int tile_type; uniform int useMask; +uniform int preserveAlpha; uniform sampler2D mask; uniform sampler2D fore; uniform float opacity; @@ -34,6 +35,7 @@ void main() { _col1.rgb *= _col1.a; vec4 res = _col0 - _col1; + if(preserveAlpha == 1) res.a = _col0.a; gl_FragColor = res; }