Strange problem in handling a notifier.
hi,
while trying to handling the a notifier named kAIDocumentWritePreprocessNotifier( AIDocumentation.h) ----
If I copied (ctrl + c ) the content of current ai document, regardless of pasting(ctrl +v ) and closing
the application (Ai) without saving(ctrl +s) the document, It still executing Notify( AINotifierMessage* message ) for 2 times.
It should not execute when I am closing document with saving.
However it is not the case when no copy command is done on document.
I have checked this notifier with SDK sample and I found same problem. I tried the following code --
///////Start//////
// Register the notifier
ASErr ProjectNamePlugin::AddNotifier(SPInterfaceMessage *message)
{
ASErr result = kNoErr;
try {
result = sAINotifier->AddNotifier(fPluginRef, " Notifier", kAIDocumentWritePreprocessNotifier, &fNotifyHandle);
aisdk::check_ai_error(result);
}
catch (ai::Error& ex) {
result = ex;
}
catch(...)
{
result = kCantHappenErr;
}
rreturn result;
}
//Respond to the notifier
SErr ProjectNamePlugin::Notify(AINotifierMessage* message)
{
ASErr result = kNoErr;
try
{
if (message->notifier == fNotifyHandle)
{
sADMBasic->MessageAlert("inside Notifier");
aisdk::check_ai_error(result);
}
}
catch (ai::Error& ex) {
result = ex;
}
catch(...)
{
result = kCantHappenErr;
}
return result;
}
///////End//////
plz help.....