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

    render document after isolateObjects

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 276 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 07/02/2015 at 01:48, xxxxxxxx wrote:

      good morning,

      I try to render a thumbnail from a new Document .

      safedoc = c4d.documents.IsolateObjects(doc, [self.node])
      dst = bitmaps.BaseBitmap()
      dst.Init(100,100)
      dst.InitWith(iconpath)
      dst = safedoc.GetDocPreviewBitmap()
      dst.Save(iconpath, c4d.FILTER_TIF)
      c4d.documents.SaveDocument(safedoc, filePath, 0, c4d.FORMAT_C4DEXPORT)
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 07/02/2015 at 02:56, xxxxxxxx wrote:

        Hello,

        this should help:
        https://developers.maxon.net/forum/topic/8328/10864_extracting-a-thumbnail-of-c4d-file-solved

        https://developers.maxon.net/forum/topic/7666/9673_set-document-preview&KW=preview

        Best wishes
        Martin

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

          On 09/02/2015 at 10:58, xxxxxxxx wrote:

          Hi,

          First the 3 following lines are useless because Cinema will assign the rendered preview bitmap 'dst':

          dst = bitmaps.BaseBitmap()
          dst.Init(100,100)
          dst.InitWith(iconpath)
          
          safedoc = c4d.documents.IsolateObjects(doc, [self.node])
          dst = safedoc.GetDocPreviewBitmap()
          dst.Save(iconpath, c4d.FILTER_TIF)
          c4d.documents.SaveDocument(safedoc, filePath, 0, c4d.FORMAT_C4DEXPORT)
          

          For GetDocPreviewBitmap() to work, the document to get the preview for needs to be saved before.
          In other words, documents.SaveDocument(safedoc) has to be called before safedoc.GetDocPreviewBitmap().
          This is because GetDocPreviewBitmap() doesn't render the preview each time it's called. It rather returns a cached bitmap.

          This works well with already saved documents, but with documents saved by scripts it's harder to get it to work. I'll post a solution as soon as I find it.

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