Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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 07/02/2015 at 02:56, xxxxxxxx wrote:
Hello,
this should help: https://plugincafe.maxon.net/topic/8328/10864_extracting-a-thumbnail-of-c4d-file-solved
https://plugincafe.maxon.net/topic/7666/9673_set-document-preview&KW=preview
Best wishes Martin
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.