diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index ccaedfd63..392179204 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -163,6 +163,7 @@ {"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",}, + {"name":"project","order":39,"path":"folders/functions/project.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -726,6 +727,7 @@ {"name":"s_icon_64","order":2,"path":"sprites/s_icon_64/s_icon_64.yy",}, {"name":"panel_graph_export_image","order":4,"path":"scripts/panel_graph_export_image/panel_graph_export_image.yy",}, {"name":"__bone","order":2,"path":"scripts/__bone/__bone.yy",}, + {"name":"save_function","order":1,"path":"scripts/save_function/save_function.yy",}, {"name":"s_node_gradient_replace","order":18,"path":"sprites/s_node_gradient_replace/s_node_gradient_replace.yy",}, {"name":"node_perlin_smear","order":9,"path":"scripts/node_perlin_smear/node_perlin_smear.yy",}, {"name":"node_alpha_cutoff","order":10,"path":"scripts/node_alpha_cutoff/node_alpha_cutoff.yy",}, @@ -793,7 +795,7 @@ {"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",}, {"name":"s_node_array_get","order":3,"path":"sprites/s_node_array_get/s_node_array_get.yy",}, - {"name":"o_dialog_load","order":12,"path":"objects/o_dialog_load/o_dialog_load.yy",}, + {"name":"o_dialog_save","order":12,"path":"objects/o_dialog_save/o_dialog_save.yy",}, {"name":"s_node_BW","order":13,"path":"sprites/s_node_BW/s_node_BW.yy",}, {"name":"s_node_strandSim_collide","order":7,"path":"sprites/s_node_strandSim_collide/s_node_strandSim_collide.yy",}, {"name":"sh_fd_turbulence","order":22,"path":"shaders/sh_fd_turbulence/sh_fd_turbulence.yy",}, @@ -1211,7 +1213,6 @@ {"name":"__node_value_processor","order":7,"path":"scripts/__node_value_processor/__node_value_processor.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":"load_function","order":2,"path":"scripts/load_function/load_function.yy",}, {"name":"draw_fit","order":12,"path":"scripts/draw_fit/draw_fit.yy",}, {"name":"s_node_morph_surface","order":56,"path":"sprites/s_node_morph_surface/s_node_morph_surface.yy",}, {"name":"fd_rectangle_get_velocity_dissipation_type","order":20,"path":"scripts/fd_rectangle_get_velocity_dissipation_type/fd_rectangle_get_velocity_dissipation_type.yy",}, @@ -1255,6 +1256,7 @@ {"name":"draw_surface_functions","order":4,"path":"scripts/draw_surface_functions/draw_surface_functions.yy",}, {"name":"s_noti_icon_error","order":5,"path":"sprites/s_noti_icon_error/s_noti_icon_error.yy",}, {"name":"node_rigid_variable","order":8,"path":"scripts/node_rigid_variable/node_rigid_variable.yy",}, + {"name":"project_function","order":2,"path":"scripts/project_function/project_function.yy",}, {"name":"s_node_zoom","order":54,"path":"sprites/s_node_zoom/s_node_zoom.yy",}, {"name":"node_noise_fbm","order":3,"path":"scripts/node_noise_fbm/node_noise_fbm.yy",}, {"name":"sh_channel_V","order":6,"path":"shaders/sh_channel_V/sh_channel_V.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 61e6eecf1..914af6f29 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -199,6 +199,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Steamworks","folderPath":"folders/Steamworks.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"UGC","folderPath":"folders/Steamworks/UGC.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"project","folderPath":"folders/functions/project.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -298,6 +299,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_preview_export.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_reset_when_preview_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_revert.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_save_all.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_save_auto.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_save.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_spalsh_show_on_start_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -356,6 +358,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_steam_creator.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_steam.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_strandSim.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_tab_exit.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_text_bullet_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"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",}, @@ -1345,7 +1348,7 @@ {"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",},}, {"id":{"name":"s_node_array_get","path":"sprites/s_node_array_get/s_node_array_get.yy",},}, - {"id":{"name":"o_dialog_load","path":"objects/o_dialog_load/o_dialog_load.yy",},}, + {"id":{"name":"o_dialog_save","path":"objects/o_dialog_save/o_dialog_save.yy",},}, {"id":{"name":"s_node_BW","path":"sprites/s_node_BW/s_node_BW.yy",},}, {"id":{"name":"s_node_strandSim_collide","path":"sprites/s_node_strandSim_collide/s_node_strandSim_collide.yy",},}, {"id":{"name":"sh_fd_turbulence","path":"shaders/sh_fd_turbulence/sh_fd_turbulence.yy",},}, @@ -1881,6 +1884,7 @@ {"id":{"name":"sh_mask","path":"shaders/sh_mask/sh_mask.yy",},}, {"id":{"name":"s_noti_icon_error","path":"sprites/s_noti_icon_error/s_noti_icon_error.yy",},}, {"id":{"name":"node_rigid_variable","path":"scripts/node_rigid_variable/node_rigid_variable.yy",},}, + {"id":{"name":"project_function","path":"scripts/project_function/project_function.yy",},}, {"id":{"name":"s_node_zoom","path":"sprites/s_node_zoom/s_node_zoom.yy",},}, {"id":{"name":"migration_function","path":"scripts/migration_function/migration_function.yy",},}, {"id":{"name":"node_noise_fbm","path":"scripts/node_noise_fbm/node_noise_fbm.yy",},}, diff --git a/datafiles/data/locale/en/UI.json b/datafiles/data/locale/en/UI.json index 17936df07..a016779b7 100644 --- a/datafiles/data/locale/en/UI.json +++ b/datafiles/data/locale/en/UI.json @@ -310,7 +310,7 @@ "dialog_group_order_add": "Add separator", "dialog_exit_title": "Project modified", - "dialog_exit_content": "Save progress before exit?", + "dialog_exit_content": "Save progress before close?", "contest_open_discord": "Open in Discord", diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index 110ccc380..5fceee327 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/_addon_custom/Alarm_0.gml b/objects/_addon_custom/Alarm_0.gml index ee8674d46..47263ef42 100644 --- a/objects/_addon_custom/Alarm_0.gml +++ b/objects/_addon_custom/Alarm_0.gml @@ -1,7 +1,7 @@ /// @description #region deserialize - if(!struct_has(LOAD_ADDON, name)) exit; - var _mp = json_parse(LOAD_ADDON[$ name]); + if(!struct_has(PROJECT.addons, name)) exit; + var _mp = json_parse(PROJECT.addons[$ name]); lua_call(thread, "deserialize", _mp); #endregion \ No newline at end of file diff --git a/objects/o_dialog_anim_time_scaler/Create_0.gml b/objects/o_dialog_anim_time_scaler/Create_0.gml index 2028b596d..17268dad1 100644 --- a/objects/o_dialog_anim_time_scaler/Create_0.gml +++ b/objects/o_dialog_anim_time_scaler/Create_0.gml @@ -8,18 +8,18 @@ event_inherited(); #endregion #region scaler - scale_to = ANIMATOR.frames_total; + scale_to = PROJECT.animator.frames_total; tb_scale_frame = new textBox(TEXTBOX_INPUT.number, function(to) { to = toNumber(to); scale_to = to; }); b_apply = button(function() { - var fac = scale_to / ANIMATOR.frames_total; - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var n = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + var fac = scale_to / PROJECT.animator.frames_total; + var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { + var n = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(!n || !n.active) continue; for(var i = 0; i < ds_list_size(n.inputs); i++) { @@ -31,7 +31,7 @@ event_inherited(); } } } - ANIMATOR.frames_total = scale_to; + PROJECT.animator.frames_total = scale_to; instance_destroy(); }).setIcon(THEME.accept, 0, COLORS._main_icon_dark); #endregion \ No newline at end of file diff --git a/objects/o_dialog_anim_time_scaler/Draw_64.gml b/objects/o_dialog_anim_time_scaler/Draw_64.gml index 87ed42b8b..662579892 100644 --- a/objects/o_dialog_anim_time_scaler/Draw_64.gml +++ b/objects/o_dialog_anim_time_scaler/Draw_64.gml @@ -22,7 +22,7 @@ if !ready exit; var sx1 = tb_x + ui(96); draw_set_text(f_p1, fa_right, fa_top, COLORS._main_text_sub); - draw_text(sx1, yy + ui(38), __txtx("anim_scale_scale_factor", "Scaling factor: ") + string(scale_to / ANIMATOR.frames_total)); + draw_text(sx1, yy + ui(38), __txtx("anim_scale_scale_factor", "Scaling factor: ") + string(scale_to / PROJECT.animator.frames_total)); var bx = sx1 + ui(16); var by = yy; diff --git a/objects/o_dialog_animation/Create_0.gml b/objects/o_dialog_animation/Create_0.gml index 165e77644..9183c6ad9 100644 --- a/objects/o_dialog_animation/Create_0.gml +++ b/objects/o_dialog_animation/Create_0.gml @@ -12,14 +12,14 @@ event_inherited(); #region data tb_length = new textBox(TEXTBOX_INPUT.number, function(str) { - ANIMATOR.frames_total = real(str); + PROJECT.animator.frames_total = real(str); }) tb_framerate = new textBox(TEXTBOX_INPUT.number, function(str) { - ANIMATOR.framerate = real(str); + PROJECT.animator.framerate = real(str); }) eb_playback = buttonGroup([__txt("Loop"), __txt("Stop")], function(b) { - ANIMATOR.playback = b; + PROJECT.animator.playback = b; }); #endregion \ No newline at end of file diff --git a/objects/o_dialog_animation/Draw_64.gml b/objects/o_dialog_animation/Draw_64.gml index b4f6d89c1..214d28744 100644 --- a/objects/o_dialog_animation/Draw_64.gml +++ b/objects/o_dialog_animation/Draw_64.gml @@ -17,19 +17,19 @@ if !ready exit; tb_length.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_length", "Animation length")); - tb_length.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, ANIMATOR.frames_total, mouse_ui); + tb_length.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, PROJECT.animator.frames_total, mouse_ui); yy += ui(44); tb_framerate.setFocusHover(sFOCUS, sHOVER); tb_framerate.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_frame_rate", "Preview frame rate")); - tb_framerate.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, ANIMATOR.framerate, mouse_ui); + tb_framerate.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, PROJECT.animator.framerate, mouse_ui); yy += ui(44); eb_playback.setFocusHover(sFOCUS, sHOVER); eb_playback.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_on_end", "On end")); - eb_playback.draw(dialog_x + dialog_w - ui(152), yy, ui(128), TEXTBOX_HEIGHT, ANIMATOR.playback, mouse_ui); + eb_playback.draw(dialog_x + dialog_w - ui(152), yy, ui(128), TEXTBOX_HEIGHT, PROJECT.animator.playback, mouse_ui); #endregion \ No newline at end of file diff --git a/objects/o_dialog_exit/Create_0.gml b/objects/o_dialog_exit/Create_0.gml index 38baa8716..2d0662212 100644 --- a/objects/o_dialog_exit/Create_0.gml +++ b/objects/o_dialog_exit/Create_0.gml @@ -2,6 +2,7 @@ event_inherited(); #region data - dialog_w = ui(400); + project = PROJECT; + dialog_w = ui(440); dialog_h = ui(140); #endregion \ No newline at end of file diff --git a/objects/o_dialog_exit/Draw_64.gml b/objects/o_dialog_exit/Draw_64.gml index 67892e379..8f97b6361 100644 --- a/objects/o_dialog_exit/Draw_64.gml +++ b/objects/o_dialog_exit/Draw_64.gml @@ -1,10 +1,20 @@ /// @description init if !ready exit; -draw_set_color(c_black); -draw_set_alpha(0.5); -draw_rectangle(0, 0, WIN_W, WIN_H, false); -draw_set_alpha(1); +#region dim BG + var lowest = true; + with(o_dialog_exit) { + if(id == other.id) continue; + if(depth > other.depth) lowest = false; + } + + if(lowest) { + 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); @@ -13,13 +23,15 @@ draw_set_alpha(1); #endregion #region text - var py = dialog_y + ui(16); + var py = dialog_y + ui(16); + var txt = $"Project modified"; draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); - draw_text(dialog_x + ui(24), py, __txtx("dialog_exit_title", "Project modified")); + draw_text(dialog_x + ui(24), py, txt); py += line_get_height(, 4); draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); - draw_text(dialog_x + ui(24), py, __txtx("dialog_exit_content", "Save progress before exit?")); + var txt = $"Save project '{filename_name(project.path)}' before exit?"; + draw_text(dialog_x + ui(24), py, txt); var bw = ui(96), bh = TEXTBOX_HEIGHT; var bx1 = dialog_x + dialog_w - ui(16); @@ -38,14 +50,19 @@ draw_set_alpha(1); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("dont_save", "Don't save")); if(b == 2) { PREF_SAVE(); - game_end(); + + if(instance_number(o_dialog_exit) == 1) + game_end(); + 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, __txt("Save")); - if(b == 2 && SAVE()) { + if(b == 2 && SAVE(project)) { PREF_SAVE(); - game_end(); + if(instance_number(o_dialog_exit) == 1) + game_end(); + instance_destroy(); } #endregion \ No newline at end of file diff --git a/objects/o_dialog_load/Create_0.gml b/objects/o_dialog_save/Create_0.gml similarity index 60% rename from objects/o_dialog_load/Create_0.gml rename to objects/o_dialog_save/Create_0.gml index 4dd7ea350..faf55e50e 100644 --- a/objects/o_dialog_load/Create_0.gml +++ b/objects/o_dialog_save/Create_0.gml @@ -2,10 +2,7 @@ event_inherited(); #region data - newFile = false; - path = ""; - readonly = false; - safe_mode = false; + project = noone; dialog_w = ui(400); dialog_h = ui(140); diff --git a/objects/o_dialog_load/Draw_64.gml b/objects/o_dialog_save/Draw_64.gml similarity index 89% rename from objects/o_dialog_load/Draw_64.gml rename to objects/o_dialog_save/Draw_64.gml index 33778049a..aa7e51c6e 100644 --- a/objects/o_dialog_load/Draw_64.gml +++ b/objects/o_dialog_save/Draw_64.gml @@ -19,7 +19,7 @@ draw_set_alpha(1); py += line_get_height(, 4); draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); - draw_text(dialog_x + ui(24), py, __txtx("dialog_exit_content", "Save progress before exit?")); + draw_text(dialog_x + ui(24), py, __txtx("dialog_exit_content", "Save progress before close?")); var bw = ui(96), bh = TEXTBOX_HEIGHT; var bx1 = dialog_x + dialog_w - ui(16); @@ -37,8 +37,7 @@ draw_set_alpha(1); var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("dont_save", "Don't save")); if(b == 2) { - if(newFile) __NEW(); - else __LOAD_PATH(path, readonly, safe_mode); + closeProject(project); instance_destroy(); } @@ -46,10 +45,8 @@ draw_set_alpha(1); var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Save")); if(b == 2) { - SAVE(); - - if(newFile) __NEW(); - else __LOAD_PATH(path, readonly, safe_mode); + SAVE(project); + closeProject(project); instance_destroy(); } #endregion \ No newline at end of file diff --git a/objects/o_dialog_load/o_dialog_load.yy b/objects/o_dialog_save/o_dialog_save.yy similarity index 97% rename from objects/o_dialog_load/o_dialog_load.yy rename to objects/o_dialog_save/o_dialog_save.yy index f19aa4d4b..88369d3ba 100644 --- a/objects/o_dialog_load/o_dialog_load.yy +++ b/objects/o_dialog_save/o_dialog_save.yy @@ -1,7 +1,7 @@ { "resourceType": "GMObject", "resourceVersion": "1.0", - "name": "o_dialog_load", + "name": "o_dialog_save", "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,}, diff --git a/objects/o_dialog_tunnels/Create_0.gml b/objects/o_dialog_tunnels/Create_0.gml index d8ac98d0e..6cc32bfe4 100644 --- a/objects/o_dialog_tunnels/Create_0.gml +++ b/objects/o_dialog_tunnels/Create_0.gml @@ -14,12 +14,12 @@ event_inherited(); tunnel_select = noone; tunnel_hover = noone; - var amo = ds_map_size(NODE_MAP); - var k = ds_map_find_first(NODE_MAP); + var amo = ds_map_size(PROJECT.nodeMap); + var k = ds_map_find_first(PROJECT.nodeMap); repeat(amo) { - var node = NODE_MAP[? k]; - k = ds_map_find_next(NODE_MAP, k); + var node = PROJECT.nodeMap[? k]; + k = ds_map_find_next(PROJECT.nodeMap, k); if(instanceof(node) == "Node_Tunnel_In") array_push(tunnel_ins, node); @@ -112,10 +112,10 @@ event_inherited(); k = ds_map_find_next(TUNNELS_OUT, k); var out = TUNNELS_OUT[? _k]; - if(out != key || !ds_map_exists(NODE_MAP, _k)) + if(out != key || !ds_map_exists(PROJECT.nodeMap, _k)) continue; - var _node = NODE_MAP[? _k]; + var _node = PROJECT.nodeMap[? _k]; draw_sprite_ui(THEME.tunnel, 0, ui(32), _y + ui(10), 0.75, 0.75, 0, COLORS._main_icon); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub); diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 76ff1c268..70a652399 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -60,6 +60,7 @@ if(!DEMO) { addHotkey("", "Save", "S", MOD_KEY.ctrl, SAVE ); addHotkey("", "Save as", "S", MOD_KEY.ctrl | MOD_KEY.shift, SAVE_AS ); + addHotkey("", "Save all", "S", MOD_KEY.ctrl | MOD_KEY.alt, SAVE_ALL ); addHotkey("", "Open", "O", MOD_KEY.ctrl, function() { LOAD(); }); } @@ -80,6 +81,9 @@ UPDATE |= RENDER_TYPE.full; }); + addHotkey("", "Close file", "Q", MOD_KEY.ctrl, function() { PANEL_GRAPH.close(); }); + addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close); + globalvar HOTKEY_MOD, HOTKEY_BLOCK; HOTKEY_MOD = 0; HOTKEY_BLOCK = false; diff --git a/objects/o_main/Other_4.gml b/objects/o_main/Other_4.gml index 0b28e21b0..fd6da9dbc 100644 --- a/objects/o_main/Other_4.gml +++ b/objects/o_main/Other_4.gml @@ -1,5 +1,5 @@ /// @description init -MODIFIED = false; +PROJECT.modified = false; PREF_LOAD(); #region reset data diff --git a/objects/o_main/Step_0.gml b/objects/o_main/Step_0.gml index c867b719c..3d86a3c66 100644 --- a/objects/o_main/Step_0.gml +++ b/objects/o_main/Step_0.gml @@ -3,30 +3,30 @@ if(OS == os_windows && gameframe_is_minimized()) exit; //print("===== Step start ====="); #region animation - if(ANIMATOR.is_playing && ANIMATOR.play_freeze == 0) { - ANIMATOR.time_since_last_frame += ANIMATOR.framerate * (delta_time / 1000000); + if(PROJECT.animator.is_playing && PROJECT.animator.play_freeze == 0) { + PROJECT.animator.time_since_last_frame += PROJECT.animator.framerate * (delta_time / 1000000); - if(ANIMATOR.time_since_last_frame >= 1) - ANIMATOR.setFrame(ANIMATOR.real_frame + 1); + if(PROJECT.animator.time_since_last_frame >= 1) + PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); } else { - ANIMATOR.frame_progress = false; - ANIMATOR.setFrame(ANIMATOR.real_frame); - ANIMATOR.time_since_last_frame = 0; + PROJECT.animator.frame_progress = false; + PROJECT.animator.setFrame(PROJECT.animator.real_frame); + PROJECT.animator.time_since_last_frame = 0; } - ANIMATOR.play_freeze = max(0, ANIMATOR.play_freeze - 1); + PROJECT.animator.play_freeze = max(0, PROJECT.animator.play_freeze - 1); #endregion #region step - GLOBAL_NODE.step(); + PROJECT.globalNode.step(); try { if(PANEL_MAIN != 0) PANEL_MAIN.step(); - for(var i = 0; i < ds_list_size(NODES); i++) { - NODES[| i].triggerCheck(); - NODES[| i].step(); + for(var i = 0; i < ds_list_size(PROJECT.nodes); i++) { + PROJECT.nodes[| i].triggerCheck(); + PROJECT.nodes[| i].step(); } } catch(e) { noti_warning("Step error: " + exception_print(e)); @@ -110,13 +110,13 @@ if(OS == os_windows && gameframe_is_minimized()) exit; #endregion #region window - if(_modified != MODIFIED) { - _modified = MODIFIED; + if(_modified != PROJECT.modified) { + _modified = PROJECT.modified; var cap = ""; if(SAFE_MODE) cap += "[SAFE MODE] "; - if(READONLY) cap += "[READ ONLY] "; - cap += CURRENT_PATH + (MODIFIED? "*" : "") + " - Pixel Composer"; + if(PROJECT.readonly) cap += "[READ ONLY] "; + cap += PROJECT.path + (PROJECT.modified? "*" : "") + " - Pixel Composer"; window_set_caption(cap); } diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index a67907d8b..c1fce18e6 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -51,13 +51,13 @@ _HOVERING_ELEMENT = noone; #region auto save AUTO_SAVE_TIMER += delta_time / 1_000_000; - if(MODIFIED && PREF_MAP[? "auto_save_time"] > 0 && AUTO_SAVE_TIMER > PREF_MAP[? "auto_save_time"]) { + if(PROJECT.modified && PREF_MAP[? "auto_save_time"] > 0 && AUTO_SAVE_TIMER > PREF_MAP[? "auto_save_time"]) { AUTO_SAVE_TIMER = 0; var loc = DIRECTORY + "Autosave/"; if(!directory_exists(loc)) directory_create(loc); - var fname = string_replace(filename_name(CURRENT_PATH), filename_ext(CURRENT_PATH), "") + + var fname = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), "") + "_autosave" + string(current_year) + "-" + string_lead_zero(current_month, 2) + "-" + string_lead_zero(current_day, 2) + "T" + @@ -65,7 +65,7 @@ _HOVERING_ELEMENT = noone; string_lead_zero(current_minute, 2) + string_lead_zero(current_second, 2) + ".pxc"; - try { SAVE_AT(loc + fname, "Autosaved "); } + try { SAVE_AT(PROJECT, loc + fname, "Autosaved "); } catch(e) { print(exception_print(e)); } } #endregion @@ -74,20 +74,20 @@ _HOVERING_ELEMENT = noone; //physics_pause_enable(true); DEF_SURFACE_RESET(); - var _k = ds_map_find_first(NODE_MAP); - var _a = ds_map_size(NODE_MAP); + var _k = ds_map_find_first(PROJECT.nodeMap); + var _a = ds_map_size(PROJECT.nodeMap); repeat(_a) { - NODE_MAP[? _k].stepBegin(); - _k = ds_map_find_next(NODE_MAP, _k); + PROJECT.nodeMap[? _k].stepBegin(); + _k = ds_map_find_next(PROJECT.nodeMap, _k); } - if(ANIMATOR.is_playing || ANIMATOR.rendering) { - if(ANIMATOR.frame_progress) { + if(PROJECT.animator.is_playing || PROJECT.animator.rendering) { + if(PROJECT.animator.frame_progress) { __addon_preAnim(); Render(); __addon_postAnim(); } - ANIMATOR.frame_progress = false; + PROJECT.animator.frame_progress = false; } else { if(UPDATE & RENDER_TYPE.full) Render(); diff --git a/scripts/GmlLua/GmlLua.gml b/scripts/GmlLua/GmlLua.gml index a5ff554b7..a478a51ed 100644 --- a/scripts/GmlLua/GmlLua.gml +++ b/scripts/GmlLua/GmlLua.gml @@ -313,9 +313,9 @@ Project.fps = 0; function lua_projectData(state) { lua_add_code(state, @" -Project.frame = " + string(ANIMATOR.current_frame) + @"; -Project.frameTotal = " + string(ANIMATOR.frames_total) + @"; -Project.fps = " + string(ANIMATOR.framerate) + @"; +Project.frame = " + string(PROJECT.animator.current_frame) + @"; +Project.frameTotal = " + string(PROJECT.animator.frames_total) + @"; +Project.fps = " + string(PROJECT.animator.framerate) + @"; "); } diff --git a/scripts/__node/__node.gml b/scripts/__node/__node.gml index 5094c9b22..0e1478029 100644 --- a/scripts/__node/__node.gml +++ b/scripts/__node/__node.gml @@ -11,7 +11,7 @@ function __Node_Base(x, y) constructor { anim_priority = -999; static step = function() {} - static update = function(frame = ANIMATOR.current_frame) {} + static update = function(frame = PROJECT.animator.current_frame) {} static valueUpdate = function(index) {} static triggerRender = function() {} diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml index 99cee4186..e329a14bc 100644 --- a/scripts/__node_iterator/__node_iterator.gml +++ b/scripts/__node_iterator/__node_iterator.gml @@ -27,7 +27,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) static doInitLoop = function() {} - static update = function(frame = ANIMATOR.current_frame) { initLoop(); } + static update = function(frame = PROJECT.animator.current_frame) { initLoop(); } static outputNextNode = function() { LOG_BLOCK_START(); diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index 084634c6f..cdcc1b545 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -128,7 +128,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co for(var i = 0; i < attributes.part_amount; i++) parts[i] = new __part(self); - static spawn = function(_time = ANIMATOR.current_frame, _pos = -1) { + static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { var _inSurf = current_data[0]; if(_inSurf == 0) { @@ -295,7 +295,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co var _loop = inputs[| 21].getValue(); if(!_loop) return; - for(var i = 0; i < ANIMATOR.frames_total; i++) { + for(var i = 0; i < PROJECT.animator.frames_total; i++) { runVFX(i, false); updateParticleForward(); } @@ -315,7 +315,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co } } - static runVFX = function(_time = ANIMATOR.current_frame, _render = true) { + static runVFX = function(_time = PROJECT.animator.current_frame, _render = true) { var _spawn_delay = inputs[| 1].getValue(_time); var _spawn_type = inputs[| 16].getValue(_time); var _spawn_active = inputs[| 27].getValue(_time); @@ -357,7 +357,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co static onDrawOverlay = -1; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _inSurf = inputs[| 0].getValue(); var _dist = inputs[| 4].getValue(); var _scatt = inputs[| 24].getValue(); diff --git a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml index 179db4b4f..4f31df637 100644 --- a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml +++ b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml @@ -2,7 +2,7 @@ function Node_Fluid(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { color = COLORS.node_blend_fluid; icon = THEME.fluid_sim; - static updateForward = function(frame = ANIMATOR.current_frame, _update = true) { + static updateForward = function(frame = PROJECT.animator.current_frame, _update = true) { if(_update) update(frame); print("Update " + string(frame) + ": " + name); diff --git a/scripts/_node_strand_affector/_node_strand_affector.gml b/scripts/_node_strand_affector/_node_strand_affector.gml index 0f57cdfe1..1721d43af 100644 --- a/scripts/_node_strand_affector/_node_strand_affector.gml +++ b/scripts/_node_strand_affector/_node_strand_affector.gml @@ -147,7 +147,7 @@ function _Node_Strand_Affector(_x, _y, _group = noone) : Node(_x, _y, _group) co active &= inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _typ = inputs[| 1].getValue(); inputs[| 4].setVisible(_typ == 1); diff --git a/scripts/addon_lua/addon_lua.gml b/scripts/addon_lua/addon_lua.gml index 9acca192c..5c40a58b0 100644 --- a/scripts/addon_lua/addon_lua.gml +++ b/scripts/addon_lua/addon_lua.gml @@ -785,12 +785,12 @@ [ "noti_warning", noti_warning ], //animation - [ "animation_playing", function() { return ANIMATOR.is_playing? lua_true : lua_false; }], - [ "animation_play", function() { ANIMATOR.resume(); }], - [ "animation_pause", function() { ANIMATOR.pause(); }], - [ "animation_stop", function() { ANIMATOR.stop(); }], - [ "animation_set_frame", function(frame) { ANIMATOR.setFrame(frame); }], - [ "animation_render", function() { ANIMATOR.render(); }], + [ "animation_playing", function() { return PROJECT.animator.is_playing? lua_true : lua_false; }], + [ "animation_play", function() { PROJECT.animator.resume(); }], + [ "animation_pause", function() { PROJECT.animator.pause(); }], + [ "animation_stop", function() { PROJECT.animator.stop(); }], + [ "animation_set_frame", function(frame) { PROJECT.animator.setFrame(frame); }], + [ "animation_render", function() { PROJECT.animator.render(); }], //panel [ "set_tooltip", function(txt) { TOOLTIP = txt; }], @@ -817,29 +817,29 @@ //nodes [ "node_get", function(nodeId) { - if(!ds_map_exists(NODE_NAME_MAP, nodeId)) return 0; - return NODE_NAME_MAP[? nodeId]; + if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return 0; + return PROJECT.nodeNameMap[? nodeId]; }], [ "node_get_input_value", function(nodeId, input) { - if(!ds_map_exists(NODE_NAME_MAP, nodeId)) return 0; - var node = NODE_NAME_MAP[? nodeId]; + if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return 0; + var node = PROJECT.nodeNameMap[? nodeId]; if(!ds_map_exists(node.inputMap, input)) return 0; return node.inputMap[? input].getValue(); }], [ "node_set_input_value", function(nodeId, input, value) { - if(!ds_map_exists(NODE_NAME_MAP, nodeId)) return 0; - var node = NODE_NAME_MAP[? nodeId]; + if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return 0; + var node = PROJECT.nodeNameMap[? nodeId]; if(!ds_map_exists(node.inputMap, input)) return 0; return node.inputMap[? input].setValue(value); }], [ "node_get_output_value", function(nodeId, input) { - if(!ds_map_exists(NODE_NAME_MAP, nodeId)) return 0; - var node = NODE_NAME_MAP[? nodeId]; + if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return 0; + var node = PROJECT.nodeNameMap[? nodeId]; if(!ds_map_exists(node.outputMap, input)) return 0; return node.outputMap[? input].getValue(); diff --git a/scripts/addon_lua_constant/addon_lua_constant.gml b/scripts/addon_lua_constant/addon_lua_constant.gml index dbe40ffbf..271afac2a 100644 --- a/scripts/addon_lua_constant/addon_lua_constant.gml +++ b/scripts/addon_lua_constant/addon_lua_constant.gml @@ -155,8 +155,8 @@ function __addon_lua_panel_variable(lua, panel) { ); lua_add_code(lua, - "Animator.frame_current = " + string(ANIMATOR.current_frame) + "\n" + - "Animator.frame_total = " + string(ANIMATOR.frames_total) + "\n" + - "Animator.frame_rate = " + string(ANIMATOR.framerate) + "\n" + "Animator.frame_current = " + string(PROJECT.animator.current_frame) + "\n" + + "Animator.frame_total = " + string(PROJECT.animator.frames_total) + "\n" + + "Animator.frame_rate = " + string(PROJECT.animator.framerate) + "\n" ); } diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index 59e4eb1cf..59164e928 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -1,5 +1,10 @@ #region global global.FLAG.keyframe_override = true; + + enum ANIMATOR_END { + loop, + stop + } #endregion #region animation class @@ -45,13 +50,13 @@ } static resetAnimation = function() { - var _key = ds_map_find_first(NODE_MAP); - var amo = ds_map_size(NODE_MAP); + var _key = ds_map_find_first(PROJECT.nodeMap); + var amo = ds_map_size(PROJECT.nodeMap); repeat(amo) { - var _node = NODE_MAP[? _key]; + var _node = PROJECT.nodeMap[? _key]; _node.resetAnimation(); - _key = ds_map_find_next(NODE_MAP, _key); + _key = ds_map_find_next(PROJECT.nodeMap, _key); } } @@ -63,23 +68,23 @@ } static toggle = function() { - ANIMATOR.is_playing = !ANIMATOR.is_playing; - ANIMATOR.frame_progress = true; + is_playing = !is_playing; + frame_progress = true; } static pause = function() { - ANIMATOR.is_playing = false; - ANIMATOR.frame_progress = true; + is_playing = false; + frame_progress = true; } static play = function() { - ANIMATOR.is_playing = true; - ANIMATOR.frame_progress = true; + is_playing = true; + frame_progress = true; } static resume = function() { - ANIMATOR.is_playing = true; - ANIMATOR.frame_progress = true; + is_playing = true; + frame_progress = true; } static stop = function() { @@ -87,14 +92,4 @@ setFrame(0); } } -#endregion - -#region object - enum ANIMATOR_END { - loop, - stop - } - - globalvar ANIMATOR; - ANIMATOR = new AnimationManager(); #endregion \ No newline at end of file diff --git a/scripts/append_function/append_function.gml b/scripts/append_function/append_function.gml index dc1cb36c3..d9f4f0490 100644 --- a/scripts/append_function/append_function.gml +++ b/scripts/append_function/append_function.gml @@ -21,9 +21,9 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { if(struct_has(_map, "version")) { var _v = _map.version; - LOADING_VERSION = _v; - if(_v != SAVEFILE_VERSION) { - var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); + PROJECT.version = _v; + if(_v != SAVE_VERSION) { + var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVE_VERSION); log_warning("FILE", warn) } } diff --git a/scripts/ase_object/ase_object.gml b/scripts/ase_object/ase_object.gml index df95dcf7c..a4e4c3389 100644 --- a/scripts/ase_object/ase_object.gml +++ b/scripts/ase_object/ase_object.gml @@ -69,7 +69,7 @@ function ase_layer(name) constructor { cels[index] = cel; } - static getCel = function(index = ANIMATOR.current_frame) { + static getCel = function(index = PROJECT.animator.current_frame) { var ind; if(tag != noone) { diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index d353c489f..e4c3e5bcd 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -74,7 +74,7 @@ function exception_print(e) { function setException() { exception_unhandled_handler(function(ex) { var path = string(DIRECTORY) + "prev_crash.pxc"; - if(!SAVING && !TESTING) SAVE_AT(path); + if(!SAVING && !TESTING) SAVE_AT(PROJECT, path); var tt = "\n-------------------------- OH NO --------------------------\n\n"; tt += "\n" + ex.longMessage; diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index c1d33d969..2e90d0a02 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -1,25 +1,47 @@ #region save - globalvar LOADING, LOADING_VERSION, APPENDING, CLONING, SAFE_MODE; - globalvar LOAD_ADDON; - globalvar MODIFIED, CURRENT_PATH, READONLY, CONNECTION_CONFLICT, GLOBAL_SEED, ALWAYS_FULL; + globalvar LOADING, APPENDING, CLONING, SAFE_MODE; + globalvar CONNECTION_CONFLICT, ALWAYS_FULL; - LOADING = false; - LOAD_ADDON = {}; - CLONING = false; - LOADING_VERSION = 0; - APPENDING = false; - READONLY = false; - SAFE_MODE = false; + LOADING = false; + CLONING = false; + APPENDING = false; + SAFE_MODE = false; - CURRENT_PATH = ""; - MODIFIED = false; CONNECTION_CONFLICT = ds_queue_create(); randomize(); - GLOBAL_SEED = irandom(9999999999); ALWAYS_FULL = false; #endregion +#region project + function Project() constructor { + path = ""; + version = 1440; + seed = irandom_range(100000, 999999); + + modified = false; + readonly = false; + + nodes = ds_list_create(); + nodeMap = ds_map_create(); + nodeNameMap = ds_map_create(); + + animator = new AnimationManager(); + + globalNode = new Node_Global(); + + addons = {}; + } + + globalvar PROJECTS, PROJECT; + + gml_pragma("global", "__init()"); + function __init() { + PROJECTS = []; + PROJECT = new Project(); + } +#endregion + #region main globalvar OS, DEBUG, THEME, COLOR_KEYS; OS = os_type; @@ -29,22 +51,17 @@ THEME = new Theme(); COLOR_KEYS = []; - globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING, BUILD_NUMBER; + globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 1146; - SAVEFILE_VERSION = 1440; - VERSION_STRING = "1.14.6"; - BUILD_NUMBER = 114600; + VERSION = 1146; + SAVE_VERSION = 1440; + VERSION_STRING = "1.14.6n1"; + BUILD_NUMBER = 114600; - globalvar NODES, NODE_MAP, APPEND_MAP, NODE_NAME_MAP; - globalvar HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES; - - NODES = ds_list_create(); - NODE_INSTANCES = ds_list_create(); - NODE_MAP = ds_map_create(); - NODE_NAME_MAP = ds_map_create(); + globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); + globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); HOTKEY_CONTEXT = ds_list_create(); HOTKEY_CONTEXT[| 0] = ""; @@ -56,9 +73,8 @@ #region inputs globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT; globalvar DOUBLE_CLICK; - globalvar CURRENT_PATH, DIALOG_CLICK; + globalvar DIALOG_CLICK; - CURRENT_PATH = ""; DOUBLE_CLICK = false; FOCUS = noone; FOCUS_STR = ""; @@ -131,7 +147,7 @@ #macro printlog if(log) show_debug_message - #macro RETURN_ON_REST if(!ANIMATOR.is_playing || !ANIMATOR.frame_progress) return; + #macro RETURN_ON_REST if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; #macro PANEL_PAD THEME_VALUE.panel_padding diff --git a/scripts/globalvar_drawer/globalvar_drawer.gml b/scripts/globalvar_drawer/globalvar_drawer.gml index 4aa074898..0be93827b 100644 --- a/scripts/globalvar_drawer/globalvar_drawer.gml +++ b/scripts/globalvar_drawer/globalvar_drawer.gml @@ -9,7 +9,7 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry if(var_editing) { var del = noone; - if(ds_list_size(GLOBAL_NODE.inputs)) { + if(ds_list_size(PROJECT.globalNode.inputs)) { yy += ui(8); hh += ui(8); } @@ -17,8 +17,8 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry var wd_x = xx; var wd_w = ww; - for( var j = 0; j < ds_list_size(GLOBAL_NODE.inputs); j++ ) { - var _inpu = GLOBAL_NODE.inputs[| j]; + for( var j = 0; j < ds_list_size(PROJECT.globalNode.inputs); j++ ) { + var _inpu = PROJECT.globalNode.inputs[| j]; var _edit = _inpu.editor; var wd_h = ui(32); @@ -53,15 +53,15 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry } if(del != noone) - ds_list_delete(GLOBAL_NODE.inputs, del); + ds_list_delete(PROJECT.globalNode.inputs, del); } else { - for( var j = 0; j < ds_list_size(GLOBAL_NODE.inputs); j++ ) { - var widg = drawWidget(xx, yy, ww, _m, GLOBAL_NODE.inputs[| j], true, focus, hover, _scrollPane, rx, ry); + for( var j = 0; j < ds_list_size(PROJECT.globalNode.inputs); j++ ) { + var widg = drawWidget(xx, yy, ww, _m, PROJECT.globalNode.inputs[| j], true, focus, hover, _scrollPane, rx, ry); var widH = widg[0]; var mbRight = widg[1]; if(hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + widH)) - _HOVERING_ELEMENT = GLOBAL_NODE.inputs[| j]; + _HOVERING_ELEMENT = PROJECT.globalNode.inputs[| j]; yy += lb_h + widH + padd; hh += lb_h + widH + padd; diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index da7e23c63..0269ce0c3 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -1,17 +1,13 @@ -function LOAD() { +function LOAD() { if(DEMO) return false; - var path = get_open_filename("Pixel Composer project (.pxc)|*.pxc", ""); + var path = get_open_filename("Pixel Composer PROJECT (.pxc)|*.pxc", ""); key_release(); if(path == "") return; if(filename_ext(path) != ".json" && filename_ext(path) != ".pxc") return; gc_collect(); LOAD_PATH(path); - - ds_list_clear(STATUSES); - ds_list_clear(WARNING); - ds_list_clear(ERRORS); } function TEST_PATH(path) { @@ -21,16 +17,25 @@ function TEST_PATH(path) { } function LOAD_PATH(path, readonly = false, safe_mode = false) { - if(MODIFIED && !READONLY) { - var dia = dialogCall(o_dialog_load); - dia.path = path; - dia.readonly = readonly; - dia.safe_mode = safe_mode; - } else - __LOAD_PATH(path, readonly, safe_mode); + var _PROJECT = PROJECT; + PROJECT = new Project(); + if(PANEL_GRAPH.project.path == "" && !PANEL_GRAPH.project.modified) { + PANEL_GRAPH.setProject(PROJECT); + } else { + var graph = new Panel_Graph(PROJECT); + PANEL_GRAPH.panel.setContent(graph, true); + PANEL_GRAPH = graph; + } + + var res = __LOAD_PATH(path, readonly, safe_mode); + if(!res) return; + + array_push(PROJECTS, PROJECT); + PANEL_ANIMATION.updatePropertyList(); + setFocus(PANEL_GRAPH.panel); } -function __LOAD_PATH(path, readonly = false, safe_mode = false) { +function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false) { SAFE_MODE = safe_mode; if(DEMO) return false; @@ -41,43 +46,47 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { } if(filename_ext(path) != ".json" && filename_ext(path) != ".pxc") { - log_warning("LOAD", "File not a valid project"); + log_warning("LOAD", "File not a valid PROJECT"); return false; } LOADING = true; - - nodeCleanUp(); - clearPanel(); - setPanel(); - if(!TESTING) - instance_destroy(_p_dialog); - ds_list_clear(ERRORS); - var temp_path = DIRECTORY + "_temp"; - if(file_exists(temp_path)) file_delete(temp_path); - file_copy(path, temp_path); + if(override) { + nodeCleanUp(); + clearPanel(); + setPanel(); + if(!TESTING) + instance_destroy(_p_dialog); + ds_list_clear(ERRORS); + } - ALWAYS_FULL = false; - READONLY = readonly; - SET_PATH(path); + var temp_path = DIRECTORY + "temp"; + if(!directory_exists(temp_path)) + directory_create(temp_path); - var _load_content = json_load_struct(temp_path); + var temp_file_path = temp_path + "/" + string(UUID_generate(6)); + if(file_exists(temp_file_path)) file_delete(temp_file_path); + file_copy(path, temp_file_path); + + //ALWAYS_FULL = false; + PROJECT.readonly = readonly; + SET_PATH(PROJECT, path); + + var _load_content = json_load_struct(temp_file_path); if(struct_has(_load_content, "version")) { var _v = _load_content.version; - LOADING_VERSION = _v; - if(_v != SAVEFILE_VERSION) { - var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVEFILE_VERSION); + PROJECT.version = _v; + if(_v != SAVE_VERSION) { + var warn = $"File version mismatch : loading file verion {_v} to Pixel Composer {SAVE_VERSION}"; log_warning("LOAD", warn); } } else { - var warn = "File version mismatch : loading old format to Pixel Composer " + string(SAVEFILE_VERSION); + var warn = $"File version mismatch : loading old format to Pixel Composer {string(SAVE_VERSION)}"; log_warning("LOAD", warn); } - nodeCleanUp(); - var create_list = ds_list_create(); if(struct_has(_load_content, "nodes")) { try { @@ -93,9 +102,9 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { try { if(struct_has(_load_content, "animator")) { - var _anim_map = _load_content.animator; - ANIMATOR.frames_total = _anim_map.frames_total; - ANIMATOR.framerate = _anim_map.framerate; + var _anim_map = _load_content.animator; + PROJECT.animator.frames_total = _anim_map.frames_total; + PROJECT.animator.framerate = _anim_map.framerate; } } catch(e) { log_warning("LOAD, animator", exception_print(e)); @@ -108,12 +117,12 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { log_warning("LOAD, metadata", exception_print(e)); } - GLOBAL_NODE = new Node_Global(); + PROJECT.globalNode = new Node_Global(); try { if(struct_has(_load_content, "global")) - GLOBAL_NODE.deserialize(_load_content.global); + PROJECT.globalNode.deserialize(_load_content.global); else if(struct_has(_load_content, "global_node")) - GLOBAL_NODE.deserialize(_load_content.global_node); + PROJECT.globalNode.deserialize(_load_content.global_node); } catch(e) { log_warning("LOAD, global", exception_print(e)); } @@ -121,10 +130,10 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { try { if(struct_has(_load_content, "addon")) { var _addon = _load_content.addon; - LOAD_ADDON = _addon; + PROJECT.addons = _addon; struct_foreach(_addon, function(_name, _value) { addonLoad(_name, false); }); } else - LOAD_ADDON = {}; + PROJECT.addons = {}; } catch(e) { log_warning("LOAD, addon", exception_print(e)); } @@ -199,9 +208,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { Render(); LOADING = false; - MODIFIED = false; - - PANEL_ANIMATION.updatePropertyList(); + PROJECT.modified = false; log_message("FILE", "load " + path, THEME.noti_icon_file_load); PANEL_MENU.setNotiIcon(THEME.noti_icon_file_load); diff --git a/scripts/load_function/load_function.yy b/scripts/load_function/load_function.yy index 403ad0fc0..97fe3c4bd 100644 --- a/scripts/load_function/load_function.yy +++ b/scripts/load_function/load_function.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "files", - "path": "folders/functions/files.yy", + "name": "project", + "path": "folders/functions/project.yy", }, } \ No newline at end of file diff --git a/scripts/meta_data/meta_data.gml b/scripts/meta_data/meta_data.gml index 452e37b02..6c326ac52 100644 --- a/scripts/meta_data/meta_data.gml +++ b/scripts/meta_data/meta_data.gml @@ -87,7 +87,7 @@ function MetaDataManager() constructor { } var _aut = __txt("By") + " " + author; - var _ver = version < SAVEFILE_VERSION? __txtx("meta_old_version", "Created on an older version") : __txtx("meta_new_version", "Created on a newer version"); + var _ver = version < SAVE_VERSION? __txtx("meta_old_version", "Created on an older version") : __txtx("meta_new_version", "Created on a newer version"); draw_set_font(f_h5); _h += string_height_ext(name, -1, ww) - ui(4); @@ -116,7 +116,7 @@ function MetaDataManager() constructor { _w = max(_w, string_width_ext(alias, -1, ww)); } - if(version != SAVEFILE_VERSION) { + if(version != SAVE_VERSION) { draw_set_font(f_p2); _h += ui(8); _h += string_height_ext(_ver, -1, ww); @@ -177,7 +177,7 @@ function MetaDataManager() constructor { ty += string_height_ext(alias, -1, _w); } - if(version != SAVEFILE_VERSION) { + if(version != SAVE_VERSION) { ty += ui(8); draw_set_text(f_p2, fa_left, fa_top, COLORS._main_accent); draw_text_line(mx + ui(8), ty, _ver, -1, _w); diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 8313255a8..ae51a68f4 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -99,8 +99,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 2) == 2) { for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time > ANIMATOR.current_frame) { - ANIMATOR.setFrame(_key.time); + if(_key.time > PROJECT.animator.current_frame) { + PROJECT.animator.setFrame(_key.time); break; } } @@ -110,7 +110,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var cc = COLORS.panel_animation_keyframe_unselected; var kfFocus = false; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { - if(jun.animator.values[| j].time == ANIMATOR.current_frame) { + if(jun.animator.values[| j].time == PROJECT.animator.current_frame) { cc = COLORS.panel_animation_keyframe_selected; kfFocus = true; break; @@ -122,18 +122,18 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var _add = false; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time == ANIMATOR.current_frame) { + if(_key.time == PROJECT.animator.current_frame) { if(ds_list_size(jun.animator.values) > 1) ds_list_delete(jun.animator.values, j); _add = true; break; - } else if(_key.time > ANIMATOR.current_frame) { - ds_list_insert(jun.animator.values, j, new valueKey(ANIMATOR.current_frame, jun.showValue(), jun.animator)); + } else if(_key.time > PROJECT.animator.current_frame) { + ds_list_insert(jun.animator.values, j, new valueKey(PROJECT.animator.current_frame, jun.showValue(), jun.animator)); _add = true; break; } } - if(!_add) ds_list_add(jun.animator.values, new valueKey(ANIMATOR.current_frame, jun.showValue(), jun.animator)); + if(!_add) ds_list_add(jun.animator.values, new valueKey(PROJECT.animator.current_frame, jun.showValue(), jun.animator)); } bx -= ui(26); @@ -141,10 +141,10 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var _t = -1; for(var j = 0; j < ds_list_size(jun.animator.values); j++) { var _key = jun.animator.values[| j]; - if(_key.time < ANIMATOR.current_frame) + if(_key.time < PROJECT.animator.current_frame) _t = _key.time; } - if(_t > -1) ANIMATOR.setFrame(_t); + if(_t > -1) PROJECT.animator.setFrame(_t); } var lhf = lb_h / 2 - 4; diff --git a/scripts/node_3d_combine/node_3d_combine.gml b/scripts/node_3d_combine/node_3d_combine.gml index bf1a231bf..3227303be 100644 --- a/scripts/node_3d_combine/node_3d_combine.gml +++ b/scripts/node_3d_combine/node_3d_combine.gml @@ -147,7 +147,7 @@ function Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) construc _3d_clear_local_transform(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dim = inputs[| 0].getValue(); var _lpos = inputs[| 1].getValue(); var _lrot = inputs[| 2].getValue(); diff --git a/scripts/node_3d_extrude/node_3d_extrude.gml b/scripts/node_3d_extrude/node_3d_extrude.gml index 4afb9a3e8..6907578a1 100644 --- a/scripts/node_3d_extrude/node_3d_extrude.gml +++ b/scripts/node_3d_extrude/node_3d_extrude.gml @@ -310,7 +310,7 @@ function Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _group case 2 : pass = "norm" break; } - if(_upda && ANIMATOR.frame_progress) + if(_upda && PROJECT.animator.frame_progress) generateMesh(); var _transform = new __3d_transform(_pos,, _sca, _lpos, _lrot, _lsca, false, _dimS ); diff --git a/scripts/node_3d_obj/node_3D_obj.gml b/scripts/node_3d_obj/node_3D_obj.gml index 72d5330b3..b1b198bfc 100644 --- a/scripts/node_3d_obj/node_3D_obj.gml +++ b/scripts/node_3d_obj/node_3D_obj.gml @@ -215,7 +215,7 @@ function Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructor _3d_clear_local_transform(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!surface_exists(tex_surface)) reset_tex(); if(do_reset_material) { diff --git a/scripts/node_3d_render/node_3d_render.gml b/scripts/node_3d_render/node_3d_render.gml index 77f8ddc2f..8e621d740 100644 --- a/scripts/node_3d_render/node_3d_render.gml +++ b/scripts/node_3d_render/node_3d_render.gml @@ -170,7 +170,7 @@ // _3d_clear_local_transform(); // } -// static update = function(frame = ANIMATOR.current_frame) { +// static update = function(frame = PROJECT.animator.current_frame) { // if(!surface_exists(tex_surface)) reset_tex(); // if(do_reset_material) { diff --git a/scripts/node_3d_repeat/node_3d_repeat.gml b/scripts/node_3d_repeat/node_3d_repeat.gml index 1311da6f0..7a65d61a5 100644 --- a/scripts/node_3d_repeat/node_3d_repeat.gml +++ b/scripts/node_3d_repeat/node_3d_repeat.gml @@ -162,7 +162,7 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) construct inputs[| 21].setVisible(_proj); } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var _dim = inputs[| 0].getValue(); var _lpos = inputs[| 1].getValue(); var _lrot = inputs[| 2].getValue(); diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index 1f830b9a8..20e3c927a 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -141,7 +141,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr onAffect(part, str); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var val = inputs[| 0].getValue(); outputs[| 0].setValue(val); if(val == -1) return; diff --git a/scripts/node_VFX_override/node_VFX_override.gml b/scripts/node_VFX_override/node_VFX_override.gml index 30c920404..8bf391317 100644 --- a/scripts/node_VFX_override/node_VFX_override.gml +++ b/scripts/node_VFX_override/node_VFX_override.gml @@ -29,7 +29,7 @@ function Node_VFX_Override(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Particles", self, JUNCTION_CONNECT.output, VALUE_TYPE.particle, -1 ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var parts = inputs[| 0].getValue(); if(!is_array(parts)) return; diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index 8b032c9d7..207bbb9c9 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -68,8 +68,8 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0].setValue(_outSurf); } - function update(_time = ANIMATOR.current_frame) { - if(!ANIMATOR.is_playing) { + function update(_time = PROJECT.animator.current_frame) { + if(!PROJECT.animator.is_playing) { recoverCache(); return; } diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index d41f5e227..bbc4fd8dd 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -22,9 +22,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y static onUpdate = function() { RETURN_ON_REST - if(ANIMATOR.current_frame == 0) + if(PROJECT.animator.current_frame == 0) reset(); - runVFX(ANIMATOR.current_frame); + runVFX(PROJECT.animator.current_frame); if(attributes.Output_pool) { outputs[| 0].setValue(parts); diff --git a/scripts/node_VFX_variable/node_VFX_variable.gml b/scripts/node_VFX_variable/node_VFX_variable.gml index 94b28d6e9..418540068 100644 --- a/scripts/node_VFX_variable/node_VFX_variable.gml +++ b/scripts/node_VFX_variable/node_VFX_variable.gml @@ -44,7 +44,7 @@ function Node_VFX_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) constr .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var parts = inputs[| 0].getValue(); if(!is_array(parts)) return; diff --git a/scripts/node_anim_priority/node_anim_priority.gml b/scripts/node_anim_priority/node_anim_priority.gml index 22d583437..29c401431 100644 --- a/scripts/node_anim_priority/node_anim_priority.gml +++ b/scripts/node_anim_priority/node_anim_priority.gml @@ -5,12 +5,12 @@ function rearrange_priority(node, newpri) { var down = prev > newpri; node.anim_priority = newpri; - var amo = ds_map_size(NODE_MAP); - var k = ds_map_find_first(NODE_MAP); + var amo = ds_map_size(PROJECT.nodeMap); + var k = ds_map_find_first(PROJECT.nodeMap); repeat(amo) { - var _node = NODE_MAP[? k]; - k = ds_map_find_next(NODE_MAP, k); + var _node = PROJECT.nodeMap[? k]; + k = ds_map_find_next(PROJECT.nodeMap, k); if(!_node.active) continue; if(_node == node) continue; diff --git a/scripts/node_animation_control/node_animation_control.gml b/scripts/node_animation_control/node_animation_control.gml index 120464cce..24171c346 100644 --- a/scripts/node_animation_control/node_animation_control.gml +++ b/scripts/node_animation_control/node_animation_control.gml @@ -21,25 +21,25 @@ function Node_Animation_Control(_x, _y, _group = noone) : Node(_x, _y, _group) c static step = function() { if(inputs[| 0].getValue()) - ANIMATOR.toggle(); + PROJECT.animator.toggle(); if(inputs[| 1].getValue()) - ANIMATOR.pause(); + PROJECT.animator.pause(); if(inputs[| 2].getValue()) - ANIMATOR.resume(); + PROJECT.animator.resume(); if(inputs[| 3].getValue()) { - ANIMATOR.stop(); - ANIMATOR.play(); + PROJECT.animator.stop(); + PROJECT.animator.play(); } if(inputs[| 4].getValue()) - ANIMATOR.render(); + PROJECT.animator.render(); if(inputs[| 5].getValue()) { var fr = inputs[| 6].getValue(); - ANIMATOR.setFrame(ANIMATOR.current_frame + fr); + PROJECT.animator.setFrame(PROJECT.animator.current_frame + fr); } } @@ -47,7 +47,7 @@ function Node_Animation_Control(_x, _y, _group = noone) : Node(_x, _y, _group) c var bbox = drawGetBbox(xx, yy, _s); var ind = 0; - if(ANIMATOR.is_playing) ind = 1; + if(PROJECT.animator.is_playing) ind = 1; draw_sprite_fit(THEME.sequence_control, ind, bbox.xc, bbox.yc, bbox.w, bbox.h); } diff --git a/scripts/node_armature/node_armature.gml b/scripts/node_armature/node_armature.gml index dab83afcf..80d3259fd 100644 --- a/scripts/node_armature/node_armature.gml +++ b/scripts/node_armature/node_armature.gml @@ -370,7 +370,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { outputs[| 0].setValue(attributes.bones); } diff --git a/scripts/node_armature_pose/node_armature_pose.gml b/scripts/node_armature_pose/node_armature_pose.gml index 9176a581a..5325c607d 100644 --- a/scripts/node_armature_pose/node_armature_pose.gml +++ b/scripts/node_armature_pose/node_armature_pose.gml @@ -237,7 +237,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const if(_boneCount != _b.childCount()) setBone(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _b = inputs[| 0].getValue(); if(_b == noone) return; diff --git a/scripts/node_array/node_array.gml b/scripts/node_array/node_array.gml index f07173866..4b122f672 100644 --- a/scripts/node_array/node_array.gml +++ b/scripts/node_array/node_array.gml @@ -159,7 +159,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { refreshDynamicInput(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _typ = getType(); outputs[| 0].type = _typ; diff --git a/scripts/node_array_add/node_array_add.gml b/scripts/node_array_add/node_array_add.gml index 1e832406f..1738413f4 100644 --- a/scripts/node_array_add/node_array_add.gml +++ b/scripts/node_array_add/node_array_add.gml @@ -52,7 +52,7 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); if(inputs[| 0].value_from == noone) { diff --git a/scripts/node_array_copy/node_array_copy.gml b/scripts/node_array_copy/node_array_copy.gml index db4b1f6a5..f4935f49c 100644 --- a/scripts/node_array_copy/node_array_copy.gml +++ b/scripts/node_array_copy/node_array_copy.gml @@ -25,7 +25,7 @@ function Node_Array_Copy(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0].type = _typ; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); var _ind = inputs[| 1].getValue(); var _siz = inputs[| 2].getValue(); diff --git a/scripts/node_array_csv_parse/node_array_csv_parse.gml b/scripts/node_array_csv_parse/node_array_csv_parse.gml index 8018a6762..47eb38b6a 100644 --- a/scripts/node_array_csv_parse/node_array_csv_parse.gml +++ b/scripts/node_array_csv_parse/node_array_csv_parse.gml @@ -14,7 +14,7 @@ function Node_Array_CSV_Parse(_x, _y, _group = noone) : Node(_x, _y, _group) con outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0) .setArrayDepth(1); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _str = inputs[| 0].getValue(); var _skp = inputs[| 1].getValue(); diff --git a/scripts/node_array_find/node_array_find.gml b/scripts/node_array_find/node_array_find.gml index eeffda17f..2bf1b6238 100644 --- a/scripts/node_array_find/node_array_find.gml +++ b/scripts/node_array_find/node_array_find.gml @@ -15,7 +15,7 @@ function Node_Array_Find(_x, _y, _group = noone) : Node(_x, _y, _group) construc outputs[| 0] = nodeValue("Index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = VALUE_TYPE.any; diff --git a/scripts/node_array_get/node_array_get.gml b/scripts/node_array_get/node_array_get.gml index a0c84ee74..ccecc7eaa 100644 --- a/scripts/node_array_get/node_array_get.gml +++ b/scripts/node_array_get/node_array_get.gml @@ -54,7 +54,7 @@ function Node_Array_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct return array_safe_get(_arr, index); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); if(!is_array(_arr)) return; diff --git a/scripts/node_array_insert/node_array_insert.gml b/scripts/node_array_insert/node_array_insert.gml index da62db785..2527d8619 100644 --- a/scripts/node_array_insert/node_array_insert.gml +++ b/scripts/node_array_insert/node_array_insert.gml @@ -19,7 +19,7 @@ function Node_Array_Insert(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = VALUE_TYPE.any; diff --git a/scripts/node_array_length/node_array_length.gml b/scripts/node_array_length/node_array_length.gml index ea1b90213..e2c2470da 100644 --- a/scripts/node_array_length/node_array_length.gml +++ b/scripts/node_array_length/node_array_length.gml @@ -11,7 +11,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; diff --git a/scripts/node_array_range/node_array_range.gml b/scripts/node_array_range/node_array_range.gml index c85e1c9e4..45d940d01 100644 --- a/scripts/node_array_range/node_array_range.gml +++ b/scripts/node_array_range/node_array_range.gml @@ -15,7 +15,7 @@ function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var st = inputs[| 0].getValue(); var ed = inputs[| 1].getValue(); var step = inputs[| 2].getValue(); diff --git a/scripts/node_array_remove/node_array_remove.gml b/scripts/node_array_remove/node_array_remove.gml index 482bfad88..57a1ce15b 100644 --- a/scripts/node_array_remove/node_array_remove.gml +++ b/scripts/node_array_remove/node_array_remove.gml @@ -42,7 +42,7 @@ function Node_Array_Remove(_x, _y, _group = noone) : Node(_x, _y, _group) constr } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); if(!is_array(_arr)) return; diff --git a/scripts/node_array_reverse/node_array_reverse.gml b/scripts/node_array_reverse/node_array_reverse.gml index 82c315d02..cad1a9b28 100644 --- a/scripts/node_array_reverse/node_array_reverse.gml +++ b/scripts/node_array_reverse/node_array_reverse.gml @@ -11,7 +11,7 @@ function Node_Array_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = VALUE_TYPE.any; diff --git a/scripts/node_array_set/node_array_set.gml b/scripts/node_array_set/node_array_set.gml index 719b54806..a24deb309 100644 --- a/scripts/node_array_set/node_array_set.gml +++ b/scripts/node_array_set/node_array_set.gml @@ -16,7 +16,7 @@ function Node_Array_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); inputs[| 0].type = VALUE_TYPE.any; diff --git a/scripts/node_array_shift/node_array_shift.gml b/scripts/node_array_shift/node_array_shift.gml index 614de3db9..47140e5e4 100644 --- a/scripts/node_array_shift/node_array_shift.gml +++ b/scripts/node_array_shift/node_array_shift.gml @@ -13,7 +13,7 @@ function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); var _shf = inputs[| 1].getValue(); diff --git a/scripts/node_array_shuffle/node_array_shuffle.gml b/scripts/node_array_shuffle/node_array_shuffle.gml index 05c34bb3d..0e3dd4e6e 100644 --- a/scripts/node_array_shuffle/node_array_shuffle.gml +++ b/scripts/node_array_shuffle/node_array_shuffle.gml @@ -12,7 +12,7 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Shuffled array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var arr = inputs[| 0].getValue(); var sed = inputs[| 1].getValue(); diff --git a/scripts/node_array_sort/node_array_sort.gml b/scripts/node_array_sort/node_array_sort.gml index ab841dbeb..e6dd16562 100644 --- a/scripts/node_array_sort/node_array_sort.gml +++ b/scripts/node_array_sort/node_array_sort.gml @@ -18,7 +18,7 @@ function Node_Array_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) construc static sortAcs = function(v1, v2) { return v1[1] < v2[1]; } static sortDes = function(v1, v2) { return v1[1] > v2[1]; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var arr = inputs[| 0].getValue(); var asc = inputs[| 1].getValue(); diff --git a/scripts/node_array_zip/node_array_zip.gml b/scripts/node_array_zip/node_array_zip.gml index aca8f700f..0bac0c9e1 100644 --- a/scripts/node_array_zip/node_array_zip.gml +++ b/scripts/node_array_zip/node_array_zip.gml @@ -49,7 +49,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); if(inputs[| 0].value_from == noone) { diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index 64c98f85f..42ce821ea 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -120,7 +120,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const var st = tag[? "Frame start"]; var ed = tag[? "Frame end"]; var rn = ed - st + 1; - var progFr = safe_mod(ANIMATOR.current_frame - _tag_delay, rn) + 1; + var progFr = safe_mod(PROJECT.animator.current_frame - _tag_delay, rn) + 1; var prog = progFr / rn; var txt = ""; @@ -294,7 +294,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); var current_tag = inputs[| 2].getValue(); if(path_current != path) updatePaths(path); @@ -311,7 +311,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const _tag_delay = 0; for( var i = 0; i < ds_list_size(inputs[| 2].animator.values); i++ ) { var kf = inputs[| 2].animator.values[| i]; - if(kf.time > ANIMATOR.current_frame) break; + if(kf.time > PROJECT.animator.current_frame) break; _tag_delay = kf.time; } @@ -328,7 +328,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const for( var i = 0; i < array_length(layers); i++ ) { layers[i].tag = tag; - var cel = layers[i].getCel(ANIMATOR.current_frame - _tag_delay); + var cel = layers[i].getCel(PROJECT.animator.current_frame - _tag_delay); if(!cel) continue; if(!array_safe_get(vis, i, true)) continue; diff --git a/scripts/node_ase_layer/node_ase_layer.gml b/scripts/node_ase_layer/node_ase_layer.gml index d852d057e..d7094429b 100644 --- a/scripts/node_ase_layer/node_ase_layer.gml +++ b/scripts/node_ase_layer/node_ase_layer.gml @@ -34,7 +34,7 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var data = inputs[| 0].getValue(); if(data == noone) return; @@ -44,7 +44,7 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct } if(layer_object == noone) return; - var cel = layer_object.getCel(ANIMATOR.current_frame - data._tag_delay); + var cel = layer_object.getCel(PROJECT.animator.current_frame - data._tag_delay); var celDim = inputs[| 1].getValue(); var ww = data.content[? "Width"]; diff --git a/scripts/node_atlas_draw/node_atlas_draw.gml b/scripts/node_atlas_draw/node_atlas_draw.gml index 87d563267..18d0f0e0b 100644 --- a/scripts/node_atlas_draw/node_atlas_draw.gml +++ b/scripts/node_atlas_draw/node_atlas_draw.gml @@ -12,7 +12,7 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_interpolation(true); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var dim = inputs[| 0].getValue(); var atl = inputs[| 1].getValue(); diff --git a/scripts/node_atlas_get/node_atlas_get.gml b/scripts/node_atlas_get/node_atlas_get.gml index 4066c0ef8..c1fd6e617 100644 --- a/scripts/node_atlas_get/node_atlas_get.gml +++ b/scripts/node_atlas_get/node_atlas_get.gml @@ -25,7 +25,7 @@ function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) .setArrayDepth(1); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var atl = inputs[| 0].getValue(); if(atl == noone) return; diff --git a/scripts/node_atlas_set/node_atlas_set.gml b/scripts/node_atlas_set/node_atlas_set.gml index 98c2d6f24..35f0277d2 100644 --- a/scripts/node_atlas_set/node_atlas_set.gml +++ b/scripts/node_atlas_set/node_atlas_set.gml @@ -27,7 +27,7 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct outputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, noone); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var atl = inputs[| 0].getValue(); if(atl == noone) return; diff --git a/scripts/node_audio_window/node_audio_window.gml b/scripts/node_audio_window/node_audio_window.gml index eadac160b..9513eb9e9 100644 --- a/scripts/node_audio_window/node_audio_window.gml +++ b/scripts/node_audio_window/node_audio_window.gml @@ -17,7 +17,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Windowed Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) .setArrayDepth(1); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); if(!is_array(_arr) || array_length(_arr) < 1) return; @@ -26,7 +26,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr var sam = inputs[| 1].getValue(); var siz = inputs[| 2].getValue(); var res = []; - var off = frame / ANIMATOR.framerate * sam; + var off = frame / PROJECT.animator.framerate * sam; for( var i = 0; i < array_length(_arr); i++ ) { var _dat = _arr[i]; diff --git a/scripts/node_cache/node_cache.gml b/scripts/node_cache/node_cache.gml index 81e3d670a..8dfd1a1aa 100644 --- a/scripts/node_cache/node_cache.gml +++ b/scripts/node_cache/node_cache.gml @@ -25,7 +25,7 @@ function Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { cache_result[cache_loading_progress] = true; cache_loading_progress++; - if(cache_loading_progress == ANIMATOR.frames_total) { + if(cache_loading_progress == PROJECT.animator.frames_total) { cache_loading = false; update(); } diff --git a/scripts/node_cache_array/node_cache_array.gml b/scripts/node_cache_array/node_cache_array.gml index 4259f4c4c..4641f7e57 100644 --- a/scripts/node_cache_array/node_cache_array.gml +++ b/scripts/node_cache_array/node_cache_array.gml @@ -32,7 +32,7 @@ function Node_Cache_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constru cache_result[cache_loading_progress] = true; cache_loading_progress++; - if(cache_loading_progress == ANIMATOR.frames_total) { + if(cache_loading_progress == PROJECT.animator.frames_total) { cache_loading = false; update(); } @@ -46,7 +46,7 @@ function Node_Cache_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constru var stp = inputs[| 3].getValue(); if(str == -1) str = 0; - if(lst == -1) lst = ANIMATOR.frames_total; + if(lst == -1) lst = PROJECT.animator.frames_total; if(lst > str && stp > 0) for( var i = str; i <= lst; i += stp ) { @@ -55,7 +55,7 @@ function Node_Cache_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constru } outputs[| 0].setValue(ss); - if(!ANIMATOR.is_playing) return; + if(!PROJECT.animator.is_playing) return; if(!inputs[| 0].value_from) return; var _surf = inputs[| 0].getValue(); diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 8dcf5d67c..67c6aa906 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -618,7 +618,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { apply_surface(); } diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 6b671f85d..ed162702c 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -258,7 +258,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static stepBegin = function() { use_cache = false; - array_safe_set(cache_result, ANIMATOR.current_frame, true); + array_safe_set(cache_result, PROJECT.animator.current_frame, true); var node_list = getNodeList(); for(var i = 0; i < ds_list_size(node_list); i++) { @@ -267,8 +267,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(!n.use_cache) continue; use_cache = true; - if(!array_safe_get(n.cache_result, ANIMATOR.current_frame)) - array_safe_set(cache_result, ANIMATOR.current_frame, false); + if(!array_safe_get(n.cache_result, PROJECT.animator.current_frame)) + array_safe_set(cache_result, PROJECT.animator.current_frame, false); } var out_surf = false; diff --git a/scripts/node_compare/node_compare.gml b/scripts/node_compare/node_compare.gml index e76b65544..ccfe3cc23 100644 --- a/scripts/node_compare/node_compare.gml +++ b/scripts/node_compare/node_compare.gml @@ -54,7 +54,7 @@ function Node_Compare(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return 0; } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var mode = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var b = inputs[| 2].getValue(); diff --git a/scripts/node_condition/node_condition.gml b/scripts/node_condition/node_condition.gml index 6a717f794..ad0cf0bae 100644 --- a/scripts/node_condition/node_condition.gml +++ b/scripts/node_condition/node_condition.gml @@ -51,7 +51,7 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct inputs[| 8].setVisible(_mode == 2, _mode == 2); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _true = inputs[| 3].getValue(); var _fals = inputs[| 4].getValue(); diff --git a/scripts/node_counter/node_counter.gml b/scripts/node_counter/node_counter.gml index 971a8a8e7..0f4704adb 100644 --- a/scripts/node_counter/node_counter.gml +++ b/scripts/node_counter/node_counter.gml @@ -27,13 +27,13 @@ function Node_Counter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c } function process_data(_output, _data, _output_index, _array_index = 0) { - var time = ANIMATOR.current_frame; + var time = PROJECT.animator.current_frame; var mode = _data[2]; var val = 0; switch(mode) { case 0 : val = _data[0] + time * _data[1]; break; - case 1 : val = time / (ANIMATOR.frames_total - 1) * _data[1]; break; + case 1 : val = time / (PROJECT.animator.frames_total - 1) * _data[1]; break; } return val; diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index 77f74e30a..75aa1e8d3 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -100,7 +100,7 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const update(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_csv_file_write/node_csv_file_write.gml b/scripts/node_csv_file_write/node_csv_file_write.gml index d45186310..4ee7bc81a 100644 --- a/scripts/node_csv_file_write/node_csv_file_write.gml +++ b/scripts/node_csv_file_write/node_csv_file_write.gml @@ -48,7 +48,7 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons file_text_close(f); } - static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index e21cbc59b..d979d68bc 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -13,7 +13,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x icon = noone; bg_spr = THEME.node_bg; bg_sel_spr = THEME.node_active; - anim_priority = ds_map_size(NODE_MAP); + anim_priority = ds_map_size(PROJECT.nodeMap); static resetInternalName = function() { var str = string_replace_all(name, " ", "_"); @@ -21,13 +21,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x str = string_replace_all(str, "-", ""); internalName = str + string(irandom_range(10000, 99999)); - NODE_NAME_MAP[? internalName] = self; + PROJECT.nodeNameMap[? internalName] = self; } if(!LOADING && !APPENDING) { recordAction(ACTION_TYPE.node_added, self); - NODE_MAP[? node_id] = self; - MODIFIED = true; + PROJECT.nodeMap[? node_id] = self; + PROJECT.modified = true; run_in(1, function() { if(display_name != "") return; @@ -251,7 +251,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x x = _x; y = _y; - if(!LOADING) MODIFIED = true; + if(!LOADING) PROJECT.modified = true; } insp1UpdateTooltip = __txtx("panel_inspector_execute", "Execute node"); @@ -278,7 +278,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(use_cache) cacheArrayCheck(); var willUpdate = false; - if(ANIMATOR.frame_progress) { + if(PROJECT.animator.frame_progress) { if(update_on_frame) willUpdate = true; if(isAnimated()) willUpdate = true; @@ -403,7 +403,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } static resetRender = function() { setRenderStatus(false); } - static isRenderActive = function() { return renderActive || (PREF_MAP[? "render_all_export"] && ANIMATOR.rendering); } + static isRenderActive = function() { return renderActive || (PREF_MAP[? "render_all_export"] && PROJECT.animator.rendering); } static isRenderable = function(log = false) { //Check if every input is ready (updated) if(!active) return false; @@ -1094,7 +1094,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static restore = function() { if(active) return; enable(); - ds_list_add(group == noone? NODES : group.getNodeList(), self); + ds_list_add(group == noone? PROJECT.nodes : group.getNodeList(), self); } static onValidate = function() { @@ -1117,26 +1117,26 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } static cacheArrayCheck = function() { - if(array_length(cached_output) != ANIMATOR.frames_total) - array_resize(cached_output, ANIMATOR.frames_total); - if(array_length(cache_result) != ANIMATOR.frames_total) - array_resize(cache_result, ANIMATOR.frames_total); + if(array_length(cached_output) != PROJECT.animator.frames_total) + array_resize(cached_output, PROJECT.animator.frames_total); + if(array_length(cache_result) != PROJECT.animator.frames_total) + array_resize(cache_result, PROJECT.animator.frames_total); } static cacheCurrentFrame = function(_frame) { cacheArrayCheck(); - if(ANIMATOR.current_frame < 0) return; - if(ANIMATOR.current_frame >= array_length(cached_output)) return; + if(PROJECT.animator.current_frame < 0) return; + if(PROJECT.animator.current_frame >= array_length(cached_output)) return; - surface_array_free(cached_output[ANIMATOR.current_frame]); - cached_output[ANIMATOR.current_frame] = surface_array_clone(_frame); + surface_array_free(cached_output[PROJECT.animator.current_frame]); + cached_output[PROJECT.animator.current_frame] = surface_array_clone(_frame); - array_safe_set(cache_result, ANIMATOR.current_frame, true); + array_safe_set(cache_result, PROJECT.animator.current_frame, true); - return cached_output[ANIMATOR.current_frame]; + return cached_output[PROJECT.animator.current_frame]; } - static cacheExist = function(frame = ANIMATOR.current_frame) { + static cacheExist = function(frame = PROJECT.animator.current_frame) { if(frame < 0) return false; if(frame >= array_length(cached_output)) return false; @@ -1147,7 +1147,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return is_array(s) || surface_exists(s); } - static getCacheFrame = function(frame = ANIMATOR.current_frame) { + static getCacheFrame = function(frame = PROJECT.animator.current_frame) { if(frame < 0) return false; if(!cacheExist(frame)) return noone; @@ -1155,10 +1155,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return surf; } - static recoverCache = function(frame = ANIMATOR.current_frame) { + static recoverCache = function(frame = PROJECT.animator.current_frame) { if(!cacheExist(frame)) return false; - var _s = cached_output[ANIMATOR.current_frame]; + var _s = cached_output[PROJECT.animator.current_frame]; outputs[| 0].setValue(_s); return true; @@ -1167,8 +1167,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!use_cache) return; if(!isRenderActive()) return; - if(array_length(cached_output) != ANIMATOR.frames_total) - array_resize(cached_output, ANIMATOR.frames_total); + if(array_length(cached_output) != PROJECT.animator.frames_total) + array_resize(cached_output, PROJECT.animator.frames_total); for(var i = 0; i < array_length(cached_output); i++) { var _s = cached_output[i]; if(is_surface(_s)) @@ -1259,7 +1259,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var _node = nodeBuild(_type, x, y, target); CLONING = false; - LOADING_VERSION = SAVEFILE_VERSION; + PROJECT.version = SAVE_VERSION; if(!_node) return; @@ -1270,8 +1270,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x _node.applyDeserialize(); _node.node_id = _nid; - NODE_MAP[? node_id] = self; - NODE_MAP[? _nid] = _node; + PROJECT.nodeMap[? node_id] = self; + PROJECT.nodeMap[? _nid] = _node; PANEL_ANIMATION.updatePropertyList(); CLONING = false; @@ -1353,7 +1353,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(APPENDING) APPEND_MAP[? load_map.id] = node_id; else node_id = load_map.id; - NODE_MAP[? node_id] = self; + PROJECT.nodeMap[? node_id] = self; if(struct_has(load_map, "name")) setDisplayName(load_map.name); @@ -1431,8 +1431,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } else { if(APPENDING) _group = GetAppendID(_group); - if(ds_map_exists(NODE_MAP, _group)) { - NODE_MAP[? _group].add(self); + if(ds_map_exists(PROJECT.nodeMap, _group)) { + PROJECT.nodeMap[? _group].add(self); } else { var txt = "Group load failed. Can't find node ID " + string(_group); log_warning("LOAD", txt); diff --git a/scripts/node_display_image/node_display_image.gml b/scripts/node_display_image/node_display_image.gml index d2f47c256..4d76ff837 100644 --- a/scripts/node_display_image/node_display_image.gml +++ b/scripts/node_display_image/node_display_image.gml @@ -71,7 +71,7 @@ function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) const return false; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index 7c83ad76f..6f045ab7d 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -19,14 +19,14 @@ Animated WebP (.webp)|*.webp", } function exportAll() { - ANIMATOR.rendering = true; + PROJECT.animator.rendering = true; Render(); - ANIMATOR.rendering = false; + PROJECT.animator.rendering = false; - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var node = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { + var node = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(!node.active) continue; if(instanceof(node) != "Node_Export") continue; @@ -273,12 +273,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var float_str = string_digits(str); if(float_str != "") { var float_val = string_digits(float_str); - var str_val = max(float_val - string_length(string(ANIMATOR.current_frame + strt)), 0); + var str_val = max(float_val - string_length(string(PROJECT.animator.current_frame + strt)), 0); repeat(str_val) s += "0"; } - s += string(ANIMATOR.current_frame + strt); + s += string(PROJECT.animator.current_frame + strt); res = true; break; case "i" : @@ -383,7 +383,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(!is_surface(_surf)) continue; if(form == NODE_EXPORT_FORMAT.gif) { - p = directory + "/" + string(i) + "/" + string_lead_zero(ANIMATOR.current_frame, 5) + ".png"; + p = directory + "/" + string(i) + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png"; } else { if(is_array(path) && array_length(path) == array_length(surf)) p = pathString(path[ safe_mod(i, array_length(path)) ], suff, i); @@ -406,7 +406,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(is_array(path)) p = path[0]; if(form == NODE_EXPORT_FORMAT.gif) - p = directory + "/" + string_lead_zero(ANIMATOR.current_frame, 5) + ".png"; + p = directory + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png"; else p = pathString(p, suff); @@ -444,9 +444,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var form = inputs[| 3].getValue(); if(form == NODE_EXPORT_FORMAT.single) { - ANIMATOR.rendering = true; + PROJECT.animator.rendering = true; Render(); - ANIMATOR.rendering = false; + PROJECT.animator.rendering = false; export(); return; @@ -454,10 +454,10 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor playing = true; played = 0; - ANIMATOR.real_frame = -1; - ANIMATOR.current_frame = -1; - ANIMATOR.is_playing = true; - ANIMATOR.rendering = true; + PROJECT.animator.real_frame = -1; + PROJECT.animator.current_frame = -1; + PROJECT.animator.is_playing = true; + PROJECT.animator.rendering = true; if(directory_exists(directory)) directory_destroy(directory); @@ -498,24 +498,24 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor outputs[| 0].visible = isInLoop(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var anim = inputs[| 3].getValue(); if(anim == NODE_EXPORT_FORMAT.single) { if(isInLoop()) export(); return; } - if(!ANIMATOR.is_playing) { + if(!PROJECT.animator.is_playing) { playing = false; return; } - if(!ANIMATOR.frame_progress || !playing || ANIMATOR.current_frame <= -1) + if(!PROJECT.animator.frame_progress || !playing || PROJECT.animator.current_frame <= -1) return; export(); - if(ANIMATOR.current_frame < ANIMATOR.frames_total - 1) + if(PROJECT.animator.current_frame < PROJECT.animator.frames_total - 1) return; if(anim != NODE_EXPORT_FORMAT.gif) diff --git a/scripts/node_feedback/node_feedback.gml b/scripts/node_feedback/node_feedback.gml index 9b33a03b5..1128c2379 100644 --- a/scripts/node_feedback/node_feedback.gml +++ b/scripts/node_feedback/node_feedback.gml @@ -15,7 +15,7 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) } static doStepBegin = function() { - if(!ANIMATOR.frame_progress) return; + if(!PROJECT.animator.frame_progress) return; setRenderStatus(false); UPDATE |= RENDER_TYPE.full; //force full render } diff --git a/scripts/node_feedback_input/node_feedback_input.gml b/scripts/node_feedback_input/node_feedback_input.gml index ce7fe60e1..cf3bb4add 100644 --- a/scripts/node_feedback_input/node_feedback_input.gml +++ b/scripts/node_feedback_input/node_feedback_input.gml @@ -15,7 +15,7 @@ function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, _node_output = vt; } - if(ANIMATOR.current_frame > 0 && _node_output != noone && _node_output.node.cache_value != noone) //use cache from output + if(PROJECT.animator.current_frame > 0 && _node_output != noone && _node_output.node.cache_value != noone) //use cache from output return [ _node_output.node.cache_value, inParent ]; return outputs[| 0].getValueDefault(); diff --git a/scripts/node_feedback_output/node_feedback_output.gml b/scripts/node_feedback_output/node_feedback_output.gml index 7ff60f85f..687171c51 100644 --- a/scripts/node_feedback_output/node_feedback_output.gml +++ b/scripts/node_feedback_output/node_feedback_output.gml @@ -11,9 +11,9 @@ function Node_Feedback_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y cache_value = -1; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(inputs[| 0].value_from == noone) return; - if(ANIMATOR.current_frame == ANIMATOR.frames_total - 1) { + if(PROJECT.animator.current_frame == PROJECT.animator.frames_total - 1) { cache_value = noone; return; } diff --git a/scripts/node_fluid_add/node_fluid_add.gml b/scripts/node_fluid_add/node_fluid_add.gml index 06fabc9ec..ebb93df40 100644 --- a/scripts/node_fluid_add/node_fluid_add.gml +++ b/scripts/node_fluid_add/node_fluid_add.gml @@ -46,7 +46,7 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con _prevPos = noone; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _pos = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_add_collider/node_fluid_add_collider.gml b/scripts/node_fluid_add_collider/node_fluid_add_collider.gml index 4c3caf92d..b1cb45d9c 100644 --- a/scripts/node_fluid_add_collider/node_fluid_add_collider.gml +++ b/scripts/node_fluid_add_collider/node_fluid_add_collider.gml @@ -34,7 +34,7 @@ function Node_Fluid_Add_Collider(_x, _y, _group = noone) : Node_Fluid(_x, _y, _g inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _area = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml index 059fe605b..9de4c9534 100644 --- a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml +++ b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml @@ -39,7 +39,7 @@ function Node_Fluid_Apply_Velocity(_x, _y, _group = noone) : Node_Fluid(_x, _y, inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _mat = inputs[| 1].getValue(frame); var _pos = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_domain/node_fluid_domain.gml b/scripts/node_fluid_domain/node_fluid_domain.gml index 59fbef6e7..979019a55 100644 --- a/scripts/node_fluid_domain/node_fluid_domain.gml +++ b/scripts/node_fluid_domain/node_fluid_domain.gml @@ -54,7 +54,7 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) domain = fd_rectangle_create(256, 256); _dim_old = [0, 0]; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { RETURN_ON_REST var _dim = inputs[| 0].getValue(frame); @@ -71,7 +71,7 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) var wrap = inputs[| 11].getValue(frame); //var loop = inputs[| 12].getValue(frame); - if(ANIMATOR.current_frame == 0 || !is_surface(domain.sf_world)) { + if(PROJECT.animator.current_frame == 0 || !is_surface(domain.sf_world)) { fd_rectangle_clear(domain); fd_rectangle_destroy(domain); domain = fd_rectangle_create(_dim[0], _dim[1]); @@ -116,9 +116,9 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) outputs[| 0].setValue(domain); //if(!loop) return; - //if(ANIMATOR.current_frame != 0) return; + //if(PROJECT.animator.current_frame != 0) return; - //for( var i = 0; i < ANIMATOR.frames_total; i++ ) + //for( var i = 0; i < PROJECT.animator.frames_total; i++ ) // updateForward(i, false); } diff --git a/scripts/node_fluid_render/node_fluid_render.gml b/scripts/node_fluid_render/node_fluid_render.gml index 37d8b8837..8b764ca3b 100644 --- a/scripts/node_fluid_render/node_fluid_render.gml +++ b/scripts/node_fluid_render/node_fluid_render.gml @@ -30,8 +30,8 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) static onInspector2Update = function() { clearCache(); } - static update = function(frame = ANIMATOR.current_frame) { - if(recoverCache() || !ANIMATOR.is_playing) + static update = function(frame = PROJECT.animator.current_frame) { + if(recoverCache() || !PROJECT.animator.is_playing) return; var _dim = inputs[| 1].getValue(frame); diff --git a/scripts/node_fluid_repulse/node_fluid_repulse.gml b/scripts/node_fluid_repulse/node_fluid_repulse.gml index bd0d24b6f..4fdffbb09 100644 --- a/scripts/node_fluid_repulse/node_fluid_repulse.gml +++ b/scripts/node_fluid_repulse/node_fluid_repulse.gml @@ -37,7 +37,7 @@ function Node_Fluid_Repulse(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _pos = inputs[| 1].getValue(frame); var _rad = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_turbulence/node_fluid_turbulence.gml b/scripts/node_fluid_turbulence/node_fluid_turbulence.gml index e8f912f21..266f30c82 100644 --- a/scripts/node_fluid_turbulence/node_fluid_turbulence.gml +++ b/scripts/node_fluid_turbulence/node_fluid_turbulence.gml @@ -31,7 +31,7 @@ function Node_Fluid_Turbulence(_x, _y, _group = noone) : Node_Fluid(_x, _y, _gro inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _are = inputs[| 1].getValue(frame); var _str = inputs[| 2].getValue(frame); diff --git a/scripts/node_fluid_update/node_fluid_update.gml b/scripts/node_fluid_update/node_fluid_update.gml index b7fe1f727..414c0eb25 100644 --- a/scripts/node_fluid_update/node_fluid_update.gml +++ b/scripts/node_fluid_update/node_fluid_update.gml @@ -17,8 +17,8 @@ function Node_Fluid_Update(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) outputs[| 0] = nodeValue("Fluid Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone); - static update = function(frame = ANIMATOR.current_frame) { - if(!ANIMATOR.is_playing) return; + static update = function(frame = PROJECT.animator.current_frame) { + if(!PROJECT.animator.is_playing) return; var _dom = inputs[| 0].getValue(frame); var _act = inputs[| 1].getValue(frame); diff --git a/scripts/node_fluid_vortex/node_fluid_vortex.gml b/scripts/node_fluid_vortex/node_fluid_vortex.gml index cdec68c09..4d738f1b6 100644 --- a/scripts/node_fluid_vortex/node_fluid_vortex.gml +++ b/scripts/node_fluid_vortex/node_fluid_vortex.gml @@ -41,7 +41,7 @@ function Node_Fluid_Vortex(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _dom = inputs[| 0].getValue(frame); var _pos = inputs[| 1].getValue(frame); var _rad = inputs[| 2].getValue(frame); diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index d89a8ba34..7985614f4 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -176,16 +176,8 @@ function variable_editor(nodeVal) constructor { } } -#region define - globalvar GLOBAL_NODE; - gml_pragma("global", @" - globalvar GLOBAL_NODE; - GLOBAL_NODE = new Node_Global(); - "); -#endregion - function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor { - name = "GLOBAL_NODE"; + name = "GLOBAL"; display_name = ""; group = noone; diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 1876b9f52..60db87a2a 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -288,7 +288,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru PATCH_STATIC - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(is_undefined(inParent)) return; var _dstype = inputs[| 0].getValue(); diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 537f03888..7b51ae237 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -89,7 +89,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { update(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); var pad = inputs[| 1].getValue(); if(path == "") return; diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index d8b3384fe..372405d5e 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -59,7 +59,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons inputs[| 5] = nodeValue("Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { if(array_length(spr) == 0) return; - ANIMATOR.frames_total = array_length(spr); + PROJECT.animator.frames_total = array_length(spr); }, "Match length"] ); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -133,7 +133,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons update(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(is_array(path) && !array_equals(path, path_loaded)) @@ -145,7 +145,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons inputs[| 3].setVisible(!str); inputs[| 4].setVisible(!str); - var spd = str? (ANIMATOR.frames_total + 1) / array_length(spr) : inputs[| 3].getValue(); + var spd = str? (PROJECT.animator.frames_total + 1) / array_length(spr) : inputs[| 3].getValue(); var _end = inputs[| 4].getValue(); if(spd == 0) spd = 1; @@ -158,7 +158,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons surfs = surface_verify(surfs, ww, hh, attrDepth()); outputs[| 0].setValue(surfs); - var _frame = floor(ANIMATOR.current_frame / spd); + var _frame = floor(PROJECT.animator.current_frame / spd); switch(_end) { case ANIMATION_END.loop : diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 8e901cefa..0aa90f19c 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -37,8 +37,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct .setDisplay(VALUE_DISPLAY.button, [ function() { if(!spr) return; if(!sprite_exists(spr)) return; - ANIMATOR.frames_total = sprite_get_number(spr); - ANIMATOR.framerate = 12; + PROJECT.animator.frames_total = sprite_get_number(spr); + PROJECT.animator.framerate = 12; }, "Match length"] ); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -108,7 +108,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); @@ -125,7 +125,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct surface_set_target(_outsurf); DRAW_CLEAR BLEND_OVERRIDE; - draw_sprite(spr, ANIMATOR.current_frame, 0, 0); + draw_sprite(spr, PROJECT.animator.current_frame, 0, 0); BLEND_NORMAL; surface_reset_target(); } diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index 05d426b3a..9c1cd1f6b 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -120,7 +120,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons return true; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(!is_array(path)) path = [ path ]; diff --git a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml index b3a45c3f9..49774141b 100644 --- a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml +++ b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml @@ -59,7 +59,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru .setDisplay(VALUE_DISPLAY.button, [ function() { var _atl = outputs[| 1].getValue(); var _spd = inputs[| 8].getValue(); - ANIMATOR.frames_total = max(1, _spd == 0? 1 : array_length(_atl) / _spd); + PROJECT.animator.frames_total = max(1, _spd == 0? 1 : array_length(_atl) / _spd); }, "Sync frames"] ); inputs[| 12] = nodeValue("Filter empty output", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); @@ -368,7 +368,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru surface_free(_empS); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(isInLoop()) doInspectorAction(); var _out = inputs[| 7].getValue(); @@ -382,7 +382,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru update_on_frame = true; if(array_length(surf_array)) { - var ind = safe_mod(ANIMATOR.current_frame * _spd, array_length(surf_array)); + var ind = safe_mod(PROJECT.animator.current_frame * _spd, array_length(surf_array)); outputs[| 0].setValue(array_safe_get(surf_array, ind)); } } diff --git a/scripts/node_iterate_sort/node_iterate_sort.gml b/scripts/node_iterate_sort/node_iterate_sort.gml index 5cfadc111..9fa47a95e 100644 --- a/scripts/node_iterate_sort/node_iterate_sort.gml +++ b/scripts/node_iterate_sort/node_iterate_sort.gml @@ -39,7 +39,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr inputs[| 0].type = type; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { initLoop(); } 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 808b4ec8f..3b0b447b4 100644 --- a/scripts/node_iterator_each_output/node_iterator_each_output.gml +++ b/scripts/node_iterator_each_output/node_iterator_each_output.gml @@ -37,7 +37,7 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group return _new_val; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; diff --git a/scripts/node_iterator_each_size/node_iterator_each_size.gml b/scripts/node_iterator_each_size/node_iterator_each_size.gml index 7365cf756..30c1b6196 100644 --- a/scripts/node_iterator_each_size/node_iterator_each_size.gml +++ b/scripts/node_iterator_each_size/node_iterator_each_size.gml @@ -9,7 +9,7 @@ function Node_Iterator_Each_Length(_x, _y, _group = noone) : Node(_x, _y, _group outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; var val = group.inputs[| 0].getValue(); outputs[| 0].setValue(array_length(val)); 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 31f0b7911..fc474aff9 100644 --- a/scripts/node_iterator_filter_output/node_iterator_filter_output.gml +++ b/scripts/node_iterator_filter_output/node_iterator_filter_output.gml @@ -23,7 +23,7 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro group.outputs[| 0].type = type; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; diff --git a/scripts/node_iterator_index/node_iterator_index.gml b/scripts/node_iterator_index/node_iterator_index.gml index e0bfa5174..3b0ebbf78 100644 --- a/scripts/node_iterator_index/node_iterator_index.gml +++ b/scripts/node_iterator_index/node_iterator_index.gml @@ -9,7 +9,7 @@ function Node_Iterator_Index(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; outputs[| 0].setValue(group.iterated); } diff --git a/scripts/node_iterator_length/node_iterator_length.gml b/scripts/node_iterator_length/node_iterator_length.gml index ea72774a0..93574a880 100644 --- a/scripts/node_iterator_length/node_iterator_length.gml +++ b/scripts/node_iterator_length/node_iterator_length.gml @@ -9,7 +9,7 @@ function Node_Iterator_Length(_x, _y, _group = noone) : Node(_x, _y, _group) con outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; var val = group.inputs[| 0].getValue(); outputs[| 0].setValue(val); diff --git a/scripts/node_iterator_output/node_iterator_output.gml b/scripts/node_iterator_output/node_iterator_output.gml index ae6fc3919..5da054dae 100644 --- a/scripts/node_iterator_output/node_iterator_output.gml +++ b/scripts/node_iterator_output/node_iterator_output.gml @@ -55,7 +55,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y return _new_val; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!variable_struct_exists(group, "iterated")) return; diff --git a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml index 8df2350fd..c69362040 100644 --- a/scripts/node_iterator_sort_output/node_iterator_sort_output.gml +++ b/scripts/node_iterator_sort_output/node_iterator_sort_output.gml @@ -13,7 +13,7 @@ function Node_Iterator_Sort_Output(_x, _y, _group = noone) : Node(_x, _y, _group static step = function() {} - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { //print(display_name + ": " + string(inputs[| 0].getValue())); } } \ No newline at end of file diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index ed75a1698..fdeb7f63a 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -140,7 +140,7 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons return true; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index 53c6ba3ce..8202a950e 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -111,7 +111,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con } } - static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 4ebb3e20e..093bfff25 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -6,7 +6,7 @@ enum CURVE_TYPE { function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor { time = _time; - ratio = time / (ANIMATOR.frames_total - 1); + ratio = time / (PROJECT.animator.frames_total - 1); value = _value; anim = _anim; @@ -20,7 +20,7 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor { static setTime = function(time) { self.time = time; - ratio = time / (ANIMATOR.frames_total - 1); + ratio = time / (PROJECT.animator.frames_total - 1); } static clone = function(target = noone) { @@ -126,7 +126,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { static getName = function() { return prop.name + suffix; } - static getValue = function(_time = ANIMATOR.current_frame) { + static getValue = function(_time = PROJECT.animator.current_frame) { if(prop.type == VALUE_TYPE.trigger) { if(ds_list_size(values) == 0) return false; @@ -180,8 +180,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { if(prop.on_end == KEYFRAME_END.wrap) { var from = values[| ds_list_size(values) - 1]; var to = values[| 0]; - var prog = ANIMATOR.frames_total - from.time + _time; - var totl = ANIMATOR.frames_total - from.time + to.time; + var prog = PROJECT.animator.frames_total - from.time + _time; + var totl = PROJECT.animator.frames_total - from.time + to.time; var rat = prog / totl; var _lrp = interpolate(from, to, rat); @@ -208,7 +208,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { var from = values[| ds_list_size(values) - 1]; var to = values[| 0]; var prog = _time - from.time; - var totl = ANIMATOR.frames_total - from.time + to.time; + var totl = PROJECT.animator.frames_total - from.time + to.time; var rat = prog / totl; var _lrp = interpolate(from, to, rat); @@ -256,7 +256,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { static setKeyTime = function(_key, _time, _replace = true) { if(!ds_list_exist(values, _key)) return 0; - if(!LOADING) MODIFIED = true; + if(!LOADING) PROJECT.modified = true; _time = max(_time, 0); _key.setTime(_time); @@ -282,7 +282,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { return 1; } - static setValue = function(_val = 0, _record = true, _time = ANIMATOR.current_frame, ease_in = 0, ease_out = 0) { + static setValue = function(_val = 0, _record = true, _time = PROJECT.animator.current_frame, ease_in = 0, ease_out = 0) { if(prop.type == VALUE_TYPE.trigger) { if(!prop.is_anim) { values[| 0] = new valueKey(0, _val, self); @@ -360,7 +360,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { for(var i = 0; i < ds_list_size(values); i++) { var _value_list = []; if(scale) - _value_list[0] = values[| i].time / (ANIMATOR.frames_total - 1); + _value_list[0] = values[| i].time / (PROJECT.animator.frames_total - 1); else _value_list[0] = values[| i].time; @@ -396,7 +396,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { static deserialize = function(_data, scale = false) { ds_list_clear(values); - if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient + if(prop.type == VALUE_TYPE.gradient && PROJECT.version < 1340 && !CLONING) { //backward compat: Gradient var _val = []; var value = _data[0][1]; @@ -422,7 +422,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { var _time = array_safe_get(_keyframe, 0); if(scale && _time <= 1) - _time = round(_time * (ANIMATOR.frames_total - 1)); + _time = round(_time * (PROJECT.animator.frames_total - 1)); var value = array_safe_get(_keyframe, 1); var ease_in = array_safe_get(_keyframe, 2); diff --git a/scripts/node_logic_operate/node_logic_operate.gml b/scripts/node_logic_operate/node_logic_operate.gml index bc777ef0f..44584b3ac 100644 --- a/scripts/node_logic_operate/node_logic_operate.gml +++ b/scripts/node_logic_operate/node_logic_operate.gml @@ -183,7 +183,7 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var mode = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var val; diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 5dfe2ae7e..6d44ebe27 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -57,7 +57,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(!LOADING && !APPENDING) createNewInput(); static stepBegin = function() { - if(ANIMATOR.frame_progress) + if(PROJECT.animator.frame_progress) setRenderStatus(false); setHeight(); @@ -161,9 +161,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!compiled) return; - //if(!ANIMATOR.is_playing || !ANIMATOR.frame_progress) return; + //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; var _func = inputs[| 0].getValue(); var _dimm = inputs[| 1].getValue(); @@ -175,7 +175,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) array_push(argument_val, inputs[| i + 2].getValue()); - //if(ANIMATOR.current_frame == 0) { //refresh state on the first frame + //if(PROJECT.animator.current_frame == 0) { //refresh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); diff --git a/scripts/node_lua_global/node_lua_global.gml b/scripts/node_lua_global/node_lua_global.gml index 74176818b..7b16b46e1 100644 --- a/scripts/node_lua_global/node_lua_global.gml +++ b/scripts/node_lua_global/node_lua_global.gml @@ -28,7 +28,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc static stepBegin = function() { var _type = inputs[| 1].getValue(); - if(ANIMATOR.is_playing && ANIMATOR.frame_progress && (ANIMATOR.current_frame == 0 || _type == 1)) + if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (PROJECT.animator.current_frame == 0 || _type == 1)) setRenderStatus(false); setHeight(); @@ -59,14 +59,14 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(index == 0 || index == 2) compiled = false; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!compiled) return; - //if(!ANIMATOR.is_playing || !ANIMATOR.frame_progress) return; + //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; var _code = inputs[| 0].getValue(); var _type = inputs[| 1].getValue(); - //if(ANIMATOR.current_frame == 0) { //rerfesh state on the first frame + //if(PROJECT.animator.current_frame == 0) { //rerfesh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); @@ -74,7 +74,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc lua_projectData(getState()); - if(ANIMATOR.current_frame == 0 || _type == 1) { + if(PROJECT.animator.current_frame == 0 || _type == 1) { try { lua_add_code(getState(), _code); } catch(e) { noti_warning(exception_print(e),, self); } } diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index b93ec6249..dacf0c5a6 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -58,7 +58,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(!LOADING && !APPENDING) createNewInput(); static stepBegin = function() { - if(ANIMATOR.frame_progress) + if(PROJECT.animator.frame_progress) setRenderStatus(false); setHeight(); @@ -155,9 +155,9 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!compiled) return; - //if(!ANIMATOR.is_playing || !ANIMATOR.frame_progress) return; + //if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return; var _func = inputs[| 0].getValue(); var _dimm = inputs[| 1].getValue(); @@ -170,7 +170,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru array_push(argument_val, inputs[| i + 2].getValue()); } - //if(ANIMATOR.current_frame == 0) { //rerfesh state on the first frame + //if(PROJECT.animator.current_frame == 0) { //rerfesh state on the first frame // lua_state_destroy(lua_state); // lua_state = lua_create(); // addCode(); diff --git a/scripts/node_math/node_math.gml b/scripts/node_math/node_math.gml index 3ebf30148..99e3b06df 100644 --- a/scripts/node_math/node_math.gml +++ b/scripts/node_math/node_math.gml @@ -201,7 +201,7 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return val; } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { use_mod = inputs[| 0].getValue(); var a = inputs[| 1].getValue(); var b = inputs[| 2].getValue(); diff --git a/scripts/node_palette_sort/node_palette_sort.gml b/scripts/node_palette_sort/node_palette_sort.gml index e7c91e029..88e1cccc0 100644 --- a/scripts/node_palette_sort/node_palette_sort.gml +++ b/scripts/node_palette_sort/node_palette_sort.gml @@ -17,7 +17,7 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0] = nodeValue("Sorted palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, []) .setDisplay(VALUE_DISPLAY.palette); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _arr = inputs[| 0].getValue(); var _ord = inputs[| 1].getValue(); var _rev = inputs[| 2].getValue(); diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 69443da21..b790f188f 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -36,8 +36,8 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ outputs[| 0].setValue(_outSurf); } - if(ANIMATOR.is_playing) - ANIMATOR.setFrame(-1); + if(PROJECT.animator.is_playing) + PROJECT.animator.setFrame(-1); } static step = function() { @@ -49,7 +49,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ } static onUpdate = function() { - if(!ANIMATOR.is_playing && !ANIMATOR.frame_progress) { + if(!PROJECT.animator.is_playing && !PROJECT.animator.frame_progress) { if(!recoverCache()) { var _dim = inputs[| input_len + 0].getValue(); var _outSurf = outputs[| 0].getValue(); @@ -60,13 +60,13 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ return; } - if(ANIMATOR.current_frame == 0) + if(PROJECT.animator.current_frame == 0) reset(); - runVFX(ANIMATOR.current_frame); + runVFX(PROJECT.animator.current_frame); } - function render(_time = ANIMATOR.current_frame) { + function render(_time = PROJECT.animator.current_frame) { var _dim = inputs[| input_len + 0].getValue(_time); var _exact = inputs[| input_len + 1].getValue(_time); var _blend = inputs[| input_len + 2].getValue(_time); @@ -93,7 +93,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ BLEND_NORMAL; surface_reset_shader(); - if(ANIMATOR.is_playing) + if(PROJECT.animator.is_playing) cacheCurrentFrame(_outSurf); } } \ No newline at end of file diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index ca216599e..dd89d7a95 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -939,7 +939,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return new Point(p[0], p[1]); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { updateLength(); var _rat = inputs[| 0].getValue(); diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index 686c3b01a..d05a89b0e 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -128,7 +128,7 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc return new Point(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { outputs[| 0].setValue(self); } diff --git a/scripts/node_pin/node_pin.gml b/scripts/node_pin/node_pin.gml index 32087b0d0..eb91988ef 100644 --- a/scripts/node_pin/node_pin.gml +++ b/scripts/node_pin/node_pin.gml @@ -18,7 +18,7 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type; outputs[| 0].type = inputs[| 0].type; outputs[| 0].value_from = inputs[| 0].value_from; diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 338eb5936..dc2f9f572 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -173,7 +173,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct return _out; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { process_amount = 0; inputs_data = array_create(ds_list_size(inputs)); process_length = array_create(ds_list_size(inputs)); diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index e429446a8..9225fd29f 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -636,7 +636,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { } function nodeDelete(node, _merge = false) { - var list = node.group == noone? NODES : node.group.getNodeList(); + var list = node.group == noone? PROJECT.nodes : node.group.getNodeList(); ds_list_remove(list, node); node.destroy(_merge); @@ -645,19 +645,17 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { } function nodeCleanUp() { - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - if(NODE_MAP[? key]) { - NODE_MAP[? key].active = false; - NODE_MAP[? key].cleanUp(); - delete NODE_MAP[? key]; + var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { + if(PROJECT.nodeMap[? key]) { + PROJECT.nodeMap[? key].active = false; + PROJECT.nodeMap[? key].cleanUp(); + delete PROJECT.nodeMap[? key]; } - key = ds_map_find_next(NODE_MAP, key); + key = ds_map_find_next(PROJECT.nodeMap, key); } ds_map_clear(APPEND_MAP); - ds_map_clear(NODE_MAP); - ds_list_clear(NODES); } function graphFocusNode(node) { @@ -668,17 +666,17 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { } function refreshNodeMap() { - ds_map_clear(NODE_NAME_MAP); - var key = ds_map_find_first(NODE_MAP); - var amo = ds_map_size(NODE_MAP); + ds_map_clear(PROJECT.nodeNameMap); + var key = ds_map_find_first(PROJECT.nodeMap); + var amo = ds_map_size(PROJECT.nodeMap); repeat(amo) { - var node = NODE_MAP[? key]; + var node = PROJECT.nodeMap[? key]; if(node.internalName != "") - NODE_NAME_MAP[? node.internalName] = node; + PROJECT.nodeNameMap[? node.internalName] = node; - key = ds_map_find_next(NODE_MAP, key); + key = ds_map_find_next(PROJECT.nodeMap, key); } } @@ -689,20 +687,20 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { if(array_length(strs) == 1) { var splt = string_splice(strs[0], "["); - var inp = GLOBAL_NODE.getInput(strs[0]); + var inp = PROJECT.globalNode.getInput(strs[0]); _val = inp == noone? 0 : inp.getValueRecursive()[0]; } else if(strs[0] == "Project") { switch(strs[1]) { - case "frame" : return ANIMATOR.current_frame; - case "frameTotal" : return ANIMATOR.frames_total; - case "fps" : return ANIMATOR.framerate; + case "frame" : return PROJECT.animator.current_frame; + case "frameTotal" : return PROJECT.animator.frames_total; + case "fps" : return PROJECT.animator.framerate; } return 0; } else if(array_length(strs) > 2) { var key = strs[0]; - if(!ds_map_exists(NODE_NAME_MAP, key)) return 0; + if(!ds_map_exists(PROJECT.nodeNameMap, key)) return 0; - var node = NODE_NAME_MAP[? key]; + var node = PROJECT.nodeNameMap[? key]; var map = noone; switch(string_lower(strs[1])) { case "inputs" : diff --git a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml index c4b19ac17..e283570b3 100644 --- a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml +++ b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml @@ -11,7 +11,7 @@ enum SPRITE_ANIM_GROUP { function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Render Spritesheet"; - anim_drawn = array_create(ANIMATOR.frames_total + 1, false); + anim_drawn = array_create(PROJECT.animator.frames_total + 1, false); inputs[| 0] = nodeValue("Sprites", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); @@ -68,7 +68,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) inputs[| 5].setVisible(pack != SPRITE_STACK.grid); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var inpt = inputs[| 0].getValue(); var grup = inputs[| 1].getValue(); var skip = inputs[| 2].getValue(); @@ -85,7 +85,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) if(grup != SPRITE_ANIM_GROUP.animation) { initRender(); return; - } else if(ANIMATOR.rendering && ANIMATOR.frame_progress && ANIMATOR.current_frame == 0 && !refreshSurface) { + } else if(PROJECT.animator.rendering && PROJECT.animator.frame_progress && PROJECT.animator.current_frame == 0 && !refreshSurface) { var skip = inputs[| 2].getValue(); if(is_array(inpt) && array_length(inpt) == 0) return; @@ -93,7 +93,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) if(!arr) inpt = [ inpt ]; var _surf = []; - var amo = floor(ANIMATOR.frames_total / skip); + var amo = floor(PROJECT.animator.frames_total / skip); var _st = clamp(rang[0], 0, amo); var _ed = rang[1]; if(rang[1] == 0) _ed = amo; @@ -116,7 +116,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) hh = sh * amo + spac * (amo - 1); break; case SPRITE_STACK.grid : - var amo = floor(ANIMATOR.frames_total / skip); + var amo = floor(PROJECT.animator.frames_total / skip); var col = inputs[| 4].getValue(); var row = ceil(amo / col); @@ -142,15 +142,15 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) outputs[| 1].setValue(_atl); } - if(safe_mod(ANIMATOR.current_frame, skip) != 0) return; + if(safe_mod(PROJECT.animator.current_frame, skip) != 0) return; - if(array_length(anim_drawn) != ANIMATOR.frames_total) - array_resize(anim_drawn, ANIMATOR.frames_total); + if(array_length(anim_drawn) != PROJECT.animator.frames_total) + array_resize(anim_drawn, PROJECT.animator.frames_total); - if(ANIMATOR.current_frame >= 0 && ANIMATOR.current_frame < ANIMATOR.frames_total) { - if(anim_drawn[ANIMATOR.current_frame]) return; + if(PROJECT.animator.current_frame >= 0 && PROJECT.animator.current_frame < PROJECT.animator.frames_total) { + if(anim_drawn[PROJECT.animator.current_frame]) return; - if(ANIMATOR.is_playing && ANIMATOR.frame_progress) { + if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress) { if(is_array(inpt) && array_length(inpt) == 0) return; if(!is_array(inpt)) inpt = [ inpt ]; } @@ -158,9 +158,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) var oupt = outputs[| 0].getValue(); if(is_array(oupt) && (array_length(inpt) != array_length(oupt))) return; - if(ANIMATOR.current_frame % skip != 0) return; + if(PROJECT.animator.current_frame % skip != 0) return; - var amo = floor(ANIMATOR.frames_total / skip); + var amo = floor(PROJECT.animator.frames_total / skip); var _st = clamp(rang[0], 0, amo); var _ed = rang[1]; if(rang[1] == 0) _ed = amo; @@ -168,7 +168,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) _ed = clamp(_ed, 0, amo); if(_ed <= _st) return; - var _frame = floor(ANIMATOR.current_frame / skip); + var _frame = floor(PROJECT.animator.current_frame / skip); if(_frame < _st || _frame > _ed) return; _frame -= _st; @@ -240,16 +240,16 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) surface_reset_target(); } - if(drawn) array_safe_set(anim_drawn, ANIMATOR.current_frame, true); + if(drawn) array_safe_set(anim_drawn, PROJECT.animator.current_frame, true); outputs[| 1].setValue(_atl); } static onInspector1Update = function(updateAll = true) { - var key = ds_map_find_first(NODE_MAP); + var key = ds_map_find_first(PROJECT.nodeMap); - repeat(ds_map_size(NODE_MAP)) { - var node = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + repeat(ds_map_size(PROJECT.nodeMap)) { + var node = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(!node.active) continue; if(instanceof(node) != "Node_Render_Sprite_Sheet") continue; @@ -274,7 +274,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) if(grup == SPRITE_ANIM_GROUP.animation) { refreshSurface = false; if(!LOADING && !APPENDING) - ANIMATOR.render(); + PROJECT.animator.render(); outputs[| 1].setValue([]); return; diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index 5df9c753c..923c429a2 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -251,7 +251,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor surface_reset_target(); } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var _inSurf = inputs[| 0].getValue(); if(is_array(_inSurf) && array_length(_inSurf) == 0) return; if(!is_array(_inSurf) && !is_surface(_inSurf)) return; diff --git a/scripts/node_rigid_activation/node_rigid_activation.gml b/scripts/node_rigid_activation/node_rigid_activation.gml index fcbf61e53..750786870 100644 --- a/scripts/node_rigid_activation/node_rigid_activation.gml +++ b/scripts/node_rigid_activation/node_rigid_activation.gml @@ -18,7 +18,7 @@ function Node_Rigid_Activate(_x, _y, _group = noone) : Node(_x, _y, _group) cons ["Activate", false], 1, ] - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _obj = inputs[| 0].getValue(); outputs[| 0].setValue(_obj); diff --git a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml index 2253a704c..21258ac08 100644 --- a/scripts/node_rigid_force_apply/node_rigid_force_apply.gml +++ b/scripts/node_rigid_force_apply/node_rigid_force_apply.gml @@ -88,7 +88,7 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c inputs[| 8].setVisible(_typ == 3); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _obj = inputs[| 0].getValue(); outputs[| 0].setValue(_obj); @@ -104,7 +104,7 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c var _str = inputs[| 7].getValue(); var _rad = inputs[| 8].getValue(); - if((_typ > 0) && ANIMATOR.current_frame != _frm) + if((_typ > 0) && PROJECT.animator.current_frame != _frm) return; if(!is_array(_obj)) _obj = [ _obj ]; diff --git a/scripts/node_rigid_global/node_rigid_global.gml b/scripts/node_rigid_global/node_rigid_global.gml index 491de3dcd..9b1acb8f7 100644 --- a/scripts/node_rigid_global/node_rigid_global.gml +++ b/scripts/node_rigid_global/node_rigid_global.gml @@ -12,7 +12,7 @@ function Node_Rigid_Global(_x, _y, _group = noone) : Node(_x, _y, _group) constr current_gra = [0, 0]; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _gra = inputs[| 0].getValue(); if(current_gra[0] != array_safe_get(_gra, 0) || current_gra[1] != array_safe_get(_gra, 1)) { diff --git a/scripts/node_rigid_group/node_rigid_group.gml b/scripts/node_rigid_group/node_rigid_group.gml index b568fd931..cfa8d3ea4 100644 --- a/scripts/node_rigid_group/node_rigid_group.gml +++ b/scripts/node_rigid_group/node_rigid_group.gml @@ -31,7 +31,7 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro } static update = function() { - if(ANIMATOR.current_frame == 0) + if(PROJECT.animator.current_frame == 0) reset(); } diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index b8e648e84..089857088 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -638,7 +638,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr return object; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(!isAnimated()) return; //for( var i = 0; i < array_length(object); i++ ) diff --git a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml index e0277398a..86d3a39c6 100644 --- a/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml +++ b/scripts/node_rigid_object_spawner/node_rigid_object_spawner.gml @@ -71,7 +71,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { RETURN_ON_REST var _obj = inputs[| 0].getValue(); @@ -86,9 +86,9 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group var _amo = inputs[| 4].getValue(); var _sed = inputs[| 7].getValue() + frame * _amo * 20; - if(_typ == 0 && (safe_mod(ANIMATOR.current_frame, _del) == 0)) + if(_typ == 0 && (safe_mod(PROJECT.animator.current_frame, _del) == 0)) spawn(_sed); - else if(_typ == 1 && ANIMATOR.current_frame == _frm) + else if(_typ == 1 && PROJECT.animator.current_frame == _frm) spawn(_sed); } diff --git a/scripts/node_rigid_override/node_rigid_override.gml b/scripts/node_rigid_override/node_rigid_override.gml index cdab15373..e9d9db7b1 100644 --- a/scripts/node_rigid_override/node_rigid_override.gml +++ b/scripts/node_rigid_override/node_rigid_override.gml @@ -29,7 +29,7 @@ function Node_Rigid_Override(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, noone ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var objNode = inputs[| 0].getValue(); outputs[| 0].setValue(objNode); if(!variable_struct_exists(objNode, "object")) return; diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 7cea52d6a..710383256 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -60,8 +60,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr outputs[| 0].setValue(_outSurf); } - static update = function(frame = ANIMATOR.current_frame) { - if(recoverCache() || !ANIMATOR.is_playing) + static update = function(frame = PROJECT.animator.current_frame) { + if(recoverCache() || !PROJECT.animator.is_playing) return; var _dim = inputs[| 0].getValue(); diff --git a/scripts/node_rigid_variable/node_rigid_variable.gml b/scripts/node_rigid_variable/node_rigid_variable.gml index fab0dc8a0..d034019f6 100644 --- a/scripts/node_rigid_variable/node_rigid_variable.gml +++ b/scripts/node_rigid_variable/node_rigid_variable.gml @@ -36,7 +36,7 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons .setDisplay(VALUE_DISPLAY.vector) .setVisible(false); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var objNode = inputs[| 0].getValue(); outputs[| 0].setValue(objNode); if(!variable_struct_exists(objNode, "object")) return; diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index d682b1419..f8958fb75 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -53,7 +53,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons static getPreviewValue = function() { return refVal; } - function update(frame = ANIMATOR.current_frame) { + function update(frame = PROJECT.animator.current_frame) { var _area = inputs[| 0].getValue(); var _dist = inputs[| 1].getValue(); var _scat = inputs[| 2].getValue(); diff --git a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml index 72263ef57..77bce5e95 100644 --- a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml +++ b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml @@ -83,7 +83,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const ["Animation", false], 1, ]; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _sur = inputs[| 0].getValue(); if(!is_array(_sur)) { outputs[| 0].setValue(_sur); @@ -94,7 +94,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const var _seq = inputs[| 2].getValue(); var _ovf = inputs[| 3].getValue(); - var frm = floor(ANIMATOR.current_frame / _spd); + var frm = floor(PROJECT.animator.current_frame / _spd); var ind = frm; if(array_length(_seq) == 0) { diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index 5614ca2b2..6045de246 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -60,7 +60,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| 2].setVisible(_axis != 2); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _axis = inputs[| 0].getValue(); var _alig = inputs[| 1].getValue(); var _spac = inputs[| 2].getValue(); diff --git a/scripts/node_statistic/node_statistic.gml b/scripts/node_statistic/node_statistic.gml index 132018295..87d1d3c50 100644 --- a/scripts/node_statistic/node_statistic.gml +++ b/scripts/node_statistic/node_statistic.gml @@ -76,7 +76,7 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct refreshDynamicInput(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var type = inputs[| 0].getValue(); var res = 0; diff --git a/scripts/node_strand_break/node_strand_break.gml b/scripts/node_strand_break/node_strand_break.gml index 56a02fb47..132b213fe 100644 --- a/scripts/node_strand_break/node_strand_break.gml +++ b/scripts/node_strand_break/node_strand_break.gml @@ -13,7 +13,7 @@ function Node_Strand_Break(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _ ["Break", false], input_fix_len + 0, input_fix_len + 1 ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _cha = inputs[| input_fix_len + 0].getValue(); var _sed = inputs[| input_fix_len + 1].getValue(); diff --git a/scripts/node_strand_collision/node_strand_collision.gml b/scripts/node_strand_collision/node_strand_collision.gml index 4c3019bfa..bfc7464c6 100644 --- a/scripts/node_strand_collision/node_strand_collision.gml +++ b/scripts/node_strand_collision/node_strand_collision.gml @@ -20,7 +20,7 @@ function Node_Strand_Collision(_x, _y, _group = noone) : Node(_x, _y, _group) co _msh.draw(_x, _y, _s); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _str = inputs[| 0].getValue(); var _msh = inputs[| 1].getValue(); diff --git a/scripts/node_strand_create/node_strand_create.gml b/scripts/node_strand_create/node_strand_create.gml index 8f9ac1e75..c954ebe29 100644 --- a/scripts/node_strand_create/node_strand_create.gml +++ b/scripts/node_strand_create/node_strand_create.gml @@ -533,8 +533,8 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const } } - static update = function(frame = ANIMATOR.current_frame) { - strandUpdate(ANIMATOR.current_frame == 0); + static update = function(frame = PROJECT.animator.current_frame) { + strandUpdate(PROJECT.animator.current_frame == 0); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_strand_force_apply/node_strand_force_apply.gml b/scripts/node_strand_force_apply/node_strand_force_apply.gml index 7c7df0091..6185488a1 100644 --- a/scripts/node_strand_force_apply/node_strand_force_apply.gml +++ b/scripts/node_strand_force_apply/node_strand_force_apply.gml @@ -19,7 +19,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector ["Force", false], input_fix_len + 0, input_fix_len + 2, input_fix_len + 1, input_fix_len + 3, input_fix_len + 4 ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _pos = inputs[| 2].getValue(); var _dir = inputs[| 4].getValue(); @@ -31,7 +31,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector inputs[| 4].setVisible(true); - var _strTur = _tur == 0? _stn : perlin1D(_sed + ANIMATOR.current_frame, _tfr, _toc, _stn - _tur, _stn + _tur); + var _strTur = _tur == 0? _stn : perlin1D(_sed + PROJECT.animator.current_frame, _tfr, _toc, _stn - _tur, _stn + _tur); var gx = lengthdir_x(_strTur, _dir); var gy = lengthdir_y(_strTur, _dir); diff --git a/scripts/node_strand_gravity/node_strand_gravity.gml b/scripts/node_strand_gravity/node_strand_gravity.gml index d1c2e6c71..001ce4182 100644 --- a/scripts/node_strand_gravity/node_strand_gravity.gml +++ b/scripts/node_strand_gravity/node_strand_gravity.gml @@ -14,7 +14,7 @@ function Node_Strand_Gravity(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.output, VALUE_TYPE.strands, noone); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _str = inputs[| 0].getValue(); var _gra = inputs[| 1].getValue(); var _dir = inputs[| 2].getValue(); diff --git a/scripts/node_strand_length_adjust/node_strand_length_adjust.gml b/scripts/node_strand_length_adjust/node_strand_length_adjust.gml index 58eb08d9e..972c06998 100644 --- a/scripts/node_strand_length_adjust/node_strand_length_adjust.gml +++ b/scripts/node_strand_length_adjust/node_strand_length_adjust.gml @@ -14,7 +14,7 @@ function Node_Strand_Length_Adjust(_x, _y, _group = noone) : _Node_Strand_Affect ["Length adjust", false], input_fix_len + 0, input_fix_len + 1, ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _sTyp = inputs[| input_fix_len + 0].getValue(); var _sStr = inputs[| input_fix_len + 1].getValue(); diff --git a/scripts/node_strand_render/node_strand_render.gml b/scripts/node_strand_render/node_strand_render.gml index 6565710d1..09524fbde 100644 --- a/scripts/node_strand_render/node_strand_render.gml +++ b/scripts/node_strand_render/node_strand_render.gml @@ -45,8 +45,8 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const _str[i].draw(_x, _y, _s); } - static update = function(frame = ANIMATOR.current_frame) { - if(!ANIMATOR.is_playing && recoverCache()) return; + static update = function(frame = PROJECT.animator.current_frame) { + if(!PROJECT.animator.is_playing && recoverCache()) return; var _dim = inputs[| 0].getValue(); var _str = inputs[| 1].getValue(); diff --git a/scripts/node_strand_render_texture/node_strand_render_texture.gml b/scripts/node_strand_render_texture/node_strand_render_texture.gml index 93277039a..44d44096a 100644 --- a/scripts/node_strand_render_texture/node_strand_render_texture.gml +++ b/scripts/node_strand_render_texture/node_strand_render_texture.gml @@ -39,8 +39,8 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou _str.draw(_x, _y, _s); } - static update = function(frame = ANIMATOR.current_frame) { - if(!ANIMATOR.is_playing && recoverCache()) return; + static update = function(frame = PROJECT.animator.current_frame) { + if(!PROJECT.animator.is_playing && recoverCache()) return; var _dim = inputs[| 0].getValue(); var _str = inputs[| 1].getValue(); diff --git a/scripts/node_strand_update/node_strand_update.gml b/scripts/node_strand_update/node_strand_update.gml index 7b891a32e..2aa14a1f1 100644 --- a/scripts/node_strand_update/node_strand_update.gml +++ b/scripts/node_strand_update/node_strand_update.gml @@ -11,7 +11,7 @@ function Node_Strand_Update(_x, _y, _group = noone) : Node(_x, _y, _group) const outputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.output, VALUE_TYPE.strands, noone); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _str = inputs[| 0].getValue(); var _itr = inputs[| 1].getValue(); diff --git a/scripts/node_struct_json_parse/node_struct_json_parse.gml b/scripts/node_struct_json_parse/node_struct_json_parse.gml index 7ae00f9d5..a57fdfe03 100644 --- a/scripts/node_struct_json_parse/node_struct_json_parse.gml +++ b/scripts/node_struct_json_parse/node_struct_json_parse.gml @@ -11,7 +11,7 @@ function Node_Struct_JSON_Parse(_x, _y, _group = noone) : Node(_x, _y, _group) c outputs[| 0] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {} ); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _str = inputs[| 0].getValue(); var str = json_parse(_str); outputs[| 0].setValue(str); diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index 79837d8df..f40dc7ec7 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -12,7 +12,7 @@ function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constr w = 96; - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _insurf = inputs[| 0].getValue(); if(is_array(_insurf)) { var len = array_length(_insurf); diff --git a/scripts/node_switch/node_switch.gml b/scripts/node_switch/node_switch.gml index b2e844f76..02282b2df 100644 --- a/scripts/node_switch/node_switch.gml +++ b/scripts/node_switch/node_switch.gml @@ -88,7 +88,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor refreshDynamicInput(); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var sele = inputs[| 0].getValue(); var _res = inputs[| 1].getValue(); diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index 133db5a6f..62589b310 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -49,7 +49,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _rang_current = [0, 0]; static generateFont = function(_path, _size, _aa, _range) { - if(ANIMATOR.is_playing) return; + if(PROJECT.animator.is_playing) return; if(_path == _font_current && _size == _size_current && diff --git a/scripts/node_text_file_read/node_text_file_read.gml b/scripts/node_text_file_read/node_text_file_read.gml index f6cb6823d..2910f629f 100644 --- a/scripts/node_text_file_read/node_text_file_read.gml +++ b/scripts/node_text_file_read/node_text_file_read.gml @@ -84,7 +84,7 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons return false; } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); diff --git a/scripts/node_text_file_write/node_text_file_write.gml b/scripts/node_text_file_write/node_text_file_write.gml index 3ac2720ef..c8c1b0b91 100644 --- a/scripts/node_text_file_write/node_text_file_write.gml +++ b/scripts/node_text_file_write/node_text_file_write.gml @@ -25,7 +25,7 @@ function Node_Text_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con file_text_close(f); } - static update = function(frame = ANIMATOR.current_frame) { writeFile(); } + static update = function(frame = PROJECT.animator.current_frame) { writeFile(); } static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index 90fc790d1..132773fbd 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -27,7 +27,7 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc attribute_surface_depth(); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _inSurf = inputs[| 0].getValue(); var _map = inputs[| 1].getValue(); var _life = inputs[| 2].getValue(); @@ -45,11 +45,11 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc texture_set_stage(uniform_map, surface_get_texture(_map)); for(var i = 0; i <= _life; i++) { - var _frame = ANIMATOR.current_frame - i; + var _frame = PROJECT.animator.current_frame - i; if(_loop) - _frame = _frame < 0? ANIMATOR.frames_total - 1 + _frame : _frame; + _frame = _frame < 0? PROJECT.animator.frames_total - 1 + _frame : _frame; else - _frame = clamp(_frame, 0, ANIMATOR.frames_total - 1); + _frame = clamp(_frame, 0, PROJECT.animator.frames_total - 1); var s = array_safe_get(cached_output, _frame) if(!is_surface(s)) continue; diff --git a/scripts/node_timeline_preview/node_timeline_preview.gml b/scripts/node_timeline_preview/node_timeline_preview.gml index d0e600e3e..bd4650b86 100644 --- a/scripts/node_timeline_preview/node_timeline_preview.gml +++ b/scripts/node_timeline_preview/node_timeline_preview.gml @@ -10,7 +10,7 @@ function Node_Timeline_Preview(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _inSurf = inputs[| 0].getValue(); if(_inSurf == 0) return; diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index f1b19381e..7d0a59e7a 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -81,7 +81,7 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { _outUV = surface_verify(_outUV, surface_get_width(_surf), surface_get_height(_surf), cDep); outputs[| 1].setValue(_outUV); - var curf = ANIMATOR.current_frame; + var curf = PROJECT.animator.current_frame; var frame_amo = _loop? _life : min(_life, curf); var st_frame = curf - frame_amo; @@ -89,9 +89,9 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var frame_idx = st_frame + i; var prog = (frame_idx - (curf - _life)) / _life; - if(_loop && frame_idx < 0) frame_idx = ANIMATOR.frames_total + frame_idx; + if(_loop && frame_idx < 0) frame_idx = PROJECT.animator.frames_total + frame_idx; - var prev = _loop? safe_mod(frame_idx - 1 + ANIMATOR.frames_total, ANIMATOR.frames_total) : frame_idx - 1; + var prev = _loop? safe_mod(frame_idx - 1 + PROJECT.animator.frames_total, PROJECT.animator.frames_total) : frame_idx - 1; var _prevFrame = getCacheFrame(prev); var _currFrame = getCacheFrame(frame_idx); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 686719fa1..b281e59a6 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -112,9 +112,9 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) static step = function() { var pos = inputs[| 2].getValue(); - if(!ANIMATOR.frame_progress) return; + if(!PROJECT.animator.frame_progress) return; - if(ANIMATOR.current_frame == 0) { + if(PROJECT.animator.current_frame == 0) { vel = 0; prev_pos[0] = pos[0]; prev_pos[1] = pos[1]; diff --git a/scripts/node_tunnel_in/node_tunnel_in.gml b/scripts/node_tunnel_in/node_tunnel_in.gml index 57bbe15fc..9c0ebb59c 100644 --- a/scripts/node_tunnel_in/node_tunnel_in.gml +++ b/scripts/node_tunnel_in/node_tunnel_in.gml @@ -34,8 +34,8 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct var amo = ds_map_size(TUNNELS_OUT); var k = ds_map_find_first(TUNNELS_OUT); repeat(amo) { - if(TUNNELS_OUT[? k] == _key && ds_map_exists(NODE_MAP, k)) { - var node = NODE_MAP[? k]; + if(TUNNELS_OUT[? k] == _key && ds_map_exists(PROJECT.nodeMap, k)) { + var node = PROJECT.nodeMap[? k]; if(node.group != group) continue; draw_set_color(COLORS.node_blend_tunnel); @@ -53,7 +53,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct } static onClone = function() { onValueUpdate(); } - static update = function(frame = ANIMATOR.current_frame) { onValueUpdate(); } + static update = function(frame = PROJECT.animator.current_frame) { onValueUpdate(); } static resetMap = function() { var _key = inputs[| 0].getValue(); @@ -90,15 +90,15 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct var amo = ds_map_size(TUNNELS_IN_MAP); var k = ds_map_find_first(TUNNELS_IN_MAP); repeat(amo) { - if(ds_map_exists(NODE_MAP, k) && struct_has(NODE_MAP[? k], "resetMap")) - NODE_MAP[? k].resetMap(); + if(ds_map_exists(PROJECT.nodeMap, k) && struct_has(PROJECT.nodeMap[? k], "resetMap")) + PROJECT.nodeMap[? k].resetMap(); k = ds_map_find_next(TUNNELS_IN_MAP, k); } var k = ds_map_find_first(TUNNELS_IN_MAP); repeat(amo) { - if(ds_map_exists(NODE_MAP, k) && struct_has(NODE_MAP[? k], "checkDuplicate")) - NODE_MAP[? k].checkDuplicate(); + if(ds_map_exists(PROJECT.nodeMap, k) && struct_has(PROJECT.nodeMap[? k], "checkDuplicate")) + PROJECT.nodeMap[? k].checkDuplicate(); k = ds_map_find_next(TUNNELS_IN_MAP, k); } @@ -132,8 +132,8 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct repeat(amo) { if(TUNNELS_OUT[? k] == _key) { - array_push(nodes, NODE_MAP[? k]); - array_push(nodeNames, NODE_MAP[? k].internalName); + array_push(nodes, PROJECT.nodeMap[? k]); + array_push(nodeNames, PROJECT.nodeMap[? k].internalName); } k = ds_map_find_next(TUNNELS_OUT, k); diff --git a/scripts/node_tunnel_out/node_tunnel_out.gml b/scripts/node_tunnel_out/node_tunnel_out.gml index db9323a9e..802b7133e 100644 --- a/scripts/node_tunnel_out/node_tunnel_out.gml +++ b/scripts/node_tunnel_out/node_tunnel_out.gml @@ -74,7 +74,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _key = inputs[| 0].getValue(); if(ds_map_exists(TUNNELS_IN, _key)) diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 4314c211b..97221fb17 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1012,7 +1012,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return value; } - static getValue = function(_time = ANIMATOR.current_frame, applyUnit = true, arrIndex = 0, useCache = true) { + static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = true) { if(type == VALUE_TYPE.trigger) useCache = false; @@ -1036,7 +1036,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return val; } - static __getAnimValue = function(_time = ANIMATOR.current_frame) { + static __getAnimValue = function(_time = PROJECT.animator.current_frame) { if(sep_axis) { var val = []; for( var i = 0; i < array_length(animators); i++ ) @@ -1046,7 +1046,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return animator.getValue(_time); } - static _getValue = function(_time = ANIMATOR.current_frame, applyUnit = true, arrIndex = 0) { + static _getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0) { var _val = getValueRecursive(_time); var val = _val[0]; var nod = _val[1]; @@ -1097,7 +1097,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return val; } - static getValueRecursive = function(_time = ANIMATOR.current_frame) { + static getValueRecursive = function(_time = PROJECT.animator.current_frame) { var val = [ -1, self ]; if(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger even will not propagate from input to output, need to be done manually @@ -1200,7 +1200,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return array_length(ar); } - static setValue = function(val = 0, record = true, time = ANIMATOR.current_frame, _update = true) { + static setValue = function(val = 0, record = true, time = PROJECT.animator.current_frame, _update = true) { //if(type == VALUE_TYPE.d3vertex && !is_array(val)) // print(val); @@ -1208,7 +1208,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return setValueDirect(val, noone, record, time, _update); } - static setValueDirect = function(val = 0, index = noone, record = true, time = ANIMATOR.current_frame, _update = true) { + static setValueDirect = function(val = 0, index = noone, record = true, time = PROJECT.animator.current_frame, _update = true) { var updated = false; if(sep_axis) { @@ -1244,7 +1244,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(!LOADING) { //print("setValueDirect"); - MODIFIED = true; + PROJECT.modified = true; } } @@ -1344,7 +1344,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru draw_line_shift_x = 0; draw_line_shift_y = 0; - if(!LOADING) MODIFIED = true; + if(!LOADING) PROJECT.modified = true; return true; } @@ -1717,13 +1717,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return true; } - if(!ds_map_exists(NODE_MAP, _node)) { + if(!ds_map_exists(PROJECT.nodeMap, _node)) { var txt = $"Node connect error : Node ID {_node} not found."; log_warning("LOAD", $"[Connect] {txt}", node); return false; } - var _nd = NODE_MAP[? _node]; + var _nd = PROJECT.nodeMap[? _node]; var _ol = ds_list_size(_nd.outputs); if(log) 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 2d6832dd5..120b3b6da 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -39,8 +39,8 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 1] = nodeValue("Sync lenght", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.button, [ function() { if(content == noone) return; - var frm = max(1, floor(content.duration * ANIMATOR.framerate)); - ANIMATOR.frames_total = frm; + var frm = max(1, floor(content.duration * PROJECT.animator.framerate)); + PROJECT.animator.frames_total = frm; }, "Sync"]) .rejectArray(); @@ -165,7 +165,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const printIf(global.FLAG.wav_import, "-- Creating preview buffer..."); - var frm = floor(content.duration * ANIMATOR.framerate); + var frm = floor(content.duration * PROJECT.animator.framerate); inputs[| 1].editWidget.text = $"Sync ({frm} frames)"; var bufferId = buffer_create(content.packet * 2, buffer_fixed, 1); @@ -210,23 +210,23 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const insp2UpdateIcon[2] = attributes.play? COLORS._main_icon_light : COLORS._main_icon; if(preview_audio == -1) return; - if(audio_is_playing(preview_audio) && !ANIMATOR.is_playing) + if(audio_is_playing(preview_audio) && !PROJECT.animator.is_playing) audio_stop_sound(preview_audio); if(!attributes.play) return; - if(ANIMATOR.is_playing) { - if(ANIMATOR.current_frame == 0) + if(PROJECT.animator.is_playing) { + if(PROJECT.animator.current_frame == 0) audio_stop_sound(preview_audio); - var dur = ANIMATOR.current_frame / ANIMATOR.framerate - attributes.preview_shift; + var dur = PROJECT.animator.current_frame / PROJECT.animator.framerate - attributes.preview_shift; if(!audio_is_playing(preview_audio)) audio_play_sound(preview_audio, 1, false, attributes.preview_gain, dur); - else if(ANIMATOR.frame_progress) + else if(PROJECT.animator.frame_progress) audio_sound_set_track_position(preview_audio, dur); } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var path = inputs[| 0].getValue(); if(path == "") return; @@ -234,8 +234,8 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const checkPreview(); var len = content.packet; - var amp_ind = round(frame * content.sample / ANIMATOR.framerate); - var amp_win = content.sample / ANIMATOR.framerate; + var amp_ind = round(frame * content.sample / PROJECT.animator.framerate); + var amp_win = content.sample / PROJECT.animator.framerate; var amp_st = clamp(amp_ind - amp_win, 0, len); var amp_ed = clamp(amp_ind + amp_win, 0, len); @@ -273,7 +273,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const bbox.yc - sh * ss / 2, ss, ss,,, 0.50); - var wd = (ANIMATOR.current_frame / ANIMATOR.framerate) / content.duration * sw; + var wd = (PROJECT.animator.current_frame / PROJECT.animator.framerate) / content.duration * sw; draw_surface_part_ext_safe(audio_surface, 0, 0, min(wd, sw), sh, bbox.xc - sw * ss / 2, bbox.yc - sh * ss / 2, @@ -291,7 +291,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_set_color(COLORS._main_icon_dark); draw_set_alpha(1); - var _st = round(content.sample / ANIMATOR.framerate); //sample per frame + var _st = round(content.sample / PROJECT.animator.framerate); //sample per frame var _am = content.packet / _st; var ox, oy, nx, ny; diff --git a/scripts/node_websocket_receiver/node_websocket_receiver.gml b/scripts/node_websocket_receiver/node_websocket_receiver.gml index 9e90c52bb..6180fedf4 100644 --- a/scripts/node_websocket_receiver/node_websocket_receiver.gml +++ b/scripts/node_websocket_receiver/node_websocket_receiver.gml @@ -90,7 +90,7 @@ function Node_Websocket_Receiver(_x, _y, _group = noone) : Node(_x, _y, _group) } } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { if(CLONING) return; var _port = inputs[| 0].getValue(); diff --git a/scripts/node_websocket_sender/node_websocket_sender.gml b/scripts/node_websocket_sender/node_websocket_sender.gml index c9118ae4a..f443126ae 100644 --- a/scripts/node_websocket_sender/node_websocket_sender.gml +++ b/scripts/node_websocket_sender/node_websocket_sender.gml @@ -83,7 +83,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 6].setVisible(_type == 3, _type == 3); } - static update = function(frame = ANIMATOR.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { var _port = inputs[| 0].getValue(); var _target = inputs[| 5].getValue(); diff --git a/scripts/node_wiggler/node_wiggler.gml b/scripts/node_wiggler/node_wiggler.gml index 4851f639e..cc4ec022d 100644 --- a/scripts/node_wiggler/node_wiggler.gml +++ b/scripts/node_wiggler/node_wiggler.gml @@ -30,18 +30,18 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var fre = getSingleValue(1); var sed = getSingleValue(2); - var step = ANIMATOR.frames_total / 64; + var step = PROJECT.animator.frames_total / 64; for( var i = 0; i < 64; i++ ) - random_value[i] = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, step * i, sed, 0, ANIMATOR.frames_total); + random_value[i] = getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, step * i, sed, 0, PROJECT.animator.frames_total); } function process_data(_output, _data, _output_index, _array_index = 0) { var ran = _data[0]; var fre = _data[1]; var sed = _data[2]; - var time = ANIMATOR.current_frame; + var time = PROJECT.animator.current_frame; - return getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, time, sed, 0, ANIMATOR.frames_total); + return getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, time, sed, 0, PROJECT.animator.frames_total); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { @@ -49,15 +49,15 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var fre = array_safe_get(current_data, 1); var sed = array_safe_get(current_data, 2); var disp = array_safe_get(current_data, 3); - var time = ANIMATOR.current_frame; - var total_time = ANIMATOR.frames_total; + var time = PROJECT.animator.current_frame; + var total_time = PROJECT.animator.frames_total; switch(disp) { case 0 : w = 96; draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); - var str = getWiggle(ran[0], ran[1], ANIMATOR.frames_total / fre, time, sed, 0, ANIMATOR.frames_total); + var str = getWiggle(ran[0], ran[1], PROJECT.animator.frames_total / fre, time, sed, 0, PROJECT.animator.frames_total); var ss = string_scale(str, (w - 16) * _s, (h - 16) * _s - 20 * draw_name); draw_text_transformed(xx + w / 2 * _s, yy + 10 + h / 2 * _s, str, ss, ss, 0); break; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index fd2f9e394..681e27221 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -80,63 +80,63 @@ function Panel_Animation() : PanelContent() constructor { anim_properties = ds_list_create(); - prev_cache = array_create(ANIMATOR.frames_total); + prev_cache = array_create(PROJECT.animator.frames_total); control_buttons = [ [ function() { return __txt("Stop"); }, function() { return 4; }, - function() { return ANIMATOR.is_playing? COLORS._main_accent : COLORS._main_icon; }, - function() { ANIMATOR.stop(); } ], - [ function() { return ANIMATOR.is_playing? __txt("Pause") : __txt("Play"); }, - function() { return !ANIMATOR.is_playing; }, - function() { return ANIMATOR.is_playing? COLORS._main_accent : COLORS._main_icon; }, + function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; }, + function() { PROJECT.animator.stop(); } ], + [ function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play"); }, + function() { return !PROJECT.animator.is_playing; }, + function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; }, function() { - if(ANIMATOR.is_playing) ANIMATOR.pause(); - else ANIMATOR.resume(); + if(PROJECT.animator.is_playing) PROJECT.animator.pause(); + else PROJECT.animator.resume(); } ], [ function() { return __txtx("panel_animation_go_to_first_frame", "Go to first frame"); }, function() { return 3; }, function() { return COLORS._main_icon; }, - function() { ANIMATOR.setFrame(0); } + function() { PROJECT.animator.setFrame(0); } ], [ function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); }, function() { return 2; }, function() { return COLORS._main_icon; }, - function() { ANIMATOR.setFrame(ANIMATOR.frames_total - 1); } + function() { PROJECT.animator.setFrame(PROJECT.animator.frames_total - 1); } ], [ function() { return __txtx("panel_animation_previous_frame", "Previous frame"); }, function() { return 5; }, function() { return COLORS._main_icon; }, - function() { ANIMATOR.setFrame(ANIMATOR.real_frame - 1); } + function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame - 1); } ], [ function() { return __txtx("panel_animation_next_frame", "Next frame"); }, function() { return 6; }, function() { return COLORS._main_icon; }, - function() { ANIMATOR.setFrame(ANIMATOR.real_frame + 1); } + function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); } ], ]; addHotkey("", "Play/Pause", vk_space, MOD_KEY.none, function() { - ANIMATOR.is_playing = !ANIMATOR.is_playing; - ANIMATOR.current_frame = -1; - ANIMATOR.time_since_last_frame = 0; + PROJECT.animator.is_playing = !PROJECT.animator.is_playing; + PROJECT.animator.current_frame = -1; + PROJECT.animator.time_since_last_frame = 0; - if(ANIMATOR.is_playing && ANIMATOR.frames_total) { - ANIMATOR.setFrame(0); - ANIMATOR.frame_progress = true; + if(PROJECT.animator.is_playing && PROJECT.animator.frames_total) { + PROJECT.animator.setFrame(0); + PROJECT.animator.frame_progress = true; } }); - addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift, function() { if(ANIMATOR.is_playing) ANIMATOR.pause() else ANIMATOR.resume(); }); + addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift, function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); }); - addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { ANIMATOR.setFrame(0); }); - addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { ANIMATOR.setFrame(ANIMATOR.frames_total - 1); }); + addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { PROJECT.animator.setFrame(0); }); + addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { PROJECT.animator.setFrame(PROJECT.animator.frames_total - 1); }); addHotkey("", "Next frame", vk_right, MOD_KEY.none, function() { - ANIMATOR.setFrame(min(ANIMATOR.real_frame + 1, ANIMATOR.frames_total - 1)); + PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, PROJECT.animator.frames_total - 1)); }); addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() { - ANIMATOR.setFrame(max(ANIMATOR.real_frame - 1, 0)); + PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); }); addHotkey("Animation", "Delete keys", vk_delete, MOD_KEY.none, function() { PANEL_ANIMATION.deleteKeys(); }); addHotkey("Animation", "Duplicate", "D", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doDuplicate(); }); @@ -375,15 +375,15 @@ function Panel_Animation() : PanelContent() constructor { function updatePropertyList() { ds_list_destroy(anim_properties); - var amo = ds_map_size(NODE_MAP); - var k = ds_map_find_first(NODE_MAP); + var amo = ds_map_size(PROJECT.nodeMap); + var k = ds_map_find_first(PROJECT.nodeMap); var pr = ds_priority_create(); - updatePropertyNode(pr, GLOBAL_NODE); + updatePropertyNode(pr, PROJECT.globalNode); repeat(amo) { - var _node = NODE_MAP[? k]; - k = ds_map_find_next(NODE_MAP, k); + var _node = PROJECT.nodeMap[? k]; + k = ds_map_find_next(PROJECT.nodeMap, k); if(!_node.active) continue; updatePropertyNode(pr, _node); @@ -398,7 +398,7 @@ function Panel_Animation() : PanelContent() constructor { var bar_y = h - timeline_h - ui(10); var bar_w = timeline_w; var bar_h = timeline_h; - var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale); + var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); var inspecting = PANEL_INSPECTOR.inspecting; resetTimelineMask(); @@ -409,13 +409,13 @@ function Panel_Animation() : PanelContent() constructor { #region bg draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h); - var __w = timeline_shift + ANIMATOR.frames_total * ui(timeline_scale) + PANEL_PAD; + var __w = timeline_shift + PROJECT.animator.frames_total * ui(timeline_scale) + PANEL_PAD; draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, min(__w, timeline_w), bar_h, COLORS.panel_animation_timeline_blend, 1); if(inspecting) inspecting.drawAnimationTimeline(timeline_shift, bar_w, bar_h, timeline_scale); - for(var i = timeline_separate; i <= ANIMATOR.frames_total; i += timeline_separate) { + for(var i = timeline_separate; i <= PROJECT.animator.frames_total; i += timeline_separate) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_color(COLORS.panel_animation_frame_divider); draw_line(bar_line_x, ui(12), bar_line_x, bar_h - PANEL_PAD); @@ -424,18 +424,18 @@ function Panel_Animation() : PanelContent() constructor { draw_text_add(bar_line_x, ui(16), string(i)); } - var bar_line_x = (ANIMATOR.current_frame + 1) * ui(timeline_scale) + timeline_shift; - var cc = ANIMATOR.is_playing? COLORS._main_value_positive : COLORS._main_accent; + var bar_line_x = (PROJECT.animator.current_frame + 1) * ui(timeline_scale) + timeline_shift; + var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent; draw_set_color(cc); draw_line(bar_line_x, ui(12), bar_line_x, bar_h - PANEL_PAD); draw_set_text(f_p2, fa_center, fa_bottom, cc); - draw_text_add(bar_line_x, ui(16), string(ANIMATOR.current_frame + 1)); + draw_text_add(bar_line_x, ui(16), string(PROJECT.animator.current_frame + 1)); #endregion #region cache if(inspecting && inspecting.use_cache) { - for(var i = 0; i < ANIMATOR.frames_total; i++) { + for(var i = 0; i < PROJECT.animator.frames_total; i++) { if(i >= array_length(inspecting.cache_result)) break; @@ -485,8 +485,8 @@ function Panel_Animation() : PanelContent() constructor { if(timeline_scubbing) { var rfrm = (mx - bar_x - timeline_shift) / ui(timeline_scale) - 1; - ANIMATOR.setFrame(clamp(rfrm, 0, ANIMATOR.frames_total - 1)); - timeline_show_time = ANIMATOR.current_frame; + PROJECT.animator.setFrame(clamp(rfrm, 0, PROJECT.animator.frames_total - 1)); + timeline_show_time = PROJECT.animator.current_frame; if(timeline_show_time != _scrub_frame) { _scrub_frame = timeline_show_time; @@ -543,7 +543,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_scubbing = true; - timeline_scub_st = ANIMATOR.current_frame; + timeline_scub_st = PROJECT.animator.current_frame; _scrub_frame = timeline_scub_st; } } @@ -551,7 +551,7 @@ function Panel_Animation() : PanelContent() constructor { if(pHOVER && point_in_rectangle(mx, my, bar_x, 8, bar_x + min(timeline_w, timeline_shift + bar_total_w), 8 + 16)) { //top bar if(mouse_press(mb_left, pFOCUS)) { timeline_scubbing = true; - timeline_scub_st = ANIMATOR.current_frame; + timeline_scub_st = PROJECT.animator.current_frame; _scrub_frame = timeline_scub_st; } } @@ -566,7 +566,7 @@ function Panel_Animation() : PanelContent() constructor { } function drawDopesheetLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) { - var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale); + var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); var bar_show_w = timeline_shift + bar_total_w; var hovering = noone; var _gy_top = key_y + ui(16); @@ -688,7 +688,7 @@ function Panel_Animation() : PanelContent() constructor { var key_last = animator.values[| ds_list_size(animator.values) - 1]; var t_last = (key_last.time + 1) * ui(timeline_scale) + timeline_shift; - if(key_last.time < ANIMATOR.frames_total) { + if(key_last.time < PROJECT.animator.frames_total) { if(valArray) { for( var ki = 0; ki < array_length(key_last.value); ki++ ) { draw_set_color(COLORS.axis[ki]); @@ -708,7 +708,7 @@ function Panel_Animation() : PanelContent() constructor { } function drawDopesheetGraph(prop, key_y, msx, msy) { - var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale); + var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); var bar_show_w = timeline_shift + bar_total_w; var _gy_top = key_y + ui(16); var _gy_bottom = _gy_top + prop.graph_h - ui(8); @@ -742,7 +742,7 @@ function Panel_Animation() : PanelContent() constructor { } key_next = prop.animator.values[| ds_list_size(prop.animator.values) - 1]; - if(key_next.time < ANIMATOR.frames_total) { + if(key_next.time < PROJECT.animator.frames_total) { draw_set_color(key_next.value); draw_rectangle(key_next.dopesheet_x, _gy_top, bar_show_w, _gy_bottom, 0); } @@ -788,10 +788,10 @@ function Panel_Animation() : PanelContent() constructor { var _t = -1; for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time < ANIMATOR.current_frame) + if(_key.time < PROJECT.animator.current_frame) _t = _key.time; } - if(_t > -1) ANIMATOR.setFrame(_t); + if(_t > -1) PROJECT.animator.setFrame(_t); } } else draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon_on_inner, 1); @@ -803,8 +803,8 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time > ANIMATOR.current_frame) { - ANIMATOR.setFrame(_key.time); + if(_key.time > PROJECT.animator.current_frame) { + PROJECT.animator.setFrame(_key.time); break; } } @@ -822,18 +822,18 @@ function Panel_Animation() : PanelContent() constructor { var _add = false; for(var k = 0; k < ds_list_size(animator.values); k++) { var _key = animator.values[| k]; - if(_key.time == ANIMATOR.current_frame) { + if(_key.time == PROJECT.animator.current_frame) { if(ds_list_size(animator.values) > 1) ds_list_delete(animator.values, k); _add = true; break; - } else if(_key.time > ANIMATOR.current_frame) { - ds_list_insert(animator.values, k, new valueKey(ANIMATOR.current_frame, animator.getValue(), animator)); + } else if(_key.time > PROJECT.animator.current_frame) { + ds_list_insert(animator.values, k, new valueKey(PROJECT.animator.current_frame, animator.getValue(), animator)); _add = true; break; } } - if(!_add) ds_list_add(animator.values, new valueKey(ANIMATOR.current_frame, animator.getValue(, false), animator)); + if(!_add) ds_list_add(animator.values, new valueKey(PROJECT.animator.current_frame, animator.getValue(, false), animator)); } } else draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent); @@ -907,7 +907,7 @@ function Panel_Animation() : PanelContent() constructor { for( var i = 0; i < ds_list_size(anim_properties); i++ ) { _node = anim_properties[| i]; - var _inContext = _node == GLOBAL_NODE || _node.group == PANEL_GRAPH.getCurrentContext(); + var _inContext = _node == PROJECT.globalNode || _node.group == PANEL_GRAPH.getCurrentContext(); var aa = _inContext? 1 : 0.9; var _node_y = _node.dopesheet_y; @@ -1130,7 +1130,7 @@ function Panel_Animation() : PanelContent() constructor { var bar_y = h - timeline_h - ui(10); var bar_w = timeline_w; var bar_h = timeline_h; - var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale); + var bar_total_w = PROJECT.animator.frames_total * ui(timeline_scale); if(!is_surface(dope_sheet_surface) || !surface_exists(dope_sheet_surface)) dope_sheet_surface = surface_create_valid(dope_sheet_w, dope_sheet_h); @@ -1240,7 +1240,7 @@ function Panel_Animation() : PanelContent() constructor { dope_sheet_y_max = max(0, dope_sheet_y_max - dope_sheet_h + ui(48)); - for(var i = timeline_sep_line; i <= ANIMATOR.frames_total; i += timeline_sep_line) { + for(var i = timeline_sep_line; i <= PROJECT.animator.frames_total; i += timeline_sep_line) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_color(COLORS.panel_animation_frame_divider); draw_set_alpha(i % timeline_separate == 0? 1 : 0.1); @@ -1257,7 +1257,7 @@ function Panel_Animation() : PanelContent() constructor { var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2; len = max(1, len); TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len); - ANIMATOR.frames_total = len; + PROJECT.animator.frames_total = len; if(mouse_release(mb_left)) timeline_stretch = 0; @@ -1267,14 +1267,14 @@ function Panel_Animation() : PanelContent() constructor { var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2; len = max(1, len); TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len); - var _len = ANIMATOR.frames_total; - ANIMATOR.frames_total = len; + var _len = PROJECT.animator.frames_total; + PROJECT.animator.frames_total = len; if(_len != len) { - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var n = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { + var n = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(!n || !n.active) continue; for(var i = 0; i < ds_list_size(n.inputs); i++) { @@ -1307,7 +1307,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_stretch = 2; timeline_stretch_mx = msx; - timeline_stretch_sx = ANIMATOR.frames_total; + timeline_stretch_sx = PROJECT.animator.frames_total; } } else { draw_sprite_ui(THEME.animation_stretch, 0, stx, sty, 1, 1, 0, COLORS._main_icon, 1); @@ -1315,7 +1315,7 @@ function Panel_Animation() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) { timeline_stretch = 1; timeline_stretch_mx = msx; - timeline_stretch_sx = ANIMATOR.frames_total; + timeline_stretch_sx = PROJECT.animator.frames_total; } } } else @@ -1519,20 +1519,20 @@ function Panel_Animation() : PanelContent() constructor { draw_set_color(COLORS.panel_animation_timeline_top); draw_rectangle(PANEL_PAD, PANEL_PAD, ww - 1, hh, false); - for(var i = timeline_separate; i <= ANIMATOR.frames_total; i += timeline_separate) { + for(var i = timeline_separate; i <= PROJECT.animator.frames_total; i += timeline_separate) { var bar_line_x = i * ui(timeline_scale) + timeline_shift; draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub); draw_text_add(bar_line_x - ui(2), PANEL_PAD, string(i)); } - var bar_line_x = (ANIMATOR.current_frame + 1) * ui(timeline_scale) + timeline_shift; - var cc = ANIMATOR.is_playing? COLORS._main_value_positive : COLORS._main_accent; + var bar_line_x = (PROJECT.animator.current_frame + 1) * ui(timeline_scale) + timeline_shift; + var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent; draw_set_color(cc); draw_set_font(f_p2); draw_line(bar_line_x, PANEL_PAD, bar_line_x, dope_sheet_h); - var cf = string(ANIMATOR.current_frame + 1); + var cf = string(PROJECT.animator.current_frame + 1); var tx = string_width(cf) + ui(4); draw_rectangle(bar_line_x - tx, PANEL_PAD, bar_line_x, hh, false); @@ -1601,29 +1601,29 @@ function Panel_Animation() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), y0, w - ui(16), y1 - y0); var pw = w - ui(16); - var px = ui(8) + pw * (ANIMATOR.current_frame / ANIMATOR.frames_total); + var px = ui(8) + pw * (PROJECT.animator.current_frame / PROJECT.animator.frames_total); draw_set_color(COLORS._main_accent); draw_line(px, y0, px, y1); if(point_in_rectangle(mx, my, ui(8), y0, w - ui(16), y1)) { if(mouse_click(mb_left, pFOCUS)) { - var rfrm = (mx - ui(8)) / (w - ui(16)) * ANIMATOR.frames_total; - ANIMATOR.setFrame(clamp(rfrm, 0, ANIMATOR.frames_total - 1)); + var rfrm = (mx - ui(8)) / (w - ui(16)) * PROJECT.animator.frames_total; + PROJECT.animator.setFrame(clamp(rfrm, 0, PROJECT.animator.frames_total - 1)); } } - var txt = string(ANIMATOR.current_frame + 1) + "/" + string(ANIMATOR.frames_total); + var txt = string(PROJECT.animator.current_frame + 1) + "/" + string(PROJECT.animator.frames_total); if(y1 - y0 < ui(40)) { draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub); draw_text_add(ui(16), cy, __txt("Frame")); - draw_set_text(f_p1, fa_right, fa_center, ANIMATOR.is_playing? COLORS._main_accent : COLORS._main_text_sub); + draw_set_text(f_p1, fa_right, fa_center, PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_text_sub); draw_text_add(w - ui(16), cy, txt); } else { draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub); draw_text_add(w / 2, cy - ui(12), __txt("Frame")); - draw_set_text(f_h5, fa_center, fa_center, ANIMATOR.is_playing? COLORS._main_accent : COLORS._main_text_sub); + draw_set_text(f_h5, fa_center, fa_center, PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_text_sub); draw_text_add(w / 2, cy + ui(6), txt); } return; @@ -1674,7 +1674,7 @@ function Panel_Animation() : PanelContent() constructor { drawAnimationControl(); if(timeline_show_time > -1) { - TOOLTIP = __txt("Frame") + " " + string(timeline_show_time + 1) + "/" + string(ANIMATOR.frames_total); + TOOLTIP = __txt("Frame") + " " + string(timeline_show_time + 1) + "/" + string(PROJECT.animator.frames_total); timeline_show_time = -1; } } @@ -1707,10 +1707,10 @@ function Panel_Animation() : PanelContent() constructor { if(ds_list_empty(copy_clipboard)) return; var shf = 0; - var minx = ANIMATOR.frames_total + 2; + var minx = PROJECT.animator.frames_total + 2; for( var i = 0; i < ds_list_size(copy_clipboard); i++ ) minx = min(minx, copy_clipboard[| i].time); - shf = ANIMATOR.current_frame - minx; + shf = PROJECT.animator.current_frame - minx; var multiVal = false; var _val = noone; diff --git a/scripts/panel_array_sequence/panel_array_sequence.gml b/scripts/panel_array_sequence/panel_array_sequence.gml index b405c8306..9eba68c79 100644 --- a/scripts/panel_array_sequence/panel_array_sequence.gml +++ b/scripts/panel_array_sequence/panel_array_sequence.gml @@ -96,7 +96,7 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { } else draw_sprite_ui(THEME.animation_stretch, 0, ax, ay,,,,, 0.75); - for( var i = 0; i < ANIMATOR.frames_total; i++ ) { + for( var i = 0; i < PROJECT.animator.frames_total; i++ ) { var _sx = sequence_x + i * _ns; draw_set_color(COLORS._main_text_sub); diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index ad0282c3c..7409d3119 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -227,7 +227,7 @@ function Panel_Collection() : PanelContent() constructor { } } - if(meta.version != SAVEFILE_VERSION) { + if(meta.version != SAVE_VERSION) { draw_set_color(COLORS._main_accent); draw_circle_prec(_boxx + grid_size - ui(8), yy + grid_size - ui(8), 3, false); } diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index edf648e67..78788db0b 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -51,8 +51,9 @@ function Panel(_parent, _x, _y, _w, _h) constructor { tab_holding_sy = 0; border_rb_close = menuItem(__txt("Close"), function() { - extract(); - o_main.panel_dragging = noone; + var con = getContent(); + if(con == noone) return; + con.close(); }, THEME.cross); border_rb_menu = [ @@ -212,7 +213,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { for( var i = 0; i < array_length(content); i++ ) content[i].onSetPanel(self); - if(_switch) content_index = array_find(content, _content); + if(_switch) setTab(array_find(content, _content)); refresh(); } @@ -471,12 +472,14 @@ function Panel(_parent, _x, _y, _w, _h) constructor { tab_x = lerp_float(tab_x, tab_x_to, 5); tab_width = 0; + var rem = -1; + draw_set_text(f_p3, fa_left, fa_bottom, COLORS._main_text_sub); for( var i = 0; i < array_length(content); i++ ) { var txt = content[i].title; var icn = content[i].icon; - var tbw = string_width(txt) + ui(16); + var tbw = string_width(txt) + ui(16 + 16); if(icn != noone) tbw += ui(16 + 4); var foc = false; @@ -510,7 +513,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { if(HOVER == self && _hov) { if(mouse_press(mb_left, FOCUS == self)) { - content_index = i; + setTab(i); tab_holding = content[i]; tab_hold_state = 0; @@ -527,13 +530,23 @@ function Panel(_parent, _x, _y, _w, _h) constructor { menuCall("panel_border_menu",,, menu); } - if(DRAGGING) { - content_index = i; - } + if(mouse_press(mb_middle, FOCUS == self)) + rem = i; + + if(DRAGGING) + setTab(i); } + var aa = 0.5; + if(point_in_rectangle(msx, msy, _tbx + tbw - ui(16), tby, _tbx + tbw, tab_height)) { + aa = 1; + if(mouse_press(mb_left, FOCUS == self)) + rem = i; + } + draw_sprite_ui(THEME.tab_exit, 0, _tbx + tbw - ui(12), tab_height / 2 + 1,,,, foc? COLORS.panel_tab_icon : COLORS._main_text_sub, aa); + if(icn != noone) { - draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + ui(1),,,, foc? COLORS.panel_tab_icon : COLORS._main_text_sub); + draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + 1,,,, foc? COLORS.panel_tab_icon : COLORS._main_text_sub); _tbx += ui(20); } @@ -543,6 +556,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor { tbx += tbw + ui(2); } + if(rem > -1) content[rem].close(); + tab_width = max(0, tab_width - w + ui(32)); if(point_in_rectangle(msx, msy, 0, 0, w, tab_height)) { if(mouse_wheel_up()) tab_x_to = clamp(tab_x_to + ui(64) * SCROLL_SPEED, -tab_width, 0); @@ -555,13 +570,14 @@ function Panel(_parent, _x, _y, _w, _h) constructor { var _tbx = tab_holding.tab_x; var txt = tab_holding.title; var icn = tab_holding.icon; - var tbw = string_width(txt) + ui(16); + var tbw = string_width(txt) + ui(16 + 16); if(icn != noone) tbw += ui(16 + 4); draw_sprite_stretched_ext(THEME.ui_panel_tab, 2, _tbx, tby, tbw, tbh, COLORS._main_accent, 1); + draw_sprite_ui(THEME.tab_exit, 0, _tbx + tbw - ui(12), tab_height / 2 + 1,,,, COLORS.panel_tab_icon); if(icn != noone) { - draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + ui(1),,,, COLORS.panel_tab_icon); + draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + 1,,,, COLORS.panel_tab_icon); _tbx += ui(20); } draw_set_text(f_p3, fa_left, fa_bottom, COLORS.panel_tab_text); @@ -580,7 +596,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { array_remove(content, tab_holding); array_insert(content, tabHov, tab_holding); - content_index = array_find(content, tab_holding); + setTab(array_find(content, tab_holding)); if(abs(msy - tab_holding_my) > ui(32)) { extract(); @@ -596,6 +612,19 @@ function Panel(_parent, _x, _y, _w, _h) constructor { draw_surface(tab_surface, tsx, tsy); } + function setTab(tabIndex) { + if(tabIndex < 0) return; + if(tabIndex >= array_length(content)) return; + + var prec = array_safe_get(content, content_index); + if(prec) prec.onFocusEnd(); + + content_index = tabIndex; + + var prec = array_safe_get(content, content_index); + if(prec) prec.onFocusBegin(); + } + function drawPanel() { if(w <= ui(16)) return; var tab = array_length(content) > 1; @@ -679,7 +708,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor { array_remove(content, con); refresh(); - content_index = 0; + setTab(0); HOVER = noone; FOCUS = noone; @@ -777,16 +806,15 @@ function Panel(_parent, _x, _y, _w, _h) constructor { } } - function remove() { - var con = getContent(); + function remove(con = getContent()) { array_remove(content, con); if(con) con.onClose(); - content_index = 0; + setTab(0); refresh(); if(hasContent()) return; if(parent == noone) { - show_message("What are you trying to do!"); + show_message("Can't close main panel."); return; } @@ -882,6 +910,10 @@ function PanelContent() constructor { function drawGUI() {} + function close() { + panel.remove(self); + } + function onClose() {} } diff --git a/scripts/panel_function/panel_function.gml b/scripts/panel_function/panel_function.gml index 06ea41f77..44bb06224 100644 --- a/scripts/panel_function/panel_function.gml +++ b/scripts/panel_function/panel_function.gml @@ -170,6 +170,30 @@ return _res; } + function findPanels(_type, _pane = PANEL_MAIN) { + return _findPanels(_type, _pane, []); + } + + function _findPanels(_type, _pane, _arr = []) { + if(instanceof(_pane) != "Panel") + return _res; + if(!ds_exists(_pane.childs, ds_type_list)) + return _res; + + if(ds_list_size(_pane.childs) == 0) { + for( var i = 0; i < array_length(_pane.content); i++ ) + if(instanceof(_pane.content[i]) == _type) { + array_append(_arr, _pane.content[i]); + return _arr; + } + } + + for(var i = 0; i < ds_list_size(_pane.childs); i++) + _arr = _findPanels(_type, _pane.childs[| i], _arr); + + return _arr; + } + function panelInit() { panel_dragging = noone; panel_hovering = noone; diff --git a/scripts/panel_globalvar/panel_globalvar.gml b/scripts/panel_globalvar/panel_globalvar.gml index 0149acceb..5137ec3f7 100644 --- a/scripts/panel_globalvar/panel_globalvar.gml +++ b/scripts/panel_globalvar/panel_globalvar.gml @@ -52,7 +52,7 @@ function Panel_Globalvar() : PanelContent() constructor { var by = title_height / 2 - ui(16 + !in_dialog * 2); if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_globalvar_add", "Add variable"), THEME.add, 1, COLORS._main_value_positive) == 2) - GLOBAL_NODE.createValue(); + PROJECT.globalNode.createValue(); bx -= ui(32 + 4); if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Edit"), var_editing? THEME.accept : THEME.gear,,,, 0.9) == 2) diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 67270edd0..eeee1bf82 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1,8 +1,16 @@ -function Panel_Graph() : PanelContent() constructor { +/// @desc Panel for displaying node graph +/// @param {Struct.Project} +function Panel_Graph(project = PROJECT) : PanelContent() constructor { title = __txt("Graph"); context_str = "Graph"; icon = THEME.panel_graph; + static setProject = function(project) { + self.project = project; + nodes_list = project.nodes; + } + setProject(project); + scale = [ 0.01, 0.02, 0.05, 0.10, 0.15, 0.20, 0.25, 0.33, 0.5, 0.65, 0.8, 1, 1.2, 1.35, 1.5, 2.0]; graph_s_index = array_find(scale, 1); graph_s = 1; @@ -27,7 +35,6 @@ function Panel_Graph() : PanelContent() constructor { mouse_grid_y = 0; mouse_on_graph = false; - nodes_list = NODES; node_context = ds_list_create(); node_dragging = noone; @@ -247,6 +254,7 @@ function Panel_Graph() : PanelContent() constructor { function onFocusBegin() { PANEL_GRAPH = self; + PROJECT = project; PANEL_ANIMATION.updatePropertyList(); } @@ -393,6 +401,7 @@ function Panel_Graph() : PanelContent() constructor { var log = false; var t = current_time; + for(var i = 0; i < ds_list_size(nodes_list); i++) { nodes_list[| i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); nodes_list[| i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); @@ -539,7 +548,7 @@ function Panel_Graph() : PanelContent() constructor { }, THEME.group)); array_push(menu, menuItem(__txtx("panel_graph_enter_group_new_tab", "Open group in new tab"), function() { - var graph = new Panel_Graph(); + var graph = new Panel_Graph(project); panel.setContent(graph, true); for( var i = 0; i < ds_list_size(node_context); i++ ) @@ -1504,7 +1513,7 @@ function Panel_Graph() : PanelContent() constructor { if(i == -1) { ds_list_clear(node_context); title = __txt("Graph"); - nodes_list = NODES; + nodes_list = project.nodes; toCenterNode(); PANEL_ANIMATION.updatePropertyList(); } else { @@ -1731,7 +1740,7 @@ function Panel_Graph() : PanelContent() constructor { } function getNodeList(cont = getCurrentContext()) { - return cont == noone? NODES : cont.getNodeList(); + return cont == noone? project.nodes : cont.getNodeList(); } function dropFile(path) { @@ -1743,6 +1752,10 @@ function Panel_Graph() : PanelContent() constructor { function drawContent(panel) { dragGraph(); + if(project.path == "") title = "New project"; + else title = filename_name_only(project.path); + title += project.modified? "*" : ""; + var bg = COLORS.panel_bg_clear; var context = instanceof(getCurrentContext()); switch(context) { @@ -1884,4 +1897,15 @@ function Panel_Graph() : PanelContent() constructor { ds_list_remove(nodes_list, node); ds_list_add(nodes_list, node); } + + function close() { + if(nodes_list != project.nodes) return; + if(!project.modified || project.readonly) { + closeProject(project); + return; + } + + var dia = dialogCall(o_dialog_save); + dia.project = project; + } } \ No newline at end of file diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 8508ea9e9..0cd122c95 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -232,7 +232,7 @@ function Panel_Inspector() : PanelContent() constructor { bx += bw + ui(4); if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, pFOCUS, _hover) == 2) - GLOBAL_NODE.createValue(); + PROJECT.globalNode.createValue(); var txt = __txt("Add"); var icon = THEME.add; @@ -651,8 +651,8 @@ function Panel_Inspector() : PanelContent() constructor { var txt = "Untitled"; var context = PANEL_GRAPH.getCurrentContext(); - if(context == noone && file_exists(CURRENT_PATH)) - txt = string_replace(filename_name(CURRENT_PATH), filename_ext(CURRENT_PATH), ""); + if(context == noone && file_exists(PROJECT.path)) + txt = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""); else if(context != noone) txt = context.name; @@ -671,7 +671,7 @@ function Panel_Inspector() : PanelContent() constructor { by += ui(36); if(STEAM_ENABLED && !workshop_uploading) { - if(CURRENT_PATH == "") { + if(PROJECT.path == "") { buttonInstant(noone, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_save", "Save file before upload"), THEME.workshop_upload, 0, COLORS._main_icon, 0.5); } else { if(!METADATA.steam) { //project made locally diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 0549ae992..5834bde6f 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -17,6 +17,7 @@ function Panel_Menu() : PanelContent() constructor { menuItem(__txt("Open") + "...", function() { LOAD(); }, THEME.noti_icon_file_load, ["", "Open"]), menuItem(__txt("Save"), function() { SAVE(); }, THEME.save, ["", "Save"]), menuItem(__txt("Save as") + "...", function() { SAVE_AS(); }, THEME.save, ["", "Save as"]), + menuItem(__txt("Save all"), function() { SAVE_ALL(); }, THEME.icon_save_all, ["", "Save all"]), menuItem(__txt("Recent files"), function(_dat) { var arr = []; for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) { @@ -59,7 +60,8 @@ function Panel_Menu() : PanelContent() constructor { else gameframe_set_fullscreen(2); },, ["", "Fullscreen"]), - menuItem(__txt("Close program"), function() { window_close(); }), + menuItem(__txt("Close current file"), function() { PANEL_GRAPH.close(); },, [ "", "Close file" ]), + menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]), ]; if(DEMO) array_delete(menu_file, 1, 5); @@ -131,15 +133,15 @@ function Panel_Menu() : PanelContent() constructor { ]], [ __txt("Rendering"), [ menuItem(__txtx("panel_menu_render_all_nodes", "Render all nodes"), function() { - for(var i = 0; i < ds_list_size(NODES); i++) - NODES[| i].triggerRender(); + for(var i = 0; i < ds_list_size(PROJECT.nodes); i++) + PROJECT.nodes[| i].triggerRender(); UPDATE |= RENDER_TYPE.full; }, [ THEME.sequence_control, 1 ], ["", "Render all"]), menuItem(__txtx("panel_menu_execute_exports", "Execute all export nodes"), function() { - var key = ds_map_find_first(NODE_MAP); - repeat(ds_map_size(NODE_MAP)) { - var node = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { + var node = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(!node.active) continue; if(instanceof(node) != "Node_Export") continue; @@ -618,11 +620,11 @@ function Panel_Menu() : PanelContent() constructor { #region title var txt = ""; - if(CURRENT_PATH == "") + if(PROJECT.path == "") txt = "Untitled"; else - txt = filename_name(CURRENT_PATH); - if(MODIFIED) + txt = filename_name(PROJECT.path); + if(PROJECT.modified) txt += "*"; txt += " - Pixel Composer"; if(ALPHA) txt += " ALPHA"; diff --git a/scripts/panel_nodes/panel_nodes.gml b/scripts/panel_nodes/panel_nodes.gml index 73b4b2229..d23508304 100644 --- a/scripts/panel_nodes/panel_nodes.gml +++ b/scripts/panel_nodes/panel_nodes.gml @@ -94,7 +94,7 @@ function Panel_Nodes() : PanelContent() constructor { #region content sc_nodes = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 40), function(_y, _m) { draw_clear_alpha(COLORS.panel_bg_clear, 0); - var _h = drawNodeList(NODES, 0, sc_nodes.surface_w, _y, _m); + var _h = drawNodeList(PROJECT.nodes, 0, sc_nodes.surface_w, _y, _m); return _h; }) #endregion diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index a6d3435ed..52290e0a8 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -489,12 +489,12 @@ function Panel_Preview() : PanelContent() constructor { right_menu_y += string_height("l"); } - draw_set_text(f_p0, fa_right, fa_top, fps >= ANIMATOR.framerate? COLORS._main_text_sub : COLORS._main_value_negative); + draw_set_text(f_p0, fa_right, fa_top, fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative); draw_text(w - ui(8), right_menu_y, __txt("fps") + " " + string(fps)); right_menu_y += string_height("l"); draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub); - draw_text(w - ui(8), right_menu_y, __txt("Frame") + " " + string(ANIMATOR.current_frame) + "/" + string(ANIMATOR.frames_total)); + draw_text(w - ui(8), right_menu_y, __txt("Frame") + " " + string(PROJECT.animator.current_frame) + "/" + string(PROJECT.animator.frames_total)); right_menu_y += string_height("l"); draw_text(w - ui(8), right_menu_y, "x" + string(canvas_s)); diff --git a/scripts/panel_tunnels/panel_tunnels.gml b/scripts/panel_tunnels/panel_tunnels.gml index 359868f9c..425281543 100644 --- a/scripts/panel_tunnels/panel_tunnels.gml +++ b/scripts/panel_tunnels/panel_tunnels.gml @@ -16,14 +16,14 @@ function Panel_Tunnels() : PanelContent() constructor { tunnel_hover = noone; function scanNodes() { - var amo = ds_map_size(NODE_MAP); - var k = ds_map_find_first(NODE_MAP); + var amo = ds_map_size(PROJECT.nodeMap); + var k = ds_map_find_first(PROJECT.nodeMap); tunnel_ins = []; repeat(amo) { - var node = NODE_MAP[? k]; - k = ds_map_find_next(NODE_MAP, k); + var node = PROJECT.nodeMap[? k]; + k = ds_map_find_next(PROJECT.nodeMap, k); if(instanceof(node) == "Node_Tunnel_In") array_push(tunnel_ins, node); @@ -122,10 +122,10 @@ function Panel_Tunnels() : PanelContent() constructor { k = ds_map_find_next(TUNNELS_OUT, k); var out = TUNNELS_OUT[? _k]; - if(out != key || !ds_map_exists(NODE_MAP, _k)) + if(out != key || !ds_map_exists(PROJECT.nodeMap, _k)) continue; - var _node = NODE_MAP[? _k]; + var _node = PROJECT.nodeMap[? _k]; draw_sprite_ui(THEME.tunnel, 0, ui(32), _y + ui(10), 0.75, 0.75, 0, COLORS._main_icon); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub); diff --git a/scripts/path_parser/path_parser.gml b/scripts/path_parser/path_parser.gml index 155813dc1..68d5f3e53 100644 --- a/scripts/path_parser/path_parser.gml +++ b/scripts/path_parser/path_parser.gml @@ -2,7 +2,7 @@ function try_get_path(path) { if(file_exists(path)) return path; - var local_path = filename_dir(CURRENT_PATH) + "/" + path; + var local_path = filename_dir(PROJECT.path) + "/" + path; if(file_exists(local_path)) return local_path; diff --git a/scripts/project_function/project_function.gml b/scripts/project_function/project_function.gml new file mode 100644 index 000000000..5690fa2c1 --- /dev/null +++ b/scripts/project_function/project_function.gml @@ -0,0 +1,18 @@ +function closeProject(project) { + array_remove(PROJECTS, project); + if(array_length(PROJECTS) == 0) + PROJECT = new Project(); + + var panels = findPanels("Panel_Graph"); + + for( var i = array_length(panels) - 1; i >= 0; i-- ) { + var panel = panels[i]; + if(panel.project == project) { + panel.panel.remove(panel); + array_remove(panels, panel) + } + } + + if(array_length(panels) == 0) + setPanel(); +} \ No newline at end of file diff --git a/scripts/project_function/project_function.yy b/scripts/project_function/project_function.yy new file mode 100644 index 000000000..1151a2abc --- /dev/null +++ b/scripts/project_function/project_function.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "project_function", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "project", + "path": "folders/functions/project.yy", + }, +} \ No newline at end of file diff --git a/scripts/random_function/random_function.gml b/scripts/random_function/random_function.gml index 632f62025..5b8f50527 100644 --- a/scripts/random_function/random_function.gml +++ b/scripts/random_function/random_function.gml @@ -33,14 +33,14 @@ function random1D(seed, startRange = 0, endRange = 1) { var _f = frac(seed); if(_f == 0) { - random_set_seed(GLOBAL_SEED + seed); + random_set_seed(PROJECT.seed + seed); return random_range(startRange, endRange); } - random_set_seed(GLOBAL_SEED + floor(seed)); + random_set_seed(PROJECT.seed + floor(seed)); var f1 = random_range(startRange, endRange); - random_set_seed(GLOBAL_SEED + floor(seed) + 1); + random_set_seed(PROJECT.seed + floor(seed) + 1); var f2 = random_range(startRange, endRange); return lerp(f1, f2, _f); @@ -67,8 +67,8 @@ function getWiggle(_min, _max, _freq, _time, seed_shift = 0, startTime = noone, if(endTime) //Clip at ending sdMax = min(endTime, sdMax); - var _x0 = (startTime != noone && sdMin <= startTime)? 0.5 : random1D(GLOBAL_SEED + seed_shift + sdMin); - var _x1 = (endTime != noone && sdMax >= endTime)? 0.5 : random1D(GLOBAL_SEED + seed_shift + sdMax); + var _x0 = (startTime != noone && sdMin <= startTime)? 0.5 : random1D(PROJECT.seed + seed_shift + sdMin); + var _x1 = (endTime != noone && sdMax >= endTime)? 0.5 : random1D(PROJECT.seed + seed_shift + sdMax); var t = (_time - sdMin) / (sdMax - sdMin); t = -(cos(pi * t) - 1) / 2; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 9ac30af96..b907dcc0c 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -53,7 +53,7 @@ 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)}] =============================="); +$"============================== RENDER START [frame {string(PROJECT.animator.current_frame)}] =============================="); try { var rendering = noone; @@ -61,23 +61,23 @@ $"============================== RENDER START [frame {string(ANIMATOR.current_fr var reset_all = !partial || ALWAYS_FULL; if(reset_all) { - var _key = ds_map_find_first(NODE_MAP); - var amo = ds_map_size(NODE_MAP); + var _key = ds_map_find_first(PROJECT.nodeMap); + var amo = ds_map_size(PROJECT.nodeMap); repeat(amo) { - var _node = NODE_MAP[? _key]; + var _node = PROJECT.nodeMap[? _key]; _node.setRenderStatus(false); - _key = ds_map_find_next(NODE_MAP, _key); + _key = ds_map_find_next(PROJECT.nodeMap, _key); } } // get leaf node RENDER_QUEUE.clear(); - var key = ds_map_find_first(NODE_MAP); - var amo = ds_map_size(NODE_MAP); + var key = ds_map_find_first(PROJECT.nodeMap); + var amo = ds_map_size(PROJECT.nodeMap); repeat(amo) { - var _node = NODE_MAP[? key]; - key = ds_map_find_next(NODE_MAP, key); + var _node = PROJECT.nodeMap[? key]; + key = ds_map_find_next(PROJECT.nodeMap, key); if(is_undefined(_node)) continue; if(!is_struct(_node)) continue; @@ -216,7 +216,7 @@ function RenderList(list) { } function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { - printIf(global.FLAG.render, "=== RENDER LIST ACTION START [frame " + string(ANIMATOR.current_frame) + "] ==="); + printIf(global.FLAG.render, "=== RENDER LIST ACTION START [frame " + string(PROJECT.animator.current_frame) + "] ==="); try { var rendering = noone; diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index f4a485de6..850a4aec8 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -2,50 +2,38 @@ globalvar SAVING; SAVING = false; function NEW() { - if(MODIFIED && !READONLY) { - var dia = dialogCall(o_dialog_load); - dia.newFile = true; - } else - __NEW(); + PROJECT = new Project(); + array_append(PROJECTS, PROJECT); + + var graph = new Panel_Graph(PROJECT); + PANEL_GRAPH.panel.setContent(graph, true); + PANEL_GRAPH = graph; } -function __NEW() { - nodeCleanUp(); - setPanel(); - instance_destroy(_p_dialog); - //room_restart(); - - gc_collect(); - SET_PATH(""); - - MODIFIED = false; - SAFE_MODE = false; -} - -function save_serialize() { +function save_serialize(project = PROJECT) { var _map = {}; - _map.version = SAVEFILE_VERSION; + _map.version = SAVE_VERSION; var _node_list = []; - var _key = ds_map_find_first(NODE_MAP); + var _key = ds_map_find_first(project.nodeMap); - repeat(ds_map_size(NODE_MAP)) { - var _node = NODE_MAP[? _key]; + repeat(ds_map_size(project.nodeMap)) { + var _node = project.nodeMap[? _key]; if(_node.active) array_push(_node_list, _node.serialize()); - _key = ds_map_find_next(NODE_MAP, _key); + _key = ds_map_find_next(project.nodeMap, _key); } _map.nodes = _node_list; var _anim_map = {}; - _anim_map.frames_total = ANIMATOR.frames_total; - _anim_map.framerate = ANIMATOR.framerate; + _anim_map.frames_total = project.animator.frames_total; + _anim_map.framerate = project.animator.framerate; _map.animator = _anim_map; _map.metadata = METADATA.serialize(); - _map.global_node = GLOBAL_NODE.serialize(); + _map.global_node = project.globalNode.serialize(); var prev = PANEL_PREVIEW.getNodePreviewSurface(); if(!is_surface(prev)) _map.preview = ""; @@ -62,33 +50,35 @@ function save_serialize() { return val; } -function SET_PATH(path) { +function SET_PATH(project, path) { if(path == "") { - READONLY = false; - } else if(!READONLY) { - var index = ds_list_find_index(RECENT_FILES, path); - if(CURRENT_PATH != path) { - if(index != -1) - ds_list_delete(RECENT_FILES, index); - ds_list_insert(RECENT_FILES, 0, path); - RECENT_SAVE(); - RECENT_REFRESH(); - } - CURRENT_PATH = filename_name(path); + project.readonly = false; + } else if(!project.readonly) { + ds_list_remove(RECENT_FILES, path); + ds_list_insert(RECENT_FILES, 0, path); + RECENT_SAVE(); + RECENT_REFRESH(); + //project.path = filename_name(path); } - CURRENT_PATH = path; + project.path = path; } -function SAVE() { +function SAVE_ALL() { + for( var i = 0; i < array_length(PROJECTS); i++ ) { + SAVE(PROJECTS[i]); + } +} + +function SAVE(project = PROJECT) { if(DEMO) return false; - if(CURRENT_PATH == "" || READONLY) - return SAVE_AS(); - return SAVE_AT(CURRENT_PATH); + if(project.path == "" || project.readonly) + return SAVE_AS(project); + return SAVE_AT(project, project.path); } -function SAVE_AS() { +function SAVE_AS(project = PROJECT) { if(DEMO) return false; var path = get_save_filename("Pixel Composer project (.pxc)|*.pxc", ""); @@ -100,13 +90,13 @@ function SAVE_AS() { if(file_exists(path)) log_warning("SAVE", "Overrided file : " + path); - SAVE_AT(path); - SET_PATH(path); + SAVE_AT(project, path); + SET_PATH(project, path); return true; } -function SAVE_AT(path, log = "save at ") { +function SAVE_AT(project = PROJECT, path = "", log = "save at ") { if(DEMO) return false; SAVING = true; @@ -118,8 +108,8 @@ function SAVE_AT(path, log = "save at ") { file_text_close(file); SAVING = false; - READONLY = false; - MODIFIED = false; + project.readonly = false; + project.modified = false; log_message("FILE", log + path, THEME.noti_icon_file_save); PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save); @@ -129,7 +119,7 @@ function SAVE_AT(path, log = "save at ") { function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { var _content = {}; - _content.version = SAVEFILE_VERSION; + _content.version = SAVE_VERSION; var _nodes = []; var cx = 0; @@ -177,7 +167,7 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co } var _content = {}; - _content.version = SAVEFILE_VERSION; + _content.version = SAVE_VERSION; var _nodes = []; SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context); diff --git a/scripts/save_function/save_function.yy b/scripts/save_function/save_function.yy index d3136e265..fa009890a 100644 --- a/scripts/save_function/save_function.yy +++ b/scripts/save_function/save_function.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "files", - "path": "folders/functions/files.yy", + "name": "project", + "path": "folders/functions/project.yy", }, } \ No newline at end of file diff --git a/scripts/steam_ugc_project/steam_ugc_project.gml b/scripts/steam_ugc_project/steam_ugc_project.gml index 2b4199259..3cab75331 100644 --- a/scripts/steam_ugc_project/steam_ugc_project.gml +++ b/scripts/steam_ugc_project/steam_ugc_project.gml @@ -1,7 +1,7 @@ function steam_ugc_create_project() { if(STEAM_UGC_ITEM_UPLOADING) return; - var file = new FileObject(string_replace(filename_name(CURRENT_PATH), filename_ext(CURRENT_PATH), ""), CURRENT_PATH); + var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path); file.getMetadata(); file.spr_path = DIRECTORY + "steamUGC/thumbnail.png"; @@ -26,7 +26,7 @@ function steam_ugc_create_project() { function steam_ugc_update_project(update_preview = false) { if(STEAM_UGC_ITEM_UPLOADING) return; - var file = new FileObject(string_replace(filename_name(CURRENT_PATH), filename_ext(CURRENT_PATH), ""), CURRENT_PATH); + var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path); file.getMetadata(); file.spr_path = DIRECTORY + "steamUGC/thumbnail.png"; diff --git a/scripts/string_eval/string_eval.gml b/scripts/string_eval/string_eval.gml index 519c05188..10ea34e26 100644 --- a/scripts/string_eval/string_eval.gml +++ b/scripts/string_eval/string_eval.gml @@ -95,7 +95,7 @@ function functionStringClean(fx) { if(is_struct(val)) return val.validate(); if(val == "value") return true; - if(GLOBAL_NODE.inputExist(val)) return true; + if(PROJECT.globalNode.inputExist(val)) return true; var strs = string_splice(val, "."); if(array_length(strs) < 2) return false; @@ -111,7 +111,7 @@ function functionStringClean(fx) { } var key = strs[0]; - return ds_map_exists(NODE_NAME_MAP, key); + return ds_map_exists(PROJECT.nodeNameMap, key); } static validate = function() { @@ -127,8 +127,8 @@ function functionStringClean(fx) { if(is_struct(val)) return val._isAnimated(); if(val == "value") return EXPRESS_TREE_ANIM.base_value; - if(GLOBAL_NODE.inputExist(val)) { - var _inp = GLOBAL_NODE.getInput(val); + if(PROJECT.globalNode.inputExist(val)) { + var _inp = PROJECT.globalNode.getInput(val); if(_inp.is_anim) return EXPRESS_TREE_ANIM.animated; } diff --git a/scripts/testing_script/testing_script.gml b/scripts/testing_script/testing_script.gml index 595d761c5..4a02fc61a 100644 --- a/scripts/testing_script/testing_script.gml +++ b/scripts/testing_script/testing_script.gml @@ -14,7 +14,7 @@ function __test_update_current_collections() { print(" > Updating " + _node.path); var _map = json_load(_node.path); - _map[? "version"] = SAVEFILE_VERSION; + _map[? "version"] = SAVE_VERSION; json_save(_node.path, _map); } @@ -35,7 +35,7 @@ function __test_update_sample_projects() { print(" > Updating " + _proj.path); var _map = json_load(_proj.path); - _map[? "version"] = SAVEFILE_VERSION; + _map[? "version"] = SAVE_VERSION; json_save(_proj.path, _map); } diff --git a/scripts/theme_definition/theme_definition.gml b/scripts/theme_definition/theme_definition.gml index d7e069b8b..09530a3ac 100644 --- a/scripts/theme_definition/theme_definition.gml +++ b/scripts/theme_definition/theme_definition.gml @@ -141,6 +141,8 @@ function Theme() constructor { websocket = noone; node_dropper = noone; bone = noone; + tab_exit = noone; + icon_save_all = noone; inspector_area = noone; inspector_area_type = noone; diff --git a/scripts/window_functions/window_functions.gml b/scripts/window_functions/window_functions.gml index 5f914cdd3..b8353939d 100644 --- a/scripts/window_functions/window_functions.gml +++ b/scripts/window_functions/window_functions.gml @@ -1,7 +1,19 @@ function window_close() { - if(MODIFIED && !READONLY) { - dialogCall(o_dialog_exit); - } else { + var noSave = true; + + for( var i = 0; i < array_length(PROJECTS); i++ ) { + var project = PROJECTS[i]; + + print($"Project {filename_name_only(project)} modified: {project.modified} readonly: {project.readonly}"); + if(project.modified && !project.readonly) { + var dia = dialogCall(o_dialog_exit,,,, true); + dia.project = project; + + noSave = false; + } + } + + if(noSave) { PREF_SAVE(); game_end(); }