On 28/11/2015 at 07:32, xxxxxxxx wrote:
I am fairly new to coding in CInema 4D and python so my code isn't the nicest and the most efficient one
This is my Code:
class OwlView(gui.GeDialog) :
def CreateLayout(self) :
self.SetTitle("Owl View")
self.GroupBegin(0, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, "Owl View", 0)
path, fn = os.path.split(__file__)
path = os.path.join(path, "res/icons/", "pre.tif")
bc = c4d.BaseContainer()
bc.SetFilename(MY_BITMAP_BUTTON, path)
self.myBitButton=self.AddCustomGui(MY_BITMAP_BUTTON, c4d.CUSTOMGUI_BITMAPBUTTON, "PReview", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT | c4d.BFH_CENTER | c4d.BFV_CENTER | c4d.BFV_BOTTOM, 30, 30, bc)
self.myBitButton.SetImage(path, False)
self.GroupEnd()
return True
def Command(self, id, msg=None) :
if id==MY_BITMAP_BUTTON:
doc = documents.GetActiveDocument()
rd = doc.GetActiveRenderData().GetData()
xres = int(rd[c4d.RDATA_XRES])
yres = int(rd[c4d.RDATA_YRES])
bmp = bitmaps.BaseBitmap()
outp = documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL)
if outp ==c4d.RENDERRESULT_OK:
self.myBitButton.SetImage(bmp, False)
return True
return True
I don't know what I have done wrong, or not as supposed, and I know your not here to correct my code but I don't understand everything so that I could correct it myself ^^
Greetings,
neon