Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    Generating preview of a C4D file [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 622 Views
    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.
    • H Offline
      Helper
      last edited by

      On 02/12/2014 at 01:48, xxxxxxxx wrote:

      Hi,

      I want to generate preview of my .c4d file in any video format like .avi , .mp4 etc using python for my plugin. How can i do that?

      Thanks
      Nishant

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 02/12/2014 at 02:59, xxxxxxxx wrote:

        Hello,

        you can use RenderDocument()[URL-REMOVED] to render single frames or a whole frame sequence of a given document. You can save the images or videos in the formats supported by your system. See this list of available formats[URL-REMOVED].

          
          # get render data  
          doc = documents.GetActiveDocument()  
          rd = doc.GetActiveRenderData().GetData()  
            
          # prepare bitmap  
          xres = int(rd[c4d.RDATA_XRES])  
          yres = int(rd[c4d.RDATA_YRES])  
            
          bmp = bitmaps.BaseBitmap()  
          bmp.Init(x=xres, y=yres, depth=24)  
            
          # set render data  
          rd[c4d.RDATA_MULTIPASS_ENABLE] = False  
          rd[c4d.RDATA_PROJECTFILE] = False  
            
          # sava as...  
          rd[c4d.RDATA_GLOBALSAVE] = True  
          rd[c4d.RDATA_SAVEIMAGE] = True  
          rd[c4d.RDATA_FORMAT] = c4d.FILTER_MOVIE # save as Quicktime movie  
            
          # preview range  
          rd[c4d.RDATA_FRAMESEQUENCE] = c4d.RDATA_FRAMESEQUENCE_MANUAL  
          rd[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(0)  
          rd[c4d.RDATA_FRAMETO] = c4d.BaseTime(1)  
            
          # get target path  
          path = c4d.storage.SaveDialog(title="Save preview")  
          rd.SetFilename(c4d.RDATA_PATH,path)  
            
          # render  
          res = documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_NODOCUMENTCLONE)  
        

        Best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 12/12/2014 at 07:02, xxxxxxxx wrote:

          Hello Nishant,

          was your question answered?

          best wishes,
          Sebastian

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 16/12/2014 at 03:27, xxxxxxxx wrote:

            Hi Sebastian,

            I was trying the above code but the result is always a 0 byte file. I am looking into it.

            Thanks 
            Nishant

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 17/12/2014 at 04:54, xxxxxxxx wrote:

              Hello,

              be aware that you must have Quicktime installed on your system to save Quicktime movies.

              Best wishes,
              Sebastian

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 29/12/2014 at 02:55, xxxxxxxx wrote:

                Hi,

                I am able to generate preview in .avi format using above code but the size of the file being generated after rendering process is very large.
                We can compromise the quality of the preview. Is there any way to decrease the time of rendering and more importantly the size of the final preview.

                Thanks

                Nishant

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 29/12/2014 at 09:32, xxxxxxxx wrote:

                  Hello,

                  the size of the file depends on the used codec and other file settings. In case of AVI you must set the
                  corresponding AVI parameters[URL-REMOVED]. You find some example how to get these parameters in this thread.

                  The video settings must be saved in the RenderData's RDATA_SAVEOPTIONS[URL-REMOVED] subcontainer.

                  Best wishes,
                  Sebastian


                  [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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