import c4d, math
from c4d import bitmaps, documents, utils
#Welcome to the world of Python
ROTANGLE = 30.0
ROTVEC = c4d.Vector(utils.Rad(ROTANGLE), 0, 0)
def main():
if op:
maxstep = int(math.floor(360.0 / ROTANGLE))
rd = doc.GetActiveRenderData().GetData()
xres = int(rd[c4d.RDATA_XRES])
yres = int(rd[c4d.RDATA_YRES])
name = rd[c4d.RDATA_PATH]
bmp = bitmaps.BaseBitmap()
bmp.Init(x=xres, y=yres, depth=24)
for i in xrange(maxstep):
c4d.StatusSetSpin()
c4d.StatusSetText('Rendering image {0} of {1}.'.format(i, maxstep))
rd[c4d.RDATA_PATH] = '{0}_{1}'.format(name, i)
res = documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL)
if res != c4d.RENDERRESULT_OK:
break
else:
bitmaps.ShowBitmap(bmp) # remove to avoid the picture manager showing up
op.SetMg(op.GetMg() * utils.HPBToMatrix(ROTVEC))
c4d.StatusClear()
c4d.EventAdd()
if __name__=='__main__':
main()