diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-07-03 18:20:22 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-07-03 18:42:45 +0300 |
commit | f254f66587f257b7de252644dd73574ad27a32af (patch) | |
tree | 9b0836087790ee66748724e6d34df9c85f486e61 /source/blender/editors/space_outliner/outliner_dragdrop.c | |
parent | 3aa53b361d135e3620b83a7cf0766c92c41aaccb (diff) |
Cleanup: Editors/Space/Outliner, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/space_outliner` module.
No functional changes.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_dragdrop.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_dragdrop.c | 69 |
1 files changed, 27 insertions, 42 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 70a628eead0..09d7f889bde 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -123,9 +123,7 @@ static ID *outliner_ID_drop_find(bContext *C, const wmEvent *event, short idcode if (te && te->idcode == idcode && tselem->type == 0) { return tselem->id; } - else { - return NULL; - } + return NULL; } /* Find tree element to drop into, with additional before and after reorder support. */ @@ -154,44 +152,35 @@ static TreeElement *outliner_drop_insert_find(bContext *C, *r_insert_type = TE_INSERT_INTO; return te_hovered; } - else { - *r_insert_type = TE_INSERT_BEFORE; - return te_hovered->subtree.first; - } + *r_insert_type = TE_INSERT_BEFORE; + return te_hovered->subtree.first; } - else { - *r_insert_type = TE_INSERT_AFTER; - return te_hovered; - } - } - else if (view_mval[1] > (te_hovered->ys + (3 * margin))) { - *r_insert_type = TE_INSERT_BEFORE; + *r_insert_type = TE_INSERT_AFTER; return te_hovered; } - else { - *r_insert_type = TE_INSERT_INTO; + if (view_mval[1] > (te_hovered->ys + (3 * margin))) { + *r_insert_type = TE_INSERT_BEFORE; return te_hovered; } + *r_insert_type = TE_INSERT_INTO; + return te_hovered; } - else { - /* Mouse doesn't hover any item (ignoring x-axis), - * so it's either above list bounds or below. */ - TreeElement *first = soops->tree.first; - TreeElement *last = soops->tree.last; - if (view_mval[1] < last->ys) { - *r_insert_type = TE_INSERT_AFTER; - return last; - } - else if (view_mval[1] > (first->ys + UI_UNIT_Y)) { - *r_insert_type = TE_INSERT_BEFORE; - return first; - } - else { - BLI_assert(0); - return NULL; - } + /* Mouse doesn't hover any item (ignoring x-axis), + * so it's either above list bounds or below. */ + TreeElement *first = soops->tree.first; + TreeElement *last = soops->tree.last; + + if (view_mval[1] < last->ys) { + *r_insert_type = TE_INSERT_AFTER; + return last; } + if (view_mval[1] > (first->ys + UI_UNIT_Y)) { + *r_insert_type = TE_INSERT_BEFORE; + return first; + } + BLI_assert(0); + return NULL; } static Collection *outliner_collection_from_tree_element_and_parents(TreeElement *te, @@ -270,9 +259,7 @@ static bool parent_drop_allowed(TreeElement *te, Object *potential_child) } return false; } - else { - return true; - } + return true; } static bool allow_parenting_without_modifier_key(SpaceOutliner *soops) @@ -650,7 +637,7 @@ static Collection *collection_parent_from_ID(ID *id) if (GS(id->name) == ID_SCE) { return ((Scene *)id)->master_collection; } - else if (GS(id->name) == ID_GR) { + if (GS(id->name) == ID_GR) { return (Collection *)id; } @@ -772,12 +759,10 @@ static bool collection_drop_poll(bContext *C, } return true; } - else { - if (changed) { - ED_region_tag_redraw_no_rebuild(region); - } - return false; + if (changed) { + ED_region_tag_redraw_no_rebuild(region); } + return false; } static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) |