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

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

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

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

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