baselink in hyperfile

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 11:09, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.6+ 
Platform:      
Language(s) :     C++  ;

---------
Hi.

I know this was actually asked before in this thread:
old thread, but i couldnt quite work out a solution from that..

the goal:
save all my plugin's settings (including baselinks) to a preset file, which may be loaded again later.

the method:
I just created a hyperfile and write the complete basecontainer of my plugin to it.

when i load it later, all settings are restored in the AM, except for the baselinks.

I wonder now what happens to the baselinks when i write my conainer to the hyperfile. does it automatically save the objects into the hyperfile as well ?

i assume it probably does not so, and only stores the link. so when i restart cinema and load my plugin settings from the preset file, how am i supposed to get the object that belongs to the baselink ?

do i have to write my objects to a c4d file and load them when i read the container with the baselinks from the hyperfile ?

thanks for any hints,
Daniel

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 11:45, xxxxxxxx wrote:

Baselinks are only retained if the objects to which they point exist in the document - otherwise they are cleared (set to NULL). This is usually only possible in a C4D document since it also stores the objects to which the baselinks point.

HyperFiles don't have facilities to save/load objects in a way that Cinema 4D can reproduce.

What type of plugin is it? Usually, as it states, HyperFiles are only needed for 'plugin data that cannot be stored in containers'. Baselinks would be retained automatically with the plugin if saved in a document.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 12:18, xxxxxxxx wrote:

Hello Robert,

its a generator plugin which has some link fields to objects in the scene.

I want to load and save presets for this generator, as it has quite smoe options now. Besides the numerical settings, i also want to safe the objects that it uses.

I could probably do this by hand, by just saving each used object into a seperate c4d file, and then manually restoring the link with some kind of reference, like the object name or some unique id.

i was just wondering if there is a better way.

greetings,
Daniel

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 13:07, xxxxxxxx wrote:

What kind of objects? If they are procedural or easily recreatable, you could save the 'information' (parameters, type, and whatnot) to the hyperfile and reconstruct the object into the scene from the preset and then set the baselink from this.

Or, you could save a C4D file for each object and store a path to the file to merge into the current scene when the preset is selected (and make the link from there). The best procedure for saving like this would be to copy the object into a temporary BaseDocument, save it, and then delete the temporary document (or use AutoAlloc to have this happen automatically).

What happens, though, if the user is sort of just selecting this preset or that and objects are being loaded? Are you going to remove those wherein the links are being cleared or changed or just keep accumulating them?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 14:05, xxxxxxxx wrote:

its all kinds of objects, not just parametric ones.
guess i have to store them all by hand then in c4d files.

i havent quite decided what i'll do when the user loads different presets after another, thanks for bringing this up!

Maybe i'll merge the objects into the doc in such a way, that will make it easy for me to flush them / replace them when another preset is loaded.

For example i might just make them children of the generator in such a way that i can be sure they were loaded by a preset, so that i can safely replace them.

greetings,
Daniel

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 14:30, xxxxxxxx wrote:

Hi, take a look at this thread:

click

Matthis wrote: The write/Read and writeObject/ReadObject methods are actually rather private.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/04/2009 at 14:55, xxxxxxxx wrote:

thanks for the info Shawni.
Looks like theres no other way atm than saving objects into c4d files, so thats what i'll do for now ;-)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/04/2009 at 01:02, xxxxxxxx wrote:

Yes, saving them into c4d files is the best option currently. Actually that is how quite alot of the presets within CINEMA 4D are written.

cheers,
Matthias