Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-07-03 18:20:22 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-07-03 18:42:45 +0300
commitf254f66587f257b7de252644dd73574ad27a32af (patch)
tree9b0836087790ee66748724e6d34df9c85f486e61 /source/blender/editors/space_outliner
parent3aa53b361d135e3620b83a7cf0766c92c41aaccb (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')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c69
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c12
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c12
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c96
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c16
-rw-r--r--source/blender/editors/space_outliner/outliner_utils.c6
8 files changed, 97 insertions, 134 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 131491fcc40..4b012934ab7 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -70,7 +70,7 @@ bool outliner_is_collection_tree_element(const TreeElement *te)
TSE_VIEW_COLLECTION_BASE)) {
return true;
}
- else if (tselem->type == 0 && te->idcode == ID_GR) {
+ if (tselem->type == 0 && te->idcode == ID_GR) {
return true;
}
@@ -89,11 +89,11 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
LayerCollection *lc = te->directdata;
return lc->collection;
}
- else if (ELEM(tselem->type, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
+ if (ELEM(tselem->type, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
Scene *scene = (Scene *)tselem->id;
return scene->master_collection;
}
- else if (tselem->type == 0 && te->idcode == ID_GR) {
+ if (tselem->type == 0 && te->idcode == ID_GR) {
return (Collection *)tselem->id;
}
@@ -338,7 +338,7 @@ void outliner_collection_delete(
skip = true;
break;
}
- else if (parent->flag & COLLECTION_IS_MASTER) {
+ if (parent->flag & COLLECTION_IS_MASTER) {
Scene *parent_scene = BKE_collection_master_scene_search(bmain, parent);
if (ID_IS_LINKED(parent_scene)) {
skip = true;
@@ -1194,7 +1194,7 @@ static bool collection_flag_poll(bContext *C, bool clear, int flag)
if (clear && (collection->flag & flag)) {
return true;
}
- else if (!clear && !(collection->flag & flag)) {
+ if (!clear && !(collection->flag & flag)) {
return true;
}
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)
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 6f5f1294167..1a0f17425fa 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2816,13 +2816,11 @@ int tree_element_id_type_to_index(TreeElement *te)
if (id_index < INDEX_ID_OB) {
return id_index;
}
- else if (id_index == INDEX_ID_OB) {
+ if (id_index == INDEX_ID_OB) {
const Object *ob = (Object *)tselem->id;
return INDEX_ID_OB + ob->type;
}
- else {
- return id_index + OB_TYPE_MAX;
- }
+ return id_index + OB_TYPE_MAX;
}
typedef struct MergedIconRow {
@@ -3590,9 +3588,7 @@ static int outliner_width(SpaceOutliner *soops, int max_tree_width, float restri
if (soops->outlinevis == SO_DATA_API) {
return outliner_data_api_buttons_start_x(max_tree_width) + OL_RNA_COL_SIZEX + 10 * UI_DPI_FAC;
}
- else {
- return max_tree_width + restrict_column_width;
- }
+ return max_tree_width + restrict_column_width;
}
static void outliner_update_viewable_area(ARegion *region,
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index bee8b28e658..bead8ddcc42 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -500,14 +500,14 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked id '%s'", id->name);
return;
}
- else if (BKE_library_ID_is_indirectly_used(bmain, id) && ID_REAL_USERS(id) <= 1) {
+ if (BKE_library_ID_is_indirectly_used(bmain, id) && ID_REAL_USERS(id) <= 1) {
BKE_reportf(reports,
RPT_WARNING,
"Cannot delete id '%s', indirectly used data-blocks need at least one user",
id->name);
return;
}
- else if (te->idcode == ID_WS) {
+ if (te->idcode == ID_WS) {
BKE_workspace_id_tag_all_visible(bmain, LIB_TAG_DOIT);
if (id->tag & LIB_TAG_DOIT) {
BKE_reportf(
@@ -947,12 +947,10 @@ static int outliner_lib_relocate_invoke_do(
((Library *)tselem->id)->filepath_abs);
return OPERATOR_CANCELLED;
}
- else {
- wmOperatorType *ot = WM_operatortype_find(
- reload ? "WM_OT_lib_reload" : "WM_OT_lib_relocate", false);
- return lib_relocate(C, te, tselem, ot, reload);
- }
+ wmOperatorType *ot = WM_operatortype_find(reload ? "WM_OT_lib_reload" : "WM_OT_lib_relocate",
+ false);
+ return lib_relocate(C, te, tselem, ot, reload);
}
}
else {
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 8a408a41897..5f025f08130 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -520,9 +520,7 @@ static eOLDrawState tree_element_active_camera(bContext *C,
return OL_DRAWSEL_NONE;
}
- else {
- return scene->camera == ob;
- }
+ return scene->camera == ob;
}
static eOLDrawState tree_element_active_world(bContext *C,
@@ -1001,9 +999,7 @@ static eOLDrawState tree_element_active_keymap_item(bContext *UNUSED(C),
}
return OL_DRAWSEL_NORMAL;
}
- else {
- kmi->flag ^= KMI_INACTIVE;
- }
+ kmi->flag ^= KMI_INACTIVE;
return OL_DRAWSEL_NONE;
}
@@ -1620,9 +1616,7 @@ static TreeElement *outliner_element_find_successor_in_parents(TreeElement *te)
te = successor->parent->next;
break;
}
- else {
- successor = successor->parent;
- }
+ successor = successor->parent;
}
return te;
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index c0632de1cd7..0aa82783b7a 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -699,8 +699,8 @@ static void outliner_object_delete_fn(bContext *C, ReportList *reports, Scene *s
reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", ob->id.name + 2);
return;
}
- else if (BKE_library_ID_is_indirectly_used(bmain, ob) && ID_REAL_USERS(ob) <= 1 &&
- ID_EXTRA_USERS(ob) == 0) {
+ if (BKE_library_ID_is_indirectly_used(bmain, ob) && ID_REAL_USERS(ob) <= 1 &&
+ ID_EXTRA_USERS(ob) == 0) {
BKE_reportf(reports,
RPT_WARNING,
"Cannot delete object '%s' from scene '%s', indirectly used objects need at "
@@ -1202,8 +1202,8 @@ static Base *outline_batch_delete_hierarchy(
base->object->id.name + 2);
return base_next;
}
- else if (BKE_library_ID_is_indirectly_used(bmain, object) && ID_REAL_USERS(object) <= 1 &&
- ID_EXTRA_USERS(object) == 0) {
+ if (BKE_library_ID_is_indirectly_used(bmain, object) && ID_REAL_USERS(object) <= 1 &&
+ ID_EXTRA_USERS(object) == 0) {
BKE_reportf(reports,
RPT_WARNING,
"Cannot delete object '%s' from scene '%s', indirectly used objects need at least "
@@ -1983,7 +1983,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
return OPERATOR_CANCELLED;
}
- else if (act->idroot == 0) {
+ if (act->idroot == 0) {
/* Hopefully in this case (i.e. library of userless actions),
* the user knows what they're doing. */
BKE_reportf(op->reports,
@@ -2414,32 +2414,29 @@ static int do_outliner_operation_event(
BKE_report(reports, RPT_WARNING, "Mixed selection");
return OPERATOR_CANCELLED;
}
- else {
- return outliner_operator_menu(C, "OUTLINER_OT_scene_operation");
- }
+ return outliner_operator_menu(C, "OUTLINER_OT_scene_operation");
}
- else if (objectlevel) {
+ if (objectlevel) {
WM_menu_name_call(C, "OUTLINER_MT_object", WM_OP_INVOKE_REGION_WIN);
return OPERATOR_FINISHED;
}
- else if (idlevel) {
+ if (idlevel) {
if (idlevel == -1 || datalevel) {
BKE_report(reports, RPT_WARNING, "Mixed selection");
return OPERATOR_CANCELLED;
}
- else {
- switch (idlevel) {
- case ID_GR:
- WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
- return OPERATOR_FINISHED;
- break;
- case ID_LI:
- return outliner_operator_menu(C, "OUTLINER_OT_lib_operation");
- break;
- default:
- return outliner_operator_menu(C, "OUTLINER_OT_id_operation");
- break;
- }
+
+ switch (idlevel) {
+ case ID_GR:
+ WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
+ break;
+ case ID_LI:
+ return outliner_operator_menu(C, "OUTLINER_OT_lib_operation");
+ break;
+ default:
+ return outliner_operator_menu(C, "OUTLINER_OT_id_operation");
+ break;
}
}
else if (datalevel) {
@@ -2447,35 +2444,32 @@ static int do_outliner_operation_event(
BKE_report(reports, RPT_WARNING, "Mixed selection");
return OPERATOR_CANCELLED;
}
- else {
- if (datalevel == TSE_ANIM_DATA) {
- return outliner_operator_menu(C, "OUTLINER_OT_animdata_operation");
- }
- else if (datalevel == TSE_DRIVER_BASE) {
- /* do nothing... no special ops needed yet */
- return OPERATOR_CANCELLED;
- }
- else if (datalevel == TSE_LAYER_COLLECTION) {
- WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
- return OPERATOR_FINISHED;
- }
- else if (ELEM(datalevel, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
- WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN);
- return OPERATOR_FINISHED;
- }
- else if (datalevel == TSE_ID_BASE) {
- /* do nothing... there are no ops needed here yet */
- }
- else if (datalevel == TSE_CONSTRAINT) {
- return outliner_operator_menu(C, "OUTLINER_OT_constraint_operation");
- }
- else if (datalevel == TSE_MODIFIER) {
- return outliner_operator_menu(C, "OUTLINER_OT_modifier_operation");
- }
- else {
- return outliner_operator_menu(C, "OUTLINER_OT_data_operation");
- }
+ if (datalevel == TSE_ANIM_DATA) {
+ return outliner_operator_menu(C, "OUTLINER_OT_animdata_operation");
+ }
+ if (datalevel == TSE_DRIVER_BASE) {
+ /* do nothing... no special ops needed yet */
+ return OPERATOR_CANCELLED;
+ }
+ if (datalevel == TSE_LAYER_COLLECTION) {
+ WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
+ }
+ if (ELEM(datalevel, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
+ WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
+ }
+ if (datalevel == TSE_ID_BASE) {
+ /* do nothing... there are no ops needed here yet */
+ return 0;
+ }
+ if (datalevel == TSE_CONSTRAINT) {
+ return outliner_operator_menu(C, "OUTLINER_OT_constraint_operation");
+ }
+ if (datalevel == TSE_MODIFIER) {
+ return outliner_operator_menu(C, "OUTLINER_OT_modifier_operation");
}
+ return outliner_operator_menu(C, "OUTLINER_OT_data_operation");
}
return 0;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index bc272431e3a..544c41a3a7b 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1666,10 +1666,10 @@ static int treesort_alpha_ob(const void *v1, const void *v2)
if (comp == 1) {
return 1;
}
- else if (comp == 2) {
+ if (comp == 2) {
return -1;
}
- else if (comp == 3) {
+ if (comp == 3) {
/* Among objects first come the ones in the collection, followed by the ones not on it.
* This way we can have the dashed lines in a separate style connecting the former. */
if ((x1->te->flag & TE_CHILD_NOT_IN_COLLECTION) !=
@@ -1682,7 +1682,7 @@ static int treesort_alpha_ob(const void *v1, const void *v2)
if (comp > 0) {
return 1;
}
- else if (comp < 0) {
+ if (comp < 0) {
return -1;
}
return 0;
@@ -1714,7 +1714,7 @@ static int treesort_alpha(const void *v1, const void *v2)
if (comp > 0) {
return 1;
}
- else if (comp < 0) {
+ if (comp < 0) {
return -1;
}
return 0;
@@ -1981,9 +1981,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
if (te->ys + UI_UNIT_Y > view_co_limit) {
return te_sub;
}
- else {
- return NULL;
- }
+ return NULL;
}
if (te->next) {
@@ -2191,7 +2189,7 @@ static bool outliner_element_is_collection_or_object(TreeElement *te)
if ((tselem->type == 0) && (te->idcode == ID_OB)) {
return true;
}
- else if (outliner_is_collection_tree_element(te)) {
+ if (outliner_is_collection_tree_element(te)) {
return true;
}
@@ -2241,7 +2239,7 @@ static int outliner_filter_subtree(SpaceOutliner *soops,
te_next = outliner_extract_children_from_subtree(te, lb);
continue;
}
- else if ((exclude_filter & SO_FILTER_SEARCH) == 0) {
+ if ((exclude_filter & SO_FILTER_SEARCH) == 0) {
/* Filter subtree too. */
outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
continue;
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index a120718e36b..9accf35784a 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -122,7 +122,7 @@ static TreeElement *outliner_find_item_at_x_in_row_recursive(const TreeElement *
if ((child_te->flag & TE_ICONROW) && over_element) {
return child_te;
}
- else if ((child_te->flag & TE_ICONROW_MERGED) && over_element) {
+ if ((child_te->flag & TE_ICONROW_MERGED) && over_element) {
if (r_merged) {
*r_merged = true;
}
@@ -409,9 +409,7 @@ bool outliner_is_element_visible(const TreeElement *te)
if (tselem->flag & TSE_CLOSED) {
return false;
}
- else {
- te = te->parent;
- }
+ te = te->parent;
}
return true;