Fix #147698: Prevent drag drop inside packed nodetree interface

When node tree is packed, prevent drag-drop operation from rearranging
the socket/panel inside node-tree interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/147794
This commit is contained in:
Pratik Borhade
2025-10-18 13:14:39 +02:00
committed by Pratik Borhade
parent e259769e9d
commit 74586023fb

View File

@@ -7,6 +7,7 @@
*/ */
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_library.hh"
#include "BKE_main_invariants.hh" #include "BKE_main_invariants.hh"
#include "BKE_node_tree_interface.hh" #include "BKE_node_tree_interface.hh"
@@ -332,6 +333,9 @@ class NodeTreeInterfaceView : public AbstractTreeView {
std::unique_ptr<AbstractViewItemDragController> NodeSocketViewItem::create_drag_controller() const std::unique_ptr<AbstractViewItemDragController> NodeSocketViewItem::create_drag_controller() const
{ {
if (!ID_IS_EDITABLE(&nodetree_.id)) {
return nullptr;
}
return std::make_unique<NodeTreeInterfaceDragController>( return std::make_unique<NodeTreeInterfaceDragController>(
static_cast<NodeTreeInterfaceView &>(this->get_tree_view()), socket_.item, nodetree_); static_cast<NodeTreeInterfaceView &>(this->get_tree_view()), socket_.item, nodetree_);
} }
@@ -343,6 +347,9 @@ std::unique_ptr<TreeViewItemDropTarget> NodeSocketViewItem::create_drop_target()
std::unique_ptr<AbstractViewItemDragController> NodePanelViewItem::create_drag_controller() const std::unique_ptr<AbstractViewItemDragController> NodePanelViewItem::create_drag_controller() const
{ {
if (!ID_IS_EDITABLE(&nodetree_.id)) {
return nullptr;
}
return std::make_unique<NodeTreeInterfaceDragController>( return std::make_unique<NodeTreeInterfaceDragController>(
static_cast<NodeTreeInterfaceView &>(this->get_tree_view()), panel_.item, nodetree_); static_cast<NodeTreeInterfaceView &>(this->get_tree_view()), panel_.item, nodetree_);
} }