Pixel-Composer/scripts/project_function/project_function.gml
2024-02-06 19:53:08 +07:00

30 lines
597 B
Plaintext

function closeProject(project) {
CALL("close");
project.active = false;
array_remove(PROJECTS, project);
if(array_length(PROJECTS) == 0) {
PROJECT = new Project();
PROJECTS = [ PROJECT ];
}
var panels = findPanels("Panel_Graph");
for( var i = array_length(panels) - 1; i >= 0; i-- ) {
var panel = panels[i];
if(panel.project != project)
continue;
if(array_length(panels) == 1) {
panel.setProject(PROJECT);
panel.onFocusBegin();
panel.resetContext();
} else {
panel.panel.remove(panel);
array_remove(panels, panel);
}
}
project.cleanup();
}