Hi Manual,
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!
Cheers,
Martijn
Hi Manual,
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!
Cheers,
Martijn
Hi all,
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.
Best regards,
Martijn
script:
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
def main():
# Clear Console for easy debugging
c4d.CallCommand(13957, 13957)
# 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
c4d.CallCommand(12501)
#create stage object
stage = c4d.BaseObject(c4d.Ostage)
doc.InsertObject(stage)
# 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
mydoc.RecordKey(stage, 1)
# Go to next key frame
c4d.CallCommand(12414)
c4d.EventAdd() #update
# Execute main()
if __name__=='__main__':
main()