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
    • Login
    The forum rollback caused push notifications and recent user data to malfunction. The problem will fix itself naturally within the next days. See the topic Broken Push Notifications for a more in detail explanation. You can fix this yourself by forcibly clearing your browser cache (for most browsers: CTRL + F5).

    Unable to update Alembic path in xref

    Cinema 4D SDK
    3
    6
    1.1k
    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.
    • N
      nicholas_yue
      last edited by

      I have the following code which was able to get the path but can't update the path

      flags = c4d.SCENEFILTER_MERGESCENE | c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS
      
      active_doc = c4d.documents.GetActiveDocument()
      merge_status = c4d.documents.MergeDocument(active_doc, target_scene, flags)
      assert(merge_status)
      # Model[c4d.ID_CA_XREF_FILE]
      obj_name_to_search = 'Model'
      xref = active_doc.SearchObject(obj_name_to_search)
      alembic_path = xref.GetParameter(c4d.ID_CA_XREF_FILE, c4d.DESCFLAGS_GET_NONE)
      print(alembic_path)
      status = xref.SetParameter(c4d.ID_CA_XREF_FILE, animated_alembic_file, c4d.DESCFLAGS_SET_PARAM_SET)
      assert(status)
      if True:
          c4d.documents.SaveDocument(active_doc,
                                  target_scene,
                                  c4d.SAVEDOCUMENTFLAGS_0,
                                  c4d.FORMAT_C4DEXPORT)
      
      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi @nicholas_yue , thanks for reaching out us.

        With regard to your question please be aware that C4DAtom::SetParameter() has to be called with DESCFLAGS_SET_USERINTERACTION flag to set ID_CA_XREF_FILE.

        Best, Riccardo

        1 Reply Last reply Reply Quote 0
        • N
          nicholas_yue
          last edited by

          @r_gigante said in Unable to update Alembic path in xref:

          DESCFLAGS_SET_USERINTERACTION

          Using DESCFLAGS_SET_USERINTERACTION there was a prompt in my script.

          Update XRef (Yes) or replace (No)?
          

          How do I respond (Yes) in my script ?

          Cheers

          1 Reply Last reply Reply Quote 0
          • M
            m_adam
            last edited by

            Unfortunately, there is no built-in way to control MessageBox within Cinema4D.

            The only way for you is to install a 3rd party python package, here a possible one https://github.com/asweigart/pyautogui.

            Cheers,
            Maxime.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            N 1 Reply Last reply Reply Quote 0
            • N
              nicholas_yue @m_adam
              last edited by

              @m_adam said in Unable to update Alembic path in xref:

              Unfortunately, there is no built-in way to control MessageBox within Cinema4D.

              The only way for you is to install a 3rd party python package, here a possible one https://github.com/asweigart/pyautogui.

              Cheers,
              Maxime.

              But I am running the script with c4dpy, there is no UI.

              Is there something I can call in c4dpy to tell the current active session to default to "Yes", it seems that c4dpy defaults to "No"

              Cheers

              1 Reply Last reply Reply Quote 0
              • M
                m_adam
                last edited by

                I know, it's not what you expected but there is for the moment no way to automate this using Cinema 4D API.

                Cheers,
                Maxime.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

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