Pixel-Composer/objects/o_main/Step_0.gml

139 lines
3.1 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
2023-12-18 04:40:21 +01:00
if(winMan_isMinimized()) exit;
2023-11-28 06:50:54 +01:00
winManStep()
2023-03-28 06:58:28 +02:00
2023-03-07 14:29:47 +01:00
//print("===== Step start =====");
2024-03-31 05:36:11 +02:00
2024-05-15 12:42:54 +02:00
if(PROJECT.active && !PROJECT.safeMode) { #region node step
2023-07-25 20:12:40 +02:00
PROJECT.animator.step();
2023-11-08 08:38:04 +01:00
PROJECT.globalNode.step();
2023-12-25 12:51:12 +01:00
LIVE_UPDATE = false;
2023-01-25 06:49:00 +01:00
2023-11-08 08:38:04 +01:00
try {
if(PANEL_MAIN != 0) PANEL_MAIN.step();
2023-11-29 03:04:28 +01:00
array_foreach(PROJECT.nodeArray, function(_node) {
if(!_node.active) return;
_node.triggerCheck();
_node.step();
});
2023-11-08 08:38:04 +01:00
} catch(e) {
noti_warning("Step error: " + exception_print(e));
}
2024-05-15 12:42:54 +02:00
IS_SAVING = false;
2023-11-25 08:54:35 +01:00
} #endregion
2022-01-13 05:24:03 +01:00
#region hotkey
2023-05-08 19:14:30 +02:00
if(!instance_exists(o_dialog_preference) && !HOTKEY_BLOCK) {
2023-04-21 19:08:10 +02:00
if(ds_map_exists(HOTKEYS, "")) {
var l = HOTKEYS[? ""];
for(var i = 0; i < ds_list_size(l); i++) {
var hotkey = l[| i];
if(hotkey.key == 0 && hotkey.modi == MOD_KEY.none) continue;
2022-01-13 05:24:03 +01:00
2023-04-21 19:08:10 +02:00
if(key_press(hotkey.key, hotkey.modi)) {
hotkey.action();
break;
}
2022-01-13 05:24:03 +01:00
}
}
2023-12-12 08:20:05 +01:00
2023-04-21 19:08:10 +02:00
if(ds_map_exists(HOTKEYS, FOCUS_STR)) {
var list = HOTKEYS[? FOCUS_STR];
for(var i = 0; i < ds_list_size(list); i++) {
var hotkey = list[| i];
if(hotkey.key == 0 && hotkey.modi == MOD_KEY.none) continue;
2022-01-13 05:24:03 +01:00
2023-04-21 19:08:10 +02:00
if(key_press(hotkey.key, hotkey.modi)) {
hotkey.action();
break;
}
2022-01-13 05:24:03 +01:00
}
}
}
2023-05-08 19:14:30 +02:00
HOTKEY_BLOCK = false;
2022-01-13 05:24:03 +01:00
#endregion
#region GIF builder
2022-01-13 05:24:03 +01:00
for( var i = 0; i < ds_list_size(GIF_READER); i++ ) {
var _reader = GIF_READER[| i];
var _reading = _reader[0].reading();
if(_reading) {
var ret = _reader[2];
ret(new __gif_sprite_builder(_reader[0]));
ds_stack_push(gif_complete_st, i);
}
}
while(!ds_stack_empty(gif_complete_st)) {
var i = ds_stack_pop(gif_complete_st);
buffer_delete(GIF_READER[| i][1]);
delete GIF_READER[| i][0];
ds_list_delete(GIF_READER, i);
}
#endregion
2022-09-21 06:09:40 +02:00
#region file drop
2023-03-08 12:14:01 +01:00
if(OS == os_windows) {
if(array_length(drop_path)) {
load_file_path(drop_path);
drop_path = [];
}
2024-05-07 10:54:34 +02:00
2023-03-08 12:14:01 +01:00
} else if(OS == os_macosx) {
file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti);
file_dnd_filelist = file_dnd_get_files();
if(file_dnd_filelist != "" && _file_dnd_filelist != file_dnd_filelist) {
var path = string_trim(file_dnd_filelist);
load_file_path(string_splice(path, "\n"));
}
_file_dnd_filelist = file_dnd_filelist;
2022-09-21 06:09:40 +02:00
}
2022-09-27 06:37:28 +02:00
#endregion
#region window
2023-07-06 19:49:16 +02:00
if(_modified != PROJECT.modified) {
_modified = PROJECT.modified;
2023-02-14 02:51:14 +01:00
var cap = "";
2023-11-01 08:10:25 +01:00
if(PROJECT.safeMode) cap += "[SAFE MODE] ";
if(PROJECT.readonly) cap += "[READ ONLY] ";
2023-07-06 19:49:16 +02:00
cap += PROJECT.path + (PROJECT.modified? "*" : "") + " - Pixel Composer";
2023-02-14 02:51:14 +01:00
window_set_caption(cap);
2022-09-27 06:37:28 +02:00
}
2022-11-03 11:44:49 +01:00
#endregion
#region notification
if(!ds_list_empty(WARNING)) {
var rem = ds_stack_create();
for( var i = 0; i < ds_list_size(WARNING); i++ ) {
var w = WARNING[| i];
if(--w.life <= 0)
ds_stack_push(rem, w);
}
while(!ds_stack_empty(rem)) {
ds_list_delete(WARNING, ds_stack_pop(rem));
}
ds_stack_destroy(rem);
}
2023-02-14 02:51:14 +01:00
#endregion
#region steam
steam_update();
if(STEAM_ENABLED) {
if (steam_is_screenshot_requested()) {
2024-05-07 10:54:34 +02:00
var file = $"PixelComposer_{seed_random(6)}.png";
2023-02-14 02:51:14 +01:00
screen_save(file);
steam_send_screenshot(file, window_get_width(), window_get_height());
}
}
#endregion