On 28/06/2013 at 17:07, xxxxxxxx wrote:
You can load/save descriptions and other settings using the World Plugin Container. Check SetWorldPluginData() and GetWorldPluginData() in the API docs. For specific presets, just put the settings in a container with a name and maybe an element noting that it is a preset and save that container (BaseContainer) as above.
Bool MyPlugin::Init(GeListNode* node)
{
BaseContainer* bc = static_cast<BaseTag*>(node)->GetDataInstance();
// Get stored settings
BaseContainer* pbc = GetWorldPluginData(ID_MYPLUGIN);
if (!pbc) return TRUE;
bc->SetLong(MYPLUGIN_MODE, pbc->GetLong(MYPLUGIN_MODE, MYPLUGIN_MODE_CIRCLE));
bc->SetVector(MYPLUGIN_COLOR, pbc->GetVector(MYPLUGIN_COLOR, Vector(1.0,1.0,0.0)));
bc->SetLong(MYPLUGIN_RADIUS, pbc->GetLong(MYPLUGIN_RADIUS, 20L));
bc->SetLong(MYPLUGIN_RECT_W, pbc->GetLong(MYPLUGIN_RECT_W, 20L));
bc->SetLong(MYPLUGIN_RECT_H, pbc->GetLong(MYPLUGIN_RECT_H, 20L));
return TRUE;
}
void MyPlugin::Free(GeListNode* node)
{
BaseContainer* bc = static_cast<BaseTag*>(node)->GetDataInstance();
// Store settings
BaseContainer pbc;
pbc.SetLong(MYPLUGIN_MODE, bc->GetLong(MYPLUGIN_MODE));
pbc.SetVector(MYPLUGIN_COLOR, bc->GetVector(MYPLUGIN_COLOR));
pbc.SetLong(MYPLUGIN_RADIUS, bc->GetLong(MYPLUGIN_RADIUS));
pbc.SetLong(MYPLUGIN_RECT_W, bc->GetLong(MYPLUGIN_RECT_W));
pbc.SetLong(MYPLUGIN_RECT_H, bc->GetLong(MYPLUGIN_RECT_H));
SetWorldPluginData(ID_MYPLUGIN, pbc);
}