diff options
author | Dalai Felinto <dalai@blender.org> | 2022-09-09 12:50:21 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2022-09-09 12:51:07 +0300 |
commit | dc937c5aee4532485c1927c278fe099f2f471f7e (patch) | |
tree | 3f935d3c6f7d774aeb445e81498c2fc2e4c19f11 /source/blender/editors/space_node/node_relationships.cc | |
parent | 58945b07f1171d5f29018e3561870d99efc3597a (diff) |
Fix Auto-offset for nodes: Revert "Cleanup: Return early"
This "cleanup" commit broke Auto-offset for nodes.
This reverts commit e3ef6a6660032ca18af53dd24cd19bf36e56a85c.
Diffstat (limited to 'source/blender/editors/space_node/node_relationships.cc')
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 40f5d20d06d..7dbaa8ccd6d 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -1727,35 +1727,34 @@ static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent SpaceNode &snode = *CTX_wm_space_node(C); bNodeTree &ntree = *snode.edittree; bNode *frame = node_find_frame_to_attach(region, ntree, event->mval); - if (frame == nullptr) { - return OPERATOR_CANCELLED; - } - LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) { - if (node->flag & NODE_SELECT) { - if (node->parent == nullptr) { - /* disallow moving a parent into its child */ - if (nodeAttachNodeCheck(frame, node) == false) { - /* attach all unparented nodes */ - nodeAttachNode(node, frame); - } - } - else { - /* attach nodes which share parent with the frame */ - bNode *parent; - for (parent = frame->parent; parent; parent = parent->parent) { - if (parent == node->parent) { - break; - } - } - - if (parent) { + if (frame) { + LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) { + if (node->flag & NODE_SELECT) { + if (node->parent == nullptr) { /* disallow moving a parent into its child */ if (nodeAttachNodeCheck(frame, node) == false) { - nodeDetachNode(node); + /* attach all unparented nodes */ nodeAttachNode(node, frame); } } + else { + /* attach nodes which share parent with the frame */ + bNode *parent; + for (parent = frame->parent; parent; parent = parent->parent) { + if (parent == node->parent) { + break; + } + } + + if (parent) { + /* disallow moving a parent into its child */ + if (nodeAttachNodeCheck(frame, node) == false) { + nodeDetachNode(node); + nodeAttachNode(node, frame); + } + } + } } } } |