From ddddb7bab173b040342ef99270ee71ae076d45e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Mar 2013 03:46:30 +0000 Subject: code cleanup: favor braces when blocks have mixed brace use. --- source/blender/editors/space_outliner/outliner_draw.c | 18 +++++++++++++----- source/blender/editors/space_outliner/outliner_edit.c | 10 +++++++--- .../blender/editors/space_outliner/outliner_select.c | 14 ++++++++++---- source/blender/editors/space_outliner/outliner_tools.c | 14 ++++++++++---- source/blender/editors/space_outliner/outliner_tree.c | 12 ++++++++---- 5 files changed, 48 insertions(+), 20 deletions(-) (limited to 'source/blender/editors/space_outliner') diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 3d5125fc075..2c88ef158b0 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1236,12 +1236,20 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa /* active blocks get white circle */ if (tselem->type == 0) { - if (te->idcode == ID_OB) active = (OBACT == (Object *)tselem->id); - else if (scene->obedit && scene->obedit->data == tselem->id) active = 1; // XXX use context? - else active = tree_element_active(C, scene, soops, te, 0); + if (te->idcode == ID_OB) { + active = (OBACT == (Object *)tselem->id); + } + else if (scene->obedit && scene->obedit->data == tselem->id) { + active = 1; // XXX use context? + } + else { + active = tree_element_active(C, scene, soops, te, 0); + } } - else active = tree_element_type_active(NULL, scene, soops, te, tselem, 0); - + else { + active = tree_element_type_active(NULL, scene, soops, te, tselem, 0); + } + if (active) { float ufac = UI_UNIT_X / 20.0f; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 9a1b3628196..e3290e7dd82 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -890,9 +890,13 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase else tselem->flag |= TSE_CLOSED; } } - else tselem->flag |= TSE_CLOSED; - - if (TSELEM_OPEN(tselem, soops)) tree_element_show_hierarchy(scene, soops, &te->subtree); + else { + tselem->flag |= TSE_CLOSED; + } + + if (TSELEM_OPEN(tselem, soops)) { + tree_element_show_hierarchy(scene, soops, &te->subtree); + } } } diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index fa337ba7af1..b3d8dc9f366 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -148,7 +148,9 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops Object *ob = NULL; /* if id is not object, we search back */ - if (te->idcode == ID_OB) ob = (Object *)tselem->id; + if (te->idcode == ID_OB) { + ob = (Object *)tselem->id; + } else { ob = (Object *)outliner_search_back(soops, te, ID_OB); if (ob == OBACT) return 0; @@ -312,7 +314,9 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops if (set) { // XXX extern_set_butspace(F5KEY, 0); } - else return 1; + else { + return 1; + } return 0; } @@ -791,9 +795,11 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa else { // rest of types tree_element_active(C, scene, soops, te, 1); } - + + } + else { + tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0)); } - else tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0)); return 1; } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 0a3aea3b1f9..07e22363ad5 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -190,8 +190,10 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle World *wrld = (World *)tsep->id; mtex = wrld->mtex; } - else return; - + else { + return; + } + for (a = 0; a < MAX_MTEX; a++) { if (a == te->index && mtex[a]) { if (mtex[a]->tex) { @@ -1259,7 +1261,9 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL); } else if (idlevel) { - if (idlevel == -1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection"); + if (idlevel == -1 || datalevel) { + BKE_report(reports, RPT_WARNING, "Mixed selection"); + } else { if (idlevel == ID_GR) WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL); @@ -1268,7 +1272,9 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S } } else if (datalevel) { - if (datalevel == -1) BKE_report(reports, RPT_WARNING, "Mixed selection"); + if (datalevel == -1) { + BKE_report(reports, RPT_WARNING, "Mixed selection"); + } else { if (datalevel == TSE_ANIM_DATA) WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index f723fbedc7b..62c947594b3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1257,19 +1257,23 @@ static int treesort_obtype_alpha(const void *v1, const void *v2) const tTreeSort *x1 = v1, *x2 = v2; /* first put objects last (hierarchy) */ - if (x1->idcode == ID_OB && x2->idcode != ID_OB) return 1; - else if (x2->idcode == ID_OB && x1->idcode != ID_OB) return -1; + if (x1->idcode == ID_OB && x2->idcode != ID_OB) { + return 1; + } + else if (x2->idcode == ID_OB && x1->idcode != ID_OB) { + return -1; + } else { /* 2nd we check ob type */ if (x1->idcode == ID_OB && x2->idcode == ID_OB) { - if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; + if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1; else return 0; } else { int comp = strcmp(x1->name, x2->name); - if (comp > 0) return 1; + if (comp > 0) return 1; else if (comp < 0) return -1; return 0; } -- cgit v1.2.3