diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index a4c167b19..212e6f23b 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -150,6 +150,7 @@ {"name":"warp","order":41,"path":"folders/shader/warp.yy",}, {"name":"sprites","order":12,"path":"folders/sprites.yy",}, {"name":"gameframe","order":2,"path":"folders/sprites/gameframe.yy",}, + {"name":"misc","order":3,"path":"folders/sprites/misc.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, ], "ResourceOrderSettings": [ @@ -192,6 +193,7 @@ {"name":"s_node_tunnel_out","order":22,"path":"sprites/s_node_tunnel_out/s_node_tunnel_out.yy",}, {"name":"__background_set_element","order":3,"path":"scripts/__background_set_element/__background_set_element.yy",}, {"name":"s_node_3d_obj","order":3,"path":"sprites/s_node_3d_obj/s_node_3d_obj.yy",}, + {"name":"ds_list_queue","order":6,"path":"scripts/ds_list_queue/ds_list_queue.yy",}, {"name":"s_node_scale","order":6,"path":"sprites/s_node_scale/s_node_scale.yy",}, {"name":"sh_color_picker_value","order":32,"path":"shaders/sh_color_picker_value/sh_color_picker_value.yy",}, {"name":"textInput","order":24,"path":"scripts/textInput/textInput.yy",}, @@ -201,6 +203,7 @@ {"name":"node_switch","order":5,"path":"scripts/node_switch/node_switch.yy",}, {"name":"sh_corner","order":20,"path":"shaders/sh_corner/sh_corner.yy",}, {"name":"node_array","order":8,"path":"scripts/node_array/node_array.yy",}, + {"name":"discordBridge","order":10,"path":"extensions/discordBridge/discordBridge.yy",}, {"name":"pack_corner","order":3,"path":"scripts/pack_corner/pack_corner.yy",}, {"name":"sh_colorize","order":9,"path":"shaders/sh_colorize/sh_colorize.yy",}, {"name":"node_string","order":13,"path":"scripts/node_string/node_string.yy",}, @@ -751,6 +754,7 @@ {"name":"collection_data","order":9,"path":"scripts/collection_data/collection_data.yy",}, {"name":"s_node_flood_fill","order":24,"path":"sprites/s_node_flood_fill/s_node_flood_fill.yy",}, {"name":"node_rigid_force_apply","order":4,"path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",}, + {"name":"__node_iterator","order":6,"path":"scripts/__node_iterator/__node_iterator.yy",}, {"name":"s_node_rigid_variable","order":8,"path":"sprites/s_node_rigid_variable/s_node_rigid_variable.yy",}, {"name":"safe_operation","order":6,"path":"scripts/safe_operation/safe_operation.yy",}, {"name":"s_node_rigid_override","order":9,"path":"sprites/s_node_rigid_override/s_node_rigid_override.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index d46ded952..a124b4824 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -183,6 +183,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"warp","folderPath":"folders/shader/warp.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprites","folderPath":"folders/sprites.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"gameframe","folderPath":"folders/sprites/gameframe.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/sprites/misc.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"texture","folderPath":"folders/sprites/texture.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy",}, @@ -512,9 +513,11 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_animation_stretch.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_animation_timing.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_arrow_16_strip4.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_arrow_back_32.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_not_found_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_cache.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_chat.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_checkbox_on_start.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_circle_12.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_circle_16.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -527,6 +530,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_cursor.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_delete_16.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_delete.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_discord.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_duplicate.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_feedback_16.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_file_explorer.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -544,6 +548,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_group_16.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_group_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_hamburger.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_heart.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_accept_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_accept_32.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_array_processor.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -619,6 +624,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_timeline_clock.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_timeline_graph.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_timeline_keyframe_strip4.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_trophy.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_tunnel.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_undo.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_unit_ref.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -749,6 +755,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_menu_button.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_menu_separator.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_menu_white.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_shadow_drop_down_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_toolbar_shadow.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"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_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, @@ -906,6 +913,7 @@ {"id":{"name":"s_node_tunnel_out","path":"sprites/s_node_tunnel_out/s_node_tunnel_out.yy",},}, {"id":{"name":"__background_set_element","path":"scripts/__background_set_element/__background_set_element.yy",},}, {"id":{"name":"s_node_3d_obj","path":"sprites/s_node_3d_obj/s_node_3d_obj.yy",},}, + {"id":{"name":"ds_list_queue","path":"scripts/ds_list_queue/ds_list_queue.yy",},}, {"id":{"name":"s_node_scale","path":"sprites/s_node_scale/s_node_scale.yy",},}, {"id":{"name":"sh_color_picker_value","path":"shaders/sh_color_picker_value/sh_color_picker_value.yy",},}, {"id":{"name":"textInput","path":"scripts/textInput/textInput.yy",},}, @@ -917,6 +925,7 @@ {"id":{"name":"node_switch","path":"scripts/node_switch/node_switch.yy",},}, {"id":{"name":"sh_corner","path":"shaders/sh_corner/sh_corner.yy",},}, {"id":{"name":"node_array","path":"scripts/node_array/node_array.yy",},}, + {"id":{"name":"discordBridge","path":"extensions/discordBridge/discordBridge.yy",},}, {"id":{"name":"pack_corner","path":"scripts/pack_corner/pack_corner.yy",},}, {"id":{"name":"sh_colorize","path":"shaders/sh_colorize/sh_colorize.yy",},}, {"id":{"name":"node_string","path":"scripts/node_string/node_string.yy",},}, @@ -1542,6 +1551,7 @@ {"id":{"name":"collection_data","path":"scripts/collection_data/collection_data.yy",},}, {"id":{"name":"s_node_flood_fill","path":"sprites/s_node_flood_fill/s_node_flood_fill.yy",},}, {"id":{"name":"node_rigid_force_apply","path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",},}, + {"id":{"name":"__node_iterator","path":"scripts/__node_iterator/__node_iterator.yy",},}, {"id":{"name":"s_node_rigid_variable","path":"sprites/s_node_rigid_variable/s_node_rigid_variable.yy",},}, {"id":{"name":"safe_operation","path":"scripts/safe_operation/safe_operation.yy",},}, {"id":{"name":"s_node_rigid_override","path":"sprites/s_node_rigid_override/s_node_rigid_override.yy",},}, @@ -1884,6 +1894,7 @@ {"id":{"name":"s_node_array_reverse","path":"sprites/s_node_array_reverse/s_node_array_reverse.yy",},}, {"id":{"name":"sh_ani_noise","path":"shaders/sh_ani_noise/sh_ani_noise.yy",},}, {"id":{"name":"rectangle_collision","path":"scripts/rectangle_collision/rectangle_collision.yy",},}, + {"id":{"name":"s_contest_banner","path":"sprites/s_contest_banner/s_contest_banner.yy",},}, {"id":{"name":"sh_level","path":"shaders/sh_level/sh_level.yy",},}, {"id":{"name":"sh_grid_tri","path":"shaders/sh_grid_tri/sh_grid_tri.yy",},}, {"id":{"name":"s_node_text","path":"sprites/s_node_text/s_node_text.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index b6e617be7..01c4e1b33 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 4e1bd2d14..1f6468354 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -195,7 +195,7 @@ event_inherited(); ]); ds_list_add(pref_global, [ - get_text("pref_enable_test_mode", "Enable test mode (require restart)"), + get_text("pref_enable_test_mode", "Enable developer mode (require restart)"), "test_mode", new checkBox(function() { PREF_MAP[? "test_mode"] = !PREF_MAP[? "test_mode"]; diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index 4d171bf43..7ff1d32fd 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -13,8 +13,8 @@ event_inherited(); project_page = 0; thumbnail_retriever = 0; - recent_thumbnail = false; - show_autosaves = false; + recent_thumbnail = false; + show_autosaves = false; recent_width = PREF_MAP[? "splash_expand_recent"]? ui(576) : ui(288); #endregion @@ -32,8 +32,9 @@ event_inherited(); x1 = dialog_x + dialog_w - ui(16); sp_sample.resize(x1 - x0 - ui(12), y1 - y0); + sp_contest.resize(x1 - x0 - ui(12), y1 - y0); } - + var x0 = dialog_x + ui(16); var x1 = x0 + recent_width; var y0 = dialog_y + ui(128); @@ -113,7 +114,14 @@ event_inherited(); sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear_inner, 0); - var list = project_page? STEAM_PROJECTS : SAMPLE_PROJECTS; + + var txt = pages[project_page]; + var list; + + switch(txt) { + case "Sample projects" : list = SAMPLE_PROJECTS; break; + case "Workshop" : list = STEAM_PROJECTS; break; + } var hh = 0; var grid_heigh = ui(96); @@ -138,14 +146,14 @@ event_inherited(); draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh); if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) { var _meta = _project.getMetadata(); - if(project_page == 1) + if(txt == "Workshop") TOOLTIP = _meta; draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_width, grid_heigh, COLORS._main_accent, 1); if(mouse_press(mb_left, sFOCUS)) { LOAD_PATH(_project.path, true); - METADATA.steam = project_page; - if(project_page == 1) + METADATA.steam = txt == "Workshop"; + if(txt == "Workshop") METADATA.file_id = _meta.file_id; instance_destroy(); } @@ -170,7 +178,7 @@ event_inherited(); var tx = _boxx + grid_width / 2; var ty = yy + grid_heigh + ui(4); draw_set_text(f_p2, fa_center, fa_top); - if(project_page == 0) { + if(txt == "Sample projects") { var _tw = string_width(_project.tag); var _th = string_height(_project.tag); @@ -192,6 +200,299 @@ event_inherited(); yy += hght; } + return hh; + }); +#endregion + +#region contest + discord_map = ds_map_create(); + discord_map[? "Authorization"] = "Bot " + get_discord_bot_token(); + + if(os_is_network_connected()) { + var url = "https://discord.com/api/v10/guilds/953634069646835773/threads/active"; + contest_req = http_request(url, "GET", discord_map, ""); + contest_message_req = []; + } + + nicknames = ds_map_create(); + attachment = ds_map_create(); + contests = []; + + grid_surface = surface_create(1, 1); + banner = noone; + banner_alpha = 0; + + contest_viewing = noone; + + sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { + draw_clear_alpha(COLORS.panel_bg_clear_inner, 0); + var hh = 0; + + if(contest_viewing == noone) { + var amo = array_length(contests); + + var bx = sp_contest.surface_w / 2; + var sy = ui(16); + + var spr_w = sprite_get_width(s_contest_banner); + var spr_h = sprite_get_height(s_contest_banner); + var ss = (sp_contest.surface_w - 40) / spr_w; + + draw_sprite_ext(s_contest_banner, 0, bx, _y + sy, ss, ss, 0, c_white, 1); + + spr_w *= ss; + spr_h *= ss; + + if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - spr_w / 2, _y + sy, bx + spr_w / 2, _y + sy + spr_h)) { + TOOLTIP = "Go to Pixel Composer Discord server"; + + if(mouse_press(mb_left, sFOCUS)) + url_open("https://discord.gg/aHGbYjQh63"); + } + + sy += spr_h - ui(4); + + var tx, ty, _col, _row; + var grid_heigh = ui(128); + var grid_width = ui(276); + var grid_space = ui(20); + var grid_hspac = ui(40); + var col = floor(sp_contest.surface_w / (grid_width + grid_space)); + + grid_surface = surface_verify(grid_surface, grid_width, grid_heigh); + + for( var i = 0; i < amo; i++ ) { + var contest = contests[i]; + _col = i % col; + _row = floor(i / col); + tx = grid_space + (grid_width + grid_space) * _col; + ty = sy + grid_space + (grid_heigh + grid_hspac + grid_space) * _row; + hh = max(hh, ty + grid_heigh + grid_hspac + grid_space + ui(32)); + ty = _y + ty; + + draw_sprite_stretched(THEME.node_bg, 0, tx, ty, grid_width, grid_heigh); + + var att = contest.title.attachments; + if(att != noone) { + var attSurf = attachment[? att.id]; + + if(!is_array(attSurf) && sprite_exists(attSurf)) { + var _sw = sprite_get_width(attSurf); + var _sh = sprite_get_height(attSurf); + var ss = max(grid_width / _sw, grid_heigh / _sh); + + surface_set_target(grid_surface); + DRAW_CLEAR + draw_sprite_stretched(THEME.node_bg, 0, 0, 0, grid_width, grid_heigh); + + gpu_set_colorwriteenable(1, 1, 1, 0); + draw_sprite_ext(attSurf, 0, grid_width / 2, grid_heigh / 2, ss, ss, 0, c_white, 1); + gpu_set_colorwriteenable(1, 1, 1, 1); + surface_reset_target(); + + draw_surface_ext(grid_surface, tx, ty, 1, 1, 0, c_white, 0.85); + } + } + + if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], tx, ty, tx + grid_width, ty + grid_heigh)) { + draw_sprite_stretched_ext(THEME.node_active, 0, tx, ty, grid_width, grid_heigh, COLORS._main_accent, 1); + + if(mouse_press(mb_left, sFOCUS)) + contest_viewing = contest; + } else + draw_sprite_stretched_ext(THEME.node_active, 0, tx, ty, grid_width, grid_heigh, COLORS._main_icon, 0.75); + + //draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); + //draw_text_ext_add(tx + ui(12), ty + ui(8), contest.name, -1, grid_width - ui(24)); + + var ch_x = tx + grid_width - ui(8); + var ch_y = ty + grid_heigh + ui(4); + + draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text); + draw_text_ext_add(tx + ui(8), ch_y, contest.name, -1, grid_width - ui(8)); + var nm_h = string_height_ext(contest.name, -1, grid_width - ui(8)); + + draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text); + draw_text_add(ch_x, ch_y, contest.message_count); + + var _w = string_width(contest.message_count); + draw_sprite_ui(THEME.chat, 0, ch_x - _w - ui(16), ch_y + ui(12), 0.75, 0.75,, COLORS._main_icon); + + var auth_msg = contest.title; + var auth_nam = ds_map_try_get(nicknames, auth_msg.author.id, auth_msg.author.username); + + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_text_add(tx + ui(8), ch_y + nm_h - ui(0), auth_nam); + + if(!struct_has(contest.title.meta, "theme")) continue; + + var txt = "Theme: " + contest.title.meta.theme; + + draw_set_text(f_p1, fa_left, fa_bottom, COLORS._main_text); + var ww = string_width(txt); + var thx = tx + grid_width - ui(12) - ww; + var thy = ty + grid_heigh - ui(8); + + draw_set_color(COLORS._main_text_sub); + draw_text_ext_add(thx, thy, "Theme: ", -1, grid_width - ui(12 + 8)); + + draw_set_color(COLORS._main_text); + draw_text_ext_add(thx + string_width("Theme: "), thy, contest.title.meta.theme, -1, grid_width - ui(12 + 8)); + + } + } else { + var con_name = contest_viewing.name; + var con_title = contest_viewing.title; + var con_author = ds_map_try_get(nicknames, con_title.author.id, con_title.author.username); + + var con_thumb = con_title.attachments; + if(con_thumb != noone) + con_thumb = attachment[? con_thumb.id]; + + var tx = ui(8); + var ty = _y + ui(64); + hh = ui(64); + + var tw = sp_contest.surface_w - ui(16); + var th = 0; + var pad = ui(12); + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + th = string_height_ext(con_title.content, -1, tw - pad * 2) + pad * 2; + + if(sprite_exists(con_thumb)) { + var spr_w = sprite_get_width(con_thumb); + var spr_h = sprite_get_height(con_thumb); + ss = (tw - pad * 2) / spr_w; + + spr_w *= ss; + spr_h *= ss; + + th += pad + spr_h; + } + + var txt_y = ty + pad; + draw_sprite_stretched_ext(THEME.node_bg, 0, tx, ty, tw, th, c_white, 0.8); + draw_text_ext_add(tx + pad, txt_y, con_title.content, -1, tw - pad * 2); + txt_y += string_height_ext(con_title.content, -1, tw - pad * 2) + pad; + + if(sprite_exists(con_thumb)) + draw_sprite_ext(con_thumb, 0, sp_contest.surface_w / 2, txt_y + spr_h / 2, ss, ss, 0, c_white, 1); + + hh += th + pad; + + var submissions = contest_viewing.messages; + var amo = 0, col = 0; + var grid_space = ui(20); + var grid_width = (sp_contest.surface_w - grid_space - ui(16)) / 2; + + var _yy = txt_y + spr_h + pad * 2; + var cx = sp_contest.surface_w / 2; + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub); + draw_text(cx, _yy + ui(8), "Submissions"); + var txt_w = string_width("Submissions"); + draw_line(cx - txt_w / 2 - ui(8), _yy + ui(8), cx - ui(200), _yy + ui(8)); + draw_line(cx + txt_w / 2 + ui(8), _yy + ui(8), cx + ui(200), _yy + ui(8)); + + _yy += ui(32); + + var grid_ys = [ _yy, _yy ]; + + for( var i = 0; i < array_length(submissions) - 1; i++ ) { + var _sub = submissions[i]; + var _att = _sub.attachments; + + if(array_length(_att) == 0) continue; + amo++; + + var _att_first = _att[0]; + if(!ds_map_exists(attachment, _att_first.id)) { + var path = DIRECTORY + "temp/" + _att_first.id + ".png"; + attachment[? _att_first.id] = [ http_get_file(_att_first.url, path), path ]; + } else if(!is_array(attachment[? _att_first.id]) && sprite_exists(attachment[? _att_first.id])) { + var sub = attachment[? _att_first.id]; + var spr_w = sprite_get_width(sub); + var spr_h = sprite_get_height(sub); + + var ss = (grid_width - ui(16)) / spr_w; + if(ss > 1) ss = floor(ss); + + spr_w *= ss; + spr_h *= ss; + + var _col = grid_ys[0] > grid_ys[1]; + var grid_x = ui(8) + (grid_width + grid_space) * _col; + var grid_y = grid_ys[_col]; + var grid_h = spr_h + ui(8) * 2; + + draw_sprite_stretched_ext(THEME.node_bg, 0, grid_x, grid_y, grid_width, grid_h, c_white, 0.8); + draw_sprite_ext(sub, 0, grid_x + grid_width / 2, grid_y + grid_h / 2, ss, ss, 0, c_white, 1); + + var label_h = ui(32); + var sub_author = ds_map_try_get(nicknames, _sub.author.id, _sub.author.username); + draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text); + draw_text_add(grid_x + ui(8), grid_y + grid_h + ui(4), sub_author); + + var react = _sub.reactions; + var hearts = 0; + for( var j = 0; j < array_length(react); j++ ) { + if(react[i].emoji.name != "💖") return; + hearts = react[i].count_details.normal; + } + + var ch_x = grid_x + grid_width - ui(8); + var ch_y = grid_y + grid_h + ui(4); + draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text); + draw_text_add(ch_x, ch_y, hearts); + + var _w = string_width(hearts); + draw_sprite_ui(THEME.heart, 0, ch_x - _w - ui(16), ch_y + ui(10), 0.75, 0.75,, COLORS._main_icon); + + grid_ys[_col] += grid_h + label_h + ui(8); + } + } + + hh = max(grid_ys[0] - _y, grid_ys[1] - _y); + + //banner + + banner_alpha = lerp_float(banner_alpha, _y < 0, 5); + draw_sprite_stretched_ext(THEME.shadow_drop_down_24, 0, 0, ui(56), sp_contest.surface_w, ui(20), c_white, banner_alpha); + draw_set_color(COLORS.panel_bg_clear); + draw_rectangle(0, 0, sp_contest.surface_w, ui(64), false); + + draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); + draw_text_add(ui(32 + 8), ui(8 + 4), con_name); + + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_text_add(ui(32 + 8), ui(8 + 30), "By " + con_author); + + draw_set_text(f_p0b, fa_right, fa_top, COLORS._main_text_accent); + draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 8), amo); + + draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub); + draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 28), "Submissions"); + + if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], ui(20 - 16), ui(36 - 16), ui(20 + 16), ui(36 + 16))) { + draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, c_white); + if(mouse_press(mb_left, sFOCUS)) + contest_viewing = noone; + } else + draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, COLORS._main_icon); + + var bx = sp_contest.surface_w - ui(20); + var by = ui(36); + + if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) { + TOOLTIP = "Open in Discord"; + + draw_sprite_ui(THEME.discord, 0, bx, by,,,, c_white); + if(mouse_press(mb_left, sFOCUS)) + url_open($"https://discord.com/channels/953634069646835773/{contest_viewing.id}"); + } else + draw_sprite_ui(THEME.discord, 0, bx, by,,,, COLORS._main_icon); + } + return hh; }); #endregion \ No newline at end of file diff --git a/objects/o_dialog_splash/Destroy_0.gml b/objects/o_dialog_splash/Destroy_0.gml new file mode 100644 index 000000000..4aeb0f84d --- /dev/null +++ b/objects/o_dialog_splash/Destroy_0.gml @@ -0,0 +1,6 @@ +/// @description +event_inherited(); + +ds_map_destroy(discord_map); +ds_map_destroy(nicknames); +ds_map_destroy(attachment); \ No newline at end of file diff --git a/objects/o_dialog_splash/Draw_64.gml b/objects/o_dialog_splash/Draw_64.gml index a38d16698..8298f903e 100644 --- a/objects/o_dialog_splash/Draw_64.gml +++ b/objects/o_dialog_splash/Draw_64.gml @@ -63,9 +63,15 @@ if !ready exit; var expandAction = false; var expand = PREF_MAP[? "splash_expand_recent"]; - if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sFOCUS, sHOVER,, THEME.arrow, expand? 2 : 0) == 2) { - PREF_MAP[? "splash_expand_recent"] = !PREF_MAP[? "splash_expand_recent"]; - expandAction = true; + + switch(pages[project_page]) { + case "Sample projects" : + case "Workshop" : + if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sFOCUS, sHOVER,, THEME.arrow, expand? 2 : 0) == 2) { + PREF_MAP[? "splash_expand_recent"] = !PREF_MAP[? "splash_expand_recent"]; + expandAction = true; + } + break; } x0 = x1 + ui(16); @@ -75,52 +81,91 @@ if !ready exit; for( var i = 0; i < array_length(pages); i++ ) { draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub); - var list = i == 1? STEAM_PROJECTS : SAMPLE_PROJECTS; - var amo = ds_list_size(list); - var tw = ui(16) + string_width(pages[i]) + ui(8) + string_width(amo) + ui(8); + var txt = pages[i]; + var amo = noone; + + switch(txt) { + case "Sample projects" : amo = ds_list_size(SAMPLE_PROJECTS); break; + case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break; + case "Contests" : amo = array_length(contests); break; + } + + var tw = ui(16) + string_width(pages[i]); + if(amo) tw += ui(8) + string_width(amo) + ui(8); + + if(txt == "Contests") + tw += ui(32); if(project_page == i) draw_sprite_stretched(THEME.ui_panel_bg, 0, bx, y0 - ui(32), tw, ui(40)); else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + tw, y0)) { draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, bx, y0 - ui(32), tw, ui(40), c_white, 0.5); - if(mouse_click(mb_left, sFOCUS)) + if(mouse_click(mb_left, sFOCUS)) { project_page = i; + + if(txt == "Contests" && PREF_MAP[? "splash_expand_recent"]) { + PREF_MAP[? "splash_expand_recent"] = false; + expandAction = true; + } + } } var _btx = bx + ui(8); - draw_text(_btx, y0 - ui(4), pages[i]); + if(txt == "Contests") { + draw_sprite_ui(THEME.trophy, 0, _btx + ui(16), y0 - ui(14),,,, CDEF.yellow); + _btx += ui(32); + } - _btx += ui(8) + string_width(pages[i]); - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _btx, y0 - ui(26), string_width(amo) + ui(8), ui(24), COLORS._main_icon, 0.5); + if(txt == "Contests") draw_set_color(project_page == i? CDEF.yellow : COLORS._main_text_sub ); + draw_text(_btx, y0 - ui(4), txt); - _btx += ui(4); - draw_set_color(COLORS._main_text_sub); - draw_text(_btx, y0 - ui(4), amo); + _btx += ui(8) + string_width(txt); + + if(amo) { + draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _btx, y0 - ui(26), string_width(amo) + ui(8), ui(24), COLORS._main_icon, 0.5); + + _btx += ui(4); + + if(txt == "Contests") draw_set_color(CDEF.yellow); + else draw_set_color(COLORS._main_text_sub); + draw_text(_btx, y0 - ui(4), amo); + } bx += tw; } draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0); - sp_sample.setActiveFocus(sFOCUS, sHOVER); - sp_sample.draw(x0 + ui(6), y0); - if(project_page == 0) { - if(!expand) { - draw_set_text(f_p1, fa_right, fa_bottom, COLORS._main_text_sub); - draw_text(x1 - ui(82), y0 - ui(4), "Art by "); - draw_sprite_ui_uniform(s_kenney, 0, x1, y0 - ui(4), 2, c_white, 0.5); - } - } else if(project_page == 1) { - var bx = x1 - ui(32); - var by = y0 - ui(32); + switch(pages[project_page]) { + case "Sample projects" : + sp_sample.setActiveFocus(sFOCUS, sHOVER); + sp_sample.draw(x0 + ui(6), y0); + + if(!expand) { + draw_set_text(f_p1, fa_right, fa_bottom, COLORS._main_text_sub); + draw_text(x1 - ui(82), y0 - ui(4), "Art by "); + draw_sprite_ui_uniform(s_kenney, 0, x1, y0 - ui(4), 2, c_white, 0.5); + } + break; + case "Workshop" : + sp_sample.setActiveFocus(sFOCUS, sHOVER); + sp_sample.draw(x0 + ui(6), y0); + + var bx = x1 - ui(32); + var by = y0 - ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Open Steam Workshop", THEME.steam) == 2) - steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Open Steam Workshop", THEME.steam) == 2) + steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); - bx -= ui(36); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Refresh content", THEME.refresh) == 2) - steamUCGload(); + bx -= ui(36); + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Refresh content", THEME.refresh) == 2) + steamUCGload(); + break; + case "Contests" : + sp_contest.setActiveFocus(sFOCUS, sHOVER); + sp_contest.draw(x0 + ui(6), y0); + break; } if(expandAction) { diff --git a/objects/o_dialog_splash/Other_62.gml b/objects/o_dialog_splash/Other_62.gml new file mode 100644 index 000000000..2063c224b --- /dev/null +++ b/objects/o_dialog_splash/Other_62.gml @@ -0,0 +1,121 @@ +/// @description +if(async_load[? "id"] == contest_req) { + var r_str = async_load[? "result"]; + if(is_undefined(r_str)) return; + + var thr_str = json_parse(r_str); + + if(struct_has(thr_str, "threads")) { + var thrs = thr_str.threads; + + for( var i = 0; i < array_length(thrs); i++ ) { + var thr = thrs[i]; + if(thr.parent_id != "1113080578351312906") continue; + if(struct_has(thr, "applied_tags") && array_exists(thr.applied_tags, "1113145223938326658")) continue; + thr.messages = []; + + array_push(contests, thr); + + var url = $"https://discord.com/api/v10/channels/{thr.id}/messages"; + array_push(contest_message_req, [ http_request(url, "GET", discord_map, ""), array_length(contests) - 1 ]); + } + + array_insert(pages, 0, "Contests"); + project_page++; + } + + return; +} + +for( var i = 0; i < array_length(contest_message_req); i++ ) { + if(async_load[? "id"] != contest_message_req[i][0]) continue; + + var r_str = async_load[? "result"]; + if(is_undefined(r_str)) return; + + var msgs = json_parse(r_str); + var ind = contest_message_req[i][1]; + var thr = contests[ind]; + thr.messages = msgs; + + for( var j = 0; j < array_length(msgs); j++ ) { + var msg = msgs[j]; + + var aut = msg.author.id; + if(ds_map_exists(nicknames, aut)) continue; + + var url = $"https://discord.com/api/v10/guilds/953634069646835773/members/{aut}"; + nicknames[? aut] = [ http_request(url, "GET", discord_map, ""), msg.author.username ]; + } + + thr.title = msgs[array_length(msgs) - 1]; + thr.title.meta = {}; + + var content = thr.title.content; + var _metaSp = string_split(content, "```",, 2); + + if(array_length(_metaSp) == 3 && _metaSp[0] == "") { + var _meta = _metaSp[1]; + var _mtS = string_splice(_meta, "\n"); + + for( var j = 0; j < array_length(_mtS); j++ ) { + var __mt = string_splice(_mtS[j], ":"); + if(array_length(__mt) < 2) continue; + + thr.title.meta[$ string_lower(string_trim(__mt[0]))] = string_trim(__mt[1]); + } + + thr.title.content = string_trim(_metaSp[2]); + } + + if(struct_has(thr.title, "attachments") && array_length(thr.title.attachments)) { + var att = thr.title.attachments[0]; + thr.title.attachments = att; + + var path = DIRECTORY + "temp/" + att.id + ".png"; + attachment[? att.id] = [ http_get_file(att.url, path), path ]; + } else + thr.title.attachments = noone; + + return; +} + +var keys = ds_map_keys_to_array(nicknames); +for( var i = 0; i < array_length(keys); i++ ) { + var nick = nicknames[? keys[i]]; + + if(!is_array(nick)) continue; + if(async_load[? "id"] != nick[0]) continue; + + var r_str = async_load[? "result"]; + if(is_undefined(r_str)) return; + + var auth = json_parse(r_str); + nicknames[? keys[i]] = struct_try_get(auth, "nick", nick[1]); + + return; +} + +var keys = ds_map_keys_to_array(attachment); +for( var i = 0; i < array_length(keys); i++ ) { + var att = attachment[? keys[i]]; + + if(!is_array(att)) continue; + if(async_load[? "id"] != att[0]) continue; + + var path = att[1]; + print(path); + + if(!file_exists(path)) { + attachment[? keys[i]] = noone; + return; + } + + var spr = sprite_add(path, 0, false, 0, 0, 0); + attachment[? keys[i]] = spr; + var _sw = sprite_get_width(spr); + var _sh = sprite_get_height(spr); + sprite_set_offset(spr, _sw / 2, _sh / 2); + + return; +} \ No newline at end of file diff --git a/objects/o_dialog_splash/o_dialog_splash.yy b/objects/o_dialog_splash/o_dialog_splash.yy index 71ef73169..9977e26f0 100644 --- a/objects/o_dialog_splash/o_dialog_splash.yy +++ b/objects/o_dialog_splash/o_dialog_splash.yy @@ -5,6 +5,8 @@ "eventList": [ {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,}, ], "managed": true, "overriddenProperties": [], diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 0bd925aec..c7d727720 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -40,7 +40,7 @@ TOOLTIP = ""; DRAGGING = noone; KEYBOARD_STRING = ""; - RENDER_QUEUE = ds_queue_create(); + RENDER_QUEUE = new Queue(); globalvar AUTO_SAVE_TIMER; AUTO_SAVE_TIMER = 0; diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml new file mode 100644 index 000000000..99cee4186 --- /dev/null +++ b/scripts/__node_iterator/__node_iterator.gml @@ -0,0 +1,89 @@ +enum ITERATION_STATUS { + not_ready, + loop, + complete, +} + +function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor { + willRestart = false; //in the next getNextNode, reset all child nodes, use in loop. + + static initLoop = function() { + resetRender(); + + iterated = 0; + loop_start_time = get_timer(); + var node_list = getNodeList(); + + for( var i = 0; i < ds_list_size(node_list); i++ ) { + var n = node_list[| i]; + if(variable_struct_exists(n, "initLoop")) + n.initLoop(); + } + + doInitLoop(); + + LOG_LINE_IF(global.FLAG.render, "------------------< Loop begin >------------------"); + } + + static doInitLoop = function() {} + + static update = function(frame = ANIMATOR.current_frame) { initLoop(); } + + static outputNextNode = function() { + LOG_BLOCK_START(); + LOG_IF(global.FLAG.render, "Get next node from Loop output"); + + var _nodes = []; + for( var i = 0; i < ds_list_size(nodes); i++ ) { // check if every node is updated + if(!nodes[| i].rendered) { + LOG_IF(global.FLAG.render, $"Skipped due to node {nodes[| i].internalName} not rendered."); + LOG_BLOCK_END(); + return _nodes; + } + } + + if(willRestart) { + resetRender(); + willRestart = false; + } + + var _ren = iterationStatus(); + + if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? + //LOG_IF(global.FLAG.render, "Loop restart: iteration " + string(group.iterated)); + _nodes = array_append(_nodes, __nodeLeafList(getNodeList())); + } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop + //LOG_IF(global.FLAG.render, "Loop completed"); + setRenderStatus(true); + _nodes = getNextNodesExternal(); + } + + LOG_BLOCK_END(); + + return _nodes; + } + + static getIterationCount = function() { return 0; } + + static iterationStatus = function() { + if(iterated >= getIterationCount()) + return ITERATION_STATUS.complete; + return ITERATION_STATUS.loop; + } + + static iterationUpdate = function() { + for( var i = 0; i < ds_list_size(nodes); i++ ) // check if every node is updated + if(!nodes[| i].rendered) return; + + willRestart = true; + var maxIter = getIterationCount(); + iterated++; + + if(iterated == maxIter) { + LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [COMPLETE] >------------------"); + render_time = get_timer() - loop_start_time; + } else if(iterated < maxIter) { + LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [RESTART] >------------------"); + } + } +} \ No newline at end of file diff --git a/scripts/__node_iterator/__node_iterator.yy b/scripts/__node_iterator/__node_iterator.yy new file mode 100644 index 000000000..ee633f532 --- /dev/null +++ b/scripts/__node_iterator/__node_iterator.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "__node_iterator", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "iterate", + "path": "folders/nodes/data/iterate.yy", + }, +} \ No newline at end of file diff --git a/scripts/ds_list_queue/ds_list_queue.gml b/scripts/ds_list_queue/ds_list_queue.gml new file mode 100644 index 000000000..e165e93ba --- /dev/null +++ b/scripts/ds_list_queue/ds_list_queue.gml @@ -0,0 +1,35 @@ +function Queue() constructor { + data = []; + + static enqueue = function(val) { + if(array_exists(data, val)) return self; + //array_remove(data, val); + array_push(data, val); + + return self; + } + + static dequeue = function() { + if(array_length(data) < 1) return undefined; + + var val = data[0]; + array_delete(data, 0, 1); + return val; + } + + static clear = function() { + data = []; + return self; + } + + static size = function() { return array_length(data); } + static empty = function() { return size() == 0; } + + static toString = function() { + var ss = "["; + for( var i = 0; i < array_length(data); i++ ) + ss += (i? ", " : "") + string(data[i].internalName); + ss += "]" + return ss; + } +} \ No newline at end of file diff --git a/scripts/ds_list_queue/ds_list_queue.yy b/scripts/ds_list_queue/ds_list_queue.yy new file mode 100644 index 000000000..12a8bc2ad --- /dev/null +++ b/scripts/ds_list_queue/ds_list_queue.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "ds_list_queue", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "ds", + "path": "folders/functions/ds.yy", + }, +} \ No newline at end of file diff --git a/scripts/logger/logger.gml b/scripts/logger/logger.gml index 767af2560..1c8dbc43b 100644 --- a/scripts/logger/logger.gml +++ b/scripts/logger/logger.gml @@ -9,7 +9,7 @@ var s = ""; repeat(global.LOG_LEVEL - 1) s += " "; - s += "|- "; + s += "├ "; print(s + string(text)); } diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 0589f6ea1..08128a7ff 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -65,6 +65,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc auto_render_time = false; combine_render_time = true; + reset_all_child = false; isInstancer = false; instanceBase = noone; @@ -135,24 +136,49 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc } } - static getNextNodes = function() { + static getNextNodes = function() { //get node inside the group LOG_BLOCK_START(); - var nodes = []; + LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from group"); + + var allReady = true; for(var i = custom_input_index; i < ds_list_size(inputs); i++) { var _in = inputs[| i].from; if(!_in.renderActive) continue; - array_push(nodes, _in); - LOG_IF(global.FLAG.render, "Check complete, push " + _in.name + " to stack."); + if(!_in.isRenderable()) { + LOG_IF(global.FLAG.render, $"Node {_in.internalName} not ready, loop skip."); + LOG_BLOCK_END(); + return []; + } } + var nodes = __nodeLeafList(getNodeList()); LOG_BLOCK_END(); return nodes; } + static getNextNodesExternal = function() { //get node connected to the parent object + var nodes = []; + for( var i = 0; i < ds_list_size(outputs); i++ ) { + var _ot = outputs[| i]; + + for(var j = 0; j < ds_list_size(_ot.value_to); j++) { + var _to = _ot.value_to[| j]; + var _node = _to.node; + + if(!_node.renderActive) continue; + + if(_node.active && _to.value_from != noone && _to.value_from.node == group && _node.isRenderable()) + array_push(nodes, _to.node); + } + } + + return nodes; + } + static setRenderStatus = function(result) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Set render status for " + name + " : " + string(result)); + LOG_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); LOG_BLOCK_END(); rendered = result; @@ -376,14 +402,14 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static resetRender = function() { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Reset Render for collection " + name); + LOG_IF(global.FLAG.render, $"Reset Render for {internalName}"); for( var i = 0; i < ds_list_size(nodes); i++ ) { - LOG_IF(global.FLAG.render, "Reset Render for " + nodes[| i].name); - nodes[| i].rendered = false; + //LOG_IF(global.FLAG.render, $"Reset Render for {nodes[| i].internalName}"); + nodes[| i].resetRender(); } - rendered = false; + setRenderStatus(false); LOG_BLOCK_END(); } diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 47f4dafce..b6c5c9626 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -716,6 +716,12 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } } + static step = function() { + var _dim_type = getSingleValue(1); + + inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant); + } + static process_data = function(_outSurf, _data, _output_index, _array_index) { if(_output_index == 1) return atlas_data; if(_output_index == 0 && _array_index == 0) atlas_data = []; @@ -730,12 +736,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) switch(_dim_type) { case COMPOSE_OUTPUT_SCALING.first : - inputs[| 2].setVisible(false); ww = surface_get_width(base); hh = surface_get_height(base); break; case COMPOSE_OUTPUT_SCALING.largest : - inputs[| 2].setVisible(false); for(var i = input_fix_len; i < array_length(_data) - data_length; i += data_length) { var _s = _data[i]; ww = max(ww, surface_get_width(_s)); @@ -743,7 +747,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } break; case COMPOSE_OUTPUT_SCALING.constant : - inputs[| 2].setVisible(true); ww = _dim[0]; hh = _dim[1]; break; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 0e8c618fe..843e5805d 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -296,7 +296,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(SAFE_MODE) return; var sBase = surface_get_target(); LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "DoUpdate called from " + name); + LOG_IF(global.FLAG.render, $">>>>>>>>>> DoUpdate called from {internalName} <<<<<<<<<<"); for( var i = 0; i < ds_list_size(inputs); i++ ) { if(inputs[| i].type != VALUE_TYPE.trigger) continue; @@ -308,11 +308,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x try { var t = get_timer(); + if(!is_instanceof(self, Node_Collection)) setRenderStatus(true); - update(); - + update(); ///UPDATE + if(!is_instanceof(self, Node_Collection)) render_time = get_timer() - t; } catch(exception) { @@ -347,22 +348,31 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static triggerRender = function() { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Trigger render for " + name + " (" + display_name + ")"); + LOG_IF(global.FLAG.render, $"Trigger render for {internalName}"); setRenderStatus(false); UPDATE |= RENDER_TYPE.partial; - var nodes = getNextNodesRaw(); - for(var i = 0; i < array_length(nodes); i++) - nodes[i].triggerRender(); + if(is_instanceof(group, Node_Collection) && group.reset_all_child) { + group.resetRender(); + } else { + resetRender(); + + var nodes = getNextNodesRaw(); + for(var i = 0; i < array_length(nodes); i++) + nodes[i].triggerRender(); + } + LOG_BLOCK_END(); } - + + static resetRender = function() { setRenderStatus(false); } + static isRenderable = function(log = false) { //Check if every input is ready (updated) if(!active) return false; if(!renderActive) return false; - if(group && struct_has(group, "iterationStatus") && group.iterationStatus() == ITERATION_STATUS.complete) return false; + //if(group && struct_has(group, "iterationStatus") && group.iterationStatus() == ITERATION_STATUS.complete) return false; for(var j = 0; j < ds_list_size(inputs); j++) { var _in = inputs[| j]; @@ -373,7 +383,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!val_from.node.active) continue; if(!val_from.node.renderActive) continue; if(!val_from.node.rendered && !val_from.node.update_on_frame) { - //LOG_LINE_IF(global.FLAG.render && name == "Tunnel Out", "Non renderable because: " + string(val_from.node.name)); + LOG_LINE_IF(global.FLAG.render, $"Node {internalName} is not renderable because input {val_from.node.internalName} is not rendered"); return false; } } @@ -385,26 +395,30 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static getNextNodes = function() { var nodes = []; + var nodeNames = []; LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Call get next node from: " + name); + LOG_IF(global.FLAG.render, $"→→→→→ Call get next node from: {internalName}"); LOG_BLOCK_START(); for(var i = 0; i < ds_list_size(outputs); i++) { var _ot = outputs[| i]; + if(!_ot.forward) continue; - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; - if(!_to.node.active || _to.value_from == noone) continue; + var _tos = _ot.getJunctionTo(); + + for( var j = 0; j < array_length(_tos); j++ ) { + var _to = _tos[j]; - LOG_IF(global.FLAG.render, "Check render " + _to.node.name + " from " + _to.value_from.node.name); - if(_to.value_from.node != self) continue; - - LOG_IF(global.FLAG.render, "Check complete, push " + _to.node.name + " to stack."); array_push(nodes, _to.node); + array_push(nodeNames, _to.node.internalName); + + //LOG_IF(global.FLAG.render, $"→→ Check output: {_ot.name} connect to node {_to.node.internalName}"); } } + LOG_IF(global.FLAG.render, $"→→ Push {nodeNames} to stack."); + LOG_BLOCK_END(); LOG_BLOCK_END(); return nodes; @@ -413,7 +427,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static onInspect = function() {} static setRenderStatus = function(result) { - LOG_LINE_IF(global.FLAG.render, "Set render status for " + name + " : " + string(result)); + LOG_LINE_IF(global.FLAG.render, $"Set render status for {internalName} : {string(result)}"); rendered = result; } diff --git a/scripts/node_feedback/node_feedback.gml b/scripts/node_feedback/node_feedback.gml index 8645eaae5..27c9d54c2 100644 --- a/scripts/node_feedback/node_feedback.gml +++ b/scripts/node_feedback/node_feedback.gml @@ -3,6 +3,8 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) color = COLORS.node_blend_feedback; icon = THEME.feedback; + reset_all_child = true; + if(!LOADING && !APPENDING && !CLONING) { var input = nodeBuild("Node_Feedback_Input", -256, -32, self); var output = nodeBuild("Node_Feedback_Output", 256, -32, self); diff --git a/scripts/node_feedback_input/node_feedback_input.gml b/scripts/node_feedback_input/node_feedback_input.gml index f47b7a0e7..ce7fe60e1 100644 --- a/scripts/node_feedback_input/node_feedback_input.gml +++ b/scripts/node_feedback_input/node_feedback_input.gml @@ -21,7 +21,7 @@ function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, return outputs[| 0].getValueDefault(); } - outputs[| 1] = nodeValue("Feedback loop", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); + outputs[| 1] = nodeValue("Feedback loop", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0).nonForward(); PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index b735807f1..058c0aa33 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -206,7 +206,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru inParent = nodeValue("Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1) .setVisible(true, true); inParent.from = self; - + ds_list_add(group.inputs, inParent); outputs[| 0].setFrom(inParent, false, false); group.setHeight(); diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 0aee5a822..f7410e00b 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -19,7 +19,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr output_index = -1; static setRenderStatus = function(result) { - LOG_LINE_IF(global.FLAG.render, "Set render status for " + name + " : " + string(result)); + LOG_LINE_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); rendered = result; if(group) group.setRenderStatus(result); @@ -56,7 +56,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr //printIf(global.FLAG.render, "Group output ready " + string(_to.node.isRenderable())); array_push(nodes, _to.node); - LOG_IF(global.FLAG.render, "Check complete, push " + _to.node.name + " to stack."); + LOG_IF(global.FLAG.render, $"Check complete, push {_to.node.internalName} to stack."); } LOG_BLOCK_END(); diff --git a/scripts/node_iterate/node_iterate.gml b/scripts/node_iterate/node_iterate.gml index 4cbe74a7a..07122d969 100644 --- a/scripts/node_iterate/node_iterate.gml +++ b/scripts/node_iterate/node_iterate.gml @@ -1,14 +1,9 @@ -enum ITERATION_STATUS { - not_ready, - loop, - complete, -} - -function Node_Iterate(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor { +function Node_Iterate(_x, _y, _group = noone) : Node_Iterator(_x, _y, _group) constructor { name = "Loop"; color = COLORS.node_blend_loop; icon = THEME.loop; + reset_all_child = true; combine_render_time = false; iterated = 0; @@ -26,71 +21,7 @@ function Node_Iterate(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) output.inputs[| 2].setFrom(input.outputs[| 1]); } - static initLoop = function() { - resetRender(); - - iterated = 0; - loop_start_time = get_timer(); - var node_list = getNodeList(); - - for( var i = 0; i < ds_list_size(node_list); i++ ) { - var n = node_list[| i]; - if(variable_struct_exists(n, "initLoop")) - n.initLoop(); - } - - LOG_LINE_IF(global.FLAG.render, "Loop begin"); - } - - static getNextNodes = function() { - var allReady = true; - for(var i = custom_input_index; i < ds_list_size(inputs); i++) { - var _in = inputs[| i].from; - if(!_in.renderActive) continue; - - allReady &= _in.isRenderable() - } - - if(!allReady) return []; - - initLoop(); - return __nodeLeafList(getNodeList()); - } - - static getIterationCount = function() { - var maxIter = inputs[| 0].getValue(); - return maxIter; - } - - static iterationUpdate = function() { - var siz = ds_list_size(outputs); // check if every output is updated - for( var i = custom_output_index; i < siz; i++ ) { - var _o = outputs[| i]; - if(!_o.node.rendered) return; - } - - var maxIter = getIterationCount(); - iterated++; - - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Iteration update: " + string(iterated) + "/" + string(maxIter)); - - if(iterated >= maxIter) { - LOG_IF(global.FLAG.render, "Iteration complete"); - render_time = get_timer() - loop_start_time; - } else { - LOG_IF(global.FLAG.render, "Iteration not completed, reset render status."); - resetRender(); - } - - LOG_BLOCK_END(); - } - - static iterationStatus = function() { - if(iterated >= getIterationCount()) - return ITERATION_STATUS.complete; - return ITERATION_STATUS.loop; - } + static getIterationCount = function() { return inputs[| 0].getValue(); } PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_iterate_each/node_iterate_each.gml b/scripts/node_iterate_each/node_iterate_each.gml index ad00127c5..0a8059d38 100644 --- a/scripts/node_iterate_each/node_iterate_each.gml +++ b/scripts/node_iterate_each/node_iterate_each.gml @@ -1,8 +1,9 @@ -function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor { +function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _group) constructor { name = "Loop Array"; color = COLORS.node_blend_loop; icon = THEME.loop; + reset_all_child = true; combine_render_time = false; iterated = 0; @@ -23,25 +24,12 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr output.inputs[| 0].setFrom(input.outputs[| 0]); } - static getNextNodesRaw = function() { - return __nodeLeafList(getNodeList()); - } - - static getNextNodes = function() { - initLoop(); - return __nodeLeafList(getNodeList()); - } - static onStep = function() { var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; inputs[| 0].type = type; } - static initLoop = function() { - resetRender(); - iterated = 0; - loop_start_time = get_timer(); - + static doInitLoop = function() { var arrIn = inputs[| 0].getValue(); var arrOut = outputs[| 0].getValue(); @@ -49,8 +37,6 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr surface_array_free(arrOut); outputs[| 0].setValue([]) } - - LOG_LINE_IF(global.FLAG.render, "Loop begin"); } static getIterationCount = function() { @@ -61,35 +47,5 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr return maxIter; } - static iterationUpdate = function() { - var siz = ds_list_size(outputs); // check if every output is updated - for( var i = custom_output_index; i < siz; i++ ) { - var _o = outputs[| i]; - if(!_o.node.rendered) return; - } - - var maxIter = getIterationCount(); - iterated++; - - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Iteration update: " + string(iterated) + "/" + string(maxIter)); - - if(iterated >= maxIter) { - LOG_IF(global.FLAG.render, "Iteration complete"); - render_time = get_timer() - loop_start_time; - } else { - LOG_IF(global.FLAG.render, "Iteration not completed, reset render status."); - resetRender(); - } - - LOG_BLOCK_END(); - } - - static iterationStatus = function() { - if(iterated >= getIterationCount()) - return ITERATION_STATUS.complete; - return ITERATION_STATUS.loop; - } - PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_iterate_filter/node_iterate_filter.gml b/scripts/node_iterate_filter/node_iterate_filter.gml index 13e05c2f6..db28910f3 100644 --- a/scripts/node_iterate_filter/node_iterate_filter.gml +++ b/scripts/node_iterate_filter/node_iterate_filter.gml @@ -1,10 +1,11 @@ //Make an iterator_* parent??? -function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor { +function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _group) constructor { name = "Filter Array"; color = COLORS.node_blend_loop; icon = THEME.loop; + reset_all_child = true; combine_render_time = false; iterated = 0; @@ -25,30 +26,17 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _ output.inputs[| 0].setFrom(input.outputs[| 0]); } - static getNextNodes = function() { - initLoop(); - return __nodeLeafList(getNodeList()); - } - static onStep = function() { var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; inputs[| 0].type = type; } - static initLoop = function() { - resetRender(); - iterated = 0; - loop_start_time = get_timer(); - + static doInitLoop = function() { var arrIn = inputs[| 0].getValue(); var arrOut = outputs[| 0].getValue(); surface_array_free(arrOut); outputs[| 0].setValue([]) - - LOG_LINE_IF(global.FLAG.render, "Loop begin"); - var _val = outputs[| 0].getValue(); - LOG_LINE_IF(global.FLAG.render, "Output original value " + string(_val)); } static getIterationCount = function() { @@ -59,27 +47,5 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _ return maxIter; } - static iterationUpdate = function() { - var siz = ds_list_size(outputs); // check if every output is updated - for( var i = custom_output_index; i < siz; i++ ) { - var _o = outputs[| i]; - if(!_o.node.rendered) return; - } - - var maxIter = getIterationCount(); - iterated++; - - if(iterated >= maxIter) - render_time = get_timer() - loop_start_time; - else - resetRender(); - } - - static iterationStatus = function() { - if(iterated >= getIterationCount()) - return ITERATION_STATUS.complete; - return ITERATION_STATUS.loop; - } - PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index 483b96f5f..5cfadc111 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -3,6 +3,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr color = COLORS.node_blend_loop; icon = THEME.loop; + reset_all_child = true; combine_render_time = false; inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] ) @@ -30,7 +31,6 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr } static getNextNodes = function() { - initLoop(); return __nodeLeafList(getNodeList()); } @@ -39,6 +39,10 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr inputs[| 0].type = type; } + static update = function(frame = ANIMATOR.current_frame) { + initLoop(); + } + static swap = function(arr, a, b) { var temp = arr[a]; arr[@ a] = arr[b]; 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 fb8b1ebcf..808b4ec8f 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -10,44 +10,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 ) .setVisible(false); - static getNextNodesRaw = function() { - var nodes = []; - - var _ot = group.outputs[| 0]; - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; - if(!_to.node.renderActive) continue; - - if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) { - if(_to.node.isRenderable()) - array_push(nodes, _to.node); - } - } - - return nodes; - } - static getNextNodes = function() { - if(!struct_has(group, "iterationStatus")) return []; - var _ren = group.iterationStatus(); - var nodes = []; - - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Call get next node from loop output."); - - if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? - LOG_IF(global.FLAG.render, "Loop restart: iteration " + string(group.iterated)); - nodes = array_append(nodes, __nodeLeafList(group.getNodeList())); - } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop - LOG_IF(global.FLAG.render, "Loop completed"); - group.setRenderStatus(true); - nodes = getNextNodesRaw(); - } else - LOG_IF(global.FLAG.render, "Loop not ready"); - - LOG_BLOCK_END(); - - return nodes; + if(!struct_has(group, "outputNextNode")) return []; + return group.outputNextNode(); } static step = function() { 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 087a41791..31f0b7911 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -10,44 +10,9 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro inputs[| 1] = nodeValue("Result", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ) .setVisible(true, true); - static getNextNodesRaw = function() { - var nodes = []; - - var _ot = group.outputs[| 0]; - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; - if(!_to.node.renderActive) continue; - - if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) { - if(_to.node.isRenderable()) - array_push(nodes, _to.node); - } - } - - return nodes; - } - static getNextNodes = function() { - if(!struct_has(group, "iterationStatus")) return []; - var _ren = group.iterationStatus(); - var nodes = []; - - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Call get next node from loop output."); - - if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? - LOG_IF(global.FLAG.render, "Loop restart: iteration " + string(group.iterated)); - nodes = array_append(nodes, __nodeLeafList(group.getNodeList())); - } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop - LOG_IF(global.FLAG.render, "Loop completed"); - group.setRenderStatus(true); - nodes = getNextNodesRaw(); - } else - LOG_IF(global.FLAG.render, "Loop not ready"); - - LOG_BLOCK_END(); - - return nodes; + if(!struct_has(group, "outputNextNode")) return []; + return group.outputNextNode(); } static step = function() { diff --git a/scripts/node_iterator_input/node_iterator_input.gml b/scripts/node_iterator_input/node_iterator_input.gml index 474975c92..03869b170 100644 --- a/scripts/node_iterator_input/node_iterator_input.gml +++ b/scripts/node_iterator_input/node_iterator_input.gml @@ -31,7 +31,7 @@ function Node_Iterator_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, return [ _node_output.node.cache_value, inParent ]; } - outputs[| 1] = nodeValue("Loop entrance", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0); + outputs[| 1] = nodeValue("Loop entrance", self, JUNCTION_CONNECT.output, VALUE_TYPE.node, 0).nonForward(); PATCH_STATIC } \ No newline at end of file diff --git a/scripts/node_iterator_output/node_iterator_output.gml b/scripts/node_iterator_output/node_iterator_output.gml index dbced5678..ae6fc3919 100644 --- a/scripts/node_iterator_output/node_iterator_output.gml +++ b/scripts/node_iterator_output/node_iterator_output.gml @@ -31,44 +31,9 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y cache_value = -1; - static getNextNodesRaw = function() { - var nodes = []; - - var _ot = outParent; - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; - if(!_to.node.renderActive) continue; - - if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) { - if(_to.node.isRenderable()) - array_push(nodes, _to.node); - } - } - - return nodes; - } - static getNextNodes = function() { - var nodes = []; - var _node_it = group; - if(!struct_has(_node_it, "iterationStatus")) return nodes; - var _ren = _node_it.iterationStatus(); - - LOG_BLOCK_START(); - - if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside? - LOG_IF(global.FLAG.render, "Loop restart: iteration " + string(group.iterated)); - nodes = array_append(nodes, __nodeLeafList(group.getNodeList())); - } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop - LOG_IF(global.FLAG.render, "Loop completed"); - group.setRenderStatus(true); - nodes = getNextNodesRaw(); - } else - LOG_IF(global.FLAG.render, "Loop not ready"); - - LOG_BLOCK_END(); - - return nodes; + if(!struct_has(group, "outputNextNode")) return []; + return group.outputNextNode(); } static initLoop = function() { diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index afdb64192..0ef14b5cd 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -353,6 +353,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru y = node.y; index = _connect == JUNCTION_CONNECT.input? ds_list_size(node.inputs) : ds_list_size(node.outputs); type = _type; + forward = true; if(struct_has(node, "inputMap")) { if(_connect == JUNCTION_CONNECT.input) node.inputMap[? internalName] = self; @@ -489,6 +490,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return self; } + static nonForward = function() { + forward = false; + return self; + } + static isAnimable = function() { if(type == VALUE_TYPE.gradient) return false; if(display_type == VALUE_DISPLAY.text_array) return false; @@ -1443,6 +1449,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var is_hover = false; if(PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, x, y, 10 * _s * sca)) { + //var _to = getJunctionTo(); + //var _ss = ""; + //for( var i = 0; i < array_length(_to); i++ ) + // _ss += (i? ", " : "") + _to[i].internalName; + //TOOLTIP = _ss; + is_hover = true; if(type == VALUE_TYPE.action) draw_sprite_ext(THEME.node_junction_inspector, 1, x, y, ss, ss, 0, c_white, 1); @@ -1561,6 +1573,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru PANEL_ANIMATION.updatePropertyList(); } + static getJunctionTo = function() { + var to = []; + + for(var j = 0; j < ds_list_size(value_to); j++) { + var _to = value_to[| j]; + if(!_to.node.active || _to.value_from == noone) continue; + if(_to.value_from != self) continue; + + array_push(to, _to); + } + + return to; + } + static dragValue = function() { if(drop_key == "None") return; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 7c3870b46..93f89d742 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -5,13 +5,13 @@ enum RENDER_TYPE { } #region globalvar - global.FLAG.render = false; + global.FLAG.render = false; global.group_inputs = [ "Node_Group_Input", "Node_Feedback_Input", "Node_Iterator_Input", "Node_Iterator_Each_Input" ]; #endregion function __nodeLeafList(_list) { var nodes = []; - LOG_BLOCK_START(); + var nodeNames = []; for( var i = 0; i < ds_list_size(_list); i++ ) { var _node = _list[| i]; @@ -21,11 +21,11 @@ function __nodeLeafList(_list) { var _startNode = _node.isRenderable(); if(_startNode) { array_push(nodes, _node); - LOG_IF(global.FLAG.render, "Push node " + _node.name + " to stack"); + array_push(nodeNames, _node.internalName); } } - LOG_BLOCK_END(); + LOG_LINE_IF(global.FLAG.render, $"Push node {nodeNames} to stack"); return nodes; } @@ -52,13 +52,15 @@ function __nodeInLoop(_node) { function Render(partial = false, runAction = false) { var t = current_time; LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "=== RENDER START [frame " + string(ANIMATOR.current_frame) + "] ==="); + LOG_IF(global.FLAG.render, +$"============================== RENDER START [frame {string(ANIMATOR.current_frame)}] =============================="); try { var rendering = noone; - var error = 0; + var error = 0; + var reset_all = !partial || ALWAYS_FULL; - if(!partial || ALWAYS_FULL) { + if(reset_all) { var _key = ds_map_find_first(NODE_MAP); var amo = ds_map_size(NODE_MAP); @@ -70,7 +72,7 @@ function Render(partial = false, runAction = false) { } // get leaf node - ds_queue_clear(RENDER_QUEUE); + RENDER_QUEUE.clear(); var key = ds_map_find_first(NODE_MAP); var amo = ds_map_size(NODE_MAP); repeat(amo) { @@ -84,49 +86,51 @@ function Render(partial = false, runAction = false) { if(!_node.active) continue; if(!_node.renderActive) continue; if(_node.rendered) { - LOG_IF(global.FLAG.render, "Skip rendered " + _node.name + " (" + _node.display_name + ")"); + LOG_IF(global.FLAG.render, $"Skip rendered {_node.internalName}"); continue; } - if(__nodeInLoop(_node)) continue; + //if(__nodeInLoop(_node)) continue; + if(_node.group != noone) continue; LOG_BLOCK_START(); var _startNode = _node.isRenderable(global.FLAG.render); if(_startNode) { - LOG_IF(global.FLAG.render, "Found leaf " + _node.name + " (" + _node.display_name + ")"); + LOG_IF(global.FLAG.render, $"Found leaf {_node.internalName}"); - _node.triggerRender(); - ds_queue_enqueue(RENDER_QUEUE, _node); + if(!reset_all) _node.triggerRender(); + RENDER_QUEUE.enqueue(_node); } else - LOG_IF(global.FLAG.render, "Skip non-leaf " + _node.name + " (" + _node.display_name + ")"); + LOG_IF(global.FLAG.render, $"Skip non-leaf {_node.internalName}"); LOG_BLOCK_END(); } - LOG_IF(global.FLAG.render, "Get leaf complete: found " + string(ds_queue_size(RENDER_QUEUE)) + " leaves."); - LOG_IF(global.FLAG.render, "Start rendering..."); + LOG_IF(global.FLAG.render, $"Get leaf complete: found {RENDER_QUEUE.size()} leaves."); + LOG_IF(global.FLAG.render, "================== Start rendering =================="); // render forward - while(!ds_queue_empty(RENDER_QUEUE)) { - rendering = ds_queue_dequeue(RENDER_QUEUE); + while(!RENDER_QUEUE.empty()) { + LOG_BLOCK_START(); + LOG_IF(global.FLAG.render, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE}"); + rendering = RENDER_QUEUE.dequeue(); var renderable = rendering.isRenderable(); - LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Rendering " + rendering.name + " (" + rendering.display_name + ") "); + LOG_IF(global.FLAG.render, $"Rendering {rendering.internalName} ({rendering.display_name}) : {renderable? "Update" : "Pass"}"); if(renderable) { rendering.doUpdate(); var nextNodes = rendering.getNextNodes(); for( var i = 0; i < array_length(nextNodes); i++ ) - ds_queue_enqueue(RENDER_QUEUE, nextNodes[i]); + RENDER_QUEUE.enqueue(nextNodes[i]); if(runAction && rendering.hasInspector1Update()) rendering.inspector1Update(); - } + } else + RENDER_QUEUE.enqueue(rendering); - LOG_IF(global.FLAG.render, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + (renderable? " [Update]" : " [Skip]")); LOG_BLOCK_END(); } } catch(e) { @@ -148,7 +152,7 @@ function __renderListReset(list) { function RenderList(list) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "=== RENDER LIST START ==="); + LOG_IF(global.FLAG.render, "=============== RENDER LIST START ==============="); var queue = ds_queue_create(); try { @@ -174,7 +178,7 @@ function RenderList(list) { } LOG_IF(global.FLAG.render, "Get leaf complete: found " + string(ds_queue_size(queue)) + " leaves."); - LOG_IF(global.FLAG.render, "Start rendering..."); + LOG_IF(global.FLAG.render, "=== Start rendering ==="); // render forward while(!ds_queue_empty(queue)) { @@ -183,7 +187,7 @@ function RenderList(list) { rendering.doUpdate(); - LOG_LINE_IF(global.FLAG.render, "Rendering " + rendering.name + " (" + rendering.display_name + ") "); + LOG_LINE_IF(global.FLAG.render, $"Rendering {rendering.internalName}"); var nextNodes = rendering.getNextNodes(); for( var i = 0; i < array_length(nextNodes); i++ ) @@ -211,7 +215,7 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { __renderListReset(list); // get leaf node - ds_queue_clear(RENDER_QUEUE); + RENDER_QUEUE.clear(); for( var i = 0; i < ds_list_size(list); i++ ) { var _node = list[| i]; @@ -223,14 +227,14 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { if(_node.rendered) continue; if(_node.isRenderable()) { - ds_queue_enqueue(RENDER_QUEUE, _node); - printIf(global.FLAG.render, " > Push " + _node.name + " (" + _node.display_name + ") node to stack"); + RENDER_QUEUE.enqueue(_node); + printIf(global.FLAG.render, $" > Push {_node.internalName} node to stack"); } } // render forward - while(!ds_queue_empty(RENDER_QUEUE)) { - rendering = ds_queue_dequeue(RENDER_QUEUE); + while(!RENDER_QUEUE.empty()) { + rendering = RENDER_QUEUE.dequeue(); if(rendering.group == context) break; var txt = rendering.isRenderable()? " [Skip]" : " [Update]"; @@ -239,15 +243,15 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { rendering.doUpdate(); if(rendering.hasInspector1Update()) { rendering.inspector1Update(); - printIf(global.FLAG.render, " > Toggle manual execution " + rendering.name + " (" + rendering.display_name + ")"); + printIf(global.FLAG.render, $" > Toggle manual execution {rendering.internalName}"); } var nextNodes = rendering.getNextNodes(); for( var i = 0; i < array_length(nextNodes); i++ ) - ds_queue_enqueue(RENDER_QUEUE, nextNodes[i]); + RENDER_QUEUE.enqueue(nextNodes[i]); } - printIf(global.FLAG.render, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + txt); + printIf(global.FLAG.render, $"Rendered {rendering.internalName} {txt}"); } printIf(global.FLAG.render, "=== RENDER COMPLETE IN {" + string(current_time - t) + "ms} ===\n"); diff --git a/scripts/string_splice/string_splice.gml b/scripts/string_splice/string_splice.gml index c031858aa..8fc5668da 100644 --- a/scripts/string_splice/string_splice.gml +++ b/scripts/string_splice/string_splice.gml @@ -2,6 +2,7 @@ function string_splice(str, delim) { var st = []; var ss = str; var sp; + var wd = string_length(delim); do { sp = string_pos(delim, ss); diff --git a/sprites/s_contest_banner/0c68139e-898a-4119-967e-260848da9553.png b/sprites/s_contest_banner/0c68139e-898a-4119-967e-260848da9553.png new file mode 100644 index 000000000..65592c451 Binary files /dev/null and b/sprites/s_contest_banner/0c68139e-898a-4119-967e-260848da9553.png differ diff --git a/sprites/s_contest_banner/layers/0c68139e-898a-4119-967e-260848da9553/bb360363-6be9-42da-998b-fcc8496da468.png b/sprites/s_contest_banner/layers/0c68139e-898a-4119-967e-260848da9553/bb360363-6be9-42da-998b-fcc8496da468.png new file mode 100644 index 000000000..65592c451 Binary files /dev/null and b/sprites/s_contest_banner/layers/0c68139e-898a-4119-967e-260848da9553/bb360363-6be9-42da-998b-fcc8496da468.png differ diff --git a/sprites/s_contest_banner/s_contest_banner.yy b/sprites/s_contest_banner/s_contest_banner.yy new file mode 100644 index 000000000..c1712bc7e --- /dev/null +++ b/sprites/s_contest_banner/s_contest_banner.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_contest_banner", + "bbox_bottom": 99, + "bbox_left": 0, + "bbox_right": 571, + "bbox_top": 0, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"0c68139e-898a-4119-967e-260848da9553",}, + ], + "gridX": 0, + "gridY": 0, + "height": 100, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"bb360363-6be9-42da-998b-fcc8496da468","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 1, + "parent": { + "name": "misc", + "path": "folders/sprites/misc.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_contest_banner", + "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":"0c68139e-898a-4119-967e-260848da9553","path":"sprites/s_contest_banner/s_contest_banner.yy",},},},"Disabled":false,"id":"86c522d5-5d70-4ef9-ba1f-ae338913f8a0","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 286, + "yorigin": 0, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 572, +} \ No newline at end of file