Custom Document Settings
On 07/05/2013 at 02:39, xxxxxxxx wrote:
Cinema 4D Version: 11.5
Platform: Mac OSX ;
Language(s) : C++ ;
I need to store custom document settings. I already did that with the R13 SDK by using >BaseContainer *bc = BaseDocument->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);
and inserting a BaseContainer under the ID of my plug-in. Saving & loading actually worked like a charm, however, I wasn't sure if that's the correct way to do this. Or if this is even allowed.
I'm even more unsure now that I had to check the R11.5 SDK (my plug-in has to support PPC Macs) to see what the ID for the document settings container is called in this version. There, the SETTINGS_DOCUMENT enum is noted with "Private!".
So, how exactly should I store custom document settings?
On 07/05/2013 at 08:07, xxxxxxxx wrote:
The document has a built-in Hyperfile where you can store data.
And it's one of the things I wish Maxon would make simpler to use. And make more robust. Like adding an image array function to them for one example.
You'll have to use three methods: Read(), Write, and CopyTo(). Just to save your data.
And they all have to be in sync. Containing the exact same data in each method.
IMHO. It's a horribly over complicated system. And once you try to save things like arrays and multiple data. It's becomes a real nightmare to use.
If you can save your data in a base container and get away with it. I would do it that way and save yourself the headache of the HF system.
But the HF is there if you really want to use it. Just don't expect it to be much fun.
On 07/05/2013 at 10:08, xxxxxxxx wrote:
Ah, I totally forgot about these methods.
I always thought those only are called when an actual Node is being written (i.e. a BaseObject), but it looks like they also are called for SceneHooks.
Awesome! It seems much more "cleaner" now.
Thanks for your help!
On 07/05/2013 at 12:33, xxxxxxxx wrote:
Also remember that a BaseDocument inherits from BaseList2D which has the GetDataInstance() function. If I'm not mistaken, there is where you can safely store a container that is your own plugin's ID, or at least that's how I've been doing it.