Godot Version
4.2.1
Question
I’m implementing a tree control and would like to be able to drag and drop portions of it to rearrange the tree. As far as I can tell, the only thing I need to do to enable dragging from within my control is to override the _get_drag_data method. But this method is never called, even if I click and drag on one of the children within the tree. Is there something else I need to do to be able to start a drag from my tree?
func _get_drag_data(at_position:Vector2)->Variant:
print("_get_drag_data")
var item:TreeItem = %Tree.get_item_at_position(at_position)
if !item:
return null
var tier:TestTreeDataModel.Tier = node_map[item]
var label:Label = Label.new()
label.text = tier.name
set_drag_preview(label)
return tier.get_parent()