THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2011 at 14:13, xxxxxxxx wrote:
Hi Matt,
the GetPreview() function needs to be updated in the documentation. By wrapping InitRender()/FreeRender() around this call you can extract the bitmap of a bitmap shader.
For this code snippet 13.029 is required.
import c4d
import inspect
from c4d import utils
from c4d.modules import render
def main() :
doc = c4d.documents.GetActiveDocument()
vidPlane = doc.SearchObject('vidPlane')
print vidPlane
textureTag = vidPlane.GetTag(c4d.Ttexture)
print textureTag
material = textureTag.GetMaterial()
print material
colShader = material[c4d.MATERIAL_COLOR_SHADER]
print colShader
irs=render.InitRenderStruct() #helper class, members are currently read-only (13.029)
colShader.InitRender(irs)
colBitmap = colShader.GetBitmap()
colShader.FreeRender() #must definetly be called after InitRender() otherwise a memleak occurs
# colBitmap == None
print colBitmap