SOLVED storage.WriteHyperFile() and storage.ReadHyperFile() (Rooky Question)

I discovered the WriteHyperFile and ReadHyperFile functions in class c4d.storage

It says, that it saves a GeListNode to a HyperFile and also that it can read a HyperFile and replace the actual Node.

Does this function Write completely write an object to a hyperfile?
Because the writing worked , it has written the file, but when I want to read , Cinema freezes.
I mean the write function says, it replaces the actual node with that one , which is saved in the HyperFile.

I'm sure I got it totally wrong 😌

Here is the small code snippet of the Save Script, which saves the selected object into a hyperfile on disc

path = c4d.storage.SaveDialog(force_suffix="file")
c4d.storage.WriteHyperFile(doc,doc.GetActiveObject(),path,100)

and here is the code snippet for the Load script , which should load and replace the actual node with the saved one

path=c4d.storage.LoadDialog()
c4d.storage.ReadHyperFile(doc, doc.GetActiveObject(), path, 100)

So when I was younger everything was a lot easier

hi,
ok, that was monday...after a bit more test on R23.110 and our last version

generator replaced by a generator -> OK
generator replaced by a polygonObject -> KO --> crash
PolygonObject replaced by a PolygonObject -> OK
PolygonObject replaced by a generator -> object disappear if you select it. --> KO

this is still a bug. I will open a new bug entry for that.

it should be possible to do it by yourself.

Cheers
Manuel

Hi,

This was a bug that have been fixed with the release 23 service pack one. It was "kind of working" with generators.
You have flagged this thread with R23, but did you update it?

Cheers,
Manuel

yes sorry , I have version 23.110 , i only bought in november, so cinema was already updated.

So my question about this function is basically, can I save a complete object with all it´s settings with this WriteHyperFile(). So when I have for instance a modeled polygon object, does it write also the points and polygons etc...?

hi,
ok, that was monday...after a bit more test on R23.110 and our last version

generator replaced by a generator -> OK
generator replaced by a polygonObject -> KO --> crash
PolygonObject replaced by a PolygonObject -> OK
PolygonObject replaced by a generator -> object disappear if you select it. --> KO

this is still a bug. I will open a new bug entry for that.

it should be possible to do it by yourself.

Cheers
Manuel

@m_magalhaes

it should be possible to do it by yourself.

😂 what in particular do you mean.....

but so far thanks for your time and effort

hi,

The issue occurs when you are trying to override a generator by a polygonObject
But you can, instead of replacing the generator, create a temporary object and read your hyperfile to that object. Then, you need to replace the existing one. You need to insert the imported object, move it to the same position of the selected object, move the children if they exist, the texture tags etc etc.

def main():
    
    node = c4d.BaseObject(c4d.Opolygon)
    path=c4d.storage.LoadDialog()
    c4d.storage.ReadHyperFile(doc, node, path, 100)
    
    doc.InsertObject(node)
    # ..... move the child from the selected object to this one and remove the selected one.
    c4d.EventAdd()
    

Cheers,
Manuel

@m_magalhaes
yes thanks that was my idea, too , I created a temporary object, in my case a spline with 0 points and 0 segments and simply exchanged it, thanks.....