rukano

music, technology, and more…

Controlling a QuartzComposer Composition in a Cocoa App

without comments

There is a way to set controllers directly from within Interface Builder to the published inputs of a Quartz Composition (QCView in the IB). This is nice, if you just want to do an animation that you control from the GUI elements. I’m working on an animation controlled within the program, and I really need to get to those published inputs to send the decisions made in the application.
This little solution may not be world changing, but I’ve searched for this little piece of code for a couple of minutes. so just as a reminder:

IBOutlet QCView * qcAnimation;

[qcAnimation setValue: (id) forInputKey: @"myKey"];


Yes… so easy! but Why it isn’t in the documentation? Well it is, but it won’t appear on the QCView or QCComposition or the quick help if you need. So, how to search for this kind of methods very quick? I found it was nicer to take a look at the header files than the documentation. If one goes to the QCView header it says:

@interface QCView : NSView <QCCompositionRenderer>

This means it inherits from NSView and uses the QCCompositionRenderer a protocol… meaning that you use the QCCompositionRenderer interface (methods). The is normally one is redirected to QCComposition or QCRenderer… so no idea how to get to the values… at least it was like that for me. I know it’s not a big deal, and a lot of people would have found this in seconds (if not just easy trying set… and autocompletation) but anyway… this may help some beginners and spare them some time looking for useful methods.
  • Twitter
  • Facebook
  • Google Reader
  • Share/Bookmark

Written by rukano

October 16th, 2009 at 12:27 pm

Leave a Reply