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
    • Login

    Draw Icon (maxon id) into treeview list geUserArea()

    Cinema 4D SDK
    r25 python
    2
    3
    533
    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.
    • M
      mogh
      last edited by

      Dear Developers,

      I want to draw some Maxon ID icons into my treeview list. Very similar tor the missing texture list inside c4d
      list_icon.png

      I dabled with these two functions but can't get the to work

      get it to work prior to R25 would be a bonus

      Thanks in advance.

      # here i can't figure out what to put into  mode= maxon.IMAGEINTERPOLATIONMODE
      
      geUserArea.DrawImageRef(1018641, wx=0, wy=0, ww=16, wh=16, opacity=0.5, mode= maxon.IMAGEINTERPOLATIONMODE)
      
      
      # how do i injest a maxon icon into the basebitmap ?
      
      geUserArea.DrawBitmap(c4d.basebitmap, wx=0, wy=0, ww=16, wh=16, x=0, y=0, w=16, h=16, mode=c4d.BMP_NORMAL)
      

      just for context here my COL method from the treelist example:

              if col == ID_INSCENE:
                  #icon 13957 X
                  #icon 1018640 OK Checkmark
                  #icon 1018641 X Not ok red
              
                  self.rootobj = getallrootnull_name()
                  name = ""
                  #name = self.drawicon()
      
                  if str(obj) in self.rootobj:
                      name = "found"
      
                  #name = obj.getfilepath()            
                  geUserArea = drawinfo["frame"]
                  w = geUserArea.DrawGetTextWidth(name)
                  h = geUserArea.DrawGetFontHeight()
                  xpos = drawinfo["xpos"]
                  ypos = drawinfo["ypos"] + drawinfo["height"]
                  #drawinfo["frame"].DrawText(name, xpos, ypos - int(h * 1.1) )
                  drawinfo["frame"].DrawImageRef(1018641, wx=0, wy=0, ww=16, wh=16, opacity=0.5, mode=0)
      

      kind regards
      mogh

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hi,

        You should use the function DrawCell to draw your icon. That is probably what you are doing but it's not clear.

        This thread should help you to understand how to do it.

        You can retrieve any icon with the command c4d.gui.GetIcon(lIconID)

        You can find the IDs of the icons on that page

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • M
          mogh
          last edited by

          Thanks, @m_magalhaes
          yes my code is inside the drawcell() method.

          I didn' have any luck with c4d.gui.GetIcon(lIconID)
          but i got c4d.bitmaps.InitResourceBitmap(resource_id)
          working.

          here are my 3 lines of code that got me an icon.

          ICON_SIZE = drawinfo["height"]
          bmp = c4d.bitmaps.InitResourceBitmap(12098)
          geUserArea.DrawBitmap(bmp, drawinfo["xpos"], drawinfo["ypos"], ICON_SIZE, ICON_SIZE, 0, 0, bmp.GetBw(), bmp.GetBh(), c4d.BMP_ALLOWALPHA)
          

          kind regards
          mogh

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