Extrude, 3D

This commit is contained in:
Tanasart 2022-12-12 15:08:03 +07:00
parent e32ae83bb5
commit e7c49a2d4f
147 changed files with 4121 additions and 2376 deletions

View file

@ -14,7 +14,7 @@
{"id":{"name":"buffer_surface","path":"scripts/buffer_surface/buffer_surface.yy",},"order":3,}, {"id":{"name":"buffer_surface","path":"scripts/buffer_surface/buffer_surface.yy",},"order":3,},
{"id":{"name":"sh_dither","path":"shaders/sh_dither/sh_dither.yy",},"order":33,}, {"id":{"name":"sh_dither","path":"shaders/sh_dither/sh_dither.yy",},"order":33,},
{"id":{"name":"panel_data","path":"scripts/panel_data/panel_data.yy",},"order":0,}, {"id":{"name":"panel_data","path":"scripts/panel_data/panel_data.yy",},"order":0,},
{"id":{"name":"node_3D_obj","path":"scripts/node_3D_obj/node_3D_obj.yy",},"order":8,}, {"id":{"name":"node_3d_obj","path":"scripts/node_3d_obj/node_3d_obj.yy",},"order":8,},
{"id":{"name":"o_dialog_menubox","path":"objects/o_dialog_menubox/o_dialog_menubox.yy",},"order":1,}, {"id":{"name":"o_dialog_menubox","path":"objects/o_dialog_menubox/o_dialog_menubox.yy",},"order":1,},
{"id":{"name":"s_node_blend","path":"sprites/s_node_blend/s_node_blend.yy",},"order":7,}, {"id":{"name":"s_node_blend","path":"sprites/s_node_blend/s_node_blend.yy",},"order":7,},
{"id":{"name":"libdlgmodule","path":"extensions/libdlgmodule/libdlgmodule.yy",},"order":2,}, {"id":{"name":"libdlgmodule","path":"extensions/libdlgmodule/libdlgmodule.yy",},"order":2,},
@ -117,6 +117,7 @@
{"id":{"name":"textBox","path":"scripts/textBox/textBox.yy",},"order":17,}, {"id":{"name":"textBox","path":"scripts/textBox/textBox.yy",},"order":17,},
{"id":{"name":"node_statistic","path":"scripts/node_statistic/node_statistic.yy",},"order":15,}, {"id":{"name":"node_statistic","path":"scripts/node_statistic/node_statistic.yy",},"order":15,},
{"id":{"name":"sh_draw_surface_part_tiled","path":"shaders/sh_draw_surface_part_tiled/sh_draw_surface_part_tiled.yy",},"order":32,}, {"id":{"name":"sh_draw_surface_part_tiled","path":"shaders/sh_draw_surface_part_tiled/sh_draw_surface_part_tiled.yy",},"order":32,},
{"id":{"name":"sh_blend_subtract_alpha","path":"shaders/sh_blend_subtract_alpha/sh_blend_subtract_alpha.yy",},"order":14,},
{"id":{"name":"o_dialog_add_node","path":"objects/o_dialog_add_node/o_dialog_add_node.yy",},"order":1,}, {"id":{"name":"o_dialog_add_node","path":"objects/o_dialog_add_node/o_dialog_add_node.yy",},"order":1,},
{"id":{"name":"s_node_curve","path":"sprites/s_node_curve/s_node_curve.yy",},"order":85,}, {"id":{"name":"s_node_curve","path":"sprites/s_node_curve/s_node_curve.yy",},"order":85,},
{"id":{"name":"sh_blend_normal","path":"shaders/sh_blend_normal/sh_blend_normal.yy",},"order":1,}, {"id":{"name":"sh_blend_normal","path":"shaders/sh_blend_normal/sh_blend_normal.yy",},"order":1,},
@ -168,6 +169,7 @@
{"id":{"name":"draw_set_text","path":"scripts/draw_set_text/draw_set_text.yy",},"order":1,}, {"id":{"name":"draw_set_text","path":"scripts/draw_set_text/draw_set_text.yy",},"order":1,},
{"id":{"name":"s_node_array","path":"sprites/s_node_array/s_node_array.yy",},"order":108,}, {"id":{"name":"s_node_array","path":"sprites/s_node_array/s_node_array.yy",},"order":108,},
{"id":{"name":"s_node_warp","path":"sprites/s_node_warp/s_node_warp.yy",},"order":23,}, {"id":{"name":"s_node_warp","path":"sprites/s_node_warp/s_node_warp.yy",},"order":23,},
{"id":{"name":"color_function","path":"scripts/color_function/color_function.yy",},"order":9,},
{"id":{"name":"node_color_data","path":"scripts/node_color_data/node_color_data.yy",},"order":4,}, {"id":{"name":"node_color_data","path":"scripts/node_color_data/node_color_data.yy",},"order":4,},
{"id":{"name":"node_noise_ani","path":"scripts/node_noise_ani/node_noise_ani.yy",},"order":7,}, {"id":{"name":"node_noise_ani","path":"scripts/node_noise_ani/node_noise_ani.yy",},"order":7,},
{"id":{"name":"s_node_transform","path":"sprites/s_node_transform/s_node_transform.yy",},"order":30,}, {"id":{"name":"s_node_transform","path":"sprites/s_node_transform/s_node_transform.yy",},"order":30,},
@ -175,6 +177,7 @@
{"id":{"name":"node_display_image","path":"scripts/node_display_image/node_display_image.yy",},"order":4,}, {"id":{"name":"node_display_image","path":"scripts/node_display_image/node_display_image.yy",},"order":4,},
{"id":{"name":"node_chromatic_aberration","path":"scripts/node_chromatic_aberration/node_chromatic_aberration.yy",},"order":45,}, {"id":{"name":"node_chromatic_aberration","path":"scripts/node_chromatic_aberration/node_chromatic_aberration.yy",},"order":45,},
{"id":{"name":"node_pin","path":"scripts/node_pin/node_pin.yy",},"order":2,}, {"id":{"name":"node_pin","path":"scripts/node_pin/node_pin.yy",},"order":2,},
{"id":{"name":"sh_noise","path":"shaders/sh_noise/sh_noise.yy",},"order":16,},
{"id":{"name":"sh_bw","path":"shaders/sh_bw/sh_bw.yy",},"order":1,}, {"id":{"name":"sh_bw","path":"shaders/sh_bw/sh_bw.yy",},"order":1,},
{"id":{"name":"real_comparison","path":"scripts/real_comparison/real_comparison.yy",},"order":1,}, {"id":{"name":"real_comparison","path":"scripts/real_comparison/real_comparison.yy",},"order":1,},
{"id":{"name":"s_node_stripe","path":"sprites/s_node_stripe/s_node_stripe.yy",},"order":36,}, {"id":{"name":"s_node_stripe","path":"sprites/s_node_stripe/s_node_stripe.yy",},"order":36,},
@ -194,7 +197,10 @@
{"id":{"name":"sh_blend_multiply_alpha","path":"shaders/sh_blend_multiply_alpha/sh_blend_multiply_alpha.yy",},"order":4,}, {"id":{"name":"sh_blend_multiply_alpha","path":"shaders/sh_blend_multiply_alpha/sh_blend_multiply_alpha.yy",},"order":4,},
{"id":{"name":"draw_sprite_ext_override","path":"scripts/draw_sprite_ext_override/draw_sprite_ext_override.yy",},"order":9,}, {"id":{"name":"draw_sprite_ext_override","path":"scripts/draw_sprite_ext_override/draw_sprite_ext_override.yy",},"order":9,},
{"id":{"name":"node_noise_cell","path":"scripts/node_noise_cell/node_noise_cell.yy",},"order":3,}, {"id":{"name":"node_noise_cell","path":"scripts/node_noise_cell/node_noise_cell.yy",},"order":3,},
{"id":{"name":"node_noise","path":"scripts/node_noise/node_noise.yy",},"order":21,},
{"id":{"name":"mtl_reader","path":"scripts/mtl_reader/mtl_reader.yy",},"order":6,},
{"id":{"name":"sh_scale2x","path":"shaders/sh_scale2x/sh_scale2x.yy",},"order":32,}, {"id":{"name":"sh_scale2x","path":"shaders/sh_scale2x/sh_scale2x.yy",},"order":32,},
{"id":{"name":"ds_priority","path":"scripts/ds_priority/ds_priority.yy",},"order":3,},
{"id":{"name":"node_vector","path":"scripts/node_vector/node_vector.yy",},"order":2,}, {"id":{"name":"node_vector","path":"scripts/node_vector/node_vector.yy",},"order":2,},
{"id":{"name":"node_palette","path":"scripts/node_palette/node_palette.yy",},"order":2,}, {"id":{"name":"node_palette","path":"scripts/node_palette/node_palette.yy",},"order":2,},
{"id":{"name":"buttonColor","path":"scripts/buttonColor/buttonColor.yy",},"order":3,}, {"id":{"name":"buttonColor","path":"scripts/buttonColor/buttonColor.yy",},"order":3,},
@ -238,6 +244,7 @@
{"id":{"name":"node_blur_radial","path":"scripts/node_blur_radial/node_blur_radial.yy",},"order":29,}, {"id":{"name":"node_blur_radial","path":"scripts/node_blur_radial/node_blur_radial.yy",},"order":29,},
{"id":{"name":"node_bloom","path":"scripts/node_bloom/node_bloom.yy",},"order":15,}, {"id":{"name":"node_bloom","path":"scripts/node_bloom/node_bloom.yy",},"order":15,},
{"id":{"name":"sh_bevel","path":"shaders/sh_bevel/sh_bevel.yy",},"order":3,}, {"id":{"name":"sh_bevel","path":"shaders/sh_bevel/sh_bevel.yy",},"order":3,},
{"id":{"name":"sh_blend_overlay","path":"shaders/sh_blend_overlay/sh_blend_overlay.yy",},"order":15,},
{"id":{"name":"node_sprite_stack","path":"scripts/node_sprite_stack/node_sprite_stack.yy",},"order":4,}, {"id":{"name":"node_sprite_stack","path":"scripts/node_sprite_stack/node_sprite_stack.yy",},"order":4,},
{"id":{"name":"sh_shape","path":"shaders/sh_shape/sh_shape.yy",},"order":3,}, {"id":{"name":"sh_shape","path":"shaders/sh_shape/sh_shape.yy",},"order":3,},
{"id":{"name":"draw_line_width2","path":"scripts/draw_line_width2/draw_line_width2.yy",},"order":2,}, {"id":{"name":"draw_line_width2","path":"scripts/draw_line_width2/draw_line_width2.yy",},"order":2,},
@ -294,6 +301,7 @@
{"id":{"name":"node_image_animated","path":"scripts/node_image_animated/node_image_animated.yy",},"order":2,}, {"id":{"name":"node_image_animated","path":"scripts/node_image_animated/node_image_animated.yy",},"order":2,},
{"id":{"name":"s_node_solid","path":"sprites/s_node_solid/s_node_solid.yy",},"order":39,}, {"id":{"name":"s_node_solid","path":"sprites/s_node_solid/s_node_solid.yy",},"order":39,},
{"id":{"name":"string_hexadecimal","path":"scripts/string_hexadecimal/string_hexadecimal.yy",},"order":1,}, {"id":{"name":"string_hexadecimal","path":"scripts/string_hexadecimal/string_hexadecimal.yy",},"order":1,},
{"id":{"name":"sh_vertex_pnt_light","path":"shaders/sh_vertex_pnt_light/sh_vertex_pnt_light.yy",},"order":4,},
{"id":{"name":"surfaceBox","path":"scripts/surfaceBox/surfaceBox.yy",},"order":22,}, {"id":{"name":"surfaceBox","path":"scripts/surfaceBox/surfaceBox.yy",},"order":22,},
{"id":{"name":"s_node_array_length","path":"sprites/s_node_array_length/s_node_array_length.yy",},"order":107,}, {"id":{"name":"s_node_array_length","path":"sprites/s_node_array_length/s_node_array_length.yy",},"order":107,},
{"id":{"name":"string_splice","path":"scripts/string_splice/string_splice.yy",},"order":5,}, {"id":{"name":"string_splice","path":"scripts/string_splice/string_splice.yy",},"order":5,},
@ -302,6 +310,7 @@
{"id":{"name":"area_function","path":"scripts/area_function/area_function.yy",},"order":2,}, {"id":{"name":"area_function","path":"scripts/area_function/area_function.yy",},"order":2,},
{"id":{"name":"s_node_statistic","path":"sprites/s_node_statistic/s_node_statistic.yy",},"order":3,}, {"id":{"name":"s_node_statistic","path":"sprites/s_node_statistic/s_node_statistic.yy",},"order":3,},
{"id":{"name":"sh_blend_alpha_addition","path":"shaders/sh_blend_alpha_addition/sh_blend_alpha_addition.yy",},"order":13,}, {"id":{"name":"sh_blend_alpha_addition","path":"shaders/sh_blend_alpha_addition/sh_blend_alpha_addition.yy",},"order":13,},
{"id":{"name":"s_node_noise","path":"sprites/s_node_noise/s_node_noise.yy",},"order":118,},
{"id":{"name":"sh_erode","path":"shaders/sh_erode/sh_erode.yy",},"order":20,}, {"id":{"name":"sh_erode","path":"shaders/sh_erode/sh_erode.yy",},"order":20,},
{"id":{"name":"node_pixel_cloud","path":"scripts/node_pixel_cloud/node_pixel_cloud.yy",},"order":19,}, {"id":{"name":"node_pixel_cloud","path":"scripts/node_pixel_cloud/node_pixel_cloud.yy",},"order":19,},
{"id":{"name":"sh_alpha_grey","path":"shaders/sh_alpha_grey/sh_alpha_grey.yy",},"order":9,}, {"id":{"name":"sh_alpha_grey","path":"shaders/sh_alpha_grey/sh_alpha_grey.yy",},"order":9,},
@ -375,6 +384,7 @@
{"id":{"name":"s_fx_pixel","path":"sprites/s_fx_pixel/s_fx_pixel.yy",},"order":0,}, {"id":{"name":"s_fx_pixel","path":"sprites/s_fx_pixel/s_fx_pixel.yy",},"order":0,},
{"id":{"name":"gradients_function","path":"scripts/gradients_function/gradients_function.yy",},"order":0,}, {"id":{"name":"gradients_function","path":"scripts/gradients_function/gradients_function.yy",},"order":0,},
{"id":{"name":"s_node_border","path":"sprites/s_node_border/s_node_border.yy",},"order":101,}, {"id":{"name":"s_node_border","path":"sprites/s_node_border/s_node_border.yy",},"order":101,},
{"id":{"name":"d3_vector","path":"scripts/d3_vector/d3_vector.yy",},"order":1,},
{"id":{"name":"s_node_pin","path":"sprites/s_node_pin/s_node_pin.yy",},"order":16,}, {"id":{"name":"s_node_pin","path":"sprites/s_node_pin/s_node_pin.yy",},"order":16,},
{"id":{"name":"s_node_9patch","path":"sprites/s_node_9patch/s_node_9patch.yy",},"order":112,}, {"id":{"name":"s_node_9patch","path":"sprites/s_node_9patch/s_node_9patch.yy",},"order":112,},
{"id":{"name":"s_node_blur_contrast","path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},"order":102,}, {"id":{"name":"s_node_blur_contrast","path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},"order":102,},
@ -386,11 +396,13 @@
{"id":{"name":"node_3d_prim_cylinder","path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",},"order":7,}, {"id":{"name":"node_3d_prim_cylinder","path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",},"order":7,},
{"id":{"name":"node_grid","path":"scripts/node_grid/node_grid.yy",},"order":20,}, {"id":{"name":"node_grid","path":"scripts/node_grid/node_grid.yy",},"order":20,},
{"id":{"name":"node_edge_detect","path":"scripts/node_edge_detect/node_edge_detect.yy",},"order":44,}, {"id":{"name":"node_edge_detect","path":"scripts/node_edge_detect/node_edge_detect.yy",},"order":44,},
{"id":{"name":"node_anim_priority","path":"scripts/node_anim_priority/node_anim_priority.yy",},"order":2,},
{"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":"FileDropper","path":"extensions/FileDropper/FileDropper.yy",},"order":4,}, {"id":{"name":"FileDropper","path":"extensions/FileDropper/FileDropper.yy",},"order":4,},
{"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,},
{"id":{"name":"node_dilate","path":"scripts/node_dilate/node_dilate.yy",},"order":34,}, {"id":{"name":"node_dilate","path":"scripts/node_dilate/node_dilate.yy",},"order":34,},
{"id":{"name":"sh_stripe","path":"shaders/sh_stripe/sh_stripe.yy",},"order":10,}, {"id":{"name":"sh_stripe","path":"shaders/sh_stripe/sh_stripe.yy",},"order":10,},
{"id":{"name":"sh_blend_contrast","path":"shaders/sh_blend_contrast/sh_blend_contrast.yy",},"order":16,},
{"id":{"name":"node_3d_prim_cube","path":"scripts/node_3d_prim_cube/node_3d_prim_cube.yy",},"order":5,}, {"id":{"name":"node_3d_prim_cube","path":"scripts/node_3d_prim_cube/node_3d_prim_cube.yy",},"order":5,},
{"id":{"name":"node_3d_transform","path":"scripts/node_3d_transform/node_3d_transform.yy",},"order":2,}, {"id":{"name":"node_3d_transform","path":"scripts/node_3d_transform/node_3d_transform.yy",},"order":2,},
{"id":{"name":"node_display_text","path":"scripts/node_display_text/node_display_text.yy",},"order":3,}, {"id":{"name":"node_display_text","path":"scripts/node_display_text/node_display_text.yy",},"order":3,},
@ -404,6 +416,7 @@
{"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},"order":14,}, {"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},"order":14,},
{"id":{"name":"s_node_normal_light","path":"sprites/s_node_normal_light/s_node_normal_light.yy",},"order":18,}, {"id":{"name":"s_node_normal_light","path":"sprites/s_node_normal_light/s_node_normal_light.yy",},"order":18,},
{"id":{"name":"node_transform_single","path":"scripts/node_transform_single/node_transform_single.yy",},"order":1,}, {"id":{"name":"node_transform_single","path":"scripts/node_transform_single/node_transform_single.yy",},"order":1,},
{"id":{"name":"s_node_3d_extrude","path":"sprites/s_node_3d_extrude/s_node_3d_extrude.yy",},"order":119,},
{"id":{"name":"buttonGradient","path":"scripts/buttonGradient/buttonGradient.yy",},"order":4,}, {"id":{"name":"buttonGradient","path":"scripts/buttonGradient/buttonGradient.yy",},"order":4,},
{"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},"order":34,}, {"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},"order":34,},
{"id":{"name":"s_node_level_selector","path":"sprites/s_node_level_selector/s_node_level_selector.yy",},"order":63,}, {"id":{"name":"s_node_level_selector","path":"sprites/s_node_level_selector/s_node_level_selector.yy",},"order":63,},
@ -470,6 +483,7 @@
{"id":{"name":"s_node_3d_transform","path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",},"order":113,}, {"id":{"name":"s_node_3d_transform","path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",},"order":113,},
{"id":{"name":"s_node_output","path":"sprites/s_node_output/s_node_output.yy",},"order":56,}, {"id":{"name":"s_node_output","path":"sprites/s_node_output/s_node_output.yy",},"order":56,},
{"id":{"name":"sh_atlas","path":"shaders/sh_atlas/sh_atlas.yy",},"order":31,}, {"id":{"name":"sh_atlas","path":"shaders/sh_atlas/sh_atlas.yy",},"order":31,},
{"id":{"name":"node_3d_extrude","path":"scripts/node_3d_extrude/node_3d_extrude.yy",},"order":9,},
{"id":{"name":"node_scale","path":"scripts/node_scale/node_scale.yy",},"order":9,}, {"id":{"name":"node_scale","path":"scripts/node_scale/node_scale.yy",},"order":9,},
{"id":{"name":"sh_displace","path":"shaders/sh_displace/sh_displace.yy",},"order":7,}, {"id":{"name":"sh_displace","path":"shaders/sh_displace/sh_displace.yy",},"order":7,},
{"id":{"name":"node_group","path":"scripts/node_group/node_group.yy",},"order":0,}, {"id":{"name":"node_group","path":"scripts/node_group/node_group.yy",},"order":0,},
@ -529,7 +543,12 @@
"Folders": [ "Folders": [
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation_curve","folderPath":"folders/animation_curve.yy","order":14,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation_curve","folderPath":"folders/animation_curve.yy","order":14,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"dialog","folderPath":"folders/dialog.yy","order":5,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"dialog","folderPath":"folders/dialog.yy","order":5,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/dialog/animation.yy","order":31,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"color selector","folderPath":"folders/dialog/color selector.yy","order":23,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"color selector","folderPath":"folders/dialog/color selector.yy","order":23,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"graph","folderPath":"folders/dialog/graph.yy","order":30,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"inspector","folderPath":"folders/dialog/inspector.yy","order":33,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"preview","folderPath":"folders/dialog/preview.yy","order":32,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/dialog/widget.yy","order":34,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Extensions","folderPath":"folders/Extensions.yy","order":11,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Extensions","folderPath":"folders/Extensions.yy","order":11,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"font","folderPath":"folders/font.yy","order":8,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"font","folderPath":"folders/font.yy","order":8,},
{"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,},
@ -586,11 +605,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprites","folderPath":"folders/sprites.yy","order":10,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprites","folderPath":"folders/sprites.yy","order":10,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"texture","folderPath":"folders/sprites/texture.yy","order":2,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"texture","folderPath":"folders/sprites/texture.yy","order":2,},
{"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":"graph","folderPath":"folders/dialog/graph.yy","order":30,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/dialog/animation.yy","order":31,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"preview","folderPath":"folders/dialog/preview.yy","order":32,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"inspector","folderPath":"folders/dialog/inspector.yy","order":33,},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/dialog/widget.yy","order":34,},
], ],
"AudioGroups": [ "AudioGroups": [
{"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,},
@ -686,7 +700,6 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Black.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Black.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Light.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"NotoSans-Light.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_bucket.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_bucket.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_ellip.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_ellip.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_ellip_fill.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_canvas_tools_ellip_fill.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
@ -846,12 +859,16 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphic.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphic.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_dialog_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_dialog_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_refresh_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_refresh_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_junc_visible_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_tile_view_strip4.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_tile_view_strip4.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_preset.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_preset.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics x2.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_animation_stretch.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_animation_stretch.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_visible.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_junc_visible_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics x2.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_path_tools_circle.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_path_tools_rectangle.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/tool",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",},
], ],
"MetaData": { "MetaData": {

Binary file not shown.

View file

@ -26,6 +26,7 @@
"_main_text_title": "blue_ltgrey", "_main_text_title": "blue_ltgrey",
"_main_text_sub": "blue_grey", "_main_text_sub": "blue_grey",
"_main_icon": "blue_grey", "_main_icon": "blue_grey",
"_main_icon_light": "blue_white",
"_main_icon_dark": "blue_mdblack", "_main_icon_dark": "blue_mdblack",
"_main_value_positive": "lime", "_main_value_positive": "lime",
"_main_value_negative": "red", "_main_value_negative": "red",
@ -42,6 +43,7 @@
"dialog_preference_prop_bg": "blue_white", "dialog_preference_prop_bg": "blue_white",
"dialog_add_node_collection": ["white", "orange", 0.5], "dialog_add_node_collection": ["white", "orange", 0.5],
"dialog_palette_divider": "blue_grey", "dialog_palette_divider": "blue_grey",
"dialog_notification_bg_hover": "blue_ltgrey",
"dialog_notification_bg": "blue_grey", "dialog_notification_bg": "blue_grey",
"dialog_notification_icon_bg": "blue_white", "dialog_notification_icon_bg": "blue_white",
"dialog_menubox_highlight": "blue_white", "dialog_menubox_highlight": "blue_white",

View file

@ -235,6 +235,13 @@
"yorigin": 24, "yorigin": 24,
"slice": null "slice": null
}, },
"visible": {
"path": "./icon/s_visible.png",
"subimages": 2,
"xorigin": 24,
"yorigin": 24,
"slice": null
},
"junc_visible": { "junc_visible": {
"path": "./icon/s_junc_visible_strip2.png", "path": "./icon/s_junc_visible_strip2.png",
"subimages": 2, "subimages": 2,
@ -1030,6 +1037,20 @@
"yorigin": 24, "yorigin": 24,
"slice": null "slice": null
}, },
"path_tools_circle": {
"path": "./tool/s_path_tools_circle.png",
"subimages": 1,
"xorigin": 24,
"yorigin": 24,
"slice": null
},
"path_tools_rectangle": {
"path": "./tool/s_path_tools_rectangle.png",
"subimages": 1,
"xorigin": 24,
"yorigin": 24,
"slice": null
},
"splice_draw": { "splice_draw": {
"path": "./tool/s_splice_draw.png", "path": "./tool/s_splice_draw.png",
"subimages": 1, "subimages": 1,

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

View file

@ -255,7 +255,7 @@ event_inherited();
search_string = ""; search_string = "";
search_list = ds_list_create(); search_list = ds_list_create();
keyboard_lastchar = ""; keyboard_lastchar = "";
keyboard_string = ""; KEYBOARD_STRING = "";
keyboard_lastkey = -1; keyboard_lastkey = -1;
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { tb_search = new textBox(TEXTBOX_INPUT.text, function(str) {

View file

@ -23,5 +23,5 @@ event_inherited();
}); });
TEXTBOX_ACTIVE = tb_name; TEXTBOX_ACTIVE = tb_name;
keyboard_string = ""; KEYBOARD_STRING = "";
#endregion #endregion

View file

@ -15,7 +15,7 @@ event_inherited();
target = noone; target = noone;
function onResize() { function onResize() {
sp_content.resize(dialog_w - ui(150), dialog_h - ui(64)); sp_content.resize(dialog_w - ui(150), dialog_h - ui(72));
} }
#endregion #endregion
@ -24,7 +24,7 @@ event_inherited();
dragging = -1; dragging = -1;
drag_spr = -1; drag_spr = -1;
sp_content = new scrollPane(dialog_w - ui(150), dialog_h - ui(64), function(_y, _m) { sp_content = new scrollPane(dialog_w - ui(150), dialog_h - ui(72), function(_y, _m) {
if(!target) return 0; if(!target) return 0;
draw_clear_alpha(COLORS.dialog_array_edit_bg, 0); draw_clear_alpha(COLORS.dialog_array_edit_bg, 0);
@ -58,6 +58,7 @@ event_inherited();
draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh); draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh);
if(sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) { if(sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) {
inb_hover = index;
if(dragging == -1) if(dragging == -1)
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1); draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1);
@ -70,17 +71,6 @@ event_inherited();
} }
} }
if(dragging != -1 && dragging != index) {
draw_set_color(COLORS.dialog_array_edit_divider);
if(sHOVER && point_in_rectangle(_m[0], _m[1], xx - pad / 2, yy, xx + ww / 2, yy + hh)) {
inb_hover = index;
draw_line_round(xx - pad / 2, yy, xx - pad / 2, yy + hh, 4);
} else if(sHOVER && point_in_rectangle(_m[0], _m[1], xx + ww / 2, yy, xx + ww + pad / 2, yy + hh)) {
inb_hover = index + 1;
draw_line_round(xx + ww + pad / 2, yy, xx + ww + pad / 2, yy + hh, 4);
}
}
var spr = target.spr[index]; var spr = target.spr[index];
var spr_w = sprite_get_width(spr); var spr_w = sprite_get_width(spr);
var spr_h = sprite_get_height(spr); var spr_h = sprite_get_height(spr);
@ -88,10 +78,8 @@ event_inherited();
var spr_x = xx + ww / 2 - spr_w * spr_s / 2; var spr_x = xx + ww / 2 - spr_w * spr_s / 2;
var spr_y = yy + hh / 2 - spr_h * spr_s / 2; var spr_y = yy + hh / 2 - spr_h * spr_s / 2;
if(dragging == index) var aa = dragging == -1? 1 : (dragging == index? 1 : 0.5);
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, 0.5); draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa);
else
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, 1);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text); draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
var path = arr[index]; var path = arr[index];
@ -107,14 +95,13 @@ event_inherited();
_h += ch; _h += ch;
} }
if(dragging != -1 && mouse_release(mb_left)) { if(dragging != -1) {
if(inb_hover != -1) { if(inb_hover != -1) {
var val = arr[dragging]; rearrange(dragging, inb_hover);
array_delete(arr, dragging, 1); dragging = inb_hover;
array_insert(arr, dragging < inb_hover? inb_hover - 1 : inb_hover, val);
target.inputs[| 0].setValue(arr);
target.doUpdate();
} }
if(mouse_release(mb_left))
dragging = -1; dragging = -1;
} }
@ -132,3 +119,16 @@ event_inherited();
return _h; return _h;
}) })
#endregion #endregion
#region function
function rearrange(oldindex, newindex) {
if(oldindex == newindex) return;
var arr = target.inputs[| 0].getValue();
var val = arr[oldindex];
array_delete(arr, oldindex, 1);
array_insert(arr, newindex, val);
target.inputs[| 0].setValue(arr);
target.doUpdate();
}
#endregion

View file

@ -14,7 +14,7 @@ if !target exit;
#region content #region content
var x0 = dialog_x + ui(20); var x0 = dialog_x + ui(20);
var x1 = x0 + sp_content.w; var x1 = x0 + sp_content.w;
var y0 = dialog_y + ui(44); var y0 = dialog_y + ui(56);
var y1 = y0 + sp_content.h; var y1 = y0 + sp_content.h;
draw_sprite_stretched(THEME.ui_panel_bg, 1, x0 - ui(6), y0 - ui(6), x1 - x0 + ui(12), y1 - y0 + ui(12)); draw_sprite_stretched(THEME.ui_panel_bg, 1, x0 - ui(6), y0 - ui(6), x1 - x0 + ui(12), y1 - y0 + ui(12));

View file

@ -35,8 +35,27 @@ event_inherited();
var _w = sp_noti.w - ui(12); var _w = sp_noti.w - ui(12);
var _h = ui(8) + string_height_ext(noti.txt, -1, txw) + ui(8); var _h = ui(8) + string_height_ext(noti.txt, -1, txw) + ui(8);
var cc = COLORS.dialog_notification_bg;
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy + ui(2), _w, _h - ui(4), COLORS.dialog_notification_bg, 1); draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy + ui(2), _w, _h - ui(4), COLORS.dialog_notification_bg, 1);
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, yy, _w, yy + _h - ui(4))) {
cc = COLORS.dialog_notification_bg_hover;
if(noti.onClick != noone && mouse_press(mb_left, sFOCUS))
noti.onClick();
if(mouse_press(mb_right, sFOCUS)) {
var dia = dialogCall(o_dialog_menubox, mouse_mx + ui(8), mouse_my + ui(8));
dia.noti = noti;
dia.setMenu([
[ "Copy notification message", function() {
clipboard_set_text(o_dialog_menubox.noti.txt);
} ],
]);
}
}
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy + ui(2), _w, _h - ui(4), cc, 1);
if(noti.life_max > 0) { if(noti.life_max > 0) {
var _nwx = sp_noti.w - ui(12) - ui(40); var _nwx = sp_noti.w - ui(12) - ui(40);
var _nw = _nwx * noti.life / noti.life_max; var _nw = _nwx * noti.life / noti.life_max;
@ -65,22 +84,6 @@ event_inherited();
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text); draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_ext(tx + ui(4), yy + _h / 2, noti.txt, -1, txw); draw_text_ext(tx + ui(4), yy + _h / 2, noti.txt, -1, txw);
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, yy, _w, yy + _h - ui(4))) {
draw_sprite_stretched_ext(THEME.node_active, 0, 0, yy + ui(2), _w, _h - ui(4), COLORS._main_accent, 1);
if(noti.onClick != noone && mouse_press(mb_left, sFOCUS))
noti.onClick();
if(mouse_press(mb_right, sFOCUS)) {
var dia = dialogCall(o_dialog_menubox, mouse_mx + ui(8), mouse_my + ui(8));
dia.noti = noti;
dia.setMenu([
[ "Copy notification message", function() {
clipboard_set_text(o_dialog_menubox.noti.txt);
} ],
]);
}
}
yy += _h; yy += _h;
hh += _h; hh += _h;
} }

View file

@ -63,12 +63,30 @@ event_inherited();
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"Double click delay", "Double click delay",
"double_click_delay", "double_click_delay",
new slider(0, 100, 1, function(val) { new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "double_click_delay"] = val; PREF_MAP[? "double_click_delay"] = val;
PREF_SAVE(); PREF_SAVE();
}) })
]); ]);
ds_list_add(pref_global, [
"Keyboard hold start",
"keyboard_repeat_start",
new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "keyboard_repeat_start"] = val;
PREF_SAVE();
})
]);
ds_list_add(pref_global, [
"Keyboard repeat delay",
"keyboard_repeat_speed",
new slider(0, 1, 0.01, function(val) {
PREF_MAP[? "keyboard_repeat_speed"] = val;
PREF_SAVE();
})
]);
ds_list_add(pref_global, [ ds_list_add(pref_global, [
"UI frame rate", "UI frame rate",
"ui_framerate", "ui_framerate",

View file

@ -20,15 +20,19 @@
draw_set_circle_precision(64); draw_set_circle_precision(64);
globalvar CURSOR, UPDATE, TOOLTIP, DIALOG_DEPTH_HOVER; globalvar CURSOR, UPDATE, TOOLTIP, DIALOG_DEPTH_HOVER;
globalvar RENDER_STACK; globalvar RENDER_STACK, KEYBOARD_STRING;
DIALOG_DEPTH_HOVER = 0; DIALOG_DEPTH_HOVER = 0;
UPDATE = RENDER_TYPE.none; UPDATE = RENDER_TYPE.none;
CURSOR = cr_default; CURSOR = cr_default;
TOOLTIP = ""; TOOLTIP = "";
KEYBOARD_STRING = "";
RENDER_STACK = ds_stack_create(); RENDER_STACK = ds_stack_create();
_cursor = CURSOR; _cursor = CURSOR;
dc_check = 0; dc_check = 0;
kb_time = 0;
kb_hold = false;
kb_hkey = 0;
//display_set_timing_method(tm_sleep); //display_set_timing_method(tm_sleep);
@ -88,6 +92,9 @@
case ".gif" : case ".gif" :
Node_create_Image_gif_path(PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y, path); Node_create_Image_gif_path(PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y, path);
break; break;
case ".obj" :
Node_create_3D_Obj_path(PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y, path);
break;
case ".json" : case ".json" :
case ".pxc" : case ".pxc" :
if(_new) NEW(); if(_new) NEW();

View file

@ -0,0 +1,5 @@
/// @description
kb_time = 0;
kb_hold = false;
kb_hkey = "";
keyboard_lastchar = "";

View file

@ -0,0 +1,24 @@
/// @description
var trigger = false;
kb_time += DELTA_TIME;
if(kb_hkey == keyboard_lastchar && kb_hkey != "") {
if(kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_speed"]) {
trigger = true;
kb_time = 0;
} else if(!kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_start"]) {
trigger = true;
kb_time = 0;
kb_hold = true;
}
} else
trigger = true;
kb_hkey = keyboard_lastchar;
if(!trigger) exit;
if(keyboard_check(vk_backspace)) {
KEYBOARD_STRING = string_copy(KEYBOARD_STRING, 1, string_length(KEYBOARD_STRING) - 1);
} else {
KEYBOARD_STRING += keyboard_lastchar;
}

View file

@ -10,7 +10,9 @@
#region animation #region animation
if(ANIMATOR.is_playing) { if(ANIMATOR.is_playing) {
ANIMATOR.real_frame += ANIMATOR.framerate * (delta_time / 1000000); var fr = ANIMATOR.real_frame + ANIMATOR.framerate * (delta_time / 1000000);
if(fr <= ANIMATOR.real_frame + 1)
ANIMATOR.real_frame = fr;
if(round(ANIMATOR.real_frame) >= ANIMATOR.frames_total) { if(round(ANIMATOR.real_frame) >= ANIMATOR.frames_total) {
switch(ANIMATOR.playback) { switch(ANIMATOR.playback) {
case ANIMATOR_END.loop : case ANIMATOR_END.loop :
@ -26,13 +28,9 @@
ANIMATOR.setFrame(ANIMATOR.real_frame); ANIMATOR.setFrame(ANIMATOR.real_frame);
} }
ANIMATOR.frame_progress = false;
var _c = ANIMATOR.current_frame; var _c = ANIMATOR.current_frame;
ANIMATOR.current_frame = round(ANIMATOR.real_frame); ANIMATOR.current_frame = round(ANIMATOR.real_frame);
ANIMATOR.frame_progress = _c != ANIMATOR.current_frame;
if(_c != ANIMATOR.current_frame) {
ANIMATOR.frame_progress = true;
}
#endregion #endregion
#region hotkey #region hotkey

View file

@ -44,12 +44,11 @@
if(dc_check > 0) { if(dc_check > 0) {
DOUBLE_CLICK = true; DOUBLE_CLICK = true;
dc_check = 0; dc_check = 0;
} else { } else
dc_check = PREF_MAP[? "double_click_delay"]; dc_check = PREF_MAP[? "double_click_delay"];
} }
}
dc_check--; dc_check -= DELTA_TIME;
#endregion #endregion
#region step #region step

View file

@ -35,6 +35,8 @@
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":2,"eventType":2,"collisionObjectId":null,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":2,"eventType":2,"collisionObjectId":null,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":3,"eventType":2,"collisionObjectId":null,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":3,"eventType":2,"collisionObjectId":null,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":3,"eventType":7,"collisionObjectId":null,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":3,"eventType":7,"collisionObjectId":null,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":1,"eventType":5,"collisionObjectId":null,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":1,"eventType":10,"collisionObjectId":null,},
], ],
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],

View file

@ -1,11 +1,17 @@
#region setup #region setup
globalvar FORMAT_PT, PRIMITIVES; globalvar PRIMITIVES, FORMAT_PT, FORMAT_PNT;
PRIMITIVES = ds_map_create(); PRIMITIVES = ds_map_create();
vertex_format_begin(); vertex_format_begin();
vertex_format_add_position_3d(); vertex_format_add_position_3d();
vertex_format_add_texcoord(); vertex_format_add_texcoord();
FORMAT_PT = vertex_format_end(); FORMAT_PT = vertex_format_end();
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_normal();
vertex_format_add_texcoord();
FORMAT_PNT = vertex_format_end();
#endregion #endregion
#region plane #region plane
@ -26,61 +32,76 @@
vertex_end(VB); vertex_end(VB);
vertex_freeze(VB); vertex_freeze(VB);
PRIMITIVES[? "plane"] = VB; PRIMITIVES[? "plane"] = VB;
var VB = vertex_create_buffer();
vertex_begin(VB, FORMAT_PNT);
vertex_add_pnt(VB, [_1, _0, 0], [0, 0, 1], [1, 0]);
vertex_add_pnt(VB, [_0, _0, 0], [0, 0, 1], [0, 0]);
vertex_add_pnt(VB, [_1, _1, 0], [0, 0, 1], [1, 1]);
vertex_add_pnt(VB, [_1, _1, 0], [0, 0, 1], [1, 1]);
vertex_add_pnt(VB, [_0, _0, 0], [0, 0, 1], [0, 0]);
vertex_add_pnt(VB, [_0, _1, 0], [0, 0, 1], [0, 1]);
vertex_end(VB);
vertex_freeze(VB);
PRIMITIVES[? "plane_normal"] = VB;
#endregion #endregion
#region cube #region cube
var VB = vertex_create_buffer(); var VB = vertex_create_buffer();
vertex_begin(VB, FORMAT_PT); vertex_begin(VB, FORMAT_PNT);
vertex_add_pt(VB, [_1, _0, _0], [1, 0]); vertex_add_pnt(VB, [_1, _0, _0], [0, 0, -1], [1, 0]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [0, 0, -1], [0, 0]);
vertex_add_pt(VB, [_1, _1, _0], [1, 1]); vertex_add_pnt(VB, [_1, _1, _0], [0, 0, -1], [1, 1]);
vertex_add_pt(VB, [_1, _1, _0], [1, 1]); vertex_add_pnt(VB, [_1, _1, _0], [0, 0, -1], [1, 1]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [0, 0, -1], [0, 0]);
vertex_add_pt(VB, [_0, _1, _0], [0, 1]); vertex_add_pnt(VB, [_0, _1, _0], [0, 0, -1], [0, 1]);
vertex_add_pt(VB, [_1, _0, _1], [1, 0]); vertex_add_pnt(VB, [_1, _0, _1], [0, 0, 1], [1, 0]);
vertex_add_pt(VB, [_0, _0, _1], [0, 0]); vertex_add_pnt(VB, [_0, _0, _1], [0, 0, 1], [0, 0]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [0, 0, 1], [1, 1]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [0, 0, 1], [1, 1]);
vertex_add_pt(VB, [_0, _0, _1], [0, 0]); vertex_add_pnt(VB, [_0, _0, _1], [0, 0, 1], [0, 0]);
vertex_add_pt(VB, [_0, _1, _1], [0, 1]); vertex_add_pnt(VB, [_0, _1, _1], [0, 0, 1], [0, 1]);
vertex_add_pt(VB, [_1, _0, _0], [1, 0]); vertex_add_pnt(VB, [_1, _0, _0], [0, 1, 0], [1, 0]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [0, 1, 0], [0, 0]);
vertex_add_pt(VB, [_1, _0, _1], [1, 1]); vertex_add_pnt(VB, [_1, _0, _1], [0, 1, 0], [1, 1]);
vertex_add_pt(VB, [_1, _0, _1], [1, 1]); vertex_add_pnt(VB, [_1, _0, _1], [0, 1, 0], [1, 1]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [0, 1, 0], [0, 0]);
vertex_add_pt(VB, [_0, _0, _1], [0, 1]); vertex_add_pnt(VB, [_0, _0, _1], [0, 1, 0], [0, 1]);
vertex_add_pt(VB, [_1, _1, _0], [1, 0]); vertex_add_pnt(VB, [_1, _1, _0], [0, -1, 0], [1, 0]);
vertex_add_pt(VB, [_0, _1, _0], [0, 0]); vertex_add_pnt(VB, [_0, _1, _0], [0, -1, 0], [0, 0]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [0, -1, 0], [1, 1]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [0, -1, 0], [1, 1]);
vertex_add_pt(VB, [_0, _1, _0], [0, 0]); vertex_add_pnt(VB, [_0, _1, _0], [0, -1, 0], [0, 0]);
vertex_add_pt(VB, [_0, _1, _1], [0, 1]); vertex_add_pnt(VB, [_0, _1, _1], [0, -1, 0], [0, 1]);
vertex_add_pt(VB, [_0, _1, _0], [1, 0]); vertex_add_pnt(VB, [_0, _1, _0], [1, 0, 0], [1, 0]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [1, 0, 0], [0, 0]);
vertex_add_pt(VB, [_0, _1, _1], [1, 1]); vertex_add_pnt(VB, [_0, _1, _1], [1, 0, 0], [1, 1]);
vertex_add_pt(VB, [_0, _1, _1], [1, 1]); vertex_add_pnt(VB, [_0, _1, _1], [1, 0, 0], [1, 1]);
vertex_add_pt(VB, [_0, _0, _0], [0, 0]); vertex_add_pnt(VB, [_0, _0, _0], [1, 0, 0], [0, 0]);
vertex_add_pt(VB, [_0, _0, _1], [0, 1]); vertex_add_pnt(VB, [_0, _0, _1], [1, 0, 0], [0, 1]);
vertex_add_pt(VB, [_1, _1, _0], [1, 0]); vertex_add_pnt(VB, [_1, _1, _0], [-1, 0, 0], [1, 0]);
vertex_add_pt(VB, [_1, _0, _0], [0, 0]); vertex_add_pnt(VB, [_1, _0, _0], [-1, 0, 0], [0, 0]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [-1, 0, 0], [1, 1]);
vertex_add_pt(VB, [_1, _1, _1], [1, 1]); vertex_add_pnt(VB, [_1, _1, _1], [-1, 0, 0], [1, 1]);
vertex_add_pt(VB, [_1, _0, _0], [0, 0]); vertex_add_pnt(VB, [_1, _0, _0], [-1, 0, 0], [0, 0]);
vertex_add_pt(VB, [_1, _0, _1], [0, 1]); vertex_add_pnt(VB, [_1, _0, _1], [-1, 0, 0], [0, 1]);
vertex_end(VB); vertex_end(VB);
vertex_freeze(VB); vertex_freeze(VB);

View file

@ -10,9 +10,13 @@
playback = ANIMATOR_END.loop; playback = ANIMATOR_END.loop;
static setFrame = function(frame) { static setFrame = function(frame) {
var _c = current_frame;
frame = clamp(frame, 0, frames_total - 1); frame = clamp(frame, 0, frames_total - 1);
real_frame = frame; real_frame = frame;
current_frame = round(frame); current_frame = round(frame);
if(_c != current_frame)
frame_progress = true;
} }
} }
#endregion #endregion

View file

@ -1,14 +1,14 @@
function APPEND(_path) { function APPEND(_path) {
APPENDING = true; APPENDING = true;
var log = false;
if(_path == "") return; if(_path == "") return;
var _map = json_load(_path);
var file = file_text_open_read(_path); if(_map == -1) {
var load_str = ""; printlog("Decode error");
while(!file_text_eof(file)) { return
load_str += file_text_readln(file);
} }
var _map = json_decode(load_str);
if(ds_map_exists(_map, "version")) { if(ds_map_exists(_map, "version")) {
var _v = _map[? "version"]; var _v = _map[? "version"];
@ -27,12 +27,14 @@ function APPEND(_path) {
ds_queue_clear(CONNECTION_CONFLICT); ds_queue_clear(CONNECTION_CONFLICT);
ds_map_clear(APPEND_MAP); ds_map_clear(APPEND_MAP);
var t = current_time;
for(var i = 0; i < ds_list_size(_node_list); i++) { for(var i = 0; i < ds_list_size(_node_list); i++) {
var _node = nodeLoad(_node_list[| i], true); var _node = nodeLoad(_node_list[| i], true);
if(_node) ds_list_add(appended_list, _node); if(_node) ds_list_add(appended_list, _node);
} }
file_text_close(file); printlog("Load time: " + string(current_time - t));
t = current_time;
try { try {
for(var i = 0; i < ds_list_size(appended_list); i++) { for(var i = 0; i < ds_list_size(appended_list); i++) {
@ -45,6 +47,8 @@ function APPEND(_path) {
} catch(e) { } catch(e) {
log_warning("APPEND, node", e.longMessage); log_warning("APPEND, node", e.longMessage);
} }
printlog("Load group time: " + string(current_time - t));
t = current_time;
try { try {
for(var i = 0; i < ds_list_size(appended_list); i++) for(var i = 0; i < ds_list_size(appended_list); i++)
@ -52,15 +56,8 @@ function APPEND(_path) {
} catch(e) { } catch(e) {
log_warning("APPEND, deserialize", e.longMessage); log_warning("APPEND, deserialize", e.longMessage);
} }
printlog("Deserialize time: " + string(current_time - t));
try { t = current_time;
for(var i = 0; i < ds_list_size(appended_list); i++) {
if(!variable_struct_exists(appended_list[| i], "collectionDeserialize")) continue;
appended_list[| i].collectionDeserialize(true);
}
} catch(e) {
log_warning("APPEND, deserialize", e.longMessage);
}
try { try {
for(var i = 0; i < ds_list_size(appended_list); i++) for(var i = 0; i < ds_list_size(appended_list); i++)
@ -72,6 +69,8 @@ function APPEND(_path) {
} catch(e) { } catch(e) {
log_warning("APPEND, connect", e.longMessage); log_warning("APPEND, connect", e.longMessage);
} }
printlog("Connect time: " + string(current_time - t));
t = current_time;
try { try {
for(var i = 0; i < ds_list_size(appended_list); i++) for(var i = 0; i < ds_list_size(appended_list); i++)
@ -79,6 +78,8 @@ function APPEND(_path) {
} catch(e) { } catch(e) {
log_warning("APPEND, update", e.longMessage); log_warning("APPEND, update", e.longMessage);
} }
printlog("Update time: " + string(current_time - t));
t = current_time;
ds_list_destroy(appended_list); ds_list_destroy(appended_list);
@ -101,11 +102,13 @@ function APPEND(_path) {
} }
if(!ds_queue_empty(CONNECTION_CONFLICT)) if(!ds_queue_empty(CONNECTION_CONFLICT))
log_warning("APPEND", "Some connection(s) is unsolved. This may caused by render node not being update properly, or image path is broken."); log_warning("APPEND", "Some connection(s) is unresolved. This may caused by render node not being update properly, or image path is broken.");
} catch(e) { } catch(e) {
log_warning("APPEND, Conflict solver error : ", e.longMessage); log_warning("APPEND, Conflict solver error : ", e.longMessage);
} }
} }
printlog("Conflict time: " + string(current_time - t));
t = current_time;
APPENDING = false; APPENDING = false;
PANEL_ANIMATION.updatePropertyList(); PANEL_ANIMATION.updatePropertyList();

View file

@ -22,3 +22,8 @@ function array_remove(arr, val) {
var ind = array_find(arr, val); var ind = array_find(arr, val);
array_delete(arr, ind, 1); array_delete(arr, ind, 1);
} }
function array_push_unique(arr, val) {
if(array_exists(arr, val)) return;
array_push(arr, val);
}

View file

@ -24,16 +24,16 @@ function buttonColorClass(_onApply) 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)) { //if(keyboard_check_pressed(vk_alt)) {
onColorPick(); // onColorPick();
is_picking = true; // is_picking = true;
} //}
if(is_picking) { //if(is_picking) {
if(keyboard_check_released(vk_alt)) { // if(keyboard_check_released(vk_alt)) {
instance_destroy(o_dialog_color_selector); // instance_destroy(o_dialog_color_selector);
is_picking = false; // is_picking = false;
} // }
} //}
var _cw = _w - ui(40); var _cw = _w - ui(40);
var click = false; var click = false;

View file

@ -15,7 +15,7 @@ function buttonGroupClass(_data, _onClick) constructor {
sb_small = new scrollBox(data, _onClick); sb_small = new scrollBox(data, _onClick);
static draw = function(_x, _y, _w, _h, _seleting, _m, _rx = 0, _ry = 0) { static draw = function(_x, _y, _w, _h, _selecting, _m, _rx = 0, _ry = 0) {
var amo = array_length(data); var amo = array_length(data);
var ww = _w / amo; var ww = _w / amo;
@ -34,7 +34,7 @@ function buttonGroupClass(_data, _onClick) constructor {
var bx = _x + ww * i; var bx = _x + ww * i;
var spr = i == 0 ? THEME.button_left : (i == amo - 1? THEME.button_right : THEME.button_middle); var spr = i == 0 ? THEME.button_left : (i == amo - 1? THEME.button_right : THEME.button_middle);
if(_seleting == i) { if(_selecting == i) {
draw_sprite_stretched(spr, 2, bx, _y, ww, _h); draw_sprite_stretched(spr, 2, bx, _y, ww, _h);
} else if(buttons[i].draw(bx, _y, ww, _h, _m, spr)) { } else if(buttons[i].draw(bx, _y, ww, _h, _m, spr)) {
onClick(i); onClick(i);
@ -50,7 +50,7 @@ function buttonGroupClass(_data, _onClick) constructor {
} else { } else {
sb_small.hover = hover; sb_small.hover = hover;
sb_small.active = active; sb_small.active = active;
sb_small.draw(_x, _y, _w, _h, _seleting, _m, _rx, _ry); sb_small.draw(_x, _y, _w, _h, data[_selecting], _m, _rx, _ry);
} }
hover = false; hover = false;

View file

@ -0,0 +1,10 @@
function colorFromRGBArray(arr) {
var r = round(real(arr[0]) * 255);
var g = round(real(arr[1]) * 255);
var b = round(real(arr[2]) * 255);
return make_color_rgb(r, g, b);
}
function colorArrayFromReal(clr) {
return [color_get_red(clr) / 255, color_get_green(clr) / 255, color_get_blue(clr) / 255 ];
}

View file

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

View file

@ -40,6 +40,7 @@ function curveBox(_onModify) constructor {
if(node_dragging != -1) { if(node_dragging != -1) {
var _my = -((_m[1] - _y) / curve_h * drag_range - drag_max); var _my = -((_m[1] - _y) / curve_h * drag_range - drag_max);
_my = clamp(_my, 0, 1);
_data[node_dragging] = _my; _data[node_dragging] = _my;

View file

@ -0,0 +1,17 @@
function d3_normalize(vec) {
var vx = vec[0], vy = vec[1], vz = vec[2];
var mag = sqrt(vx * vx + vy * vy + vz * vz);
vec[0] = vx / mag;
vec[1] = vy / mag;
vec[2] = vz / mag;
return vec;
}
function d3_cross_product(a, b, result) {
var ax = a[0], ay = a[1], az = a[2],
bx = b[0], by = b[1], bz = b[2];
result[@ 0] = ay * bz - az * by;
result[@ 1] = az * bx - ax * bz;
result[@ 2] = ax * by - ay * bx;
}

View file

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

View file

@ -1,10 +1,12 @@
globalvar BLEND_TYPES; globalvar BLEND_TYPES;
BLEND_TYPES = [ "Normal", "Add", "Subtract", "Multiply", "Multiply keep Alpha", "Screen", "Screen keep Alpha", "Maximum", "Minimum" ]; BLEND_TYPES = [ "Normal", "Add", "Subtract", "Subtract keep alpha", "Multiply", "Multiply keep Alpha", "Screen", "Screen keep Alpha", "Contrast", "Overlay", "Maximum", "Minimum" ];
enum BLEND_MODE { enum BLEND_MODE {
normal, normal,
add, add,
subtract, subtract,
subtract_alpha,
multiply, multiply,
multiply_alpha, multiply_alpha,
@ -12,6 +14,9 @@ enum BLEND_MODE {
screen, screen,
screen_alpha, screen_alpha,
contrast,
overlay,
maxx, maxx,
minn, minn,
} }
@ -25,10 +30,13 @@ 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.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.screen_alpha : sh = sh_blend_screen_alpha; break;
case BLEND_MODE.contrast : sh = sh_blend_contrast; break;
case BLEND_MODE.overlay : sh = sh_blend_overlay; break;
case BLEND_MODE.maxx : sh = sh_blend_max; break; case BLEND_MODE.maxx : sh = sh_blend_max; break;
case BLEND_MODE.minn : sh = sh_blend_min; break; case BLEND_MODE.minn : sh = sh_blend_min; break;
} }

View file

@ -0,0 +1,13 @@
function ds_priority_to_list(priority, asc = true) {
var l = ds_list_create();
var amo = ds_priority_size(priority);
repeat(amo) {
if(asc)
ds_list_add(l, ds_priority_delete_min(priority));
else
ds_list_add(l, ds_priority_delete_max(priority));
}
return l;
}

View file

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

View file

@ -74,6 +74,8 @@
#macro sFOCUS FOCUS == self #macro sFOCUS FOCUS == self
#macro sHOVER HOVER == self #macro sHOVER HOVER == self
#macro DELTA_TIME delta_time / 1000000
#region color #region color
#macro c_ui_blue_dkblack $251919 #macro c_ui_blue_dkblack $251919
#macro c_ui_blue_mdblack $2c1e1e #macro c_ui_blue_mdblack $2c1e1e
@ -107,6 +109,7 @@
#macro PIXEL_SURFACE surface_create_valid(1, 1) #macro PIXEL_SURFACE surface_create_valid(1, 1)
#macro print show_debug_message #macro print show_debug_message
#macro printlog if(log) show_debug_message
#endregion #endregion
#region presets #region presets

View file

@ -1,5 +1,5 @@
function json_load(path) { function json_load(path) {
if(!file_exists(path)) return {}; if(!file_exists(path)) return noone;
var f = file_text_open_read(path); var f = file_text_open_read(path);
var s = file_text_read_all(f); var s = file_text_read_all(f);
@ -16,3 +16,10 @@ function json_save(path, struct) {
file_text_write_string(f, s); file_text_write_string(f, s);
file_text_close(f); file_text_close(f);
} }
function file_text_read_all(file) {
var s = "";
while(!file_text_eof(file))
s += file_text_readln(file);
return s;
}

View file

@ -106,15 +106,6 @@ function LOAD_PATH(path, readonly = false) {
log_warning("LOAD, deserialize", e.longMessage); log_warning("LOAD, deserialize", e.longMessage);
} }
try {
for(var i = 0; i < ds_list_size(create_list); i++) {
if(!variable_struct_exists(create_list[| i], "collectionDeserialize")) continue;
create_list[| i].collectionDeserialize();
}
} catch(e) {
log_warning("LOAD, deserialize", e.longMessage);
}
try { try {
for(var i = 0; i < ds_list_size(create_list); i++) for(var i = 0; i < ds_list_size(create_list); i++)
create_list[| i].preConnect(); create_list[| i].preConnect();

View file

@ -0,0 +1,41 @@
function MTLmaterial(name) constructor {
self.name = name;
self.refc = 0;
self.diff = 0;
self.spec = 0;
self.refc_path = "";
self.diff_path = "";
self.spec_path = "";
}
function readMtl(path) {
if(!file_exists(path)) return [];
var mat = [];
var cur_mat = noone;
var file = file_text_open_read(path);
while(!file_text_eof(file)) {
var l = file_text_readln(file);
l = string_replace_all(l, "\n", "");
var sep = string_splice(l, " ");
if(array_length(sep) == 0 || sep[0] == "") continue;
switch(sep[0]) {
case "newmtl" :
cur_mat = new MTLmaterial(sep[1]);
array_push(mat, cur_mat);
break;
case "Ka" : cur_mat.refc = colorFromRGBArray([sep[1], sep[2], sep[3]]); break;
case "Kd" : cur_mat.diff = colorFromRGBArray([sep[1], sep[2], sep[3]]); break;
case "Ks" : cur_mat.spec = colorFromRGBArray([sep[1], sep[2], sep[3]]); break;
case "map_Ka": cur_mat.refc_path = filename_dir(path) + "/" + sep[1]; break;
case "map_Kd": cur_mat.diff_path = filename_dir(path) + "/" + sep[1]; break;
case "map_Ks": cur_mat.spec_path = filename_dir(path) + "/" + sep[1]; break;
}
}
return mat;
}

View file

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

View file

@ -59,7 +59,7 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor {
["Render", false], 11, 10 ["Render", false], 11, 10
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _shape = inputs[| 1].getValue(); var _shape = inputs[| 1].getValue();
switch(_shape) { switch(_shape) {
@ -68,14 +68,14 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor {
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my);
break; break;
case LIGHT_SHAPE_2D.line : case LIGHT_SHAPE_2D.line :
case LIGHT_SHAPE_2D.line_asym : case LIGHT_SHAPE_2D.line_asym :
case LIGHT_SHAPE_2D.spot : case LIGHT_SHAPE_2D.spot :
inputs[| 6].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 6].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 7].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 7].drawOverlay(active, _x, _y, _s, _mx, _my);
break; break;
} }
} }

View file

@ -4,9 +4,26 @@ function Node_create_3D_Obj(_x, _y) {
return node; return node;
} }
function Node_create_3D_Obj_path(_x, _y, path) {
if(!file_exists(path)) return noone;
var node = new Node_3D_Obj(_x, _y);
node.inputs[| 0].setValue(path);
node.updateObj();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
}
function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor { function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
name = "3D Obj"; name = "3D Obj";
uniVertex_lightFor = shader_get_uniform(sh_vertex_pnt_light, "u_LightForward");
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "")
.setDisplay(VALUE_DISPLAY.path_load, [ "*.obj", "" ]); .setDisplay(VALUE_DISPLAY.path_load, [ "*.obj", "" ]);
@ -19,19 +36,34 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2)
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 180 ]) inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 180 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 5] = nodeValue(5, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) inputs[| 5] = nodeValue(5, "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)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| 7] = nodeValue(7, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]);
inputs[| 8] = nodeValue(8, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 9] = nodeValue(9, "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);
input_display_list = [ 2, input_display_list = [ 2,
["Geometry", false], 0, 1, ["Geometry", false], 0, 1,
["Transform", false], 3, 4, 5 ["Transform", false], 3, 4, 5,
["Textures", true],
["Light", false], 6, 7, 8, 9, 10,
]; ];
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(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
@ -46,23 +78,47 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
function createMaterial(m_index) { function createMaterial(m_index) {
var index = ds_list_size(inputs); var index = ds_list_size(inputs);
inputs[| index] = nodeValue( index, "Texture " + materials[m_index], self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface); inputs[| index] = nodeValue( index, materialNames[m_index] + " texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface);
inputs[| index].setVisible(false); inputs[| index].setVisible(true);
input_display_list[input_display_len + m_index] = index; input_display_list[input_display_len + m_index] = index;
if(m_index >= array_length(materials)) return;
var matY = y - (array_length(materials) - 1) / 2 * (128 + 32);
var mat = materials[m_index];
if(file_exists(mat.diff_path)) {
var sol = Node_create_Image_path(x - (w + 64), matY + m_index * (128 + 32), mat.diff_path);
sol.name = mat.name + " texture";
inputs[| index].setFrom(sol.outputs[| 0]);
} else {
var sol = nodeBuild("Solid", x - (w + 64), matY + m_index * (128 + 32));
sol.name = mat.name + " texture";
sol.inputs[| 1].setValue(mat.diff);
inputs[| index].setFrom(sol.outputs[| 0]);
}
} }
VB = noone; VB = [];
materialNames = [];
materialIndex = [];
materials = []; materials = [];
static updateObj = function() { static updateObj = function() {
var _path = inputs[| 0].getValue(); var _path = inputs[| 0].getValue();
var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl";
var _v = readObj(_path); var _v = readObj(_path);
if(_v != noone) { if(_v != noone) {
VB = _v[0]; VB = _v[0];
materials = _v[1]; materialNames = _v[1];
materialIndex = _v[2];
} }
materials = readMtl(_pathMtl);
do_reset_material = true; do_reset_material = true;
} }
do_reset_material = false; do_reset_material = false;
@ -82,14 +138,14 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
drag_mx = 0; drag_mx = 0;
drag_my = 0; drag_my = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var active = _active;
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false; if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false;
var _dim = inputs[| 2].getValue(); var _dim = inputs[| 2].getValue();
var _pos = inputs[| 3].getValue();
var _rot = inputs[| 4].getValue(); var _rot = inputs[| 4].getValue();
var cx = _x + _dim[0] * _s / 2; var cx = _x + _pos[0] * _s;
var cy = _y + _dim[1] * _s / 2; var cy = _y + _pos[1] * _s;
draw_set_color(COLORS.axis[0]); draw_set_color(COLORS.axis[0]);
draw_line(cx - 64, cy, cx + 64, cy); draw_line(cx - 64, cy, cx + 64, cy);
@ -101,7 +157,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
draw_circle(cx, cy, 64, true); draw_circle(cx, cy, 64, true);
if(drag_index == 0) { if(drag_index == 0) {
var dx = (_mx - drag_mx) / _s * 6; var dx = (_mx - drag_mx) / _s * -6;
_rot[1] = drag_sv + dx; _rot[1] = drag_sv + dx;
if(inputs[| 4].setValue(_rot)) if(inputs[| 4].setValue(_rot))
@ -112,7 +168,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} else if(drag_index == 1) { } else if(drag_index == 1) {
var dy = (_my - drag_my) / _s * -6; var dy = (_my - drag_my) / _s * 6;
_rot[0] = drag_sv + dy; _rot[0] = drag_sv + dy;
if(inputs[| 4].setValue(_rot)) if(inputs[| 4].setValue(_rot))
@ -123,8 +179,8 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} else if(drag_index == 2) { } else if(drag_index == 2) {
var da = point_direction(cx, cy, _mx, _my); var dy = point_direction(cx, cy, _mx, _my) - point_direction(cx, cy, drag_mx, drag_my);
_rot[2] = da; _rot[2] = drag_sv + dy;
if(inputs[| 4].setValue(_rot)) if(inputs[| 4].setValue(_rot))
UNDO_HOLDING = true; UNDO_HOLDING = true;
@ -134,7 +190,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} else { } else {
if(distance_to_line(_mx, _my, cx - 64, cy, cx + 64, cy) < 16) { if(active && distance_to_line(_mx, _my, cx - 64, cy, cx + 64, cy) < 16) {
draw_set_color(COLORS.axis[0]); draw_set_color(COLORS.axis[0]);
draw_line_width(cx - 64, cy, cx + 64, cy, 3); draw_line_width(cx - 64, cy, cx + 64, cy, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -143,7 +199,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
} }
} else if(distance_to_line(_mx, _my, cx, cy - 64, cx, cy + 64) < 16) { } else if(active && distance_to_line(_mx, _my, cx, cy - 64, cx, cy + 64) < 16) {
draw_set_color(COLORS.axis[1]); draw_set_color(COLORS.axis[1]);
draw_line_width(cx, cy - 64, cx, cy + 64, 3); draw_line_width(cx, cy - 64, cx, cy + 64, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -152,7 +208,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
} }
} else if(abs(point_distance(_mx, _my, cx, cy) - 64) < 8) { } else if(active && abs(point_distance(_mx, _my, cx, cy) - 64) < 8) {
draw_set_color(COLORS.axis[2]); draw_set_color(COLORS.axis[2]);
draw_circle_border(cx, cy, 64, 3); draw_circle_border(cx, cy, 64, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -163,6 +219,8 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
} }
} }
} }
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)
} }
static update = function() { static update = function() {
@ -171,12 +229,11 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
if(do_reset_material) { if(do_reset_material) {
array_resize(input_display_list, input_display_len); array_resize(input_display_list, input_display_len);
while(ds_list_size(inputs) > 6) while(ds_list_size(inputs) > input_length)
ds_list_delete(inputs, 6); ds_list_delete(inputs, input_length);
for(var i = 0; i < array_length(materials); i++) { for(var i = 0; i < array_length(materialNames); i++)
createMaterial(i); createMaterial(i);
}
do_reset_material = false; do_reset_material = false;
} }
@ -185,6 +242,12 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
var _rot = inputs[| 4].getValue(); var _rot = inputs[| 4].getValue();
var _sca = inputs[| 5].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 _outSurf = outputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) { if(!is_surface(_outSurf)) {
_outSurf = surface_create_valid(_dim[0], _dim[1]); _outSurf = surface_create_valid(_dim[0], _dim[1]);
@ -192,28 +255,35 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
} else } else
surface_size_to(_outSurf, _dim[0], _dim[1]); surface_size_to(_outSurf, _dim[0], _dim[1]);
TM = matrix_build(_dim[0] / 2 + _pos[0], _dim[1] / 2 + _pos[1], 0, _rot[0], _rot[1], _rot[2], _dim[0] * _sca[0], _dim[1] * _sca[1], 1); var TM = matrix_build(_pos[0], _pos[1], 0, _rot[0], _rot[1], _rot[2], _dim[0] * _sca[0], _dim[1] * _sca[1], 1);
cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100); var cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100);
camera_set_view_mat(cam, cam_proj); camera_set_view_mat(cam, cam_proj);
camera_set_view_size(cam, _dim[0], _dim[1]); camera_set_view_size(cam, _dim[0], _dim[1]);
surface_set_target(_outSurf); var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
shader_set(sh_vertex_pt);
camera_apply(cam);
gpu_set_ztestenable(true); gpu_set_ztestenable(true);
surface_set_target(_outSurf);
shader_set(sh_vertex_pnt_light);
shader_set_uniform_f_array(uniVertex_lightFor, lightFor);
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
camera_apply(cam);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
matrix_stack_push(TM); matrix_stack_push(TM);
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
if(VB != noone) {
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 >= ds_list_size(inputs)) break;
var tex = inputs[| 6 + i].getValue(); var mIndex = materialIndex[i];
if(is_surface(tex)) var tex = inputs[| input_length + mIndex].getValue();
if(!is_surface(tex)) continue;
vertex_submit(VB[i], pr_trianglelist, surface_get_texture(tex)); vertex_submit(VB[i], pr_trianglelist, surface_get_texture(tex));
} }
}
shader_reset(); shader_reset();
matrix_stack_pop(); matrix_stack_pop();

View file

@ -1,7 +1,7 @@
{ {
"resourceType": "GMScript", "resourceType": "GMScript",
"resourceVersion": "1.0", "resourceVersion": "1.0",
"name": "node_3D_obj", "name": "node_3d_obj",
"isDnD": false, "isDnD": false,
"isCompatibility": false, "isCompatibility": false,
"parent": { "parent": {

View file

@ -0,0 +1,318 @@
function Node_create_3D_Extrude(_x, _y) {
var node = new Node_3D_Extrude(_x, _y);
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
}
function Node_3D_Extrude(_x, _y) : Node(_x, _y) constructor {
name = "3D Extrude";
uniVertex_lightFor = shader_get_uniform(sh_vertex_pnt_light, "u_LightForward");
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
inputs[| 0] = nodeValue(0, "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)
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 3] = nodeValue(3, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 4] = nodeValue(4, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 0.1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 5] = nodeValue(5, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 6] = nodeValue(6, "Manual generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.button, [ function() {
generateMesh();
}, "Generate"] );
inputs[| 7] = nodeValue(7, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| 8] = nodeValue(8, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]);
inputs[| 9] = nodeValue(9, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 10] = nodeValue(10, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
inputs[| 11] = nodeValue(11, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey);
input_display_list = [1,
["Geometry", false], 0, 6,
["Transform", false], 2, 3, 4, 5,
["Light", false], 7, 8, 9, 10, 11
];
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
VB = vertex_create_buffer();
vertex_begin(VB, FORMAT_PT);
vertex_end(VB);
static onValueUpdate = function(index) {
if(index == 0)
generateMesh();
}
static generateMesh = function() {
var _ins = inputs[| 0].getValue();
if(!is_surface(_ins)) return;
var ww = surface_get_width(_ins);
var hh = surface_get_height(_ins);
var tw = 1 / ww;
var th = 1 / hh;
var sw = -ww / 2 * tw;
var sh = -hh / 2 * th;
var surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2);
buffer_get_surface(surface_buffer, _ins, 0);
buffer_seek(surface_buffer, buffer_seek_start, 0);
vertex_begin(VB, FORMAT_PNT);
var ap = array_create(ww, hh);
for( var j = 0; j < hh; j++ )
for( var i = 0; i < ww; i++ ) {
var cc = buffer_read(surface_buffer, buffer_u32);
var _a = (cc & (0b11111111 << 24)) >> 24;
ap[i][j] = _a;
}
for( var i = 0; i < ww; i++ )
for( var j = 0; j < hh; j++ ) {
if(ap[i][j] == 0) continue;
var i0 = sw + i * tw, i1 = i0 + tw;
var j0 = sh + j * th, j1 = j0 + th;
var tx0 = tw * i, tx1 = tx0 + tw;
var ty0 = th * j, ty1 = ty0 + th;
vertex_add_pnt(VB, [i1, j0, -0.5], [0, 0, -1], [tx1, ty0]);
vertex_add_pnt(VB, [i0, j0, -0.5], [0, 0, -1], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, -0.5], [0, 0, -1], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j1, -0.5], [0, 0, -1], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j0, -0.5], [0, 0, -1], [tx0, ty0]);
vertex_add_pnt(VB, [i0, j1, -0.5], [0, 0, -1], [tx0, ty1]);
vertex_add_pnt(VB, [i1, j0, 0.5], [0, 0, 1], [tx1, ty0]);
vertex_add_pnt(VB, [i0, j0, 0.5], [0, 0, 1], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, 0.5], [0, 0, 1], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j1, 0.5], [0, 0, 1], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j0, 0.5], [0, 0, 1], [tx0, ty0]);
vertex_add_pnt(VB, [i0, j1, 0.5], [0, 0, 1], [tx0, ty1]);
if(j == 0 || ap[i][j - 1] == 0) {
vertex_add_pnt(VB, [i0, j0, 0.5], [0, -1, 0], [tx1, ty0]);
vertex_add_pnt(VB, [i0, j0, -0.5], [0, -1, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j0, 0.5], [0, -1, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j0, -0.5], [0, -1, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j0, -0.5], [0, -1, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j0, 0.5], [0, -1, 0], [tx0, ty1]);
}
if(j == hh - 1 || ap[i][j + 1] == 0) {
vertex_add_pnt(VB, [i0, j1, 0.5], [0, 1, 0], [tx1, ty0]);
vertex_add_pnt(VB, [i0, j1, -0.5], [0, 1, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, 0.5], [0, 1, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j1, -0.5], [0, 1, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j1, -0.5], [0, 1, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, 0.5], [0, 1, 0], [tx0, ty1]);
}
if(i == 0 || ap[i - 1][j] == 0) {
vertex_add_pnt(VB, [i0, j0, 0.5], [1, 0, 0], [tx1, ty0]);
vertex_add_pnt(VB, [i0, j0, -0.5], [1, 0, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i0, j1, 0.5], [1, 0, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j0, -0.5], [1, 0, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i0, j1, -0.5], [1, 0, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i0, j1, 0.5], [1, 0, 0], [tx0, ty1]);
}
if(i == ww - 1 || ap[i + 1][j] == 0) {
vertex_add_pnt(VB, [i1, j0, 0.5], [-1, 0, 0], [tx1, ty0]);
vertex_add_pnt(VB, [i1, j0, -0.5], [-1, 0, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, 0.5], [-1, 0, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j0, -0.5], [-1, 0, 0], [tx1, ty1]);
vertex_add_pnt(VB, [i1, j1, -0.5], [-1, 0, 0], [tx0, ty0]);
vertex_add_pnt(VB, [i1, j1, 0.5], [-1, 0, 0], [tx0, ty1]);
}
}
vertex_end(VB);
update();
}
drag_index = -1;
drag_sv = 0;
drag_mx = 0;
drag_my = 0;
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my))
active = false;
var _dim = inputs[| 1].getValue();
var _pos = inputs[| 2].getValue();
var _rot = inputs[| 3].getValue();
var cx = _x + _pos[0] * _s;
var cy = _y + _pos[1] * _s;
draw_set_color(COLORS.axis[0]);
draw_line(cx - 64, cy, cx + 64, cy);
draw_set_color(COLORS.axis[1]);
draw_line(cx, cy - 64, cx, cy + 64);
draw_set_color(COLORS.axis[2]);
draw_circle(cx, cy, 64, true);
if(drag_index == 0) {
var dx = (_mx - drag_mx) / _s * 6;
_rot[1] = drag_sv + dx;
if(inputs[| 3].setValue(_rot))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
drag_index = -1;
UNDO_HOLDING = false;
}
} else if(drag_index == 1) {
var dy = (_my - drag_my) / _s * -6;
_rot[0] = drag_sv + dy;
if(inputs[| 3].setValue(_rot))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
drag_index = -1;
UNDO_HOLDING = false;
}
} else if(drag_index == 2) {
var da = point_direction(cx, cy, _mx, _my);
_rot[2] = da;
if(inputs[| 3].setValue(_rot))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
drag_index = -1;
UNDO_HOLDING = false;
}
} else {
if(distance_to_line(_mx, _my, cx - 64, cy, cx + 64, cy) < 16) {
draw_set_color(COLORS.axis[0]);
draw_line_width(cx - 64, cy, cx + 64, cy, 3);
if(mouse_press(mb_left, active)) {
drag_index = 0;
drag_sv = _rot[1];
drag_mx = _mx;
drag_my = _my;
}
} else if(distance_to_line(_mx, _my, cx, cy - 64, cx, cy + 64) < 16) {
draw_set_color(COLORS.axis[1]);
draw_line_width(cx, cy - 64, cx, cy + 64, 3);
if(mouse_press(mb_left, active)) {
drag_index = 1;
drag_sv = _rot[0];
drag_mx = _mx;
drag_my = _my;
}
} else if(abs(point_distance(_mx, _my, cx, cy) - 64) < 8) {
draw_set_color(COLORS.axis[2]);
draw_circle_border(cx, cy, 64, 3);
if(mouse_press(mb_left, active)) {
drag_index = 2;
drag_sv = _rot[2];
drag_mx = _mx;
drag_my = _my;
}
}
}
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
}
#region 3D setup
TM = matrix_build(0, 0, 0, 0, 0, 0, 1, 1, 1);
cam = camera_create();
cam_view = matrix_build_lookat(0, 0, 1, 0, 0, 0, 0, 1, 0);
cam_proj = matrix_build_projection_ortho(1, 1, 1, 100);
camera_set_proj_mat(cam, cam_view);
camera_set_view_mat(cam, cam_proj);
#endregion
static update = function() {
var _ins = inputs[| 0].getValue();
var _dim = inputs[| 1].getValue();
var _pos = inputs[| 2].getValue();
var _rot = inputs[| 3].getValue();
var _lsc = inputs[| 4].getValue();
var _sca = inputs[| 5].getValue();
var _ldir = inputs[| 7].getValue();
var _lhgt = inputs[| 8].getValue();
var _lint = inputs[| 9].getValue();
var _lclr = inputs[| 10].getValue();
var _aclr = inputs[| 11].getValue();
var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) {
_outSurf = surface_create_valid(_dim[0], _dim[1]);
outputs[| 0].setValue(_outSurf);
} else
surface_size_to(_outSurf, _dim[0], _dim[1]);
if(!is_surface(_ins)) return _outSurf;
var TM = matrix_build(_pos[0], _pos[1], 0, _rot[0], _rot[1], _rot[2], _dim[0] * _sca[0], _dim[1] * _sca[1], 1);
var cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100);
camera_set_view_mat(cam, cam_proj);
camera_set_view_size(cam, _dim[0], _dim[1]);
var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
gpu_set_ztestenable(true);
surface_set_target(_outSurf);
shader_set(sh_vertex_pnt_light);
shader_set_uniform_f_array(uniVertex_lightFor, lightFor);
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
camera_apply(cam);
draw_clear_alpha(0, 0);
matrix_stack_push(TM);
matrix_stack_push(matrix_build(0, 0, 0, 0, 0, 0, _lsc[0], _lsc[1], _lsc[2]));
matrix_set(matrix_world, matrix_stack_top());
vertex_submit(VB, pr_trianglelist, surface_get_texture(_ins));
shader_reset();
matrix_stack_pop();
matrix_stack_pop();
matrix_set(matrix_world, MATRIX_IDENTITY);
surface_reset_target();
gpu_set_ztestenable(false);
camera_apply(0);
return _outSurf;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_3d_extrude",
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3D",
"path": "folders/nodes/data/3D.yy",
},
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3D",
"path": "folders/nodes/data/3D.yy",
},
"resourceVersion": "1.0",
"name": "node_3d_prim_cube",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -7,31 +7,52 @@ function Node_create_3D_Cube(_x, _y) {
function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor { function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
name = "3D Cube"; name = "3D Cube";
uniVertex_lightFor = shader_get_uniform(sh_vertex_pnt_light, "u_LightForward");
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
inputs[| 0] = nodeValue(0, "Main texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE); inputs[| 0] = nodeValue(0, "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(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2)
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) inputs[| 2] = nodeValue(2, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 3] = nodeValue(3, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) inputs[| 3] = nodeValue(3, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 4] = nodeValue(4, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) inputs[| 4] = nodeValue(4, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 5] = nodeValue(5, "Use textures", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); inputs[| 5] = nodeValue(5, "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); inputs[| 6] = nodeValue( 6, "Textures 0", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 7] = nodeValue( 7, "Textures 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 7] = nodeValue( 7, "Textures 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 8] = nodeValue( 8, "Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 8] = nodeValue( 8, "Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 9] = nodeValue( 9, "Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 9] = nodeValue( 9, "Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 10] = nodeValue(10, "Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 10] = nodeValue(10, "Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 11] = nodeValue(11, "Textures 5", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 11] = nodeValue(11, "Textures 5", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
inputs[| 12] = nodeValue(12, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 13] = nodeValue(13, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| 14] = nodeValue(14, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]);
inputs[| 15] = nodeValue(15, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 16] = nodeValue(16, "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);
input_display_list = [ input_display_list = [
["Transform", false], 0, 1, 2, 3, 4, ["Transform", false], 0, 1, 2, 3, 12, 4,
["Texture", false], 5, 6, 7, 8, 9, 10, 11 ["Texture", true], 5, 6, 7, 8, 9, 10, 11,
["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(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
@ -51,14 +72,15 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
drag_mx = 0; drag_mx = 0;
drag_my = 0; drag_my = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var active = _active; if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my))
if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false; active = false;
var _dim = inputs[| 1].getValue(); var _dim = inputs[| 1].getValue();
var _pos = inputs[| 2].getValue();
var _rot = inputs[| 3].getValue(); var _rot = inputs[| 3].getValue();
var cx = _x + _dim[0] * _s / 2; var cx = _x + _pos[0] * _s;
var cy = _y + _dim[1] * _s / 2; var cy = _y + _pos[1] * _s;
draw_set_color(COLORS.axis[0]); draw_set_color(COLORS.axis[0]);
draw_line(cx - 64, cy, cx + 64, cy); draw_line(cx - 64, cy, cx + 64, cy);
@ -103,7 +125,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} else { } else {
if(distance_to_line(_mx, _my, cx - 64, cy, cx + 64, cy) < 16) { if(active && distance_to_line(_mx, _my, cx - 64, cy, cx + 64, cy) < 16) {
draw_set_color(COLORS.axis[0]); draw_set_color(COLORS.axis[0]);
draw_line_width(cx - 64, cy, cx + 64, cy, 3); draw_line_width(cx - 64, cy, cx + 64, cy, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -112,7 +134,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
} }
} else if(distance_to_line(_mx, _my, cx, cy - 64, cx, cy + 64) < 16) { } else if(active && distance_to_line(_mx, _my, cx, cy - 64, cx, cy + 64) < 16) {
draw_set_color(COLORS.axis[1]); draw_set_color(COLORS.axis[1]);
draw_line_width(cx, cy - 64, cx, cy + 64, 3); draw_line_width(cx, cy - 64, cx, cy + 64, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -121,7 +143,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
} }
} else if(abs(point_distance(_mx, _my, cx, cy) - 64) < 8) { } else if(active && abs(point_distance(_mx, _my, cx, cy) - 64) < 8) {
draw_set_color(COLORS.axis[2]); draw_set_color(COLORS.axis[2]);
draw_circle_border(cx, cy, 64, 3); draw_circle_border(cx, cy, 64, 3);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -132,6 +154,8 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
} }
} }
} }
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {
@ -143,9 +167,17 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
var _pos = inputs[| 2].getValue(); var _pos = inputs[| 2].getValue();
var _rot = inputs[| 3].getValue(); var _rot = inputs[| 3].getValue();
var _sca = inputs[| 4].getValue(); var _sca = inputs[| 4].getValue();
var _lsc = inputs[| 12].getValue();
var _ldir = inputs[| 13].getValue();
var _lhgt = inputs[| 14].getValue();
var _lint = inputs[| 15].getValue();
var _lclr = inputs[| 16].getValue();
var _aclr = inputs[| 17].getValue();
var _usetex = inputs[| 5].getValue(); var _usetex = inputs[| 5].getValue();
for(var i = 6; i <= 11; i++) inputs[| i].setVisible(_usetex); for(var i = 6; i <= 11; i++) inputs[| i].setVisible(_usetex);
inputs[| 0].setVisible(true, !_usetex);
var _outSurf = outputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) { if(!is_surface(_outSurf)) {
@ -154,50 +186,58 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
} else } else
surface_size_to(_outSurf, _dim[0], _dim[1]); surface_size_to(_outSurf, _dim[0], _dim[1]);
TM = matrix_build(_ww / 2 + _pos[0], _hh / 2 + _pos[1], 0, _rot[0], _rot[1], _rot[2], _ww * _sca[0], _hh * _sca[1], 1); TM = matrix_build(_pos[0], _pos[1], 0, _rot[0], _rot[1], _rot[2], _ww * _sca[0], _hh * _sca[1], 1);
cam_proj = matrix_build_projection_ortho(_ww, _hh, 1, 100); cam_proj = matrix_build_projection_ortho(_ww, _hh, 1, 100);
camera_set_view_mat(cam, cam_proj); camera_set_view_mat(cam, cam_proj);
camera_set_view_size(cam, _ww, _hh); camera_set_view_size(cam, _ww, _hh);
var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
gpu_set_ztestenable(true);
surface_set_target(_outSurf); surface_set_target(_outSurf);
shader_set(sh_vertex_pt); shader_set(sh_vertex_pnt_light);
shader_set_uniform_f_array(uniVertex_lightFor, lightFor);
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
camera_apply(cam); camera_apply(cam);
draw_clear_alpha(0, 0); draw_clear_alpha(0, 0);
matrix_stack_push(TM); matrix_stack_push(TM);
gpu_set_ztestenable(true); matrix_stack_push(matrix_build(0, 0, 0, 0, 0, 0, _lsc[0], _lsc[1], _lsc[2]));
if(_usetex) { if(_usetex) {
var face = []; var face = [];
for(var i = 0; i < 6; i++) face[i] = inputs[| 6 + i].getValue(); for(var i = 0; i < 6; i++) face[i] = inputs[| 6 + i].getValue();
matrix_stack_push(matrix_build(0, 0, 0.5, 0, 0, 0, 1, 1, 1)); matrix_stack_push(matrix_build(0, 0, 0.5, 0, 0, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[0])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[0]));
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_push(matrix_build(0, 0, -0.5, 0, 0, 0, 1, 1, 1)); matrix_stack_push(matrix_build(0, 0, -0.5, 0, 0, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[1])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[1]));
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_push(matrix_build(0, 0.5, 0, 90, 0, 0, 1, 1, 1)); matrix_stack_push(matrix_build(0, 0.5, 0, 90, 0, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[2])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[2]));
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_push(matrix_build(0, -0.5, 0, 90, 0, 0, 1, 1, 1)); matrix_stack_push(matrix_build(0, -0.5, 0, 90, 0, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[3])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[3]));
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_push(matrix_build(0.5, 0, 0, 0, 90, 0, 1, 1, 1)); matrix_stack_push(matrix_build(0.5, 0, 0, 0, 90, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[4])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[4]));
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_push(matrix_build(-0.5, 0, 0, 0, 90, 0, 1, 1, 1)); matrix_stack_push(matrix_build(-0.5, 0, 0, 0, 90, 0, 1, 1, 1));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(PRIMITIVES[? "plane"], pr_trianglelist, surface_get_texture(face[5])); vertex_submit(PRIMITIVES[? "plane_normal"], pr_trianglelist, surface_get_texture(face[5]));
matrix_stack_pop(); matrix_stack_pop();
} else { } else {
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
@ -206,6 +246,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
shader_reset(); shader_reset();
matrix_stack_pop(); matrix_stack_pop();
matrix_stack_pop();
matrix_set(matrix_world, MATRIX_IDENTITY); matrix_set(matrix_world, MATRIX_IDENTITY);
surface_reset_target(); surface_reset_target();

View file

@ -7,6 +7,11 @@ function Node_create_3D_Cylinder(_x, _y) {
function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor { function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
name = "3D Cylinder"; name = "3D Cylinder";
uniVertex_lightFor = shader_get_uniform(sh_vertex_pnt_light, "u_LightForward");
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
inputs[| 0] = nodeValue(0, "Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); inputs[| 0] = nodeValue(0, "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(1, "Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2);
@ -14,23 +19,39 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2) inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2)
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) inputs[| 3] = nodeValue(3, "Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ def_surf_size / 2, def_surf_size / 2 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ]) inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 5] = nodeValue(5, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) inputs[| 5] = nodeValue(5, "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(6, "Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 7] = nodeValue(7, "Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 7] = nodeValue(7, "Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 8] = nodeValue(8, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 8] = nodeValue(8, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 9] = nodeValue(9, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 10] = nodeValue(10, "Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| 11] = nodeValue(11, "Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider, [-1, 1, 0.01]);
inputs[| 12] = nodeValue(12, "Light intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
inputs[| 13] = nodeValue(13, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
inputs[| 14] = nodeValue(14, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey);
input_display_list = [2, input_display_list = [2,
["Geometry", false], 0, 1, ["Geometry", false], 0, 1,
["Transform", false], 3, 4, 5, ["Transform", false], 3, 4, 9, 5,
["Texture", false], 6, 7, 8 ["Texture", true], 6, 7, 8,
["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(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
@ -43,15 +64,15 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
static generate_vb = function() { static generate_vb = function() {
var _ox, _oy, _nx, _ny, _ou, _nu; var _ox, _oy, _nx, _ny, _ou, _nu;
vertex_begin(VB_top, FORMAT_PT); vertex_begin(VB_top, FORMAT_PNT);
for(var i = 0; i <= sides; i++) { for(var i = 0; i <= sides; i++) {
_nx = lengthdir_x(0.5, i * 360 / sides); _nx = lengthdir_x(0.5, i * 360 / sides);
_ny = lengthdir_y(0.5, i * 360 / sides); _ny = lengthdir_y(0.5, i * 360 / sides);
if(i) { if(i) {
vertex_add_pt(VB_top, [ 0, thick / 2, 0], [ 0 + 0.5, 0 + 0.5]); vertex_add_pnt(VB_top, [ 0, thick / 2, 0], [0, 1, 0], [ 0 + 0.5, 0 + 0.5]);
vertex_add_pt(VB_top, [_ox, thick / 2, _oy], [_ox + 0.5, _oy + 0.5]); vertex_add_pnt(VB_top, [_ox, thick / 2, _oy], [0, 1, 0], [_ox + 0.5, _oy + 0.5]);
vertex_add_pt(VB_top, [_nx, thick / 2, _ny], [_nx + 0.5, _ny + 0.5]); vertex_add_pnt(VB_top, [_nx, thick / 2, _ny], [0, 1, 0], [_nx + 0.5, _ny + 0.5]);
} }
_ox = _nx; _ox = _nx;
@ -60,20 +81,20 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
vertex_end(VB_top); vertex_end(VB_top);
vertex_begin(VB_sid, FORMAT_PT); vertex_begin(VB_sid, FORMAT_PNT);
for(var i = 0; i <= sides; i++) { for(var i = 0; i <= sides; i++) {
_nx = lengthdir_x(0.5, i * 360 / sides); _nx = lengthdir_x(0.5, i * 360 / sides);
_ny = lengthdir_y(0.5, i * 360 / sides); _ny = lengthdir_y(0.5, i * 360 / sides);
_nu = i / sides; _nu = i / sides;
if(i) { if(i) {
vertex_add_pt(VB_sid, [_ox, -thick / 2, _oy], [_ou, 0]); vertex_add_pnt(VB_sid, [_ox, -thick / 2, _oy], [_nx, 0, _ny], [_ou, 0]);
vertex_add_pt(VB_sid, [_ox, thick / 2, _oy], [_ou, 1]); vertex_add_pnt(VB_sid, [_ox, thick / 2, _oy], [_nx, 0, _ny], [_ou, 1]);
vertex_add_pt(VB_sid, [_nx, thick / 2, _ny], [_nu, 1]); vertex_add_pnt(VB_sid, [_nx, thick / 2, _ny], [_nx, 0, _ny], [_nu, 1]);
vertex_add_pt(VB_sid, [_nx, thick / 2, _ny], [_nu, 1]); vertex_add_pnt(VB_sid, [_nx, thick / 2, _ny], [_nx, 0, _ny], [_nu, 1]);
vertex_add_pt(VB_sid, [_nx, -thick / 2, _ny], [_nu, 0]); vertex_add_pnt(VB_sid, [_nx, -thick / 2, _ny], [_nx, 0, _ny], [_nu, 0]);
vertex_add_pt(VB_sid, [_ox, -thick / 2, _oy], [_ou, 0]); vertex_add_pnt(VB_sid, [_ox, -thick / 2, _oy], [_nx, 0, _ny], [_ou, 0]);
} }
_ox = _nx; _ox = _nx;
@ -89,14 +110,15 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
drag_mx = 0; drag_mx = 0;
drag_my = 0; drag_my = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var active = _active; if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my))
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false; active = false;
var _dim = inputs[| 2].getValue(); var _dim = inputs[| 2].getValue();
var _pos = inputs[| 3].getValue();
var _rot = inputs[| 4].getValue(); var _rot = inputs[| 4].getValue();
var cx = _x + _dim[0] * _s / 2; var cx = _x + _pos[0] * _s;
var cy = _y + _dim[1] * _s / 2; var cy = _y + _pos[1] * _s;
draw_set_color(COLORS.axis[0]); draw_set_color(COLORS.axis[0]);
draw_line(cx - 64, cy, cx + 64, cy); draw_line(cx - 64, cy, cx + 64, cy);
@ -170,6 +192,8 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
} }
} }
} }
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
#region 3D setup #region 3D setup
@ -199,6 +223,13 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
var face_top = inputs[| 6].getValue(); var face_top = inputs[| 6].getValue();
var face_bot = inputs[| 7].getValue(); var face_bot = inputs[| 7].getValue();
var face_sid = inputs[| 8].getValue(); var face_sid = inputs[| 8].getValue();
var _lsc = inputs[| 9].getValue();
var _ldir = inputs[| 10].getValue();
var _lhgt = inputs[| 11].getValue();
var _lint = inputs[| 12].getValue();
var _lclr = inputs[| 13].getValue();
var _aclr = inputs[| 14].getValue();
var _outSurf = outputs[| 0].getValue(); var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) { if(!is_surface(_outSurf)) {
@ -207,20 +238,25 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
} else } else
surface_size_to(_outSurf, _dim[0], _dim[1]); surface_size_to(_outSurf, _dim[0], _dim[1]);
TM = matrix_build(_dim[0] / 2 + _pos[0], _dim[1] / 2 + _pos[1], 0, _rot[0], _rot[1], _rot[2], _dim[0] * _sca[0], _dim[1] * _sca[1], 1); TM = matrix_build(_pos[0], _pos[1], 0, _rot[0], _rot[1], _rot[2], _dim[0] * _sca[0], _dim[1] * _sca[1], 1);
cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100); cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100);
camera_set_view_mat(cam, cam_proj); camera_set_view_mat(cam, cam_proj);
camera_set_view_size(cam, _dim[0], _dim[1]); camera_set_view_size(cam, _dim[0], _dim[1]);
surface_set_target(_outSurf); var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
draw_clear_alpha(0, 0);
BLEND_ADD
shader_set(sh_vertex_pt);
camera_apply(cam);
gpu_set_ztestenable(true); gpu_set_ztestenable(true);
surface_set_target(_outSurf);
shader_set(sh_vertex_pnt_light);
shader_set_uniform_f_array(uniVertex_lightFor, lightFor);
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
camera_apply(cam);
draw_clear_alpha(0, 0);
matrix_stack_push(TM); matrix_stack_push(TM);
matrix_stack_push(matrix_build(0, 0, 0, 0, 0, 0, _lsc[0], _lsc[1], _lsc[2]));
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_top)); vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_top));
@ -232,12 +268,11 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
vertex_submit(VB_sid, pr_trianglelist, surface_get_texture(face_sid)); vertex_submit(VB_sid, pr_trianglelist, surface_get_texture(face_sid));
shader_reset();
shader_reset();
matrix_stack_pop();
matrix_stack_pop(); matrix_stack_pop();
matrix_set(matrix_world, MATRIX_IDENTITY); matrix_set(matrix_world, MATRIX_IDENTITY);
BLEND_NORMAL
surface_reset_target(); surface_reset_target();
gpu_set_ztestenable(false); gpu_set_ztestenable(false);

View file

@ -49,9 +49,9 @@ function Node_3D_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
drag_mx = 0; drag_mx = 0;
drag_my = 0; drag_my = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var active = _active; if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my))
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false; active = false;
var _out = outputs[| 0].getValue(); var _out = outputs[| 0].getValue();
if(!is_surface(_out) || !surface_exists(_out)) return; if(!is_surface(_out) || !surface_exists(_out)) return;

View file

@ -32,7 +32,7 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _dim = inputs[| 1].getValue(); var _dim = inputs[| 1].getValue();
var _splice = inputs[| 2].getValue(); var _splice = inputs[| 2].getValue();
@ -69,10 +69,10 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} }
if(!inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my)) { if(!inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my)) {
if(distance_to_line_infinite(_mx, _my, sp_r, -hh, sp_r, hh) < 12) { if(distance_to_line_infinite(_mx, _my, sp_r, -hh, sp_r, hh) < 12) {
draw_line_width(sp_r, -hh, sp_r, hh, 3); draw_line_width(sp_r, -hh, sp_r, hh, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 0; drag_side = 0;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -80,7 +80,7 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, -ww, sp_t, ww, sp_t) < 12) { } else if(distance_to_line_infinite(_mx, _my, -ww, sp_t, ww, sp_t) < 12) {
draw_line_width(-ww, sp_t, ww, sp_t, 3); draw_line_width(-ww, sp_t, ww, sp_t, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 1; drag_side = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -88,7 +88,7 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, sp_l, -hh, sp_l, hh) < 12) { } else if(distance_to_line_infinite(_mx, _my, sp_l, -hh, sp_l, hh) < 12) {
draw_line_width(sp_l, -hh, sp_l, hh, 3); draw_line_width(sp_l, -hh, sp_l, hh, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 2; drag_side = 2;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -96,7 +96,7 @@ function Node_9Slice(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, -ww, sp_b, ww, sp_b) < 12) { } else if(distance_to_line_infinite(_mx, _my, -ww, sp_b, ww, sp_b) < 12) {
draw_line_width(-ww, sp_b, ww, sp_b, 3); draw_line_width(-ww, sp_b, ww, sp_b, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 3; drag_side = 3;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;

View file

@ -0,0 +1,25 @@
function rearrange_priority(node, newpri) {
if(node.anim_priority == newpri) return;
var prev = node.anim_priority;
var down = prev > newpri;
node.anim_priority = newpri;
var amo = ds_map_size(NODE_MAP);
var k = ds_map_find_first(NODE_MAP);
repeat(amo) {
var _node = NODE_MAP[? k];
k = ds_map_find_next(NODE_MAP, k);
if(!_node.active) continue;
if(_node == node) continue;
if(down && _node.anim_priority >= newpri && _node.anim_priority <= prev)
_node.anim_priority++;
if(!down && _node.anim_priority <= newpri && _node.anim_priority >= prev)
_node.anim_priority--;
}
PANEL_ANIMATION.updatePropertyList();
}

View file

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

View file

@ -25,7 +25,7 @@ function Node_Area(_x, _y) : Node_Value_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Area", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0, AREA_SHAPE.rectangle ]) outputs[| 0] = nodeValue(0, "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) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _pos = inputs[| 0].getValue(); var _pos = inputs[| 0].getValue();
var _span = inputs[| 1].getValue(); var _span = inputs[| 1].getValue();
var _shape = inputs[| 2].getValue(); var _shape = inputs[| 2].getValue();
@ -44,8 +44,8 @@ function Node_Area(_x, _y) : Node_Value_Processor(_x, _y) constructor {
break; break;
} }
inputs[| 0].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 1].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 1].drawOverlay(active, px, py, _s, _mx, _my);
} }
function process_value_data(_data, index = 0) { function process_value_data(_data, index = 0) {

View file

@ -19,7 +19,7 @@ function Node_Blur_Directional(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _surf = outputs[| 0].getValue(); var _surf = outputs[| 0].getValue();
if(is_array(_surf)) { if(is_array(_surf)) {
if(array_length(_surf) == 0) return; if(array_length(_surf) == 0) return;
@ -29,7 +29,7 @@ function Node_Blur_Directional(_x, _y) : Node_Processor(_x, _y) constructor {
var ww = surface_get_width(_surf); var ww = surface_get_width(_surf);
var hh = surface_get_height(_surf); var hh = surface_get_height(_surf);
inputs[| 2].drawOverlay(_active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my); inputs[| 2].drawOverlay(active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -18,13 +18,13 @@ function Node_Blur_Radial(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 2].getValue(); var pos = inputs[| 2].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, px, py, _s, _mx, _my, 0, 64, THEME.anchor_scale_hori); inputs[| 1].drawOverlay(active, px, py, _s, _mx, _my, 0, 64, THEME.anchor_scale_hori);
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -330,8 +330,8 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
surface_update(); surface_update();
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(!_active) return; if(!active) return;
if(keyboard_check(vk_alt)) return; if(keyboard_check(vk_alt)) return;
var _col = inputs[| 1].getValue(); var _col = inputs[| 1].getValue();
@ -384,7 +384,7 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
mouse_pre_draw_y = mouse_cur_y; mouse_pre_draw_y = mouse_cur_y;
} }
if(mouse_holding && mouse_click(mb_left)) { if(mouse_holding && mouse_click(mb_left, active)) {
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);

View file

@ -39,13 +39,13 @@ function Node_Checker(_x, _y) : Node(_x, _y) constructor {
["Render", false], 4, 5, ["Render", false], 4, 5,
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 3].getValue(); var pos = inputs[| 3].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -21,12 +21,12 @@ function Node_Chromatic_Aberration(_x, _y) : Node_Processor(_x, _y) constructor
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 1].getValue(); var pos = inputs[| 1].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -9,6 +9,27 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
custom_input_index = 0; custom_input_index = 0;
custom_output_index = 0; custom_output_index = 0;
static setRenderStatus = function(result) {
rendered = result;
if(result) {
var siz = ds_list_size(outputs);
for( var i = custom_output_index; i < siz; i++ ) {
var _o = outputs[| i];
if(_o.node.rendered) continue;
rendered = false;
break;
}
}
if(!result && group != -1)
group.setRenderStatus(result);
postSetRenderStatus(result);
}
static postSetRenderStatus = function(result) {}
function add(_node) { function add(_node) {
ds_list_add(nodes, _node); ds_list_add(nodes, _node);
var list = _node.group == -1? PANEL_GRAPH.nodes_list : _node.group.nodes; var list = _node.group == -1? PANEL_GRAPH.nodes_list : _node.group.nodes;
@ -107,7 +128,7 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
static preConnect = function() { static preConnect = function() {
sortIO(); sortIO();
deserialize(keyframe_scale); deserialize(load_map, load_scale);
} }
static sortIO = function() { static sortIO = function() {
@ -164,20 +185,9 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
static resetRenderStatus = function() { static resetRenderStatus = function() {
for( var i = 0; i < ds_list_size(nodes); i++ ) { for( var i = 0; i < ds_list_size(nodes); i++ ) {
nodes[| i].setRenderStatus(false); nodes[| i].setUpdate();
if(variable_struct_exists(nodes[| i], "nodes")) if(variable_struct_exists(nodes[| i], "nodes"))
nodes[| i].resetRenderStatus(); nodes[| i].resetRenderStatus();
} }
} }
static collectionDeserialize = function(scale = false) {
sortIO();
var _inputs = load_map[? "inputs"];
if(!ds_list_empty(_inputs) && !ds_list_empty(inputs)) {
var _siz = min(ds_list_size(_inputs), ds_list_size(inputs));
for(var i = 0; i < _siz; i++) {
inputs[| i].deserialize(_inputs[| i], scale);
}
}
}
} }

View file

@ -15,8 +15,8 @@ function Node_Sampler(_x, _y) : Node(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
outputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); outputs[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
_input = -1; _input = -1;

View file

@ -233,7 +233,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
createNewSurface(); createNewSurface();
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pad = inputs[| 0].getValue(); var pad = inputs[| 0].getValue();
var ww = overlay_w; var ww = overlay_w;
var hh = overlay_h; var hh = overlay_h;
@ -366,7 +366,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
draw_rectangle_border(_dx0, _dy0, _dx1, _dy1, 2); draw_rectangle_border(_dx0, _dy0, _dx1, _dy1, 2);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
surf_dragging = hovering; surf_dragging = hovering;
input_dragging = hovering + 1; input_dragging = hovering + 1;
drag_type = hovering_type; drag_type = hovering_type;
@ -376,7 +376,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
dragging_my = _my; dragging_my = _my;
} }
} else if(hovering_type == 1) { //rot } else if(hovering_type == 1) { //rot
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
surf_dragging = hovering; surf_dragging = hovering;
input_dragging = hovering + 2; input_dragging = hovering + 2;
drag_type = hovering_type; drag_type = hovering_type;
@ -387,7 +387,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my); dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
} }
} else if(hovering_type == 2) { //sca } else if(hovering_type == 2) { //sca
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
surf_dragging = hovering; surf_dragging = hovering;
input_dragging = hovering + 3; input_dragging = hovering + 3;
drag_type = hovering_type; drag_type = hovering_type;

View file

@ -14,13 +14,36 @@ function Node_Counter(_x, _y) : Node_Value_Processor(_x, _y) constructor {
inputs[| 0] = nodeValue(0, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); inputs[| 0] = nodeValue(0, "Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
inputs[| 1] = nodeValue(1, "Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); inputs[| 1] = nodeValue(1, "Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
inputs[| 2] = nodeValue(2, "Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Frame count", "Animation progress"]);
outputs[| 0] = nodeValue(0, "Counter", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0); outputs[| 0] = nodeValue(0, "Counter", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
input_display_list = [
2, 0, 1
];
static step = function() {
var mode = inputs[| 2].getValue();
switch(mode) {
case 0 :
inputs[| 0].setVisible(true);
break;
case 1 :
inputs[| 0].setVisible(false);
break;
}
}
function process_value_data(_data, index = 0) { function process_value_data(_data, index = 0) {
var time = ANIMATOR.current_frame; var time = ANIMATOR.current_frame;
var spd = _data[1]; var mode = inputs[| 2].getValue();
var val = _data[0] + time * spd; var val;
switch(mode) {
case 0 : val = _data[0] + time * _data[1]; break;
case 1 : val = time / (ANIMATOR.frames_total - 1) * _data[1]; break;
}
return val; return val;
} }
@ -28,6 +51,6 @@ function Node_Counter(_x, _y) : Node_Value_Processor(_x, _y) constructor {
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);
draw_text(xx + w / 2 * _s, yy + 10 + h / 2 * _s, outputs[| 0].getValue()); draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, outputs[| 0].getValue(), _s, _s, 0);
} }
} }

View file

@ -18,7 +18,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
drag_my = 0; drag_my = 0;
drag_sv = 0; drag_sv = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(array_length(current_data) < 2) return; if(array_length(current_data) < 2) return;
var _inSurf = current_data[0]; var _inSurf = current_data[0];
@ -54,7 +54,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
if(inputs[| 1].setValue(_splice)) if(inputs[| 1].setValue(_splice))
UNDO_HOLDING = true; UNDO_HOLDING = true;
if(mouse_release(mb_left)) { if(mouse_release(mb_left, active)) {
drag_side = -1; drag_side = -1;
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
@ -62,7 +62,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
if(distance_to_line_infinite(_mx, _my, sp_r, -hh, sp_r, hh) < 12) { if(distance_to_line_infinite(_mx, _my, sp_r, -hh, sp_r, hh) < 12) {
draw_line_width(sp_r, -hh, sp_r, hh, 3); draw_line_width(sp_r, -hh, sp_r, hh, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 0; drag_side = 0;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -70,7 +70,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, -ww, sp_t, ww, sp_t) < 12) { } else if(distance_to_line_infinite(_mx, _my, -ww, sp_t, ww, sp_t) < 12) {
draw_line_width(-ww, sp_t, ww, sp_t, 3); draw_line_width(-ww, sp_t, ww, sp_t, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 1; drag_side = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -78,7 +78,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, sp_l, -hh, sp_l, hh) < 12) { } else if(distance_to_line_infinite(_mx, _my, sp_l, -hh, sp_l, hh) < 12) {
draw_line_width(sp_l, -hh, sp_l, hh, 3); draw_line_width(sp_l, -hh, sp_l, hh, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 2; drag_side = 2;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -86,7 +86,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
} }
} else if(distance_to_line_infinite(_mx, _my, -ww, sp_b, ww, sp_b) < 12) { } else if(distance_to_line_infinite(_mx, _my, -ww, sp_b, ww, sp_b) < 12) {
draw_line_width(-ww, sp_b, ww, sp_b, 3); draw_line_width(-ww, sp_b, ww, sp_b, 3);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_side = 3; drag_side = 3;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;

View file

@ -6,6 +6,7 @@ function Node(_x, _y) constructor {
icon = noone; icon = noone;
bg_spr = THEME.node_bg; bg_spr = THEME.node_bg;
bg_sel_spr = THEME.node_active; bg_sel_spr = THEME.node_active;
anim_priority = ds_map_size(NODE_MAP);
if(!LOADING && !APPENDING) { if(!LOADING && !APPENDING) {
recordAction(ACTION_TYPE.node_added, self); recordAction(ACTION_TYPE.node_added, self);
@ -122,16 +123,14 @@ function Node(_x, _y) constructor {
if(update_on_frame) if(update_on_frame)
doUpdate(); doUpdate();
for(var i = 0; i < ds_list_size(inputs); i++) { for(var i = 0; i < ds_list_size(inputs); i++) {
if(inputs[| i].isAnim()) { if(inputs[| i].isAnimated())
stack_push = true; stack_push = true;
} }
} }
}
if(stack_push) { if(stack_push) {
setRenderStatus(false); setRenderStatus(false);
UPDATE |= RENDER_TYPE.full; UPDATE |= RENDER_TYPE.partial;
//ds_stack_push(RENDER_STACK, self);
} }
if(auto_height) if(auto_height)
@ -150,7 +149,7 @@ function Node(_x, _y) constructor {
static onValueUpdate = function(index) {} static onValueUpdate = function(index) {}
static isUpdateReady = function() { static isUpdateReady = function() {
if(rendered) return false; //if(rendered) return false;
for(var j = 0; j < ds_list_size(inputs); j++) { for(var j = 0; j < ds_list_size(inputs); j++) {
var _in = inputs[| j]; var _in = inputs[| j];
@ -176,7 +175,8 @@ function Node(_x, _y) constructor {
var jun = outputs[| i]; var jun = outputs[| i];
for(var j = 0; j < ds_list_size(jun.value_to); j++) { for(var j = 0; j < ds_list_size(jun.value_to); j++) {
var _to = jun.value_to[| j]; var _to = jun.value_to[| j];
if(_to.value_from == jun) if(_to.value_from != jun) continue;
_to.node.triggerRender(); _to.node.triggerRender();
} }
} }
@ -186,6 +186,9 @@ function Node(_x, _y) constructor {
static setRenderStatus = function(result) { static setRenderStatus = function(result) {
rendered = result; rendered = result;
if(!result && group != -1)
group.setRenderStatus(result);
} }
static pointIn = function(_x, _y, _mx, _my, _s) { static pointIn = function(_x, _y, _mx, _my, _s) {
@ -236,16 +239,18 @@ function Node(_x, _y) constructor {
draw_sprite_stretched_ext(THEME.node_bg_name, 0, xx, yy, w * _s, ui(20), color, 0.75); draw_sprite_stretched_ext(THEME.node_bg_name, 0, xx, yy, w * _s, ui(20), color, 0.75);
var cc = COLORS._main_text; var cc = COLORS._main_text;
if(PREF_MAP[? "node_show_render_status"]) if(PREF_MAP[? "node_show_render_status"] && !rendered)
cc = rendered? COLORS._main_text : COLORS._main_value_negative; cc = isUpdateReady()? COLORS._main_value_positive : COLORS._main_value_negative;
draw_set_text(f_p1, fa_left, fa_center, cc); draw_set_text(f_p1, fa_left, fa_center, cc);
if(!auto_update) icon = THEME.refresh_s; if(!auto_update) icon = THEME.refresh_s;
var ts = clamp(power(_s, 0.5), 0.5, 1);
if(icon) { if(icon) {
draw_sprite_ui_uniform(icon, 0, xx + ui(12), yy + ui(10)); draw_sprite_ui_uniform(icon, 0, xx + ui(12), yy + ui(10));
draw_text_cut(xx + ui(24), yy + ui(10), name, w * _s - ui(24)); draw_text_cut(xx + ui(24), yy + ui(10), name, w * _s - ui(24), ts);
} else { } else {
draw_text_cut(xx + ui(8), yy + ui(10), name, w * _s - ui(8)); draw_text_cut(xx + ui(8), yy + ui(10), name, w * _s - ui(8), ts);
} }
} }
@ -466,7 +471,7 @@ function Node(_x, _y) constructor {
active_draw_index = ind; active_draw_index = ind;
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {} static drawOverlay = function(active, _x, _y, _s, _mx, _my) {}
static destroy = function(_merge = false) { static destroy = function(_merge = false) {
active = false; active = false;
@ -595,7 +600,10 @@ function Node(_x, _y) constructor {
var _ou = outputs[| i]; var _ou = outputs[| i];
for(var j = 0; j < ds_list_size(_ou.value_to); j++) { for(var j = 0; j < ds_list_size(_ou.value_to); j++) {
var _to = _ou.value_to[| j]; var _to = _ou.value_to[| j];
if(_to.value_from == _ou && _to.node.active && _to.node.group != group) { if(_to.value_from != _ou) continue;
if(!_to.node.active) continue;
if(_to.node.group == group) continue;
var output_node = noone; var output_node = noone;
switch(_type) { switch(_type) {
case "group" : output_node = new Node_Group_Output(x + w + 64, y, group); break; case "group" : output_node = new Node_Group_Output(x + w + 64, y, group); break;
@ -610,6 +618,16 @@ function Node(_x, _y) constructor {
} }
} }
} }
static clone = function() {
var _type = instanceof(self);
var _node = NODE_CREATE_FUCTION[? _type](x, y);
var _data = serialize();
_node.deserialize(ds_map_clone(_data));
_node.node_id = generateUUID();
return _node;
} }
static serialize = function(scale = false, preset = false) { static serialize = function(scale = false, preset = false) {
@ -644,11 +662,11 @@ function Node(_x, _y) constructor {
} }
static doSerialize = function(_map) {} static doSerialize = function(_map) {}
keyframe_scale = false; load_scale = false;
load_map = -1; load_map = -1;
static deserialize = function(_map, scale = false, preset = false) { static deserialize = function(_map, scale = false, preset = false) {
load_map = _map; load_map = _map;
keyframe_scale = scale; load_scale = scale;
if(!preset) { if(!preset) {
if(APPENDING) { if(APPENDING) {

View file

@ -23,13 +23,13 @@ function Node_Dilate(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 1].getValue(); var pos = inputs[| 1].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori); inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -67,11 +67,13 @@ function Node_Frame(_x, _y) : Node(_x, _y) constructor {
active_draw_index = -1; active_draw_index = -1;
} }
var _re_x = (x + w - 4) * _s + _x; var x1 = xx + w * _s;
var _re_y = (y + h - 4) * _s + _y; var y1 = yy + h * _s;
draw_sprite_ext(THEME.node_resize, 0, _re_x, _re_y, 1, 1, 0, c_white, 0.5); var x0 = xx + w * _s - 16 * _s;
if(!name_hover && point_in_rectangle(_mx, _my, _re_x - 16 * _s, _re_y - 16 * _s, _re_x + 4 * _s, _re_y + 4 * _s)) { var y0 = yy + h * _s - 16 * _s;
draw_sprite_ext(THEME.node_resize, 0, _re_x, _re_y, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.node_resize, 0, x1 - 4 * _s, y1 - 4 * _s, 1, 1, 0, c_white, 0.5);
if(!name_hover && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) {
draw_sprite_ext(THEME.node_resize, 0, x1 - 4 * _s, y1 - 4 * _s, 1, 1, 0, c_white, 1);
PANEL_GRAPH.drag_locking = true; PANEL_GRAPH.drag_locking = true;
if(mouse_press(mb_left)) { if(mouse_press(mb_left)) {
@ -86,17 +88,18 @@ function Node_Frame(_x, _y) : Node(_x, _y) constructor {
} }
static pointIn = function(_x, _y, _mx, _my, _s) { static pointIn = function(_x, _y, _mx, _my, _s) {
var xx = x * _s + _x; var xx = x * _s + _x + w * _s;
var yy = y * _s + _y; var yy = y * _s + _y + h * _s;
draw_set_font(f_h5); draw_set_font(f_h5);
var ww = (string_width(name) + 16) / _s; var ww = (string_width(name) + 16) / _s;
var hh = (string_height(name) + 16) / _s; var hh = (string_height(name) + 16) / _s;
var _x0 = max(xx + 16, xx - ww); var _x0 = xx - ww;
var _y0 = max(yy + 16, yy - hh); var _y0 = yy - hh;
var hover = point_in_rectangle(_mx, _my, _x0, _y0, xx - 32, yy); var hover = point_in_rectangle(_mx, _my, _x0, _y0, xx, yy) && !point_in_rectangle(_mx, _my, xx - 16 * _s, yy - 16 * _s, xx, yy);
name_hover = hover; name_hover = hover;
//print(string(_my) + ", " + string(_y0));
return hover; return hover;
} }

View file

@ -52,8 +52,8 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor {
["Shape", false], 2, 3, 4, 6 ["Shape", false], 2, 3, 4, 6
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 6].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 6].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -54,8 +54,8 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -76,6 +76,8 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
case VALUE_DISPLAY.slider_range : case VALUE_DISPLAY.slider_range :
inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]);
break;
case VALUE_DISPLAY.rotation_range : case VALUE_DISPLAY.rotation_range :
if(!is_array(_val) || array_length(_val) != 2) if(!is_array(_val) || array_length(_val) != 2)
inParent.animator = new valueAnimator([0, 0], inParent); inParent.animator = new valueAnimator([0, 0], inParent);
@ -130,10 +132,9 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
break; break;
} }
if(index == 5) { if(index == 5)
group.sortIO(); group.sortIO();
} }
}
static createInput = function(override_order = true) { static createInput = function(override_order = true) {
if(group == noone || !is_struct(group)) return noone; if(group == noone || !is_struct(group)) return noone;

View file

@ -119,7 +119,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
return [_y, _x]; return [_y, _x];
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(inputs[| 0].value_from == noone) return; if(inputs[| 0].value_from == noone) return;
var _inSurf = inputs[| 0].getValue(); var _inSurf = inputs[| 0].getValue();
@ -200,7 +200,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
draw_line_width(fr_x1, 0, fr_x1, room_height, 1); draw_line_width(fr_x1, 0, fr_x1, room_height, 1);
draw_line_width(0, fr_y1, room_width, fr_y1, 1); draw_line_width(0, fr_y1, room_width, fr_y1, 1);
if(mouse_release(mb_left)) { if(mouse_release(mb_left, active)) {
bound_drag = 0; bound_drag = 0;
if(row && col) { if(row && col) {
@ -210,7 +210,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
inputs[| 4].setValue([ bound_sx + _off[0], bound_sy + _off[1]]); inputs[| 4].setValue([ bound_sx + _off[0], bound_sy + _off[1]]);
} }
} }
} else if(mouse_press(mb_left, _active)) { } else if(mouse_press(mb_left, active)) {
bound_drag = 1; bound_drag = 1;
bound_sx = _ex; bound_sx = _ex;
bound_sy = _ey; bound_sy = _ey;

View file

@ -1,3 +1,9 @@
enum ITERATION_STATUS {
not_ready,
loop,
complete,
}
function Node_create_Iterate(_x, _y) { function Node_create_Iterate(_x, _y) {
var node = new Node_Iterate(_x, _y); var node = new Node_Iterate(_x, _y);
ds_list_add(PANEL_GRAPH.nodes_list, node); ds_list_add(PANEL_GRAPH.nodes_list, node);
@ -16,15 +22,14 @@ function Node_Iterate(_x, _y) : Node_Collection(_x, _y) constructor {
custom_input_index = 1; custom_input_index = 1;
loop_start_time = 0; loop_start_time = 0;
static setRenderStatus = function(result) { static postSetRenderStatus = function(result) {
rendered = result; if(rendered) return;
if(!rendered) {
iterated = 0; iterated = 0;
loop_start_time = get_timer(); loop_start_time = get_timer();
} }
}
static outputRendered = function() { static iterationStatus = function() {
var iter = true; var iter = true;
for( var i = 0; i < ds_list_size(outputs); i++ ) { for( var i = 0; i < ds_list_size(outputs); i++ ) {
var _out = outputs[| i].node; var _out = outputs[| i].node;
@ -34,14 +39,14 @@ function Node_Iterate(_x, _y) : Node_Collection(_x, _y) constructor {
if(iter) { if(iter) {
if(++iterated == inputs[| 0].getValue()) { if(++iterated == inputs[| 0].getValue()) {
render_time = get_timer() - loop_start_time; render_time = get_timer() - loop_start_time;
return 2; return ITERATION_STATUS.complete;
} else if(iterated > inputs[| 0].getValue()) } else if(iterated > inputs[| 0].getValue())
return 3; return ITERATION_STATUS.complete;
resetRenderStatus(); resetRenderStatus();
return 1; return ITERATION_STATUS.loop;
} }
return 0; return ITERATION_STATUS.not_ready;
} }
} }

View file

@ -100,6 +100,8 @@ function Node_Iterator_Input(_x, _y, _group) : Node(_x, _y) constructor {
case VALUE_DISPLAY.slider_range : case VALUE_DISPLAY.slider_range :
inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]); inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]);
break;
case VALUE_DISPLAY.rotation_range : case VALUE_DISPLAY.rotation_range :
if(!is_array(_val) || array_length(_val) != 2) if(!is_array(_val) || array_length(_val) != 2)
inParent.animator = new valueAnimator([0, 0], inParent); inParent.animator = new valueAnimator([0, 0], inParent);

View file

@ -78,9 +78,9 @@ function valueAnimator(_val, _prop) constructor {
if(prop.display_type == VALUE_DISPLAY.gradient) return processType(values); if(prop.display_type == VALUE_DISPLAY.gradient) return processType(values);
if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value); if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value);
if(!is_anim) return processType(values[| 0].value);
if(ds_list_size(values) == 0) return processType(0); if(ds_list_size(values) == 0) return processType(0);
if(ds_list_size(values) == 1) return processType(values[| 0].value); if(ds_list_size(values) == 1) return processType(values[| 0].value);
if(!is_anim) return processType(values[| 0].value);
if(ds_list_size(values) > 1) { if(ds_list_size(values) > 1) {
var _time_first = values[| 0].time; var _time_first = values[| 0].time;
@ -274,6 +274,7 @@ function valueAnimator(_val, _prop) constructor {
static deserialize = function(_list, scale = false) { static deserialize = function(_list, scale = false) {
var base = getValue(); var base = getValue();
ds_list_clear(values); ds_list_clear(values);
for(var i = 0; i < ds_list_size(_list); i++) { for(var i = 0; i < ds_list_size(_list); i++) {
var _key = _list[| i]; var _key = _list[| i];
var _time = _key[| 0]; var _time = _key[| 0];

View file

@ -39,18 +39,18 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
inputs[| 10] = nodeValue(10, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white) inputs[| 10] = nodeValue(10, "Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white)
.setDisplay(VALUE_DISPLAY.gradient); .setDisplay(VALUE_DISPLAY.gradient);
inputs[| 11] = nodeValue(11, "Width over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, [1, 1, 1, 1]);
input_display_list = [ input_display_list = [
["Output", true], 0, 1, ["Output", true], 0, 1,
["Line data", false], 6, 7, 2, ["Line data", false], 6, 7, 2,
["Line settings", false], 3, 8, 9, ["Line settings", false], 3, 11, 8, 9,
["Wiggle", false], 4, 5, ["Wiggle", false], 4, 5,
["Render", false], 10 ["Render", false], 10
]; ];
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
display_reset(0, 1);
static update = function() { static update = function() {
var _dim = inputs[| 0].getValue(); var _dim = inputs[| 0].getValue();
var _bg = inputs[| 1].getValue(); var _bg = inputs[| 1].getValue();
@ -65,9 +65,10 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
var _color = inputs[| 10].getValue(); var _color = inputs[| 10].getValue();
var _col_data = inputs[| 10].getExtraData(); var _col_data = inputs[| 10].getExtraData();
var _widc = inputs[| 11].getValue();
var _rat = max(_ratio[0], _ratio[1]) - min(_ratio[0], _ratio[1]); var _rtStr = min(_ratio[0], _ratio[1]);
var _rats = min(_ratio[0], _ratio[1]); var _rtLen = max(_ratio[0], _ratio[1]) - _rtStr;
var _use_path = _pat != 0 && instanceof(_pat) == "Node_Path"; var _use_path = _pat != 0 && instanceof(_pat) == "Node_Path";
if(_ang < 0) _ang = 360 + _ang; if(_ang < 0) _ang = 360 + _ang;
@ -94,10 +95,10 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
var _ox, _nx, _oy, _ny, _ow, _nw, _oa, _na; var _ox, _nx, _oy, _ny, _ow, _nw, _oa, _na;
if(_use_path) { if(_use_path) {
var ww = _rat / _seg; var ww = _rtLen / _seg;
var _total = _rat; var _total = _rtLen;
var _prog_curr = frac(_shift + _rats) - ww; var _prog_curr = frac(_shift + _rtStr) - ww;
var _prog = _prog_curr + 1; var _prog = _prog_curr + 1;
var _prog_eli = 0; var _prog_eli = 0;
@ -110,13 +111,14 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
_nx = p[0]; _nx = p[0];
_ny = p[1]; _ny = p[1];
if(_total < _rat) { if(_total < _rtLen) {
var _d = point_direction(_ox, _oy, _nx, _ny); var _d = point_direction(_ox, _oy, _nx, _ny);
_nx += lengthdir_x(random(_wig) * choose(-1, 1), _d + 90); _nx += lengthdir_x(random(_wig) * choose(-1, 1), _d + 90);
_ny += lengthdir_y(random(_wig) * choose(-1, 1), _d + 90); _ny += lengthdir_y(random(_wig) * choose(-1, 1), _d + 90);
} }
_nw = random_range(_wid[0], _wid[1]); _nw = random_range(_wid[0], _wid[1]);
_nw *= eval_bezier_cubic(1 - _prog_curr, _widc[0], _widc[1], _widc[2], _widc[3]);
if(_total <= _prog_curr - _prog) { if(_total <= _prog_curr - _prog) {
_na = point_direction(_ox, _oy, _nx, _ny) + 90; _na = point_direction(_ox, _oy, _nx, _ny) + 90;
@ -124,7 +126,7 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
var np = _pat.getPointRatio(_prog_curr + ww); var np = _pat.getPointRatio(_prog_curr + ww);
var _nna = point_direction(_nx, _ny, np[0], np[1]) + 90; var _nna = point_direction(_nx, _ny, np[0], np[1]) + 90;
if(_total == _rat) if(_total == _rtLen)
_na = _nna; _na = _nna;
else { else {
var _da = point_direction(_ox, _oy, _nx, _ny) + 90; var _da = point_direction(_ox, _oy, _nx, _ny) + 90;
@ -133,7 +135,7 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
} }
if(_prog_curr > _prog) { if(_prog_curr > _prog) {
draw_set_color(gradient_eval(_color, _prog_eli / _rat, ds_list_get(_col_data, 0))); draw_set_color(gradient_eval(_color, _prog_eli / _rtLen, ds_list_get(_col_data, 0)));
draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _oa, _na); draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _oa, _na);
_total -= (_prog_curr - _prog); _total -= (_prog_curr - _prog);
} }
@ -156,9 +158,9 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
var _l = point_distance(x0, y0, x1, y1); var _l = point_distance(x0, y0, x1, y1);
var _d = point_direction(x0, y0, x1, y1); var _d = point_direction(x0, y0, x1, y1);
var ww = _rat / _seg; var ww = _rtLen / _seg;
var _total = _rat; var _total = _rtLen;
var _prog_curr = frac(_shift + _rats) - ww; var _prog_curr = frac(_shift + _rtStr) - ww;
var _prog = _prog_curr + 1; var _prog = _prog_curr + 1;
var _prog_eli = 0; var _prog_eli = 0;
@ -174,9 +176,10 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
_ny += lengthdir_y(random(_wig) * choose(-1, 1), _d + 90); _ny += lengthdir_y(random(_wig) * choose(-1, 1), _d + 90);
_nw = random_range(_wid[0], _wid[1]); _nw = random_range(_wid[0], _wid[1]);
_nw *= eval_bezier_cubic(1 - _prog_curr, _widc[0], _widc[1], _widc[2], _widc[3]);
if(_prog_curr > _prog) { if(_prog_curr > _prog) {
draw_set_color(gradient_eval(_color, _prog_eli / _rat, ds_list_get(_col_data, 0))); draw_set_color(gradient_eval(_color, _prog_eli / _rtLen, ds_list_get(_col_data, 0)));
draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _d + 90, _d + 90); draw_line_width2_angle(_ox, _oy, _nx, _ny, _ow, _nw, _d + 90, _d + 90);
_total -= (_prog_curr - _prog); _total -= (_prog_curr - _prog);
} }

View file

@ -69,9 +69,9 @@ function Node_Math(_x, _y) : Node(_x, _y) constructor {
case MATH_OPERATOR.add : return a + b; case MATH_OPERATOR.add : return a + b;
case MATH_OPERATOR.subtract : return a - b; case MATH_OPERATOR.subtract : return a - b;
case MATH_OPERATOR.multiply : return a * b; case MATH_OPERATOR.multiply : return a * b;
case MATH_OPERATOR.divide : return a / b; case MATH_OPERATOR.divide : return b == 0? 0 : a / b;
case MATH_OPERATOR.power : return power(a, b); case MATH_OPERATOR.power : return power(a, b);
case MATH_OPERATOR.root : return power(a, 1 / b); case MATH_OPERATOR.root : return b == 0? 0 : power(a, 1 / b);
case MATH_OPERATOR.sin : return sin(degtorad(a)) * b; case MATH_OPERATOR.sin : return sin(degtorad(a)) * b;
case MATH_OPERATOR.cos : return cos(degtorad(a)) * b; case MATH_OPERATOR.cos : return cos(degtorad(a)) * b;

View file

@ -20,7 +20,7 @@ function Node_Mirror(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _pos = inputs[| 1].getValue(); var _pos = inputs[| 1].getValue();
var _ang = inputs[| 2].getValue(); var _ang = inputs[| 2].getValue();
var _posx = _pos[0] * _s + _x; var _posx = _pos[0] * _s + _x;
@ -34,8 +34,8 @@ function Node_Mirror(_x, _y) : Node_Processor(_x, _y) constructor {
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
draw_line(dx0, dy0, dx1, dy1); draw_line(dx0, dy0, dx1, dy1);
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 2].drawOverlay(_active, _posx, _posy, _s, _mx, _my); inputs[| 2].drawOverlay(active, _posx, _posy, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "generator",
"path": "folders/nodes/data/generator.yy",
},
"resourceVersion": "1.0",
"name": "node_gradient",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,45 @@
function Node_create_Noise(_x, _y) {
var node = new Node_Noise(_x, _y);
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
}
function Node_Noise(_x, _y) : Node(_x, _y) constructor {
name = "Noise";
shader = sh_noise;
uniform_sed = shader_get_uniform(shader, "seed");
inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue(1, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(99999));
input_display_list = [
["Output", false], 0,
["Noise", false], 1,
];
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static update = function() {
var _dim = inputs[| 0].getValue();
var _sed = inputs[| 1].getValue();
var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) {
_outSurf = surface_create_valid(_dim[0], _dim[1]);
outputs[| 0].setValue(_outSurf);
} else
surface_size_to(_outSurf, _dim[0], _dim[1]);
surface_set_target(_outSurf);
shader_set(shader);
shader_set_uniform_f(uniform_sed, _sed);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();
}
doUpdate();
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_noise",
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "generator",
"path": "folders/nodes/data/generator.yy",
},
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "generator",
"path": "folders/nodes/data/generator.yy",
},
"resourceVersion": "1.0",
"name": "node_perlin",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -30,8 +30,8 @@ function Node_Noise_Aniso(_x, _y) : Node(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -44,8 +44,8 @@ function Node_Cellular(_x, _y) : Node(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -40,8 +40,8 @@ function Node_Grid_Noise(_x, _y) : Node(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -40,13 +40,13 @@ function Node_Normal_Light(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 4].getValue(); var pos = inputs[| 4].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 5].drawOverlay(active, px, py, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -514,10 +514,10 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
} }
} }
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
if(onDrawOverlay != -1) if(onDrawOverlay != -1)
onDrawOverlay(_active, _x, _y, _s, _mx, _my); onDrawOverlay(active, _x, _y, _s, _mx, _my);
} }
static onDrawOverlay = -1; static onDrawOverlay = -1;

View file

@ -61,8 +61,8 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
current_data = []; current_data = [];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
var parts = inputs[| 0].getValue(); var parts = inputs[| 0].getValue();
if(!parts) return; if(!parts) return;

View file

@ -32,7 +32,9 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
tools = [ tools = [
[ "Anchor add / remove (ctrl)", THEME.path_tools_add ], [ "Anchor add / remove (ctrl)", THEME.path_tools_add ],
[ "Edit Control point (shift)", THEME.path_tools_anchor ] [ "Edit Control point (shift)", THEME.path_tools_anchor ],
[ "Rectangle path", THEME.path_tools_rectangle ],
[ "Circle path", THEME.path_tools_circle ],
]; ];
lengths = []; lengths = [];
@ -45,7 +47,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
drag_point_sx = 0; drag_point_sx = 0;
drag_point_sy = 0; drag_point_sy = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var sample = PREF_MAP[? "path_resolution"]; var sample = PREF_MAP[? "path_resolution"];
var loop = inputs[| 1].getValue(); var loop = inputs[| 1].getValue();
var ansize = ds_list_size(inputs) - list_start; var ansize = ds_list_size(inputs) - list_start;
@ -54,6 +56,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
var dx = drag_point_sx + (_mx - drag_point_mx) / _s; var dx = drag_point_sx + (_mx - drag_point_mx) / _s;
var dy = drag_point_sy + (_my - drag_point_my) / _s; var dy = drag_point_sy + (_my - drag_point_my) / _s;
if(drag_type < 2) {
var inp = inputs[| list_start + drag_point]; var inp = inputs[| list_start + drag_point];
var anc = inp.getValue(); var anc = inp.getValue();
if(drag_type == 0) { if(drag_type == 0) {
@ -88,6 +91,73 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
} }
inp.setValue(anc); inp.setValue(anc);
} else if(drag_type == 2) {
var minx = min((_mx - _x) / _s, (drag_point_mx - _x) / _s);
var maxx = max((_mx - _x) / _s, (drag_point_mx - _x) / _s);
var miny = min((_my - _y) / _s, (drag_point_my - _y) / _s);
var maxy = max((_my - _y) / _s, (drag_point_my - _y) / _s);
var a = [];
for( var i = 0; i < 4; i++ )
a[i] = inputs[| list_start + i].getValue();
a[0][0] = minx;
a[0][1] = miny;
a[1][0] = maxx;
a[1][1] = miny;
a[2][0] = maxx;
a[2][1] = maxy;
a[3][0] = minx;
a[3][1] = maxy;
for( var i = 0; i < 4; i++ )
inputs[| list_start + i].setValue(a[i]);
} else if(drag_type == 3) {
var minx = min((_mx - _x) / _s, (drag_point_mx - _x) / _s);
var maxx = max((_mx - _x) / _s, (drag_point_mx - _x) / _s);
var miny = min((_my - _y) / _s, (drag_point_my - _y) / _s);
var maxy = max((_my - _y) / _s, (drag_point_my - _y) / _s);
var a = [];
for( var i = 0; i < 4; i++ )
a[i] = inputs[| list_start + i].getValue();
a[0][0] = (minx + maxx) / 2;
a[0][1] = miny;
a[0][2] = -(maxx - minx) * 0.27614;
a[0][3] = 0;
a[0][4] = (maxx - minx) * 0.27614;
a[0][5] = 0;
a[1][0] = maxx;
a[1][1] = (miny + maxy) / 2;
a[1][2] = 0;
a[1][3] = -(maxy - miny) * 0.27614;
a[1][4] = 0;
a[1][5] = (maxy - miny) * 0.27614;
a[2][0] = (minx + maxx) / 2;
a[2][1] = maxy;
a[2][2] = (maxx - minx) * 0.27614;
a[2][3] = 0;
a[2][4] = -(maxx - minx) * 0.27614;
a[2][5] = 0;
a[3][0] = minx;
a[3][1] = (miny + maxy) / 2;
a[3][2] = 0;
a[3][3] = (maxy - miny) * 0.27614;
a[3][4] = 0;
a[3][5] = -(maxy - miny) * 0.27614;
for( var i = 0; i < 4; i++ )
inputs[| list_start + i].setValue(a[i]);
}
if(mouse_release(mb_left)) if(mouse_release(mb_left))
drag_point = -1; drag_point = -1;
} }
@ -168,7 +238,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
if(keyboard_check(vk_shift) || PANEL_PREVIEW.tool_index == 1) { if(keyboard_check(vk_shift) || PANEL_PREVIEW.tool_index == 1) {
draw_sprite_ui_uniform(THEME.cursor_path_anchor, 0, _mx + 16, _my + 16); draw_sprite_ui_uniform(THEME.cursor_path_anchor, 0, _mx + 16, _my + 16);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
if(_a[2] != 0 || _a[3] != 0 || _a[4] != 0 || _a[5] != 0) { if(_a[2] != 0 || _a[3] != 0 || _a[4] != 0 || _a[5] != 0) {
_a[2] = 0; _a[2] = 0;
_a[3] = 0; _a[3] = 0;
@ -192,14 +262,14 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
} else if(keyboard_check(vk_control) || PANEL_PREVIEW.tool_index == 0) { } else if(keyboard_check(vk_control) || PANEL_PREVIEW.tool_index == 0) {
draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16); draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
ds_list_delete(inputs, list_start + anchor_hover); ds_list_delete(inputs, list_start + anchor_hover);
doUpdate(); doUpdate();
} }
} else { } else {
draw_sprite_ui_uniform(THEME.cursor_path_move, 0, _mx + 16, _my + 16); draw_sprite_ui_uniform(THEME.cursor_path_move, 0, _mx + 16, _my + 16);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_point = anchor_hover; drag_point = anchor_hover;
drag_type = hover_type; drag_type = hover_type;
drag_point_mx = _mx; drag_point_mx = _mx;
@ -219,7 +289,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
} else if(keyboard_check(vk_control) || PANEL_PREVIEW.tool_index == 0) { } else if(keyboard_check(vk_control) || PANEL_PREVIEW.tool_index == 0) {
draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16); draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_point = ds_list_size(inputs) - list_start; drag_point = ds_list_size(inputs) - list_start;
createAnchor((_mx - _x) / _s, (_my - _y) / _s); createAnchor((_mx - _x) / _s, (_my - _y) / _s);
@ -229,6 +299,22 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
drag_point_sx = (_mx - _x) / _s; drag_point_sx = (_mx - _x) / _s;
drag_point_sy = (_my - _y) / _s; drag_point_sy = (_my - _y) / _s;
} }
} else if(PANEL_PREVIEW.tool_index >= 2) {
draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16);
if(mouse_press(mb_left, active)) {
while(ds_list_size(inputs) > list_start)
ds_list_delete(inputs, list_start);
drag_point = 0;
drag_type = PANEL_PREVIEW.tool_index;
drag_point_mx = _mx;
drag_point_my = _my;
inputs[| 1].setValue(true);
repeat(4)
createAnchor((_mx - _x) / _s, (_my - _y) / _s);
}
} }
} }

View file

@ -133,9 +133,10 @@ function NodeObject(_name, _spr, _create, tags = []) constructor {
addNodeObject(threeD, "Normal light", s_node_normal_light, "Node_Normal_Light", Node_create_Normal_Light); addNodeObject(threeD, "Normal light", s_node_normal_light, "Node_Normal_Light", Node_create_Normal_Light);
addNodeObject(threeD, "Bevel", s_node_bevel, "Node_Bevel", Node_create_Bevel); addNodeObject(threeD, "Bevel", s_node_bevel, "Node_Bevel", Node_create_Bevel);
addNodeObject(threeD, "Sprite stack", s_node_stack, "Node_Sprite_Stack", Node_create_Sprite_Stack); addNodeObject(threeD, "Sprite stack", s_node_stack, "Node_Sprite_Stack", Node_create_Sprite_Stack);
addNodeObject(threeD, "3D Obj", s_node_3d_obj, "Node_3D_Obj", Node_create_3D_Obj);
addNodeObject(threeD, "3D Cube", s_node_3d_cube, "Node_3D_Cube", Node_create_3D_Cube); addNodeObject(threeD, "3D Cube", s_node_3d_cube, "Node_3D_Cube", Node_create_3D_Cube);
addNodeObject(threeD, "3D Cylinder", s_node_3d_cylinder, "Node_3D_Cylinder", Node_create_3D_Cylinder); addNodeObject(threeD, "3D Cylinder", s_node_3d_cylinder, "Node_3D_Cylinder", Node_create_3D_Cylinder);
addNodeObject(threeD, "3D Obj", s_node_3d_obj, "Node_3D_Obj", Node_create_3D_Obj); addNodeObject(threeD, "3D Extrude", s_node_3d_extrude, "Node_3D_Extrude", Node_create_3D_Extrude);
var number = ds_list_create(); var number = ds_list_create();
addNodeCatagory("Number", number); addNodeCatagory("Number", number);
@ -182,6 +183,7 @@ function NodeObject(_name, _spr, _create, tags = []) constructor {
addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", Node_create_Particle); addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", Node_create_Particle);
addNodeObject(generator, "Particle Effector", s_node_particle_effector, "Node_Particle_Effector", Node_create_Particle_Effector, ["affector"]); addNodeObject(generator, "Particle Effector", s_node_particle_effector, "Node_Particle_Effector", Node_create_Particle_Effector, ["affector"]);
addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", Node_create_Scatter); addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", Node_create_Scatter);
addNodeObject(generator, "Noise", s_node_noise, "Node_Noise", Node_create_Noise);
addNodeObject(generator, "Perlin noise", s_node_noise_perlin, "Node_Perlin", Node_create_Perlin); addNodeObject(generator, "Perlin noise", s_node_noise_perlin, "Node_Perlin", Node_create_Perlin);
addNodeObject(generator, "Cellular noise", s_node_noise_cell, "Node_Cellular", Node_create_Cellular); addNodeObject(generator, "Cellular noise", s_node_noise_cell, "Node_Cellular", Node_create_Cellular);
addNodeObject(generator, "Grid noise", s_node_grid_noise, "Node_Grid_Noise", Node_create_Grid_Noise); addNodeObject(generator, "Grid noise", s_node_grid_noise, "Node_Grid_Noise", Node_create_Grid_Noise);

View file

@ -50,8 +50,8 @@ function Node_Scatter(_x, _y) : Node(_x, _y) constructor {
temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ]; temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 5].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -6,7 +6,7 @@ function Node_create_Seperate_Shape(_x, _y) {
function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor { function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
name = "Separate shape"; name = "Separate shape";
//auto_update = false; auto_update = false;
uniform_it_dim = shader_get_uniform(sh_seperate_shape_ite, "dimension"); uniform_it_dim = shader_get_uniform(sh_seperate_shape_ite, "dimension");

View file

@ -28,7 +28,7 @@ function Node_Shadow(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _surf = outputs[| 0].getValue(); var _surf = outputs[| 0].getValue();
if(is_array(_surf)) { if(is_array(_surf)) {
if(array_length(_surf) == 0) return; if(array_length(_surf) == 0) return;
@ -38,7 +38,7 @@ function Node_Shadow(_x, _y) : Node_Processor(_x, _y) constructor {
var ww = surface_get_width(_surf) * _s; var ww = surface_get_width(_surf) * _s;
var hh = surface_get_height(_surf) * _s; var hh = surface_get_height(_surf) * _s;
inputs[| 3].drawOverlay(_active, _x + ww / 2, _y + hh / 2, _s, _mx, _my); inputs[| 3].drawOverlay(active, _x + ww / 2, _y + hh / 2, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -28,6 +28,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
uniform_aa = shader_get_uniform(shader, "aa"); uniform_aa = shader_get_uniform(shader, "aa");
uniform_dim = shader_get_uniform(shader, "dimension"); uniform_dim = shader_get_uniform(shader, "dimension");
uniform_bgCol = shader_get_uniform(shader, "bgColor"); uniform_bgCol = shader_get_uniform(shader, "bgColor");
uniform_drawDF = shader_get_uniform(shader, "drawDF");
inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 ) inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
@ -62,16 +63,18 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
inputs[| 11] = nodeValue(11, "Background color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); inputs[| 11] = nodeValue(11, "Background color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);
inputs[| 12] = nodeValue(12, "Distance field", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
input_display_list = [ input_display_list = [
["Surface", false], 0, 6, ["Surface", false], 0, 6,
["Shape", false], 2, 3, 9, 4, 5, 7, 8, ["Shape", false], 2, 3, 9, 4, 5, 7, 8,
["Render", true], 10, 1, 11 ["Render", true], 10, 1, 11, 12
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {
@ -82,6 +85,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
var _aa = _data[6]; var _aa = _data[6];
var _corner = _data[9]; var _corner = _data[9];
var _color = _data[10]; var _color = _data[10];
var _df = _data[12];
var _bgcol = _bg? colToVec4(_data[11]) : [0, 0, 0, 0]; var _bgcol = _bg? colToVec4(_data[11]) : [0, 0, 0, 0];
inputs[| 11].setVisible(_bg); inputs[| 11].setVisible(_bg);
@ -154,6 +158,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
shader_set_uniform_i(uniform_shape, _shape); shader_set_uniform_i(uniform_shape, _shape);
shader_set_uniform_f_array(uniform_bgCol, _bgcol); shader_set_uniform_f_array(uniform_bgCol, _bgcol);
shader_set_uniform_i(uniform_aa, _aa); shader_set_uniform_i(uniform_aa, _aa);
shader_set_uniform_i(uniform_drawDF, _df);
shader_set_uniform_f(uniform_corner, _corner); shader_set_uniform_f(uniform_corner, _corner);
shader_set_uniform_f_array(uniform_cent, [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]); shader_set_uniform_f_array(uniform_cent, [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]);

View file

@ -36,13 +36,13 @@ function Node_Sprite_Stack(_x, _y) : Node(_x, _y) constructor {
["Render", false], 6, 7, ["Render", false], 6, 7,
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 4].getValue(); var pos = inputs[| 4].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 5].drawOverlay(active, px, py, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -50,13 +50,13 @@ function Node_Stripe(_x, _y) : Node(_x, _y) constructor {
["Render", false], 3, 6, 7 ["Render", false], 3, 6, 7
]; ];
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 4].getValue(); var pos = inputs[| 4].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my); inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my);
} }
static update = function() { static update = function() {

View file

@ -149,6 +149,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
var ww = surface_get_width(ins); var ww = surface_get_width(ins);
var hh = surface_get_height(ins); var hh = surface_get_height(ins);
var _ww = ww, _hh = hh; var _ww = ww, _hh = hh;
if(_ww <= 1 && _hh <= 1) return _outSurf;
switch(out_type) { switch(out_type) {
case OUTPUT_SCALING.same_as_input : case OUTPUT_SCALING.same_as_input :
@ -249,7 +250,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
overlay_drag_ma = 0; overlay_drag_ma = 0;
overlay_drag_sa = 0; overlay_drag_sa = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(array_length(current_data) < ds_list_size(inputs)) return; if(array_length(current_data) < ds_list_size(inputs)) return;
var _surf = inputs[| 0].getValue(); var _surf = inputs[| 0].getValue();
@ -424,7 +425,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} else { } else {
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
if(point_in_circle(_mx, _my, bax, bay, 8)) { if(point_in_circle(_mx, _my, bax, bay, 8)) {
overlay_dragging = 2; overlay_dragging = 2;
overlay_drag_mx = _mx; overlay_drag_mx = _mx;

View file

@ -53,7 +53,7 @@ function Node_Transform_Single(_x, _y) : Node_Processor(_x, _y) constructor {
overlay_drag_ma = 0; overlay_drag_ma = 0;
overlay_drag_sa = 0; overlay_drag_sa = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
if(array_length(current_data) < ds_list_size(inputs)) return; if(array_length(current_data) < ds_list_size(inputs)) return;
var _surf = outputs[| 0].getValue(); var _surf = outputs[| 0].getValue();
@ -154,7 +154,7 @@ function Node_Transform_Single(_x, _y) : Node_Processor(_x, _y) constructor {
if(mouse_release(mb_left)) if(mouse_release(mb_left))
overlay_dragging = 0; overlay_dragging = 0;
} else { } else {
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
if(point_in_circle(_mx, _my, bax, bay, 8)) { if(point_in_circle(_mx, _my, bax, bay, 8)) {
overlay_dragging = 2; overlay_dragging = 2;
overlay_drag_mx = _mx; overlay_drag_mx = _mx;

View file

@ -23,13 +23,13 @@ function Node_Twirl(_x, _y) : Node_Processor(_x, _y) constructor {
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE); outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var pos = inputs[| 1].getValue(); var pos = inputs[| 1].getValue();
var px = _x + pos[0] * _s; var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s; var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my); inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori); inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori);
} }
static process_data = function(_outSurf, _data, _output_index) { static process_data = function(_outSurf, _data, _output_index) {

View file

@ -368,8 +368,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
case VALUE_TYPE.curve : case VALUE_TYPE.curve :
visible = false; visible = false;
display_type = VALUE_DISPLAY.curve; display_type = VALUE_DISPLAY.curve;
editWidget = new curveBox( editWidget = new curveBox(function(_modified) { setValue(_modified); });
function(_modified) { setValue(_modified); });
break; break;
case VALUE_TYPE.text : case VALUE_TYPE.text :
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
@ -490,9 +489,9 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
static __anim = function() { static __anim = function() {
return animator.is_anim || node.update_on_frame; return animator.is_anim || node.update_on_frame;
} }
static isAnim = function() { static isAnimated = function() {
if(value_from == noone) return __anim(); if(value_from == noone) return __anim();
else return value_from.isAnim() || value_from.__anim(); else return value_from.isAnimated() || value_from.__anim();
} }
static showValue = function() { static showValue = function() {
@ -598,8 +597,11 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
//show_debug_message("connected " + name + " to " + _valueFrom.name) //show_debug_message("connected " + name + " to " + _valueFrom.name)
node.onValueUpdate(index, _o); node.onValueUpdate(index, _o);
if(_update) node.updateValueFrom(index); if(_update) {
if(_update && node.auto_update) _valueFrom.node.triggerRender(); node.updateValueFrom(index);
node.triggerRender();
if(node.use_cache) node.clearCache();
}
MODIFIED = true; MODIFIED = true;
return true; return true;
@ -679,7 +681,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
drag_my = 0; drag_my = 0;
drag_sx = 0; drag_sx = 0;
drag_sy = 0; drag_sy = 0;
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) { static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _val = getValue(); var _val = getValue();
var hover = -1; var hover = -1;
@ -717,7 +719,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
if(point_in_circle(_mx, _my, _ax, _ay, 8)) { if(point_in_circle(_mx, _my, _ax, _ay, 8)) {
hover = 1; hover = 1;
index = 1; index = 1;
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_type = 1; drag_type = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -764,7 +766,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
hover = 1; hover = 1;
draw_sprite_ui(THEME.anchor_rotate, 1, _ax, _ay, 1, 1, _val - 90, c_white, 1); draw_sprite_ui(THEME.anchor_rotate, 1, _ax, _ay, 1, 1, _val - 90, c_white, 1);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_type = 1; drag_type = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -810,7 +812,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
if(point_in_circle(_mx, _my, _ax, _ay, 8)) { if(point_in_circle(_mx, _my, _ax, _ay, 8)) {
hover = 1; hover = 1;
draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay); draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_type = 1; drag_type = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -890,7 +892,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
} }
} }
if(_active) { if(active) {
if(point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8)) { if(point_in_circle(_mx, _my, _ax + _aw, _ay + _ah, 8)) {
hover = 2; hover = 2;
if(mouse_press(mb_left)) { if(mouse_press(mb_left)) {
@ -1007,7 +1009,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
if(point_in_circle(_mx, _my, _ax, _ay, 8)) { if(point_in_circle(_mx, _my, _ax, _ay, 8)) {
hover = 1; hover = 1;
draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay); draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_type = 1; drag_type = 1;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;
@ -1019,7 +1021,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
if(_val[PUPPET_CONTROL.mode] == PUPPET_FORCE_MODE.move && point_in_circle(_mx, _my, _ax1, _ay1, 8)) { if(_val[PUPPET_CONTROL.mode] == PUPPET_FORCE_MODE.move && point_in_circle(_mx, _my, _ax1, _ay1, 8)) {
hover = 2; hover = 2;
draw_sprite_ui_uniform(THEME.anchor_selector, 0, _ax1, _ay1); draw_sprite_ui_uniform(THEME.anchor_selector, 0, _ax1, _ay1);
if(_mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
drag_type = 2; drag_type = 2;
drag_mx = _mx; drag_mx = _mx;
drag_my = _my; drag_my = _my;

View file

@ -15,8 +15,8 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
inputs[| 0] = nodeValue(0, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) inputs[| 0] = nodeValue(0, "Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue(1, "Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 3, 5 ] ) inputs[| 1] = nodeValue(1, "Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 )
.setDisplay(VALUE_DISPLAY.slider_range, [1, 32, 1]); .setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]);
inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(9999999) ); inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(9999999) );
@ -37,34 +37,27 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
var fre = inputs[| 1].getValue(); var fre = inputs[| 1].getValue();
var sed = inputs[| 2].getValue(); var sed = inputs[| 2].getValue();
var _fmin = ANIMATOR.frames_total / max(1, min(fre[0], fre[1])); var step = ANIMATOR.frames_total / 64;
var _fmax = ANIMATOR.frames_total / max(1, max(fre[0], fre[1])); for( var i = 0; i < 64; i++ ) {
var _val; random_value[i] = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, step * i, sed, 0, ANIMATOR.frames_total);
for( var i = 0; i < ANIMATOR.frames_total + 1; i++ ) {
_val = getWiggle(ran[0], ran[1], _fmin, _fmax, i, sed);
random_value[i] = _val;
} }
} }
function process_value_data(_data, index = 0) { function process_value_data(_data, index = 0) {
if(array_length(random_value) != ANIMATOR.frames_total + 1) { var ran = inputs[| 0].getValue();
array_resize(random_value, ANIMATOR.frames_total + 1); var fre = inputs[| 1].getValue();
onValueUpdate(0); var sed = inputs[| 2].getValue();
}
var time = ANIMATOR.current_frame; var time = ANIMATOR.current_frame;
return random_value[time];
return getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, time, sed, 0, ANIMATOR.frames_total);
} }
doUpdate(); doUpdate();
static onDrawNode = function(xx, yy, _mx, _my, _s) { static onDrawNode = function(xx, yy, _mx, _my, _s) {
if(array_length(random_value) != ANIMATOR.frames_total + 1) { var ran = inputs[| 0].getValue();
array_resize(random_value, ANIMATOR.frames_total + 1); var fre = inputs[| 1].getValue();
onValueUpdate(0); var sed = inputs[| 2].getValue();
}
var disp = inputs[| 3].getValue(); var disp = inputs[| 3].getValue();
var time = ANIMATOR.current_frame; var time = ANIMATOR.current_frame;
var total_time = ANIMATOR.frames_total; var total_time = ANIMATOR.frames_total;
@ -73,7 +66,7 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
case 0 : case 0 :
min_h = 0; min_h = 0;
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 = string(random_value[time]); var str = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, time, sed, 0, ANIMATOR.frames_total);
var ss = string_scale(str, (w - 16) * _s, (h - 16) * _s - 20); var ss = string_scale(str, (w - 16) * _s, (h - 16) * _s - 20);
draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, str, ss, ss, 0); draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, str, ss, ss, 0);
break; break;
@ -81,16 +74,10 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
w = 128; w = 128;
min_h = 96; min_h = 96;
var ran = inputs[| 0].getValue();
var fre = inputs[| 1].getValue();
var sed = inputs[| 2].getValue();
var _min = ran[0]; var _min = ran[0];
var _max = ran[1]; var _max = ran[1];
var val = (_min + _max) / 2; var val = (_min + _max) / 2;
var _ran = _max - _min; var _ran = _max - _min;
var _fmin = max(1, fre[0]);
var _fmax = max(1, fre[1]);
var x0 = xx + 8 * _s; var x0 = xx + 8 * _s;
var x1 = xx + (w - 8) * _s; var x1 = xx + (w - 8) * _s;
@ -105,10 +92,10 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
var _fx = x0 + (time / total_time * ww); var _fx = x0 + (time / total_time * ww);
draw_line(_fx, y0, _fx, y1); draw_line(_fx, y0, _fx, y1);
var lw = ww / (array_length(random_value) - 1); var lw = ww / (64 - 1);
draw_set_color(COLORS.node_wiggler_line); draw_set_color(COLORS.node_wiggler_frame);
var ox, oy; var ox, oy;
for( var i = 0; i < array_length(random_value); i++ ) { for( var i = 0; i < 64; i++ ) {
var _x = x0 + i * lw; var _x = x0 + i * lw;
var _y = yc - (random_value[i] - val) / (_ran * 2) * hh; var _y = yc - (random_value[i] - val) / (_ran * 2) * hh;
if(i) if(i)

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