On 04/12/2014 at 02:16, xxxxxxxx wrote:
Hello,
I hope someone can help me with this!
I can´t find an easy way to get a Bitmap out of a Bodypaint layer.
I want to show those Layers on an Userarea, how can I do this?
Additionally it seems to me that some bodypaint features are not available in Python?
(at the bottom of the thread)
What I´ve found out so far:
if there is an active BB texture;
tex = bodypaint.PaintTexture.GetSelectedTexture()
texturename = tex.GetFilename()
actlay = tex.GetActive()
if one have to load a new BB texture;
#loaddialog
texturename = c4d.storage.LoadDialog(type= c4d.FILESELECTTYPE_IMAGES, title="Load Hdr", flags=c4d.FILESELECT_LOAD)
#pass it to BB and make itself and the first layer active
settings = c4d.BaseContainer()
settings.SetFilename(c4d.LOADTEXTURE_FILENAME, texturename)
tex = bodypaint.SendPainterCommand(c4d.PAINTER_LOADTEXTURE, doc=doc, tex=None, bc=settings)
if not tex:return
lay = tex.GetFirstLayer()
tex.SetActiveLayer(lay, activatetexture=True, show=True)
#get the active layer
actlay = tex.GetActive()
print actlay, "layer"
#read layerdimensions
res = actlay.GetBoundingBox()
xres = res['x2']
yres = res['y2']
#check attributes
print actlay[c4d.ID_BASELIST_NAME]
print actlay[c4d.ID_PAINTBITMAP_PREVIEW]
print actlay[c4d.ID_PAINTLAYER_BLEND]
print actlay[c4d.ID_PAINTLAYER_OPACITY]
print actlay[c4d.ID_PAINTLAYER_SHOW]
#add a new layer
print tex.AddLayerBmp(insertafter=ActLay, useundo=True, activate=True)
######################################################################
#save the whole texture and pass it to the userarea is not what I want
######################################################################
#orig = bitmaps.BaseBitmap()
#orig.InitWith(texturename)
#bitmaps.ShowBitmap(orig)
######################################################################
-How to add a new layer on top of the last one? Why only insertafter?
-[c4d.ID_PAINTBITMAP_PREVIEW]is always None?
Thanks in advance
Martin