mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-03 16:55:14 +01:00
project close bug
This commit is contained in:
parent
89694e99e8
commit
a0843b6aa7
8 changed files with 76 additions and 59 deletions
|
@ -2,36 +2,37 @@
|
|||
if(OS == os_windows && gameframe_is_minimized()) exit;
|
||||
|
||||
//print("===== Step start =====");
|
||||
#region animation
|
||||
if(PROJECT.animator.is_playing && PROJECT.animator.play_freeze == 0) {
|
||||
PROJECT.animator.time_since_last_frame += PROJECT.animator.framerate * (delta_time / 1000000);
|
||||
if(PROJECT.active) {
|
||||
#region animation
|
||||
if(PROJECT.animator.is_playing && PROJECT.animator.play_freeze == 0) {
|
||||
PROJECT.animator.time_since_last_frame += PROJECT.animator.framerate * (delta_time / 1000000);
|
||||
|
||||
if(PROJECT.animator.time_since_last_frame >= 1)
|
||||
PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1);
|
||||
} else {
|
||||
PROJECT.animator.frame_progress = false;
|
||||
PROJECT.animator.setFrame(PROJECT.animator.real_frame);
|
||||
PROJECT.animator.time_since_last_frame = 0;
|
||||
}
|
||||
|
||||
PROJECT.animator.play_freeze = max(0, PROJECT.animator.play_freeze - 1);
|
||||
#endregion
|
||||
|
||||
#region step
|
||||
PROJECT.globalNode.step();
|
||||
|
||||
try {
|
||||
if(PANEL_MAIN != 0)
|
||||
PANEL_MAIN.step();
|
||||
|
||||
for(var i = 0; i < ds_list_size(PROJECT.nodes); i++) {
|
||||
PROJECT.nodes[| i].triggerCheck();
|
||||
PROJECT.nodes[| i].step();
|
||||
if(PROJECT.animator.time_since_last_frame >= 1)
|
||||
PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1);
|
||||
} else {
|
||||
PROJECT.animator.frame_progress = false;
|
||||
PROJECT.animator.setFrame(PROJECT.animator.real_frame);
|
||||
PROJECT.animator.time_since_last_frame = 0;
|
||||
}
|
||||
} catch(e) {
|
||||
noti_warning("Step error: " + exception_print(e));
|
||||
}
|
||||
#endregion
|
||||
|
||||
PROJECT.animator.play_freeze = max(0, PROJECT.animator.play_freeze - 1);
|
||||
#endregion
|
||||
|
||||
#region step
|
||||
PROJECT.globalNode.step();
|
||||
|
||||
try {
|
||||
if(PANEL_MAIN != 0)
|
||||
PANEL_MAIN.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));
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region hotkey
|
||||
HOTKEY_MOD = 0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// @description init
|
||||
//print(PROJECT.path);
|
||||
global.cache_call = 0;
|
||||
global.cache_hit = 0;
|
||||
|
||||
|
@ -77,26 +78,29 @@ _HOVERING_ELEMENT = noone;
|
|||
//physics_pause_enable(true);
|
||||
DEF_SURFACE_RESET();
|
||||
|
||||
var _k = ds_map_find_first(PROJECT.nodeMap);
|
||||
var _a = ds_map_size(PROJECT.nodeMap);
|
||||
repeat(_a) {
|
||||
PROJECT.nodeMap[? _k].stepBegin();
|
||||
_k = ds_map_find_next(PROJECT.nodeMap, _k);
|
||||
if(PROJECT.active) {
|
||||
var _k = ds_map_find_first(PROJECT.nodeMap);
|
||||
var _a = ds_map_size(PROJECT.nodeMap);
|
||||
repeat(_a) {
|
||||
PROJECT.nodeMap[? _k].stepBegin();
|
||||
_k = ds_map_find_next(PROJECT.nodeMap, _k);
|
||||
}
|
||||
|
||||
if(PROJECT.animator.is_playing || PROJECT.animator.rendering) {
|
||||
if(PROJECT.animator.frame_progress) {
|
||||
__addon_preAnim();
|
||||
Render();
|
||||
__addon_postAnim();
|
||||
}
|
||||
PROJECT.animator.frame_progress = false;
|
||||
} else {
|
||||
if(UPDATE & RENDER_TYPE.full)
|
||||
Render();
|
||||
else if(UPDATE & RENDER_TYPE.partial)
|
||||
Render(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(PROJECT.animator.is_playing || PROJECT.animator.rendering) {
|
||||
if(PROJECT.animator.frame_progress) {
|
||||
__addon_preAnim();
|
||||
Render();
|
||||
__addon_postAnim();
|
||||
}
|
||||
PROJECT.animator.frame_progress = false;
|
||||
} else {
|
||||
if(UPDATE & RENDER_TYPE.full)
|
||||
Render();
|
||||
else if(UPDATE & RENDER_TYPE.partial)
|
||||
Render(true);
|
||||
}
|
||||
UPDATE = RENDER_TYPE.none;
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#region project
|
||||
function Project() constructor {
|
||||
active = true;
|
||||
|
||||
path = "";
|
||||
version = 0;
|
||||
seed = irandom_range(100000, 999999);
|
||||
|
|
|
@ -1826,6 +1826,7 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
function drawContent(panel) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
if(!PROJECT.active) return;
|
||||
|
||||
if(tool_width_drag) {
|
||||
CURSOR = cr_size_we;
|
||||
|
|
|
@ -910,9 +910,7 @@ function PanelContent() constructor {
|
|||
|
||||
function drawGUI() {}
|
||||
|
||||
function close() {
|
||||
panel.remove(self);
|
||||
}
|
||||
function close() { panel.remove(self); }
|
||||
|
||||
function onClose() {}
|
||||
}
|
||||
|
|
|
@ -175,17 +175,16 @@
|
|||
}
|
||||
|
||||
function _findPanels(_type, _pane, _arr = []) {
|
||||
if(instanceof(_pane) != "Panel")
|
||||
return _res;
|
||||
if(!is_instanceof(_pane, Panel))
|
||||
return _arr;
|
||||
if(!ds_exists(_pane.childs, ds_type_list))
|
||||
return _res;
|
||||
return _arr;
|
||||
|
||||
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 < array_length(_pane.content); i++ ) {
|
||||
var _cnt = instanceof(_pane.content[i]);
|
||||
//print($" - content {_cnt} \ {_cnt == _type}");
|
||||
if(_cnt == _type)
|
||||
array_push(_arr, _pane.content[i]);
|
||||
}
|
||||
|
||||
for(var i = 0; i < ds_list_size(_pane.childs); i++)
|
||||
|
|
|
@ -256,6 +256,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
PANEL_GRAPH = self;
|
||||
PROJECT = project;
|
||||
PANEL_ANIMATION.updatePropertyList();
|
||||
|
||||
//print($"Focus {PROJECT.path}");
|
||||
}
|
||||
|
||||
function stepBegin() {
|
||||
|
@ -1755,6 +1757,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
function drawContent(panel) {
|
||||
if(!project.active) return;
|
||||
|
||||
dragGraph();
|
||||
|
||||
if(project.path == "") title = "New project";
|
||||
|
@ -1907,7 +1911,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
function close() {
|
||||
if(nodes_list != project.nodes) return;
|
||||
if(nodes_list != project.nodes) {
|
||||
panel.remove(self);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!project.modified || project.readonly) {
|
||||
closeProject(project);
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/// @desc Function Description
|
||||
/// @param {Struct.Project} project Description
|
||||
function closeProject(project) {
|
||||
//print($"Close {PROJECT.path}");
|
||||
|
||||
PROJECT.active = false;
|
||||
array_remove(PROJECTS, project);
|
||||
if(array_length(PROJECTS) == 0)
|
||||
PROJECT = new Project();
|
||||
|
@ -9,6 +12,7 @@ function closeProject(project) {
|
|||
|
||||
for( var i = array_length(panels) - 1; i >= 0; i-- ) {
|
||||
var panel = panels[i];
|
||||
//print($" Check {panel.project.path}");
|
||||
if(panel.project == project) {
|
||||
panel.panel.remove(panel);
|
||||
array_remove(panels, panel)
|
||||
|
|
Loading…
Reference in a new issue