THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/05/2008 at 09:50, xxxxxxxx wrote:
Cinema 4D Version: 10.111
Language(s) : C++ ;
I have a BaseContainer that I would like saved with the document. It is not attached to a tag or an object, and it currently does not get saved with the file. Where would be the best place to save it? Should I use a hyperfile, add it to the document's container, or something else?
On 18/05/2008 at 06:08, xxxxxxxx wrote:
That is a good question. I am at the same point. I save something in a BaseContainer and didn't think about the save option.
In my case, I save the created Inports of a Xpresso Node with a true value and their IDs in a BaseContainer. If I would save the file, they should be gone.
Another way would be, to "recalculate" the settings of a BaseContainer when the "Create" Method of your class is called. So you have to fill the BaseContainer again!.
The other way would be the method, what you already said. You save it in a Hyperfile, but notice, the user has to open it too after the c4d file is loaded.
Hope my little appendage will help.
On 19/05/2008 at 14:56, xxxxxxxx wrote:
For what I'm doing, it seems to make sense to save it in the document's container. The one thing to be careful of there is to make sure you or the user is able to delete that data if you need or want to.
To save in the document's container, all you have to do is:
BaseDocument* doc = GetActiveDocument();
BaseContainer* docContainer = doc->GetDataInstance();
docContainer->SetContainer(plugin id, bc); //bc is container with info you want to save
doc->SetChanged(); //good to mark document changed so user doesn't accidentally quit without saving the values
On 20/05/2008 at 08:34, xxxxxxxx wrote:
I wonder where you get the container from?
On 20/05/2008 at 10:25, xxxxxxxx wrote:
Am I doing something wrong there Matthias? Seems to work fine on my end.
On 21/05/2008 at 15:06, xxxxxxxx wrote:
I am just curious because usally there is plugin node where you can save a basecontainer to, but if it works than it's ok.