Merge pull request #56063 from KoBeWi/dragging_nodes_over_wifi
This commit is contained in:
commit
f2791a75b3
2 changed files with 35 additions and 0 deletions
|
@ -225,6 +225,39 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int
|
||||||
updating_scene_tree = false;
|
updating_scene_tree = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variant EditorDebuggerTree::get_drag_data(const Point2 &p_point) {
|
||||||
|
if (get_button_id_at_position(p_point) != -1) {
|
||||||
|
return Variant();
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeItem *selected = get_selected();
|
||||||
|
if (!selected) {
|
||||||
|
return Variant();
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = selected->get_text(0);
|
||||||
|
|
||||||
|
HBoxContainer *hb = memnew(HBoxContainer);
|
||||||
|
TextureRect *tf = memnew(TextureRect);
|
||||||
|
tf->set_texture(selected->get_icon(0));
|
||||||
|
tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
|
||||||
|
hb->add_child(tf);
|
||||||
|
Label *label = memnew(Label(path));
|
||||||
|
hb->add_child(label);
|
||||||
|
set_drag_preview(hb);
|
||||||
|
|
||||||
|
if (!selected->get_parent() || !selected->get_parent()->get_parent()) {
|
||||||
|
path = ".";
|
||||||
|
} else {
|
||||||
|
while (selected->get_parent()->get_parent() != get_root()) {
|
||||||
|
selected = selected->get_parent();
|
||||||
|
path = selected->get_text(0) + "/" + path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vformat("\"%s\"", path);
|
||||||
|
}
|
||||||
|
|
||||||
String EditorDebuggerTree::get_selected_path() {
|
String EditorDebuggerTree::get_selected_path() {
|
||||||
if (!get_selected()) {
|
if (!get_selected()) {
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -65,6 +65,8 @@ protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual Variant get_drag_data(const Point2 &p_point) override;
|
||||||
|
|
||||||
String get_selected_path();
|
String get_selected_path();
|
||||||
ObjectID get_selected_object();
|
ObjectID get_selected_object();
|
||||||
int get_current_debugger(); // Would love to have one tree for every debugger.
|
int get_current_debugger(); // Would love to have one tree for every debugger.
|
||||||
|
|
Loading…
Reference in a new issue