THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/07/2011 at 06:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R10-R12
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
---------
In my plugin, the user can store the current settings to be used as default using SetWorldPluginData(). And they are retrieved for a new instance (in Init()) using GetWorldPluginData(). All of the values are stored and retrieved except for the SPLINE customgui/customdatatype settings. It comes up empty when the plugin data is retrieved and applied to the plugin container. How do I do this?
In Message for MSG_DESCRIPTION_COMMAND, the user can store the current settings:
DescriptionCommand* dc = static_cast<DescriptionCommand*>(data);
BaseObject* op = static_cast<BaseObject*>(node);
if (!dc) return;
LONG id = dc->id[0].id;
// Save As User Default Settings
if (id == COLLISIONDEFORMER_SETDEFAULT)
{
// Set a World Preference from this object's BaseContainer settings
SetWorldPluginData(ID_COLLISIONDEFORMER_OBJ, op->GetData(), TRUE);
}
And when a new plugin object is created, I do this in the Init() :
BaseContainer* bc = ((BaseList2D* )node)->GetDataInstance();
if (!bc) return FALSE;
BaseContainer* wbc = GetWorldPluginData(ID_COLLISIONDEFORMER_OBJ);
if (!wbc)
{
FactoryReset(bc);
return;
}
// General
// ... Other settings retrieved (and working)
// - Bulge Shape (Spline)
// ... Doing this to see if it needs initialization before retrieval (?)
GeData d(CUSTOMDATATYPE_SPLINE, DEFAULTVALUE);
SplineData* sd = (SplineData* )d.GetCustomDataType(CUSTOMDATATYPE_SPLINE);
if (sd)
{
sd->MakeLinearSpline(2L);
sd->SetRound(1.0);
}
bc->SetData(COLLISIONDEFORMER_BSHAPE, d);
bc->SetData(COLLISIONDEFORMER_BSHAPE, wbc->GetData(COLLISIONDEFORMER_BSHAPE));