Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    GeUserArea - python

    PYTHON Development
    0
    2
    469
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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...

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post