Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    User Area Image

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 248 Views
    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 Offline
      Helper
      last edited by

      On 16/12/2013 at 12:36, xxxxxxxx wrote:

      I want to add a user area with an image to a dialogue like this:

        
      GROUP_ID1=1000  
      USERAREA=1010  
        
      class Dialog1(gui.GeDialog) :  
        
        class DialogUserArea(c4d.gui.GeUserArea) :  
            def GetMinSize(self) :  
               self.width = 200  
               self.height = 50  
               return (self.width, self.height)   
        
            def DrawMsg(self, x1, y1, x2, y2, msg) :  
                bmp = c4d.bitmaps.BaseBitmap()  
                dir, file = os.path.split(__file__)  
                path = os.path.join(dir, "res", "test.tif")  
                result = bmp.InitWith(path)  
                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)  
        
            def Redraw(self) :  
                bmp = c4d.bitmaps.BaseBitmap()  
                dir, file = os.path.split(__file__)  
                path = os.path.join(dir, "res", "test.tif")  
                result = bmp.InitWith(path)  
                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)  
        
        def CreateLayout(self) :  
            self.GroupBegin(GROUP_ID1, c4d.BFH_LEFT, 1, 1)  
            self.AddUserArea(USERAREA, flags = c4d.BFH_LEFT, initw=200, inith=50)  
            self.GroupEnd()  
            ua = Dialog1.DialogUserArea()  
            self.AttachUserArea(ua, USERAREA)  
            self.LayoutChanged(GROUP_ID1)  
            ua.Redraw()  
            print XXXXXX # provoke error  
            return True  
              
      class do_command(c4d.plugins.CommandData) :  
          
        def Execute(self, doc) :  
            menu = Dialog1()  
            menu.Open(c4d.DLG_TYPE_MODAL, defaultw=215, defaulth=100)  
            return True  
      

      If I provoke an error message in create layout like print XXXXX the image is there, if CreateLayout returns True there is no image!?
      Probably something stupid, it´s the first time I work with user areas.

      Edited Topic Title

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

        On 17/12/2013 at 04:38, xxxxxxxx wrote:

        Don´t worry, used a Custom Gui Bitmapbutton for that.

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