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

    Insert scene under object

    Cinema 4D SDK
    python
    3
    5
    799
    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.
    • ROMANR
      ROMAN
      last edited by Manuel

      Hello guys! I know how to merge a scene with a current project. But i have no idea how to insert scene under parent with coordinats of this parent.

      I want to create custom nulls thats why i want to it. What should i add in this code if i want insert scene under object?

      import c4d
      def main():
          doc.StartUndo() # Start recording undos
          path = "C:\Users\Jamaletdinov.r\Desktop\ArrowR.c4d" 
          flags = c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_MERGESCENE 
          c4d.documents.MergeDocument(doc, path, flags) 
          c4d.EventAdd()
          doc.EndUndo() 
      if __name__=='__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hi,

        There's no direct way of doing that. I see two possibilities:

        • Create an Xref as a child of the object, define the imported document as the document for the xref, make the xref editable.
        • Open your document and clone all objects one by one. You could end up with lofs of issues if the document has a lot of links. (material, effectors etc etc)

        The problem is, as you can see on this thread, that some parameters of the xref are not accessible with python.
        The problem with links can be handle with AliasTrans.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • mikeudinM
          mikeudin
          last edited by

          1. Set active scene first object to, for example, variable MyFirstObject.
          2. Merge another scene to active document. All new objects will be pasted on the top of all in hierarchy.
          3. Put all objects before MyFirstObject to null.
          4. Place the null where you need.

          Checkout my python tutorials, plugins, scripts, xpresso presets and more
          https://mikeudin.net

          ManuelM 1 Reply Last reply Reply Quote 1
          • ManuelM
            Manuel @mikeudin
            last edited by

            hi,

            hoo thanks a lot @mikeudin I somehow didn't though about this one xD

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • ROMANR
              ROMAN
              last edited by

              Mike, thank you a lot!

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