THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/03/2006 at 19:02, xxxxxxxx wrote:
Howdy,
Oh no, I don't need to save the AtomArray to the hyperfile, it is only there to keep a running list of which tags to send the message to. The message is being sent from a MessageData() which is polling for the core message EVMSG_CHANGE. Then it resends a custom message, only to the plugin's tags so they can check their data to see if they need to update.
Each time you load the file the tag's Init() function will be called and the tag is appended to the AtomArray, so the AtomArray gets rebuilt each time the file is loaded.
In the Main.cpp file, it's defined like this:
static AtomArray *taglist = NULL;
Then the AtomArray is allocated in PluginStart() :
taglist = AtomArray::Alloc();
and freed in PluginEnd() :
AtomArray::Free(taglist);
Then a case is added in PluginMessage(LONG id, void *data) :
case ID_MYTAG:
d = (mydata * )data;
d->list = taglist;
return TRUE;
The data structure is set up in the plugin's header file like this:
struct mydata
{
mydata(){list=NULL;}
AtomArray *list;
};
Then the pointer to the AtomArray is obtained from the tag's Init() function by sending:
mydata d;
PluginMessage(ID_MYTAG,&d;);
... which returns the pointer to the data structure "d" so it can append the array like this:
if(d.list) d.list->Append(node);
Then, in the tag's Free() function it removes the node from the AtomArray like this:
mydata d;
PluginMessage(ID_MYTAG,&d;);
if(d.list) d.list->Remove(node);
The code is from Paul Everett, who helped me set it up and it works great, but when I went to recompile it in R8, that's when I discovered that the R8 AtomArray class doesn't have the Remove() function available.
But, I'm curious if in R8, you can get by without the Remove() function, because the code in the MesageData() is checking if the BaseTag has a document before it tries to send a message to the tag. I may not support R8 for the plugin anyway, but was just curious.
Adios,
Cactus Dan