diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 02:19:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 12:48:16 +0300 |
commit | 620b960d3d8cfd90b9f0df6ba3671c33eccb8309 (patch) | |
tree | 64f69db4bf9d44f0a32d1c92b0714bf2dc98ff2d /source/blender/editors/object/object_collection.c | |
parent | bba60bb564cf5a16cfcac744d4ba82cf8eba3da9 (diff) |
Cleanup: style, use braces for editors
Diffstat (limited to 'source/blender/editors/object/object_collection.c')
-rw-r--r-- | source/blender/editors/object/object_collection.c | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c index e0de4b8faef..54c50db99a5 100644 --- a/source/blender/editors/object/object_collection.c +++ b/source/blender/editors/object/object_collection.c @@ -79,8 +79,9 @@ static const EnumPropertyItem *collection_object_active_itemf(bContext *C, /* if 2 or more collections, add option to add to all collections */ collection = NULL; - while ((collection = BKE_collection_object_find(bmain, scene, collection, ob))) + while ((collection = BKE_collection_object_find(bmain, scene, collection, ob))) { count++; + } if (count >= 2) { item_tmp.identifier = item_tmp.name = "All Collections"; @@ -135,19 +136,23 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) bool is_cycle = false; bool updated = false; - if (ob == NULL) + if (ob == NULL) { return OPERATOR_CANCELLED; + } /* now add all selected objects to the collection(s) */ FOREACH_COLLECTION_BEGIN (bmain, scene, Collection *, collection) { - if (single_collection && collection != single_collection) + if (single_collection && collection != single_collection) { continue; - if (!BKE_collection_has_object(collection, ob)) + } + if (!BKE_collection_has_object(collection, ob)) { continue; + } CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { - if (BKE_collection_has_object(collection, base->object)) + if (BKE_collection_has_object(collection, base->object)) { continue; + } if (!BKE_collection_object_cyclic_check(bmain, base->object, collection)) { BKE_collection_object_add(bmain, collection, base->object); @@ -162,11 +167,13 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) } FOREACH_COLLECTION_END; - if (is_cycle) + if (is_cycle) { BKE_report(op->reports, RPT_WARNING, "Skipped some collections because of cycle detected"); + } - if (!updated) + if (!updated) { return OPERATOR_CANCELLED; + } DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); @@ -214,14 +221,16 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) bmain, scene, ob, single_collection_index); bool ok = false; - if (ob == NULL) + if (ob == NULL) { return OPERATOR_CANCELLED; + } /* Linking to same collection requires its own loop so we can avoid * looking up the active objects collections each time. */ FOREACH_COLLECTION_BEGIN (bmain, scene, Collection *, collection) { - if (single_collection && collection != single_collection) + if (single_collection && collection != single_collection) { continue; + } if (BKE_collection_has_object(collection, ob)) { /* Remove collections from selected objects */ @@ -235,8 +244,9 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) } FOREACH_COLLECTION_END; - if (!ok) + if (!ok) { BKE_report(op->reports, RPT_ERROR, "Active object contains no collections"); + } DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); @@ -314,14 +324,17 @@ static int collection_objects_remove_exec(bContext *C, wmOperator *op) bmain, scene, ob, single_collection_index); bool updated = false; - if (ob == NULL) + if (ob == NULL) { return OPERATOR_CANCELLED; + } FOREACH_COLLECTION_BEGIN (bmain, scene, Collection *, collection) { - if (single_collection && collection != single_collection) + if (single_collection && collection != single_collection) { continue; - if (!BKE_collection_has_object(collection, ob)) + } + if (!BKE_collection_has_object(collection, ob)) { continue; + } /* now remove all selected objects from the collection */ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -333,8 +346,9 @@ static int collection_objects_remove_exec(bContext *C, wmOperator *op) } FOREACH_COLLECTION_END; - if (!updated) + if (!updated) { return OPERATOR_CANCELLED; + } DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); @@ -418,8 +432,9 @@ static int collection_add_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob = ED_object_context(C); Main *bmain = CTX_data_main(C); - if (ob == NULL) + if (ob == NULL) { return OPERATOR_CANCELLED; + } Collection *collection = BKE_collection_add(bmain, NULL, "Collection"); id_fake_user_set(&collection->id); @@ -454,8 +469,9 @@ static int collection_link_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); Collection *collection = BLI_findlink(&bmain->collections, RNA_enum_get(op->ptr, "collection")); - if (ELEM(NULL, ob, collection)) + if (ELEM(NULL, ob, collection)) { return OPERATOR_CANCELLED; + } /* Early return check, if the object is already in collection * we could skip all the dependency check and just consider @@ -517,8 +533,9 @@ static int collection_remove_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob = ED_object_context(C); Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data; - if (!ob || !collection) + if (!ob || !collection) { return OPERATOR_CANCELLED; + } BKE_collection_object_remove(bmain, collection, ob, false); @@ -550,8 +567,9 @@ static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op)) Main *bmain = CTX_data_main(C); Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data; - if (!collection) + if (!collection) { return OPERATOR_CANCELLED; + } BKE_id_delete(bmain, collection); @@ -583,8 +601,9 @@ static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data; - if (!collection) + if (!collection) { return OPERATOR_CANCELLED; + } CTX_DATA_BEGIN (C, Base *, base, visible_bases) { if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) { |