Stop event, last action or how to clean up the state of things on user interrupt?

mc's picture

Would there be a way to detect (or get notified) that a quartz composition will stop, so that one has the chance to execute a last action or clean up the state of other depending patches or remote apps?

Alternatively:

How would one best poll a quartz composition in order to check if it is still alive?

Or, is my only chance to constantly send 'still alive' messages to depending patches in oder to detect, if my composition was stopped?

If anybody ever had this need, or ran into similar problems i would appreciate to learn about possible solutions, or workarounds.

smokris's picture
Re: Stop event, last action or how to clean up the state of ...

Quartz Composer does not provide in-composition notifications for termination.

However:

  • The Kineme QuartzBuilder protocol provides an applicationWillTerminate input value, which is true for the final frame rendered before application termination.
  • If you're writing your own Cocoa application wrapper, you could trap the - applicationWillTerminate: Objective-C message and set a published input to the composition, render a frame, then terminate.
  • Public and Private API patches get, respectively, a - stopExecution: and - cleanup: Objective-C messages (but you can't pass data to downstream patches by this point).

mc's picture
Re: Stop event, last action or how to clean up the state of ...

Thank you very much for this very concrete answer!

So, if i understand correctly, there is no other way than actually building a Cocoa app.

Or, would the Kineme QuartzBuilder protocol also be accessible by a custom plugin (SkankySDK) that would then execute a 'last-frame' macro, or load another composition as 'last-action'?

Thanks in advance for further elaborations, mc

mc's picture
Re: Stop event, last action or how to clean up the state of ...

Or, if SkankySDK plugins are subsumed by "Public and Private API patches", could a plugin possibly send a final OSC message on termination (instead of triggering a final frame), at least?

smokris's picture
Re: Stop event, last action or how to clean up the state of ...

mc wrote:
Or, if SkankySDK plugins are subsumed by "Public and Private API patches", could a plugin possibly send a final OSC message on termination (instead of triggering a final frame), at least?

Yes, "SkankySDK" == "Private API". Both Public and Private API plugins can respond to composition render termination.

The QuartzBuilder protocol is only active when the composition is built into a standalone application using QuartzBuilder.

mc's picture
Re: Stop event, last action or how to clean up the state of ...

ThanX for this clarification!