Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/01/2011 at 16:32, xxxxxxxx wrote:
User Information: Cinema 4D Version: 12 Platform: Mac OSX ; Language(s) : PYTHON ;
--------- Hi there,
I am running into some problems with GeUserArea in Python. Hoping someone can help me with a quick example. I am trying to use a bitmap image in my dialog...
Here is what I have so far:
class DialogUserArea(c4d.gui.GeUserArea) : def GetMinSize(self) : self.width = 20 self.height = 20 return (self.width, self.height)
def DrawMsg(self, x1, y1, x2, y2, msg) : bmp = c4d.bitmaps.BaseBitmap() startuppath = c4d.storage.GeGetStartupPath() path = os.path.join(startuppath, "plugins", "MyPlugin", "icon.tif") result, ismovie = bmp.InitWith(path) if result == c4d.IMAGERESULT_OK: print("load ok!") self.DrawBitmap(bmp, 0, 0, bmp.GetBw(), bmp.GetBh(), 0, 0, bmp.GetBw(), bmp.GetBh(), c4d.BMP_NORMALSCALED | c4d.BMP_ALLOWALPHA) def Redraw(self) : bmp = c4d.bitmaps.BaseBitmap() startuppath = c4d.storage.GeGetStartupPath() path = os.path.join(startuppath, "plugins", "MyPlugin", "icon.tif") result, ismovie = bmp.InitWith(path) if result == c4d.IMAGERESULT_OK: print("load ok!") self.DrawBitmap(bmp, 0, 0, bmp.GetBw(), bmp.GetBh(), 0, 0, bmp.GetBw(), bmp.GetBh(), c4d.BMP_NORMALSCALED | c4d.BMP_ALLOWALPHA)
In my main dialog class, in CreateLayout()... self.AddUserArea(id, c4d.BFH_LEFT | c4d.BFV_CENTER, 20, 20) ua = DialogUserArea() self.AttachUserArea(ua, id) ua.LayoutChanged() ua.Redraw()
This seems like it should be correct, except no image loads... I get a blank beveled area where the image should be and no errors in the console - only a print("load ok!") from my test...
On 16/01/2011 at 17:37, xxxxxxxx wrote:
Ok, I see the problem now (after much frustration)...
My user area must be a distinct member of my dialog class, and then everything works like it should. Will try to post example code after I clean everything up.