On 22/07/2014 at 18:01, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15
Platform: Windows ;
Language(s) : C++ ;
---------
Hi PluginCafe,
I have a CommandPlugin that opens a GeDialog with various Reals/Checkboxes/etc. and I want that all settings are saved even when the document is closed and reopened. The behavior should basically be the same as, for example, the width and height of the RenderSettings from C4D.
I've read this:
https://plugincafe.maxon.net/topic/7735/9792_container-owners
So do I have to store all parameters of my dialog in a container and then the container as a subcontainer in the document's container? Therefore, I would need an additional unique ID, right? This feels a bit strange in my opinion?! Right now this is the way I do it, so I have a unique ID for my CommandPlugin, a unique ID for my Tag and a unique ID for my "Unique I want my dialog to remember its stuff ID".
I've read this:
https://plugincafe.maxon.net/topic/7860/10194_undo-basedocument-container-changes
So they store their own container in the SceneHook. Are we supposed to do so? The thread reads like somebody is experimenting with places to store their data?!
The thing is, that my tags work like a charm, I simply write this:
Bool MyTag::Init(GeListNode* node)
{
BaseTag* tag = (BaseTag* )node;
BaseContainer* baseContainer = tag->GetDataInstance();
baseContainer->SetInt32( MY_INT, 0 );
return true;
}
And the tag is initialized with the correct value when I create one and all values are stored on a per-object-basis even when I close and reopen the whole document. I guess that this works because I store the data in the node's container and the node is the object the tag is attached to, right? And this object lives the whole time so no data is lost and it is even restored when a document is closed?
Maybe I'm using the GeDialog in a wrong manner?
I inherit a MyDialog from GeDialog and override Bool MyDialog::InitValues(). As far as my understanding of C4D and containers goes is that I lose my values because InitValues() is called everytime I reopen the dialog (checked with the debugger). So I would have to store the values in a container, but where should I put this container?
Thanks, and sorry if this question was asked before, but it seems that the whole container-concept is a little riddle for many programmers here ;-)