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

    "Current Take" doesn't override layer processes that made by scripting

    Cinema 4D SDK
    python
    2
    3
    646
    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 Manuel

      hi,

      I change layer properties via script and I need current take override those layer processes. But when I changed a property via scripting current take can't see any changins and does not override any data.

      How can I do that?

      layer_and_takes_problem.png

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

        hi and welcome to our forum,

        For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

        • Q&A New Functionality.
        • How to Post Questions especially the tagging part.

        I've added the tags and marked this thread as a question so when you considered it as solved, please change the state 🙂

        About your question the take system is not automatic for scripts.

        You can have a look at our example in python
        Using Autotake
        Other example about takes
        How to create layers

        Based on those example i came with this test that is working as expected. Using AutoTake. You have to pass to the function two object that will be compared.
        So before doing the change, make a clone of your object.

        But you can also write parameter directly on the take itself. (see above links)

        
        import c4d
        
        
        def main():
            rootLayers = doc.GetLayerObjectRoot()
            if rootLayers is None:
                raise RuntimeError("Failed to retrieve the Root Layer.")
            layer = rootLayers.GetDown()
            if layer is None:
                raise ValueError("layer is None")
            
            layerClone = layer.GetClone(c4d.COPYFLAGS_0)
            
            
        
            # Changes the radius of the sphere in scene
            layer[c4d.ID_LAYER_VIEW] = False
        
            # 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.")
        
            # Checks if there is some TakeData and the current mode is set to auto Take
            if takeData and takeData.GetTakeMode() == c4d.TAKE_MODE_AUTO:
        
                # Retrieves the active Take
                currentTake = takeData.GetCurrentTake()
        
                # If there is an active Take, automatically generate a Take based on the difference between op and undoObject
                if currentTake:
                    currentTake.AutoTake(takeData, layer, layerClone)
        
                # Pushes an update event to Cinema 4D
                c4d.EventAdd()
        
        
        if __name__ == '__main__':
            main()
        

        If you have any question, feel free to ask.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

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

          thank you for your help.

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