Pixel-Composer/scripts/project_function/project_function.gml

31 lines
565 B
Plaintext
Raw Normal View History

2023-07-06 19:49:16 +02:00
function closeProject(project) {
2024-02-06 13:53:08 +01:00
CALL("close");
2024-02-04 07:33:42 +01:00
2023-07-25 20:12:40 +02:00
project.active = false;
2023-07-06 19:49:16 +02:00
array_remove(PROJECTS, project);
if(array_empty(PROJECTS)) {
2023-07-25 20:12:40 +02:00
PROJECT = new Project();
PROJECTS = [ PROJECT ];
}
2023-07-06 19:49:16 +02:00
var panels = findPanels("Panel_Graph");
for( var i = array_length(panels) - 1; i >= 0; i-- ) {
var panel = panels[i];
2024-02-04 07:33:42 +01:00
2023-07-25 20:12:40 +02:00
if(panel.project != project)
continue;
if(array_length(panels) == 1) {
panel.setProject(PROJECT);
panel.reset();
2023-07-25 20:12:40 +02:00
} else {
2023-07-06 19:49:16 +02:00
panel.panel.remove(panel);
2023-07-25 20:12:40 +02:00
array_remove(panels, panel);
2023-07-06 19:49:16 +02:00
}
}
2023-07-10 20:14:10 +02:00
project.cleanup();
2023-07-06 19:49:16 +02:00
}