Play/Pause control via Python

  • On 03/09/2017 at 04:53, xxxxxxxx wrote:

    Is it possible to control timeline's play/pause via Python or Xpresso in someway?

  • On 03/09/2017 at 05:22, xxxxxxxx wrote:

    Using the Console log

        c4d.CallCommand(12412) # Play Forwards

    But the problem with that is you don't have a lot of control about it. So I propose you to use this method instead which allow you to customize how you want to play the animation.

    import c4d
    def main() :
        fps = doc.GetFps()
        frame = 0 #Starting frame
        maxFrame = doc.GetLoopMaxTime().GetFrame(fps) #end frame
        #Loop until our frame number is egual to our max frame
        while frame < maxFrame:
    	#We change the time
            doc.SetTime(c4d.BaseTime(frame, fps))
    	#We redraw everything
    	#Send message to tell c4d the time changed
    	#Do something here...
    	c4d.CallCommand(12410) # Record Active Objects
    	#we define our next frame
            frame += 1
        #Update the whole scene
    if __name__=='__main__':

  • On 04/09/2017 at 02:46, xxxxxxxx wrote:


    there's also RunAnimation(), which works quite nicely.

Log in to reply