I'm practicing some Python scripting at the moment on a little side project (i'm a novice), and i've come across a stumbling block.
I'm looking for a way in Python to get a BaseTake object by searching for the take by name (i'm probably not using any official terms here). I've search the documentation and couldn't see anything obvious, but the fact I don't really know what i'm doing doesn't help.
I'll shed a little light on what i'm trying to achieve, as it could be i'm trying to approach things the wrong way.
Essentially I want to create copies of the following format:
The top level take (Take 1-1) is the one I am aiming to copy x amount of times, and the name of this will change accordingly (will move onto this shortly). All children of this main take will need to be copied to the new take(s), but they will need to be identical. I want a system where I can create a template take containing these children, and copy these to newly created takes with one click. If I were to update these child takes at any point, I can remove them from the newly created takes, updated the children takes stored in the template, then run the script to copy them back over.
The other step, which i'm pretty close to achieving, is to give the newly created top level takes an automatic name based on the name of corresponding render setting (done), and then automatically assign that render setting to the newly created take (not done). The reason I can't find a way to assign the render setting to the newly created take is because I don't know how to reference the take once it is created - I assumed searching for it by name would do the job, hence this post (although I assume duplicate take names would cause complications?).
from c4d import gui
#Welcome to the world of Python
doc = c4d.documents.GetActiveDocument()
ts = c4d.modules.takesystem
#Get selected render setting
rs = doc.GetActiveRenderData()
#Create list from all children of render setting
rsch = rs.GetChildren()
#Get Take Data
td = doc.GetTakeData()
#Cycle through each render setting
for rs in rsch:
#Assign new take name to match render setting
tkName = rs.GetName()
#Create new take with assigned name
#Add corresponding render settings to newly created take
Feel free to pick apart the code as much as you can - I imagine there is a lot of dodgy stuff i'm doing here!