Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

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

    Cinema 4D SDK
    windows python r23
    2
    7
    745
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ThomasBT
      ThomasB
      last edited by

      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

      Thanks,
      T.S.B

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by 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

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • ThomasBT
          ThomasB
          last edited by ThomasB

          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...?

          Thanks,
          T.S.B

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by Manuel

            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

            MAXON SDK Specialist

            MAXON Registered Developer

            ThomasBT 1 Reply Last reply Reply Quote 0
            • ThomasBT
              ThomasB @Manuel
              last edited by ThomasB

              @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

              Thanks,
              T.S.B

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                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

                MAXON SDK Specialist

                MAXON Registered Developer

                ThomasBT 1 Reply Last reply Reply Quote 0
                • ThomasBT
                  ThomasB @Manuel
                  last edited by

                  @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.....

                  Thanks,
                  T.S.B

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post