mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 11:28:06 +01:00
Extrude, 3D
This commit is contained in:
parent
e32ae83bb5
commit
e7c49a2d4f
147 changed files with 4121 additions and 2376 deletions
|
@ -14,7 +14,7 @@
|
|||
{"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":"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":"s_node_blend","path":"sprites/s_node_blend/s_node_blend.yy",},"order":7,},
|
||||
{"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":"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_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":"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,},
|
||||
|
@ -168,6 +169,7 @@
|
|||
{"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_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_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,},
|
||||
|
@ -175,6 +177,7 @@
|
|||
{"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_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":"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,},
|
||||
|
@ -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":"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","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":"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_palette","path":"scripts/node_palette/node_palette.yy",},"order":2,},
|
||||
{"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_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_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":"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,},
|
||||
|
@ -294,6 +301,7 @@
|
|||
{"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":"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":"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,},
|
||||
|
@ -302,6 +310,7 @@
|
|||
{"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":"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":"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,},
|
||||
|
@ -375,6 +384,7 @@
|
|||
{"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":"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_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,},
|
||||
|
@ -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_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_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":"FileDropper","path":"extensions/FileDropper/FileDropper.yy",},"order":4,},
|
||||
{"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":"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_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,},
|
||||
|
@ -404,6 +416,7 @@
|
|||
{"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":"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":"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,},
|
||||
|
@ -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_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":"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":"sh_displace","path":"shaders/sh_displace/sh_displace.yy",},"order":7,},
|
||||
{"id":{"name":"node_group","path":"scripts/node_group/node_group.yy",},"order":0,},
|
||||
|
@ -529,7 +543,12 @@
|
|||
"Folders": [
|
||||
{"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":"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":"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":"font","folderPath":"folders/font.yy","order":8,},
|
||||
{"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":"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":"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": [
|
||||
{"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-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.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_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",},
|
||||
|
@ -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":"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_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":"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":"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_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",},
|
||||
],
|
||||
"MetaData": {
|
||||
|
|
Binary file not shown.
|
@ -26,6 +26,7 @@
|
|||
"_main_text_title": "blue_ltgrey",
|
||||
"_main_text_sub": "blue_grey",
|
||||
"_main_icon": "blue_grey",
|
||||
"_main_icon_light": "blue_white",
|
||||
"_main_icon_dark": "blue_mdblack",
|
||||
"_main_value_positive": "lime",
|
||||
"_main_value_negative": "red",
|
||||
|
@ -42,6 +43,7 @@
|
|||
"dialog_preference_prop_bg": "blue_white",
|
||||
"dialog_add_node_collection": ["white", "orange", 0.5],
|
||||
"dialog_palette_divider": "blue_grey",
|
||||
"dialog_notification_bg_hover": "blue_ltgrey",
|
||||
"dialog_notification_bg": "blue_grey",
|
||||
"dialog_notification_icon_bg": "blue_white",
|
||||
"dialog_menubox_highlight": "blue_white",
|
||||
|
|
|
@ -235,6 +235,13 @@
|
|||
"yorigin": 24,
|
||||
"slice": null
|
||||
},
|
||||
"visible": {
|
||||
"path": "./icon/s_visible.png",
|
||||
"subimages": 2,
|
||||
"xorigin": 24,
|
||||
"yorigin": 24,
|
||||
"slice": null
|
||||
},
|
||||
"junc_visible": {
|
||||
"path": "./icon/s_junc_visible_strip2.png",
|
||||
"subimages": 2,
|
||||
|
@ -1030,6 +1037,20 @@
|
|||
"yorigin": 24,
|
||||
"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": {
|
||||
"path": "./tool/s_splice_draw.png",
|
||||
"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 |
BIN
datafiles/data/themes/default/graphics/icon/s_visible.png
Normal file
BIN
datafiles/data/themes/default/graphics/icon/s_visible.png
Normal file
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 |
|
@ -255,7 +255,7 @@ event_inherited();
|
|||
search_string = "";
|
||||
search_list = ds_list_create();
|
||||
keyboard_lastchar = "";
|
||||
keyboard_string = "";
|
||||
KEYBOARD_STRING = "";
|
||||
keyboard_lastkey = -1;
|
||||
|
||||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) {
|
||||
|
|
|
@ -23,5 +23,5 @@ event_inherited();
|
|||
});
|
||||
|
||||
TEXTBOX_ACTIVE = tb_name;
|
||||
keyboard_string = "";
|
||||
KEYBOARD_STRING = "";
|
||||
#endregion
|
|
@ -15,7 +15,7 @@ event_inherited();
|
|||
target = noone;
|
||||
|
||||
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
|
||||
|
||||
|
@ -24,7 +24,7 @@ event_inherited();
|
|||
dragging = -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;
|
||||
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);
|
||||
|
||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) {
|
||||
inb_hover = index;
|
||||
if(dragging == -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_w = sprite_get_width(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_y = yy + hh / 2 - spr_h * spr_s / 2;
|
||||
|
||||
if(dragging == index)
|
||||
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, 0.5);
|
||||
else
|
||||
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, 1);
|
||||
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, aa);
|
||||
|
||||
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
|
||||
var path = arr[index];
|
||||
|
@ -107,15 +95,14 @@ event_inherited();
|
|||
_h += ch;
|
||||
}
|
||||
|
||||
if(dragging != -1 && mouse_release(mb_left)) {
|
||||
if(dragging != -1) {
|
||||
if(inb_hover != -1) {
|
||||
var val = arr[dragging];
|
||||
array_delete(arr, dragging, 1);
|
||||
array_insert(arr, dragging < inb_hover? inb_hover - 1 : inb_hover, val);
|
||||
target.inputs[| 0].setValue(arr);
|
||||
target.doUpdate();
|
||||
rearrange(dragging, inb_hover);
|
||||
dragging = inb_hover;
|
||||
}
|
||||
dragging = -1;
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
dragging = -1;
|
||||
}
|
||||
|
||||
if(menu > -1) {
|
||||
|
@ -131,4 +118,17 @@ event_inherited();
|
|||
|
||||
return _h;
|
||||
})
|
||||
#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
|
|
@ -14,7 +14,7 @@ if !target exit;
|
|||
#region content
|
||||
var x0 = dialog_x + ui(20);
|
||||
var x1 = x0 + sp_content.w;
|
||||
var y0 = dialog_y + ui(44);
|
||||
var y0 = dialog_y + ui(56);
|
||||
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));
|
||||
|
|
|
@ -35,8 +35,27 @@ event_inherited();
|
|||
var _w = sp_noti.w - ui(12);
|
||||
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);
|
||||
|
||||
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) {
|
||||
var _nwx = sp_noti.w - ui(12) - ui(40);
|
||||
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_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;
|
||||
hh += _h;
|
||||
}
|
||||
|
|
|
@ -63,12 +63,30 @@ event_inherited();
|
|||
ds_list_add(pref_global, [
|
||||
"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_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, [
|
||||
"UI frame rate",
|
||||
"ui_framerate",
|
||||
|
|
|
@ -20,15 +20,19 @@
|
|||
|
||||
draw_set_circle_precision(64);
|
||||
globalvar CURSOR, UPDATE, TOOLTIP, DIALOG_DEPTH_HOVER;
|
||||
globalvar RENDER_STACK;
|
||||
globalvar RENDER_STACK, KEYBOARD_STRING;
|
||||
DIALOG_DEPTH_HOVER = 0;
|
||||
UPDATE = RENDER_TYPE.none;
|
||||
CURSOR = cr_default;
|
||||
TOOLTIP = "";
|
||||
KEYBOARD_STRING = "";
|
||||
RENDER_STACK = ds_stack_create();
|
||||
|
||||
_cursor = CURSOR;
|
||||
dc_check = 0;
|
||||
kb_time = 0;
|
||||
kb_hold = false;
|
||||
kb_hkey = 0;
|
||||
|
||||
//display_set_timing_method(tm_sleep);
|
||||
|
||||
|
@ -88,6 +92,9 @@
|
|||
case ".gif" :
|
||||
Node_create_Image_gif_path(PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y, path);
|
||||
break;
|
||||
case ".obj" :
|
||||
Node_create_3D_Obj_path(PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y, path);
|
||||
break;
|
||||
case ".json" :
|
||||
case ".pxc" :
|
||||
if(_new) NEW();
|
||||
|
|
5
objects/o_main/KeyRelease_1.gml
Normal file
5
objects/o_main/KeyRelease_1.gml
Normal file
|
@ -0,0 +1,5 @@
|
|||
/// @description
|
||||
kb_time = 0;
|
||||
kb_hold = false;
|
||||
kb_hkey = "";
|
||||
keyboard_lastchar = "";
|
24
objects/o_main/Keyboard_1.gml
Normal file
24
objects/o_main/Keyboard_1.gml
Normal 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;
|
||||
}
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
#region animation
|
||||
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) {
|
||||
switch(ANIMATOR.playback) {
|
||||
case ANIMATOR_END.loop :
|
||||
|
@ -26,13 +28,9 @@
|
|||
ANIMATOR.setFrame(ANIMATOR.real_frame);
|
||||
}
|
||||
|
||||
ANIMATOR.frame_progress = false;
|
||||
var _c = ANIMATOR.current_frame;
|
||||
ANIMATOR.current_frame = round(ANIMATOR.real_frame);
|
||||
|
||||
if(_c != ANIMATOR.current_frame) {
|
||||
ANIMATOR.frame_progress = true;
|
||||
}
|
||||
ANIMATOR.frame_progress = _c != ANIMATOR.current_frame;
|
||||
#endregion
|
||||
|
||||
#region hotkey
|
||||
|
|
|
@ -44,12 +44,11 @@
|
|||
if(dc_check > 0) {
|
||||
DOUBLE_CLICK = true;
|
||||
dc_check = 0;
|
||||
} else {
|
||||
dc_check = PREF_MAP[? "double_click_delay"];
|
||||
}
|
||||
} else
|
||||
dc_check = PREF_MAP[? "double_click_delay"];
|
||||
}
|
||||
|
||||
dc_check--;
|
||||
dc_check -= DELTA_TIME;
|
||||
#endregion
|
||||
|
||||
#region step
|
||||
|
|
|
@ -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":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":1,"eventType":5,"collisionObjectId":null,},
|
||||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":1,"eventType":10,"collisionObjectId":null,},
|
||||
],
|
||||
"properties": [],
|
||||
"overriddenProperties": [],
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
#region setup
|
||||
globalvar FORMAT_PT, PRIMITIVES;
|
||||
globalvar PRIMITIVES, FORMAT_PT, FORMAT_PNT;
|
||||
PRIMITIVES = ds_map_create();
|
||||
|
||||
vertex_format_begin();
|
||||
vertex_format_add_position_3d();
|
||||
vertex_format_add_texcoord();
|
||||
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
|
||||
|
||||
#region plane
|
||||
|
@ -26,61 +32,76 @@
|
|||
vertex_end(VB);
|
||||
vertex_freeze(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
|
||||
|
||||
#region cube
|
||||
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_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _1, _0], [1, 1]);
|
||||
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_pt(VB, [_1, _1, _0], [1, 1]);
|
||||
vertex_add_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _1, _0], [0, 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_add_pt(VB, [_1, _0, _1], [1, 0]);
|
||||
vertex_add_pt(VB, [_0, _0, _1], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
vertex_add_pnt(VB, [_1, _0, _1], [0, 0, 1], [1, 0]);
|
||||
vertex_add_pnt(VB, [_0, _0, _1], [0, 0, 1], [0, 0]);
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [0, 0, 1], [1, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
vertex_add_pt(VB, [_0, _0, _1], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _1, _1], [0, 1]);
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [0, 0, 1], [1, 1]);
|
||||
vertex_add_pnt(VB, [_0, _0, _1], [0, 0, 1], [0, 0]);
|
||||
vertex_add_pnt(VB, [_0, _1, _1], [0, 0, 1], [0, 1]);
|
||||
|
||||
|
||||
vertex_add_pt(VB, [_1, _0, _0], [1, 0]);
|
||||
vertex_add_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _0, _1], [1, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _0, _1], [1, 1]);
|
||||
vertex_add_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _0, _1], [0, 1]);
|
||||
vertex_add_pnt(VB, [_1, _0, _0], [0, 1, 0], [1, 0]);
|
||||
vertex_add_pnt(VB, [_0, _0, _0], [0, 1, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_1, _0, _1], [0, 1, 0], [1, 1]);
|
||||
|
||||
vertex_add_pnt(VB, [_1, _0, _1], [0, 1, 0], [1, 1]);
|
||||
vertex_add_pnt(VB, [_0, _0, _0], [0, 1, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_0, _0, _1], [0, 1, 0], [0, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _1, _0], [1, 0]);
|
||||
vertex_add_pt(VB, [_0, _1, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
vertex_add_pnt(VB, [_1, _1, _0], [0, -1, 0], [1, 0]);
|
||||
vertex_add_pnt(VB, [_0, _1, _0], [0, -1, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [0, -1, 0], [1, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
vertex_add_pt(VB, [_0, _1, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _1, _1], [0, 1]);
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [0, -1, 0], [1, 1]);
|
||||
vertex_add_pnt(VB, [_0, _1, _0], [0, -1, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_0, _1, _1], [0, -1, 0], [0, 1]);
|
||||
|
||||
|
||||
vertex_add_pt(VB, [_0, _1, _0], [1, 0]);
|
||||
vertex_add_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _1, _1], [1, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_0, _1, _1], [1, 1]);
|
||||
vertex_add_pt(VB, [_0, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_0, _0, _1], [0, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _1, _0], [1, 0]);
|
||||
vertex_add_pt(VB, [_1, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
|
||||
vertex_add_pt(VB, [_1, _1, _1], [1, 1]);
|
||||
vertex_add_pt(VB, [_1, _0, _0], [0, 0]);
|
||||
vertex_add_pt(VB, [_1, _0, _1], [0, 1]);
|
||||
vertex_add_pnt(VB, [_0, _1, _0], [1, 0, 0], [1, 0]);
|
||||
vertex_add_pnt(VB, [_0, _0, _0], [1, 0, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_0, _1, _1], [1, 0, 0], [1, 1]);
|
||||
|
||||
vertex_add_pnt(VB, [_0, _1, _1], [1, 0, 0], [1, 1]);
|
||||
vertex_add_pnt(VB, [_0, _0, _0], [1, 0, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_0, _0, _1], [1, 0, 0], [0, 1]);
|
||||
|
||||
vertex_add_pnt(VB, [_1, _1, _0], [-1, 0, 0], [1, 0]);
|
||||
vertex_add_pnt(VB, [_1, _0, _0], [-1, 0, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [-1, 0, 0], [1, 1]);
|
||||
|
||||
vertex_add_pnt(VB, [_1, _1, _1], [-1, 0, 0], [1, 1]);
|
||||
vertex_add_pnt(VB, [_1, _0, _0], [-1, 0, 0], [0, 0]);
|
||||
vertex_add_pnt(VB, [_1, _0, _1], [-1, 0, 0], [0, 1]);
|
||||
|
||||
vertex_end(VB);
|
||||
vertex_freeze(VB);
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
playback = ANIMATOR_END.loop;
|
||||
|
||||
static setFrame = function(frame) {
|
||||
var _c = current_frame;
|
||||
frame = clamp(frame, 0, frames_total - 1);
|
||||
real_frame = frame;
|
||||
current_frame = round(frame);
|
||||
|
||||
if(_c != current_frame)
|
||||
frame_progress = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
function APPEND(_path) {
|
||||
APPENDING = true;
|
||||
|
||||
var log = false;
|
||||
if(_path == "") return;
|
||||
var _map = json_load(_path);
|
||||
|
||||
var file = file_text_open_read(_path);
|
||||
var load_str = "";
|
||||
while(!file_text_eof(file)) {
|
||||
load_str += file_text_readln(file);
|
||||
if(_map == -1) {
|
||||
printlog("Decode error");
|
||||
return
|
||||
}
|
||||
var _map = json_decode(load_str);
|
||||
|
||||
if(ds_map_exists(_map, "version")) {
|
||||
var _v = _map[? "version"];
|
||||
|
@ -27,12 +27,14 @@ function APPEND(_path) {
|
|||
|
||||
ds_queue_clear(CONNECTION_CONFLICT);
|
||||
ds_map_clear(APPEND_MAP);
|
||||
var t = current_time;
|
||||
|
||||
for(var i = 0; i < ds_list_size(_node_list); i++) {
|
||||
var _node = nodeLoad(_node_list[| i], true);
|
||||
if(_node) ds_list_add(appended_list, _node);
|
||||
}
|
||||
file_text_close(file);
|
||||
printlog("Load time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
try {
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++) {
|
||||
|
@ -45,6 +47,8 @@ function APPEND(_path) {
|
|||
} catch(e) {
|
||||
log_warning("APPEND, node", e.longMessage);
|
||||
}
|
||||
printlog("Load group time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
try {
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++)
|
||||
|
@ -52,15 +56,8 @@ function APPEND(_path) {
|
|||
} catch(e) {
|
||||
log_warning("APPEND, deserialize", e.longMessage);
|
||||
}
|
||||
|
||||
try {
|
||||
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);
|
||||
}
|
||||
printlog("Deserialize time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
try {
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++)
|
||||
|
@ -72,6 +69,8 @@ function APPEND(_path) {
|
|||
} catch(e) {
|
||||
log_warning("APPEND, connect", e.longMessage);
|
||||
}
|
||||
printlog("Connect time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
try {
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++)
|
||||
|
@ -79,6 +78,8 @@ function APPEND(_path) {
|
|||
} catch(e) {
|
||||
log_warning("APPEND, update", e.longMessage);
|
||||
}
|
||||
printlog("Update time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
ds_list_destroy(appended_list);
|
||||
|
||||
|
@ -101,11 +102,13 @@ function APPEND(_path) {
|
|||
}
|
||||
|
||||
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) {
|
||||
log_warning("APPEND, Conflict solver error : ", e.longMessage);
|
||||
}
|
||||
}
|
||||
printlog("Conflict time: " + string(current_time - t));
|
||||
t = current_time;
|
||||
|
||||
APPENDING = false;
|
||||
PANEL_ANIMATION.updatePropertyList();
|
||||
|
|
|
@ -21,4 +21,9 @@ function array_remove(arr, val) {
|
|||
if(!array_exists(arr, val)) return;
|
||||
var ind = array_find(arr, val);
|
||||
array_delete(arr, ind, 1);
|
||||
}
|
||||
|
||||
function array_push_unique(arr, val) {
|
||||
if(array_exists(arr, val)) return;
|
||||
array_push(arr, val);
|
||||
}
|
|
@ -24,16 +24,16 @@ function buttonColorClass(_onApply) constructor {
|
|||
b_picker.active = active;
|
||||
b_picker.draw(_x + _w - ui(32), _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide);
|
||||
|
||||
if(keyboard_check_pressed(vk_alt)) {
|
||||
onColorPick();
|
||||
is_picking = true;
|
||||
}
|
||||
if(is_picking) {
|
||||
if(keyboard_check_released(vk_alt)) {
|
||||
instance_destroy(o_dialog_color_selector);
|
||||
is_picking = false;
|
||||
}
|
||||
}
|
||||
//if(keyboard_check_pressed(vk_alt)) {
|
||||
// onColorPick();
|
||||
// is_picking = true;
|
||||
//}
|
||||
//if(is_picking) {
|
||||
// if(keyboard_check_released(vk_alt)) {
|
||||
// instance_destroy(o_dialog_color_selector);
|
||||
// is_picking = false;
|
||||
// }
|
||||
//}
|
||||
|
||||
var _cw = _w - ui(40);
|
||||
var click = false;
|
||||
|
|
|
@ -15,7 +15,7 @@ function buttonGroupClass(_data, _onClick) constructor {
|
|||
|
||||
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 ww = _w / amo;
|
||||
|
||||
|
@ -34,7 +34,7 @@ function buttonGroupClass(_data, _onClick) constructor {
|
|||
var bx = _x + ww * i;
|
||||
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);
|
||||
} else if(buttons[i].draw(bx, _y, ww, _h, _m, spr)) {
|
||||
onClick(i);
|
||||
|
@ -50,7 +50,7 @@ function buttonGroupClass(_data, _onClick) constructor {
|
|||
} else {
|
||||
sb_small.hover = hover;
|
||||
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;
|
||||
|
|
10
scripts/color_function/color_function.gml
Normal file
10
scripts/color_function/color_function.gml
Normal 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 ];
|
||||
}
|
11
scripts/color_function/color_function.yy
Normal file
11
scripts/color_function/color_function.yy
Normal 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",
|
||||
},
|
||||
}
|
|
@ -40,7 +40,8 @@ function curveBox(_onModify) constructor {
|
|||
|
||||
if(node_dragging != -1) {
|
||||
var _my = -((_m[1] - _y) / curve_h * drag_range - drag_max);
|
||||
|
||||
_my = clamp(_my, 0, 1);
|
||||
|
||||
_data[node_dragging] = _my;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
|
|
17
scripts/d3_vector/d3_vector.gml
Normal file
17
scripts/d3_vector/d3_vector.gml
Normal 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;
|
||||
}
|
11
scripts/d3_vector/d3_vector.yy
Normal file
11
scripts/d3_vector/d3_vector.yy
Normal 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",
|
||||
},
|
||||
}
|
|
@ -1,10 +1,12 @@
|
|||
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 {
|
||||
normal,
|
||||
add,
|
||||
|
||||
subtract,
|
||||
subtract_alpha,
|
||||
|
||||
multiply,
|
||||
multiply_alpha,
|
||||
|
@ -12,6 +14,9 @@ enum BLEND_MODE {
|
|||
screen,
|
||||
screen_alpha,
|
||||
|
||||
contrast,
|
||||
overlay,
|
||||
|
||||
maxx,
|
||||
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.add : sh = sh_blend_add; break;
|
||||
case BLEND_MODE.subtract : sh = sh_blend_subtract; break;
|
||||
case BLEND_MODE.subtract_alpha : sh = sh_blend_subtract_alpha; break;
|
||||
case BLEND_MODE.multiply : sh = sh_blend_multiply; break;
|
||||
case BLEND_MODE.multiply_alpha : sh = sh_blend_multiply_alpha; break;
|
||||
case BLEND_MODE.screen : sh = sh_blend_screen; break;
|
||||
case BLEND_MODE.screen_alpha : sh = sh_blend_screen_alpha; break;
|
||||
case BLEND_MODE.contrast : sh = sh_blend_contrast; break;
|
||||
case BLEND_MODE.overlay : sh = sh_blend_overlay; break;
|
||||
case BLEND_MODE.maxx : sh = sh_blend_max; break;
|
||||
case BLEND_MODE.minn : sh = sh_blend_min; break;
|
||||
}
|
||||
|
|
13
scripts/ds_priority/ds_priority.gml
Normal file
13
scripts/ds_priority/ds_priority.gml
Normal 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;
|
||||
}
|
11
scripts/ds_priority/ds_priority.yy
Normal file
11
scripts/ds_priority/ds_priority.yy
Normal 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",
|
||||
},
|
||||
}
|
|
@ -74,6 +74,8 @@
|
|||
#macro sFOCUS FOCUS == self
|
||||
#macro sHOVER HOVER == self
|
||||
|
||||
#macro DELTA_TIME delta_time / 1000000
|
||||
|
||||
#region color
|
||||
#macro c_ui_blue_dkblack $251919
|
||||
#macro c_ui_blue_mdblack $2c1e1e
|
||||
|
@ -107,6 +109,7 @@
|
|||
|
||||
#macro PIXEL_SURFACE surface_create_valid(1, 1)
|
||||
#macro print show_debug_message
|
||||
#macro printlog if(log) show_debug_message
|
||||
#endregion
|
||||
|
||||
#region presets
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function json_load(path) {
|
||||
if(!file_exists(path)) return {};
|
||||
if(!file_exists(path)) return noone;
|
||||
|
||||
var f = file_text_open_read(path);
|
||||
var s = file_text_read_all(f);
|
||||
|
@ -15,4 +15,11 @@ function json_save(path, struct) {
|
|||
var f = file_text_open_write(path);
|
||||
file_text_write_string(f, s);
|
||||
file_text_close(f);
|
||||
}
|
||||
|
||||
function file_text_read_all(file) {
|
||||
var s = "";
|
||||
while(!file_text_eof(file))
|
||||
s += file_text_readln(file);
|
||||
return s;
|
||||
}
|
|
@ -106,22 +106,13 @@ function LOAD_PATH(path, readonly = false) {
|
|||
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 {
|
||||
for(var i = 0; i < ds_list_size(create_list); i++)
|
||||
create_list[| i].preConnect();
|
||||
for(var i = 0; i < ds_list_size(create_list); i++)
|
||||
create_list[| i].connect();
|
||||
for(var i = 0; i < ds_list_size(create_list); i++)
|
||||
create_list[| i].postConnect();
|
||||
create_list[| i].postConnect();
|
||||
} catch(e) {
|
||||
log_warning("LOAD, connect", e.longMessage);
|
||||
}
|
||||
|
|
41
scripts/mtl_reader/mtl_reader.gml
Normal file
41
scripts/mtl_reader/mtl_reader.gml
Normal 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;
|
||||
}
|
11
scripts/mtl_reader/mtl_reader.yy
Normal file
11
scripts/mtl_reader/mtl_reader.yy
Normal 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",
|
||||
},
|
||||
}
|
|
@ -59,7 +59,7 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
["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();
|
||||
|
||||
switch(_shape) {
|
||||
|
@ -68,14 +68,14 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
break;
|
||||
case LIGHT_SHAPE_2D.line :
|
||||
case LIGHT_SHAPE_2D.line_asym :
|
||||
case LIGHT_SHAPE_2D.spot :
|
||||
inputs[| 6].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 7].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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,26 @@ function Node_create_3D_Obj(_x, _y) {
|
|||
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 {
|
||||
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, "")
|
||||
.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)
|
||||
.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);
|
||||
|
||||
inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 180 ])
|
||||
.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);
|
||||
|
||||
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,
|
||||
["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);
|
||||
|
||||
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) {
|
||||
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].setVisible(false);
|
||||
inputs[| index] = nodeValue( index, materialNames[m_index] + " texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface);
|
||||
inputs[| index].setVisible(true);
|
||||
|
||||
input_display_list[input_display_len + m_index] = index;
|
||||
|
||||
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 = [];
|
||||
|
||||
static updateObj = function() {
|
||||
var _path = inputs[| 0].getValue();
|
||||
var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl";
|
||||
|
||||
var _v = readObj(_path);
|
||||
if(_v != noone) {
|
||||
VB = _v[0];
|
||||
materials = _v[1];
|
||||
materialNames = _v[1];
|
||||
materialIndex = _v[2];
|
||||
}
|
||||
|
||||
materials = readMtl(_pathMtl);
|
||||
|
||||
do_reset_material = true;
|
||||
}
|
||||
do_reset_material = false;
|
||||
|
@ -82,14 +138,14 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = 0;
|
||||
drag_my = 0;
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
var active = _active;
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false;
|
||||
|
||||
var _dim = inputs[| 2].getValue();
|
||||
var _pos = inputs[| 3].getValue();
|
||||
var _rot = inputs[| 4].getValue();
|
||||
var cx = _x + _dim[0] * _s / 2;
|
||||
var cy = _y + _dim[1] * _s / 2;
|
||||
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);
|
||||
|
@ -101,7 +157,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
draw_circle(cx, cy, 64, true);
|
||||
|
||||
if(drag_index == 0) {
|
||||
var dx = (_mx - drag_mx) / _s * 6;
|
||||
var dx = (_mx - drag_mx) / _s * -6;
|
||||
_rot[1] = drag_sv + dx;
|
||||
|
||||
if(inputs[| 4].setValue(_rot))
|
||||
|
@ -112,7 +168,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
UNDO_HOLDING = false;
|
||||
}
|
||||
} else if(drag_index == 1) {
|
||||
var dy = (_my - drag_my) / _s * -6;
|
||||
var dy = (_my - drag_my) / _s * 6;
|
||||
_rot[0] = drag_sv + dy;
|
||||
|
||||
if(inputs[| 4].setValue(_rot))
|
||||
|
@ -123,8 +179,8 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
UNDO_HOLDING = false;
|
||||
}
|
||||
} else if(drag_index == 2) {
|
||||
var da = point_direction(cx, cy, _mx, _my);
|
||||
_rot[2] = da;
|
||||
var dy = point_direction(cx, cy, _mx, _my) - point_direction(cx, cy, drag_mx, drag_my);
|
||||
_rot[2] = drag_sv + dy;
|
||||
|
||||
if(inputs[| 4].setValue(_rot))
|
||||
UNDO_HOLDING = true;
|
||||
|
@ -134,7 +190,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
UNDO_HOLDING = false;
|
||||
}
|
||||
} 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_line_width(cx - 64, cy, cx + 64, cy, 3);
|
||||
if(mouse_press(mb_left, active)) {
|
||||
|
@ -143,7 +199,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = _mx;
|
||||
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_line_width(cx, cy - 64, cx, cy + 64, 3);
|
||||
if(mouse_press(mb_left, active)) {
|
||||
|
@ -152,7 +208,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = _mx;
|
||||
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_circle_border(cx, cy, 64, 3);
|
||||
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() {
|
||||
|
@ -171,19 +229,24 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
if(do_reset_material) {
|
||||
array_resize(input_display_list, input_display_len);
|
||||
|
||||
while(ds_list_size(inputs) > 6)
|
||||
ds_list_delete(inputs, 6);
|
||||
while(ds_list_size(inputs) > input_length)
|
||||
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);
|
||||
}
|
||||
do_reset_material = false;
|
||||
}
|
||||
|
||||
var _dim = inputs[| 2].getValue();
|
||||
var _pos = inputs[| 3].getValue();
|
||||
var _rot = inputs[| 4].getValue();
|
||||
var _sca = inputs[| 5].getValue();
|
||||
var _dim = inputs[| 2].getValue();
|
||||
var _pos = inputs[| 3].getValue();
|
||||
var _rot = inputs[| 4].getValue();
|
||||
var _sca = inputs[| 5].getValue();
|
||||
|
||||
var _ldir = inputs[| 6].getValue();
|
||||
var _lhgt = inputs[| 7].getValue();
|
||||
var _lint = inputs[| 8].getValue();
|
||||
var _lclr = inputs[| 9].getValue();
|
||||
var _aclr = inputs[| 10].getValue();
|
||||
|
||||
var _outSurf = outputs[| 0].getValue();
|
||||
if(!is_surface(_outSurf)) {
|
||||
|
@ -192,28 +255,35 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
|
|||
} else
|
||||
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);
|
||||
cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 1, 100);
|
||||
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_pt);
|
||||
camera_apply(cam);
|
||||
gpu_set_ztestenable(true);
|
||||
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);
|
||||
draw_clear_alpha(0, 0);
|
||||
matrix_stack_push(TM);
|
||||
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
if(VB != noone) {
|
||||
for(var i = 0; i < array_length(VB); i++) {
|
||||
if(i >= ds_list_size(inputs)) break;
|
||||
var tex = inputs[| 6 + i].getValue();
|
||||
if(is_surface(tex))
|
||||
vertex_submit(VB[i], pr_trianglelist, surface_get_texture(tex));
|
||||
}
|
||||
}
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
for(var i = 0; i < array_length(VB); i++) {
|
||||
if(i >= ds_list_size(inputs)) break;
|
||||
var mIndex = materialIndex[i];
|
||||
var tex = inputs[| input_length + mIndex].getValue();
|
||||
|
||||
if(!is_surface(tex)) continue;
|
||||
vertex_submit(VB[i], pr_trianglelist, surface_get_texture(tex));
|
||||
}
|
||||
shader_reset();
|
||||
|
||||
matrix_stack_pop();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_3D_obj",
|
||||
"name": "node_3d_obj",
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
|
|
318
scripts/node_3d_extrude/node_3d_extrude.gml
Normal file
318
scripts/node_3d_extrude/node_3d_extrude.gml
Normal 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;
|
||||
}
|
||||
}
|
11
scripts/node_3d_extrude/node_3d_extrude.yy
Normal file
11
scripts/node_3d_extrude/node_3d_extrude.yy
Normal 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",
|
||||
},
|
||||
}
|
12
scripts/node_3d_extrude/node_3d_prim_cube.yy
Normal file
12
scripts/node_3d_extrude/node_3d_prim_cube.yy
Normal 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",
|
||||
}
|
|
@ -7,31 +7,52 @@ function Node_create_3D_Cube(_x, _y) {
|
|||
function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
||||
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[| 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, [ 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);
|
||||
|
||||
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 ])
|
||||
inputs[| 4] = nodeValue(4, "Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
|
||||
.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[| 7] = nodeValue( 7, "Textures 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 8] = nodeValue( 8, "Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 9] = nodeValue( 9, "Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 10] = nodeValue(10, "Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 11] = nodeValue(11, "Textures 5", 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).setVisible(false);
|
||||
inputs[| 8] = nodeValue( 8, "Textures 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
|
||||
inputs[| 9] = nodeValue( 9, "Textures 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
|
||||
inputs[| 10] = nodeValue(10, "Textures 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
|
||||
inputs[| 11] = nodeValue(11, "Textures 5", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0).setVisible(false);
|
||||
|
||||
inputs[| 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 = [
|
||||
["Transform", false], 0, 1, 2, 3, 4,
|
||||
["Texture", false], 5, 6, 7, 8, 9, 10, 11
|
||||
["Transform", false], 0, 1, 2, 3, 12, 4,
|
||||
["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);
|
||||
|
@ -51,14 +72,15 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = 0;
|
||||
drag_my = 0;
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
var active = _active;
|
||||
if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false;
|
||||
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 + _dim[0] * _s / 2;
|
||||
var cy = _y + _dim[1] * _s / 2;
|
||||
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);
|
||||
|
@ -103,7 +125,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
UNDO_HOLDING = false;
|
||||
}
|
||||
} 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_line_width(cx - 64, cy, cx + 64, cy, 3);
|
||||
if(mouse_press(mb_left, active)) {
|
||||
|
@ -112,7 +134,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = _mx;
|
||||
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_line_width(cx, cy - 64, cx, cy + 64, 3);
|
||||
if(mouse_press(mb_left, active)) {
|
||||
|
@ -121,7 +143,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = _mx;
|
||||
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_circle_border(cx, cy, 64, 3);
|
||||
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() {
|
||||
|
@ -143,9 +167,17 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
var _pos = inputs[| 2].getValue();
|
||||
var _rot = inputs[| 3].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();
|
||||
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();
|
||||
if(!is_surface(_outSurf)) {
|
||||
|
@ -154,50 +186,58 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
} else
|
||||
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);
|
||||
camera_set_view_mat(cam, cam_proj);
|
||||
camera_set_view_size(cam, _ww, _hh);
|
||||
|
||||
var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
|
||||
|
||||
gpu_set_ztestenable(true);
|
||||
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);
|
||||
draw_clear_alpha(0, 0);
|
||||
|
||||
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) {
|
||||
var face = [];
|
||||
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_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_push(matrix_build(0, 0, -0.5, 0, 0, 0, 1, 1, 1));
|
||||
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_push(matrix_build(0, 0.5, 0, 90, 0, 0, 1, 1, 1));
|
||||
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_push(matrix_build(0, -0.5, 0, 90, 0, 0, 1, 1, 1));
|
||||
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_push(matrix_build(0.5, 0, 0, 0, 90, 0, 1, 1, 1));
|
||||
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_push(matrix_build(-0.5, 0, 0, 0, 90, 0, 1, 1, 1));
|
||||
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();
|
||||
} else {
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
|
@ -206,6 +246,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
shader_reset();
|
||||
matrix_stack_pop();
|
||||
matrix_stack_pop();
|
||||
matrix_set(matrix_world, MATRIX_IDENTITY);
|
||||
surface_reset_target();
|
||||
|
||||
|
|
|
@ -7,6 +7,11 @@ function Node_create_3D_Cylinder(_x, _y) {
|
|||
function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
||||
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[| 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)
|
||||
.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);
|
||||
|
||||
inputs[| 4] = nodeValue(4, "Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
|
||||
.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);
|
||||
|
||||
inputs[| 6] = nodeValue( 6, "Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 7] = nodeValue( 7, "Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 8] = nodeValue( 8, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 6] = nodeValue(6, "Textures top", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 7] = nodeValue(7, "Textures bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 8] = nodeValue(8, "Textures side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 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,
|
||||
["Geometry", false], 0, 1,
|
||||
["Transform", false], 3, 4, 5,
|
||||
["Texture", false], 6, 7, 8
|
||||
["Transform", false], 3, 4, 9, 5,
|
||||
["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);
|
||||
|
@ -43,15 +64,15 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
|||
static generate_vb = function() {
|
||||
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++) {
|
||||
_nx = lengthdir_x(0.5, i * 360 / sides);
|
||||
_ny = lengthdir_y(0.5, i * 360 / sides);
|
||||
|
||||
if(i) {
|
||||
vertex_add_pt(VB_top, [ 0, thick / 2, 0], [ 0 + 0.5, 0 + 0.5]);
|
||||
vertex_add_pt(VB_top, [_ox, thick / 2, _oy], [_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, [ 0, thick / 2, 0], [0, 1, 0], [ 0 + 0.5, 0 + 0.5]);
|
||||
vertex_add_pnt(VB_top, [_ox, thick / 2, _oy], [0, 1, 0], [_ox + 0.5, _oy + 0.5]);
|
||||
vertex_add_pnt(VB_top, [_nx, thick / 2, _ny], [0, 1, 0], [_nx + 0.5, _ny + 0.5]);
|
||||
}
|
||||
|
||||
_ox = _nx;
|
||||
|
@ -60,20 +81,20 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
vertex_end(VB_top);
|
||||
|
||||
vertex_begin(VB_sid, FORMAT_PT);
|
||||
vertex_begin(VB_sid, FORMAT_PNT);
|
||||
for(var i = 0; i <= sides; i++) {
|
||||
_nx = lengthdir_x(0.5, i * 360 / sides);
|
||||
_ny = lengthdir_y(0.5, i * 360 / sides);
|
||||
_nu = i / sides;
|
||||
|
||||
if(i) {
|
||||
vertex_add_pt(VB_sid, [_ox, -thick / 2, _oy], [_ou, 0]);
|
||||
vertex_add_pt(VB_sid, [_ox, thick / 2, _oy], [_ou, 1]);
|
||||
vertex_add_pt(VB_sid, [_nx, thick / 2, _ny], [_nu, 1]);
|
||||
vertex_add_pnt(VB_sid, [_ox, -thick / 2, _oy], [_nx, 0, _ny], [_ou, 0]);
|
||||
vertex_add_pnt(VB_sid, [_ox, thick / 2, _oy], [_nx, 0, _ny], [_ou, 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_pt(VB_sid, [_nx, -thick / 2, _ny], [_nu, 0]);
|
||||
vertex_add_pt(VB_sid, [_ox, -thick / 2, _oy], [_ou, 0]);
|
||||
vertex_add_pnt(VB_sid, [_nx, thick / 2, _ny], [_nx, 0, _ny], [_nu, 1]);
|
||||
vertex_add_pnt(VB_sid, [_nx, -thick / 2, _ny], [_nx, 0, _ny], [_nu, 0]);
|
||||
vertex_add_pnt(VB_sid, [_ox, -thick / 2, _oy], [_nx, 0, _ny], [_ou, 0]);
|
||||
}
|
||||
|
||||
_ox = _nx;
|
||||
|
@ -89,14 +110,15 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_mx = 0;
|
||||
drag_my = 0;
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
var active = _active;
|
||||
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false;
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my))
|
||||
active = false;
|
||||
|
||||
var _dim = inputs[| 2].getValue();
|
||||
var _pos = inputs[| 3].getValue();
|
||||
var _rot = inputs[| 4].getValue();
|
||||
var cx = _x + _dim[0] * _s / 2;
|
||||
var cy = _y + _dim[1] * _s / 2;
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -199,6 +223,13 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
|||
var face_top = inputs[| 6].getValue();
|
||||
var face_bot = inputs[| 7].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();
|
||||
if(!is_surface(_outSurf)) {
|
||||
|
@ -207,37 +238,41 @@ function Node_3D_Cylinder(_x, _y) : Node(_x, _y) constructor {
|
|||
} else
|
||||
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);
|
||||
camera_set_view_mat(cam, cam_proj);
|
||||
camera_set_view_size(cam, _dim[0], _dim[1]);
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
draw_clear_alpha(0, 0);
|
||||
BLEND_ADD
|
||||
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);
|
||||
|
||||
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());
|
||||
vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_top));
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_top));
|
||||
|
||||
matrix_stack_push(matrix_build(0, -thick, 0, 0, 0, 0, 1, 1, 1));
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_bot));
|
||||
matrix_stack_pop();
|
||||
matrix_stack_push(matrix_build(0, -thick, 0, 0, 0, 0, 1, 1, 1));
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
vertex_submit(VB_top, pr_trianglelist, surface_get_texture(face_bot));
|
||||
matrix_stack_pop();
|
||||
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
vertex_submit(VB_sid, pr_trianglelist, surface_get_texture(face_sid));
|
||||
shader_reset();
|
||||
matrix_set(matrix_world, matrix_stack_top());
|
||||
vertex_submit(VB_sid, pr_trianglelist, surface_get_texture(face_sid));
|
||||
|
||||
shader_reset();
|
||||
matrix_stack_pop();
|
||||
matrix_stack_pop();
|
||||
matrix_set(matrix_world, MATRIX_IDENTITY);
|
||||
|
||||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
|
||||
gpu_set_ztestenable(false);
|
||||
|
|
|
@ -49,9 +49,9 @@ function Node_3D_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
drag_mx = 0;
|
||||
drag_my = 0;
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
var active = _active;
|
||||
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my)) active = false;
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my))
|
||||
active = false;
|
||||
var _out = outputs[| 0].getValue();
|
||||
if(!is_surface(_out) || !surface_exists(_out)) return;
|
||||
|
||||
|
|
|
@ -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 _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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
drag_my = _my;
|
||||
|
|
25
scripts/node_anim_priority/node_anim_priority.gml
Normal file
25
scripts/node_anim_priority/node_anim_priority.gml
Normal 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();
|
||||
}
|
11
scripts/node_anim_priority/node_anim_priority.yy
Normal file
11
scripts/node_anim_priority/node_anim_priority.yy
Normal 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",
|
||||
},
|
||||
}
|
|
@ -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 ])
|
||||
.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 _span = inputs[| 1].getValue();
|
||||
var _shape = inputs[| 2].getValue();
|
||||
|
@ -44,8 +44,8 @@ function Node_Area(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
|||
break;
|
||||
}
|
||||
|
||||
inputs[| 0].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 1].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 1].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
}
|
||||
|
||||
function process_value_data(_data, index = 0) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var _surf = outputs[| 0].getValue();
|
||||
if(is_array(_surf)) {
|
||||
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 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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var pos = inputs[| 2].getValue();
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
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[| 1].drawOverlay(active, px, py, _s, _mx, _my, 0, 64, THEME.anchor_scale_hori);
|
||||
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index) {
|
||||
|
|
|
@ -330,8 +330,8 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
|
|||
surface_update();
|
||||
}
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
if(!_active) return;
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
if(!active) return;
|
||||
if(keyboard_check(vk_alt)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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_line_size(mouse_pre_draw_x, mouse_pre_draw_y, mouse_cur_x, mouse_cur_y, _siz, _brush);
|
||||
|
||||
|
|
|
@ -39,13 +39,13 @@ function Node_Checker(_x, _y) : Node(_x, _y) constructor {
|
|||
["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 px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var pos = inputs[| 1].getValue();
|
||||
var px = _x + pos[0] * _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) {
|
||||
|
|
|
@ -9,6 +9,27 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
|
|||
custom_input_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) {
|
||||
ds_list_add(nodes, _node);
|
||||
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() {
|
||||
sortIO();
|
||||
deserialize(keyframe_scale);
|
||||
deserialize(load_map, load_scale);
|
||||
}
|
||||
|
||||
static sortIO = function() {
|
||||
|
@ -164,20 +185,9 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
static resetRenderStatus = function() {
|
||||
for( var i = 0; i < ds_list_size(nodes); i++ ) {
|
||||
nodes[| i].setRenderStatus(false);
|
||||
nodes[| i].setUpdate();
|
||||
if(variable_struct_exists(nodes[| i], "nodes"))
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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[| 1] = nodeValue(1, "Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
_input = -1;
|
||||
|
|
|
@ -233,7 +233,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
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 ww = overlay_w;
|
||||
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_rectangle_border(_dx0, _dy0, _dx1, _dy1, 2);
|
||||
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
surf_dragging = hovering;
|
||||
input_dragging = hovering + 1;
|
||||
drag_type = hovering_type;
|
||||
|
@ -376,7 +376,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
dragging_my = _my;
|
||||
}
|
||||
} else if(hovering_type == 1) { //rot
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
surf_dragging = hovering;
|
||||
input_dragging = hovering + 2;
|
||||
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);
|
||||
}
|
||||
} else if(hovering_type == 2) { //sca
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
surf_dragging = hovering;
|
||||
input_dragging = hovering + 3;
|
||||
drag_type = hovering_type;
|
||||
|
|
|
@ -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[| 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);
|
||||
|
||||
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) {
|
||||
var time = ANIMATOR.current_frame;
|
||||
var spd = _data[1];
|
||||
var val = _data[0] + time * spd;
|
||||
var mode = inputs[| 2].getValue();
|
||||
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;
|
||||
}
|
||||
|
@ -28,6 +51,6 @@ function Node_Counter(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
|||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
drag_my = 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;
|
||||
|
||||
var _inSurf = current_data[0];
|
||||
|
@ -54,7 +54,7 @@ function Node_Crop(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
if(inputs[| 1].setValue(_splice))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
if(mouse_release(mb_left, active)) {
|
||||
drag_side = -1;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
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) {
|
||||
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_mx = _mx;
|
||||
drag_my = _my;
|
||||
|
|
|
@ -6,6 +6,7 @@ function Node(_x, _y) constructor {
|
|||
icon = noone;
|
||||
bg_spr = THEME.node_bg;
|
||||
bg_sel_spr = THEME.node_active;
|
||||
anim_priority = ds_map_size(NODE_MAP);
|
||||
|
||||
if(!LOADING && !APPENDING) {
|
||||
recordAction(ACTION_TYPE.node_added, self);
|
||||
|
@ -122,16 +123,14 @@ function Node(_x, _y) constructor {
|
|||
if(update_on_frame)
|
||||
doUpdate();
|
||||
for(var i = 0; i < ds_list_size(inputs); i++) {
|
||||
if(inputs[| i].isAnim()) {
|
||||
if(inputs[| i].isAnimated())
|
||||
stack_push = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(stack_push) {
|
||||
setRenderStatus(false);
|
||||
UPDATE |= RENDER_TYPE.full;
|
||||
//ds_stack_push(RENDER_STACK, self);
|
||||
UPDATE |= RENDER_TYPE.partial;
|
||||
}
|
||||
|
||||
if(auto_height)
|
||||
|
@ -150,7 +149,7 @@ function Node(_x, _y) constructor {
|
|||
static onValueUpdate = function(index) {}
|
||||
|
||||
static isUpdateReady = function() {
|
||||
if(rendered) return false;
|
||||
//if(rendered) return false;
|
||||
|
||||
for(var j = 0; j < ds_list_size(inputs); j++) {
|
||||
var _in = inputs[| j];
|
||||
|
@ -176,8 +175,9 @@ function Node(_x, _y) constructor {
|
|||
var jun = outputs[| i];
|
||||
for(var j = 0; j < ds_list_size(jun.value_to); j++) {
|
||||
var _to = jun.value_to[| j];
|
||||
if(_to.value_from == jun)
|
||||
_to.node.triggerRender();
|
||||
if(_to.value_from != jun) continue;
|
||||
|
||||
_to.node.triggerRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,6 +186,9 @@ function Node(_x, _y) constructor {
|
|||
|
||||
static setRenderStatus = function(result) {
|
||||
rendered = result;
|
||||
|
||||
if(!result && group != -1)
|
||||
group.setRenderStatus(result);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
var cc = COLORS._main_text;
|
||||
if(PREF_MAP[? "node_show_render_status"])
|
||||
cc = rendered? COLORS._main_text : COLORS._main_value_negative;
|
||||
if(PREF_MAP[? "node_show_render_status"] && !rendered)
|
||||
cc = isUpdateReady()? COLORS._main_value_positive : COLORS._main_value_negative;
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, cc);
|
||||
|
||||
if(!auto_update) icon = THEME.refresh_s;
|
||||
var ts = clamp(power(_s, 0.5), 0.5, 1);
|
||||
if(icon) {
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {}
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {}
|
||||
|
||||
static destroy = function(_merge = false) {
|
||||
active = false;
|
||||
|
@ -595,23 +600,36 @@ function Node(_x, _y) constructor {
|
|||
var _ou = outputs[| i];
|
||||
for(var j = 0; j < ds_list_size(_ou.value_to); j++) {
|
||||
var _to = _ou.value_to[| j];
|
||||
if(_to.value_from == _ou && _to.node.active && _to.node.group != group) {
|
||||
var output_node = noone;
|
||||
switch(_type) {
|
||||
case "group" : output_node = new Node_Group_Output(x + w + 64, y, group); break;
|
||||
case "loop" : output_node = new Node_Iterator_Output(x + w + 64, y, group); break;
|
||||
}
|
||||
|
||||
if(output_node == noone) continue;
|
||||
ds_list_add(group.nodes, output_node);
|
||||
|
||||
_to.setFrom(output_node.outParent);
|
||||
output_node.inputs[| 0].setFrom(_ou);
|
||||
if(_to.value_from != _ou) continue;
|
||||
if(!_to.node.active) continue;
|
||||
if(_to.node.group == group) continue;
|
||||
|
||||
var output_node = noone;
|
||||
switch(_type) {
|
||||
case "group" : output_node = new Node_Group_Output(x + w + 64, y, group); break;
|
||||
case "loop" : output_node = new Node_Iterator_Output(x + w + 64, y, group); break;
|
||||
}
|
||||
|
||||
if(output_node == noone) continue;
|
||||
ds_list_add(group.nodes, output_node);
|
||||
|
||||
_to.setFrom(output_node.outParent);
|
||||
output_node.inputs[| 0].setFrom(_ou);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
var _map = ds_map_create();
|
||||
|
||||
|
@ -644,11 +662,11 @@ function Node(_x, _y) constructor {
|
|||
}
|
||||
static doSerialize = function(_map) {}
|
||||
|
||||
keyframe_scale = false;
|
||||
load_scale = false;
|
||||
load_map = -1;
|
||||
static deserialize = function(_map, scale = false, preset = false) {
|
||||
load_map = _map;
|
||||
keyframe_scale = scale;
|
||||
load_scale = scale;
|
||||
|
||||
if(!preset) {
|
||||
if(APPENDING) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var pos = inputs[| 1].getValue();
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
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[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index) {
|
||||
|
|
|
@ -67,11 +67,13 @@ function Node_Frame(_x, _y) : Node(_x, _y) constructor {
|
|||
active_draw_index = -1;
|
||||
}
|
||||
|
||||
var _re_x = (x + w - 4) * _s + _x;
|
||||
var _re_y = (y + h - 4) * _s + _y;
|
||||
draw_sprite_ext(THEME.node_resize, 0, _re_x, _re_y, 1, 1, 0, c_white, 0.5);
|
||||
if(!name_hover && point_in_rectangle(_mx, _my, _re_x - 16 * _s, _re_y - 16 * _s, _re_x + 4 * _s, _re_y + 4 * _s)) {
|
||||
draw_sprite_ext(THEME.node_resize, 0, _re_x, _re_y, 1, 1, 0, c_white, 1);
|
||||
var x1 = xx + w * _s;
|
||||
var y1 = yy + h * _s;
|
||||
var x0 = xx + w * _s - 16 * _s;
|
||||
var y0 = yy + h * _s - 16 * _s;
|
||||
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;
|
||||
|
||||
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) {
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
var xx = x * _s + _x + w * _s;
|
||||
var yy = y * _s + _y + h * _s;
|
||||
draw_set_font(f_h5);
|
||||
var ww = (string_width(name) + 16) / _s;
|
||||
var hh = (string_height(name) + 16) / _s;
|
||||
|
||||
var _x0 = max(xx + 16, xx - ww);
|
||||
var _y0 = max(yy + 16, yy - hh);
|
||||
var _x0 = xx - ww;
|
||||
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;
|
||||
//print(string(_my) + ", " + string(_y0));
|
||||
|
||||
return hover;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor {
|
|||
["Shape", false], 2, 3, 4, 6
|
||||
];
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 6].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 6].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -76,6 +76,8 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
|
|||
|
||||
case VALUE_DISPLAY.slider_range :
|
||||
inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]);
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.rotation_range :
|
||||
if(!is_array(_val) || array_length(_val) != 2)
|
||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||
|
@ -130,9 +132,8 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
|
|||
break;
|
||||
}
|
||||
|
||||
if(index == 5) {
|
||||
if(index == 5)
|
||||
group.sortIO();
|
||||
}
|
||||
}
|
||||
|
||||
static createInput = function(override_order = true) {
|
||||
|
|
|
@ -119,7 +119,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
|
|||
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;
|
||||
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(0, fr_y1, room_width, fr_y1, 1);
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
if(mouse_release(mb_left, active)) {
|
||||
bound_drag = 0;
|
||||
|
||||
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]]);
|
||||
}
|
||||
}
|
||||
} else if(mouse_press(mb_left, _active)) {
|
||||
} else if(mouse_press(mb_left, active)) {
|
||||
bound_drag = 1;
|
||||
bound_sx = _ex;
|
||||
bound_sy = _ey;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
enum ITERATION_STATUS {
|
||||
not_ready,
|
||||
loop,
|
||||
complete,
|
||||
}
|
||||
|
||||
function Node_create_Iterate(_x, _y) {
|
||||
var node = new Node_Iterate(_x, _y);
|
||||
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;
|
||||
loop_start_time = 0;
|
||||
|
||||
static setRenderStatus = function(result) {
|
||||
rendered = result;
|
||||
if(!rendered) {
|
||||
iterated = 0;
|
||||
loop_start_time = get_timer();
|
||||
}
|
||||
static postSetRenderStatus = function(result) {
|
||||
if(rendered) return;
|
||||
|
||||
iterated = 0;
|
||||
loop_start_time = get_timer();
|
||||
}
|
||||
|
||||
static outputRendered = function() {
|
||||
static iterationStatus = function() {
|
||||
var iter = true;
|
||||
for( var i = 0; i < ds_list_size(outputs); i++ ) {
|
||||
var _out = outputs[| i].node;
|
||||
|
@ -34,14 +39,14 @@ function Node_Iterate(_x, _y) : Node_Collection(_x, _y) constructor {
|
|||
if(iter) {
|
||||
if(++iterated == inputs[| 0].getValue()) {
|
||||
render_time = get_timer() - loop_start_time;
|
||||
return 2;
|
||||
return ITERATION_STATUS.complete;
|
||||
} else if(iterated > inputs[| 0].getValue())
|
||||
return 3;
|
||||
return ITERATION_STATUS.complete;
|
||||
|
||||
resetRenderStatus();
|
||||
return 1;
|
||||
return ITERATION_STATUS.loop;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ITERATION_STATUS.not_ready;
|
||||
}
|
||||
}
|
|
@ -100,6 +100,8 @@ function Node_Iterator_Input(_x, _y, _group) : Node(_x, _y) constructor {
|
|||
|
||||
case VALUE_DISPLAY.slider_range :
|
||||
inParent.setDisplay(_dtype, [_range[0], _range[1], 0.01]);
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.rotation_range :
|
||||
if(!is_array(_val) || array_length(_val) != 2)
|
||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||
|
|
|
@ -78,9 +78,9 @@ function valueAnimator(_val, _prop) constructor {
|
|||
if(prop.display_type == VALUE_DISPLAY.gradient) return processType(values);
|
||||
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) == 1) return processType(values[| 0].value);
|
||||
if(!is_anim) return processType(values[| 0].value);
|
||||
|
||||
if(ds_list_size(values) > 1) {
|
||||
var _time_first = values[| 0].time;
|
||||
|
@ -274,6 +274,7 @@ function valueAnimator(_val, _prop) constructor {
|
|||
static deserialize = function(_list, scale = false) {
|
||||
var base = getValue();
|
||||
ds_list_clear(values);
|
||||
|
||||
for(var i = 0; i < ds_list_size(_list); i++) {
|
||||
var _key = _list[| i];
|
||||
var _time = _key[| 0];
|
||||
|
|
|
@ -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)
|
||||
.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 = [
|
||||
["Output", true], 0, 1,
|
||||
["Line data", false], 6, 7, 2,
|
||||
["Line settings", false], 3, 8, 9,
|
||||
["Line settings", false], 3, 11, 8, 9,
|
||||
["Wiggle", false], 4, 5,
|
||||
["Render", false], 10
|
||||
];
|
||||
|
||||
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
|
||||
|
||||
display_reset(0, 1);
|
||||
|
||||
static update = function() {
|
||||
var _dim = inputs[| 0].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 _col_data = inputs[| 10].getExtraData();
|
||||
var _widc = inputs[| 11].getValue();
|
||||
|
||||
var _rat = max(_ratio[0], _ratio[1]) - min(_ratio[0], _ratio[1]);
|
||||
var _rats = min(_ratio[0], _ratio[1]);
|
||||
var _rtStr = min(_ratio[0], _ratio[1]);
|
||||
var _rtLen = max(_ratio[0], _ratio[1]) - _rtStr;
|
||||
|
||||
var _use_path = _pat != 0 && instanceof(_pat) == "Node_Path";
|
||||
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;
|
||||
|
||||
if(_use_path) {
|
||||
var ww = _rat / _seg;
|
||||
var ww = _rtLen / _seg;
|
||||
|
||||
var _total = _rat;
|
||||
var _prog_curr = frac(_shift + _rats) - ww;
|
||||
var _total = _rtLen;
|
||||
var _prog_curr = frac(_shift + _rtStr) - ww;
|
||||
var _prog = _prog_curr + 1;
|
||||
var _prog_eli = 0;
|
||||
|
||||
|
@ -110,13 +111,14 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
|
|||
_nx = p[0];
|
||||
_ny = p[1];
|
||||
|
||||
if(_total < _rat) {
|
||||
if(_total < _rtLen) {
|
||||
var _d = point_direction(_ox, _oy, _nx, _ny);
|
||||
_nx += lengthdir_x(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 *= eval_bezier_cubic(1 - _prog_curr, _widc[0], _widc[1], _widc[2], _widc[3]);
|
||||
|
||||
if(_total <= _prog_curr - _prog) {
|
||||
_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 _nna = point_direction(_nx, _ny, np[0], np[1]) + 90;
|
||||
|
||||
if(_total == _rat)
|
||||
if(_total == _rtLen)
|
||||
_na = _nna;
|
||||
else {
|
||||
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) {
|
||||
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);
|
||||
_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 _d = point_direction(x0, y0, x1, y1);
|
||||
|
||||
var ww = _rat / _seg;
|
||||
var _total = _rat;
|
||||
var _prog_curr = frac(_shift + _rats) - ww;
|
||||
var ww = _rtLen / _seg;
|
||||
var _total = _rtLen;
|
||||
var _prog_curr = frac(_shift + _rtStr) - ww;
|
||||
var _prog = _prog_curr + 1;
|
||||
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);
|
||||
|
||||
_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) {
|
||||
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);
|
||||
_total -= (_prog_curr - _prog);
|
||||
}
|
||||
|
|
|
@ -69,9 +69,9 @@ function Node_Math(_x, _y) : Node(_x, _y) constructor {
|
|||
case MATH_OPERATOR.add : return a + b;
|
||||
case MATH_OPERATOR.subtract : return a - b;
|
||||
case MATH_OPERATOR.multiply : return a * b;
|
||||
case MATH_OPERATOR.divide : return a / b;
|
||||
case MATH_OPERATOR.divide : return b == 0? 0 : 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.cos : return cos(degtorad(a)) * b;
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var _pos = inputs[| 1].getValue();
|
||||
var _ang = inputs[| 2].getValue();
|
||||
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_line(dx0, dy0, dx1, dy1);
|
||||
|
||||
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(_active, _posx, _posy, _s, _mx, _my);
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(active, _posx, _posy, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index) {
|
||||
|
|
12
scripts/node_noise/node_gradient.yy
Normal file
12
scripts/node_noise/node_gradient.yy
Normal 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",
|
||||
}
|
45
scripts/node_noise/node_noise.gml
Normal file
45
scripts/node_noise/node_noise.gml
Normal 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();
|
||||
}
|
11
scripts/node_noise/node_noise.yy
Normal file
11
scripts/node_noise/node_noise.yy
Normal 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",
|
||||
},
|
||||
}
|
12
scripts/node_noise/node_perlin.yy
Normal file
12
scripts/node_noise/node_perlin.yy
Normal 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",
|
||||
}
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var pos = inputs[| 4].getValue();
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 5].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index) {
|
||||
|
|
|
@ -514,10 +514,10 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
if(onDrawOverlay != -1)
|
||||
onDrawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
onDrawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static onDrawOverlay = -1;
|
||||
|
|
|
@ -61,8 +61,8 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
current_data = [];
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
|
||||
var parts = inputs[| 0].getValue();
|
||||
if(!parts) return;
|
||||
|
|
|
@ -32,7 +32,9 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
tools = [
|
||||
[ "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 = [];
|
||||
|
@ -45,7 +47,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
|
|||
drag_point_sx = 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 loop = inputs[| 1].getValue();
|
||||
var ansize = ds_list_size(inputs) - list_start;
|
||||
|
@ -54,40 +56,108 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
|
|||
var dx = drag_point_sx + (_mx - drag_point_mx) / _s;
|
||||
var dy = drag_point_sy + (_my - drag_point_my) / _s;
|
||||
|
||||
var inp = inputs[| list_start + drag_point];
|
||||
var anc = inp.getValue();
|
||||
if(drag_type == 0) {
|
||||
anc[0] = dx;
|
||||
anc[1] = dy;
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[0] = round(anc[0]);
|
||||
anc[1] = round(anc[1]);
|
||||
}
|
||||
} else if(drag_type == 1) {
|
||||
anc[2] = dx - anc[0];
|
||||
anc[3] = dy - anc[1];
|
||||
anc[4] = -anc[2];
|
||||
anc[5] = -anc[3];
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[2] = round(anc[2]);
|
||||
anc[3] = round(anc[3]);
|
||||
anc[4] = round(anc[4]);
|
||||
anc[5] = round(anc[5]);
|
||||
}
|
||||
} else if(drag_type == -1) {
|
||||
anc[4] = dx - anc[0];
|
||||
anc[5] = dy - anc[1];
|
||||
anc[2] = -anc[4];
|
||||
anc[3] = -anc[5];
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[2] = round(anc[2]);
|
||||
anc[3] = round(anc[3]);
|
||||
anc[4] = round(anc[4]);
|
||||
anc[5] = round(anc[5]);
|
||||
}
|
||||
}
|
||||
if(drag_type < 2) {
|
||||
var inp = inputs[| list_start + drag_point];
|
||||
var anc = inp.getValue();
|
||||
if(drag_type == 0) {
|
||||
anc[0] = dx;
|
||||
anc[1] = dy;
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[0] = round(anc[0]);
|
||||
anc[1] = round(anc[1]);
|
||||
}
|
||||
} else if(drag_type == 1) {
|
||||
anc[2] = dx - anc[0];
|
||||
anc[3] = dy - anc[1];
|
||||
anc[4] = -anc[2];
|
||||
anc[5] = -anc[3];
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[2] = round(anc[2]);
|
||||
anc[3] = round(anc[3]);
|
||||
anc[4] = round(anc[4]);
|
||||
anc[5] = round(anc[5]);
|
||||
}
|
||||
} else if(drag_type == -1) {
|
||||
anc[4] = dx - anc[0];
|
||||
anc[5] = dy - anc[1];
|
||||
anc[2] = -anc[4];
|
||||
anc[3] = -anc[5];
|
||||
if(keyboard_check(vk_control)) {
|
||||
anc[2] = round(anc[2]);
|
||||
anc[3] = round(anc[3]);
|
||||
anc[4] = round(anc[4]);
|
||||
anc[5] = round(anc[5]);
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
|
||||
inp.setValue(anc);
|
||||
if(mouse_release(mb_left))
|
||||
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) {
|
||||
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) {
|
||||
_a[2] = 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) {
|
||||
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);
|
||||
doUpdate();
|
||||
}
|
||||
} else {
|
||||
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_type = hover_type;
|
||||
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) {
|
||||
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;
|
||||
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_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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, "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, "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 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();
|
||||
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 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, "Noise", s_node_noise, "Node_Noise", Node_create_Noise);
|
||||
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, "Grid noise", s_node_grid_noise, "Node_Grid_Noise", Node_create_Grid_Noise);
|
||||
|
|
|
@ -50,8 +50,8 @@ function Node_Scatter(_x, _y) : Node(_x, _y) constructor {
|
|||
|
||||
temp_surf = [ PIXEL_SURFACE, PIXEL_SURFACE ];
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 5].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -6,7 +6,7 @@ function Node_create_Seperate_Shape(_x, _y) {
|
|||
|
||||
function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
|
||||
name = "Separate shape";
|
||||
//auto_update = false;
|
||||
auto_update = false;
|
||||
|
||||
uniform_it_dim = shader_get_uniform(sh_seperate_shape_ite, "dimension");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var _surf = outputs[| 0].getValue();
|
||||
if(is_array(_surf)) {
|
||||
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 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) {
|
||||
|
|
|
@ -28,6 +28,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
uniform_aa = shader_get_uniform(shader, "aa");
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
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 )
|
||||
.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[| 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);
|
||||
|
||||
input_display_list = [
|
||||
["Surface", false], 0, 6,
|
||||
["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) {
|
||||
inputs[| 3].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
}
|
||||
|
||||
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 _corner = _data[9];
|
||||
var _color = _data[10];
|
||||
var _df = _data[12];
|
||||
var _bgcol = _bg? colToVec4(_data[11]) : [0, 0, 0, 0];
|
||||
|
||||
inputs[| 11].setVisible(_bg);
|
||||
|
@ -141,7 +145,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
shader_set_uniform_f_array(uniform_arange, [ sin(range), cos(range) ] );
|
||||
shader_set_uniform_f(uniform_inner, _data[5] / 2);
|
||||
break;
|
||||
case NODE_SHAPE_TYPE.capsule :
|
||||
case NODE_SHAPE_TYPE.capsule :
|
||||
inputs[| 4].setVisible(false);
|
||||
inputs[| 5].setVisible(false);
|
||||
inputs[| 7].setVisible(false);
|
||||
|
@ -154,6 +158,7 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
shader_set_uniform_i(uniform_shape, _shape);
|
||||
shader_set_uniform_f_array(uniform_bgCol, _bgcol);
|
||||
shader_set_uniform_i(uniform_aa, _aa);
|
||||
shader_set_uniform_i(uniform_drawDF, _df);
|
||||
shader_set_uniform_f(uniform_corner, _corner);
|
||||
|
||||
shader_set_uniform_f_array(uniform_cent, [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]);
|
||||
|
|
|
@ -36,13 +36,13 @@ function Node_Sprite_Stack(_x, _y) : Node(_x, _y) constructor {
|
|||
["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 px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 5].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 5].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -50,13 +50,13 @@ function Node_Stripe(_x, _y) : Node(_x, _y) constructor {
|
|||
["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 px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
inputs[| 4].drawOverlay(_active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(_active, px, py, _s, _mx, _my);
|
||||
inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my);
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
|
|
|
@ -149,6 +149,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
var ww = surface_get_width(ins);
|
||||
var hh = surface_get_height(ins);
|
||||
var _ww = ww, _hh = hh;
|
||||
if(_ww <= 1 && _hh <= 1) return _outSurf;
|
||||
|
||||
switch(out_type) {
|
||||
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_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;
|
||||
|
||||
var _surf = inputs[| 0].getValue();
|
||||
|
@ -424,7 +425,7 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
UNDO_HOLDING = false;
|
||||
}
|
||||
} else {
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
if(point_in_circle(_mx, _my, bax, bay, 8)) {
|
||||
overlay_dragging = 2;
|
||||
overlay_drag_mx = _mx;
|
||||
|
|
|
@ -53,7 +53,7 @@ function Node_Transform_Single(_x, _y) : Node_Processor(_x, _y) constructor {
|
|||
overlay_drag_ma = 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;
|
||||
|
||||
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))
|
||||
overlay_dragging = 0;
|
||||
} else {
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
if(point_in_circle(_mx, _my, bax, bay, 8)) {
|
||||
overlay_dragging = 2;
|
||||
overlay_drag_mx = _mx;
|
||||
|
|
|
@ -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);
|
||||
|
||||
static drawOverlay = function(_active, _x, _y, _s, _mx, _my) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
|
||||
var pos = inputs[| 1].getValue();
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
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[| 1].drawOverlay(active, _x, _y, _s, _mx, _my);
|
||||
inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, 0, 1, THEME.anchor_scale_hori);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index) {
|
||||
|
|
|
@ -368,8 +368,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
|
|||
case VALUE_TYPE.curve :
|
||||
visible = false;
|
||||
display_type = VALUE_DISPLAY.curve;
|
||||
editWidget = new curveBox(
|
||||
function(_modified) { setValue(_modified); });
|
||||
editWidget = new curveBox(function(_modified) { setValue(_modified); });
|
||||
break;
|
||||
case VALUE_TYPE.text :
|
||||
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() {
|
||||
return animator.is_anim || node.update_on_frame;
|
||||
}
|
||||
static isAnim = function() {
|
||||
static isAnimated = function() {
|
||||
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() {
|
||||
|
@ -598,8 +597,11 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
|
|||
//show_debug_message("connected " + name + " to " + _valueFrom.name)
|
||||
|
||||
node.onValueUpdate(index, _o);
|
||||
if(_update) node.updateValueFrom(index);
|
||||
if(_update && node.auto_update) _valueFrom.node.triggerRender();
|
||||
if(_update) {
|
||||
node.updateValueFrom(index);
|
||||
node.triggerRender();
|
||||
if(node.use_cache) node.clearCache();
|
||||
}
|
||||
|
||||
MODIFIED = true;
|
||||
return true;
|
||||
|
@ -679,7 +681,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
|
|||
drag_my = 0;
|
||||
drag_sx = 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 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)) {
|
||||
hover = 1;
|
||||
index = 1;
|
||||
if(_mouse_press(mb_left, active)) {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
drag_type = 1;
|
||||
drag_mx = _mx;
|
||||
drag_my = _my;
|
||||
|
@ -764,7 +766,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
|
|||
hover = 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_mx = _mx;
|
||||
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)) {
|
||||
hover = 1;
|
||||
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_mx = _mx;
|
||||
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)) {
|
||||
hover = 2;
|
||||
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)) {
|
||||
hover = 1;
|
||||
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_mx = _mx;
|
||||
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)) {
|
||||
hover = 2;
|
||||
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_mx = _mx;
|
||||
drag_my = _my;
|
||||
|
|
|
@ -7,7 +7,7 @@ function Node_create_Wiggler(_x, _y) {
|
|||
function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
||||
name = "Wiggler";
|
||||
update_on_frame = true;
|
||||
previewable = false;
|
||||
previewable = false;
|
||||
|
||||
w = 96;
|
||||
min_h = 0;
|
||||
|
@ -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])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue(1, "Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 3, 5 ] )
|
||||
.setDisplay(VALUE_DISPLAY.slider_range, [1, 32, 1]);
|
||||
inputs[| 1] = nodeValue(1, "Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 )
|
||||
.setDisplay(VALUE_DISPLAY.slider, [1, 32, 1]);
|
||||
|
||||
inputs[| 2] = nodeValue(2, "Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(9999999) );
|
||||
|
||||
|
@ -37,34 +37,27 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
|||
var fre = inputs[| 1].getValue();
|
||||
var sed = inputs[| 2].getValue();
|
||||
|
||||
var _fmin = ANIMATOR.frames_total / max(1, min(fre[0], fre[1]));
|
||||
var _fmax = ANIMATOR.frames_total / max(1, max(fre[0], fre[1]));
|
||||
var _val;
|
||||
|
||||
for( var i = 0; i < ANIMATOR.frames_total + 1; i++ ) {
|
||||
_val = getWiggle(ran[0], ran[1], _fmin, _fmax, i, sed);
|
||||
random_value[i] = _val;
|
||||
var step = ANIMATOR.frames_total / 64;
|
||||
for( var i = 0; i < 64; i++ ) {
|
||||
random_value[i] = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, step * i, sed, 0, ANIMATOR.frames_total);
|
||||
}
|
||||
}
|
||||
|
||||
function process_value_data(_data, index = 0) {
|
||||
if(array_length(random_value) != ANIMATOR.frames_total + 1) {
|
||||
array_resize(random_value, ANIMATOR.frames_total + 1);
|
||||
onValueUpdate(0);
|
||||
}
|
||||
|
||||
var ran = inputs[| 0].getValue();
|
||||
var fre = inputs[| 1].getValue();
|
||||
var sed = inputs[| 2].getValue();
|
||||
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();
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
||||
if(array_length(random_value) != ANIMATOR.frames_total + 1) {
|
||||
array_resize(random_value, ANIMATOR.frames_total + 1);
|
||||
onValueUpdate(0);
|
||||
}
|
||||
|
||||
var ran = inputs[| 0].getValue();
|
||||
var fre = inputs[| 1].getValue();
|
||||
var sed = inputs[| 2].getValue();
|
||||
var disp = inputs[| 3].getValue();
|
||||
var time = ANIMATOR.current_frame;
|
||||
var total_time = ANIMATOR.frames_total;
|
||||
|
@ -73,7 +66,7 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
|||
case 0 :
|
||||
min_h = 0;
|
||||
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);
|
||||
draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, str, ss, ss, 0);
|
||||
break;
|
||||
|
@ -81,16 +74,10 @@ function Node_Wiggler(_x, _y) : Node_Value_Processor(_x, _y) constructor {
|
|||
w = 128;
|
||||
min_h = 96;
|
||||
|
||||
var ran = inputs[| 0].getValue();
|
||||
var fre = inputs[| 1].getValue();
|
||||
var sed = inputs[| 2].getValue();
|
||||
|
||||
var _min = ran[0];
|
||||
var _max = ran[1];
|
||||
var val = (_min + _max) / 2;
|
||||
var _ran = _max - _min;
|
||||
var _fmin = max(1, fre[0]);
|
||||
var _fmax = max(1, fre[1]);
|
||||
|
||||
var x0 = xx + 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);
|
||||
draw_line(_fx, y0, _fx, y1);
|
||||
|
||||
var lw = ww / (array_length(random_value) - 1);
|
||||
draw_set_color(COLORS.node_wiggler_line);
|
||||
var lw = ww / (64 - 1);
|
||||
draw_set_color(COLORS.node_wiggler_frame);
|
||||
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 _y = yc - (random_value[i] - val) / (_ran * 2) * hh;
|
||||
if(i)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue