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

    A GetClone problem about takes

    General Talk
    2
    5
    914
    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.
    • delizadeD
      delizade
      last edited by delizade

      GetClone creates a take from a source take but its overrides are linked to source take. if I remove overrides from cloned take, original take's overrides also deleted. Is this a bug or GetClone produces a kind of instance object with linking to source object? How can I fix this? How can I break them from the source take?

      1. open attached c4d doc
      2. select Sphere take
      3. run this script
      4. script will clone sphare take under main take. Newly cloned take have 2 overrides: 1) for X location and 2) for layer properties.
      5. activate newly cloned Sphere take
      6. activate AutoTake and Lock Override buttons
      7. change Sphere's X location and/or sphare layer visibility values
      8. you will see that c4d will add another override lines under already existent overrides
      import c4d
      # Script clones selected take to under Main Take
      
      # AliasTrans did not work
          #trans = c4d.AliasTrans()
          #if trans is None or trans.Init(doc) is False:
          #    return False
          #clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0)
          #trans.Translate(False)
      
      def main():
          takeData = doc.GetTakeData()
          mainTake=takeData.GetMainTake()
          selectedTake=takeData.GetTakeSelection(0)
          doc.StartUndo()
          doc.AddUndo(c4d.UNDOTYPE_CHANGE, mainTake)
      
          clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0)
          clonedTake.InsertUnder(mainTake)
          doc.EndUndo()
          c4d.EventAdd()    
          #gui.MessageDialog('Hello World!')
      
      # Execute main()
      if __name__=='__main__':
          main()
      

      test.c4d

      1 Reply Last reply Reply Quote 0
      • delizadeD
        delizade
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • delizadeD
          delizade
          last edited by delizade

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand
            last edited by

            Hi @delizade,

            thank you for reaching out to us. There are two problems with your code:

            1. You are using C4DAtom.GetClone() and GeListNode.InsertUnder() to add and clone a take. You should instead use TakeData.AddTake() which also provides a cloneFrom argument (Link for AddTake).
            2. You are cloning and inserting the main take, which leads in Python to hiccups. Because even when you do it correctly, like discussed in this thread via AddTake, it will insert a second "main take" into a document. I.e., one which has no "inherit from parent" and "default cemara/rendersettings" icons.

            According to one our devs, No. 2 seems to be a Python bug and not a limitation, we will investigate that. For now you would have to clone the two child takes under the main take manually in Python (and add a parent take beforehand if you want this structure). Because otherwise you will end up with two "root/main" takes in your document, confusing Cinema 4D 😉

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • ferdinandF
              ferdinand
              last edited by

              Hi @delizade,

              without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly.

              Cheers,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

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