UNSOLVED New - Interested in .py script to auto create new takes within an existing project

Hello, new. 🙂

I am interested in generating new takes within an existing project using the python API / SDK. I am at a loss for which library / calls to make to accomplish this. If anyone can point me to an example script that works with the same library that you can use to trigger auto takes, please share. Thank you very much in advance.

Edit: I notice in the script log that "New Take" and "Auto Take" record.

import c4d
#Welcome to the world of Python

def main():
    c4d.CallCommand(300000116) # Script Log...
    c4d.CallCommand(431000056) # New Take
    c4d.CallCommand(431000081) # Auto Take


if __name__=='__main__':
    main()
    c4d.EventAdd()

So conceivably I can use this (not terribly excited about it, again new). But then I would be interested in the Layers within that auto generated Take of which the script log does not record (specifically am interested in toggling the "Solo" button via code in the Layers section within the newly created Take). This does not record so I was hoping there was a call to interact with that section.

Edit 2:

https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.modules/takesystem/TakeData/index.html

I can use the takesystem module to interact with take data and create new takes. My next step is to insert a Layer into the Take Category via code. Does anyone know the calls to add a Category to a Take?

Hi and welcome to the forum,

In futur thread, please use our system to mark your thread as a question and mark it as solved once you are done. Please read our forum guideline to have more information on that feature.

Ferdinand answered a few threads about the take system lately. This one will help you to find the information you need.

You need to know how to create a new take and add overwrite to them so you can change some parameter value for those takes. You will have to understand what a DescID is and how to use it. You can check our c++ manual where you will find information about them.

Of course, let us know if something is not clear, and ask questions.

Cheers,
Manuel

Hi @m_magalhaes

Thanks for the reply! I ran into those exact posts looking for the answer as well.

I am still struggling with how to get the proper usage out of FindOrAddOverrideParam with the c4d.DescID argument. I am basically digging for the coordinates of the property (I believe) to the SOLO layer via the take, which is what I want to perform in my script. Anyways, here's some of the code so far, it compiles but I don't think I'm passing my arguments correctly. Will report back.

doc = c4d.documents.GetActiveDocument()
root = doc.GetLayerObjectRoot()

#work with takes
take_data = doc.GetTakeData()

main_take = take_data.GetMainTake()
# Its first child which is the first "actual" take.
base_take = main_take.GetDown()

if base_take is None:
    msg = "Please insert at least one base take to clone."
    raise RuntimeError(msg)

new_take = take_data.AddTake("", None, base_take)
new_take.SetName("Bob is your uncle.")
take_data.SetCurrentTake(new_take)
print(take_data.GetCurrentTake())

c4d.EventAdd()

# lets turn some layers on while looping thru
LayersList = root.GetChildren()

for layer in LayersList:
     print(layer.GetName())
     if layer.GetName() == "Star 5":
           newValue = c4d.ID_LAYER_SOLO
           descId = c4d.DescID(c4d.DescLevel(c4d.ID_LAYER_SOLO, c4d.DTYPE_LONG, 0))
           print(descId)
           # this makes no sense in a loop of the layers.
           # regardless I want to use this function to 
           # turn on the layer solo "parameter" so it becomes
           # applied to my take
           overrideNode = new_take.FindOrAddOverrideParam(take_data, layer, descId, newValue)

Update 2: The above code is working! Excellent!