Aperture: Writing An Export Plug-in

cocoasmall
I'm going to write an Aperture export plugin. Or rather I'm going to try to write an Aperture export plug-in -- we'll see how far I get before either getting totally stuck or running out of time and patience. The purpose of my plugin is to provide randomness to exported images. Initially it will write images to a folder that the user selects and give them random file names. It will be called Random Wok.

Since I have XCode 2.4.1 already installed, the first thing I have to do is to get the Software Developer Kit for Aperture 1.5.1. That is downloaded from Apple's developer web site. Once logged in it is found under Applications in the Downloads area. Since I'm an ADC member (a free, cheap Online member) I have a log-in and can access the disk image that I need. Sign up to be a member if you are not already. Doing so will subject you to a NDA, so beware. I certainly won't be giving any secrets away in writing about my attempts. Note that the documentation for the Aperture Export SDK is publicly available.

Once I have the SDK disk image I open it and install it and copy the documentation to a folder on my hard drive. The Read Me contains instructions on how to integrate the documentation into the XCode documentation viewer. It is worth following those instructions because it makes accessing it very easy.

The SDK installs a template that can be used as a starting point for writing a plugin. Creating a new project in XCode allows me to select the plug-in template:
rwok1
I give it the name Random Wok and my project is created:
rwok2
Random_wok.m is where most of my code will live.

I have limited tools to work with. The template contains some starter code, and the installation of the SDK installed an example plugin called SampleFTPExportPlugin. And there is the documentation, and that is it.

My understanding of the way this plugin works and what I need to do is also limited. I know that I have to set up some data in the info.plist file to describe my plugin, create and edit any interface elements I need with Interface Builder, and manage the plugin interface. As far as I can tell, the way the plugin works is that my interface is presented to the user and then everything is event-driven based on what the user clicks and what Aperture gives me. The plugin can either have Aperture write images to files or can handle the image data itself. I have to at least partially understand the dance that is required between Aperture and the plugin.

I also have to set up a number of methods so that Aperture knows what to do with my plugin. For instance -(BOOL)allowsMasterExport returns either YES or NO depending on what my plugin is capable of. The first thing to do is to fill in enough to make it compile and do roughly what I want and sprinkle some NSLog() function calls around so I can see what is happening.

The other parts of this series can be found via the Cocoa page.
The Bagelturf site welcomes Donations of any size