On 04/08/2018 at 05:32, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 19
Platform: Windows ;
Language(s) : C++ ;
---------
At first, I thought that it's a very simple task.. My mistake.:-/
What I tried to do is to create global storage and save link to plugin instance every time it's being created:
< <<Main.cpp>>>
def PLUGIN_ID = 1234321
class MyTagPlugin: TagData {
...
...
MyTagPlugin::MyTagPlugin()
{
GePrint("---MyTag constructor---");
}
Bool MyTagPlugin::Init(GeListNode *node)
{
GePrint("init...");
pluginStorage = GetActiveDocument()->GetDataInstance()->GetContainer(PLUGIN_ID);
// ERROR SECTION
/*
index = bc.GetInt32(0,0)+1;
pluginStorage.SetInt32(0,index);
pluginStorage.SetLink(index, (BaseTag* )node);
*/
}
Bool PluginMessage(Int32 id, void *data)
{
if(id==C4DPL_COMMANDLINEARGS)
{
GePrint("Creating plugin storage");
GetActiveDocument()->GetDataIstance()->SetContainer(PLUGIN_ID, BaseContainer());
}
}
< <<Output>>>
Creating plugin storage
---MyTag constructor---
init...
---MyTag constructor---
init...
Why Constructor and Init functions of my plugin are fired twice when each instance of it created and twice every time when I change any parameter of MyTag?
What event or function should I use instead, to catch the moment of MyTag creation?