How to get a color picker button in a Tree?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By woopdeedoo

The tree only seems to support string, check, range and icon buttons. So how can we get color pickers?

(Or how does Godot’s inspector panel do it?)

I figured out the custom one a bit, but not enough. I think it may be the answer, but I can’t figure out how. This:

item.set_cell_mode(1, TreeItem.CELL_MODE_CUSTOM)
item.set_custom_draw(1, self, "foo")

Doesn’t see to ever call this callback:

func foo():
	print("TreeItem callback was called")

And I can’t figure out how to make it call it…

:bust_in_silhouette: Reply From: elamaunt

It works for me with a properly draw method. Just add required parameters

func foo(item, rect):
    tree.draw_rect(rect,,1,1))  # draws your color as cell's background