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 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
c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)
#Send message to tell c4d the time changed
c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)
#Do something here...
c4d.CallCommand(12410) # Record Active Objects
#we define our next frame
frame += 1
#Update the whole scene
c4d.EventAdd()
if __name__=='__main__':
main()