Update 2: The above code is working! Excellent!
Posts made by thecomishy
-
RE: New - Interested in .py script to auto create new takes within an existing project
-
RE: New - Interested in .py script to auto create new takes within an existing project
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)
-
RE: New - Interested in .py script to auto create new takes within an existing project
Edit 2:
https://developers.maxon.net/docs/py/2023_2/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?
-
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.