Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene tree drag&drop does not work after delay #91270

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void SceneTreeDock::_quick_open() {
}

void SceneTreeDock::_inspect_hovered_node() {
scene_tree->set_selected(node_hovered_now);
scene_tree->set_selected(node_hovered_now, false);
scene_tree->set_marked(node_hovered_now);
Tree *tree = scene_tree->get_scene_tree();
TreeItem *item = tree->get_item_at_position(tree->get_local_mouse_position());
Expand All @@ -97,8 +97,8 @@ void SceneTreeDock::_handle_hover_to_inspect() {
node_hovered_now = get_node_or_null(np);
if (node_hovered_previously != node_hovered_now) {
inspect_hovered_node_delay->start();
node_hovered_previously = node_hovered_now;
}
node_hovered_previously = node_hovered_now;
} else {
_reset_hovering_timer();
}
Expand Down Expand Up @@ -1586,8 +1586,15 @@ void SceneTreeDock::_notification(int p_what) {
}
} break;

case NOTIFICATION_DRAG_BEGIN: {
drop_completed = false;
} break;

case NOTIFICATION_DRAG_END: {
_reset_hovering_timer();
if (!drop_completed) {
EditorNode::get_singleton()->edit_current();
}
} break;
}
}
Expand Down Expand Up @@ -3306,6 +3313,8 @@ void SceneTreeDock::_nodes_dragged(const Array &p_nodes, NodePath p_to, int p_ty
for (Node *E : nodes) {
editor_selection->add_node(E);
}

drop_completed = true;
}

void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
Expand Down
1 change: 1 addition & 0 deletions editor/scene_tree_dock.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ class SceneTreeDock : public VBoxContainer {
Timer *inspect_hovered_node_delay = nullptr;
Node *node_hovered_now = nullptr;
Node *node_hovered_previously = nullptr;
bool drop_completed = false;

virtual void input(const Ref<InputEvent> &p_event) override;
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
Expand Down
Loading