diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 4b0055cad..900a028f8 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1183,6 +1183,7 @@ {"name":"fd_rectangle_set_material_dissipation_type","order":4,"path":"scripts/fd_rectangle_set_material_dissipation_type/fd_rectangle_set_material_dissipation_type.yy",}, {"name":"s_node_gradient_shift","order":15,"path":"sprites/s_node_gradient_shift/s_node_gradient_shift.yy",}, {"name":"node_cache_array","order":8,"path":"scripts/node_cache_array/node_cache_array.yy",}, + {"name":"node_array_convolute","order":16,"path":"scripts/node_array_convolute/node_array_convolute.yy",}, {"name":"sh_channel_A_grey","order":10,"path":"shaders/sh_channel_A_grey/sh_channel_A_grey.yy",}, {"name":"draw_rect_border","order":6,"path":"scripts/draw_rect_border/draw_rect_border.yy",}, {"name":"node_composite","order":1,"path":"scripts/node_composite/node_composite.yy",}, @@ -1493,6 +1494,7 @@ {"name":"mac_window_step","order":1,"path":"scripts/mac_window_step/mac_window_step.yy",}, {"name":"s_node_image","order":1,"path":"sprites/s_node_image/s_node_image.yy",}, {"name":"__node_value_processor","order":6,"path":"scripts/__node_value_processor/__node_value_processor.yy",}, + {"name":"hotkey_data","order":16,"path":"scripts/hotkey_data/hotkey_data.yy",}, {"name":"s_node_group_input","order":16,"path":"sprites/s_node_group_input/s_node_group_input.yy",}, {"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",}, {"name":"__matrix3","order":5,"path":"scripts/__matrix3/__matrix3.yy",}, @@ -1508,6 +1510,7 @@ {"name":"__node_3d_extrude","order":3,"path":"scripts/__node_3d_extrude/__node_3d_extrude.yy",}, {"name":"node_path_array","order":11,"path":"scripts/node_path_array/node_path_array.yy",}, {"name":"node_scale","order":8,"path":"scripts/node_scale/node_scale.yy",}, + {"name":"o_dialog_run_shell","order":13,"path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",}, {"name":"panel_array_sequence","order":3,"path":"scripts/panel_array_sequence/panel_array_sequence.yy",}, {"name":"sh_displace","order":5,"path":"shaders/sh_displace/sh_displace.yy",}, {"name":"fd_rectangle_get_material_height","order":10,"path":"scripts/fd_rectangle_get_material_height/fd_rectangle_get_material_height.yy",}, @@ -1597,6 +1600,7 @@ {"name":"panel_node_data_gen","order":9,"path":"scripts/panel_node_data_gen/panel_node_data_gen.yy",}, {"name":"node_dynamic_surface_out","order":1,"path":"scripts/node_dynamic_surface_out/node_dynamic_surface_out.yy",}, {"name":"fd_rectangle_update_material","order":21,"path":"scripts/fd_rectangle_update_material/fd_rectangle_update_material.yy",}, + {"name":"s_node_array_convolute","order":16,"path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",}, {"name":"sh_perlin_tiled","order":6,"path":"shaders/sh_perlin_tiled/sh_perlin_tiled.yy",}, {"name":"sh_time_remap","order":2,"path":"shaders/sh_time_remap/sh_time_remap.yy",}, ], diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 8e1bdf93d..fb09dd8fe 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -623,6 +623,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_active.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_fg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_inner_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_tab.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_scroll_bar.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_selection.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, @@ -1840,6 +1841,7 @@ {"id":{"name":"fd_rectangle_set_material_dissipation_type","path":"scripts/fd_rectangle_set_material_dissipation_type/fd_rectangle_set_material_dissipation_type.yy",},}, {"id":{"name":"s_node_gradient_shift","path":"sprites/s_node_gradient_shift/s_node_gradient_shift.yy",},}, {"id":{"name":"node_cache_array","path":"scripts/node_cache_array/node_cache_array.yy",},}, + {"id":{"name":"node_array_convolute","path":"scripts/node_array_convolute/node_array_convolute.yy",},}, {"id":{"name":"sh_channel_A_grey","path":"shaders/sh_channel_A_grey/sh_channel_A_grey.yy",},}, {"id":{"name":"draw_rect_border","path":"scripts/draw_rect_border/draw_rect_border.yy",},}, {"id":{"name":"node_composite","path":"scripts/node_composite/node_composite.yy",},}, @@ -2207,6 +2209,7 @@ {"id":{"name":"mac_window_step","path":"scripts/mac_window_step/mac_window_step.yy",},}, {"id":{"name":"s_node_image","path":"sprites/s_node_image/s_node_image.yy",},}, {"id":{"name":"__node_value_processor","path":"scripts/__node_value_processor/__node_value_processor.yy",},}, + {"id":{"name":"hotkey_data","path":"scripts/hotkey_data/hotkey_data.yy",},}, {"id":{"name":"s_node_group_input","path":"sprites/s_node_group_input/s_node_group_input.yy",},}, {"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},}, {"id":{"name":"load_function","path":"scripts/load_function/load_function.yy",},}, @@ -2224,6 +2227,7 @@ {"id":{"name":"__node_3d_extrude","path":"scripts/__node_3d_extrude/__node_3d_extrude.yy",},}, {"id":{"name":"node_path_array","path":"scripts/node_path_array/node_path_array.yy",},}, {"id":{"name":"node_scale","path":"scripts/node_scale/node_scale.yy",},}, + {"id":{"name":"o_dialog_run_shell","path":"objects/o_dialog_run_shell/o_dialog_run_shell.yy",},}, {"id":{"name":"node_array_insert","path":"scripts/node_array_insert/node_array_insert.yy",},}, {"id":{"name":"panel_array_sequence","path":"scripts/panel_array_sequence/panel_array_sequence.yy",},}, {"id":{"name":"sh_displace","path":"shaders/sh_displace/sh_displace.yy",},}, @@ -2331,6 +2335,7 @@ {"id":{"name":"panel_node_data_gen","path":"scripts/panel_node_data_gen/panel_node_data_gen.yy",},}, {"id":{"name":"node_dynamic_surface_out","path":"scripts/node_dynamic_surface_out/node_dynamic_surface_out.yy",},}, {"id":{"name":"fd_rectangle_update_material","path":"scripts/fd_rectangle_update_material/fd_rectangle_update_material.yy",},}, + {"id":{"name":"s_node_array_convolute","path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},}, {"id":{"name":"sh_perlin_tiled","path":"shaders/sh_perlin_tiled/sh_perlin_tiled.yy",},}, {"id":{"name":"sh_time_remap","path":"shaders/sh_time_remap/sh_time_remap.yy",},}, {"id":{"name":"rm_main","path":"rooms/rm_main/rm_main.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index cd2b23258..2614d7fb7 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_crash_handler/Create_0.gml b/objects/o_crash_handler/Create_0.gml index 42d493cf8..d2a33a1d3 100644 --- a/objects/o_crash_handler/Create_0.gml +++ b/objects/o_crash_handler/Create_0.gml @@ -41,15 +41,11 @@ gameframe_button_array = []; if(!file_exists(path)) game_end(1); crash_content = file_text_read_all(path); - log_surface = surface_create(1, 1); - log_y = 0; - log_y_to = 0; + log_surface = surface_create(1, 1); + log_y = 0; + log_y_to = 0; - LOCALE = { - config: { - per_character_line_break: true - } - } + LOCALE = { config: { per_character_line_break: true } } win_w = 640; win_h = 480; diff --git a/objects/o_crash_handler/Draw_64.gml b/objects/o_crash_handler/Draw_64.gml index 6472968ec..34ee8ad31 100644 --- a/objects/o_crash_handler/Draw_64.gml +++ b/objects/o_crash_handler/Draw_64.gml @@ -12,7 +12,7 @@ if(win_w != w || win_h != h) { } draw_set_text(_f_p1, fa_left, fa_center, c_white); -draw_text(34, 18, __txt("Pixel Composer crashed")); +draw_text(34, 18, "Pixel Composer crashed"); draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); #region display @@ -75,7 +75,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); } draw_sprite_ext(s_copy, 0, bx0 + 16, by0 + 16, 0.5, 0.5, 0, #8fde5d, 1); - draw_text(bx0 + 32, by0 + 16, __txt("Copy") + " "); + draw_text(bx0 + 32, by0 + 16, "Copy" + " "); #endregion #region close @@ -95,7 +95,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); draw_sprite_stretched(s_button, 1, bx0, by0, bw, bh); } else draw_sprite_stretched(s_button, 0, bx0, by0, bw, bh); - draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Close")); + draw_text(bx0 + bw / 2, by0 + bh / 2, "Close"); #endregion #region open log @@ -115,7 +115,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); draw_sprite_stretched(s_button, 1, bx0, by0, bw, bh); } else draw_sprite_stretched(s_button, 0, bx0, by0, bw, bh); - draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Open log folder")); + draw_text(bx0 + bw / 2, by0 + bh / 2, "Open log folder"); #endregion #region restart @@ -137,7 +137,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); draw_sprite_stretched(s_button, 1, bx0, by0, bw, bh); } else draw_sprite_stretched(s_button, 0, bx0, by0, bw, bh); - draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Restart application")); + draw_text(bx0 + bw / 2, by0 + bh / 2, "Restart application"); #endregion #region discord diff --git a/objects/o_dialog_assetbox/Create_0.gml b/objects/o_dialog_assetbox/Create_0.gml index 8a48d722f..163dad504 100644 --- a/objects/o_dialog_assetbox/Create_0.gml +++ b/objects/o_dialog_assetbox/Create_0.gml @@ -41,17 +41,18 @@ event_inherited(); #endregion #region surface - folderW = ui(200); + folderW = ui(204); folderW_dragging = false; folderW_drag_mx = 0; folderW_drag_sx = 0; - content_w = dialog_w - ui(36) - folderW; + content_w = dialog_w - ui(34) - folderW; content_h = dialog_h - ui(32); function onResize() { - content_w = dialog_w - ui(36) - folderW; + content_w = dialog_w - ui(34) - folderW; content_h = dialog_h - ui(32); + contentPane.resize(content_w, content_h); folderPane.resize(folderW - ui(12), content_h - ui(32)); } @@ -61,14 +62,20 @@ event_inherited(); var hh = 8; for(var i = 0; i < ds_list_size(global.ASSETS.subDir); i++) { - var hg = global.ASSETS.subDir[| i].draw(self, ui(8), _y + 8, _m, folderPane.surface_w - ui(16), - sHOVER && folderPane.hover, sFOCUS, global.ASSETS); + var _w = folderPane.surface_w - ui(16); + var _hover = sHOVER && folderPane.hover; + var _clr = { + selecting : COLORS.assetbox_current_bg + } + + var hg = global.ASSETS.subDir[| i].draw(self, ui(8), _y + 8, _m, _w, _hover, sFOCUS, global.ASSETS, _clr); hh += hg; _y += hg; } return hh + 8; }); + folderPane.always_scroll = true; contentPane = new scrollPane(content_w, content_h, function(_y, _m) { draw_clear_alpha(c_white, 0); diff --git a/objects/o_dialog_assetbox/Draw_64.gml b/objects/o_dialog_assetbox/Draw_64.gml index 7fadfcf91..4332fb409 100644 --- a/objects/o_dialog_assetbox/Draw_64.gml +++ b/objects/o_dialog_assetbox/Draw_64.gml @@ -20,8 +20,8 @@ draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text); draw_text(dialog_x + ui(16), dialog_y + ui(16), __txt("Assets")); - draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(16), dialog_y + ui(48), folderW - ui(8), dialog_h - ui(64)); - draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(16) + folderW, dialog_y + ui(16), dialog_w - ui(32) - folderW, dialog_h - ui(32)); + draw_sprite_stretched(THEME.ui_panel_inner_bg, 0, dialog_x + ui(16), dialog_y + ui(48), folderW - ui(24), dialog_h - ui(64)); + draw_sprite_stretched(THEME.ui_panel_inner_bg, 0, dialog_x + ui(12) + folderW, dialog_y + ui(16), dialog_w - ui(28) - folderW, dialog_h - ui(32)); var dx0 = dialog_x + ui(16) + folderW - ui(8); var dx1 = dialog_x + ui(16) + folderW; @@ -41,5 +41,5 @@ folderPane.draw(dialog_x + ui(16), dialog_y + ui(48)); contentPane.setFocusHover(sFOCUS, sHOVER); - contentPane.draw(dialog_x + ui(20) + folderW, dialog_y + ui(16)); + contentPane.draw(dialog_x + ui(12) + folderW, dialog_y + ui(16)); #endregion \ No newline at end of file diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 1ebefd417..727ba56f9 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -29,6 +29,11 @@ event_inherited(); page[2] = __txt("Theme"); page[3] = __txt("Hotkeys"); + section_current = ""; + sections = array_create(array_length(page)); +#endregion + +#region general pref_global = ds_list_create(); ds_list_add(pref_global, [ @@ -351,6 +356,8 @@ event_inherited(); var cx = x1 - cw - ui(8); var category = ""; + var sect = []; + for( var i = 0, n = array_length(COLOR_KEYS); i < n; i++ ) { var key = COLOR_KEYS[i]; var val = variable_struct_get(COLORS, key); @@ -363,8 +370,15 @@ event_inherited(); var cat = spl[0] == ""? spl[1] : spl[0]; if(cat != category) { category = cat; + var _sect = string_title(category); + draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); - draw_text(ui(16), yy, string_title(category)); + draw_text(ui(16), yy, _sect); + + array_push(sect, [ _sect, sp_colors, hh ]); + if(yy > 0 && section_current == "") + section_current = _sect; + yy += string_height(category) + ui(8); hh += string_height(category) + ui(8); ind = 0; @@ -401,6 +415,8 @@ event_inherited(); ind++; } + sections[2] = sect; + return hh; }); @@ -410,92 +426,6 @@ event_inherited(); } #endregion -#region draw - current_list = pref_global; - - sp_pref = new scrollPane(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding), function(_y, _m, _r) { - draw_clear_alpha(COLORS.panel_bg_clear, 0); - var hh = 0; - var th = TEXTBOX_HEIGHT; - var x1 = sp_pref.surface_w; - var yy = _y + ui(8); - var padd = ui(6); - var ind = 0; - - for(var i = 0; i < ds_list_size(current_list); i++) { - var _pref = current_list[| i]; - if(is_string(_pref)) continue; - - var name = _pref[0]; - if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0) - continue; - - _pref[2].register(sp_pref); - } - - for(var i = 0; i < ds_list_size(current_list); i++) { - var _pref = current_list[| i]; - var th = TEXTBOX_HEIGHT; - - if(is_string(_pref)) { - draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); - draw_text(ui(16), yy, _pref); - yy += string_height(_pref) + ui(8); - hh += string_height(_pref) + ui(8); - ind = 0; - continue; - } - - var name = _pref[0]; - var txt = _pref[1]; - if(is_method(txt)) - txt = txt(); - else - txt = PREF_MAP[? txt]; - - if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0) - continue; - - if(ind % 2 == 0) - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yy - padd, sp_pref.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1); - - draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); - draw_text(ui(8), yy + th / 2, _pref[0]); - _pref[2].setFocusHover(sFOCUS, sHOVER && sp_pref.hover); - - var widget_w = ui(240); - var widget_h = th; - - if(instanceof(_pref[2]) == "textBox") - widget_w = _pref[2].input == TEXTBOX_INPUT.text? ui(400) : widget_w; - - var widget_x = x1 - ui(4) - widget_w; - var widget_y = yy; - - var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, txt, {}, _m, _r[0], _r[1]); - if(instanceof(_pref[2]) == "checkBox") - params.halign = fa_center; - - var th = _pref[2].drawParam(params) ?? 0; - - yy += th + padd + ui(8); - hh += th + padd + ui(8); - ind++; - } - - return hh; - }); -#endregion - -#region search - tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { - search_text = str; - }); - tb_search.align = fa_left; - - search_text = ""; -#endregion - #region hotkey pref_hot = ds_list_create(); ds_list_add(pref_hot, [ @@ -525,8 +455,9 @@ event_inherited(); draw_set_text(f_p0, fa_left, fa_top); - var yy = _y + ui(8); - var ind = 0; + var yy = _y + ui(8); + var ind = 0; + var sect = []; for( var i = 0, n = ds_list_size(pref_hot); i < n; i++ ) { var _pref = pref_hot[| i]; @@ -579,8 +510,14 @@ event_inherited(); if(group != currGroup) { if(group != "") hh += ui(12); + + var _grp = group == ""? __txt("Global") : group; draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); - draw_text(ui(16), yy + hh, group == ""? __txt("Global") : group); + draw_text(ui(16), yy + hh, _grp); + + array_push(sect, [ _grp, sp_hotkey, hh ]); + if(yy > 0 && section_current == "") + section_current = _grp; hh += string_height("l") + ui(16); currGroup = group; @@ -685,7 +622,96 @@ event_inherited(); } } + + + sections[3] = sect; + return hh; }) #endregion +#region draw + current_list = pref_global; + + sp_pref = new scrollPane(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding), function(_y, _m, _r) { + draw_clear_alpha(COLORS.panel_bg_clear, 0); + var hh = 0; + var th = TEXTBOX_HEIGHT; + var x1 = sp_pref.surface_w; + var yy = _y + ui(8); + var padd = ui(6); + var ind = 0; + + for(var i = 0; i < ds_list_size(current_list); i++) { + var _pref = current_list[| i]; + if(is_string(_pref)) continue; + + var name = _pref[0]; + if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0) + continue; + + _pref[2].register(sp_pref); + } + + for(var i = 0; i < ds_list_size(current_list); i++) { + var _pref = current_list[| i]; + var th = TEXTBOX_HEIGHT; + + if(is_string(_pref)) { + draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); + draw_text(ui(16), yy, _pref); + yy += string_height(_pref) + ui(8); + hh += string_height(_pref) + ui(8); + ind = 0; + continue; + } + + var name = _pref[0]; + var txt = _pref[1]; + if(is_method(txt)) + txt = txt(); + else + txt = PREF_MAP[? txt]; + + if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0) + continue; + + if(ind % 2 == 0) + draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yy - padd, sp_pref.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1); + + draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); + draw_text(ui(8), yy + th / 2, _pref[0]); + _pref[2].setFocusHover(sFOCUS, sHOVER && sp_pref.hover); + + var widget_w = ui(240); + var widget_h = th; + + if(instanceof(_pref[2]) == "textBox") + widget_w = _pref[2].input == TEXTBOX_INPUT.text? ui(400) : widget_w; + + var widget_x = x1 - ui(4) - widget_w; + var widget_y = yy; + + var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, txt, {}, _m, _r[0], _r[1]); + if(instanceof(_pref[2]) == "checkBox") + params.halign = fa_center; + + var th = _pref[2].drawParam(params) ?? 0; + + yy += th + padd + ui(8); + hh += th + padd + ui(8); + ind++; + } + + return hh; + }); +#endregion + +#region search + tb_search = new textBox(TEXTBOX_INPUT.text, function(str) { + search_text = str; + }); + tb_search.align = fa_left; + + search_text = ""; +#endregion diff --git a/objects/o_dialog_preference/Draw_64.gml b/objects/o_dialog_preference/Draw_64.gml index 52448e1c3..08cf0231f 100644 --- a/objects/o_dialog_preference/Draw_64.gml +++ b/objects/o_dialog_preference/Draw_64.gml @@ -17,9 +17,11 @@ if !ready exit; #endregion #region page + var xx = dialog_x + ui(padding + 8); var yy = dialog_y + ui(title_height); var yl = yy - ui(8); var hg = line_get_height(f_p0, 16); + var hs = line_get_height(f_p1, 8); for(var i = 0; i < array_length(page); i++) { draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); @@ -31,12 +33,32 @@ if !ready exit; page_current = i; } - draw_text(dialog_x + ui(padding + 8), yl + hg / 2, page[i]); + draw_text(xx, yl + hg / 2, page[i]); yl += hg; + + if(i == page_current && sections[i] != 0) { + for( var j = 0, m = array_length(sections[i]); j < m; j++ ) { + var sect = sections[i][j]; + + draw_set_text(f_p1, fa_left, fa_center, section_current == sect[0]? COLORS._main_text : COLORS._main_text_sub); + + if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yl, dialog_x + page_width + ui(padding + 8), yl + hs - 1)) { + if(mouse_press(mb_left, sFOCUS)) + sect[1].scroll_y_to = -sect[2]; + + draw_set_color(COLORS._main_text); + } + + draw_text(xx + ui(16), yl + hs / 2, sect[0]); + + yl += hs; + } + } } #endregion #region draw + section_current = ""; var px = dialog_x + ui(padding + page_width); var py = dialog_y + ui(title_height); var pw = dialog_w - ui(padding + page_width + padding); diff --git a/objects/o_dialog_run_shell/Create_0.gml b/objects/o_dialog_run_shell/Create_0.gml new file mode 100644 index 000000000..2ba33a06f --- /dev/null +++ b/objects/o_dialog_run_shell/Create_0.gml @@ -0,0 +1,35 @@ +/// @description init +event_inherited(); + +#region data + dialog_w = ui(640); + dialog_h = ui(140); + + node = noone; + prog = ""; + cmd = ""; + + ctxt = []; + + function setData(_node, _prog, _cmd) { + node = _node; + prog = _prog; + cmd = _cmd; + + ctxt[0] = $"Do you want {node.name} node to run"; + ctxt[1] = $"{prog} {cmd}"; + ctxt[2] = $"Running unknown shell script can cause damage to your computer. Make sure you trust the author of the node before running it."; + + draw_set_font(f_p0); + var _hh = string_height_ext(ctxt[0], -1, dialog_w - ui(48)) + ui(16); + + draw_set_font(f_code); + _hh += string_height_ext(ctxt[1], -1, dialog_w - ui(64)) + ui(16); + + draw_set_font(f_p0); + _hh += string_height_ext(ctxt[2], -1, dialog_w - ui(48)); + + dialog_h = _hh + ui(120); + dialog_y = WIN_H / 2 - dialog_h / 2; + } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_run_shell/Draw_64.gml b/objects/o_dialog_run_shell/Draw_64.gml new file mode 100644 index 000000000..41dcd7829 --- /dev/null +++ b/objects/o_dialog_run_shell/Draw_64.gml @@ -0,0 +1,61 @@ +/// @description init +if !ready exit; + +#region dim BG + var lowest = true; + + draw_set_color(c_black); + draw_set_alpha(0.5); + draw_rectangle(0, 0, WIN_W, WIN_H, false); + draw_set_alpha(1); +#endregion + +#region base UI + draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h); + if(sFOCUS) + draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1); +#endregion + +#region text + var py = dialog_y + ui(16); + var txt = __txt($"Running shell script"); + draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); + draw_text(dialog_x + ui(24), py, txt); + py += line_get_height(, 8); + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text_ext(dialog_x + ui(24), py, ctxt[0], -1, dialog_w - ui(48)); + py += string_height_ext(ctxt[0], -1, dialog_w - ui(48)) + ui(16); + + draw_set_text(f_code, fa_left, fa_top, COLORS._main_text); + var _hh = string_height_ext(ctxt[1], -1, dialog_w - ui(64)); + draw_sprite_stretched(THEME.ui_panel_inner_bg, 0, dialog_x + ui(24), py - ui(8), dialog_w - ui(48), _hh + ui(16)); + draw_text_ext(dialog_x + ui(32), py, ctxt[1], -1, dialog_w - ui(64)); + py += _hh + ui(16); + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text_ext(dialog_x + ui(24), py, ctxt[2], -1, dialog_w - ui(48)); + py += string_height_ext(ctxt[2], -1, dialog_w - ui(48)); + + var bw = ui(96), bh = BUTTON_HEIGHT; + var bx1 = dialog_x + dialog_w - ui(16); + var by1 = dialog_y + dialog_h - ui(16); + var bx0 = bx1 - bw; + var by0 = by1 - bh; + + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel")); + if(b == 2) + instance_destroy(); + + bx0 -= bw + ui(12); + var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("run", "Run")); + if(b == 2) { + shell_execute(prog, cmd); + node.trusted = true; + + instance_destroy(); + } +#endregion \ No newline at end of file diff --git a/objects/o_dialog_run_shell/o_dialog_run_shell.yy b/objects/o_dialog_run_shell/o_dialog_run_shell.yy new file mode 100644 index 000000000..81686012c --- /dev/null +++ b/objects/o_dialog_run_shell/o_dialog_run_shell.yy @@ -0,0 +1,37 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "o_dialog_run_shell", + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + ], + "managed": true, + "overriddenProperties": [], + "parent": { + "name": "menu", + "path": "folders/dialog/menu.yy", + }, + "parentObjectId": { + "name": "_p_dialog", + "path": "objects/_p_dialog/_p_dialog.yy", + }, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, +} \ No newline at end of file diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml index f41b92826..c870c7b0b 100644 --- a/scripts/__node_iterator/__node_iterator.gml +++ b/scripts/__node_iterator/__node_iterator.gml @@ -73,10 +73,14 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) } static iterationUpdate = function() { - for( var i = 0; i < ds_list_size(nodes); i++ ) // check if every node is updated - if(!nodes[| i].rendered) return; - var maxIter = getIterationCount(); + + for( var i = 0; i < ds_list_size(nodes); i++ ) // check if every node is updated + if(!nodes[| i].rendered) { + LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [RENDER FAILED] >------------------"); + return; + } + iterated++; for( var i = 0; i < ds_list_size(nodes); i++ ) diff --git a/scripts/d3d_object/d3d_object.gml b/scripts/d3d_object/d3d_object.gml index 8ae2768a5..148931b4f 100644 --- a/scripts/d3d_object/d3d_object.gml +++ b/scripts/d3d_object/d3d_object.gml @@ -30,7 +30,7 @@ function __3dObject() constructor { size = new __vec3(1); materials = []; - matrial_index = []; + material_index = []; texture_flip = false; static checkParameter = function(params = {}, forceUpdate = false) { #region @@ -143,7 +143,7 @@ function __3dObject() constructor { gpu_set_tex_repeat(true); for( var i = 0, n = array_length(VB); i < n; i++ ) { - var _ind = array_safe_get(matrial_index, i, i); + var _ind = array_safe_get(material_index, i, i); var _mat = array_safe_get(materials, _ind, noone); if(_shader == sh_d3d_default) { diff --git a/scripts/directory_object/directory_object.gml b/scripts/directory_object/directory_object.gml index 2870ea564..38b8cfa6a 100644 --- a/scripts/directory_object/directory_object.gml +++ b/scripts/directory_object/directory_object.gml @@ -184,21 +184,23 @@ function DirectoryObject(name, path) constructor { ds_list_destroy(_temp_name); } - static draw = function(parent, _x, _y, _m, _w, _hover, _focus, _homedir) { + static draw = function(parent, _x, _y, _m, _w, _hover, _focus, _homedir, _colors = {}) { var hg = ui(28); var hh = 0; + var color_selecting = struct_try_get(_colors, "selecting", COLORS.collection_path_current_bg); + if(path == parent.context.path) - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _x + ui(28), _y, _w - ui(36), hg, COLORS.collection_path_current_bg, 1); + draw_sprite_stretched_ext(THEME.group_label, 1, _x + ui(28), _y, _w - ui(36), hg, color_selecting, 1); if(!ds_list_empty(subDir) && _hover && point_in_rectangle(_m[0], _m[1], _x, _y, ui(32), _y + hg - 1)) { - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _x, _y, ui(32), hg, COLORS.collection_path_current_bg, 1); + draw_sprite_stretched_ext(THEME.group_label, 1, _x, _y, ui(32), hg, color_selecting, 1); if(mouse_press(mb_left, _focus)) open = !open; } if(_hover && point_in_rectangle(_m[0], _m[1], _x + ui(32), _y, _w, _y + hg - 1)) { - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _x + ui(28), _y, _w - ui(36), hg, COLORS.collection_path_current_bg, 1); + draw_sprite_stretched_ext(THEME.group_label, 1, _x + ui(28), _y, _w - ui(36), hg, color_selecting, 1); if(mouse_press(mb_left, _focus)) { if(!ds_list_empty(subDir)) open = !open; @@ -224,7 +226,7 @@ function DirectoryObject(name, path) constructor { if(open && !ds_list_empty(subDir)) { var l_y = _y; for(var i = 0; i < ds_list_size(subDir); i++) { - var _hg = subDir[| i].draw(parent, _x + ui(16), _y, _m, _w - ui(16), _hover, _focus, _homedir); + var _hg = subDir[| i].draw(parent, _x + ui(16), _y, _m, _w - ui(16), _hover, _focus, _homedir, _colors); draw_set_color(COLORS.collection_tree_line); draw_line(_x + ui(12), _y + hg / 2, _x + ui(16), _y + hg / 2); diff --git a/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml b/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml index 9dcc14083..da6aa585c 100644 --- a/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml +++ b/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml @@ -7,8 +7,9 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = return; } - var sample = corner / 4; - sample = clamp(sample, 1, 8); + var sample = floor(corner / 8); + sample = clamp(sample, 0, 8); + if(sample == 0) corner = 0; if(cx == noone) cx = (x0 + x1) / 2; if(cy == noone) cy = (y0 + y1) / 2; @@ -210,8 +211,9 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = } function draw_line_elbow_diag_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_white, col2 = c_white, corner = 0, indexIn = 1, indexOut = 1, type = LINE_STYLE.solid) { - var sample = corner / 4; - sample = clamp(sample, 1, 8); + var sample = floor(corner / 8); + sample = clamp(sample, 0, 8); + if(sample == 0) corner = 0; var rat = abs(x0 - x1) / (abs(x0 - x1) + abs(y0 - y1)); var colc = merge_color(col1, col2, rat); diff --git a/scripts/hotkey_data/hotkey_data.gml b/scripts/hotkey_data/hotkey_data.gml new file mode 100644 index 000000000..a99085935 --- /dev/null +++ b/scripts/hotkey_data/hotkey_data.gml @@ -0,0 +1,84 @@ +#region + globalvar HOTKEYS_CUSTOM; + HOTKEYS_CUSTOM = { + "Node_Canvas": { + "Selection": new hotkeySimple("S"), + "Pencil": new hotkeySimple("B"), + "Eraser": new hotkeySimple("E"), + "Rectangle": new hotkeySimple("N"), + "Ellipse": new hotkeySimple("M"), + "Fill": new hotkeySimple("F"), + } + }; +#endregion + +#region hotkeys + function hotkeySimple(_key) constructor { + self.key = _key; + } + + function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor { + context = _context; + name = _name; + key = _key; + modi = _mod; + action = _action; + + dKey = _key; + dModi = _mod; + + static serialize = function() { + var ll = ds_list_create(); + ll[| 0] = context; + ll[| 1] = name; + ll[| 2] = key; + ll[| 3] = modi; + return ll; + } + + static deserialize = function(ll) { + key = ll[| 2]; + modi = ll[| 3]; + } + } + + function addHotkey(_context, _name, _key, _mod, _action) { + if(is_string(_key)) { + var ind = key_get_index(_key); + _key = ind? ind : ord(_key); + } + + var key = new hotkeyObject(_context, _name, _key, _mod, _action); + + if(!ds_map_exists(HOTKEYS, _context)) { + HOTKEYS[? _context] = ds_list_create(); + if(!ds_list_exist(HOTKEY_CONTEXT, _context)) + ds_list_add(HOTKEY_CONTEXT, _context); + } + + for(var i = 0; i < ds_list_size(HOTKEYS[? _context]); i++) { + var hotkey = HOTKEYS[? _context][| i]; + if(hotkey.name == key.name) { + delete HOTKEYS[? _context][| i]; + HOTKEYS[? _context][| i] = key; + return; + } + } + + if(_context == "") + ds_list_insert(HOTKEYS[? _context], 0, key); + else + ds_list_add(HOTKEYS[? _context], key); + } +#endregion + +#region functions + function getHotkey(_group, _key, _def = "") { + gml_pragma("forceinline"); + + if(!struct_has(HOTKEYS_CUSTOM, _group)) return def; + + var _grp = HOTKEYS_CUSTOM[$ _group]; + return struct_try_get(_grp, _key, _def); + } +#endregion \ No newline at end of file diff --git a/scripts/hotkey_data/hotkey_data.yy b/scripts/hotkey_data/hotkey_data.yy new file mode 100644 index 000000000..8c9a20a33 --- /dev/null +++ b/scripts/hotkey_data/hotkey_data.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "hotkey_data", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "startup scripts", + "path": "folders/main/startup scripts.yy", + }, +} \ No newline at end of file diff --git a/scripts/mtl_reader/mtl_reader.gml b/scripts/mtl_reader/mtl_reader.gml index b7deba5a8..1968ff690 100644 --- a/scripts/mtl_reader/mtl_reader.gml +++ b/scripts/mtl_reader/mtl_reader.gml @@ -25,7 +25,7 @@ function readMtl(path) { var file = file_text_open_read(path); while(!file_text_eof(file)) { var l = file_text_readln(file); - l = string_replace_all(l, "\n", ""); + l = string_trim(l); var sep = string_splice(l, " "); if(array_length(sep) == 0 || sep[0] == "") continue; @@ -35,14 +35,16 @@ function readMtl(path) { cur_mat = new MTLmaterial(str_strip_nr(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 "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) + "/" + str_strip_nr(sep[1]); break; case "map_Kd": cur_mat.diff_path = filename_dir(path) + "/" + str_strip_nr(sep[1]); break; case "map_Ks": cur_mat.spec_path = filename_dir(path) + "/" + str_strip_nr(sep[1]); break; } } + file_text_close(file); + return mat; } \ No newline at end of file diff --git a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml index 93068cd41..740712cc6 100644 --- a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml +++ b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml @@ -41,6 +41,12 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) setIsDynamicInput(1); + obj_reading = false; + obj_raw = noone; + obj_read_progress = 0; + obj_read_prog_sub = 0; + obj_read_prog_tot = 3; + current_path = ""; materials = []; materialNames = []; @@ -50,15 +56,9 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { - var _path = getInputData(in_mesh + 0); - updateObj(_path); - } - - function setPath(path) { - inputs[| in_mesh + 0].setValue(path); - updateObj(path); - } + static onInspector1Update = function() { current_path = ""; } + + function setPath(path) { inputs[| in_mesh + 0].setValue(path); } static createNewInput = function(index = -1) { #region if(index == -1) index = ds_list_size(inputs); @@ -99,33 +99,64 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) if(!file_exists(_path)) return; current_path = _path; - var _dir = filename_dir(_path); - var _pathMtl = string_copy(_path, 1, string_length(_path) - 4) + ".mtl"; + readObj_init(); - var _v = readObj(_path); - if(_v == noone) return; + obj_read_file = file_text_open_read(current_path); + } + + static updateObjProcess = function() { + switch(obj_read_progress) { + case 0 : readObj_file(); break; + case 1 : readObj_cent(); break; + case 2 : readObj_buff(); break; + } + } + + static updateObjComplete = function() { #region + if(obj_raw == noone) return; + + var txt = $"========== OBJ import ==========\n"; + txt += $"Vertex counts: {obj_raw.vertex_count}\n"; + txt += $"Object counts: {obj_raw.object_counts}\n"; + txt += $"Material counts: {array_length(obj_raw.materials)}\n"; + txt += $"Model BBOX: {obj_raw.model_size}\n"; + print(txt); + + var span = max(abs(obj_raw.model_size.x), abs(obj_raw.model_size.y), abs(obj_raw.model_size.z)); + if(span > 10) noti_warning($"The model is tool large to display properly ({span}u). Scale the model down to preview."); if(object != noone) object.destroy(); object = new __3dObject(); - object.VB = _v.vertex_groups; - object.vertex = _v.vertex; - object.object_counts = _v.object_counts; + object.VB = obj_raw.vertex_groups; + object.vertex = obj_raw.vertex; + object.object_counts = obj_raw.object_counts; + object.size = obj_raw.model_size; + use_normal = obj_raw.use_normal; - object.size = _v.model_size; - materialNames = _v.materials; - materialIndex = _v.material_index; - use_normal = _v.use_normal; - if(_v.mtl_path != "") - _pathMtl = _dir + "/" + _v.mtl_path; - - if(array_length(materialNames)) - materials = readMtl(_pathMtl); - else { - materialNames = [ "Material" ]; - materialIndex = [ 0 ]; - materials = [ new MTLmaterial("Material") ]; - } + materialNames = [ "Material" ]; + materialIndex = [ 0 ]; + materials = [ new MTLmaterial("Material") ]; + if(array_length(materialNames)) { + var _dir = filename_dir(current_path); + var _pathMtl = string_copy(current_path, 1, string_length(current_path) - 4) + ".mtl"; + if(obj_raw.mtl_path != "") _pathMtl = _dir + "/" + obj_raw.mtl_path; + materials = readMtl(_pathMtl); + + if(array_length(materials) == array_length(obj_raw.materials)) { + materialNames = array_create(array_length(materials)); + for( var i = 0, n = array_length(materials); i < n; i++ ) + materialNames[i] = materials[i].name; + + for( var i = 0, n = array_length(materials); i < n; i++ ) { + var _mat = obj_raw.materials[i]; + var _ord = array_find(materialNames, _mat); + materialIndex[i] = _ord; + } + } else + noti_warning("Load mtl error: Material amount defined in .mtl file not match the .obj file.") + } + array_resize(input_display_list, input_display_len); var _overflow = input_fix_len + array_length(materialNames); @@ -139,15 +170,26 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) } #endregion static step = function() { #region + if(obj_reading) { + updateObjProcess(); + + if(obj_read_progress == obj_read_prog_tot) { + updateObjComplete(); + obj_reading = false; + + triggerRender(); + } + return; + } + var _path = getInputData(in_mesh + 0); + if(_path != current_path) updateObj(_path); } #endregion static processData = function(_output, _data, _output_index, _array_index = 0) { #region - var _path = _data[in_mesh + 0]; - var _flip = _data[in_mesh + 1]; + if(obj_reading) return noone; - if(_path != current_path) - updateObj(_path); + var _flip = _data[in_mesh + 1]; if(object == noone) return noone; var materials = []; @@ -161,7 +203,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) _object.vertex = object.vertex; _object.object_counts = object.object_counts; _object.materials = materials; - _object.matrial_index = materialIndex; + _object.material_index = materialIndex; _object.texture_flip = _flip; setTransform(_object, _data); @@ -169,4 +211,16 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) } #endregion static getPreviewValues = function() { return array_safe_get(all_inputs, in_mesh + 2, noone); } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + if(!obj_reading) return; + + var cx = xx + w * _s / 2; + var cy = yy + h * _s / 2; + var rr = min(w - 32, h - 32) * _s / 2; + + draw_set_color(COLORS._main_icon); + //draw_arc(cx, cy, rr, 90, 90 - 360 * (obj_read_progress + obj_read_prog_sub) / obj_read_prog_tot, 4 * _s, 180); + draw_arc(cx, cy, rr, current_time / 5, current_time / 5 + 90, 4 * _s, 90); + } } \ No newline at end of file diff --git a/scripts/node_array_convolute/node_array_convolute.gml b/scripts/node_array_convolute/node_array_convolute.gml new file mode 100644 index 000000000..2e95d40a9 --- /dev/null +++ b/scripts/node_array_convolute/node_array_convolute.gml @@ -0,0 +1,63 @@ +function Node_Array_Convolute(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { + name = "Array Convulute"; + previewable = false; + + w = 96; + h = 32 + 24; + min_h = h; + + inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setArrayDepth(1) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Kernel", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, []) + .setArrayDepth(1) + .setVisible(true, true); + + outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0) + .setArrayDepth(1); + + static convolute = function(arr, ker) { + __tmp_ker = ker; + __tmp_arr = arr; + __tmp_len = array_length(ker); + __tmp_arn = array_length(arr); + __tmp_st = floor((__tmp_len - 1) / 2); + + return array_map(arr, function(val, ind) { + var ret = 0; + + for(var i = 0; i < __tmp_len; i++) { + var _ind = ind + i - __tmp_st; + if(_ind < 0) continue; + if(_ind >= __tmp_arn) continue; + + ret += __tmp_arr[_ind] * __tmp_ker[i]; + } + + return ret; + }); + } + + static update = function(frame = PROJECT.animator.current_frame) { + var _arr = getInputData(0); + var _ker = getInputData(1); + + if(array_empty(_arr) || array_empty(_ker)) return; + + var res; + + if(is_array(_arr[0])) { + for( var i = 0, n = array_length(_arr); i < n; i++ ) + res[i] = convolute(_arr[i], _ker); + } else + res = convolute(_arr, _ker); + + outputs[| 0].setValue(res); + } + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_fit(s_node_array_convolute, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + } +} \ No newline at end of file diff --git a/scripts/node_array_convolute/node_array_convolute.yy b/scripts/node_array_convolute/node_array_convolute.yy new file mode 100644 index 000000000..f409e8984 --- /dev/null +++ b/scripts/node_array_convolute/node_array_convolute.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_array_convolute", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "array", + "path": "folders/nodes/data/value/array.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_array_convolute/node_counter.yy b/scripts/node_array_convolute/node_counter.yy new file mode 100644 index 000000000..10832a0b0 --- /dev/null +++ b/scripts/node_array_convolute/node_counter.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "variable", + "path": "folders/nodes/data/variable.yy", + }, + "resourceVersion": "1.0", + "name": "node_counter", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_audio_window/node_audio_window.gml b/scripts/node_audio_window/node_audio_window.gml index e36ba1b5f..f57af36d8 100644 --- a/scripts/node_audio_window/node_audio_window.gml +++ b/scripts/node_audio_window/node_audio_window.gml @@ -9,7 +9,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 0] = nodeValue("Audio data", self, JUNCTION_CONNECT.input, VALUE_TYPE.audioBit, noone) .setVisible(true, true); - inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 64, "Amount of bits to extract."); + inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4096, "Amount of bits to extract."); inputs[| 2] = nodeValue("Location", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY._default, { unit: 0, side_button: button(function() { @@ -21,12 +21,12 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr } ); - inputs[| 3] = nodeValue("Cursor location", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Cursor location", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) .setDisplay(VALUE_DISPLAY.enum_button, [ "Start", "Middle", "End" ]); - inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16); - inputs[| 5] = nodeValue("Match animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Set window cursor to match animation timeline."); + inputs[| 5] = nodeValue("Match timeline", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Set window cursor to match animation timeline."); outputs[| 0] = nodeValue("Bit Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) .setArrayDepth(1); @@ -43,6 +43,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _anim = getInputData(5); inputs[| 2].setVisible(!_anim); + update_on_frame = _anim; } static update = function(frame = PROJECT.animator.current_frame) { @@ -74,9 +75,10 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr case 2 : st = off - _wid; break; } - ed = st + _wid; st = clamp(st, 0, _aud.packet - 1); - ed = clamp(ed, 0, _aud.packet - 1); + + ed = clamp(st + _wid, 0, _aud.packet - 1); + st = clamp(ed - _wid, 0, _aud.packet - 1); len = (ed - st) / _stp; preview_cr = off / _aud.packet; diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 1312cb0f7..dd0b3b85a 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -73,12 +73,12 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor ]; tools = [ - new NodeTool( "Selection", [ THEME.canvas_tools_selection_rectangle, THEME.canvas_tools_selection_circle ] ), - new NodeTool( "Pencil", THEME.canvas_tools_pencil ), - new NodeTool( "Eraser", THEME.canvas_tools_eraser ), + new NodeTool( "Selection", [ THEME.canvas_tools_selection_rectangle, THEME.canvas_tools_selection_circle ]), + new NodeTool( "Pencil", THEME.canvas_tools_pencil), + new NodeTool( "Eraser", THEME.canvas_tools_eraser), new NodeTool( "Rectangle", [ THEME.canvas_tools_rect, THEME.canvas_tools_rect_fill ]), new NodeTool( "Ellipse", [ THEME.canvas_tools_ellip, THEME.canvas_tools_ellip_fill ]), - new NodeTool( "Fill", THEME.canvas_tools_bucket ), + new NodeTool( "Fill", THEME.canvas_tools_bucket), ]; draw_stack = ds_list_create(); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 307f4628a..54de3ec17 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -180,7 +180,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc } #endregion static getNextNodesExternal = function() { #region //get node connected to the parent object - LOG_IF(global.FLAG.render, $"Checking next node external for {internalName}"); + LOG_IF(global.FLAG.render, $"Checking next node external for {INAME}"); LOG_BLOCK_START(); var nodes = []; @@ -205,7 +205,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static setRenderStatus = function(result) { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); + LOG_IF(global.FLAG.render, $"Set render status for {INAME} : {result}"); rendered = result; if(result) @@ -444,7 +444,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static resetRender = function() { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"Reset Render for {internalName}"); + LOG_IF(global.FLAG.render, $"Reset Render for {INAME}"); for( var i = 0; i < ds_list_size(nodes); i++ ) { LOG_IF(global.FLAG.render, $"Reseting {nodes[| i].internalName}"); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index f7b2f3a42..3b0793280 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -32,10 +32,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) attributes.layer_selectable = []; hold_visibility = true; - hold_select = true; - layer_dragging = noone; - layer_remove = -1; - layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region + hold_select = true; + layer_dragging = noone; + layer_remove = -1; + layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1; if(array_length(current_data) != ds_list_size(inputs)) return 0; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 571d11bba..f616635dc 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1,5 +1,7 @@ global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ]; +#macro INAME internalName == ""? name : internalName + enum CACHE_USE { none, manual, @@ -413,11 +415,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } #endregion static getInputs = function() { #region - input_hash_raw = ""; inputs_data = array_create(ds_list_size(inputs), undefined); + //input_hash_raw = ""; + for(var i = 0; i < ds_list_size(inputs); i++) { inputs_data[i] = inputs[| i].getValue(,,, true); - input_hash_raw += string_copy(string(inputs_data[i]), 1, 256); + //input_hash_raw += string_copy(string(inputs_data[i]), 1, 256); } } #endregion @@ -429,24 +432,28 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static doUpdate = function() { #region if(SAFE_MODE) return; if(NODE_EXTRACT) return; - + var render_timer = get_timer(); if(cached_manual || (use_cache == CACHE_USE.auto && recoverCache())) { render_cached = true; + + if(!is_instanceof(self, Node_Collection)) setRenderStatus(true); } else { render_cached = false; var sBase = surface_get_target(); - var _hash = input_hash; + //var _hash = input_hash; getInputs(); - input_hash = md5_string_unicode(input_hash_raw); - anim_last_step = isAnimated() || _hash != input_hash || !rendered; + //input_hash = md5_string_unicode(input_hash_raw); + anim_last_step = isAnimated() || /*_hash != input_hash || */!rendered; LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $">>>>>>>>>> DoUpdate called from {internalName} [{anim_last_step}] [{update_on_frame}, {isAnimated()}, {_hash != input_hash}, {!rendered}] <<<<<<<<<<"); - + LOG_IF(global.FLAG.render, $">>>>>>>>>> DoUpdate called from {INAME} [{anim_last_step}] <<<<<<<<<<"); + + if(!is_instanceof(self, Node_Collection)) setRenderStatus(true); + try { - if(anim_last_step) update(); ///Update only if input hash differs from previous. + if(anim_last_step) update(); // Update only if input hash differs from previous. } catch(exception) { var sCurr = surface_get_target(); while(surface_get_target() != sBase) @@ -478,10 +485,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(autoUpdatedTrigger) updatedTrigger.setValue(true); - if(!is_instanceof(self, Node_Collection)) { - setRenderStatus(true); + if(!is_instanceof(self, Node_Collection)) render_time = get_timer() - render_timer; - } LOG_BLOCK_END(); } #endregion @@ -498,7 +503,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static triggerRender = function() { #region LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"Trigger render for {internalName}"); + LOG_IF(global.FLAG.render, $"Trigger render for {INAME}"); setRenderStatus(false); UPDATE |= RENDER_TYPE.partial; @@ -534,7 +539,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!val_from.node.active) continue; if(!val_from.node.isRenderActive()) continue; if!(val_from.node.rendered || val_from.node.update_on_frame) { - LOG_LINE_IF(global.FLAG.render, $"Node {internalName} is not renderable because input {val_from.node.internalName} is not rendered ({val_from.node.rendered})"); + LOG_LINE_IF(global.FLAG.render, $"Node {INAME} is not renderable because input {val_from.node.internalName} is not rendered ({val_from.node.rendered})"); return false; } } @@ -549,7 +554,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var nodeNames = []; LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from: {internalName}"); + LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from: {INAME}"); LOG_BLOCK_START(); for(var i = 0; i < ds_list_size(outputs); i++) { @@ -587,7 +592,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static onInspect = function() {} static setRenderStatus = function(result) { #region - LOG_LINE_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); + LOG_LINE_IF(global.FLAG.render, $"Set render status for {INAME} : {result}"); rendered = result; } #endregion diff --git a/scripts/node_frame/node_frame.gml b/scripts/node_frame/node_frame.gml index 54fba0e06..440ef0f74 100644 --- a/scripts/node_frame/node_frame.gml +++ b/scripts/node_frame/node_frame.gml @@ -1,3 +1,5 @@ +global.__FRAME_LABEL_SCALE = 1; + function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Frame"; w = 240; @@ -12,7 +14,13 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { size_dragging_my = h; auto_height = false; - name_hover = false; + name_hover = false; + hover_progress = 0; + + color = c_white; + alpha = 1; + scale = 1; + label_color = false; inputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 240, 160 ] ) .setDisplay(VALUE_DISPLAY.vector) @@ -25,29 +33,44 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { .setDisplay(VALUE_DISPLAY.slider) .rejectArray(); + inputs[| 3] = nodeValue("Label size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, global.__FRAME_LABEL_SCALE ) + .setDisplay(VALUE_DISPLAY.slider) + .rejectArray(); + + inputs[| 4] = nodeValue("Blend label", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + .setDisplay(VALUE_DISPLAY.slider) + .rejectArray(); + + static onValueUpdate = function(index = 3) { + global.__FRAME_LABEL_SCALE = getInputData(3); + } + static step = function() { var si = getInputData(0); w = si[0]; h = si[1]; - color = getInputData(1); - alpha = getInputData(2); + color = getInputData(1); + alpha = getInputData(2); + scale = getInputData(3); + label_color = getInputData(4); } static drawNodeBase = function(xx, yy, _s) { draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, color, alpha); var txt = display_name == ""? name : display_name; - draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); + hover_progress = lerp_float(hover_progress, name_hover, 2); + + draw_set_text(f_h5, fa_left, fa_top, merge_color(COLORS._main_text, color, label_color)); draw_set_alpha(clamp(alpha + name_hover * 0.5, 0, 1)); - draw_text_cut(xx + 24, yy + 4 * _s, txt, (w - 8) * _s - 24); + draw_text_cut(xx + 8 + 16 * hover_progress, yy + 4 * _s, txt, (w - 8) * _s - 24, scale); draw_set_alpha(1); } draw_scale = 1; static drawNode = function(_x, _y, _mx, _my, _s) { draw_scale = _s; - //if(group != PANEL_GRAPH.getCurrentContext()) return; if(size_dragging) { w = size_dragging_w + (mouse_mx - size_dragging_mx) / _s; @@ -78,7 +101,7 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var y0 = y1 - 16; var ics = 0.5; - draw_sprite_ext(THEME.node_move, 0, xx + 4, yy + 4 * _s, ics, ics, 0, c_white, 0.25 + 0.35 * name_hover); + if(name_hover) draw_sprite_ext(THEME.node_move, 0, xx + 4, yy + 4 * _s, ics, ics * scale, 0, color, 0.4); if(point_in_rectangle(_mx, _my, xx, yy, x1, y1) || size_dragging) draw_sprite_ext(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 0.5); diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 3af4e7432..6f1cc4d5d 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -35,7 +35,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr } static setRenderStatus = function(result) { - LOG_LINE_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); + LOG_LINE_IF(global.FLAG.render, $"Set render status for {INAME} : {result}"); rendered = result; if(group) group.setRenderStatus(result); diff --git a/scripts/node_iterator_each_output/node_iterator_each_output.gml b/scripts/node_iterator_each_output/node_iterator_each_output.gml index a4deb49d7..7d7612b29 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -38,9 +38,6 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group } static update = function(frame = PROJECT.animator.current_frame) { - if(!variable_struct_exists(group, "iterated")) - return; - if(inputs[| 0].value_from == noone) { group.iterationUpdate(); return; diff --git a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml index fc9f9526f..0931eba74 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -24,9 +24,6 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro } static update = function(frame = PROJECT.animator.current_frame) { - if(!variable_struct_exists(group, "iterated")) - return; - if(inputs[| 0].value_from == noone) { group.iterationUpdate(); return; diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 40d349200..3dc06385b 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -446,7 +446,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { return; } - var base = getValue(); + var base = prop.def_val; for(var i = 0; i < array_length(_data); i++) { var _keyframe = _data[i]; @@ -478,9 +478,10 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { if(is_array(value)) { for(var j = 0; j < array_length(value); j++) _val[j] = processValue(value[j]); - } else if(is_array(base)) + } else if(is_array(base)) { for(var j = 0; j < array_length(base); j++) _val[j] = processValue(value); + } } //print($"Deserialize {prop.node.name}:{prop.name} = {_val} "); diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index 04a09b83c..a164da0f0 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -8,7 +8,9 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { previewable = false; isHovering = false; - hoverExpand = 0; + hover_scale = 0; + hover_scale_to = 0; + hover_alpha = 0; bg_spr = THEME.node_pin_bg; bg_sel_spr = THEME.node_pin_bg_active; @@ -35,13 +37,15 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var xx = x * _s + _x; var yy = y * _s + _y; - inputs[| 0].x = xx - hoverExpand * 12 * _s; + inputs[| 0].x = xx; inputs[| 0].y = yy; - outputs[| 0].x = xx + hoverExpand * 12 * _s; + outputs[| 0].x = xx; outputs[| 0].y = yy; } + static drawJunctionNames = function(_x, _y, _mx, _my, _s) {} + static drawJunctions = function(_x, _y, _mx, _my, _s) { isHovering = false; var hover = noone; @@ -49,27 +53,13 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var yy = y * _s + _y; var hov = PANEL_GRAPH.value_dragging; - if(hov == noone && point_in_rectangle(_mx, _my, xx - 16 * _s, yy - 12 * _s, xx + 16 * _s, yy + 12 * _s)) { + if(hov == noone && point_in_circle(_mx, _my, xx, yy, _s * 24)) { isHovering = true; - - draw_sprite_stretched(THEME.node_bg, 0, xx - 12 * _s, yy - 12 * _s, 24 * _s, 24 * _s); - if(inputs[| 0].drawJunction(_s, _mx, _my)) - hover = inputs[| 0]; - if(outputs[| 0].drawJunction(_s, _mx, _my)) - hover = outputs[| 0]; - } else if(hoverExpand > 0) { - inputs[| 0].drawJunction(_s, _mx, _my) - outputs[| 0].drawJunction(_s, _mx, _my) - } else { - var jun; - if(hov != noone) jun = hov.connect_type == JUNCTION_CONNECT.input? outputs[| 0] : inputs[| 0]; - else jun = inputs[| 0].value_from == noone? inputs[| 0] : outputs[| 0]; - - if(jun.drawJunction(_s, _mx, _my)) - hover = jun; + hover_scale_to = 1; } - hoverExpand = lerp(hoverExpand, isHovering, 1 / 5); + if(outputs[| 0].drawJunction(_s, _mx, _my)) + hover = outputs[| 0]; return hover; } @@ -80,11 +70,18 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var xx = x * _s + _x; var yy = y * _s + _y; + hover_alpha = 0.5; if(active_draw_index > -1) { - draw_sprite_ext(bg_sel_spr, 0, xx, yy, _s, _s, 0, COLORS._main_accent, 1); - active_draw_index = -1; + hover_alpha = 1; + hover_scale_to = 1; + active_draw_index = -1; } + if(hover_scale > 0) + draw_sprite_ext(THEME.node_pin_bg_active, 0, xx, yy, _s * hover_scale, _s * hover_scale, 0, COLORS._main_accent, hover_alpha); + hover_scale = lerp_float(hover_scale, hover_scale_to, 3); + hover_scale_to = 0; + if(renamed && display_name != "" && display_name != "Pin") { draw_set_text(f_p0, fa_center, fa_bottom, COLORS._main_text); draw_text_transformed(xx, yy - 12, display_name, _s, _s, 0); diff --git a/scripts/node_plot_linear/node_plot_linear.gml b/scripts/node_plot_linear/node_plot_linear.gml index 66abc6bc5..eb7c8740c 100644 --- a/scripts/node_plot_linear/node_plot_linear.gml +++ b/scripts/node_plot_linear/node_plot_linear.gml @@ -22,9 +22,9 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 7] = nodeValue("Graph Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1); - inputs[| 8] = nodeValue("Use Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 8] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 9] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); + inputs[| 9] = nodeValue("Background color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black); inputs[| 10] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); @@ -58,13 +58,18 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 23] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.slider); + + inputs[| 24] = nodeValue("Color Over Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white)); + + inputs[| 25] = nodeValue("Value range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] ) + .setDisplay(VALUE_DISPLAY.range); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 0, ["Data", true], 1, 12, 21, 14, 2, 3, 15, 16, - ["Plot", false], 11, 4, 10, 20, 5, 17, 22, 23, - ["Render", false], 6, 13, 7, 18, 19, 8, 9, + ["Plot", false], 11, 4, 10, 20, 5, 22, 23, + ["Render", false], 6, 13, 24, 25, 7, 17, 18, 19, 8, 9, ]; attribute_surface_depth(); @@ -105,14 +110,12 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _sam = _data[ 3]; _sam = max(1, _sam); var _ori = _data[ 4]; var _amp = _data[ 5]; - var _lcl = _data[ 6]; var _lth = _data[ 7]; var _ubg = _data[ 8]; var _bgc = _data[ 9]; var _ang = _data[10]; var _typ = _data[11]; var _off = _data[12]; - var _grd = _data[13]; var _trim_mode = _data[14]; var _win_size = _data[15]; @@ -128,6 +131,11 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _loop = _data[22]; var _smt = _data[23]; + var _lcl = _data[ 6]; + var _cls = _data[13]; + var _clv = _data[24]; + var _clv_r = _data[25]; + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); surface_set_target(_outSurf); @@ -165,18 +173,18 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou } var amo = array_length(_smp_data); - var _px, _py, _ang_nor, _val, _grd_col; + var _px, _py, _ang_nor, _val, _col_sam, _col_val; var _pnt, _ppnt = undefined; - var _bar_spc = _typ == 1? _pnt_spac : _pnt_spac + _bar_wid; + var _bar_spc = _typ == 1? _pnt_spac + 1 : _pnt_spac + _bar_wid; + var _oc; for( var i = 0; i < amo; i++ ) { if(_path == noone) { _px = _ori[0] + lengthdir_x(i * _bar_spc, _ang); _py = _ori[1] + lengthdir_y(i * _bar_spc, _ang); } else { - _pnt = _path.getPointRatio(i / amo); - if(_ppnt == undefined) - _ppnt = _path.getPointRatio(i / amo - 0.001); + _pnt = _path.getPointRatio(i / amo); + _ppnt ??= _path.getPointRatio(i / amo - 0.001); _px = _pnt.x; _py = _pnt.y; @@ -186,11 +194,15 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou } _ang_nor = _ang + 90; + _val = _smp_data[i] + _off; + _col_sam = _cls.eval(i / amo); + _col_val = _clv.eval((_val - _clv_r[0]) - (_clv_r[1] - _clv_r[0])); - _val = _smp_data[i] + _off; + var _c1 = colorMultiply(_lcl, _col_sam); + var _c2 = _col_val; + var _col_final = colorMultiply(_c1, _c2); - _grd_col = _grd.eval(i / amo); - draw_set_color(colorMultiply(_lcl, _grd_col)); + draw_set_color(_col_final); nx = _px + lengthdir_x(_amp * _val, _ang_nor); ny = _py + lengthdir_y(_amp * _val, _ang_nor); @@ -209,10 +221,6 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _b1x = nx + lengthdir_x(dist * _smt, _ang + 180); var _b1y = ny + lengthdir_y(dist * _smt, _ang + 180); - //draw_line(ox, oy, _b0x, _b0y); - //draw_line(_b0x, _b0y, _b1x, _b1y); - //draw_line(_b1x, _b1y, nx, ny); - var _ox = ox, _oy = oy, _nx, _ny; for( var j = 1; j <= 8; j++ ) { @@ -227,8 +235,8 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou _oy = _ny; } } else { - if(_lth > 1) draw_line_round(ox, oy, nx, ny, _lth); - else draw_line(ox, oy, nx, ny); + if(_lth > 1) draw_line_round_color(ox, oy, nx, ny, _lth, _oc, _col_final); + else draw_line_color(ox, oy, nx, ny, _oc, _col_final); } } break; @@ -236,6 +244,7 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou ox = nx; oy = ny; + _oc = _col_final; if(i == 0) { fx = nx; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 3d645b51c..8444752bf 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -548,6 +548,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio addNodeObject(values, "Array Shift", s_node_array_shift, "Node_Array_Shift", [1, Node_Array_Shift]).setVersion(1137); addNodeObject(values, "Array Zip", s_node_array_zip, "Node_Array_Zip", [1, Node_Array_Zip]).setVersion(1138); addNodeObject(values, "Array Copy", s_node_array_copy, "Node_Array_Copy", [1, Node_Array_Copy]).setVersion(1144); + addNodeObject(values, "Array Convolute",s_node_array_convolute, "Node_Array_Convolute", [1, Node_Array_Convolute]).setVersion(11540); addNodeObject(values, "Sort Number", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).setVersion(1120); addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).setVersion(1120); addNodeObject(values, "Loop Array", s_node_loop_array, "Node_Iterate_Each", [1, Node_Iterate_Each], ["iterate each", "for each", "array loop"], "Create group that iterate to each member in an array."); diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index ecdc1c4df..a99254a70 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -7,6 +7,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 0] = nodeValue("Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF) .setDisplay(VALUE_DISPLAY.vector) .rejectArray(); + + inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -64,6 +66,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr return; var _dim = getInputData(0); + var _rnd = getInputData(1); var _outSurf = outputs[| 0].getValue(); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); @@ -95,8 +98,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr var ixs = max(0, _o.xscale); var iys = max(0, _o.yscale); - var xx = _o.phy_position_x; - var yy = _o.phy_position_y; + var xx = _rnd? round(_o.phy_position_x) : _o.phy_position_x; + var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y; draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha); diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index 077120aed..a183c4415 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -20,7 +20,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 1] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []); + outputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, []); input_display_list = [ ["Shape", false], 0, 1, 4, @@ -35,7 +35,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons surface_w = 1; surface_h = 1; - attributes.max_shape = 32; + attributes.max_shape = 64; array_push(attributeEditors, ["Maximum shapes", function() { return attributes.max_shape; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.max_shape = val; @@ -71,7 +71,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons var hh = surface_get_height_safe(_inSurf); surface_w = ww; surface_h = hh; - + for(var i = 0; i < 2; i++) { temp_surface[i] = surface_verify(temp_surface[i], ww, hh, attrDepth()); @@ -80,112 +80,102 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons surface_reset_target(); } - shader_set(sh_seperate_shape_index); - shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_index, "ignore"), _ignore); - surface_set_target(temp_surface[1]); - draw_sprite_stretched(s_fx_pixel, 0, 0, 0, ww, hh); - surface_reset_target(); - shader_reset(); + #region region indexing + surface_set_shader(temp_surface[1], sh_seperate_shape_index); + shader_set_i("ignore", _ignore); + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, ww, hh); + surface_reset_shader(); - shader_set(sh_seperate_shape_ite); - shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_ite, "ignore"), _ignore); - shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_ite, "dimension"), ww, hh); - shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_ite, "threshold"), _thres); - if(is_surface(_inSurf)) - texture_set_stage(shader_get_sampler_index(sh_seperate_shape_ite, "map"), surface_get_texture(_inSurf)); - - var res_index = 0, iteration = ww + hh; - for(var i = 0; i <= iteration; i++) { - var bg = i % 2; - var fg = !bg; - - surface_set_target(temp_surface[bg]); - DRAW_CLEAR - BLEND_OVERRIDE; - draw_surface_safe(temp_surface[fg], 0, 0); - BLEND_NORMAL; - surface_reset_target(); - - res_index = bg; - } - - shader_reset(); - - var _pixel_surface = surface_create_valid(attributes.max_shape, 1); - surface_set_target(_pixel_surface); - DRAW_CLEAR - BLEND_OVERRIDE; - shader_set(sh_seperate_shape_counter); - texture_set_stage(shader_get_sampler_index(sh_seperate_shape_counter, "surface"), surface_get_texture(temp_surface[res_index])); - shader_set_uniform_f_array_safe(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]); - shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "maxShape"), attributes.max_shape); - shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "ignore"), _ignore); - draw_sprite_ext(s_fx_pixel, 0, 0, 0, attributes.max_shape, 1, 0, c_white, 1); + shader_set(sh_seperate_shape_ite); + shader_set_i("ignore", _ignore); + shader_set_f("dimension", ww, hh); + shader_set_f("threshold", _thres); + shader_set_surface("map", _inSurf); shader_reset(); - BLEND_NORMAL; - surface_reset_target(); - var px = surface_get_pixel(_pixel_surface, 0, 0); + var res_index = 0, iteration = ww + hh; + for(var i = 0; i <= iteration; i++) { + var bg = i % 2; + var fg = !bg; + + surface_set_shader(temp_surface[bg], sh_seperate_shape_ite,, BLEND.over); + draw_surface_safe(temp_surface[fg], 0, 0); + surface_reset_shader(); + + res_index = bg; + } + #endregion - if(px == 0) return; + #region count and match color + var _pixel_surface = surface_create_valid(attributes.max_shape, 1); + surface_set_shader(_pixel_surface, sh_seperate_shape_counter); + shader_set_surface("surface", temp_surface[res_index]); + shader_set_f("dimension", [ ww, hh ]); + shader_set_i("maxShape", attributes.max_shape); + shader_set_i("ignore", _ignore); + + draw_sprite_ext(s_fx_pixel, 0, 0, 0, attributes.max_shape, 1, 0, c_white, 1); + surface_reset_shader(); - var _outSurf, _val; - _val = array_create(px); - outputs[| 0].setValue(_val); + var px = surface_get_pixel(_pixel_surface, 0, 0); + if(px == 0) return; + #endregion + + #region extract region + var _outSurf, _val; + _val = array_create(px); + outputs[| 0].setValue(_val); - var _boundary = array_create(px); + var _atlas = array_create(px); - buffer_delete(surface_buffer); - surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); - buffer_get_surface(surface_buffer, temp_surface[res_index], 0); + buffer_delete(surface_buffer); + surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); + buffer_get_surface(surface_buffer, temp_surface[res_index], 0); - for(var i = 0; i < px; i++) { - _outSurf = surface_create_valid(ww, hh); - _val[i] = _outSurf; + for(var i = 0; i < px; i++) { + _outSurf = surface_create_valid(ww, hh); + _val[i] = _outSurf; - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - shader_set(sh_seperate_shape_sep); - var ccx = surface_get_pixel_ext(_pixel_surface, 1 + i, 0); - var alpha = (ccx >> 24) & 255; - var blue = (ccx >> 16) & 255; - var green = (ccx >> 8) & 255; - var red = ccx & 255; + surface_set_shader(_outSurf, sh_seperate_shape_sep); + var ccx = surface_get_pixel_ext(_pixel_surface, 1 + i, 0); + var alpha = (ccx >> 24) & 255; + var blue = (ccx >> 16) & 255; + var green = (ccx >> 8) & 255; + var red = ccx & 255; - var min_x = floor(red / 255 * ww); - var min_y = floor(green / 255 * hh); - var max_x = ceil(blue / 255 * ww); - var max_y = ceil(alpha / 255 * hh); - var t = max_y; - var b = min_y; - var l = max_x; - var r = min_x; + var min_x = floor(red / 255 * ww); + var min_y = floor(green / 255 * hh); + var max_x = ceil(blue / 255 * ww); + var max_y = ceil(alpha / 255 * hh); + var t = max_y; + var b = min_y; + var l = max_x; + var r = min_x; - for( var j = min_x; j < max_x; j++ ) - for( var k = min_y; k < max_y; k++ ) { - var _sc = get_color_buffer(j, k); - if(_sc != ccx) continue; + for( var j = min_x; j < max_x; j++ ) + for( var k = min_y; k < max_y; k++ ) { + var _sc = get_color_buffer(j, k); + if(_sc != ccx) continue; - t = min(t, k); - b = max(b, k); - l = min(l, j); - r = max(r, j); - } + t = min(t, k); + b = max(b, k); + l = min(l, j); + r = max(r, j); + } - _boundary[i] = [l, t, r, b]; - - if(is_surface(_inSurf)) - texture_set_stage(shader_get_sampler_index(sh_seperate_shape_sep, "original"), surface_get_texture(_inSurf)); - shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_sep, "color"), red, green, blue, alpha); - shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_sep, "override"), _ovr); - shader_set_uniform_f_array_safe(shader_get_uniform(sh_seperate_shape_sep, "overColor"), colToVec4(_ovrclr)); - draw_surface_safe(temp_surface[res_index], 0, 0); - shader_reset(); - BLEND_NORMAL; - surface_reset_target(); - } + _atlas[i] = [l, t, r, b]; + _atlas[i] = new SurfaceAtlas(_outSurf, [ r.x + _spac, r.y + _spac ]); + + shader_set_surface("original", _inSurf); + shader_set_f("color", red, green, blue, alpha); + shader_set_i("override", _ovr); + shader_set_f("overColor", colToVec4(_ovrclr)); + + draw_surface_safe(temp_surface[res_index], 0, 0); + surface_reset_shader(); + } - outputs[| 1].setValue(_boundary,,, false); + outputs[| 1].setValue(_atlas); + #endregion } } \ No newline at end of file diff --git a/scripts/node_shell/node_shell.gml b/scripts/node_shell/node_shell.gml index 4b352736e..cf018db51 100644 --- a/scripts/node_shell/node_shell.gml +++ b/scripts/node_shell/node_shell.gml @@ -12,14 +12,25 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { insp1UpdateTooltip = "Run"; insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; + trusted = false; + + static onValueUpdate = function() { + trusted = false; + } + static onInspector1Update = function() { update(); } static update = function() { var _pro = getInputData(0); var _scr = getInputData(1); - if(_pro == "") return; + if(_pro == "" || _scr == "") return; - shell_execute(_pro, _scr); + if(trusted) { + shell_execute(_pro, _scr); + } else { + var dia = dialogCall(o_dialog_run_shell); + dia.setData(self, _pro, _scr); + } } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_tool/node_tool.gml b/scripts/node_tool/node_tool.gml index 3492c4bbd..49d912e9e 100644 --- a/scripts/node_tool/node_tool.gml +++ b/scripts/node_tool/node_tool.gml @@ -1,15 +1,26 @@ function NodeTool(name, spr) constructor { - self.name = name; - self.spr = spr; + node = other; + self.name = name; + self.spr = spr; subtools = is_array(spr)? array_length(spr) : 0; selecting = 0; settings = []; attribute = {}; + static checkHotkey = function() { + gml_pragma("forceinline"); + + return getHotkey(instanceof(node), name); + } + static getName = function(index = 0) { - if(is_array(name)) return array_safe_get(name, index, ""); - return name; + var _key = checkHotkey(); + + var _nme = is_array(name)? array_safe_get(name, index, "") : name; + if(_key != "") _nme += $" ({_key})"; + + return _nme; } static addSetting = function(name, type, onEdit, keyAttr, val) { @@ -48,5 +59,21 @@ function NodeTool(name, spr) constructor { onToggle(); } + static toggleKeyboard = function() { + if(subtools == 0) { + PANEL_PREVIEW.tool_current = PANEL_PREVIEW.tool_current == self? noone : self; + } else if(PANEL_PREVIEW.tool_current != self) { + PANEL_PREVIEW.tool_current = self; + selecting = 0; + } else if(selecting == subtools - 1) { + PANEL_PREVIEW.tool_current = noone; + selecting = 0; + } else + selecting++; + + if(PANEL_PREVIEW.tool_current == self) + onToggle(); + } + static onToggle = function() {} } \ No newline at end of file diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index abdbae59c..cabed0a47 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -127,7 +127,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct var k = ds_map_find_first(TUNNELS_OUT); LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from: {internalName}"); + LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from: {INAME}"); LOG_BLOCK_START(); repeat(amo) { diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 3bf0d022e..2aea9688f 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -2,10 +2,10 @@ global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ]; global.displaySuffix_Range = [ "min", "max" ]; - global.displaySuffix_Area = [ "x", "y", "w", "h" ]; + global.displaySuffix_Area = [ "x", "y", "w", "h", "shape" ]; global.displaySuffix_Padding = [ "right", "top", "left", "bottom" ]; global.displaySuffix_VecRange = [ "x min", "x max", "y min", "y max" ]; - global.displaySuffix_Axis = [ "x", "y", "z", "w"]; + global.displaySuffix_Axis = [ "x", "y", "z", "w" ]; #endregion enum JUNCTION_CONNECT { @@ -1012,28 +1012,28 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru editWidget = new pathArrayBox(node, display_data.filter, function(path) { setValueDirect(path); } ); break; case VALUE_DISPLAY.path_load : - editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueDirect(str); }, - button(function() { - var path = get_open_filename(display_data.filter, ""); - key_release(); - if(path == "") return noone; - return setValueDirect(path); - }, THEME.button_path_icon) - ); + editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueDirect(str); } ); + editWidget.align = fa_left; + editWidget.side_button = button(function() { + var path = get_open_filename(display_data.filter, ""); + key_release(); + if(path == "") return noone; + return setValueDirect(path); + }, THEME.button_path_icon); extract_node = "Node_String"; break; case VALUE_DISPLAY.path_save : - editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueDirect(str); }, - button(function() { - var path = get_save_filename(display_data.filter, ""); - key_release(); - if(path == "") return noone; - return setValueDirect(path); - }, THEME.button_path_icon) - ); + editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueDirect(str); } ); + editWidget.align = fa_left; + editWidget.side_button = button(function() { + var path = get_save_filename(display_data.filter, ""); + key_release(); + if(path == "") return noone; + return setValueDirect(path); + }, THEME.button_path_icon); extract_node = "Node_String"; break; @@ -1124,6 +1124,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static expressionUpdate = function() { #region expTree = evaluateFunctionList(expression); + resetCache(); node.triggerRender(); } #endregion diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index 2742e29c6..4af48df95 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -177,7 +177,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 1].editWidget.text = $"Sync ({frm} frames)"; } - RENDER_ALL + RENDER_ALL_REORDER } insp2UpdateIcon[1] = attributes.play; diff --git a/scripts/obj_reader/obj_reader.gml b/scripts/obj_reader/obj_reader.gml index 35e0619af..79fd6806b 100644 --- a/scripts/obj_reader/obj_reader.gml +++ b/scripts/obj_reader/obj_reader.gml @@ -1,25 +1,32 @@ -function readObj(path) { - if(!file_exists(path)) return noone; +function readObj_init() { + obj_reading = true; + obj_read_progress = 0; + obj_read_prog_sub = 0; + obj_read_prog_tot = 3; + obj_raw = noone; - var _VB = []; - var _VBT = []; - var _VBN = []; - var mats = []; - var matIndex = []; - var tris = []; - 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 tri = 0; + _VB = []; + _VBT = []; + _VBN = []; + mats = []; + matIndex = []; + tris = []; + mtlPath = ""; + use_normal = true; + v = ds_list_create(); + vt = ds_list_create(); + vn = ds_list_create(); + f = ds_list_create(); + ft = ds_list_create(); + fn = ds_list_create(); + tri = 0; +} + +function readObj_file() { + var _time = current_time; - var file = file_text_open_read(path); - while(!file_text_eof(file)) { #region reading file - var l = file_text_readln(file); + while(!file_text_eof(obj_read_file)) { #region reading file + var l = file_text_readln(obj_read_file); l = string_trim(l); var sep = string_split(l, " "); @@ -100,7 +107,9 @@ function readObj(path) { //print("Reading vertex group: " + sep[1]) break; } - } + + if(current_time - _time > 30) return; + } #endregion if(!ds_list_empty(f)) { array_push(_VB, f); @@ -108,24 +117,28 @@ function readObj(path) { array_push(_VBN, fn); array_push(tris, tri); } - file_text_close(file); - #endregion + file_text_close(obj_read_file); if(use_normal) vn[| 0] = [ 0, 0, 0 ]; + obj_read_progress = 1; + obj_read_prog_sub = 0; + //var txt = "OBJ summary"; //txt += $"\n\tVerticies : {ds_list_size(v)}"; //txt += $"\n\tTexture Verticies : {ds_list_size(vt)}"; //txt += $"\n\tNormal Verticies : {ds_list_size(vn)}"; //txt += $"\n\tVertex groups : {array_length(_VB)}"; //txt += $"\n\tTriangles : {tris}"; - //print(txt); - + //print(txt); +} + +function readObj_cent() { #region centralize vertex - var _bmin = v[| 0]; - var _bmax = v[| 0]; - var cv = [0, 0, 0]; - var vertex = ds_list_size(v); + _bmin = v[| 0]; + _bmax = v[| 0]; + cv = [0, 0, 0]; + vertex = ds_list_size(v); for( var i = 0; i < vertex; i++ ) { var _v = v[| i]; @@ -149,19 +162,28 @@ function readObj(path) { cv[1] /= vertex; cv[2] /= vertex; - for( var i = 0, n = ds_list_size(v); i < n; i++ ) { - v[| i][0] -= cv[0]; - v[| i][1] -= cv[1]; - v[| i][2] -= cv[2]; - } - - var _size = new __vec3( + obj_size = new __vec3( _bmax[0] - _bmin[0], _bmax[1] - _bmin[1], _bmax[2] - _bmin[2], ); + + var sc = 1; + //var span = max(abs(_size.x), abs(_size.y), abs(_size.z)); + //if(span > 10) sc = span / 10; + + for( var i = 0, n = ds_list_size(v); i < n; i++ ) { + v[| i][0] = (v[| i][0] - cv[0]) / sc; + v[| i][1] = (v[| i][1] - cv[1]) / sc; + v[| i][2] = (v[| i][2] - cv[2]) / sc; + } #endregion + obj_read_progress = 2; + obj_read_prog_sub = 0; +} + +function readObj_buff() { #region vertex buffer creation var _vblen = array_length(_VB); var VBS = array_create(_vblen); @@ -173,7 +195,6 @@ function readObj(path) { var face = _VB[i]; var facet = _VBT[i]; var facen = _VBN[i]; - var tri = tris[i]; var _flen = ds_list_size(face); var _v = ds_list_create(); @@ -239,8 +260,12 @@ function readObj(path) { ds_list_destroy(vt); #endregion - return { + obj_read_progress = 3; + obj_read_prog_sub = 0; + + obj_raw = { vertex: V, + vertex_count: vertex, vertex_groups: VBS, object_counts: _vblen, @@ -248,6 +273,6 @@ function readObj(path) { material_index: matIndex, use_normal: use_normal, mtl_path: mtlPath, - model_size: _size, + model_size: obj_size, }; } \ No newline at end of file diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index a2413906e..3eb8c8ad0 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -1154,7 +1154,7 @@ function Panel_Preview() : PanelContent() constructor { if(point_in_rectangle(_mx, _my, _sx0, _sy0 + 1, _sx1, _sy1 - 1)) { TOOLTIP = tool.getName(j); draw_sprite_stretched(THEME.button_hide, 1, _sx0 + pd, _sy0 + pd, tool_size - pd * 2, tool_size - pd * 2); - + if(mouse_press(mb_left, pFOCUS)) tool.toggle(j); } @@ -1179,8 +1179,12 @@ function Panel_Preview() : PanelContent() constructor { tool.toggle(); } - if(pFOCUS && WIDGET_CURRENT == noone && keyboard_check_pressed(ord(string(i + 1)))) - tool.toggle(); + if(pFOCUS && WIDGET_CURRENT == noone) { + var _key = tool.checkHotkey(); + + if(keyboard_check_pressed(ord(string(i + 1))) || (_key != "" && keyboard_check_pressed(ord(_key)))) + tool.toggleKeyboard(); + } if(tool_current == tool) { draw_sprite_stretched_ext(THEME.button_hide, 2, _x0 + pd, _y0 + pd, tool_size - pd * 2, tool_size - pd * 2, COLORS.panel_preview_grid, 1); diff --git a/scripts/preferences/preferences.gml b/scripts/preferences/preferences.gml index ce65bdd09..e42274626 100644 --- a/scripts/preferences/preferences.gml +++ b/scripts/preferences/preferences.gml @@ -1,6 +1,6 @@ #region data globalvar PREF_MAP; - PREF_MAP = ds_map_create(); + PREF_MAP = ds_map_create(); #endregion #region pref map @@ -77,62 +77,6 @@ PREF_MAP[? "clear_temp_on_close"] = true; #endregion -#region hotkeys - function hotkeyObject(_context, _name, _key, _mod, _action) constructor { - context = _context; - name = _name; - key = _key; - modi = _mod; - action = _action; - - dKey = _key; - dModi = _mod; - - static serialize = function() { - var ll = ds_list_create(); - ll[| 0] = context; - ll[| 1] = name; - ll[| 2] = key; - ll[| 3] = modi; - return ll; - } - - static deserialize = function(ll) { - key = ll[| 2]; - modi = ll[| 3]; - } - } - - function addHotkey(_context, _name, _key, _mod, _action) { - if(is_string(_key)) { - var ind = key_get_index(_key); - _key = ind? ind : ord(_key); - } - - var key = new hotkeyObject(_context, _name, _key, _mod, _action); - - if(!ds_map_exists(HOTKEYS, _context)) { - HOTKEYS[? _context] = ds_list_create(); - if(!ds_list_exist(HOTKEY_CONTEXT, _context)) - ds_list_add(HOTKEY_CONTEXT, _context); - } - - for(var i = 0; i < ds_list_size(HOTKEYS[? _context]); i++) { - var hotkey = HOTKEYS[? _context][| i]; - if(hotkey.name == key.name) { - delete HOTKEYS[? _context][| i]; - HOTKEYS[? _context][| i] = key; - return; - } - } - - if(_context == "") - ds_list_insert(HOTKEYS[? _context], 0, key); - else - ds_list_add(HOTKEYS[? _context], key); - } -#endregion - #region recent files globalvar RECENT_FILES, RECENT_FILE_DATA; RECENT_FILES = ds_list_create(); diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index eb16b83f9..04a1aa96f 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -64,6 +64,10 @@ function ResetAllNodesRender() { #region repeat(amo) { var _node = PROJECT.nodeMap[? _key]; _node.setRenderStatus(false); + + for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ ) + _node.inputs[| i].resetCache(); + _key = ds_map_find_next(PROJECT.nodeMap, _key); } } #endregion diff --git a/scripts/scrollPane/scrollPane.gml b/scripts/scrollPane/scrollPane.gml index c771fd52d..fac094943 100644 --- a/scripts/scrollPane/scrollPane.gml +++ b/scripts/scrollPane/scrollPane.gml @@ -58,7 +58,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED; } - if(abs(content_h) > 0) { + if(abs(content_h) > 0 || always_scroll) { var scr_w = sprite_get_width(THEME.ui_scrollbar); draw_scroll(x + w - scr_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h), COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + _mx, y + _my); diff --git a/sprites/s_node_array_convolute/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc.png b/sprites/s_node_array_convolute/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc.png new file mode 100644 index 000000000..2b968878e Binary files /dev/null and b/sprites/s_node_array_convolute/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc.png differ diff --git a/sprites/s_node_array_convolute/layers/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc/284cafea-7057-469b-9abc-10a34804d93a.png b/sprites/s_node_array_convolute/layers/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc/284cafea-7057-469b-9abc-10a34804d93a.png new file mode 100644 index 000000000..2b968878e Binary files /dev/null and b/sprites/s_node_array_convolute/layers/d4f846ac-8f81-4d21-a4ae-aaff8ca044bc/284cafea-7057-469b-9abc-10a34804d93a.png differ diff --git a/sprites/s_node_array_convolute/s_node_array_convolute.yy b/sprites/s_node_array_convolute/s_node_array_convolute.yy new file mode 100644 index 000000000..16859537e --- /dev/null +++ b/sprites/s_node_array_convolute/s_node_array_convolute.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_array_convolute", + "bbox_bottom": 61, + "bbox_left": 0, + "bbox_right": 63, + "bbox_top": 2, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"d4f846ac-8f81-4d21-a4ae-aaff8ca044bc",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"284cafea-7057-469b-9abc-10a34804d93a","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "array", + "path": "folders/nodes/icons/value/array.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_array_convolute", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"d4f846ac-8f81-4d21-a4ae-aaff8ca044bc","path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},},},"Disabled":false,"id":"298a68fe-1e37-455e-a0a0-950092c9f10c","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file