Fix Auto-offset for nodes: Revert "Cleanup: Return early"

This "cleanup" commit broke Auto-offset for nodes.

This reverts commit e3ef6a6660.
This commit is contained in:
2022-09-09 11:50:21 +02:00
parent 58945b07f1
commit dc937c5aee
2 changed files with 42 additions and 45 deletions

View File

@@ -1727,10 +1727,8 @@ static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
SpaceNode &snode = *CTX_wm_space_node(C); SpaceNode &snode = *CTX_wm_space_node(C);
bNodeTree &ntree = *snode.edittree; bNodeTree &ntree = *snode.edittree;
bNode *frame = node_find_frame_to_attach(region, ntree, event->mval); bNode *frame = node_find_frame_to_attach(region, ntree, event->mval);
if (frame == nullptr) {
return OPERATOR_CANCELLED;
}
if (frame) {
LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) { LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) {
if (node->flag & NODE_SELECT) { if (node->flag & NODE_SELECT) {
if (node->parent == nullptr) { if (node->parent == nullptr) {
@@ -1759,6 +1757,7 @@ static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
} }
} }
} }
}
node_sort(ntree); node_sort(ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);

View File

@@ -14,7 +14,6 @@
#include "BLI_lasso_2d.h" #include "BLI_lasso_2d.h"
#include "BLI_listbase.h" #include "BLI_listbase.h"
#include "BLI_rect.h" #include "BLI_rect.h"
#include "BLI_set.hh"
#include "BLI_string.h" #include "BLI_string.h"
#include "BLI_string_search.h" #include "BLI_string_search.h"
#include "BLI_string_utf8.h" #include "BLI_string_utf8.h"
@@ -645,10 +644,8 @@ static bool node_mouse_select(bContext *C,
} }
} }
if (!(changed || found)) { /* update node order */
return false; if (changed || found) {
}
bool active_texture_changed = false; bool active_texture_changed = false;
bool viewer_node_changed = false; bool viewer_node_changed = false;
if ((node != nullptr) && (node_was_selected == false || params->select_passthrough == false)) { if ((node != nullptr) && (node_was_selected == false || params->select_passthrough == false)) {
@@ -666,8 +663,9 @@ static bool node_mouse_select(bContext *C,
} }
WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr);
}
return true; return changed || found;
} }
static int node_select_exec(bContext *C, wmOperator *op) static int node_select_exec(bContext *C, wmOperator *op)