Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Daguna
    3. Best
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by Daguna

    • RE: Timeline commands ran via Python script does not have same result

      Marvelous @Dunhou, thanks yet again!!

      Here's the final script in case someone else has use for it:

      from typing import Optional
      import c4d
      
      doc: c4d.documents.BaseDocument  # The active document
      op: Optional[c4d.BaseObject]  # The active object, None if unselected
      
      def main():
      
          # Retrieves BaseTime of frame 5, 20
          start = 0
          end = 1
          if c4d.CheckIsRunning(c4d.CHECKISRUNNING_ANIMATIONRUNNING) == True:
              c4d.CallCommand(12412) # Play Forwards
      
          # Loops through the frames
          for frame in range(start, end + 1):
      
              # Changes the time of the document
              doc.SetTime(c4d.BaseTime(frame, doc.GetFps()))
      
              # Updates timeline
              c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)
      
              # Redraws the viewport and regenerate the cache object
              c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW | c4d.DRAWFLAGS_NO_THREAD | c4d.DRAWFLAGS_STATICBREAK)
      
          # Pushes an update event to Cinema 4D
          c4d.EventAdd(c4d.EVENT_ANIMATE)
      
      if __name__ == '__main__':
          main()
      
      posted in Cinema 4D SDK
      D
      Daguna