diff --git a/Pixels Composer.yyp b/Pixels Composer.yyp index ef1133700..f9b61815b 100644 --- a/Pixels Composer.yyp +++ b/Pixels Composer.yyp @@ -84,6 +84,7 @@ {"id":{"name":"s_node_array_find","path":"sprites/s_node_array_find/s_node_array_find.yy",},"order":2,}, {"id":{"name":"fd_rectangle_set_velocity_time_step","path":"scripts/fd_rectangle_set_velocity_time_step/fd_rectangle_set_velocity_time_step.yy",},"order":17,}, {"id":{"name":"fd_rectangle_set_collision_mask_sprite","path":"scripts/fd_rectangle_set_collision_mask_sprite/fd_rectangle_set_collision_mask_sprite.yy",},"order":1,}, + {"id":{"name":"node_iterate_each","path":"scripts/node_iterate_each/node_iterate_each.yy",},"order":0,}, {"id":{"name":"sh_flip","path":"shaders/sh_flip/sh_flip.yy",},"order":7,}, {"id":{"name":"s_node_alpha_grey","path":"sprites/s_node_alpha_grey/s_node_alpha_grey.yy",},"order":2,}, {"id":{"name":"node_blend","path":"scripts/node_blend/node_blend.yy",},"order":0,}, @@ -138,7 +139,7 @@ {"id":{"name":"sh_polar","path":"shaders/sh_polar/sh_polar.yy",},"order":1,}, {"id":{"name":"s_node_warp_mesh","path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},"order":10,}, {"id":{"name":"sh_pixel_cloud","path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},"order":13,}, - {"id":{"name":"node_iterate","path":"scripts/node_iterate/node_iterate.yy",},"order":1,}, + {"id":{"name":"node_iterate","path":"scripts/node_iterate/node_iterate.yy",},"order":0,}, {"id":{"name":"sh_de_stray","path":"shaders/sh_de_stray/sh_de_stray.yy",},"order":16,}, {"id":{"name":"sh_chromatic_aberration","path":"shaders/sh_chromatic_aberration/sh_chromatic_aberration.yy",},"order":31,}, {"id":{"name":"fd_rectangle_create_view","path":"scripts/fd_rectangle_create_view/fd_rectangle_create_view.yy",},"order":3,}, @@ -273,6 +274,7 @@ {"id":{"name":"distribution_function","path":"scripts/distribution_function/distribution_function.yy",},"order":12,}, {"id":{"name":"sh_blur_radial","path":"shaders/sh_blur_radial/sh_blur_radial.yy",},"order":9,}, {"id":{"name":"node_blur","path":"scripts/node_blur/node_blur.yy",},"order":0,}, + {"id":{"name":"node_iterator_each_input","path":"scripts/node_iterator_each_input/node_iterator_each_input.yy",},"order":1,}, {"id":{"name":"json_minify","path":"scripts/json_minify/json_minify.yy",},"order":6,}, {"id":{"name":"sh_fd_vortex","path":"shaders/sh_fd_vortex/sh_fd_vortex.yy",},"order":20,}, {"id":{"name":"s_node_loop","path":"sprites/s_node_loop/s_node_loop.yy",},"order":5,}, @@ -408,6 +410,7 @@ {"id":{"name":"o_dialog_preview_grid","path":"objects/o_dialog_preview_grid/o_dialog_preview_grid.yy",},"order":0,}, {"id":{"name":"fd_rectangle_set_velocity_size","path":"scripts/fd_rectangle_set_velocity_size/fd_rectangle_set_velocity_size.yy",},"order":16,}, {"id":{"name":"node_image_gif","path":"scripts/node_image_gif/node_image_gif.yy",},"order":6,}, + {"id":{"name":"node_iterator_each_output","path":"scripts/node_iterator_each_output/node_iterator_each_output.yy",},"order":2,}, {"id":{"name":"o_dialog_anim_time_scaler","path":"objects/o_dialog_anim_time_scaler/o_dialog_anim_time_scaler.yy",},"order":0,}, {"id":{"name":"boneObject","path":"scripts/boneObject/boneObject.yy",},"order":0,}, {"id":{"name":"sh_fd_advect_material_a_8_glsl","path":"shaders/sh_fd_advect_material_a_8_glsl/sh_fd_advect_material_a_8_glsl.yy",},"order":3,}, @@ -419,6 +422,7 @@ {"id":{"name":"node_feedback_input","path":"scripts/node_feedback_input/node_feedback_input.yy",},"order":1,}, {"id":{"name":"o_dialog_add_multiple_images","path":"objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy",},"order":0,}, {"id":{"name":"assets_data","path":"scripts/assets_data/assets_data.yy",},"order":0,}, + {"id":{"name":"s_node_loop_array","path":"sprites/s_node_loop_array/s_node_loop_array.yy",},"order":23,}, {"id":{"name":"sh_color_adjust","path":"shaders/sh_color_adjust/sh_color_adjust.yy",},"order":6,}, {"id":{"name":"sh_fd_visualize_thick_smoke_glsl","path":"shaders/sh_fd_visualize_thick_smoke_glsl/sh_fd_visualize_thick_smoke_glsl.yy",},"order":17,}, {"id":{"name":"surface_get_palette","path":"scripts/surface_get_palette/surface_get_palette.yy",},"order":2,}, @@ -805,7 +809,7 @@ {"id":{"name":"string_decimal","path":"scripts/string_decimal/string_decimal.yy",},"order":0,}, {"id":{"name":"_f_h3","path":"fonts/_f_h3/_f_h3.yy",},"order":3,}, {"id":{"name":"s_node_math","path":"sprites/s_node_math/s_node_math.yy",},"order":1,}, - {"id":{"name":"node_iterator_index","path":"scripts/node_iterator_index/node_iterator_index.yy",},"order":4,}, + {"id":{"name":"node_iterator_index","path":"scripts/node_iterator_index/node_iterator_index.yy",},"order":2,}, {"id":{"name":"node_greyscale","path":"scripts/node_greyscale/node_greyscale.yy",},"order":5,}, {"id":{"name":"node_color_adjustment","path":"scripts/node_color_adjustment/node_color_adjustment.yy",},"order":1,}, {"id":{"name":"s_node_array_reverse","path":"sprites/s_node_array_reverse/s_node_array_reverse.yy",},"order":8,}, @@ -1140,6 +1144,8 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy","order":0,}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy","order":6,}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for","folderPath":"folders/nodes/data/iterate/for.yy","order":0,}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for each","folderPath":"folders/nodes/data/iterate/for each.yy","order":1,}, ], "AudioGroups": [ {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index fcf588e4d..8a11a11b8 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -22,12 +22,60 @@ event_inherited(); node_selecting = 0; node_focusing = -1; + node_show_connectable = true; + anchor = ANCHOR.left | ANCHOR.top; + function filtered(node) { + if(!node_show_connectable) return true; + if(node_called == noone && junction_hovering == noone) return true; + if(!struct_has(global.NODE_GUIDE, node.node)) return true; + + var io = global.NODE_GUIDE[$ node.node]; + + if(node_called) { + var call_in = node_called.connect_type == JUNCTION_CONNECT.input; + var ar = call_in? io.outputs : io.inputs; + var typ = node_called.type; + + for( var i = 0; i < array_length(ar); i++ ) { + var _in = call_in? node_called.type : ar[i]; + var _ot = call_in? ar[i] : node_called.type; + + if(typeCompatible(_in, _ot, false)) return true; + } + + return false; + } else if(junction_hovering) { + var to = junction_hovering.type; + var fr = junction_hovering.value_from.type; + + for( var i = 0; i < array_length(io.inputs); i++ ) { + var _in = fr; + var _ot = io.inputs[i]; + + if(typeCompatible(_in, _ot, false)) return true; + } + + for( var i = 0; i < array_length(io.outputs); i++ ) { + var _in = io.outputs[i]; + var _ot = to; + + if(typeCompatible(_in, _ot, false)) return true; + } + + return false; + } + + return false; + } + function setPage(pageIndex) { ADD_NODE_PAGE = pageIndex; - node_list = NODE_CATEGORY[| ADD_NODE_PAGE].list; + node_list = pageIndex == -1? noone : NODE_CATEGORY[| ADD_NODE_PAGE].list; } + if(ADD_NODE_PAGE < 0) + ADD_NODE_PAGE = NODE_PAGE_DEFAULT; setPage(ADD_NODE_PAGE); function buildNode(_node, _param = "") { @@ -39,7 +87,7 @@ event_inherited(); var _new_node = noone; var _inputs = 0, _outputs = 0; - if(is_struct(_node) && instanceof(_node) == "NodeObject") { + if(instanceof(_node) == "NodeObject") { _new_node = _node.build(node_target_x, node_target_y,, _param); if(!_new_node) { instance_destroy(); @@ -86,11 +134,11 @@ event_inherited(); } //try to connect - if(node_called != noone) { + if(node_called != noone) { //dragging from junction var _node_list = node_called.connect_type == JUNCTION_CONNECT.input? _outputs : _inputs; for(var i = 0; i < ds_list_size(_node_list); i++) { var _target = _node_list[| i]; - if( _target.isVisible() && (value_bit(_target.type) & value_bit(node_called.type)) ) { + if(_target.auto_connect && (value_bit(_target.type) & value_bit(node_called.type)) ) { if(node_called.connect_type == JUNCTION_CONNECT.input) { node_called.setFrom(_node_list[| i]); _new_node.x -= _new_node.w; @@ -99,13 +147,13 @@ event_inherited(); break; } } - } else if(junction_hovering != noone) { + } else if(junction_hovering != noone) { //right click on junction var to = junction_hovering; var from = junction_hovering.value_from; for( var i = 0; i < ds_list_size(_inputs); i++ ) { var _in = _inputs[| i]; - if(value_bit(_in.type) & value_bit(from.type)) { + if(_in.auto_connect && _in.isConnectable(from)) { _in.setFrom(from); break; } @@ -113,7 +161,7 @@ event_inherited(); for( var i = 0; i < ds_list_size(_outputs); i++ ) { var _ot = _outputs[| i]; - if(value_bit(_ot.type) & value_bit(to.type)) { + if(to.isConnectable(_ot)) { to.setFrom(_ot); break; } @@ -124,26 +172,37 @@ event_inherited(); } catagory_pane = new scrollPane(ui(132), dialog_h - ui(66), function(_y, _m) { - draw_clear_alpha(COLORS.panel_bg_clear, 0); + draw_clear_alpha(COLORS._main_text, 0); var hh = 0; var hg = ui(28); - var cnt = PANEL_GRAPH.getCurrentContext(); - var context = cnt == -1? "" : instanceof(cnt); + var context = PANEL_GRAPH.getCurrentContext(); + context = context == -1? "" : instanceof(context); - for(var i = 0; i < ds_list_size(NODE_CATEGORY); i++) { - var cat = NODE_CATEGORY[| i]; - var name = cat.name; - draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + var start = -1; + + for(var i = start; i < ds_list_size(NODE_CATEGORY); i++) { + var name = ""; - if(cat.filter != "") { - if(context != cat.filter) { - if(ADD_NODE_PAGE == i) setPage(NODE_PAGE_DEFAULT); - continue; - } - draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_accent); + if(i == -1) { + draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_accent); + name = "All"; + } else { + var cat = NODE_CATEGORY[| i]; + name = cat.name; + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); + + if(array_length(cat.filter)) { + if(!array_exists(cat.filter, context)) { + if(ADD_NODE_PAGE == i) + setPage(NODE_PAGE_DEFAULT); + continue; + } + draw_set_color(COLORS._main_text_accent); + } } + BLEND_OVERRIDE; if(i == ADD_NODE_PAGE) { draw_sprite_stretched(THEME.ui_panel_bg, 0, 0, _y + hh, ui(132), hg); } else if(sHOVER && catagory_pane.hover && point_in_rectangle(_m[0], _m[1], 0, _y + hh, ui(100), _y + hh + hg - 1)) { @@ -151,9 +210,11 @@ event_inherited(); if(mouse_click(mb_left, sFOCUS)) { setPage(i); content_pane.scroll_y = 0; + content_pane.scroll_y_raw = 0; content_pane.scroll_y_to = 0; } } + BLEND_NORMAL; draw_text(ui(8), _y + hh + hg / 2, name); hh += hg; @@ -164,12 +225,30 @@ event_inherited(); content_pane = new scrollPane(dialog_w - ui(136), dialog_h - ui(66), function(_y, _m) { draw_clear_alpha(c_white, 0); - - var node_count = ds_list_size(node_list); var hh = 0; var _hover = sHOVER && content_pane.hover; + var _list = node_list; - if(PREF_MAP[? "dialog_add_node_view"] == 0) { + if(ADD_NODE_PAGE == -1) { + var context = PANEL_GRAPH.getCurrentContext(); + context = context == -1? "" : instanceof(context); + + _list = ds_list_create(); + for(var i = 0; i < ds_list_size(NODE_CATEGORY); i++) { + var cat = NODE_CATEGORY[| i]; + if(array_length(cat.filter) && !array_exists(cat.filter, context)) + continue; + + for( var j = 0; j < ds_list_size(cat.list); j++ ) { + if(is_string(cat.list[| j])) continue; + ds_list_add(_list, cat.list[| j]); + } + } + } + + var node_count = ds_list_size(_list); + + if(PREF_MAP[? "dialog_add_node_view"] == 0) { //grid var grid_size = ui(64); var grid_width = ui(80); var grid_space = ui(12); @@ -181,7 +260,7 @@ event_inherited(); hh += grid_space; for(var index = 0; index < node_count; index++) { - var _node = node_list[| index]; + var _node = _list[| index]; if(is_string(_node)) { if(!PREF_MAP[? "dialog_add_node_grouping"]) continue; @@ -191,9 +270,9 @@ event_inherited(); cProg = 0; curr_height = 0; - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite_stretched_ext(THEME.node_bg, 0, ui(16), yy, content_pane.surface_w - ui(32), ui(24), COLORS._main_icon, 1); - BLEND_NORMAL + BLEND_NORMAL; draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(ui(16 + 16), yy + ui(12), _node); @@ -202,13 +281,15 @@ event_inherited(); yy += ui(24 + 12); continue; } - + + if(!filtered(_node)) continue; + var _nx = grid_space + (grid_width + grid_space) * cProg; var _boxx = _nx + (grid_width - grid_size) / 2; - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size); - BLEND_NORMAL + BLEND_NORMAL; if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) { draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1); @@ -226,7 +307,7 @@ event_inherited(); draw_sprite_ui_uniform(THEME.node_new_badge, 0, _boxx + grid_size - ui(12), yy + ui(6)); draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text); - draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_width); + draw_text_ext_over(_boxx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_width); var name_height = string_height_ext(_node.name, -1, grid_width) + 8; curr_height = max(curr_height, grid_size + grid_space + name_height); @@ -242,14 +323,15 @@ event_inherited(); hh += curr_height; yy += curr_height; - } else if(PREF_MAP[? "dialog_add_node_view"] == 1) { + } else if(PREF_MAP[? "dialog_add_node_view"] == 1) { //list var list_width = content_pane.surface_w; var list_height = ui(28); - var yy = _y + list_height / 2; + var yy = _y + list_height / 2; + var bg_ind = 0; hh += list_height; - + for(var i = 0; i < node_count; i++) { - var _node = node_list[| i]; + var _node = _list[| i]; if(is_string(_node)) { if(!PREF_MAP[? "dialog_add_node_grouping"]) @@ -258,9 +340,9 @@ event_inherited(); hh += ui(8); yy += ui(8); - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite_stretched_ext(THEME.node_bg, 0, ui(8), yy, content_pane.surface_w - ui(24), ui(24), COLORS._main_icon, 1); - BLEND_NORMAL + BLEND_NORMAL; draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(ui(24), yy + ui(12), _node); @@ -270,10 +352,12 @@ event_inherited(); continue; } - if(i % 2) { - BLEND_OVERRIDE + if(!filtered(_node)) continue; + + if(++bg_ind % 2) { + BLEND_OVERRIDE; draw_sprite_stretched_ext(THEME.node_bg, 0, ui(4), yy, list_width - ui(8), list_height, c_white, 0.2); - BLEND_NORMAL + BLEND_NORMAL; } if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, list_width, yy + list_height - 1)) { @@ -299,13 +383,16 @@ event_inherited(); } draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text); - draw_text_add(tx, yy + list_height / 2, _node.name); + draw_text_over(tx, yy + list_height / 2, _node.name); yy += list_height; hh += list_height; } } + if(ADD_NODE_PAGE == -1) + ds_list_destroy(_list); + return hh; }); #endregion @@ -343,6 +430,7 @@ event_inherited(); function searchNodes() { ds_list_clear(search_list); + var pr_list = ds_priority_create(); var cnt = PANEL_GRAPH.getCurrentContext(); var context = cnt == -1? "" : instanceof(cnt); @@ -352,7 +440,7 @@ event_inherited(); for(var i = 0; i < ds_list_size(NODE_CATEGORY); i++) { var cat = NODE_CATEGORY[| i]; - if(cat.filter != "" && context != cat.filter) + if(array_length(cat.filter) && !array_exists(cat.filter, context)) continue; var _content = cat.list; @@ -362,25 +450,32 @@ event_inherited(); if(is_string(_node)) continue; if(ds_map_exists(search_map, _node.node)) continue; - var match = string_pos(search_lower, string_lower(_node.name)) > 0; + var match = string_partial_match(string_lower(_node.name), search_lower); var param = ""; for( var k = 0; k < array_length(_node.tags); k++ ) { - if(string_pos(search_lower, _node.tags[k]) == 0) - continue; - match = true; - param = _node.tags[k]; + var mat = string_partial_match(_node.tags[k], search_lower); + if(mat > match) { + match = mat; + param = _node.tags[k]; + } } - if(!match) continue; + if(match == -9999) continue; - ds_list_add(search_list, [_node, param]); + ds_priority_add(pr_list, [_node, param], match); search_map[? _node.node] = 1; } } ds_map_destroy(search_map); - searchCollection(search_list, search_string, false); + searchCollection(pr_list, search_string, false); + + repeat(ds_priority_size(pr_list)) { + ds_list_add(search_list, ds_priority_delete_max(pr_list)); + } + + ds_priority_destroy(pr_list); } search_pane = new scrollPane(dialog_w - ui(32), dialog_h - ui(66), function(_y, _m) { @@ -390,7 +485,7 @@ event_inherited(); var hh = 0; var _hover = sHOVER && search_pane.hover; - if(PREF_MAP[? "dialog_add_node_view"] == 0) { + if(PREF_MAP[? "dialog_add_node_view"] == 0) { //grid view var grid_size = ui(64); var grid_width = ui(80); var grid_space = ui(16); @@ -413,12 +508,12 @@ event_inherited(); var _nx = grid_space + (grid_width + grid_space) * index; var _boxx = _nx + (grid_width - grid_size) / 2; - BLEND_OVERRIDE + BLEND_OVERRIDE; if(is_array(s_res)) draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size); else draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.dialog_add_node_collection, 1); - BLEND_NORMAL + BLEND_NORMAL; if(variable_struct_exists(_node, "getSpr")) _node.getSpr(); if(sprite_exists(_node.spr)) { @@ -441,7 +536,7 @@ event_inherited(); draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text); var txt = _node.name; name_height = max(name_height, string_height_ext(txt, -1, grid_width) + ui(8)); - draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + 4, txt, -1, grid_width); + draw_text_ext_over(_boxx + grid_size / 2, yy + grid_size + 4, txt, -1, grid_width); if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) { node_selecting = i; @@ -466,7 +561,7 @@ event_inherited(); yy += hght; } } - } else if(PREF_MAP[? "dialog_add_node_view"] == 1) { + } else if(PREF_MAP[? "dialog_add_node_view"] == 1) { //list view var list_width = search_pane.surface_w; var list_height = ui(28); var yy = _y + list_height / 2; @@ -482,9 +577,9 @@ event_inherited(); _node = s_res; if(i % 2) { - BLEND_OVERRIDE + BLEND_OVERRIDE; draw_sprite_stretched_ext(THEME.node_bg, 0, ui(4), yy, list_width - ui(8), list_height, c_white, 0.2); - BLEND_NORMAL + BLEND_NORMAL; } if(variable_struct_exists(_node, "getSpr")) _node.getSpr(); @@ -506,7 +601,7 @@ event_inherited(); } draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text); - draw_text_add(list_height + ui(20), yy + list_height / 2, _node.name); + draw_text_over(list_height + ui(20), yy + list_height / 2, _node.name); if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, list_width, yy + list_height - 1)) { node_selecting = i; diff --git a/objects/o_dialog_add_node/Draw_64.gml b/objects/o_dialog_add_node/Draw_64.gml index 7cbcc324f..51dd927bb 100644 --- a/objects/o_dialog_add_node/Draw_64.gml +++ b/objects/o_dialog_add_node/Draw_64.gml @@ -31,20 +31,34 @@ if !ready exit; search_pane.draw(dialog_x + ui(16), dialog_y + ui(52)); } - tb_search.draw(dialog_x + ui(14), dialog_y + ui(14), dialog_w - ui(96), ui(32), search_string, mouse_ui); + var tw = dialog_w - ui(96); + if(node_called != noone || junction_hovering != noone) + tw -= ui(32); + tb_search.draw(dialog_x + ui(14), dialog_y + ui(14), tw, ui(32), search_string, mouse_ui); var bx = dialog_x + dialog_w - ui(44); var by = dialog_y + ui(16); var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, - PREF_MAP[? "dialog_add_node_view"]? "List view" : "Grid view", THEME.view_mode, PREF_MAP[? "dialog_add_node_view"], COLORS._main_icon); + PREF_MAP[? "dialog_add_node_view"]? get_text("view_list", "List view") : get_text("view_grid", "Grid view"), + THEME.view_mode, PREF_MAP[? "dialog_add_node_view"], COLORS._main_icon); if(b == 2) PREF_MAP[? "dialog_add_node_view"] = !PREF_MAP[? "dialog_add_node_view"]; bx -= ui(32); var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, - PREF_MAP[? "dialog_add_node_grouping"]? "Group enabled" : "Group disabled", THEME.view_group, PREF_MAP[? "dialog_add_node_grouping"], COLORS._main_icon); + PREF_MAP[? "dialog_add_node_grouping"]? get_text("add_node_group_enabled", "Group enabled") : get_text("add_node_group_disabled", "Group disabled"), + THEME.view_group, PREF_MAP[? "dialog_add_node_grouping"], COLORS._main_icon); if(b == 2) PREF_MAP[? "dialog_add_node_grouping"] = !PREF_MAP[? "dialog_add_node_grouping"]; + + if(node_called != noone || junction_hovering != noone) { + var txt = node_show_connectable? get_text("add_node_show_connect", "Showing connectable") : get_text("add_node_show_all", "Showing all"); + var cc = node_show_connectable? COLORS._main_accent : COLORS._main_icon; + bx -= ui(32); + var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.filter_type, node_show_connectable, cc); + if(b == 2) + node_show_connectable = !node_show_connectable; + } #endregion //#region dec diff --git a/scripts/_3D/_3D.gml b/scripts/_3D/_3D.gml index 22d0ef208..6ebe73650 100644 --- a/scripts/_3D/_3D.gml +++ b/scripts/_3D/_3D.gml @@ -4,9 +4,13 @@ enum CAMERA_PROJ { } #region setup - globalvar PRIMITIVES, FORMAT_PT, FORMAT_PNT; + globalvar PRIMITIVES, FORMAT_P, FORMAT_PT, FORMAT_PNT; PRIMITIVES = ds_map_create(); + vertex_format_begin(); + vertex_format_add_position_3d(); + FORMAT_P = vertex_format_end(); + vertex_format_begin(); vertex_format_add_position_3d(); vertex_format_add_texcoord(); @@ -113,6 +117,18 @@ enum CAMERA_PROJ { PRIMITIVES[? "cube"] = VB; #endregion +#region gixmo circle + var VB = vertex_create_buffer(); + vertex_begin(VB, FORMAT_P); + + for( var i = 0; i <= 360; i += 12 ) + vertex_position_3d(VB, cos(i), sin(i), 0); + + vertex_end(VB); + vertex_freeze(VB); + PRIMITIVES[? "gixmo_rotate"] = VB; +#endregion + #region helper function _3d_node_init(iDim, iPos, iRot, iSca) { VB = []; @@ -157,7 +173,7 @@ enum CAMERA_PROJ { draw_circle(cx, cy, 64, true); if(drag_index == 0) { - var dx = (_mx - drag_mx) / _s * -6; + var dx = (_mx - drag_mx) * -2; _rot[1] = drag_sv - dx * (invx? -1 : 1); if(inputs[| input_rot].setValue(_rot)) @@ -168,7 +184,7 @@ enum CAMERA_PROJ { UNDO_HOLDING = false; } } else if(drag_index == 1) { - var dy = (_my - drag_my) / _s * 6; + var dy = (_my - drag_my) * 2; _rot[0] = drag_sv - dy * (invy? -1 : 1); if(inputs[| input_rot].setValue(_rot)) @@ -258,34 +274,36 @@ enum CAMERA_PROJ { uniLightNrm = shader_get_uniform(shader, "useNormal"); shader_set(shader); - 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_array_safe(uniVertex_lightFor, lightFor); + shader_set_uniform_f_array_safe(uniLightAmb, colorArrayFromReal(_aclr)); + shader_set_uniform_f_array_safe(uniLightClr, colorArrayFromReal(_lclr)); shader_set_uniform_f(uniLightInt, _lint); shader_set_uniform_i(uniLightNrm, use_normal); var cam_view, cam_proj; + var dw = array_safe_get(_dim, 0); + var dh = array_safe_get(_dim, 1); if(_proj == CAMERA_PROJ.ortho) { cam_view = matrix_build_lookat(0, 0, 128, 0, 0, 0, 0, 1, 0); - cam_proj = matrix_build_projection_ortho(_dim[0], _dim[1], 0.1, 256); + cam_proj = matrix_build_projection_ortho(dw, dh, 0.1, 256); } else { var _adjFov = power(_fov / 90, 1 / 4) * 90; var dist = _dim[0] / 2 * dtan(90 - _adjFov); cam_view = matrix_build_lookat(0, 0, 1 + dist, 0, 0, 0, 0, 1, 0); - cam_proj = matrix_build_projection_perspective(_dim[0], _dim[1], dist, dist + 256); + cam_proj = matrix_build_projection_perspective(dw, dh, dist, dist + 256); } var cam = camera_get_active(); - camera_set_view_size(cam, _dim[0], _dim[1]); + camera_set_view_size(cam, dw, dh); camera_set_view_mat(cam, cam_view); camera_set_proj_mat(cam, cam_proj); camera_apply(cam); if(_proj == CAMERA_PROJ.ortho) - matrix_stack_push(matrix_build(_dim[0] / 2 - _pos[0], _pos[1] - _dim[1] / 2, 0, 0, 0, 0, _dim[0] * _sca[0], _dim[1] * _sca[1], 1)); + matrix_stack_push(matrix_build(dw / 2 - _pos[0], _pos[1] - dh / 2, 0, 0, 0, 0, dw * _sca[0], dh * _sca[1], 1)); else - matrix_stack_push(matrix_build(_dim[0] / 2 - _pos[0], _pos[1] - _dim[1] / 2, 0, 0, 0, 0, _dim[0] * _sca[0], _dim[1] * _sca[1], 1)); + matrix_stack_push(matrix_build(dw / 2 - _pos[0], _pos[1] - dh / 2, 0, 0, 0, 0, dw * _sca[0], dh * _sca[1], 1)); //matrix_stack_push(matrix_build(0, 0, 0, 0, 0, 0, 1, 1, 1)); if(_applyLocal) _3d_local_transform(_lpos, _lrot, _lsca); diff --git a/scripts/collection_data/collection_data.gml b/scripts/collection_data/collection_data.gml index 43e96e850..118e5ced7 100644 --- a/scripts/collection_data/collection_data.gml +++ b/scripts/collection_data/collection_data.gml @@ -30,8 +30,8 @@ function refreshCollections() { } function searchCollection(_list, _search_str, _clear_list = true) { - if(_clear_list) - ds_list_clear(_list); + //if(_clear_list) + // ds_list_clear(_list); if(_search_str == "") return; var search_lower = string_lower(_search_str); @@ -44,10 +44,10 @@ function searchCollection(_list, _search_str, _clear_list = true) { for( var i = 0; i < ds_list_size(_st.content); i++ ) { var _nd = _st.content[| i]; - var match = string_pos(search_lower, string_lower(_nd.name)) > 0; - if(!match) continue; + var match = string_partial_match(string_lower(_nd.name), search_lower); + if(match == -9999) continue; - ds_list_add(_list, _nd); + ds_priority_add(_list, _nd, match); } for( var i = 0; i < ds_list_size(_st.subDir); i++ ) { diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 16118316a..2a207c4e4 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -1,7 +1,9 @@ #region save globalvar LOADING, LOADING_VERSION, APPENDING, CLONING, SAFE_MODE; globalvar MODIFIED, CURRENT_PATH, READONLY, CONNECTION_CONFLICT, GLOBAL_SEED, ALWAYS_FULL; - globalvar UPDATE_STEP; + globalvar RENDERING; + + RENDERING = false; LOADING = false; CLONING = false; @@ -9,7 +11,6 @@ APPENDING = false; READONLY = false; SAFE_MODE = false; - UPDATE_STEP = 0; CURRENT_PATH = ""; MODIFIED = false; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index d12367b04..ec4125615 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -73,6 +73,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor { error_noti_update = noone; error_update_enabled = false; manual_updated = false; + manual_deletable = true; static resetDefault = function() { var folder = instanceof(self); @@ -253,8 +254,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor { log_warning("RENDER", "Render error " + exception_print(exception), self); } - - UPDATE_STEP++; } static valueUpdate = function(index) { diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index ade40f928..22176d63f 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -78,13 +78,17 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { inputs[| 10] = nodeValue("Quality", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 80) .setDisplay(VALUE_DISPLAY.slider, [0, 100, 1]) .rejectArray(); - + + outputs[| 0] = nodeValue("Loop exit", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); + input_display_list = [ ["Export", false], 0, 1, 2, 4, ["Format ", false], 3, 9, ["Settings", false], 8, 5, 6, 7, 10, ]; + in_loop = false; + directory = DIRECTORY + "temp\\" + string(irandom_range(100000, 999999)); converter = working_directory + "ImageMagick\\convert.exe"; magick = working_directory + "ImageMagick\\magick.exe"; @@ -341,6 +345,8 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { static onInspectorUpdate = function() { initExport(); + + if(in_loop) Render(); } static onInspector2Update = function() { @@ -354,6 +360,8 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { node.initExport(); } + + if(in_loop) Render(); } static initExport = function() { @@ -381,7 +389,10 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { directory_create(directory); } + loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ]; static step = function() { + in_loop = array_exists(loop_nodes, instanceof(group)); + var surf = inputs[| 0].getValue(); if(is_array(surf)) { inputs[| 3].display_data = format_array; @@ -408,11 +419,17 @@ function Node_Export(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { inputs[| 9].editWidget.data_list = format_image; inputs[| 10].setVisible(extn != 0); } + + outputs[| 0].visible = in_loop; } static update = function(frame = ANIMATOR.current_frame) { var anim = inputs[| 3].getValue(); - if(anim == NODE_EXPORT_FORMAT.single) return; + if(anim == NODE_EXPORT_FORMAT.single) { + if(in_loop && RENDERING) + initExport(); + return; + } if(!ANIMATOR.is_playing) { playing = false; diff --git a/scripts/node_guide/node_guide.gml b/scripts/node_guide/node_guide.gml index 27badb808..591391fe4 100644 --- a/scripts/node_guide/node_guide.gml +++ b/scripts/node_guide/node_guide.gml @@ -27,7 +27,7 @@ function __generate_node_guide() { CLONING = false; - var path = "D:\\Project\\MakhamDev\\LTS-PixelComposer\\Pixels Composer\\datafiles\\data\\nodes\\node_guides.json" + var path = DIRECTORY + "node_guides.json"; json_save_struct(path, node_struct); ds_map_destroy(node_struct); game_end(); @@ -35,7 +35,7 @@ function __generate_node_guide() { function __init_node_guide() { global.NODE_GUIDE = {}; - var path = "data\\nodes\\node_guides.json"; + var path = DIRECTORY + "node_guides.json"; if(!file_exists(path)) return; global.NODE_GUIDE = json_load_struct(path); diff --git a/scripts/node_iterate/node_iterate.gml b/scripts/node_iterate/node_iterate.gml index c3574b2ed..23a4aea60 100644 --- a/scripts/node_iterate/node_iterate.gml +++ b/scripts/node_iterate/node_iterate.gml @@ -63,11 +63,11 @@ function Node_Iterate(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) con if(iter) { iterated++; - if(iterated == maxIter) { + if(iterated >= maxIter) { render_time = get_timer() - loop_start_time; + iterated = 0; return ITERATION_STATUS.complete; - } else if(iterated > maxIter) - return ITERATION_STATUS.complete; + } resetAllRenderStatus(); return ITERATION_STATUS.loop; diff --git a/scripts/node_iterate/node_iterate.yy b/scripts/node_iterate/node_iterate.yy index b88b76c90..49514b453 100644 --- a/scripts/node_iterate/node_iterate.yy +++ b/scripts/node_iterate/node_iterate.yy @@ -5,7 +5,7 @@ "isDnD": false, "isCompatibility": false, "parent": { - "name": "iterate", - "path": "folders/nodes/data/iterate.yy", + "name": "for", + "path": "folders/nodes/data/iterate/for.yy", }, } \ No newline at end of file diff --git a/scripts/node_iterate_each/node_iterate_each.gml b/scripts/node_iterate_each/node_iterate_each.gml new file mode 100644 index 000000000..13f9afc4f --- /dev/null +++ b/scripts/node_iterate_each/node_iterate_each.gml @@ -0,0 +1,66 @@ +function Node_Iterate_Each(_x, _y, _group = -1) : Node_Collection(_x, _y, _group) constructor { + name = "Loop Array"; + color = COLORS.node_blend_loop; + icon = THEME.loop; + + iterated = 0; + + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] ) + .setVisible(true, true); + + outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, [] ); + + custom_input_index = ds_list_size(inputs); + custom_output_index = ds_list_size(inputs); + loop_start_time = 0; + ALWAYS_FULL = true; + + if(!LOADING && !APPENDING && !CLONING) { + var input = nodeBuild("Node_Iterator_Each_Input", -256, -32, self); + var output = nodeBuild("Node_Iterator_Each_Output", 256, -32, self); + + output.inputs[| 0].setFrom(input.outputs[| 0]); + } + + static getNextNodes = function() { + __nodeLeafList(nodes, RENDER_QUEUE); + initLoop(); + } + + static onStep = function() { + var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; + inputs[| 0].type = type; + } + + static initLoop = function() { + iterated = 0; + loop_start_time = get_timer(); + + var arrIn = inputs[| 0].getValue(); + var maxIter = is_array(arrIn)? array_length(arrIn) : 0; + var arrOut = array_create(maxIter); + outputs[| 0].setValue(arrOut); + + // + + printIf(global.RENDER_LOG, " > Loop begin"); + } + + static iterationStatus = function() { + var iter = true; + var arrIn = inputs[| 0].getValue(); + var maxIter = is_array(arrIn)? array_length(arrIn) : 0; + if(!is_real(maxIter)) maxIter = 1; + + iterated++; + + if(iterated >= maxIter) { + render_time = get_timer() - loop_start_time; + iterated = 0; + return ITERATION_STATUS.complete; + } + + resetAllRenderStatus(); + return ITERATION_STATUS.loop; + } +} \ No newline at end of file diff --git a/scripts/node_iterate_each/node_iterate_each.yy b/scripts/node_iterate_each/node_iterate_each.yy new file mode 100644 index 000000000..bc4c806db --- /dev/null +++ b/scripts/node_iterate_each/node_iterate_each.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_iterate_each", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "for each", + "path": "folders/nodes/data/iterate/for each.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_iterator_each_input/node_iterator_each_input.gml b/scripts/node_iterator_each_input/node_iterator_each_input.gml new file mode 100644 index 000000000..fd450e556 --- /dev/null +++ b/scripts/node_iterator_each_input/node_iterator_each_input.gml @@ -0,0 +1,25 @@ +function Node_Iterator_Each_Input(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { + name = "Input"; + color = COLORS.node_blend_loop; + + manual_deletable = false; + + outputs[| 0] = nodeValue("Value in", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 ); + outputs[| 0].getValueDefault = method(outputs[| 0], outputs[| 0].getValueRecursive); //Get value from outside loop + outputs[| 0].getValueRecursive = function() { + if(!variable_struct_exists(group, "iterated")) + return outputs[| 0].getValueDefault(); + + var ind = group.iterated; + var val = group.inputs[| 0].getValue(); + + return [ array_safe_get(val, ind), group.inputs[| 0] ]; + } + + static step = function() { + if(!variable_struct_exists(group, "iterated")) return; + + outputs[| 0].type = group.inputs[| 0].type; + } + +} \ No newline at end of file diff --git a/scripts/node_iterator_each_input/node_iterator_each_input.yy b/scripts/node_iterator_each_input/node_iterator_each_input.yy new file mode 100644 index 000000000..4196494ac --- /dev/null +++ b/scripts/node_iterator_each_input/node_iterator_each_input.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_iterator_each_input", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "for each", + "path": "folders/nodes/data/iterate/for each.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_iterator_each_output/node_group_input.yy b/scripts/node_iterator_each_output/node_group_input.yy new file mode 100644 index 000000000..b48fa62c4 --- /dev/null +++ b/scripts/node_iterator_each_output/node_group_input.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "group", + "path": "folders/nodes/data/group.yy", + }, + "resourceVersion": "1.0", + "name": "node_group_input", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.gml b/scripts/node_iterator_each_output/node_iterator_each_output.gml new file mode 100644 index 000000000..117f48a4f --- /dev/null +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -0,0 +1,98 @@ +function Node_Iterator_Each_Output(_x, _y, _group = -1) : Node(_x, _y, _group) constructor { + name = "Output"; + color = COLORS.node_blend_loop; + + manual_deletable = false; + + inputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 ) + .setVisible(true, true); + + outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 ) + .setVisible(false); + + static getNextNodes = function() { + if(!struct_has(group, "iterationStatus")) return; + var _ren = group.iterationStatus(); + + if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? + printIf(global.RENDER_LOG, " > Loop restart: iteration " + string(group.iterated)); + __nodeLeafList(group.nodes, RENDER_QUEUE); + } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop + printIf(global.RENDER_LOG, " > Loop completed"); + group.setRenderStatus(true); + + var _ot = group.outputs[| 0]; + for(var j = 0; j < ds_list_size(_ot.value_to); j++) { + var _to = _ot.value_to[| j]; + + if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) { + _to.node.triggerRender(); + if(_to.node.isUpdateReady()) ds_queue_enqueue(RENDER_QUEUE, _to.node); + } + } + } else + printIf(global.RENDER_LOG, " > Loop not ready"); + } + + static step = function() { + if(!variable_struct_exists(group, "iterated")) return; + + var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; + inputs[| 0].type = type; + group.outputs[| 0].type = type; + outputs[| 0].type = type; + } + + static cloneValue = function(_prev_val, _val) { + if(inputs[| 0].value_from == noone) return _prev_val; + + var _arr = inputs[| 0].value_from.isArray(); + var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface; + + if(is_array(_prev_val)) { + for( var i = 0; i < array_length(_prev_val); i++ ) { + if(is_surf && is_surface(_prev_val[i])) + surface_free(_prev_val[i]); + } + } else if(is_surf && is_surface(_prev_val)) + surface_free(_prev_val); + + var _new_val = 0; + if(_arr) { + var amo = array_length(_val); + _new_val = array_create(amo); + + if(is_surf) { + for( var i = 0; i < amo; i++ ) { + if(is_surface(_val[i])) + _new_val[i] = surface_clone(_val[i]); + } + } else + _new_val = _val; + } else { + if(is_surf) { + if(is_surface(_val)) + _new_val = surface_clone(_val); + } else + _new_val = _val; + } + + return _new_val; + } + + static update = function(frame = ANIMATOR.current_frame) { + if(inputs[| 0].value_from == noone) + return; + + if(!variable_struct_exists(group, "iterated")) + return; + + var ind = group.iterated; + var _val = group.outputs[| 0].getValue(); + if(!is_array(_val)) return; + + _val[ind] = cloneValue(array_safe_get(_val, ind), inputs[| 0].getValue()); + group.outputs[| 0].setValue(_val); + outputs[| 0].setValue(_val); + } +} \ No newline at end of file diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.yy b/scripts/node_iterator_each_output/node_iterator_each_output.yy new file mode 100644 index 000000000..8ea23e130 --- /dev/null +++ b/scripts/node_iterator_each_output/node_iterator_each_output.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_iterator_each_output", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "for each", + "path": "folders/nodes/data/iterate/for each.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_iterator_input/node_iterator_input.yy b/scripts/node_iterator_input/node_iterator_input.yy index 42d792f4d..3065f9624 100644 --- a/scripts/node_iterator_input/node_iterator_input.yy +++ b/scripts/node_iterator_input/node_iterator_input.yy @@ -5,7 +5,7 @@ "isDnD": false, "isCompatibility": false, "parent": { - "name": "iterate", - "path": "folders/nodes/data/iterate.yy", + "name": "for", + "path": "folders/nodes/data/iterate/for.yy", }, } \ No newline at end of file diff --git a/scripts/node_iterator_output/node_iterator_output.yy b/scripts/node_iterator_output/node_iterator_output.yy index 00efd302e..9cf0a80b6 100644 --- a/scripts/node_iterator_output/node_iterator_output.yy +++ b/scripts/node_iterator_output/node_iterator_output.yy @@ -5,7 +5,7 @@ "isDnD": false, "isCompatibility": false, "parent": { - "name": "iterate", - "path": "folders/nodes/data/iterate.yy", + "name": "for", + "path": "folders/nodes/data/iterate/for.yy", }, } \ No newline at end of file diff --git a/scripts/node_path_map_area/node_path_map_area.gml b/scripts/node_path_map_area/node_path_map_area.gml index c1a5ac450..c05596ded 100644 --- a/scripts/node_path_map_area/node_path_map_area.gml +++ b/scripts/node_path_map_area/node_path_map_area.gml @@ -44,6 +44,6 @@ function Node_Path_Map_Area(_x, _y, _group = -1) : Node(_x, _y, _group) construc static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_path_map, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_path_shift/node_path_shift.gml b/scripts/node_path_shift/node_path_shift.gml index 77ddb0404..2a43f5ce4 100644 --- a/scripts/node_path_shift/node_path_shift.gml +++ b/scripts/node_path_shift/node_path_shift.gml @@ -36,6 +36,6 @@ function Node_Path_Shift(_x, _y, _group = -1) : Node(_x, _y, _group) constructor static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_path_shift, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_path_transform/node_path_transform.gml b/scripts/node_path_transform/node_path_transform.gml index 50025413f..8bc246e97 100644 --- a/scripts/node_path_transform/node_path_transform.gml +++ b/scripts/node_path_transform/node_path_transform.gml @@ -69,6 +69,6 @@ function Node_Path_Transform(_x, _y, _group = -1) : Node(_x, _y, _group) constru static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_path_transform, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_path_trim/node_path_trim.gml b/scripts/node_path_trim/node_path_trim.gml index 153827792..a92389086 100644 --- a/scripts/node_path_trim/node_path_trim.gml +++ b/scripts/node_path_trim/node_path_trim.gml @@ -31,6 +31,6 @@ function Node_Path_Trim(_x, _y, _group = -1) : Node(_x, _y, _group) constructor static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_path_trim, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_path_wave/node_path_wave.gml b/scripts/node_path_wave/node_path_wave.gml index cbd445c9c..11b00ddb4 100644 --- a/scripts/node_path_wave/node_path_wave.gml +++ b/scripts/node_path_wave/node_path_wave.gml @@ -54,6 +54,6 @@ function Node_Path_Wave(_x, _y, _group = -1) : Node(_x, _y, _group) constructor static onDrawNode = function(xx, yy, _mx, _my, _s) { var bbox = drawGetBbox(xx, yy, _s); - draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + draw_sprite_fit(s_node_path_wave, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); } } \ No newline at end of file diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 94f9df486..2aed54aa6 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -50,18 +50,18 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { return _n; } - function addNodeCatagory(name, list, filter = "") { + function addNodeCatagory(name, list, filter = []) { ds_list_add(NODE_CATEGORY, { name: name, list: list, filter: filter }); } var group = ds_list_create(); - addNodeCatagory("Group", group, "Node_Group"); + addNodeCatagory("Group", group, ["Node_Group"]); ds_list_add(group, "Groups"); addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(group, "Output", s_node_group_output,"Node_Group_Output", [1, Node_Group_Output]); var iter = ds_list_create(); - addNodeCatagory("Loop", iter, "Node_Iterate"); + addNodeCatagory("Loop", iter, ["Node_Iterate"]); ds_list_add(iter, "Groups"); addNodeObject(iter, "Input", s_node_loop_input, "Node_Iterator_Input", [1, Node_Iterator_Input]); addNodeObject(iter, "Output", s_node_loop_output, "Node_Iterator_Output", [1, Node_Iterator_Output]); @@ -69,14 +69,23 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(iter, "Loops"); addNodeObject(iter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); + var itere = ds_list_create(); + addNodeCatagory("Loop", itere, ["Node_Iterate_Each"]); + ds_list_add(itere, "Groups"); + addNodeObject(itere, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); + addNodeObject(itere, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); + + ds_list_add(itere, "Loops"); + addNodeObject(itere, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); + var feed = ds_list_create(); - addNodeCatagory("Feedback", feed, "Node_Feedback"); + addNodeCatagory("Feedback", feed, ["Node_Feedback"]); ds_list_add(feed, "Groups"); addNodeObject(feed, "Input", s_node_feedback_input, "Node_Feedback_Input", [1, Node_Feedback_Input]); addNodeObject(feed, "Output", s_node_feedback_output, "Node_Feedback_Output", [1, Node_Feedback_Output]); var vfx = ds_list_create(); - addNodeCatagory("VFX", vfx, "Node_VFX_Group"); + addNodeCatagory("VFX", vfx, ["Node_VFX_Group"]); ds_list_add(vfx, "Groups"); addNodeObject(vfx, "Input", s_node_vfx_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(vfx, "Output", s_node_vfx_output, "Node_Group_Output", [1, Node_Group_Output]); @@ -99,7 +108,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(vfx, "VFX Override", s_node_vfx_override, "Node_VFX_Override", [1, Node_VFX_Override]).set_version(1120); var rigidSim = ds_list_create(); - addNodeCatagory("RigidSim", rigidSim, "Node_Rigid_Group"); + addNodeCatagory("RigidSim", rigidSim, ["Node_Rigid_Group"]); ds_list_add(rigidSim, "Group"); addNodeObject(rigidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(rigidSim, "Output", s_node_group_output,"Node_Group_Output", [1, Node_Group_Output]); @@ -116,7 +125,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(rigidSim, "Rigidbody Override", s_node_rigid_override, "Node_Rigid_Override", [1, Node_Rigid_Override]).set_version(1120); var fluidSim = ds_list_create(); - addNodeCatagory("FluidSim", fluidSim, "Node_Fluid_Group"); + addNodeCatagory("FluidSim", fluidSim, ["Node_Fluid_Group"]); ds_list_add(fluidSim, "Group"); addNodeObject(fluidSim, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]); addNodeObject(fluidSim, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]); @@ -152,8 +161,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(input, "Files"); addNodeObject(input, "Text File In", s_node_text_file_read, "Node_Text_File_Read", [1, Node_Text_File_Read], ["txt"]).set_version(1080); addNodeObject(input, "Text File Out", s_node_text_file_write, "Node_Text_File_Write", [1, Node_Text_File_Write], ["txt"]).set_version(1090); - addNodeObject(input, "CSV File In", s_node_csv_file_read, "Node_CSV_File_Read", [1, Node_CSV_File_Read], ["comma"]).set_version(1090); - addNodeObject(input, "CSV File Out", s_node_csv_file_write, "Node_CSV_File_Write", [1, Node_CSV_File_Write], ["comma"]).set_version(1090); + addNodeObject(input, "CSV File In", s_node_csv_file_read, "Node_CSV_File_Read", [1, Node_CSV_File_Read], ["comma separated value"]).set_version(1090); + addNodeObject(input, "CSV File Out", s_node_csv_file_write, "Node_CSV_File_Write", [1, Node_CSV_File_Write], ["comma separated value"]).set_version(1090); addNodeObject(input, "JSON File In", s_node_json_file_read, "Node_Json_File_Read", [1, Node_Json_File_Read]).set_version(1090); addNodeObject(input, "JSON File Out", s_node_json_file_write, "Node_Json_File_Write", [1, Node_Json_File_Write]).set_version(1090); addNodeObject(input, "ASE File In", s_node_ase_file, "Node_ASE_File_Read", [0, Node_create_ASE_File_Read]).set_version(1100); @@ -162,10 +171,10 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { var transform = ds_list_create(); addNodeCatagory("Transform", transform); ds_list_add(transform, "Transformations"); - addNodeObject(transform, "Transform", s_node_transform, "Node_Transform", [1, Node_Transform]); + addNodeObject(transform, "Transform", s_node_transform, "Node_Transform", [1, Node_Transform], ["move", "rotate", "scale"]); addNodeObject(transform, "Scale", s_node_scale, "Node_Scale", [1, Node_Scale], ["resize"]); addNodeObject(transform, "Scale Algorithm", s_node_scale_algo, "Node_Scale_Algo", [0, Node_create_Scale_Algo], ["scale2x", "scale3x"]); - addNodeObject(transform, "Flip", s_node_flip, "Node_Flip", [1, Node_Flip]); + addNodeObject(transform, "Flip", s_node_flip, "Node_Flip", [1, Node_Flip], ["mirror"]); ds_list_add(transform, "Warps"); addNodeObject(transform, "Crop", s_node_crop, "Node_Crop", [1, Node_Crop]); @@ -270,7 +279,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(threeD, "3D operations"); addNodeObject(threeD, "3D Transform", s_node_3d_transform, "Node_3D_Transform", [1, Node_3D_Transform]).set_version(1080); addNodeObject(threeD, "3D Combine", s_node_3d_obj_combine, "Node_3D_Combine", [1, Node_3D_Combine]).set_version(1080); - addNodeObject(threeD, "3D Repeat", s_node_3d_array, "Node_3D_Repeat", [1, Node_3D_Repeat], ["array", "3d array"]).set_version(1080); + addNodeObject(threeD, "3D Repeat", s_node_3d_array, "Node_3D_Repeat", [1, Node_3D_Repeat], ["3d array"]).set_version(1080); var generator = ds_list_create(); addNodeCatagory("Generate", generator); @@ -365,16 +374,16 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(values, "Arrays"); addNodeObject(values, "Array", s_node_array, "Node_Array", [1, Node_Array]); addNodeObject(values, "Array Range", s_node_array_range, "Node_Array_Range", [1, Node_Array_Range]); - addNodeObject(values, "Array Add", s_node_array_add, "Node_Array_Add", [1, Node_Array_Add]); + addNodeObject(values, "Array Add", s_node_array_add, "Node_Array_Add", [1, Node_Array_Add], ["add array"]); addNodeObject(values, "Array Length", s_node_array_length, "Node_Array_Length", [1, Node_Array_Length]); - addNodeObject(values, "Array Get", s_node_array_get, "Node_Array_Get", [1, Node_Array_Get]); - addNodeObject(values, "Array Set", s_node_array_set, "Node_Array_Set", [1, Node_Array_Set]).set_version(1120); - addNodeObject(values, "Array Find", s_node_array_find, "Node_Array_Find", [1, Node_Array_Find]).set_version(1120); - addNodeObject(values, "Array Insert", s_node_array_insert, "Node_Array_Insert", [1, Node_Array_Insert]).set_version(1120); - addNodeObject(values, "Array Remove", s_node_array_remove, "Node_Array_Remove", [1, Node_Array_Remove]).set_version(1120); - addNodeObject(values, "Array Reverse", s_node_array_reverse, "Node_Array_Reverse", [1, Node_Array_Reverse]).set_version(1120); - addNodeObject(values, "Sort Array", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort]).set_version(1120); - addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle]).set_version(1120); + addNodeObject(values, "Array Get", s_node_array_get, "Node_Array_Get", [1, Node_Array_Get], ["get array"]); + addNodeObject(values, "Array Set", s_node_array_set, "Node_Array_Set", [1, Node_Array_Set], ["set array"]).set_version(1120); + addNodeObject(values, "Array Find", s_node_array_find, "Node_Array_Find", [1, Node_Array_Find], ["find array"]).set_version(1120); + addNodeObject(values, "Array Insert", s_node_array_insert, "Node_Array_Insert", [1, Node_Array_Insert], ["insert array"]).set_version(1120); + addNodeObject(values, "Array Remove", s_node_array_remove, "Node_Array_Remove", [1, Node_Array_Remove], ["remove array", "delete array", "array delete"]).set_version(1120); + addNodeObject(values, "Array Reverse", s_node_array_reverse, "Node_Array_Reverse", [1, Node_Array_Reverse], ["reverse array"]).set_version(1120); + addNodeObject(values, "Sort Array", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).set_version(1120); + addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).set_version(1120); ds_list_add(values, "Paths"); addNodeObject(values, "Path", s_node_path, "Node_Path", [1, Node_Path]); @@ -384,7 +393,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(values, "Transform Path", s_node_path_transform, "Node_Path_Transform", [1, Node_Path_Transform]).set_version(1130); addNodeObject(values, "Shift Path", s_node_path_shift, "Node_Path_Shift", [1, Node_Path_Shift]).set_version(1130); addNodeObject(values, "Trim Path", s_node_path_trim, "Node_Path_Trim", [1, Node_Path_Trim]).set_version(1130); - addNodeObject(values, "Wave Path", s_node_path_wave, "Node_Path_Wave", [1, Node_Path_Wave]).set_version(1130); + addNodeObject(values, "Wave Path", s_node_path_wave, "Node_Path_Wave", [1, Node_Path_Wave], ["zigzag path"]).set_version(1130); ds_list_add(values, "Boolean"); addNodeObject(values, "Boolean", s_node_boolean, "Node_Boolean", [1, Node_Boolean]); @@ -423,7 +432,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(node, "Groups"); addNodeObject(node, "Group", s_node_group, "Node_Group", [1, Node_Group]); addNodeObject(node, "Feedback", s_node_feedback, "Node_Feedback", [1, Node_Feedback]); - addNodeObject(node, "Loop", s_node_loop, "Node_Iterate", [1, Node_Iterate], ["iterate"]); + addNodeObject(node, "Loop", s_node_loop, "Node_Iterate", [1, Node_Iterate], ["iterate", "for"]); + addNodeObject(node, "Loop Array", s_node_loop_array, "Node_Iterate_Each", [1, Node_Iterate_Each], ["iterate each", "for each", "array loop"]); ds_list_add(node, "Lua"); addNodeObject(node, "Lua Global", s_node_lua_global, "Node_Lua_Global", [1, Node_Lua_Global]).set_version(1090); @@ -437,6 +447,11 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(node, "Tunnel Out", s_node_tunnel_out, "Node_Tunnel_Out", [1, Node_Tunnel_Out]); addNodeObject(node, "Display Text", s_node_text_display,"Node_Display_Text", [1, Node_Display_Text]); addNodeObject(node, "Display Image", s_node_image, "Node_Display_Image", [0, Node_create_Display_Image]); + + var hid = ds_list_create(); + addNodeCatagory("Hidden", hid, ["Hidden"]); + addNodeObject(hid, "Input", s_node_feedback_input, "Node_Iterator_Each_Input", [1, Node_Iterator_Each_Input]); + addNodeObject(hid, "Output", s_node_feedback_output, "Node_Iterator_Each_Output", [1, Node_Iterator_Each_Output]); #endregion #region node function diff --git a/scripts/obj_reader/obj_reader.gml b/scripts/obj_reader/obj_reader.gml index 3d24c2e83..a8fc93536 100644 --- a/scripts/obj_reader/obj_reader.gml +++ b/scripts/obj_reader/obj_reader.gml @@ -6,13 +6,15 @@ function readObj(path, flipUV = false) { var _VBN = []; var mats = []; var matIndex = []; + var mtlPath = ""; var use_normal = true; - var v = ds_list_create(); - var vt = ds_list_create(); - var vn = ds_list_create(); - var f = ds_list_create(); - var ft = ds_list_create(); - var fn = ds_list_create(); + var v = []; + var vt = []; + var vn = []; + var f = []; + var ft = []; + var fn = []; + var face = 0; var file = file_text_open_read(path); while(!file_text_eof(file)) { @@ -24,60 +26,85 @@ function readObj(path, flipUV = false) { switch(sep[0]) { case "v" : - ds_list_add(v, [ toNumber(sep[1]), toNumber(sep[2]), toNumber(sep[3]) ]); + array_push(v, [ toNumber(sep[1]), toNumber(sep[2]), toNumber(sep[3]) ]); break; case "vt" : if(flipUV) - ds_list_add(vt, [ 1 + toNumber(sep[1]), -toNumber(sep[2]) ]); + array_push(vt, [ toNumber(sep[1]), 1 - toNumber(sep[2]) ]); else - ds_list_add(vt, [ toNumber(sep[1]), toNumber(sep[2]) ]); + array_push(vt, [ toNumber(sep[1]), toNumber(sep[2]) ]); break; case "vn" : - ds_list_add(vn, [ toNumber(sep[1]), toNumber(sep[2]), toNumber(sep[3]) ]); + array_push(vn, [ toNumber(sep[1]), toNumber(sep[2]), toNumber(sep[3]) ]); break; case "f" : - var f1 = string_splice(sep[1], "/"); - var f2 = string_splice(sep[2], "/"); - var f3 = string_splice(sep[3], "/"); + var _f = []; + var _ft = []; + var _fn = []; - ds_list_add(f, [f1[0], f2[0], f3[0]]); - ds_list_add(ft, [f1[1], f2[1], f3[1]]); - if(array_length(f1) > 2) ds_list_add(fn, [f1[2], f2[2], f3[2]]); - else { - ds_list_add(fn, [0, 0, 0]); - use_normal = false; + for( var i = 1; i < array_length(sep); i++ ) { + var _sp = string_splice(sep[i], "/"); + _f[i - 1] = toNumber(array_safe_get(_sp, 0)); + _ft[i - 1] = toNumber(array_safe_get(_sp, 1)); + _fn[i - 1] = toNumber(array_safe_get(_sp, 2)); + + if(array_length(_sp) < 3) use_normal = false; } + + face++; + array_push(f, _f ); //get position + array_push(ft, _ft); //get texture map + array_push(fn, _fn); //get normal break; case "usemtl" : - var mname = string_replace_all(sep[1], "\n", ""); - mname = string_replace_all(mname, "\r", ""); + var mname = ""; + for( var i = 1; i < array_length(sep); i++ ) + mname += (i == 1? "" : " ") + sep[i]; + mname = string_trim(mname); array_push_unique(mats, mname); array_push(matIndex, array_find(mats, mname)); - if(!ds_list_empty(f)) { + if(array_length(f)) { array_push(_VB, f); array_push(_VBT, ft); array_push(_VBN, fn); - f = ds_list_create(); - ft = ds_list_create(); - fn = ds_list_create(); + f = []; + ft = []; + fn = []; } break; + case "mtllib" : + mtlPath = ""; + for( var i = 1; i < array_length(sep); i++ ) + mtlPath += (i == 1? "" : " ") + sep[i]; + mtlPath = string_trim(mtlPath); + break; + case "o" : + //print("Reading vertex group: " + sep[1]) + break; } } - if(!ds_list_empty(f)) { + if(array_length(f)) { array_push(_VB, f); array_push(_VBT, ft); array_push(_VBN, fn); } file_text_close(file); + var txt = "OBJ summary"; + txt += "\n\tVerticies : " + string(array_length(v)); + txt += "\n\tTexture Verticies : " + string(array_length(vt)); + txt += "\n\tNormal Verticies : " + string(array_length(vn)); + txt += "\n\tFaces : " + string(face); + txt += "\n\tVertex groups : " + string(array_length(_VB)); + print(txt); + #region centralize vertex var cv = [0, 0, 0]; - var vertex = ds_list_size(v); + var vertex = array_length(v); for( var i = 0; i < vertex; i++ ) { - var _v = v[| i]; + var _v = v[i]; cv[0] += _v[0]; cv[1] += _v[1]; cv[2] += _v[2]; @@ -87,14 +114,15 @@ function readObj(path, flipUV = false) { cv[1] /= vertex; cv[2] /= vertex; - for( var i = 0; i < ds_list_size(v); i++ ) { - v[| i][0] -= cv[0]; - v[| i][1] -= cv[1]; - v[| i][2] -= cv[2]; + for( var i = 0; i < array_length(v); i++ ) { + v[i][0] -= cv[0]; + v[i][1] -= cv[1]; + v[i][2] -= cv[2]; } #endregion var VBS = []; + for(var i = 0; i < array_length(_VB); i++) { var VB = vertex_create_buffer(); vertex_begin(VB, FORMAT_PNT); @@ -102,41 +130,48 @@ function readObj(path, flipUV = false) { var facet = _VBT[i]; var facen = _VBN[i]; - for(var j = 0; j < ds_list_size(face); j++) { - var _f = face[| j]; - var _f1 = v[| _f[0] - 1]; - var _f2 = v[| _f[1] - 1]; - var _f3 = v[| _f[2] - 1]; - - var _ft = facet[| j]; - var _ft1 = vt[| _ft[0] - 1]; - var _ft2 = vt[| _ft[1] - 1]; - var _ft3 = vt[| _ft[2] - 1]; - - var _fn = facen[| j]; - var _fn1 = _fn[0]? vn[| _fn[0] - 1] : [0, 0, 0]; - var _fn2 = _fn[1]? vn[| _fn[1] - 1] : [0, 0, 0]; - var _fn3 = _fn[2]? vn[| _fn[2] - 1] : [0, 0, 0]; + for(var j = 0; j < array_length(face); j++) { + var _f = face[j]; + var _ft = facet[j]; + var _fn = facen[j]; - vertex_add_pnt(VB, _f1, _fn1, _ft1 ); - vertex_add_pnt(VB, _f2, _fn2, _ft2 ); - vertex_add_pnt(VB, _f3, _fn3, _ft3 ); + var _pf = []; + var _pft = []; + var _pfn = []; + + for( var k = 0; k < array_length(_f); k++ ) { + var _f1 = v[_f[k] - 1]; + var _ft1 = vt[_ft[k] - 1]; + var _fn1 = _fn[k]? vn[_fn[k] - 1] : [0, 0, 0]; + + array_push( _pf, _f1); + array_push(_pft, _ft1); + array_push(_pfn, _fn1); + } + + if(array_length(_f) >= 3) { + vertex_add_pnt(VB, _pf[0], _pfn[0], _pft[0]); + vertex_add_pnt(VB, _pf[1], _pfn[1], _pft[1]); + vertex_add_pnt(VB, _pf[2], _pfn[2], _pft[2]); + } + + if(array_length(_f) >= 4) { + vertex_add_pnt(VB, _pf[0], _pfn[0], _pft[0]); + vertex_add_pnt(VB, _pf[2], _pfn[2], _pft[2]); + vertex_add_pnt(VB, _pf[3], _pfn[3], _pft[3]); + } } vertex_end(VB); vertex_freeze(VB); array_push(VBS, VB); - - ds_list_destroy(face); - ds_list_destroy(facet); } - ds_list_destroy(v); - ds_list_destroy(vt); - ds_list_destroy(vn); - ds_list_destroy(f); - ds_list_destroy(ft); - ds_list_destroy(fn); - - return [ VBS, mats, matIndex, use_normal ]; + return { + vertex_groups: VBS, + materials: mats, + material_index: matIndex, + use_normal: use_normal, + mtl_path: mtlPath, + }; } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index ee6bba2b1..15e872df7 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -949,11 +949,12 @@ function Panel_Graph() : PanelContent() constructor { } function doDelete(_merge = false) { - if(node_focus != noone) + if(node_focus != noone && mode_focus.manual_deletable) nodeDelete(node_focus, _merge); for(var i = 0; i < ds_list_size(nodes_select_list); i++) { - nodeDelete(nodes_select_list[| i], _merge); + if(nodes_select_list[| i].manual_deletable) + nodeDelete(nodes_select_list[| i], _merge); } ds_list_clear(nodes_select_list); } @@ -1427,6 +1428,7 @@ function Panel_Graph() : PanelContent() constructor { switch(context) { case "Node_Group" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_collection, 0.05); break; case "Node_Iterate" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_loop, 0.05); break; + case "Node_Iterate_Each" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_loop, 0.05); break; case "Node_VFX_Group" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_vfx, 0.05); break; case "Node_Feedback" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_feedback, 0.05); break; case "Node_Rigid_Group" : bg = merge_color(COLORS.panel_bg_clear, COLORS.node_blend_simulation, 0.05); break; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 73e3c954e..3662a651b 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -19,18 +19,29 @@ function __nodeLeafList(_list, _queue) { } } +global.group_inputs = [ "Node_Group_Input", "Node_Feedback_Input", "Node_Iterator_Input", "Node_Iterator_Each_Input" ]; + +function __nodeIsLoop(_node) { + switch(instanceof(_node)) { + case "Node_Iterate" : + case "Node_Iterate_Each" : + case "Node_Feedback" : + return true; + } + return false; +} + function __nodeInLoop(_node) { var gr = _node.group; while(gr != -1) { - if(instanceof(gr) == "Node_Iterate") return true; - if(instanceof(gr) == "Node_Feedback") return true; + if(__nodeIsLoop(gr)) return true; gr = gr.group; } return false; } function Render(partial = false) { - UPDATE_STEP++; + RENDERING = true; try { var rendering = noone; @@ -59,8 +70,7 @@ function Render(partial = false) { if(is_undefined(_node)) continue; if(!is_struct(_node)) continue; - if(instanceof(_node) == "Node_Group_Input") continue; - if(instanceof(_node) == "Node_Iterator_Input") continue; + if(array_exists(global.group_inputs, instanceof(_node))) continue; if(!_node.active) continue; if(_node.rendered) continue; @@ -89,4 +99,6 @@ function Render(partial = false) { printIf(global.RENDER_LOG, "=== RENDER COMPLETE IN {" + string(current_time - t) + "ms} ===\n"); } catch(e) noti_warning("Rendering error: " + exception_print(e)); + + RENDERING = false; } \ No newline at end of file diff --git a/scripts/string_function/string_function.gml b/scripts/string_function/string_function.gml index c4b9a0686..033c0d53e 100644 --- a/scripts/string_function/string_function.gml +++ b/scripts/string_function/string_function.gml @@ -4,4 +4,29 @@ function string_to_array(str) { for( var i = 0; i < amo; i++ ) arr[i] = string_char_at(str, i + 1); return arr; +} + +function string_partial_match(str, key) { + var amo = string_length(str); + var run = 1; + var consec = 0; + var conMax = 0; + var misMatch = 0; + var kchr = string_char_at(key, run); + + for( var i = 1; i <= amo; i++ ) { + var ch = string_char_at(str, i); + if(ch == kchr) { + consec++; + conMax = max(conMax, consec); + run++; + if(run > string_length(key)) return conMax - (misMatch + (amo - i)); + kchr = string_char_at(key, run); + } else { + consec = 0; + misMatch++; + } + } + + return -9999; } \ No newline at end of file