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

    Create a Take

    Cinema 4D SDK
    r23 python
    3
    5
    697
    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.
    • P
      pim
      last edited by

      I want to create Takes using Python
      I have a Null with an object as a child under it.

      Below code creates the Take, but it does not fill the Category ok.

      adc42e48-4cf4-411f-9d20-2817c549b3de-image.png

      What am I doing wrong?

      import c4d
      
      def main():
          # Gets the TakeData from the active document (holds all information about Takes)
          takeData = doc.GetTakeData()
          if takeData is None:
              raise RuntimeError("Failed to retrieve the take data.")
         
          obj = doc.GetFirstObject()
          print ("First: ", obj.GetName())    
              
          # Adds a new Take
          newTake = takeData.AddTake(obj.GetName(), None, None)
          if newTake is None:
              raise RuntimeError("Failed to add a new take.")
      
          # Defines the created Take as the active one
          takeData.SetCurrentTake(newTake)
      
          c4d.CallCommand(431000081) # Auto Take toggle On
          # Unhide object, initially object is hidden.
          obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = c4d.OBJECT_ON     
          obj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = c4d.OBJECT_ON 
      
          c4d.CallCommand(431000081) # Auto Take toggle Off
          # Hide object again
          obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = c4d.OBJECT_OFF      
          obj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = c4d.OBJECT_OFF
              
          # Pushes an update event to Cinema 4D
          c4d.EventAdd()
      
      
      if __name__ == '__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hi,

        regarding your question, this thread will help
        We also have our documentation

        You can also use GetTakeMode and enable the auto mode accordingly.

        
        import c4d
        
        
        def main():
            
            opClone = op.GetClone(c4d.COPYFLAGS_0)
            op[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = c4d.OBJECT_OFF      
            op[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = c4d.OBJECT_OFF
        
        
            # Gets the TakeData from the active document (holds all information about Takes)
            takeData = doc.GetTakeData()
            if takeData is None:
                raise RuntimeError("Failed to retrieve the take data.")
        
                # Adds a new Take
            newTake = takeData.AddTake(op.GetName(), None, None)
            if newTake is None:
                raise RuntimeError("Failed to add a new take.")
        
            # Defines the created Take as the active one
            takeData.SetCurrentTake(newTake)
        
            # Checks if there is some TakeData and the current mode is set to auto Take
            if takeData and takeData.GetTakeMode() == c4d.TAKE_MODE_AUTO:
                newTake.AutoTake(takeData, op, opClone)
        
                # Pushes an update event to Cinema 4D
                c4d.EventAdd()
        
        
        if __name__ == '__main__':
            main()
        

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • P
          pim
          last edited by

          Great, that works!

          One other question.
          I have now a script that removes old takes and adds takes based on selected objects

          Now I see that the main take still has 'old' previous deleted takes.
          I do not think that is an issue, but I am not sure.

          1b93592c-afc5-4c64-85ab-8790da45a722-image.png

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

            The main should contain all the objects that all the takes are changing. Are you sure none of the take change a value of the "Null" object ?

            MAXON SDK Specialist

            MAXON Registered Developer

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

              Hello @pim,

              without any further feedback or questions, we will consider this topic as solved by Wednesday and flag it accordingly.

              Thank you for your understanding,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

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