diff options
author | Julian Eisel <julian@blender.org> | 2022-01-13 18:58:38 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-01-13 19:01:47 +0300 |
commit | 22dc865a86520e70ce05bd099ddc3b2053c1bb60 (patch) | |
tree | b8b063c9f833d85118dca1c8c32ebe945dd983bf /source/blender/editors/space_outliner/outliner_tree.cc | |
parent | 039cc329178e9f7b14f514850479648c38fe1ea3 (diff) |
Cleanup: Use `nullptr` in new Outliner C++ files
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.cc')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.cc | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index de0f7a0f9df..92da192c2d3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -113,7 +113,7 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner) BLI_mempool_iternew(ts, &iter); while ((tselem = reinterpret_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) { - if (tselem->id == NULL) { + if (tselem->id == nullptr) { unused++; } } @@ -121,10 +121,10 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner) if (unused) { if (BLI_mempool_len(ts) == unused) { BLI_mempool_destroy(ts); - space_outliner->treestore = NULL; + space_outliner->treestore = nullptr; if (space_outliner->runtime->treehash) { BKE_outliner_treehash_free(space_outliner->runtime->treehash); - space_outliner->runtime->treehash = NULL; + space_outliner->runtime->treehash = nullptr; } } else { @@ -157,12 +157,12 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner) static void check_persistent( SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr) { - if (space_outliner->treestore == NULL) { + if (space_outliner->treestore == nullptr) { /* if treestore was not created in readfile.c, create it here */ space_outliner->treestore = BLI_mempool_create( sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER); } - if (space_outliner->runtime->treehash == NULL) { + if (space_outliner->runtime->treehash == nullptr) { space_outliner->runtime->treehash = reinterpret_cast<GHash *>( BKE_outliner_treehash_create_from_treestore(space_outliner->treestore)); } @@ -320,7 +320,7 @@ static void outliner_add_object_contents(SpaceOutliner *space_outliner, tenla->name = IFACE_("Pose"); /* channels undefined in editmode, but we want the 'tenla' pose icon itself */ - if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) { + if ((arm->edbo == nullptr) && (ob->mode & OB_MODE_POSE)) { int const_index = 1000; /* ensure unique id for bone constraints */ int a; LISTBASE_FOREACH_INDEX (bPoseChannel *, pchan, &ob->pose->chanbase, a) { @@ -717,7 +717,7 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner, /* make hierarchy */ TreeElement *ten = arm->edbo->first ? reinterpret_cast<TreeElement *>( ((EditBone *)arm->edbo->first)->temp.p) : - NULL; + nullptr; while (ten) { TreeElement *nten = ten->next, *par; EditBone *ebone = (EditBone *)ten->directdata; @@ -874,8 +874,8 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, if (type == TSE_ID_BASE) { /* pass */ } - else if (id == NULL) { - return NULL; + else if (id == nullptr) { + return nullptr; } if (type == 0) { @@ -903,7 +903,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, te->type = outliner_tree_element_type_create(type, te, idv); if (te->type) { /* Element types ported to the new design are expected to have their name set at this point! */ - BLI_assert(te->name != NULL); + BLI_assert(te->name != nullptr); } if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { @@ -1025,12 +1025,12 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, /* we do lazy build, for speed and to avoid infinite recursion */ - if (ptr->data == NULL) { + if (ptr->data == nullptr) { te->name = IFACE_("(empty)"); } else if (type == TSE_RNA_STRUCT) { /* struct */ - te->name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); + te->name = RNA_struct_name_get_alloc(ptr, nullptr, 0, nullptr); if (te->name) { te->flag |= TE_FREE_NAME; @@ -1154,7 +1154,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, } } - if (outliner_element_warnings_get(te, NULL, NULL)) { + if (outliner_element_warnings_get(te, nullptr, nullptr)) { te->flag |= TE_HAS_WARNING; } @@ -1348,7 +1348,7 @@ static int treesort_obtype_alpha(const void *v1, const void *v2) static void outliner_sort(ListBase *lb) { TreeElement *last_te = reinterpret_cast<TreeElement *>(lb->last); - if (last_te == NULL) { + if (last_te == nullptr) { return; } TreeStoreElem *last_tselem = TREESTORE(last_te); @@ -1416,7 +1416,7 @@ static void outliner_sort(ListBase *lb) static void outliner_collections_children_sort(ListBase *lb) { TreeElement *last_te = reinterpret_cast<TreeElement *>(lb->last); - if (last_te == NULL) { + if (last_te == nullptr) { return; } TreeStoreElem *last_tselem = TREESTORE(last_te); @@ -1473,12 +1473,12 @@ static void outliner_restore_scrolling_position(SpaceOutliner *space_outliner, { View2D *v2d = ®ion->v2d; - if (focus->tselem != NULL) { + if (focus->tselem != nullptr) { outliner_set_coordinates(region, space_outliner); TreeElement *te_new = outliner_find_tree_element(&space_outliner->tree, focus->tselem); - if (te_new != NULL) { + if (te_new != nullptr) { int ys_new = te_new->ys; int ys_old = focus->ys; @@ -1519,13 +1519,13 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive( LISTBASE_FOREACH (TreeElement *, te_iter, &te->subtree) { TreeElement *te_sub = outliner_find_first_desired_element_at_y_recursive( space_outliner, te_iter, limit, callback_test); - if (te_sub != NULL) { + if (te_sub != nullptr) { return te_sub; } } } - return NULL; + return nullptr; } /** @@ -1536,7 +1536,7 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive( * * Basically we keep going up and down the outliner tree from that point forward, until we find * what we are looking for. If we are past the visible range and we can't find a valid element - * we return NULL. + * we return nullptr. */ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner *space_outliner, const float view_co, @@ -1553,15 +1553,15 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner callback_test = test_collection_callback; } - while (te != NULL) { + while (te != nullptr) { TreeElement *te_sub = outliner_find_first_desired_element_at_y_recursive( space_outliner, te, view_co_limit, callback_test); - if (te_sub != NULL) { + if (te_sub != nullptr) { /* Skip the element if it was not visible to start with. */ if (te->ys + UI_UNIT_Y > view_co_limit) { return te_sub; } - return NULL; + return nullptr; } if (te->next) { @@ -1569,7 +1569,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner continue; } - if (te->parent == NULL) { + if (te->parent == nullptr) { break; } @@ -1582,7 +1582,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner } } - return NULL; + return nullptr; } /** @@ -1603,12 +1603,12 @@ static void outliner_store_scrolling_position(SpaceOutliner *space_outliner, TreeElement *te = outliner_find_first_desired_element_at_y( space_outliner, region->v2d.cur.ymax, limit); - if (te != NULL) { + if (te != nullptr) { focus->tselem = TREESTORE(te); focus->ys = te->ys; } else { - focus->tselem = NULL; + focus->tselem = nullptr; } } @@ -1666,7 +1666,7 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, Object *ob = (Object *)tselem->id; Base *base = (Base *)te->directdata; - BLI_assert((base == NULL) || (base->object == ob)); + BLI_assert((base == nullptr) || (base->object == ob)); if (exclude_filter & SO_FILTER_OB_TYPE) { switch (ob->type) { @@ -1704,10 +1704,10 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, } if (exclude_filter & SO_FILTER_OB_STATE) { - if (base == NULL) { + if (base == nullptr) { base = BKE_view_layer_base_find(view_layer, ob); - if (base == NULL) { + if (base == nullptr) { return false; } } @@ -1742,14 +1742,14 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, return is_visible; } - if ((te->parent != NULL) && (TREESTORE(te->parent)->type == TSE_SOME_ID) && + if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) && (te->parent->idcode == ID_OB)) { if (exclude_filter & SO_FILTER_NO_CHILDREN) { return false; } } } - else if ((te->parent != NULL) && (TREESTORE(te->parent)->type == TSE_SOME_ID) && + else if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) && (te->parent->idcode == ID_OB)) { if (exclude_filter & SO_FILTER_NO_OB_CONTENT) { return false; @@ -1792,7 +1792,7 @@ static TreeElement *outliner_extract_children_from_subtree(TreeElement *element, TreeElement *te_next = element->next; if (outliner_element_is_collection_or_object(element)) { - TreeElement *te_prev = NULL; + TreeElement *te_prev = nullptr; for (TreeElement *te = reinterpret_cast<TreeElement *>(element->subtree.last); te; te = te_prev) { te_prev = te->prev; @@ -1874,7 +1874,7 @@ static int outliner_filter_subtree(SpaceOutliner *space_outliner, static void outliner_filter_tree(SpaceOutliner *space_outliner, ViewLayer *view_layer) { - char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2]; + char search_buff[sizeof(((struct SpaceOutliner *)nullptr)->search_string) + 2]; char *search_string; const int exclude_filter = outliner_exclude_filter_get(space_outliner); @@ -1900,7 +1900,7 @@ static void outliner_clear_newid_from_main(Main *bmain) { ID *id_iter; FOREACH_MAIN_ID_BEGIN (bmain, id_iter) { - id_iter->newid = NULL; + id_iter->newid = nullptr; } FOREACH_MAIN_ID_END; } |