ExpressionPluginTag lose BaseContainer
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/09/2005 at 18:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;---------
Cafe Regular
**Group: Members
Posts: 87
Joined: 10-January 05
From: Denmark
Member No.: 3,656I am having trouble keeping passed variables in a dynamically created ExpressionPluginTag.
The setup is as follows:
I have a created a MenuPlugin with a dialog, that can receive dropped objects.
Clicking a button creates a new object based on extracted data from the objects dropped into the MenuPlugin's dialog. Hereby, I can create multiple new objects by dropping new objects into the dialog and hitting the create button.The MenuPlugin also applies an ExpressionPluginTag, which are supposed to carry important informations, on the created object. As the ExpressionPluginTag is generated, variables, which are passed from the MenuPlugin, are stored in the BaseContainer of newly created ExpressionPluginTag. To ensure that this information is stored properly, I have overwritten the Load(), Save(), and Copy() functions like this:
MyExpressionPluginTag::Save(hf) { var ct = GetContainer(); hf->WriteContainer(ct); } MyExpressionPluginTag::Load(hf) { var ct = hf->ReadContainer(); SetContainer(ct); } MyExpressionPluginTag::Copy(dest) { var ct = GetContainer(); dest->SetContainer(ct->GetClone()); }
It all seems to work fine until I change the content of the dialog of the MenuPlugin by replacing or dropping new objects. In fact, even, if I just hover the dragged object over a drop area in the dialog and not dropping it, the code breaks.
This means that the stored data in BaseContainer of ExpressionPluginTag is no longer stored, and the BaseContainer's ID has also changed.
So basically the question is, how do you pass data from a MenuPlugin to an ExpressionPluginTag generated by the first, and keeping that data safe, even if the original data in the MenuPlugin changes?