Official-API Subpatch Support

This Official-API plugin unlocks Subpatch support for Official-API Quartz Composer Plugins. To use this in your Official-API plugins, simply add a +(BOOL)allowsSubpatches method that returns YES to allow subpatches in your patch.

To execute these subpatches, you'll need to use [[self patch] executeSubpatches:(double)time arguments:(NSDictionary*)args] in your execute method.

Have a lot of fun :)

I expect Apple to include this functionality in a future release of QC, so Please only use this if you know what you're doing.

[NOTE: If you're a kineme.net regular, This PlugIn goes in the official PlugIns directory, not the Patches directory like all our other plugins — It's our first public official-API plugin! :)]

PreviewAttachmentSize
KinemeAllowOfficialSubpatches-0.1.zip9.42 KB

cwright's picture
More Information

Here's an example project that'll demonstrate official-api macro patches. You'll need an output port connected to a consumer to get it executing.

Also, you'll be able to save, but loading won't work (QC assumes all plugins are non-macro patches, and the official plugin doesn't get there in time to change it's mind). This is probably fixable with an unofficial-api plugin (these are loaded before the official-api ones), so let me know if you're interested in such a plugin.

PreviewAttachmentSize
ExampleSubpatchPlugIn.zip15.07 KB

Just.Jake's picture
That unofficial plugin would sure be nice ;-)

Or we could do it via SIMBL, but that is ALL SORTS of devilish hackery...

cwright's picture
already done :)

I've just completed that plugin actually (it's not published here yet, awaiting some feedback etc). mail me (i'm available at the e-mail address at the bottom of each page), and you can give it a spin too :)

Just.Jake's picture
Subpatches

A great application of custom macro patch is remaking "Render to Image," which uses a QCRenderer in its own openglcontext to render subpatches. If you make your own, you'd be able to specify your own openglpixelformat; and thus gain access to multisampling or supersampling within Quartz Composer, which would be a vast improvement. I have a great deal of code for this sort of thing already written; I'm just waiting on working access to subpatch capabilities...

cwright's picture
jump ship

You could also jump into the unofficial api (what we develop against); that gives you access to subpatches (among other things).

I love your idea for this, BTW. If you don't get around to implementing it, would you mind if I took a swing at it? (probably not any time soon, but I feel like this is the best solution to the AA problem that's been suggested; way better than my init-time hacks I was considering a month or two ago.)

Just.Jake's picture
Unofficial API in non-Quartz Composer

How well do your plugins work in other QC contexts? I'm trying to use QC to provide a visual window switcher with Witch-like functionality, so I need whatever plugins I use to be active in non-Quartz Composer applications.

cwright's picture
quite well

We've had our plugins work in a variety of different contexts successfully.

Final Cut Pro, Motion, VDMX, Keynote, JustAddMusic, and Image Flow, just to name a few.

Some environments complain about safe-mode. We're able to work around this too, but we usually do it on a case-by-case basis (since there are some risks that need to be considered). If they fail to load, you'll get some messages in the Console (Console.app) to help track down which ones you'd like for us to look at.

Just.Jake's picture
Fantastic!

Fantastic! I'll get right to work as soon as I get to my dev machine!

EDIT: uhoh. Where can I find documentation or a sample plugin with subpatches to rampantly steal code from?

cwright's picture
8 comments up :)

About 8 comments up. Search for "ExampleSubpatchPlugIn.zip 15.07 KB" -- I made a sample official-api plugin that allows subpatches (and executes them). Not much help for the render-in-image stuff you want to do, but it's a start to get familiar with it.

Swizzling the context will be a bit trickier, and will probably require some more undocumented methods. We'll cross that bridge when you come to it though.