Annotator - how to work a basic example
Hi,
This is my first attempt at writing plugins having previously been more of a scripter!
I have been 'hacking' the Annotator example project to have it work with other messages, e.g. when a document is opened.
What I am trying to do is draw an annotation against art items which have a certain key in their dictionary.
I managed to work out the message and dictionary parts, but am getting stuck on the annotator, which is producing an exception when I try to set the background colour.
Here are the changes that I made to the sample project:
1) Commented out the calls to the existing draw annotation functions
2) Upon initialisation of the plugin, set the annotator to active straight away (no need to click on the annotator tool)
3) Added a new event listener for document open
4) Set a const AIRGBColor for the background colour (exact copy/paste from the example)
5) Cast the notifier message as an AIAnnotatorMessage: AIAnnotatorMessage* annMsg = (AIAnnotatorMessage*)message;
6) Invalidate whole document bounds (as this is just a test)
7) attempt to set the background colour: sAIAnnotatorDrawer->SetColor(annMsg->drawer, BKGND_COLOR).
Everything is fine until 7) where I get an exception; EXC_BAD_ACCESS (code 1).
Inspecting the annMsg object it does have a drawer object within it, so that part seems OK.
Clearly, I'm doing something wrong prior to point 7, I have tried to work back the existing example and things seem to be called in a similar order, but does anybody have any clues as to what I might check?
Also could somebody explain what the "SDK_ASSERT" call does, as I cannot find any mention of this in the documentation?
Many thanks in advance