Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Register
    • Login

    Alembic Export Options Not Working

    Cinema 4D SDK
    python s22
    5
    7
    1.5k
    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.
    • I
      ivodow
      last edited by r_gigante

      Hi,

      S22.016(RC)

      I am attempting to make an automated Alembic thinking particle exporter, and I have run into an issue where setting the export options does not work.

      Copying directly from the dev example here:
      https://github.com/PluginCafe/cinema4d_py_sdk_extended/blob/master/scripts/03_application_development/files_media/export_alembic_r14.py

      and only changing a few of the export options. Script does not work properly, as the resulting .abc file exported DOES contain all objects (not just the selection, as specified), and does NOT contain the particles.

      Please advise me.

      Thank you.

      """
      Copyright: MAXON Computer GmbH
      Description:
          - Exports Alembic with custom settings.
      Class/method highlighted:
          - c4d.plugins.FindPlugin()
          - MSG_RETRIEVEPRIVATEDATA
          - c4d.documents.SaveDocument()
      Compatible:
          - Win / Mac
          - R14, R15, R16, R17, R18, R19, R20, R21, S22
      """
      import c4d
      
      
      def main():
          # Retrieves a path to save the exported file
          filePath = c4d.storage.LoadDialog(title="Save File for Alembic Export", flags=c4d.FILESELECT_SAVE, force_suffix="abc")
          if not filePath:
              return
      
          # Retrieves Alembic exporter plugin, 1028082, defined in R20.046 as FORMAT_ABCEXPORT
          abcExportId = 1028082 if c4d.GetC4DVersion() < 20046 else c4d.FORMAT_ABCEXPORT
          plug = c4d.plugins.FindPlugin(abcExportId, c4d.PLUGINTYPE_SCENESAVER)
          if plug is None:
              raise RuntimeError("Failed to retrieve the alembic exporter.")
      
          data = dict()
          # Sends MSG_RETRIEVEPRIVATEDATA to Alembic export plugin
          if not plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data):
              raise RuntimeError("Failed to retrieve private data.")
      
          # BaseList2D object stored in "imexporter" key hold the settings
          abcExport = data.get("imexporter", None)
          if abcExport is None:
              raise RuntimeError("Failed to retrieve BaseContainer private data.")
      
          # Defines Alembic export settings
          abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
          abcExport[c4d.ABCEXPORT_PARTICLES] = True
          abcExport[c4d.ABCEXPORT_PARTICLE_GEOMETRY] = True
      
          # Finally export the document
          if not c4d.documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, abcExportId):
              raise RuntimeError("Failed to save the document.")
      
          print("Document successfully exported to:", filePath)
      
      
      if __name__ == '__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • I
        ivodow
        last edited by ivodow

        Seems to be an initialization/ caching issue. I found 2 workarounds:

        1. Open the Alembic Export Dialog manually, then hit Cancel, before running the script.

        -or-

        1. Toggle the state of each export setting in the script, as follows:
            abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = False
        
            abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
        
        
        1 Reply Last reply Reply Quote 0
        • r_giganteR
          r_gigante
          last edited by

          Hi @ivodow , thanks for reaching out us.

          With regard to your issue, I can't reproduce in S22.118 (S22 Service Pack1 HF2). Can you please provide info on your Cinema 4D environment? If your release matches the one above, can you share a simple scene to reproduce?

          Thanks, Riccardo

          1 Reply Last reply Reply Quote 0
          • S
            simon_analog
            last edited by simon_analog

            I just had the same problem in R25 I am curious if it was ever resolved

            this workaround fixed it for me

            abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = False
            abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
            
            1 Reply Last reply Reply Quote 1
            • i_mazlovI
              i_mazlov
              last edited by

              Hi @simon_analog,

              Thanks for reaching out to us.

              The issue is not reproducible for me neither in R25.117 (Build 25_0.CL363640.28201) Win nor in later versions, e.g. 2023.2.1 (Build 2023_36ed7c56a8dd_898294082) Win.

              Please, provide more information on you Cinema 4D environment: exact c4d release version (from the about window), your OS, Processor, Graphics card information.

              Cheers,
              Ilia

              MAXON SDK Specialist
              developers.maxon.net

              S 1 Reply Last reply Reply Quote 0
              • S
                simon_analog @i_mazlov
                last edited by

                @i_mazlov hope it helps
                R25.121 (Build 25_0.CL383430.43293) Win
                OS Name Microsoft Windows 10 Pro
                Version 10.0.19045 Build 19045
                gfx NVIDIA GeForce RTX 2080 Ti
                Processor Intel(R) Core(TM) i9-9920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)

                1 Reply Last reply Reply Quote 0
                • BigRoyB
                  BigRoy
                  last edited by

                  Just want to confirm here that I'm facing this same issue - only setting the negative state first and then the positive state after seems to make this work. So, thanks for the workaround.

                  Here's the reported bug on our pipeline: https://github.com/ynput/ayon-cinema4d/issues/6
                  And this is what fixed it: https://github.com/ynput/ayon-cinema4d/pull/8

                  Looking at 'what' fixes it this most definitely sounds like a bug.
                  (I tested in Cinema4D 2023.2.2 on Windows 10)

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