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

    Getting and setting frame range from RenderData

    Cinema 4D SDK
    2
    2
    553
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nicholas_yue
      last edited by

      Hi,

      I read that I can get the RenderData object via

      rdata = doc.GetActiveRenderData()

      I see that frame range values are documented here

      https://developers.maxon.net/docs/py/2023_2/modules/c4d.documents/RenderData/index.html?highlight=renderdata

      RDATA_FRAMEFROM
      RDATA_FRAMETO
      RDATA_FRAMESTEP

      Cheers

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi @nicholas_yue thanks for reaching out us.

        Although I'm not sure if your post was meant as a question or as a statement I'm going, nevertheless, to share some thoughts.
        The data you're looking for are stored in the RenderData BaseContainer and you can set/get them using the usual method.

        A full exmaple is available on PluginCafe Github Repo.

        Put down in words the code might looks like something as:

        def printRDataInfo(in_rdata):
            # BaseTime values are printed as frame
            print in_rdata[c4d.RDATA_FRAMEFROM].GetFrame(doc.GetFps())
            print in_rdata[c4d.RDATA_FRAMETO].GetFrame(doc.GetFps())
            print in_rdata[c4d.RDATA_FRAMESTEP]
        
        # Main function
        def main():
            # retrieve the RenderData instance
            rdata = doc.GetActiveRenderData()
            
            #just print the default values
            print "default rdata from/to/step values"
            printRDataInfo(rdata)
            
            # start is at sec 1
            rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(1)
            # end is at sec 2
            rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime(2)
            rdata[c4d.RDATA_FRAMESTEP] = 1
            
            #just print again the values
            print "first change with values to secs"
            printRDataInfo(rdata)
            
            # start is at frame 5
            rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime( 5.0, doc.GetFps())
            # end is at frame 15
            rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime( 15.0,  doc.GetFps())
            rdata[c4d.RDATA_FRAMESTEP] = 1
            
            #just print again the values
            print "second change with values to frames"
            printRDataInfo(rdata)
        

        Cheers, R

        1 Reply Last reply Reply Quote 0
        • First post
          Last post