Source control mishap fix 1

This commit is contained in:
Tanasart 2023-02-14 11:32:32 +07:00
parent 83634ca975
commit bc98b195f8
257 changed files with 5302 additions and 3265 deletions

View file

@ -81,7 +81,7 @@
{"id":{"name":"s_node_polar","path":"sprites/s_node_polar/s_node_polar.yy",},"order":5,}, {"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":"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":"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":"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_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,}, {"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":"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":"math_function","path":"scripts/math_function/math_function.yy",},"order":7,},
{"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},"order":13,}, {"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":"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":"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,}, {"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":"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":"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":"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":"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":"panel_inspector","path":"scripts/panel_inspector/panel_inspector.yy",},"order":0,},
{"id":{"name":"node_padding","path":"scripts/node_padding/node_padding.yy",},"order":9,}, {"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":"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":"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":"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":"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":"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,}, {"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":"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":"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":"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":"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":"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,}, {"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":"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_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":"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_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":"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,}, {"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":"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_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":"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":"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":"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,}, {"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_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":"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":"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":"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":"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,}, {"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":"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":"regex","path":"scripts/regex/regex.yy",},"order":0,},
{"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},"order":6,}, {"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":"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":"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":"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":"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":"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":"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":"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,}, {"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":"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":"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":"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":"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":"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":"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_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":"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":"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":"draw_shapes","path":"scripts/draw_shapes/draw_shapes.yy",},"order":10,},
{"id":{"name":"node_channels","path":"scripts/node_channels/node_channels.yy",},"order":0,}, {"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":"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":"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":"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":"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":"compat","folderPath":"folders/functions/compat.yy","order":13,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"control","folderPath":"folders/functions/control.yy","order":22,}, {"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":"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":"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":"widgets","folderPath":"folders/widgets.yy","order":6,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"menu","folderPath":"folders/dialog/menu.yy","order":18,},
], ],
"AudioGroups": [ "AudioGroups": [
{"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,},

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -32,7 +32,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -0,0 +1,7 @@
/// @description init
event_inherited();
#region data
dialog_w = ui(480);
dialog_h = ui(140);
#endregion

View file

@ -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

View file

@ -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",
},
}

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -23,16 +23,16 @@ event_inherited();
#region pages #region pages
page_current = 0; page_current = 0;
page[0] = "General"; page[0] = get_text("pref_pages_general", "General");
page[1] = "Node settings"; page[1] = get_text("pref_pages_nodes", "Node settings");
page[2] = "Appearances"; page[2] = get_text("pref_pages_appearance", "Appearances");
page[3] = "Colors"; page[3] = get_text("pref_pages_colors", "Colors");
page[4] = "Hotkeys"; page[4] = get_text("pref_pages_hotkeys", "Hotkeys");
pref_global = ds_list_create(); pref_global = ds_list_create();
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Show welcome screen", get_text("pref_show_welcome_screen", "Show welcome screen"),
"show_splash", "show_splash",
new checkBox(function() { new checkBox(function() {
PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"]; PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"];
@ -42,7 +42,7 @@ event_inherited();
PREF_MAP[? "_display_scaling"] = PREF_MAP[? "display_scaling"]; PREF_MAP[? "_display_scaling"] = PREF_MAP[? "display_scaling"];
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"GUI scaling", get_text("pref_gui_scaling", "GUI scaling"),
"_display_scaling", "_display_scaling",
new slider(0.5, 2, 0.01, function(val) { new slider(0.5, 2, 0.01, function(val) {
PREF_MAP[? "_display_scaling"] = val; PREF_MAP[? "_display_scaling"] = val;
@ -61,7 +61,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Double click delay", get_text("pref_double_click_delay", "Double click delay"),
"double_click_delay", "double_click_delay",
new slider(0, 1, 0.01, function(val) { new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "double_click_delay"] = val; PREF_MAP[? "double_click_delay"] = val;
@ -70,7 +70,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Keyboard hold start", get_text("pref_keyboard_hold_start", "Keyboard hold start"),
"keyboard_repeat_start", "keyboard_repeat_start",
new slider(0, 1, 0.01, function(val) { new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "keyboard_repeat_start"] = val; PREF_MAP[? "keyboard_repeat_start"] = val;
@ -79,7 +79,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Keyboard repeat delay", get_text("pref_keyboard_repeat_delay", "Keyboard repeat delay"),
"keyboard_repeat_speed", "keyboard_repeat_speed",
new slider(0, 1, 0.01, function(val) { new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "keyboard_repeat_speed"] = val; PREF_MAP[? "keyboard_repeat_speed"] = val;
@ -88,7 +88,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"UI frame rate", get_text("pref_ui_frame_rate", "UI frame rate"),
"ui_framerate", "ui_framerate",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "ui_framerate"] = max(15, round(real(str))); PREF_MAP[? "ui_framerate"] = max(15, round(real(str)));
@ -98,7 +98,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Default surface size", get_text("pref_default_surface_size", "Default surface size"),
"default_surface_side", "default_surface_side",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "default_surface_side"] = max(1, round(real(str))); PREF_MAP[? "default_surface_side"] = max(1, round(real(str)));
@ -107,7 +107,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Show node render time", get_text("pref_show_node_render_time", "Show node render time"),
"node_show_time", "node_show_time",
new checkBox(function() { new checkBox(function() {
PREF_MAP[? "node_show_time"] = !PREF_MAP[? "node_show_time"]; PREF_MAP[? "node_show_time"] = !PREF_MAP[? "node_show_time"];
@ -116,7 +116,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Show node render status", get_text("pref_show_node_render_status", "Show node render status"),
"node_show_render_status", "node_show_render_status",
new checkBox(function() { new checkBox(function() {
PREF_MAP[? "node_show_render_status"] = !PREF_MAP[? "node_show_render_status"]; PREF_MAP[? "node_show_render_status"] = !PREF_MAP[? "node_show_render_status"];
@ -125,7 +125,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Collection preview speed", get_text("pref_collection_preview_speed", "Collection preview speed"),
"collection_preview_speed", "collection_preview_speed",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "collection_preview_speed"] = max(1, round(real(str))); PREF_MAP[? "collection_preview_speed"] = max(1, round(real(str)));
@ -135,7 +135,7 @@ event_inherited();
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Inspector line break width", get_text("pref_inspector_line_break_width", "Inspector line break width"),
"inspector_line_break_width", "inspector_line_break_width",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "inspector_line_break_width"] = max(1, round(real(str))); PREF_MAP[? "inspector_line_break_width"] = max(1, round(real(str)));
@ -144,7 +144,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Expand hovering panel", get_text("pref_expand_hovering_panel", "Expand hovering panel"),
"expand_hover", "expand_hover",
new checkBox(function() { new checkBox(function() {
PREF_MAP[? "expand_hover"] = !PREF_MAP[? "expand_hover"]; PREF_MAP[? "expand_hover"] = !PREF_MAP[? "expand_hover"];
@ -153,7 +153,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Graph zoom smoothing", get_text("pref_graph_zoom_smoothing", "Graph zoom smoothing"),
"graph_zoom_smoooth", "graph_zoom_smoooth",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "graph_zoom_smoooth"] = max(1, round(real(str))); PREF_MAP[? "graph_zoom_smoooth"] = max(1, round(real(str)));
@ -162,7 +162,7 @@ event_inherited();
]); ]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Warning notification time", get_text("pref_warning_notification_time", "Warning notification time"),
"notification_time", "notification_time",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "notification_time"] = max(0, round(real(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 #endregion
#region //NODE #region //NODE
@ -177,7 +186,7 @@ event_inherited();
ds_list_add(pref_node, "Particle"); ds_list_add(pref_node, "Particle");
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Max particles", get_text("pref_max_particles", "Max particles"),
"part_max_amount", "part_max_amount",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "part_max_amount"] = real(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, "Separate shape");
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Max shapes", get_text("pref_max_shapes", "Max shapes"),
"shape_separation_max", "shape_separation_max",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "shape_separation_max"] = real(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, "Levels");
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Histogram resolution", get_text("pref_histogram_resolution", "Histogram resolution"),
"level_resolution", "level_resolution",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "level_resolution"] = real(str); PREF_MAP[? "level_resolution"] = real(str);
@ -206,7 +215,7 @@ event_inherited();
]); ]);
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Maximum sampling", get_text("pref_maximum_sampling", "Maximum sampling"),
"level_max_sampling", "level_max_sampling",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "level_max_sampling"] = real(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, "Physics");
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Verlet iteration", get_text("pref_verlet_iteration", "Verlet iteration"),
"verlet_iteration", "verlet_iteration",
new textBox(TEXTBOX_INPUT.number, function(str) { new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "verlet_iteration"] = real(str); PREF_MAP[? "verlet_iteration"] = real(str);
@ -225,10 +234,10 @@ event_inherited();
]); ]);
ds_list_add(pref_node, [ ds_list_add(pref_node, [
"Gravity", get_text("pref_gravity", "Gravity"),
"physics_gravity", "physics_gravity",
new vectorBox(2, TEXTBOX_INPUT.number, function(val) { new vectorBox(2, TEXTBOX_INPUT.number, function(index, val) {
PREF_MAP[? "physics_gravity"] = val; PREF_MAP[? "physics_gravity"][index] = val;
physics_world_gravity(PREF_MAP[? "physics_gravity"][0], PREF_MAP[? "physics_gravity"][1]); physics_world_gravity(PREF_MAP[? "physics_gravity"][0], PREF_MAP[? "physics_gravity"][1]);
PREF_SAVE(); PREF_SAVE();
}) })
@ -240,18 +249,18 @@ event_inherited();
ds_list_add(pref_appr, "Graph"); ds_list_add(pref_appr, "Graph");
ds_list_add(pref_appr, [ ds_list_add(pref_appr, [
"Connection thickness", get_text("pref_connection_thickness", "Connection thickness"),
"connection_line_width", "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_MAP[? "connection_line_width"] = real(str);
PREF_SAVE(); PREF_SAVE();
}) })
]); ]);
ds_list_add(pref_appr, [ ds_list_add(pref_appr, [
"Connection curve smoothness", get_text("pref_connection_curve_smoothness", "Connection curve smoothness"),
"connection_line_sample", "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_MAP[? "connection_line_sample"] = real(str);
PREF_SAVE(); PREF_SAVE();
}) })
@ -328,7 +337,7 @@ event_inherited();
if(b == 2) { if(b == 2) {
var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2);
dialog.selector.setColor(val); dialog.setDefault(val);
self.key = key; self.key = key;
dialog.onApply = function(color) { dialog.onApply = function(color) {
variable_struct_set(COLORS, self.key, color); variable_struct_set(COLORS, self.key, color);
@ -499,8 +508,8 @@ event_inherited();
var _mod_prs = 0; var _mod_prs = 0;
if(key_mod_press(CTRL)) _mod_prs |= MOD_KEY.ctrl; if(key_mod_press(CTRL)) _mod_prs |= MOD_KEY.ctrl;
if(keyboard_check(vk_shift)) _mod_prs |= MOD_KEY.shift; if(key_mod_press(SHIFT)) _mod_prs |= MOD_KEY.shift;
if(keyboard_check(vk_alt)) _mod_prs |= MOD_KEY.alt; if(key_mod_press(ALT)) _mod_prs |= MOD_KEY.alt;
if(keyboard_check_pressed(vk_escape)) { if(keyboard_check_pressed(vk_escape)) {
key.key = ""; key.key = "";
@ -551,7 +560,7 @@ event_inherited();
modified = true; modified = true;
var bx = x1 - ui(32); var bx = x1 - ui(32);
var by = _y + hh; 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.key = dkey;
key.modi = dmod; key.modi = dmod;
} }
@ -564,7 +573,7 @@ event_inherited();
if(modified) { if(modified) {
var bx = x1 - ui(32); var bx = x1 - ui(32);
var by = _y + ui(2); 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++) { for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]]; var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
for(var i = 0; i < ds_list_size(ll); i++) { for(var i = 0; i < ds_list_size(ll); i++) {

View file

@ -32,7 +32,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -33,7 +33,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -31,7 +31,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -32,7 +32,7 @@
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],
"parent": { "parent": {
"name": "dialog", "name": "menu",
"path": "folders/dialog.yy", "path": "folders/dialog/menu.yy",
}, },
} }

View file

@ -19,12 +19,14 @@
#region panels #region panels
if(PANEL_MAIN == 0) setPanel(); if(PANEL_MAIN == 0) setPanel();
var surf = surface_get_target();
try
PANEL_MAIN.draw(); PANEL_MAIN.draw();
catch(e) {
while(surface_get_target() != surf) //var surf = surface_get_target();
surface_reset_target(); //try
noti_warning("UI error: " + exception_print(e)); // PANEL_MAIN.draw();
} //catch(e) {
// while(surface_get_target() != surf)
// surface_reset_target();
// noti_warning("UI error: " + exception_print(e));
//}
#endregion #endregion

View file

@ -15,6 +15,9 @@
log_message("DIRECTORY", DIRECTORY); log_message("DIRECTORY", DIRECTORY);
PREF_LOAD(); PREF_LOAD();
loadFonts();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
__initLocale(); __initLocale();
__init_theme(); __init_theme();
@ -26,10 +29,6 @@
__init_node_guide(); __init_node_guide();
__initSteamUGC(); __initSteamUGC();
loadFonts();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
setPanel(); setPanel();
if(file_exists("icon.png")) if(file_exists("icon.png"))

View file

@ -1,4 +1,11 @@
/// @description /// @description
#region log #region log
log_message("SESSION", "Ended"); log_message("SESSION", "Ended");
PREF_SAVE();
#endregion
#region steam
if(STEAM_ENABLED) {
steam_shutdown();
}
#endregion #endregion

View file

@ -1,3 +1,10 @@
/// @description init /// @description init
MODIFIED = false; MODIFIED = false;
PREF_LOAD(); PREF_LOAD();
#region reset data
ds_stack_clear(UNDO_STACK);
ds_stack_clear(REDO_STACK);
VARIABLE = new Node_Global();
#endregion

View file

@ -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); var _s = surface_create(prev_size, prev_size);
surface_set_target(_s); surface_set_target(_s);
draw_clear(COLORS._main_icon_dark); 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); draw_sprite_stretched(s_workshop_frame, 0, 0, 0, prev_size, prev_size);
if(spr == -1) spr = THEME.group; if(spr == -1) spr = THEME.group;

View file

@ -1,5 +1,8 @@
/// @description /// @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"]; dropping = async_load[?"filename"];
array_push(drop_path, dropping); array_push(drop_path, dropping);
} }

View file

@ -1,3 +0,0 @@
function Script509(){
}

View file

@ -24,9 +24,6 @@ function __part(_node) constructor {
boundary_data = -1; boundary_data = -1;
fx = 0;
fy = 0;
gy = 0; gy = 0;
scx = 1; scx = 1;
@ -145,8 +142,8 @@ function __part(_node) constructor {
} }
if(!is_surface(ss)) return; if(!is_surface(ss)) return;
scx = sc_sx * 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_bezier_cubic_x(sct, 1 - life / life_total); scy = sc_sy * eval_curve_x(sct, 1 - life / life_total);
var _xx, _yy; var _xx, _yy;
var s_w = surface_get_width(ss) * scx; 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); var cc = (col == -1)? c_white : gradient_eval(col, 1 - life / life_total);
cc = colorMultiply(blend, cc); 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); draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw);
} }

View file

@ -7,51 +7,52 @@ enum FORCE_TYPE {
Turbulence, Turbulence,
Destroy Destroy
} }
/*
function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_Particle_Effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "Effector"; name = "Effector";
previewable = false; previewable = false;
color = COLORS.node_blend_vfx;
icon = THEME.vfx;
w = 96; w = 96;
h = 32 + 24; h = 32 + 24;
min_h = h; 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); .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); .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); .setDisplay(VALUE_DISPLAY.area);
inputs[| 3] = nodeValue(3, "Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ) inputs[| 3] = nodeValue("Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 );
.setDisplay(VALUE_DISPLAY.curve);
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" ] ); .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); .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); .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); .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, input_display_list = [ 0, 1,
["Area", false], 2, 3, 4, ["Area", false], 2, 3, 4,
["Effect", false], 5, 10, 7, 6, 8, 9 ["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 = []; 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_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_x0, _area_y0, _area_x0, _area_y1),
distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _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) { } else if(_area_t == AREA_SHAPE.elipse) {
if(point_in_circle(pv[0], pv[1], _area_x, _area_y, min(_area_w, _area_h))) { 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); 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_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_x0, _area_y0, _area_x0, _area_y1),
distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _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) { } else if(_area_t == AREA_SHAPE.elipse) {
if(point_in_circle(pv[0], pv[1], _area_x, _area_y, min(_area_w, _area_h))) { 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); 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; else part.scy += sign(part.scy) * scy_s;
} }
static update = function() { static update = function(frame = ANIMATOR.current_frame) {
outputs[| 0].setValue(inputs[| 0].getValue()); outputs[| 0].setValue(inputs[| 0].getValue());
var jun = outputs[| 0]; var jun = outputs[| 0];
for(var j = 0; j < ds_list_size(jun.value_to); j++) { for(var j = 0; j < ds_list_size(jun.value_to); j++) {

View file

@ -1,93 +1,99 @@
function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "Spawner"; name = "Spawner";
inputs[| 0] = nodeValue(0, "Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) inputs[| 0] = nodeValue("Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
.setDisplay(noone, "particles");
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); .setDisplay(VALUE_DISPLAY.area);
inputs[| 4] = nodeValue(4, "Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Area", "Border" ]); .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); .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); .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); .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); .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); .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); .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); .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); .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" ]); .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); .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); .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" ]) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation" ])
.setVisible(false); .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); .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" ]); .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); .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" ]) .setDisplay(VALUE_DISPLAY.enum_button, [ "Loop", "Ping pong", "Destroy" ])
.setVisible(false); .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); .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_len = ds_list_size(inputs);
input_display_list = [ input_display_list = [ 32,
["Sprite", false], 0, 22, 23, 26, ["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, ["Movement", true], 29, 6, 18, 7,
["Physics", true], 19, 20, ["Physics", true], 19, 20,
["Rotation", true], 15, 8, 9, ["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 = array_create(PREF_MAP[? "part_max_amount"]);
parts_runner = 0; parts_runner = 0;
seed_origin = irandom(9999999); seed = 0;
seed = seed_origin;
spawn_index = 0; spawn_index = 0;
scatter_index = 0; scatter_index = 0;
def_surface = -1; def_surface = -1;
@ -114,12 +119,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const
var _inSurf = current_data[0]; var _inSurf = current_data[0];
if(_inSurf == 0) { if(_inSurf == 0) {
if(def_surface == -1 || !surface_exists(def_surface)) { if(!is_surface(def_surface))
def_surface = PIXEL_SURFACE; return;
surface_set_target(def_surface);
draw_clear(c_white);
surface_reset_target();
}
_inSurf = def_surface; _inSurf = def_surface;
} }
@ -128,6 +129,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const
var _spawn_area = current_data[ 3]; var _spawn_area = current_data[ 3];
var _distrib = current_data[ 4]; var _distrib = current_data[ 4];
var _dist_map = current_data[30];
var _dist_data = current_data[31];
var _scatter = current_data[24]; var _scatter = current_data[24];
var _life = current_data[ 5]; var _life = current_data[ 5];
@ -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; if(_rotation[1] < _rotation[0]) _rotation[1] += 360;
repeat(_amo) { var _posDist = [];
random_set_seed(seed++); 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); parts_runner = clamp(parts_runner, 0, array_length(parts) - 1);
var part = parts[parts_runner]; 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; part.boundary_data = _b;
} else { } else {
if(_distrib < 2) {
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed); var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed);
xx = sp[0]; xx = sp[0];
yy = sp[1]; 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 { } else {
xx = _pos[0]; 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"]); spawn_index = safe_mod(spawn_index + 1, PREF_MAP[? "part_max_amount"]);
onSpawn(_time, part); 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(); render();
seed = seed_origin; seed = inputs[| 32].getValue();
var _loop = inputs[| 21].getValue(); var _loop = inputs[| 21].getValue();
if(!_loop) return; if(!_loop) return;
@ -258,7 +281,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const
updateParticleForward(false); updateParticleForward(false);
} }
seed = seed_origin; seed = inputs[| 32].getValue();
} }
function checkPartPool() { function checkPartPool() {
@ -307,13 +330,17 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const
static step = function() { static step = function() {
var _inSurf = inputs[| 0].getValue(); var _inSurf = inputs[| 0].getValue();
var _dist = inputs[| 4].getValue();
var _scatt = inputs[| 24].getValue(); var _scatt = inputs[| 24].getValue();
var _dirAng = inputs[| 29].getValue(); var _dirAng = inputs[| 29].getValue();
inputs[| 6].setVisible(!_dirAng); inputs[| 6].setVisible(!_dirAng);
inputs[| 22].setVisible(false); inputs[| 22].setVisible(false);
inputs[| 23].setVisible(false); inputs[| 23].setVisible(false);
inputs[| 26].setVisible(false);
inputs[| 25].setVisible(_scatt == 2); inputs[| 25].setVisible(_scatt == 2);
inputs[| 30].setVisible(_dist == 2, _dist == 2);
inputs[| 31].setVisible(_dist == 3, _dist == 3);
if(is_array(_inSurf)) { if(is_array(_inSurf)) {
inputs[| 22].setVisible(true); 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() { static onStep = function() {
if(!ANIMATOR.frame_progress) return; RETURN_ON_REST
if(!ANIMATOR.is_playing) return;
if(ANIMATOR.current_frame == 0) if(ANIMATOR.current_frame == 0)
reset(); reset();
@ -349,7 +375,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = -1) : Node(_x, _y, _group) const
static onDrawOverlay = -1; static onDrawOverlay = -1;
static update = function() {} static update = function(frame = ANIMATOR.current_frame) {}
static render = function() {} static render = function() {}
static onPartCreate = function(part) {} static onPartCreate = function(part) {}

View file

@ -21,53 +21,53 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
onModifySingle[0] = function(val) { onModifySingle[0] = function(val) {
if(mode == AREA_MODE.area) { if(mode == AREA_MODE.area) {
onModify(0, toNumber(val)); return onModify(0, toNumber(val));
} else if(mode == AREA_MODE.padding) { } else if(mode == AREA_MODE.padding) {
var v = toNumber(val); var v = toNumber(val);
if(link_value) current_data = [ v, v, v, v ]; if(link_value) current_data = [ v, v, v, v ];
else current_data[0] = v; else current_data[0] = v;
setAllData(current_data); return setAllData(current_data);
} else if(mode == AREA_MODE.two_point) { } else if(mode == AREA_MODE.two_point) {
onModify(0, val); return onModify(0, val);
} }
} }
onModifySingle[1] = function(val) { onModifySingle[1] = function(val) {
if(mode == AREA_MODE.area) { if(mode == AREA_MODE.area) {
onModify(1, toNumber(val)); return onModify(1, toNumber(val));
} else if(mode == AREA_MODE.padding) { } else if(mode == AREA_MODE.padding) {
var v = toNumber(val); var v = toNumber(val);
if(link_value) current_data = [ v, v, v, v ]; if(link_value) current_data = [ v, v, v, v ];
else current_data[1] = v; else current_data[1] = v;
setAllData(current_data); return setAllData(current_data);
} else if(mode == AREA_MODE.two_point) { } else if(mode == AREA_MODE.two_point) {
onModify(1, val); return onModify(1, val);
} }
} }
onModifySingle[2] = function(val) { onModifySingle[2] = function(val) {
if(mode == AREA_MODE.area) { if(mode == AREA_MODE.area) {
onModify(2, toNumber(val)); return onModify(2, toNumber(val));
} else if(mode == AREA_MODE.padding) { } else if(mode == AREA_MODE.padding) {
var v = toNumber(val); var v = toNumber(val);
if(link_value) current_data = [ v, v, v, v ]; if(link_value) current_data = [ v, v, v, v ];
else current_data[2] = v; else current_data[2] = v;
setAllData(current_data); return setAllData(current_data);
} else if(mode == AREA_MODE.two_point) { } else if(mode == AREA_MODE.two_point) {
onModify(2, val); return onModify(2, val);
} }
} }
onModifySingle[3] = function(val) { onModifySingle[3] = function(val) {
if(mode == AREA_MODE.area) { if(mode == AREA_MODE.area) {
onModify(3, toNumber(val)); return onModify(3, toNumber(val));
} else if(mode == AREA_MODE.padding) { } else if(mode == AREA_MODE.padding) {
var v = toNumber(val); var v = toNumber(val);
if(link_value) current_data = [ v, v, v, v ]; if(link_value) current_data = [ v, v, v, v ];
else current_data[3] = v; else current_data[3] = v;
setAllData(current_data); return setAllData(current_data);
} else if(mode == AREA_MODE.two_point) { } 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; tb[i].slidable = true;
} }
static setSlideSpeed = function(speed) {
for(var i = 0; i < 4; i++)
tb[i].slide_speed = speed;
}
static setAllData = function(data) { static setAllData = function(data) {
onModify(0, data[0]); var mod0 = onModify(0, data[0]);
onModify(1, data[1]); var mod1 = onModify(1, data[1]);
onModify(2, data[2]); var mod2 = onModify(2, data[2]);
onModify(3, data[3]); var mod3 = onModify(3, data[3]);
return mod0 || mod1 || mod2 || mod3;
} }
static setInteract = function(interactable = noone) { static setInteract = function(interactable = noone) {

View file

@ -19,7 +19,7 @@ function buttonColorClass(_onApply) : widget() constructor {
static trigger = function() { static trigger = function() {
var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); 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.selector.onApply = onApply;
dialog.onApply = onApply; dialog.onApply = onApply;
} }
@ -35,17 +35,6 @@ function buttonColorClass(_onApply) : widget() constructor {
b_picker.active = active; b_picker.active = active;
b_picker.draw(_x + _w - ui(32), _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide); 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 _cw = _w - ui(40);
var click = false; var click = false;
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _cw, _y + _h)) { if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _cw, _y + _h)) {

View file

@ -10,7 +10,7 @@ function buttonGradientClass(_onApply) : widget() constructor {
static trigger = function() { static trigger = function() {
var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2); 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; dialog.onApply = onApply;
} }
@ -23,13 +23,13 @@ function buttonGradientClass(_onApply) : widget() constructor {
current_data = _data; current_data = _data;
var click = false; 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); draw_sprite_stretched(THEME.button, 1, _x, _y, _w, _h);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, iactive)) {
trigger(); trigger();
click = true; click = true;
} }
if(mouse_click(mb_left, active)) if(mouse_click(mb_left, iactive))
draw_sprite_stretched(THEME.button, 2, _x, _y, _w, _h); draw_sprite_stretched(THEME.button, 2, _x, _y, _w, _h);
} else { } else {
draw_sprite_stretched(THEME.button, 0, _x, _y, _w, _h); draw_sprite_stretched(THEME.button, 0, _x, _y, _w, _h);

View file

@ -75,6 +75,16 @@ function buttonGroupClass(_data, _onClick) : widget() constructor {
draw_sprite_ui_uniform(data[i], i, bx + ww / 2, _y + _h / 2); 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 { } else {
sb_small.hover = hover; sb_small.hover = hover;
sb_small.active = active; sb_small.active = active;

View file

@ -19,13 +19,13 @@ function controlPointBox(_onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
onSurfaceSize = -1; onSurfaceSize = -1;
tbCx = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.cx, toNumber(val)); }); tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); });
tbCy = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.cy, toNumber(val)); }); tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); });
tbFx = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.fx, toNumber(val)); }); tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); });
tbFy = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); });
tbW = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); });
tbH = new textBox(TEXTBOX_INPUT.float, function(val) { onModify(PUPPET_CONTROL.height, 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) { onModify(PUPPET_CONTROL.fy, toNumber(val)); }); rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); });
tbFx.slidable = true; tbFx.slidable = true;
tbFy.slidable = true; tbFy.slidable = true;
tbW.slidable = true; tbW.slidable = true;

View file

@ -4,24 +4,20 @@ BLEND_TYPES = [ "Normal", "Add", "Subtract", "Subtract keep alpha", "Multiply",
enum BLEND_MODE { enum BLEND_MODE {
normal, normal,
add, add,
subtract, subtract,
subtract_alpha,
multiply, multiply,
multiply_alpha,
screen, screen,
screen_alpha,
contrast, contrast,
overlay, overlay,
hue,
sat,
luma,
maxx, maxx,
minn, 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; if(!is_surface(background)) return;
var sh = sh_blend_normal var sh = sh_blend_normal
@ -29,13 +25,14 @@ function draw_surface_blend(background, foreground, blend, alpha, _mask = 0, til
case BLEND_MODE.normal : sh = sh_blend_normal break; case BLEND_MODE.normal : sh = sh_blend_normal break;
case BLEND_MODE.add : sh = sh_blend_add; break; case BLEND_MODE.add : sh = sh_blend_add; break;
case BLEND_MODE.subtract : sh = sh_blend_subtract; 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 : 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 : 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.contrast : sh = sh_blend_contrast; break;
case BLEND_MODE.overlay : sh = sh_blend_overlay; 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.maxx : sh = sh_blend_max; break;
case BLEND_MODE.minn : sh = sh_blend_min; break; case BLEND_MODE.minn : sh = sh_blend_min; break;
} }
@ -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_is_mask = shader_get_uniform(sh, "useMask");
var uniform_alpha = shader_get_uniform(sh, "opacity"); var uniform_alpha = shader_get_uniform(sh, "opacity");
var uniform_tile = shader_get_uniform(sh, "tile_type"); var uniform_tile = shader_get_uniform(sh, "tile_type");
var uniform_presalpha = shader_get_uniform(sh, "preserveAlpha");
var surf = surface_get_target(); var surf = surface_get_target();
var surf_w = surface_get_width(surf); 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_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_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_f(uniform_alpha, alpha);
shader_set_uniform_i(uniform_presalpha, _pre_alp);
shader_set_uniform_i(uniform_tile, tile); shader_set_uniform_i(uniform_tile, tile);
} }

View file

@ -1,11 +1,23 @@
function draw_text_add(_x, _y, _text) { function draw_text_over(_x, _y, _text) {
BLEND_OVERRIDE BLEND_OVERRIDE;
draw_text(_x, _y, _text); 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) { function draw_text_ext_add(_x, _y, _text, _sep, _w) {
BLEND_OVERRIDE BLEND_ADD;
draw_text_ext(_x, _y, _text, _sep, _w); draw_text_ext(_x, _y, _text, _sep, _w);
BLEND_NORMAL BLEND_NORMAL;
} }

View file

@ -15,9 +15,15 @@ enum ACTION_TYPE {
node_added, node_added,
node_delete, node_delete,
junction_connect, junction_connect,
junction_disconnect,
group_added, group_added,
group_removed, group_removed,
group,
ungroup,
collection_loaded,
} }
enum DS_TYPE { enum DS_TYPE {
@ -29,6 +35,7 @@ function Action(_type, _object, _data) constructor {
type = _type; type = _type;
obj = _object; obj = _object;
data = _data; data = _data;
extra_data = 0;
static undo = function() { static undo = function() {
var _n; var _n;
@ -47,6 +54,7 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.list_insert : case ACTION_TYPE.list_insert :
if(!ds_exists(obj, ds_type_list)) return; if(!ds_exists(obj, ds_type_list)) return;
ds_list_delete(obj, data[1]); ds_list_delete(obj, data[1]);
PANEL_ANIMATION.updatePropertyList();
break; break;
case ACTION_TYPE.list_modify : case ACTION_TYPE.list_modify :
if(!ds_exists(obj, ds_type_list)) return; if(!ds_exists(obj, ds_type_list)) return;
@ -62,19 +70,33 @@ function Action(_type, _object, _data) constructor {
nodeDelete(obj); nodeDelete(obj);
break; break;
case ACTION_TYPE.node_delete : case ACTION_TYPE.node_delete :
ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); obj.restore();
break; break;
case ACTION_TYPE.junction_connect : case ACTION_TYPE.junction_connect :
var _d = obj.value_from; var _d = obj.value_from;
obj.setFrom(data); obj.setFrom(data);
data = _d; data = _d;
break; break;
case ACTION_TYPE.junction_disconnect :
obj.setFrom(data);
break;
case ACTION_TYPE.group_added : case ACTION_TYPE.group_added :
obj.remove(data); obj.remove(data);
break; break;
case ACTION_TYPE.group_removed : case ACTION_TYPE.group_removed :
obj.add(data); obj.add(data);
break; 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 : case ACTION_TYPE.list_insert :
if(!ds_exists(obj, ds_type_list)) return; if(!ds_exists(obj, ds_type_list)) return;
ds_list_insert(obj, data[1], data[0]); ds_list_insert(obj, data[1], data[0]);
PANEL_ANIMATION.updatePropertyList();
break; break;
case ACTION_TYPE.list_modify : case ACTION_TYPE.list_modify :
if(!ds_exists(obj, ds_type_list)) return; if(!ds_exists(obj, ds_type_list)) return;
@ -106,7 +129,7 @@ function Action(_type, _object, _data) constructor {
ds_list_delete(obj, data[1]); ds_list_delete(obj, data[1]);
break; break;
case ACTION_TYPE.node_added : case ACTION_TYPE.node_added :
ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj); obj.restore();
break; break;
case ACTION_TYPE.node_delete : case ACTION_TYPE.node_delete :
nodeDelete(obj); nodeDelete(obj);
@ -116,12 +139,26 @@ function Action(_type, _object, _data) constructor {
obj.setFrom(data); obj.setFrom(data);
data = _d; data = _d;
break; break;
case ACTION_TYPE.junction_disconnect :
obj.removeFrom();
break;
case ACTION_TYPE.group_added : case ACTION_TYPE.group_added :
obj.add(data); obj.add(data);
break; break;
case ACTION_TYPE.group_removed : case ACTION_TYPE.group_removed :
obj.remove(data); obj.remove(data);
break; 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;
} }
} }
@ -129,9 +166,15 @@ function Action(_type, _object, _data) constructor {
var ss = ""; var ss = "";
switch(type) { switch(type) {
case ACTION_TYPE.var_modify : case ACTION_TYPE.var_modify :
if(array_length(data) > 2)
ss = "modify " + string(data[2]);
else
ss = "modify " + string(data[1]); ss = "modify " + string(data[1]);
break; break;
case ACTION_TYPE.list_insert : case ACTION_TYPE.list_insert :
if(array_length(data) > 2)
ss = data[2];
else
ss = "insert " + string(data[1]) + " to list " + string(obj); ss = "insert " + string(data[1]) + " to list " + string(obj);
break; break;
case ACTION_TYPE.list_modify : case ACTION_TYPE.list_modify :
@ -147,7 +190,10 @@ function Action(_type, _object, _data) constructor {
ss = "deleted " + string(obj.name) + " node"; ss = "deleted " + string(obj.name) + " node";
break; break;
case ACTION_TYPE.junction_connect : 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; break;
case ACTION_TYPE.group_added : case ACTION_TYPE.group_added :
ss = "add " + string(obj.name) + " to group"; ss = "add " + string(obj.name) + " to group";
@ -155,6 +201,15 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.group_removed : case ACTION_TYPE.group_removed :
ss = "remove " + string(obj.name) + " from group"; ss = "remove " + string(obj.name) + " from group";
break; 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; return ss;
} }
@ -162,25 +217,24 @@ function Action(_type, _object, _data) constructor {
function recordAction(_type, _object, _data = -1) { function recordAction(_type, _object, _data = -1) {
if(IS_UNDOING) return; if(IS_UNDOING) return;
if(UNDO_HOLDING) return;
if(LOADING) return; if(LOADING) return;
if(UNDO_HOLDING) return;
var act = new Action(_type, _object, _data); var act = new Action(_type, _object, _data);
array_push(o_main.action_last_frame, act); array_push(o_main.action_last_frame, act);
ds_stack_clear(REDO_STACK);
return act; return act;
} }
function UNDO() { function UNDO() {
if(ds_stack_empty(UNDO_STACK)) return; if(ds_stack_empty(UNDO_STACK)) return;
if(instance_exists(_p_dialog)) return; if(instance_exists(_p_dialog_undo_block)) return;
IS_UNDOING = true; IS_UNDOING = true;
var actions = ds_stack_pop(UNDO_STACK); var actions = ds_stack_pop(UNDO_STACK);
for(var i = 0; i < array_length(actions); i++) { for(var i = array_length(actions) - 1; i >= 0; i--)
//print("UNDO " + actions[i].toString());
actions[i].undo(); actions[i].undo();
}
IS_UNDOING = false; IS_UNDOING = false;
Render(); Render();
@ -189,13 +243,12 @@ function UNDO() {
function REDO() { 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; IS_UNDOING = true;
var actions = ds_stack_pop(REDO_STACK); var actions = ds_stack_pop(REDO_STACK);
for(var i = 0; i < array_length(actions); i++) { for(var i = 0; i < array_length(actions); i++)
//print("REDO " + actions[i].toString());
actions[i].redo(); actions[i].redo();
}
IS_UNDOING = false; IS_UNDOING = false;
Render(); Render();

View file

@ -4,8 +4,21 @@ enum GRADIENT_INTER {
hue 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) { function draw_gradient(_x, _y, _w, _h, _grad, _int = GRADIENT_INTER.smooth) {
if(!ds_exists(_grad, ds_type_list)) return;
static RES = 48; static RES = 48;
var _step = _w / RES; var _step = _w / RES;
var _ox, _oc; var _ox, _oc;
@ -18,22 +31,22 @@ function draw_gradient(_x, _y, _w, _h, _grad, _int = GRADIENT_INTER.smooth) {
var _grad_color = []; var _grad_color = [];
var _grad_time = []; var _grad_time = [];
for(var i = 0; i < ds_list_size(_grad); i++) { 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 + 0] = color_get_red(_grad[i].value) / 255;
_grad_color[i * 4 + 1] = color_get_green(_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 + 2] = color_get_blue(_grad[i].value) / 255;
_grad_color[i * 4 + 3] = 1; _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) draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _w, _h)
} else { } else {
shader_set(sh_gradient_display); shader_set(sh_gradient_display);
shader_set_uniform_i(uniform_grad_blend, _int); shader_set_uniform_i(uniform_grad_blend, _int);
shader_set_uniform_f_array(uniform_grad, _grad_color); shader_set_uniform_f_array_safe(uniform_grad, _grad_color);
shader_set_uniform_f_array(uniform_grad_time, _grad_time); shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time);
shader_set_uniform_i(uniform_grad_key, ds_list_size(_grad)); shader_set_uniform_i(uniform_grad_key, array_length(_grad));
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _w, _h) draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _w, _h)
shader_reset(); 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) { function gradient_eval(_gradient, _time, _int = GRADIENT_INTER.smooth) {
if(!ds_exists(_gradient, ds_type_list)) return c_white; if(array_length(_gradient) == 0) return c_white;
if(ds_list_size(_gradient) == 0) return c_white; if(array_length(_gradient) == 1) return _gradient[0].value;
if(ds_list_size(_gradient) == 1) return _gradient[| 0].value;
for(var i = 0; i < ds_list_size(_gradient); i++) { for(var i = 0; i < array_length(_gradient); i++) {
var _key = _gradient[| i]; var _key = _gradient[i];
if(_key.time < _time) continue; 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 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) { if(_int == GRADIENT_INTER.smooth) {
var rat = (_time - _gradient[| i - 1].time) / (_gradient[| i].time - _gradient[| i - 1].time); var rat = (_time - _gradient[i - 1].time) / (_gradient[i].time - _gradient[i - 1].time);
var c1 = _gradient[| i].value; var c1 = _gradient[i].value;
return merge_color(c0, c1, rat); return merge_color(c0, c1, rat);
} else if(_int == GRADIENT_INTER.none) { } else if(_int == GRADIENT_INTER.none) {
return c0; 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) { function gradient_add(_gradient, _addkey, _deleteDup) {
if(!ds_exists(_gradient, ds_type_list)) return; if(array_length(_gradient) == 0) {
array_push(_gradient, _addkey);
if(ds_list_size(_gradient) == 0) {
ds_list_add(_gradient, _addkey);
return; return;
} }
for(var i = 0; i < ds_list_size(_gradient); i++) { for(var i = 0; i < array_length(_gradient); i++) {
var _key = _gradient[| i]; var _key = _gradient[i];
if(_key.time == _addkey.time) { if(_key.time == _addkey.time) {
if(_deleteDup) if(_deleteDup)
_key.value = _addkey.value; _key.value = _addkey.value;
return; return;
} else if(_key.time > _addkey.time) { } else if(_key.time > _addkey.time) {
ds_list_insert(_gradient, i, _addkey); array_insert(_gradient, i, _addkey);
return; 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 ];
} }

View file

@ -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) { function json_load(path) {
if(!file_exists(path)) return noone; if(!file_exists(path)) return noone;
@ -9,8 +17,8 @@ function json_load(path) {
return js; return js;
} }
function json_save(path, struct) { function json_save(path, map) {
var s = json_encode(struct); var s = json_encode_minify(map);
var f = file_text_open_write(path); var f = file_text_open_write(path);
file_text_write_string(f, s); file_text_write_string(f, s);
@ -29,7 +37,7 @@ function json_load_struct(path) {
} }
function json_save_struct(path, struct) { function json_save_struct(path, struct) {
var s = json_stringify(struct); var s = json_stringify_minify(struct);
var f = file_text_open_write(path); var f = file_text_open_write(path);
file_text_write_string(f, s); file_text_write_string(f, s);

View file

@ -8,26 +8,28 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
b_link.icon = THEME.value_link; b_link.icon = THEME.value_link;
onModifyIndex = function(index, val) { onModifyIndex = function(index, val) {
var modi = false;
if(linked) { if(linked) {
for( var i = 0; i < size; i++ ) for( var i = 0; i < size; i++ )
onModify(i, toNumber(val)); modi |= onModify(i, toNumber(val));
return; return modi;
} }
onModify(index, toNumber(val)); return onModify(index, toNumber(val));
} }
onModifySingle[0] = function(val) { onModifyIndex(0, val); } onModifySingle[0] = function(val) { return onModifyIndex(0, val); }
onModifySingle[1] = function(val) { onModifyIndex(1, val); } onModifySingle[1] = function(val) { return onModifyIndex(1, val); }
onModifySingle[2] = function(val) { onModifyIndex(2, val); } onModifySingle[2] = function(val) { return onModifyIndex(2, val); }
onModifySingle[3] = function(val) { onModifyIndex(3, val); } onModifySingle[3] = function(val) { return onModifyIndex(3, val); }
onModifySingle[4] = function(val) { onModifyIndex(4, val); } onModifySingle[4] = function(val) { return onModifyIndex(4, val); }
onModifySingle[5] = function(val) { onModifyIndex(5, val); } onModifySingle[5] = function(val) { return onModifyIndex(5, val); }
onModifySingle[6] = function(val) { onModifyIndex(6, val); } onModifySingle[6] = function(val) { return onModifyIndex(6, val); }
onModifySingle[7] = function(val) { onModifyIndex(7, val); } onModifySingle[7] = function(val) { return onModifyIndex(7, val); }
onModifySingle[8] = function(val) { onModifyIndex(8, val); } onModifySingle[8] = function(val) { return onModifyIndex(8, val); }
extras = -1; extras = -1;
@ -60,6 +62,11 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
tb[i].slidable = true; 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) { static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x; x = _x;
y = _y; y = _y;

View file

@ -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);
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "migration_function",
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "migration",
"path": "folders/functions/migration.yy",
},
}

View file

@ -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_band = shader_get_uniform(shader, "band");
uniform_attn = shader_get_uniform(shader, "atten"); 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" ]); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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]); .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); .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); .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]); .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]); .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]); .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"]); .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]); .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); .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]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); inputs[| 15] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
outputs[| 1] = nodeValue(1, "Light only", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); active_index = 15;
input_display_list = [ 0, 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, ["Shape", false], 1, 2, 6, 7, 8, 9,
["Light", false], 3, 4, 5, 12, 13, 14, ["Light", false], 3, 4, 5, 12, 13, 14,
["Render", false], 11, 10 ["Render", false], 11, 10
@ -150,14 +153,14 @@ function Node_2D_light(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con
} else } else
draw_clear_alpha(c_black, 1); draw_clear_alpha(c_black, 1);
BLEND_ADD BLEND_ADD;
shader_set(shader); shader_set(shader);
gpu_set_colorwriteenable(1, 1, 1, 0); gpu_set_colorwriteenable(1, 1, 1, 0);
shader_set_uniform_f(uniform_intn, _inten); shader_set_uniform_f(uniform_intn, _inten);
shader_set_uniform_f(uniform_band, _band); shader_set_uniform_f(uniform_band, _band);
shader_set_uniform_f(uniform_attn, _attn); 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) { switch(_shape) {
case LIGHT_SHAPE_2D.point : 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); gpu_set_colorwriteenable(1, 1, 1, 1);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -1,43 +1,56 @@
function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "3D Combine"; name = "3D Combine";
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 ])
.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 ])
.setDisplay(VALUE_DISPLAY.vector) .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 ]) inputs[| 1] = nodeValue("Object position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector)
.rejectArray();
inputs[| 6] = nodeValue(6, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) inputs[| 2] = nodeValue("Object rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation); .setDisplay(VALUE_DISPLAY.vector)
.rejectArray();
inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) inputs[| 3] = nodeValue("Object scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ])
.setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]); .setDisplay(VALUE_DISPLAY.vector)
.rejectArray();
inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) inputs[| 4] = nodeValue("Render position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ])
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef( function() { return inputs[| 2].getValue(); })
.rejectArray();
inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 5] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector)
.rejectArray();
inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey); inputs[| 6] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation)
.rejectArray();
inputs[| 11] = nodeValue(11, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 7] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01])
.rejectArray();
inputs[| 12] = nodeValue(12, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) inputs[| 8] = nodeValue("Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 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, input_display_list = [ 0,
["Object transform", false], 1, 2, 3, ["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_fix_len = ds_list_size(inputs);
input_display_len = array_length(input_display_list); 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 = [ output_display_list = [
0, 2, 1 0, 2, 1
@ -64,7 +77,7 @@ function Node_3D_Combine(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
static createNewInput = function() { static createNewInput = function() {
var index = ds_list_size(inputs); 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); .setVisible(true, true);
array_push(input_display_list, index); 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(); _3d_clear_local_transform();
} }
static update = function() { static update = function(frame = ANIMATOR.current_frame) {
var _dim = inputs[| 0].getValue(); var _dim = inputs[| 0].getValue();
var _lpos = inputs[| 1].getValue(); var _lpos = inputs[| 1].getValue();
var _lrot = inputs[| 2].getValue(); var _lrot = inputs[| 2].getValue();

View file

@ -1,56 +1,57 @@
function Node_3D_Extrude(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_3D_Extrude(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "3D Extrude"; 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); .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); .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); .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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef( function() { return inputs[| 1].getValue(); }); .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); .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); .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() { .setDisplay(VALUE_DISPLAY.button, [ function() {
generateMesh(); generateMesh();
update(); update();
}, "Generate"] ); }, "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); .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]); .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]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 12] = nodeValue(12, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 12] = nodeValue("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[| 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) inputs[| 16] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]);
input_display_list = [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, ["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 = [ output_display_list = [
0, 2, 1 0, 2, 1

View file

@ -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 { function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "3D Object"; name = "3D Object";
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, [ "*.obj", "" ]); .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() { .setDisplay(VALUE_DISPLAY.button, [ function() {
updateObj(); updateObj();
doUpdate(); doUpdate();
}, "Generate"] ); }, "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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef( function() { return inputs[| 2].getValue(); }); .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); .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); .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); .setDisplay(VALUE_DISPLAY.rotation)
.rejectArray();
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]); .setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01])
.rejectArray();
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]); .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); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 15] = nodeValue(15, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 15] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ])
.rejectArray();
inputs[| 16] = nodeValue(16, "Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60) inputs[| 16] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ])
.rejectArray();
input_display_list = [ 2, input_display_list = [ 2,
["Geometry", false], 0, 1, ["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_length = ds_list_size(inputs);
input_display_len = array_length(input_display_list); 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 = [ output_display_list = [
0, 2, 1 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); _3d_node_init(2, /*Transform*/ 3, 13, 5);
function reset_tex() { function reset_tex() {
tex_surface = PIXEL_SURFACE; tex_surface = surface_create(1, 1);
surface_set_target(tex_surface); surface_set_target(tex_surface);
draw_clear(c_black); draw_clear(c_black);
surface_reset_target(); surface_reset_target();
} }
reset_tex(); reset_tex();
static onValueUpdate = function(index) { static onValueUpdate = function(index = 0) {
if(index == 12) updateObj(); if(index == 12) updateObj(false);
} }
function setPath(path) { function setPath(path) {
inputs[| 0].setValue(path); inputs[| 0].setValue(path);
updateObj(); updateObj();
doUpdate();
} }
function createMaterial(m_index) { function createMaterial(m_index) {
var index = ds_list_size(inputs); 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); inputs[| index].setVisible(true);
input_display_list[input_display_len + m_index] = index; input_display_list[input_display_len + m_index] = index;
@ -131,19 +139,24 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
materialIndex = []; materialIndex = [];
materials = []; materials = [];
static updateObj = function() { static updateObj = function(updateMat = true) {
var _path = inputs[| 0].getValue(); var _path = inputs[| 0].getValue();
var _flip = inputs[| 12].getValue(); var _flip = inputs[| 12].getValue();
var _dir = filename_dir(_path);
var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl"; var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl";
var _v = readObj(_path, _flip); var _v = readObj(_path, _flip);
if(_v != noone) { if(_v != noone) {
VB = _v[0]; VB = _v.vertex_groups;
materialNames = _v[1]; materialNames = _v.materials;
materialIndex = _v[2]; materialIndex = _v.material_index;
use_normal = _v[3]; use_normal = _v.use_normal;
if(_v.mtl_path != "")
_pathMtl = _dir + "\\" + _v.mtl_path;
} }
if(updateMat) {
if(array_length(materialNames)) if(array_length(materialNames))
materials = readMtl(_pathMtl); materials = readMtl(_pathMtl);
else { else {
@ -154,6 +167,8 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
do_reset_material = true; do_reset_material = true;
} }
update();
}
do_reset_material = false; do_reset_material = false;
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
@ -168,7 +183,6 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
_3d_local_transform(_lpos, _lrot, _lsca); _3d_local_transform(_lpos, _lrot, _lsca);
for(var i = 0; i < array_length(VB); i++) { for(var i = 0; i < array_length(VB); i++) {
if(i >= ds_list_size(inputs)) break;
if(i >= array_length(materialIndex)) continue; if(i >= array_length(materialIndex)) continue;
var mIndex = materialIndex[i]; 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(); _3d_clear_local_transform();
} }
static update = function() { static update = function(frame = ANIMATOR.current_frame) {
if(!surface_exists(tex_surface)) reset_tex(); if(!surface_exists(tex_surface)) reset_tex();
if(do_reset_material) { if(do_reset_material) {

View file

@ -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"; 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); .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); .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); .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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef( function() { return inputs[| 2].getValue(); }); .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); .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); .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]); .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]); .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); .setVisible(true, true);
inputs[| 12] = nodeValue(12, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 12] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]);
input_display_list = [ 0, 11, 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, ["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 = [ output_display_list = [
0, 2, 1 0, 2, 1
@ -83,33 +84,31 @@ function Node_3D_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) construct
_3d_clear_local_transform(); _3d_clear_local_transform();
} }
static update = function() { static step = 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();
var _proj = inputs[| 12].getValue(); var _proj = inputs[| 12].getValue();
var _fov = inputs[| 13].getValue();
inputs[| 13].setVisible(_proj); inputs[| 13].setVisible(_proj);
}
for( var i = 0; i < array_length(output_display_list) - 1; i++ ) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var ind = output_display_list[i]; var _dim = _data[0];
var _outSurf = outputs[| ind].getValue(); var _lpos = _data[1];
outputs[| ind].setValue(surface_verify(_outSurf, _dim[0], _dim[1])); var _lrot = _data[2];
var _lsca = _data[3];
var _pos = _data[4];
var _sca = _data[5];
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"; var pass = "diff";
switch(ind) { switch(_output_index) {
case 0 : pass = "diff" break; case 0 : pass = "diff" break;
case 2 : pass = "norm" break; case 2 : pass = "norm" break;
} }
@ -117,6 +116,7 @@ function Node_3D_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) construct
_3d_pre_setup(_outSurf, _dim, _pos, _sca, _ldir, _lhgt, _lint, _lclr, _aclr, _lpos, _lrot, _lsca, _proj, _fov, pass, false); _3d_pre_setup(_outSurf, _dim, _pos, _sca, _ldir, _lhgt, _lint, _lclr, _aclr, _lpos, _lrot, _lsca, _proj, _fov, pass, false);
submit_vertex(); submit_vertex();
_3d_post_setup(); _3d_post_setup();
}
return _outSurf;
} }
} }

View file

@ -1,40 +1,42 @@
function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "3D Plane"; 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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 4] = nodeValue(4, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_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" ]); .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); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 8] = nodeValue(8, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 8] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
input_display_list = [0, 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, ["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 = [ output_display_list = [
0, 1 0, 1
@ -72,6 +74,7 @@ function Node_3D_Plane(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con
_3d_local_transform(_lpos, _lrot, _lsca); _3d_local_transform(_lpos, _lrot, _lsca);
if(is_surface(_inSurf))
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(_inSurf)); vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(_inSurf));
_3d_clear_local_transform(); _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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader = sh_vertex_pt; shader = sh_vertex_pt;
shader_set(shader); 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"); uniUVscale = shader_get_uniform(shader, "UVscale");
uniUVshift = shader_get_uniform(shader, "UVshift"); uniUVshift = shader_get_uniform(shader, "UVshift");
shader_set_uniform_f_array(uniUVscale, _uvSca); shader_set_uniform_f_array_safe(uniUVscale, _uvSca);
shader_set_uniform_f_array(uniUVshift, _uvShf); shader_set_uniform_f_array_safe(uniUVshift, _uvShf);
var cam_view, cam_proj; var cam_view, cam_proj;
if(_proj == CAMERA_PROJ.ortho) { 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_stack_clear();
matrix_set(matrix_world, MATRIX_IDENTITY); matrix_set(matrix_world, MATRIX_IDENTITY);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -1,51 +1,52 @@
function Node_3D_Cone(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_3D_Cone(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "3D Cone"; 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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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); .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); .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); .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); .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]); .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]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 8] = nodeValue(8, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 8] = nodeValue("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[| 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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 12] = nodeValue(12, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 12] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .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, input_display_list = [0,
["Geometry", false], 14, ["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, ["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 = [ output_display_list = [
0, 2, 1 0, 2, 1

View file

@ -2,56 +2,57 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons
name = "3D Cube"; name = "3D Cube";
dimension_index = 1; 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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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); .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); .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[| 6] = nodeValue("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[| 7] = nodeValue("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[| 8] = nodeValue("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[| 9] = nodeValue("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[| 10] = nodeValue("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[| 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); .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); .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]); .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]); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 20] = nodeValue(20, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 20] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]);
input_display_list = [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, ["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 = [ output_display_list = [
0, 2, 1 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])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(_data[6 + i]));
matrix_stack_pop(); matrix_stack_pop();
} }
} else { } else if(is_surface(_inSurf)) {
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "cube"], pr_trianglelist, surface_get_texture(_inSurf)); vertex_submit(PRIMITIVES[? "cube"], pr_trianglelist, surface_get_texture(_inSurf));
} }

View file

@ -2,55 +2,56 @@ function Node_3D_Cylinder(_x, _y, _group = -1) : Node_Processor(_x, _y, _group)
name = "3D Cylinder"; name = "3D Cylinder";
dimension_index = 2; 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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 6] = nodeValue(6, "Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 6] = nodeValue("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[| 7] = nodeValue("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[| 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); .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); .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]); .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]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 13] = nodeValue(13, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 13] = nodeValue("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[| 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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 17] = nodeValue(17, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 17] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
input_display_list = [2, 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, ["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 = [ output_display_list = [
0, 2, 1 0, 2, 1

View file

@ -2,49 +2,50 @@ function Node_3D_Sphere(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) co
name = "3D Sphere"; name = "3D Sphere";
dimension_index = 1; 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); .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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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); .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); .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); .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); .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]); .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]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 10] = nodeValue(10, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 10] = nodeValue("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[| 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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 14] = nodeValue(14, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 14] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]);
input_display_list = [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, ["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 = [ output_display_list = [
0, 2, 1 0, 2, 1

View file

@ -1,67 +1,69 @@
function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "3D Repeat"; 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); .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); .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); .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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef( function() { return inputs[| 0].getValue(); }); .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); .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); .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]); .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]); .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); .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); .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); .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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 16] = nodeValue(16, "Repeat pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 16] = nodeValue("Repeat pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Linear", "Circular" ]); .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" ]); .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); .setDisplay(VALUE_DISPLAY.rotation_range);
inputs[| 20] = nodeValue(20, "Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 20] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Orthographic", "Perspective" ]); .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 ]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 90, 1 ]);
input_display_list = [ 0, 11, 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 = [ output_display_list = [
0, 2, 1 0, 2, 1
@ -152,7 +154,19 @@ function Node_3D_Repeat(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
_3d_clear_local_transform(); _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 _dim = inputs[| 0].getValue();
var _lpos = inputs[| 1].getValue(); var _lpos = inputs[| 1].getValue();
var _lrot = inputs[| 2].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 _fov = inputs[| 21].getValue();
var _patt = inputs[| 16].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++ ) { for( var i = 0; i < array_length(output_display_list) - 1; i++ ) {
var ind = output_display_list[i]; var ind = output_display_list[i];

View file

@ -1,19 +1,19 @@
function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Nine Slice"; 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); .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) .setDisplay(VALUE_DISPLAY.padding)
.setUnitRef(function(index) { return getDimension(index); }); .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" ]); .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_side = -1;
drag_mx = 0; drag_mx = 0;
@ -118,7 +118,7 @@ function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
var ww = _dim[0]; var ww = _dim[0];
var hh = _dim[1]; 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(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -4,7 +4,7 @@ function Node_VFX_Turbulence(_x, _y, _group = -1) : Node_VFX_effector(_x, _y, _g
inputs[| 4].setVisible(false, false); 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); .setVisible(true, false);
array_push(input_display_list, 8); array_push(input_display_list, 8);

View file

@ -4,9 +4,9 @@ function Node_VFX_Vortex(_x, _y, _group = -1) : Node_VFX_effector(_x, _y, _group
inputs[| 4].setVisible(false, false); 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); array_push(input_display_list, 8, 9);

View file

@ -1,5 +1,7 @@
function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "Effector"; name = "Effector";
color = COLORS.node_blend_vfx;
icon = THEME.vfx;
previewable = false; previewable = false;
node_draw_icon = s_node_vfx_accel; 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; h = 80;
min_h = h; 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); .setVisible(true, true);
inputs[| 1] = nodeValue(1, "Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) inputs[| 1] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ])
.setDisplay(VALUE_DISPLAY.area); .setDisplay(VALUE_DISPLAY.area)
.rejectArray();
inputs[| 2] = nodeValue(2, "Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 ) inputs[| 2] = nodeValue("Falloff", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01 )
.setDisplay(VALUE_DISPLAY.curve); .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 ] ) inputs[| 4] = nodeValue("Effect Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -1, 0 ] )
.setDisplay(VALUE_DISPLAY.vector); .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 ] ) inputs[| 6] = nodeValue("Rotate particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] )
.setDisplay(VALUE_DISPLAY.rotation_range); .setDisplay(VALUE_DISPLAY.rotation_range)
.rejectArray();
inputs[| 7] = nodeValue(7, "Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) inputs[| 7] = nodeValue("Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] )
.setDisplay(VALUE_DISPLAY.vector_range); .setDisplay(VALUE_DISPLAY.vector_range)
.rejectArray();
input_display_list = [ 0, input_display_list = [ 0,
["Area", false], 1, 2, 3, ["Area", false], 1, 2, 3,
["Effect", false], 4, 5, 6, 7, ["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 = []; current_data = [];
@ -122,7 +130,7 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) construct
if(_dst <= _fads) { if(_dst <= _fads) {
var inf = in? 0.5 + _dst / _fads : 0.5 - _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) } else if(in)
str = 1; str = 1;
@ -131,15 +139,15 @@ function Node_VFX_effector(_x, _y, _group = -1) : Node(_x, _y, _group) construct
onAffect(part, str); onAffect(part, str);
} }
static update = function() { static update = function(frame = ANIMATOR.current_frame) {
var val = inputs[| 0].getValue(); var val = inputs[| 0].getValue();
outputs[| 0].setValue(val); outputs[| 0].setValue(val);
if(val == -1) return; 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(); current_data[i] = inputs[| i].getValue();
}
if(!is_array(val) || array_length(val) == 0) return;
if(!is_array(val[0])) val = [ val ]; if(!is_array(val[0])) val = [ val ];
for( var i = 0; i < array_length(val); i++ ) for( var i = 0; i < array_length(val); i++ )
for( var j = 0; j < array_length(val[i]); j++ ) { for( var j = 0; j < array_length(val[i]); j++ ) {

View file

@ -1,6 +1,7 @@
function Node_VFX_Group(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) constructor { function Node_VFX_Group(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) constructor {
name = "VFX"; name = "VFX";
color = COLORS.node_blend_vfx; color = COLORS.node_blend_vfx;
icon = THEME.vfx;
ungroupable = false; ungroupable = false;
if(!LOADING && !APPENDING && !CLONING) { if(!LOADING && !APPENDING && !CLONING) {

View file

@ -1,25 +1,29 @@
function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "Renderer"; 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); .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 ) inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Additive" ]); .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Additive" ])
.rejectArray();
data_length = 1; data_length = 1;
input_fix_len = ds_list_size(inputs); input_fix_len = ds_list_size(inputs);
static createNewInput = function() { static createNewInput = function() {
var index = ds_list_size(inputs); 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); .setVisible(true, true);
} }
if(!LOADING && !APPENDING) createNewInput(); 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() { static refreshDynamicInput = function() {
var _l = ds_list_create(); 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); outputs[| 0].setValue(_outSurf);
surface_set_target(_outSurf); surface_set_target(_outSurf);
switch(_blend) { draw_clear_alpha(0, 0);
case PARTICLE_BLEND_MODE.normal :
draw_clear_alpha(c_white, 0); if(_blend == PARTICLE_BLEND_MODE.normal)
gpu_set_blendmode(bm_normal); BLEND_OVER_ALPHA;
break; else if(_blend == PARTICLE_BLEND_MODE.additive)
case PARTICLE_BLEND_MODE.additive : BLEND_ADD;
draw_clear_alpha(c_black, 0);
gpu_set_blendmode(bm_add);
break;
}
var surf_w = surface_get_width(_outSurf); var surf_w = surface_get_width(_outSurf);
var surf_h = surface_get_height(_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++ ) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
var parts = inputs[| i].getValue(_time); var parts = inputs[| i].getValue(_time);
if(!is_array(parts) || array_length(parts) == 0) continue;
if(!is_array(parts[0])) parts = [ parts ]; if(!is_array(parts[0])) parts = [ parts ];
for(var j = 0; j < array_length(parts); j++) for(var j = 0; j < array_length(parts); j++)
for(var k = 0; k < array_length(parts[j]); k++) { 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); parts[j][k].draw(_exact, surf_w, surf_h);
} }
} }
gpu_set_blendmode(bm_normal); BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
cacheCurrentFrame(_outSurf); cacheCurrentFrame(_outSurf);

View file

@ -1,15 +1,17 @@
function Node_VFX_Spawner(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _group) constructor { function Node_VFX_Spawner(_x, _y, _group = -1) : Node_VFX_Spawner_Base(_x, _y, _group) constructor {
name = "Spawner"; 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); .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[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, parts );
outputs[| 1] = nodeValue(1, "On create", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, noone ); outputs[| 1] = nodeValue("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[| 2] = nodeValue("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[| 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); 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(); var spr = inputs[| 0].getValue();
if(spr == 0) { if(spr == 0) {
if(def_surface == -1 || !surface_exists(def_surface)) { if(!is_surface(def_surface))
def_surface = PIXEL_SURFACE; return;
surface_set_target(def_surface);
draw_clear(c_white);
surface_reset_target();
}
spr = def_surface; spr = def_surface;
} }

View file

@ -1,25 +1,41 @@
function Node_Alpha_Cutoff(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_Alpha_Cutoff(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Alpha Cutoff"; name = "Alpha Cutoff";
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, "Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Any pixel with less alpha (more transparent) than this will be removed.")
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]); .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);
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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(sh_alpha_cutoff); shader_set(sh_alpha_cutoff);
shader_set_uniform_f(shader_get_uniform(sh_alpha_cutoff, "cutoff"), _data[1]); shader_set_uniform_f(shader_get_uniform(sh_alpha_cutoff, "cutoff"), _data[1]);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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, 15, 47, 7, 39, 13, 45, 5, 37,
63, 31, 55, 23, 61, 29, 53, 21]; 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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -1,18 +1,25 @@
function Node_Alpha_Grey(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_Alpha_Grey(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Alpha to Grey"; 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;
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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(sh_alpha_grey); shader_set(sh_alpha_grey);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -1,32 +1,31 @@
function Node_Anim_Curve(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_Anim_Curve(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Anim Curve"; name = "Evaluate Curve";
update_on_frame = true; update_on_frame = true;
previewable = false; previewable = false;
w = 96; w = 96;
inputs[| 0] = nodeValue("Curve", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01);
inputs[| 0] = nodeValue(0, "Curve", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01); inputs[| 1] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
inputs[| 1] = nodeValue(1, "Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]); .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 2] = nodeValue(2, "Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); inputs[| 2] = nodeValue("Minimum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
inputs[| 3] = nodeValue(3, "Maximum", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); 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 curve = _data[0];
var time = _data[1]; var time = _data[1];
var _min = _data[2]; var _min = _data[2];
var _max = _data[3]; 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; return val;
} }
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {
var bbox = drawGetBbox(xx, yy, _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);
} }
} }

View file

@ -6,17 +6,17 @@ function Node_Area(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constru
w = 96; 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) .setDisplay(VALUE_DISPLAY.vector)
.setVisible(true, true); .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) .setDisplay(VALUE_DISPLAY.vector)
.setVisible(true, true); .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"]); .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); .setDisplay(VALUE_DISPLAY.vector);
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { 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); 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]]; return [_data[0][0], _data[0][1], _data[1][0], _data[1][1], _data[2]];
} }

View file

@ -4,8 +4,9 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
w = 96; 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, [ "Any", "Surface", "Number", "Text" ]); .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) { array_adjust_tool = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var _h = ui(48); 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 bxc = bx + bw / 2 - (string_width("Add") + ui(64)) / 2;
var byc = by + bh / 2; var byc = by + bh / 2;
draw_sprite_ui(THEME.add, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light); 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 bx = _x + bw + ui(8);
var amo = attributes[? "size"]; 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); input_display_list_len = array_length(input_display_list);
data_length = 1; 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; attributes[? "size"] = 1;
static createNewInput = function() { static getType = function() {
var index = ds_list_size(inputs);
var _type = inputs[| 0].getValue(); var _type = inputs[| 0].getValue();
var _typ = VALUE_TYPE.any;
switch(_type) { switch(_type) {
case 1 : _typ = VALUE_TYPE.surface; break; case 1 : return VALUE_TYPE.surface;
case 2 : _typ = VALUE_TYPE.float; break; case 2 : return VALUE_TYPE.float;
case 3 : _typ = VALUE_TYPE.text; break; case 3 : return VALUE_TYPE.color;
case 4 : return VALUE_TYPE.text;
default : return VALUE_TYPE.any;
}
} }
inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, _typ, -1 ) static createNewInput = function() {
var index = ds_list_size(inputs);
var _typ = getType();
inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, _typ, -1 )
.setVisible(true, true); .setVisible(true, true);
array_push(input_display_list, index); 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 = []; input_display_list = [];
for( var i = 0; i < ds_list_size(_l); i++ ) { for( var i = 0; i < ds_list_size(_l); i++ ) {
_l[| i].index = i; _l[| i].index = i;
_l[| i].setVisible(i < ds_list_size(_l) - 1);
array_push(input_display_list, i); array_push(input_display_list, i);
if(i >= input_fix_len && _l[| i].value_from == noone) 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(); lastNode = createNewInput();
} }
static onValueUpdate = function(index) { static onValueUpdate = function(index = 0) {
if(index != 0) return; if(index != 0) return;
var _typ = getType();
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;
}
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) { 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(); inputs[| i].resetDisplay();
if(_typ && inputs[| i].value_from && (value_bit(inputs[| i].value_from.type) & value_bit(_typ) == 0)) if(_typ && inputs[| i].value_from && (value_bit(inputs[| i].value_from.type) & value_bit(_typ) == 0))
inputs[| i].removeFrom(); inputs[| i].removeFrom();
} }
refreshDynamicInput();
} }
static onValueFromUpdate = function(index) { static onValueFromUpdate = function(index) {
@ -144,15 +146,8 @@ function Node_Array(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
refreshDynamicInput(); refreshDynamicInput();
} }
static update = function() { static update = function(frame = ANIMATOR.current_frame) {
var _type = inputs[| 0].getValue(); var _typ = getType();
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;
}
outputs[| 0].type = _typ; outputs[| 0].type = _typ;
var res = array_create(ds_list_size(inputs) - input_fix_len - 1); 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++ ) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
res[ind++] = inputs[| i].getValue(); 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) if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from)
outputs[| 0].type = inputs[| i].value_from? inputs[| i].value_from.type : VALUE_TYPE.any; outputs[| 0].type = inputs[| i].value_from.type;
} }
outputs[| 0].setValue(res); outputs[| 0].setValue(res);

View file

@ -6,17 +6,18 @@ function Node_Array_Add(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
h = 32 + 24; h = 32 + 24;
min_h = h; 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); .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); .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 _arr = inputs[| 0].getValue();
var _val = inputs[| 1].getValue(); var _val = inputs[| 1].getValue();
var _app = inputs[| 2].getValue(); var _app = inputs[| 2].getValue();

View file

@ -6,28 +6,33 @@ function Node_Array_Get(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
h = 32 + 24; h = 32 + 24;
min_h = h; 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); .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); .setVisible(true, true);
inputs[| 2] = nodeValue(2, "Overflow", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 2] = nodeValue("Overflow", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Clamp", "Loop", "Ping Pong"]); .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; inputs[| 0].type = VALUE_TYPE.any;
outputs[| 0].type = VALUE_TYPE.any; outputs[| 0].type = VALUE_TYPE.any;
if(!is_array(_arr)) return; 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 _len = array_length(_arr);
var _ovf = inputs[| 2].getValue();
switch(_ovf) { switch(_ovf) {
case 0 : case 0 :
@ -45,12 +50,25 @@ function Node_Array_Get(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
break; break;
} }
if(inputs[| 0].value_from != noone) { return array_safe_get(_arr, index);
inputs[| 0].type = inputs[| 0].value_from.type;
outputs[| 0].type = inputs[| 0].type;
} }
outputs[| 0].setValue(_arr[index]); static update = function(frame = ANIMATOR.current_frame) {
var _arr = inputs[| 0].getValue();
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) { 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 idx = inputs[| 1].getValue();
var str = string(idx); var str = string(idx);
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
var ss = string_scale(str, bbox.w, bbox.h); var ss = string_scale(str, bbox.w, bbox.h);
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);

View file

@ -6,12 +6,12 @@ function Node_Array_Length(_x, _y, _group = -1) : Node(_x, _y, _group) construct
h = 32 + 24; h = 32 + 24;
min_h = h; 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); .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(); var _arr = inputs[| 0].getValue();
if(!is_array(_arr) || array_length(_arr) == 0) { 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; 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)); 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);
} }
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {

View file

@ -4,13 +4,18 @@ function Node_Array_Range(_x, _y, _group = -1) : Node(_x, _y, _group) constructo
w = 96; w = 96;
inputs[| 0] = nodeValue(0, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0); inputs[| 0] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
inputs[| 1] = nodeValue(1, "End", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 10); .rejectArray();
inputs[| 2] = nodeValue(2, "Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
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 st = inputs[| 0].getValue();
var ed = inputs[| 1].getValue(); var ed = inputs[| 1].getValue();
var step = inputs[| 2].getValue(); var step = inputs[| 2].getValue();

View file

@ -29,20 +29,22 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc
w = 128; 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", ""]); .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"] ); .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, "") outputs[| 2] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "");
.setVisible(true, true);
outputs[| 3] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [])
.setDisplay(VALUE_DISPLAY.palette);
hold_visibility = true; hold_visibility = true;
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { 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 = []; layers = [];
tags = []; tags = [];
_tag_delay = 0; _tag_delay = 0;
palette = [];
path_current = ""; path_current = "";
first_update = false; 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); path = try_get_path(path);
if(path == -1) return false; 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), ""); var _name = string_replace(filename_name(path), filename_ext(path), "");
if(ext != ".ase" && ext != ".aseprite") return false; 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 g = pck[k][? "Green"];
var b = pck[k][? "Blue"]; var b = pck[k][? "Blue"];
var a = pck[k][? "Alpha"]; var a = pck[k][? "Alpha"];
array_push(plt, [r, g, b, a]) array_push(plt, [r, g, b, a]);
} }
content[? "Palette"] = plt; 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; break;
case 0x2004: //layer case 0x2004: //layer
var name = chunk[? "Name"]; var name = chunk[? "Name"];
@ -269,7 +275,7 @@ function Node_ASE_File_Read(_x, _y, _group = -1) : Node(_x, _y, _group) construc
return true; return true;
} }
static inspectorUpdate = function() { static onInspectorUpdate = function() {
var path = inputs[| 0].getValue(); var path = inputs[| 0].getValue();
if(path == "") return; if(path == "") return;
updatePaths(path); 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 path = inputs[| 0].getValue();
var current_tag = inputs[| 2].getValue(); var current_tag = inputs[| 2].getValue();
if(path_current != path) updatePaths(path); if(path_current != path) updatePaths(path);

View file

@ -4,12 +4,14 @@ function Node_ASE_layer(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
always_output = true; always_output = true;
previewable = false; previewable = false;
inputs[| 0] = nodeValue(0, "ASE data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone) inputs[| 0] = nodeValue("ASE data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, noone)
.setVisible(false, true); .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; layer_object = noone;
_name = ""; _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(); var data = inputs[| 0].getValue();
if(data == noone) return; 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); surface_set_target(surf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
draw_surface(_inSurf, xx, yy); draw_surface(_inSurf, xx, yy);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
} }
} }

View file

@ -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"); 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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(sh_atlas); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -4,9 +4,21 @@ function Node_Average(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons
shader = sh_average; shader = sh_average;
uniform_dim = shader_get_uniform(shader, "dimension"); 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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var inSurf = _data[0]; 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); side = power(2, lop);
if(side / 2 >= 1) { 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; var _ind = 1;
gpu_set_tex_filter(true); gpu_set_tex_filter(true);
surface_set_target(_Surf[0]); surface_set_target(_Surf[0]);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
draw_surface_stretched(inSurf, 0, 0, side, side); draw_surface_stretched(inSurf, 0, 0, side, side);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
for( var i = 0; i < lop; i++ ) { 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; side /= 2;
} }
gpu_set_tex_filter(false); gpu_set_tex_filter(false);
cc = surface_getpixel(_Surf[!_ind], 0, 0); cc = surface_getpixel(_Surf[!_ind], 0, 0);
surface_free(_Surf[0]);
surface_free(_Surf[1]);
} else } else
cc = surface_getpixel(inSurf, 0, 0); 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); draw_clear(cc);
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_hei = shader_get_uniform(shader, "height");
uniform_slp = shader_get_uniform(shader, "slope"); uniform_slp = shader_get_uniform(shader, "slope");
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.integer, 4); 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); .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); .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" ]); .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 = [ inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
["Surface", true], 0, .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, ["Bevel", false], 4, 1,
["Transform", false], 2, 3, ["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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_hei, _hei); shader_set_uniform_f(uniform_hei, _hei);
shader_set_uniform_f_array(uniform_shf, _shf); shader_set_uniform_f_array_safe(uniform_shf, _shf);
shader_set_uniform_f_array(uniform_sca, _sca); shader_set_uniform_f_array_safe(uniform_sca, _sca);
shader_set_uniform_i(uniform_slp, _slp); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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 { function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Blend"; name = "Blend";
inputs[| 0] = nodeValue(0, "Background", 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(1, "Foreground", 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 ); .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]); .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" ]); .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Stretch", "Tile" ]);
inputs[| 6] = nodeValue(6, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 6] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Background", "Forground", "Mask", "Maximum", "Constant" ]); .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); .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;
input_display_list = [ inputs[| 9] = nodeValue("Preserve alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 8,
["Surfaces", true], 0, 1, 4, 6, 7, ["Surfaces", true], 0, 1, 4, 6, 7,
["Blend", false], 2, 3, ["Blend", false], 2, 3, 9,
["Transform", false], 5, ["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 _outp = _data[6];
var _out_dim = _data[7]; var _out_dim = _data[7];
var _pre_alp = _data[9];
inputs[| 7].setVisible(_outp == 4); inputs[| 7].setVisible(_outp == 4);
var ww = 1, hh = 1; 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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); 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(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -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_umsk = shader_get_uniform(shader, "useMask");
uniform_mask = shader_get_sampler_index(shader, "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, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.") inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.")
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); .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]); .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]); .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 = [ inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
["Surface", true], 0, 4,
["Bloom", false], 1, 2, 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;
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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _size = _data[1]; var _size = _data[1];
@ -47,27 +57,28 @@ function Node_Bloom(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr
shader_reset(); shader_reset();
surface_reset_target(); 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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
var uniform_foreground = shader_get_sampler_index(sh_blend_add_alpha_adj, "fore"); 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"); var uniform_opacity = shader_get_uniform(sh_blend_add_alpha_adj, "opacity");
shader_set(sh_blend_add_alpha_adj); 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); shader_set_uniform_f(uniform_opacity, _stre);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
surface_free(pass1); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);
return _outSurf; return _outSurf;
} }

View file

@ -1,39 +1,53 @@
function Node_Blur(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_Blur(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "Blur"; name = "Blur";
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, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); .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" ]); .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 = [ inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
["Surface", false], 0, 2, .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, ["Blur", false], 1, 3, 4,
]; ];
surface_blur_init();
static process_data = function(_outSurf, _data, _output_index, _array_index) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _size = _data[1]; var _size = _data[1];
var _clamp = _data[2]; var _clamp = _data[2];
var _isovr = _data[3]; var _isovr = _data[3];
var _mask = _data[5];
var _mix = _data[6];
var _overc = _isovr? _data[4] : noone; var _overc = _isovr? _data[4] : noone;
inputs[| 4].setVisible(_isovr); inputs[| 4].setVisible(_isovr);
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(_isovr? _overc : 0, 0); 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); draw_surface_safe(surface_apply_gaussian(_data[0], _size, false, c_white, _clamp, _overc), 0, 0);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_dim = shader_get_uniform(shader, "dimension");
uniform_str = shader_get_uniform(shader, "strength"); 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, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider, [0, 16, 0.01]); .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);
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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _str = _data[1]; var _str = _data[1];
var _mask = _data[2];
var _mix = _data[3];
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_tes = shader_get_uniform(shader, "treshold");
uniform_dir = shader_get_uniform(shader, "direction"); 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, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); .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]); .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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _surf = _data[0]; var _surf = _data[0];
var _size = _data[1]; var _size = _data[1];
var _tres = _data[2]; var _tres = _data[2];
var _mask = _data[3];
var _mix = _data[4];
var ww = surface_get_width(_surf); var ww = surface_get_width(_surf);
var hh = surface_get_height(_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); surface_set_target(pass);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); 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_siz, _size);
shader_set_uniform_f(uniform_tes, _tres); shader_set_uniform_f(uniform_tes, _tres);
shader_set_uniform_i(uniform_dir, 0); shader_set_uniform_i(uniform_dir, 0);
draw_surface_safe(_surf, 0, 0); draw_surface_safe(_surf, 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_i(uniform_dir, 1); shader_set_uniform_i(uniform_dir, 1);
draw_surface_safe(pass, 0, 0); draw_surface_safe(pass, 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_str = shader_get_uniform(shader, "strength");
uniform_dir = shader_get_uniform(shader, "direction"); 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, "Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider, [0, 0.1, 0.001]); .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); .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) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _surf = outputs[| 0].getValue(); var _surf = outputs[| 0].getValue();
@ -30,9 +44,11 @@ function Node_Blur_Directional(_x, _y, _group = -1) : Node_Processor(_x, _y, _gr
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 _str = _data[1];
var _dir = _data[2]; var _dir = _data[2];
var _mask = _data[3];
var _mix = _data[4];
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_str, _str); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_str = shader_get_uniform(shader, "strength");
uniform_sam = shader_get_uniform(shader, "sampleMode"); 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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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" ]); .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 = [ inputs[| 5] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
["Surface", false], 0, 3, .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, ["Blur", false], 1, 2,
]; ];
@ -39,25 +47,29 @@ function Node_Blur_Radial(_x, _y, _group = -1) : Node_Processor(_x, _y, _group)
var _str = _data[1]; var _str = _data[1];
var _cen = _data[2]; var _cen = _data[2];
var _sam = _data[3]; var _sam = _data[3];
var _mask = _data[3];
var _mix = _data[4];
_cen[0] /= surface_get_width(_outSurf); _cen[0] /= surface_get_width(_outSurf);
_cen[1] /= surface_get_height(_outSurf); _cen[1] /= surface_get_height(_outSurf);
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_dim, surface_get_width(_outSurf), surface_get_height(_outSurf)); 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(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); shader_set_uniform_i(uniform_sam, _sam);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -11,25 +11,33 @@ function Node_Blur_Simple(_x, _y, _group = -1) : Node_Processor(_x, _y, _group)
uniform_ovr = shader_get_uniform(shader, "overrideColor"); uniform_ovr = shader_get_uniform(shader, "overrideColor");
uniform_ovc = shader_get_uniform(shader, "overColor"); uniform_ovc = shader_get_uniform(shader, "overColor");
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, "Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]); .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" ]); .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 = [ inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
["Surface", false], 0, 3, 2,
["Blur", false], 1, 4, 5, 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; if(!is_surface(_data[0])) return _outSurf;
@ -38,12 +46,14 @@ function Node_Blur_Simple(_x, _y, _group = -1) : Node_Processor(_x, _y, _group)
var _mask = _data[3]; var _mask = _data[3];
var _isovr = _data[4]; var _isovr = _data[4];
var _overc = _data[5]; var _overc = _data[5];
var _msk = _data[6];
var _mix = _data[7];
inputs[| 5].setVisible(_isovr); inputs[| 5].setVisible(_isovr);
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); 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_sam, _samp);
shader_set_uniform_i(uniform_ovr, _isovr); 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)); shader_set_uniform_i(uniform_umk, is_surface(_mask));
if(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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _msk, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_umk = shader_get_uniform(shader, "useMask");
uniform_msk = shader_get_sampler_index(shader, "mask"); 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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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" ]); .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" ]); .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 = [ inputs[| 7] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
["Surface", false], 0, 3, .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 ["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 _sam = _data[3];
var _blr = _data[4]; var _blr = _data[4];
var _msk = _data[5]; var _msk = _data[5];
var _mask = _data[6];
var _mix = _data[7];
_cen[0] /= surface_get_width(_outSurf); _cen[0] /= surface_get_width(_outSurf);
_cen[1] /= surface_get_height(_outSurf); _cen[1] /= surface_get_height(_outSurf);
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_str, _str); 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_blr, _blr);
shader_set_uniform_i(uniform_sam, _sam); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
return _outSurf; return _outSurf;
} }
} }

View file

@ -6,18 +6,18 @@ function Node_Boolean(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons
w = 96; w = 96;
min_h = 32 + 24 * 1; 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); .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]; return _data[0];
} }
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); 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 bbox = drawGetBbox(xx, yy, _s);
var ss = string_scale(str, bbox.w, bbox.h); var ss = string_scale(str, bbox.w, bbox.h);

View file

@ -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_exp = shader_get_uniform(shader, "brightness");
uniform_con = shader_get_uniform(shader, "contrast"); 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]); .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]); .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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _exp = _data[1]; var _exp = _data[1];
var _con = _data[2]; var _con = _data[2];
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f(uniform_exp, _exp); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_sam_mod = shader_get_uniform(shader, "sampleMode");
uni_blur = shader_get_uniform(shader, "blur"); uni_blur = shader_get_uniform(shader, "blur");
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, "Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ]) 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); }); .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 ]); .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" ]); .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 = [ input_display_list = [
["Surface", false], 0, 3, ["Surface", true], 0, 3,
["Camera", false], 1, 2, ["Camera", false], 1, 2,
["Elements", true], ["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 index = ds_list_size(inputs);
var _s = floor((index - input_fix_len) / data_length); 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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
if(!is_surface(_data[0])) return;
var _area = _data[1]; var _area = _data[1];
var _zoom = _data[2]; var _zoom = _data[2];
var _samp = _data[3]; 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 _dw = round(surface_valid_size(_area[2]) * 2);
var _dh = round(surface_valid_size(_area[3]) * 2); var _dh = round(surface_valid_size(_area[3]) * 2);
_outSurf = surface_verify(_outSurf, _dw, _dh); _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; var ppInd = 0;
surface_set_target(pingpong[0]); surface_set_target(pingpong[0]);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
draw_surface(_data[0], 0, 0); draw_surface(_data[0], 0, 0);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
surface_set_target(pingpong[1]); 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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
draw_surface(pingpong[ppInd], 0, 0); draw_surface(pingpong[ppInd], 0, 0);
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
surface_free(pingpong[0]); surface_free(pingpong[0]);

View file

@ -1,37 +1,48 @@
function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
name = "Canvas"; name = "Canvas";
color = COLORS.node_blend_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); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black ); inputs[| 1] = nodeValue("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[| 2] = nodeValue("Brush size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 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]); .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"]); .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); inputs[| 8] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1);
outputs[| 1] = nodeValue(1, "Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
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 = [ input_display_list = [
["Output", false], 0, ["Output", false], 0,
["Brush", false], 6, 1, 2, ["Brush", false], 6, 1, 2,
["Fill", false], 3, 4, ["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_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2);
surface_w = 1;
surface_h = 1;
tools = [ tools = [
[ "Pencil", THEME.canvas_tools_pencil ], [ "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 ], [ "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(); draw_stack = ds_list_create();
function surface_update() { function surface_update() {
var _surf = outputs[| 0].getValue(); buffer_delete(surface_buffer);
buffer_get_surface(surface_buffer, _surf, 0);
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(); 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) { 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) { function get_color_buffer(_x, _y) {
var _c1_r = c1 & 255; var pos = (surface_w * _y + _x) * 4;
var _c1_g = (c1 >> 8) & 255; if(pos > buffer_get_size(surface_buffer)) {
var _c1_b = (c1 >> 16) & 255; print("Error buffer overflow " + string(pos) + "/" + string(buffer_get_size(surface_buffer)));
var _c1_a = (c1 >> 24) & 255; 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, pos);
buffer_seek(surface_buffer, buffer_seek_start, (w * _y + _x) * 4);
var c = buffer_read(surface_buffer, buffer_u32); var c = buffer_read(surface_buffer, buffer_u32);
return c; return c;
} }
function flood_fill_scanline(_x, _y, _surf, _thres, _corner = false) { function ff_fillable(colorBase, colorFill, _x, _y, _thres) {
var w = surface_get_width(_surf); var d = color_diff(colorBase, get_color_buffer(_x, _y));
var h = surface_get_height(_surf); return d <= _thres && d != colorFill;
}
var _c0 = draw_get_color() + (255 << 24); function flood_fill_scanline(_x, _y, _surf, _thres, _corner = false) {
var _c1 = get_color_buffer(_x, _y, w, h); surface_update();
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 x1, y1, x_start;
var spanAbove, spanBelow; var spanAbove, spanBelow;
var stack = ds_stack_create(); var queue = ds_queue_create();
ds_stack_push(stack, [_x, _y]); ds_queue_enqueue(queue, [_x, _y]);
while(!ds_stack_empty(stack)) {
var pos = ds_stack_pop(stack); while(!ds_queue_empty(queue)) {
var pos = ds_queue_dequeue(queue);
x1 = pos[0]; x1 = pos[0];
y1 = pos[1]; 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--;
}
x1++; x1++;
x_start = x1; x_start = x1;
spanAbove = 0; spanAbove = false;
spanBelow = 0; 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); draw_point(x1, y1);
buffer_seek(surface_buffer, buffer_seek_start, (w * y1 + x1) * 4); buffer_seek(surface_buffer, buffer_seek_start, (surface_w * y1 + x1) * 4);
buffer_write(surface_buffer, buffer_u32, _c0); buffer_write(surface_buffer, buffer_u32, colorFill);
//print("> Filling " + string(x1) + ", " + string(y1) + ": " + string(get_color_buffer(x1, y1)));
if(y1 > 0) { if(y1 > 0) {
if(x1 == x_start && x1 > 0 && _corner) { if(x1 == x_start && x1 > 0 && _corner) {
var _delta = color_diff(_c1, get_color_buffer(x1 - 1, y1 - 1, w, h)); if(!spanAbove && ff_fillable(colorBase, colorFill, x1 - 1, y1 - 1, _thres)) {
if(!spanAbove && _delta <= _thres) { ds_queue_enqueue(queue, [x1 - 1, y1 - 1]);
ds_stack_push(stack, [x1 - 1, y1 - 1]); spanAbove = true;
spanAbove = 1;
} else if(spanAbove && _delta > _thres) {
spanAbove = 0;
} }
} }
var _delta = color_diff(_c1, get_color_buffer(x1, y1 - 1, w, h)); if(ff_fillable(colorBase, colorFill, x1, y1 - 1, _thres)) {
if(!spanAbove && _delta <= _thres) { ds_queue_enqueue(queue, [x1, y1 - 1]);
ds_stack_push(stack, [x1, y1 - 1]);
spanAbove = 1;
} else if(spanAbove && _delta > _thres) {
spanAbove = 0;
} }
} }
if(y1 < h - 1) { if(y1 < surface_h - 1) {
if(x1 == x_start && x1 > 0 && _corner) { if(x1 == x_start && x1 > 0 && _corner) {
var _delta = color_diff(_c1, get_color_buffer(x1 - 1, y1 + 1, w, h)); if(!spanBelow && ff_fillable(colorBase, colorFill, x1 - 1, y1 + 1, _thres)) {
if(!spanBelow && _delta <= _thres) { ds_queue_enqueue(queue, [x1 - 1, y1 + 1]);
ds_stack_push(stack, [x1 - 1, y1 + 1]); spanBelow = true;
spanBelow = 1;
} else if(spanBelow && _delta > _thres) {
spanBelow = 0;
} }
} }
var _delta = color_diff(_c1, get_color_buffer(x1, y1 + 1, w, h)); if(ff_fillable(colorBase, colorFill, x1, y1 + 1, _thres)) {
if(!spanBelow && _delta <= _thres) { ds_queue_enqueue(queue, [x1, y1 + 1]);
ds_stack_push(stack, [x1, y1 + 1]);
spanBelow = 1;
} else if(spanBelow && _delta > _thres) {
spanBelow = 0;
} }
} }
x1++; x1++;
} }
if(x1 < w - 1 && _corner) { if(x1 < surface_w - 1 && _corner) {
var _delta = color_diff(_c1, get_color_buffer(x1, y1 - 1, w, h)); if(y1 > 0) {
if(!spanAbove && _delta <= _thres) { if(!spanAbove && ff_fillable(colorBase, colorFill, x1 + 1, y1 - 1, _thres)) {
ds_stack_push(stack, [x1, y1 - 1]); ds_queue_enqueue(queue, [x1 + 1, y1 - 1]);
spanAbove = 1; spanAbove = true;
} else if(spanAbove && _delta > _thres) { }
spanAbove = 0;
} }
var _delta = color_diff(_c1, get_color_buffer(x1, y1 + 1, w, h)); if(y1 < surface_h - 1) {
if(!spanBelow && _delta <= _thres) { if(!spanBelow && ff_fillable(colorBase, colorFill, x1 + 1, y1 + 1, _thres)) {
ds_stack_push(stack, [x1, y1 + 1]); ds_queue_enqueue(queue, [x1 + 1, y1 + 1]);
spanBelow = 1; spanBelow = true;
} else if(spanBelow && _delta > _thres) {
spanBelow = 0;
} }
} }
} }
} }
surface_update();
}
function canvas_fill(_x, _y, _surf, _thres) { function canvas_fill(_x, _y, _surf, _thres) {
var w = surface_get_width(_surf); var w = surface_get_width(_surf);
var h = surface_get_height(_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 i = 0; i < w; i++ ) {
for( var j = 0; j < h; j++ ) { for( var j = 0; j < h; j++ ) {
@ -313,7 +350,7 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
continue; continue;
} }
var _c2 = get_color_buffer(i, j, w, h); var _c2 = get_color_buffer(i, j);
if(color_diff(_c1, _c2) <= _thres) if(color_diff(_c1, _c2) <= _thres)
draw_point(i, j); draw_point(i, j);
} }
@ -322,10 +359,19 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
surface_update(); 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) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(!active) return; if(!active) return;
if(keyboard_check(vk_alt)) return;
var _dim = inputs[| 0].getValue();
var _col = inputs[| 1].getValue(); var _col = inputs[| 1].getValue();
var _siz = inputs[| 2].getValue(); var _siz = inputs[| 2].getValue();
var _thr = inputs[| 3].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 _prev = inputs[| 5].getValue();
var _brush = inputs[| 6].getValue(); var _brush = inputs[| 6].getValue();
var _surf = outputs[| 0].getValue(); if(!surface_exists(canvas_surface))
var _surf_prev = outputs[| 1].getValue(); apply_surface();
var _surf_w = surface_get_width(_surf);
var _surf_h = surface_get_height(_surf);
if(!surface_exists(_surf)) return; var _surf_w = surface_get_width(canvas_surface);
if(!surface_exists(_surf_prev)) return; var _surf_h = surface_get_height(canvas_surface);
surface_set_target(_surf); surface_set_target(canvas_surface);
draw_set_color(_col); draw_set_color(_col);
var _tool = PANEL_PREVIEW.tool_index; 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); mouse_cur_y = round((_my - _y) / _s - 0.5);
if(_tool == 0 || _tool == 1) { 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 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 dd = point_distance(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y);
var _a = round(aa / 45) * 45; 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); draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush);
mouse_holding = true; 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); draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush);
mouse_holding = false; 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)) { if(mouse_holding && mouse_click(mb_left, active)) {
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_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); 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_x = mouse_cur_x;
mouse_pre_draw_y = mouse_cur_y; 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)) { if(mouse_release(mb_left)) {
surface_update(); 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_x = mouse_cur_x;
mouse_pre_y = mouse_cur_y; mouse_pre_y = mouse_cur_y;
apply_surface();
} else if(_tool == 2 || _tool == 3) { } 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 ww = mouse_cur_x - mouse_pre_x;
var hh = mouse_cur_y - mouse_pre_y; var hh = mouse_cur_y - mouse_pre_y;
var ss = max(abs(ww), abs(hh)); 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(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); 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); draw_ellp_size(mouse_pre_x, mouse_pre_y, mouse_cur_x, mouse_cur_y, _siz, _sub_tool, _brush);
} BLEND_NORMAL;
surface_update(); surface_update();
mouse_holding = false; mouse_holding = false;
} }
apply_surface();
} else if(_tool == 4) { } 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)) { 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) { switch(_fill_type) {
case 0 : 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; break;
case 1 : 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; break;
case 2 : case 2 :
canvas_fill(mouse_cur_x, mouse_cur_y, _surf, _thr); canvas_fill(mouse_cur_x, mouse_cur_y, canvas_surface, _thr);
break; break;
} }
@ -441,16 +499,25 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
surface_reset_target(); surface_reset_target();
#region preview
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); surface_set_target(_surf_prev);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
draw_surface_safe(_surf, 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); draw_set_color(_col);
if(_tool == 0 || _tool == 1) { if(_tool == 0 || _tool == 1) {
if(_tool == 1) gpu_set_blendmode(bm_subtract); if(key_mod_press(SHIFT))
if(keyboard_check(vk_shift))
draw_line_size(mouse_pre_draw_x, mouse_pre_draw_y, 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);
else else
draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush); draw_point_size(mouse_cur_x, mouse_cur_y, _siz, _brush);
@ -465,11 +532,9 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
} }
} }
BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
#region preview
if(_prev) draw_surface_ext(_surf_prev, _x, _y, _s, _s, 0, c_white, 1);
if (_tool == 2 || _tool == 3) { if (_tool == 2 || _tool == 3) {
if(mouse_holding) { if(mouse_holding) {
var _pr_x = _x + mouse_pre_x * _s; var _pr_x = _x + mouse_pre_x * _s;
@ -492,29 +557,16 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
#endregion #endregion
} }
static update = function() { static step = function() {
var _dim = inputs[| 0].getValue();
var _outSurf = outputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) { if(is_surface(_outSurf)) return;
_outSurf = surface_create_valid(_dim[0], _dim[1]);
_outSurf = surface_create_from_buffer(surface_w, surface_h, surface_buffer);
outputs[| 0].setValue(_outSurf); 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);
}
} }
var _outSurf = outputs[| 1].getValue(); static update = function(frame = ANIMATOR.current_frame) {
if(!is_surface(_outSurf)) { apply_surface();
_outSurf = surface_create_valid(_dim[0], _dim[1]);
outputs[| 1].setValue(_outSurf);
} else
surface_size_to(_outSurf, _dim[0], _dim[1]);
} }
static doSerialize = function(_map) { static doSerialize = function(_map) {
@ -524,7 +576,8 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
static postDeserialize = function() { static postDeserialize = function() {
if(!ds_map_exists(load_map, "surface")) return; if(!ds_map_exists(load_map, "surface")) return;
surface_buffer = buffer_base64_decode(load_map[? "surface"]); 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();
} }
} }

View file

@ -1,22 +1,22 @@
function Node_RGB_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { 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"]); .setDisplay(VALUE_DISPLAY.enum_scroll, ["Channel value", "Greyscale"]);
outputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 3] = nodeValue(3, "Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
static process_data = function(_outSurf, _data, output_index) { static process_data = function(_outSurf, _data, output_index) {
var _out = _data[1]; var _out = _data[1];
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
switch(output_index) { switch(output_index) {
case 0 : shader_set(_out? sh_channel_R_grey : sh_channel_R); break; 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; 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -1,16 +1,16 @@
function Node_HSV_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor { function Node_HSV_Channel(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
name = "HSV Extract"; 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[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue(1, "Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 2] = nodeValue(2, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
static process_data = function(_outSurf, _data, output_index) { static process_data = function(_outSurf, _data, output_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
switch(output_index) { switch(output_index) {
case 0 : shader_set(sh_channel_H); break; case 0 : shader_set(sh_channel_H); break;
case 1 : shader_set(sh_channel_S); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -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_col1 = shader_get_uniform(shader, "col1");
uniform_col2 = shader_get_uniform(shader, "col2"); 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); .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]); .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); .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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) { return getDimension(index); });
inputs[| 4] = nodeValue(4, "Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 4] = nodeValue("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[| 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 = [ input_display_list = [
["Output", true], 0, ["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_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]);
shader_set_uniform_f(uniform_angle, degtorad(_ang)); shader_set_uniform_f(uniform_angle, degtorad(_ang));
shader_set_uniform_f(uniform_amount, _amo); shader_set_uniform_f(uniform_amount, _amo);
shader_set_uniform_f_array(uniform_col1, colToVec4(_col1)); shader_set_uniform_f_array_safe(uniform_col1, colToVec4(_col1));
shader_set_uniform_f_array(uniform_col2, colToVec4(_col2)); 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); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset(); shader_reset();
surface_reset_target(); surface_reset_target();

View file

@ -6,16 +6,19 @@ function Node_Chromatic_Aberration(_x, _y, _group = -1) : Node_Processor(_x, _y,
uniform_cen = shader_get_uniform(shader, "center"); uniform_cen = shader_get_uniform(shader, "center");
uniform_str = shader_get_uniform(shader, "strength"); 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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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]); .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) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 1].getValue(); 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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
var center = _data[1]; var center = _data[1];
var stren = _data[2]; var stren = _data[2];
shader_set(shader); 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_array(uniform_cen, center); shader_set_uniform_f_array_safe(uniform_cen, center);
shader_set_uniform_f(uniform_str, stren); shader_set_uniform_f(uniform_str, stren);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -3,6 +3,61 @@ enum COLLECTION_TAG {
loop = 2 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 { function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
nodes = ds_list_create(); nodes = ds_list_create();
ungroupable = true; ungroupable = true;
@ -10,6 +65,8 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
custom_input_index = 0; custom_input_index = 0;
custom_output_index = 0; custom_output_index = 0;
metadata = new MetaDataManager();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
for(var i = custom_input_index; i < ds_list_size(inputs); i++) { for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
var _in = 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); recordAction(ACTION_TYPE.group_removed, self, _node);
switch(instanceof(_node)) { if(struct_has(_node, "ungroup"))
case "Node_Group_Input" : _node.ungroup();
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; if(_node.destroy_when_upgroup)
_node.y += y; nodeDelete(_node);
else
_node.group = group;
} }
static clearCache = function() { static clearCache = function() {
@ -90,8 +140,7 @@ function Node_Collection(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
static inspectorGroupUpdate = function() { static inspectorGroupUpdate = function() {
for(var i = 0; i < ds_list_size(nodes); i++) { for(var i = 0; i < ds_list_size(nodes); i++) {
var _node = nodes[| i]; var _node = nodes[| i];
if(_node.inspectorUpdate == noone) continue; if(_node.hasInspectorUpdate() == noone)
_node.inspectorUpdate(); _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++) { for(var i = 0; i < ds_list_size(nodes); i++) {
var n = nodes[| i]; var n = nodes[| i];
n.stepBegin(); n.stepBegin();
if(n.inspectorUpdate != noone) if(n.hasInspectorUpdate())
inspectorUpdate = inspectorGroupUpdate; inspectorUpdate = inspectorGroupUpdate;
if(!n.use_cache) continue; 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); ds_priority_destroy(ar);
} }
static onDestroy = function() { static onClone = function(target = PANEL_GRAPH.getCurrentContext()) {
for( var i = 0; i < ds_list_size(nodes); i++ ) { var dups = ds_list_create();
nodes[| i].destroy();
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() { static resetAllRenderStatus = function() {

View file

@ -4,11 +4,11 @@ function Node_Color(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constr
w = 96; 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]; 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(); 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_set_color(col);
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0);

View file

@ -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_use = shader_get_uniform(shader, "use_mask");
uniform_mask = shader_get_sampler_index(shader, "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]); .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]); .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]); .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]); .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]); .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]); .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]); .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]); .setDisplay(VALUE_DISPLAY.slider, [ 0, 4, 0.01]);
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); inputs[| 11] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 11;
input_display_list = [0, 8, outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [11, 0, 8,
["Brightness", false], 1, 10, 2, ["Brightness", false], 1, 10, 2,
["HSV", false], 3, 4, 5, ["HSV", false], 3, 4, 5,
["Color blend", false], 6, 7, 9 ["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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_i(uniform_mask_use, _m != DEF_SURFACE); 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_sat, _sat);
shader_set_uniform_f(uniform_val, _val); 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); shader_set_uniform_f(uniform_bla, _bla);
gpu_set_colorwriteenable(1, 1, 1, 0); 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); if(is_surface(_data[0])) draw_surface_ext_safe(_data[0], 0, 0, 1, 1, 0, c_white, _alp);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -4,23 +4,23 @@ function Node_Color_Data(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c
w = 96; 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); inputs[| 0].setVisible(true, true);
outputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
outputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
outputs[| 2] = nodeValue(2, "Blue", 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[| 3] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
outputs[| 4] = nodeValue(4, "Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); outputs[| 4] = nodeValue("Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
outputs[| 5] = nodeValue(5, "Value", 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]; var c = _data[0];
switch(index) { switch(_output_index) {
case 0 : return color_get_red(c) / 255; case 0 : return color_get_red(c) / 255;
case 1 : return color_get_green(c) / 255; case 1 : return color_get_green(c) / 255;
case 2 : return color_get_blue(c) / 255; case 2 : return color_get_blue(c) / 255;

View file

@ -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"; name = "HSV Color";
previewable = false; previewable = false;
w = 96; w = 96;
inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
inputs[| 0] = nodeValue(0, "Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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() { static process_data = function(_outSurf, _data, _output_index, _array_index) {
outputs[| 0].setValue(make_color_hsv(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); return make_color_hsv(_data[0] * 255, _data[1] * 255, _data[2] * 255);
} }
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; 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); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0);
} }
} }

View file

@ -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"; name = "RGB Color";
previewable = false; previewable = false;
w = 96; w = 96;
inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
inputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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]) .setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(true, true); .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() { static process_data = function(_outSurf, _data, _output_index, _array_index) {
outputs[| 0].setValue(make_color_rgb(inputs[| 0].getValue() * 255, inputs[| 1].getValue() * 255, inputs[| 2].getValue() * 255)); return make_color_rgb(_data[0] * 255, _data[1] * 255, _data[2] * 255);
} }
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; 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); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0);
} }
} }

View file

@ -4,46 +4,66 @@ function Node_Color_Remove(_x, _y, _group = -1) : Node_Processor(_x, _y, _group)
shader = sh_color_remove; shader = sh_color_remove;
uniform_from = shader_get_uniform(shader, "colorFrom"); uniform_from = shader_get_uniform(shader, "colorFrom");
uniform_from_count = shader_get_uniform(shader, "colorFrom_amo"); uniform_from_count = shader_get_uniform(shader, "colorFrom_amo");
uniform_invert = shader_get_uniform(shader, "invert");
uniform_ter = shader_get_uniform(shader, "treshold"); uniform_ter = shader_get_uniform(shader, "treshold");
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, "Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ])
inputs[| 1] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ])
.setDisplay(VALUE_DISPLAY.palette); .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]); .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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var fr = _data[1]; var frm = _data[1];
var tr = _data[2]; var thr = _data[2];
var inv = _data[6];
var _colors = array_create(array_length(fr) * 4); var _colors = array_create(array_length(frm) * 4);
for(var i = 0; i < array_length(fr); i++) { for(var i = 0; i < array_length(frm); i++) {
_colors[i * 4 + 0] = color_get_red(fr[i]) / 255; _colors[i * 4 + 0] = color_get_red(frm[i]) / 255;
_colors[i * 4 + 1] = color_get_green(fr[i]) / 255; _colors[i * 4 + 1] = color_get_green(frm[i]) / 255;
_colors[i * 4 + 2] = color_get_blue(fr[i]) / 255; _colors[i * 4 + 2] = color_get_blue(frm[i]) / 255;
_colors[i * 4 + 3] = 1; _colors[i * 4 + 3] = 1;
} }
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_f_array(uniform_from, _colors); shader_set_uniform_f_array_safe(uniform_from, _colors);
shader_set_uniform_i(uniform_from_count, array_length(fr)); shader_set_uniform_i(uniform_from_count, array_length(frm));
shader_set_uniform_f(uniform_ter, thr);
shader_set_uniform_f(uniform_ter, tr); shader_set_uniform_i(uniform_invert, inv);
draw_surface_safe(_data[0], 0, 0); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -13,29 +13,38 @@ function Node_Color_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group
uniform_inv = shader_get_uniform(shader, "inverted"); uniform_inv = shader_get_uniform(shader, "inverted");
uniform_hrd = shader_get_uniform(shader, "hardReplace"); uniform_hrd = shader_get_uniform(shader, "hardReplace");
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 from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ], "Color to be replaced.") inputs[| 1] = nodeValue("Palette from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [ c_black ], "Color to be replaced.")
.setDisplay(VALUE_DISPLAY.palette); .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); .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]); .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, ["Palette", false], 1, 2,
["Comparison", false], 3, 5, ["Comparison", false], 3, 5,
["Render", false], 4, 6 ["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 fr = _data[1];
@ -63,15 +72,15 @@ function Node_Color_replace(_x, _y, _group = -1) : Node_Processor(_x, _y, _group
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); 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_from_count, array_length(fr));
shader_set_uniform_i(uniform_alp, alp); shader_set_uniform_i(uniform_alp, alp);
shader_set_uniform_i(uniform_hrd, hrd); 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_i(uniform_to_count, array_length(to));
shader_set_uniform_f(uniform_ter, tr); shader_set_uniform_f(uniform_ter, tr);
shader_set_uniform_i(uniform_inv, in); 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 BLEND_NORMAL
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -2,16 +2,16 @@ function Node_Sampler(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) cons
name = "Sampler"; name = "Sampler";
w = 96; 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) .setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); }); .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]); .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]; } 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); 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 _surf = _data[0];
var _pos = _data[1]; var _pos = _data[1];
var _sam = _data[2]; 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; if(bbox.h <= 0) return;
var c = outputs[| 0].getValue(); var col = outputs[| 0].getValue();
if(is_array(c)) c = c[0];
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); draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 0);
} }
} }

View file

@ -7,50 +7,63 @@ function Node_Colorize(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) con
uniform_time = shader_get_uniform(shader, "gradient_time"); uniform_time = shader_get_uniform(shader, "gradient_time");
uniform_shift = shader_get_uniform(shader, "gradient_shift"); uniform_shift = shader_get_uniform(shader, "gradient_shift");
uniform_key = shader_get_uniform(shader, "keys"); 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); .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 ]); .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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _gra = _data[1]; var _gra = _data[1];
var _gra_data = inputs[| 1].getExtraData(); var _gra_data = inputs[| 1].getExtraData();
var _gra_shift = _data[2]; var _gra_shift = _data[2];
var _alpha = _data[6];
var _grad_color = []; var _grad = gradient_to_array(_gra);
var _grad_time = []; var _grad_color = _grad[0];
var _grad_time = _grad[1];
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;
}
surface_set_target(_outSurf); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
shader_set_uniform_i(uniform_grad_blend, ds_list_get(_gra_data, 0)); 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_safe(uniform_color, _grad_color);
shader_set_uniform_f_array(uniform_time, _grad_time); shader_set_uniform_f_array_safe(uniform_time, _grad_time);
shader_set_uniform_f(uniform_shift, _gra_shift); 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); draw_surface_safe(_data[0], 0, 0);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
return _outSurf; return _outSurf;
} }
} }

View file

@ -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_s = shader_get_sampler_index(shader, "samS");
uniform_v = shader_get_sampler_index(shader, "samV"); uniform_v = shader_get_sampler_index(shader, "samV");
inputs[| 0] = nodeValue(0, "Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue(1, "Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 2] = nodeValue(2, "Value", 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) { static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _h = _data[0]; 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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
texture_set_stage(uniform_h, surface_get_texture(_h)); 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); draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

View file

@ -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_usea = shader_get_uniform(shader, "useA");
uniform_mode = shader_get_uniform(shader, "mode"); uniform_mode = shader_get_uniform(shader, "mode");
inputs[| 0] = nodeValue(0, "Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue(1, "Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 2] = nodeValue(2, "Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 3] = nodeValue(3, "Alpha", 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"]); .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 = [ input_display_list = [
["Sampling", false], 4, ["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) { 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); surface_set_target(_outSurf);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
BLEND_OVERRIDE BLEND_OVERRIDE;
shader_set(shader); shader_set(shader);
texture_set_stage(uniform_r, surface_get_texture(_r)); 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); draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1);
shader_reset(); shader_reset();
BLEND_NORMAL BLEND_NORMAL;
surface_reset_target(); surface_reset_target();
return _outSurf; return _outSurf;

Some files were not shown because too many files have changed in this diff Show more