using System.Diagnostics; namespace VFXReviewWorker; /// /// Detects an *interactive* After Effects session on this machine. /// /// This matters because `AfterFX.com -noui -r script.jsx` is handed to an /// already-running After Effects instance rather than starting an isolated /// one — so running the preview build while an artist has AE open would take /// over their session and quit it, losing unsaved work. /// /// Deliberately conservative: this matches any After Effects process, the /// interactive `AfterFX.exe` as well as the `AfterFX.com` render engine that /// aerender drives. Waiting for either to finish also avoids two AE instances /// competing for the same box, and the worst case is only that a preview build /// starts a little later. /// public static class AeSession { public static bool InteractiveRunning() { try { return Process.GetProcessesByName("AfterFX").Length > 0; } catch { // If we cannot tell, assume an artist is working — never risk their session. return true; } } }