Cleanup: Return early

This commit is contained in:
2022-09-06 12:13:15 -05:00
parent 545fb528d5
commit e3ef6a6660
2 changed files with 45 additions and 42 deletions

View File

@@ -1727,8 +1727,10 @@ 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) {
@@ -1757,7 +1759,6 @@ 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,6 +14,7 @@
#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"
@@ -644,8 +645,10 @@ static bool node_mouse_select(bContext *C,
} }
} }
/* update node order */ if (!(changed || found)) {
if (changed || found) { return false;
}
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)) {
@@ -663,9 +666,8 @@ 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 changed || found; return true;
} }
static int node_select_exec(bContext *C, wmOperator *op) static int node_select_exec(bContext *C, wmOperator *op)