On 10/02/2014 at 05:31, xxxxxxxx wrote:
Using Cinema R15 on OSX; I am trying to using the python API extract a UV map from a mulipass-render.
This can be done none programatically by going into [ render -> edit render settings ] then enabling multipass and then adding and enabling 'Material UVW'
The problem is that can't get this to reliably work programatically. Below is the code I trying:
def test(doc) :
#creates a new render data object
rd1=c4d.documents.RenderData()
#add multipass
vuvw=c4d.BaseList2D(c4d.Zmultipass)
vuvw.GetDataInstance()[c4d.MULTIPASSOBJECT_TYPE] = c4d.VPBUFFER_MAT_UV
rd1.InsertMultipass(vuvw)
rd=rd1.GetDataInstance()
rd[c4d.RDATA_MULTIPASS_ENABLE]=True
#det dimensions
xres=800
yres=800
rd[c4d.RDATA_XRES]=float(xres)
rd[c4d.RDATA_YRES]=float(yres)
#set output
bmp = c4d.bitmaps.MultipassBitmap(xres, yres, c4d.COLORMODE_RGBw)
res = c4d.documents.RenderDocument(doc, rd, bmp)
if res!=c4d.RENDERRESULT_OK:
print 'Render Failed!!!'
return False
else:
print 'Render Success!!!'
#print layer names
for i in range(bmp.GetLayerCount()) :
print bmp.GetLayerNum(i).GetParameter(c4d.MPBTYPE_NAME)
This code just prints out 'Background' instead of Background and 'Material UV'. (This is confirmed by writing the layers out to a file).
I am not really sure what I am doing wrong, of course please ask if there is any additional information I can provide.
Thanks for any help in advance!