From 7a2c386e281db72871dda33944502b7a7e7a6df9 Mon Sep 17 00:00:00 2001 From: Robert Yevdokimov Date: Fri, 12 Jan 2024 12:49:10 -0500 Subject: [PATCH] Clear drag preview nodes on `NOTIFICATION_DRAG_END` --- editor/plugins/canvas_item_editor_plugin.cpp | 4 ++++ editor/plugins/node_3d_editor_plugin.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f16aff555c88..1eb0f783b9b0 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -6027,6 +6027,10 @@ void CanvasItemEditorViewport::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { disconnect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); } break; + + case NOTIFICATION_DRAG_END: { + _remove_preview(); + } break; } } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index e4d24832bff2..74bd7e817218 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3017,6 +3017,8 @@ void Node3DEditorViewport::_notification(int p_what) { // Clear preview material when dropped outside applicable object. if (spatial_editor->get_preview_material().is_valid() && !is_drag_successful()) { _remove_preview_material(); + } else { + _remove_preview_node(); } } break; }