render document after isolateObjects



  • 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)
    




  • 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.


Log in to reply