Thanks for your help! Next time I will use the 'ask question' when posting a question.
You code does exactly what I need, much appreciated!
I’m trying to make a little script that takes all selected cameras and puts them in a (newly created) stage object (one camera per frame).
Super useful if you want to render out stills on a render farm that doesn’t support takes.
I’ve got almost everything working:
The two things I’m struggling with:
Who can point me into the right direction?
Your help is much appreciated.
import c4d, math
from c4d import gui
# This is a little script that puts the selected cameras into a stage object with keyframes
# Main function
# Clear Console for easy debugging
# Get selected cameras
obj = doc.GetActiveObjects(1)
# Check if selected objects are cameras, if not pop-up error
#code should come here
# Go to Start of timeline
#create stage object
stage = c4d.BaseObject(c4d.Ostage)
# Get active document
mydoc = c4d.documents.GetActiveDocument()
# Loop through the array of cameras & put selected cameras in stage object
for x in obj:
mytime = mydoc.GetTime()
myfps = mydoc.GetFps() # define prject fps
myframe = mytime.GetFrame(myfps) #get current frame
print(myframe) # print frame number
stage[c4d.STAGEOBJECT_CLINK] = x # put camera camera slot of stage object
#set keyframe How??
#mydoc.RecordKey(stage,[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X]) #Add the keyframe to Rotation X successfully
# Go to next key frame
# Execute main()