diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 16:50:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 17:10:44 +0300 |
commit | 40a9b5ebc77953a3f0b47def39438beed681aac0 (patch) | |
tree | 7c59d584e43ea837a40e064a73859909f08ca84b /source/blender/depsgraph/intern/eval | |
parent | 01a348274218103ecdbaddc699a97e86f0c4ce18 (diff) |
Cleanup: changed NULL to nullptr in depsgraph C++ code
No functional changes.
Diffstat (limited to 'source/blender/depsgraph/intern/eval')
13 files changed, 124 insertions, 124 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index a1bb0aab029..18e1dec8bc1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -120,13 +120,13 @@ union NestedIDHackTempStorage { World world; }; -/* Set nested owned ID pointers to NULL. */ +/* Set nested owned ID pointers to nullptr. */ void nested_id_hack_discard_pointers(ID *id_cow) { switch (GS(id_cow->name)) { # define SPECIAL_CASE(id_type, dna_type, field) \ case id_type: { \ - ((dna_type *)id_cow)->field = NULL; \ + ((dna_type *)id_cow)->field = nullptr; \ break; \ } @@ -144,9 +144,9 @@ void nested_id_hack_discard_pointers(ID *id_cow) Scene *scene_cow = (Scene *)id_cow; /* Node trees always have their own ID node in the graph, and are * being copied as part of their copy-on-write process. */ - scene_cow->nodetree = NULL; + scene_cow->nodetree = nullptr; /* Tool settings pointer is shared with the original scene. */ - scene_cow->toolsettings = NULL; + scene_cow->toolsettings = nullptr; break; } @@ -154,7 +154,7 @@ void nested_id_hack_discard_pointers(ID *id_cow) /* Clear the ParticleSettings pointer to prevent doubly-freeing it. */ Object *ob = (Object *)id_cow; LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) { - psys->part = NULL; + psys->part = nullptr; } break; } @@ -165,7 +165,7 @@ void nested_id_hack_discard_pointers(ID *id_cow) } } -/* Set ID pointer of nested owned IDs (nodetree, key) to NULL. +/* Set ID pointer of nested owned IDs (nodetree, key) to nullptr. * * Return pointer to a new ID to be used. */ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage, const ID *id) @@ -174,7 +174,7 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage # define SPECIAL_CASE(id_type, dna_type, field, variable) \ case id_type: { \ storage->variable = *(dna_type *)id; \ - storage->variable.field = NULL; \ + storage->variable.field = nullptr; \ return &storage->variable.id; \ } @@ -190,8 +190,8 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage case ID_SCE: { storage->scene = *(Scene *)id; - storage->scene.toolsettings = NULL; - storage->scene.nodetree = NULL; + storage->scene.toolsettings = nullptr; + storage->scene.nodetree = nullptr; return &storage->scene.id; } @@ -206,7 +206,7 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage /* Set ID pointer of nested owned IDs (nodetree, key) to the original value. */ void nested_id_hack_restore_pointers(const ID *old_id, ID *new_id) { - if (new_id == NULL) { + if (new_id == nullptr) { return; } switch (GS(old_id->name)) { @@ -240,9 +240,9 @@ void ntree_hack_remap_pointers(const Depsgraph *depsgraph, ID *id_cow) # define SPECIAL_CASE(id_type, dna_type, field, field_type) \ case id_type: { \ dna_type *data = (dna_type *)id_cow; \ - if (data->field != NULL) { \ + if (data->field != nullptr) { \ ID *ntree_id_cow = depsgraph->get_cow_id(&data->field->id); \ - if (ntree_id_cow != NULL) { \ + if (ntree_id_cow != nullptr) { \ DEG_COW_PRINT(" Remapping datablock for %s: id_orig=%p id_cow=%p\n", \ data->field->id.name, \ data->field, \ @@ -287,7 +287,7 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) #endif bool result = BKE_id_copy_ex( - NULL, (ID *)id_for_copy, &newid, (LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE)); + nullptr, (ID *)id_for_copy, &newid, (LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE)); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -310,7 +310,7 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) #endif bool result = BKE_id_copy_ex( - NULL, id_for_copy, (ID **)&new_scene, LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE); + nullptr, id_for_copy, (ID **)&new_scene, LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -339,7 +339,7 @@ ViewLayer *get_original_view_layer(const Depsgraph *depsgraph, const IDNode *id_ * properly fixed. * * TODO(sergey): Support indirectly linked scene. */ - return NULL; + return nullptr; } /* Remove all view layers but the one which corresponds to an input one. */ @@ -359,27 +359,27 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph, * NOTE: Need to keep view layers for all scenes, even indirect ones. This is because of * render layer node possibly pointing to another scene. */ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene_cow->view_layers) { - view_layer->basact = NULL; + view_layer->basact = nullptr; } return; } else if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) { /* Indirectly linked scenes means it's not an input scene and not a set scene, and is pulled * via some driver. Such scenes should not have view layers after copy. */ - view_layer_input = NULL; + view_layer_input = nullptr; } else { view_layer_input = get_original_view_layer(depsgraph, id_node); } - ViewLayer *view_layer_eval = NULL; + ViewLayer *view_layer_eval = nullptr; /* Find evaluated view layer. At the same time we free memory used by * all other of the view layers. */ for (ViewLayer *view_layer_cow = reinterpret_cast<ViewLayer *>(scene_cow->view_layers.first), *view_layer_next; - view_layer_cow != NULL; + view_layer_cow != nullptr; view_layer_cow = view_layer_next) { view_layer_next = view_layer_cow->next; - if (view_layer_input != NULL && STREQ(view_layer_input->name, view_layer_cow->name)) { + if (view_layer_input != nullptr && STREQ(view_layer_input->name, view_layer_cow->name)) { view_layer_eval = view_layer_cow; } else { @@ -387,8 +387,8 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph, } } /* Make evaluated view layer the only one in the evaluated scene (if it exists). */ - if (view_layer_eval != NULL) { - view_layer_eval->prev = view_layer_eval->next = NULL; + if (view_layer_eval != nullptr) { + view_layer_eval->prev = view_layer_eval->next = nullptr; } scene_cow->view_layers.first = view_layer_eval; scene_cow->view_layers.last = view_layer_eval; @@ -405,10 +405,10 @@ void scene_remove_all_bases(Scene *scene_cow) * objects. */ void view_layer_remove_disabled_bases(const Depsgraph *depsgraph, ViewLayer *view_layer) { - if (view_layer == NULL) { + if (view_layer == nullptr) { return; } - ListBase enabled_bases = {NULL, NULL}; + ListBase enabled_bases = {nullptr, nullptr}; LISTBASE_FOREACH_MUTABLE (Base *, base, &view_layer->object_bases) { /* TODO(sergey): Would be cool to optimize this somehow, or make it so * builder tags bases. @@ -427,7 +427,7 @@ void view_layer_remove_disabled_bases(const Depsgraph *depsgraph, ViewLayer *vie } else { if (base == view_layer->basact) { - view_layer->basact = NULL; + view_layer->basact = nullptr; } MEM_freeN(base); } @@ -438,7 +438,7 @@ void view_layer_remove_disabled_bases(const Depsgraph *depsgraph, ViewLayer *vie void view_layer_update_orig_base_pointers(const ViewLayer *view_layer_orig, ViewLayer *view_layer_eval) { - if (view_layer_orig == NULL || view_layer_eval == NULL) { + if (view_layer_orig == nullptr || view_layer_eval == nullptr) { /* Happens when scene is only used for parameters or compositor/sequencer. */ return; } @@ -478,7 +478,7 @@ void update_sequence_orig_pointers(const ListBase *sequences_orig, ListBase *seq { Sequence *sequence_orig = reinterpret_cast<Sequence *>(sequences_orig->first); Sequence *sequence_cow = reinterpret_cast<Sequence *>(sequences_cow->first); - while (sequence_orig != NULL) { + while (sequence_orig != nullptr) { update_sequence_orig_pointers(&sequence_orig->seqbase, &sequence_cow->seqbase); sequence_cow->orig_sequence = sequence_orig; sequence_cow = sequence_cow->next; @@ -488,7 +488,7 @@ void update_sequence_orig_pointers(const ListBase *sequences_orig, ListBase *seq void update_scene_orig_pointers(const Scene *scene_orig, Scene *scene_cow) { - if (scene_orig->ed != NULL) { + if (scene_orig->ed != nullptr) { update_sequence_orig_pointers(&scene_orig->ed->seqbase, &scene_cow->ed->seqbase); } } @@ -515,7 +515,7 @@ struct RemapCallbackUserData { int foreach_libblock_remap_callback(void *user_data_v, ID *id_self, ID **id_p, int /*cb_flag*/) { - if (*id_p == NULL) { + if (*id_p == nullptr) { return IDWALK_RET_NOP; } RemapCallbackUserData *user_data = (RemapCallbackUserData *)user_data_v; @@ -535,7 +535,7 @@ int foreach_libblock_remap_callback(void *user_data_v, ID *id_self, ID **id_p, i const ID_Type id_type_self = GS(id_self->name); if (id_type == ID_OB && id_type_self == ID_SCE) { IDNode *id_node = depsgraph->find_id_node(id_orig); - if (id_node == NULL) { + if (id_node == nullptr) { id_cow = id_orig; } else { @@ -549,7 +549,7 @@ int foreach_libblock_remap_callback(void *user_data_v, ID *id_self, ID **id_p, i else { id_cow = depsgraph->get_cow_id(id_orig); } - BLI_assert(id_cow != NULL); + BLI_assert(id_cow != nullptr); DEG_COW_PRINT( " Remapping datablock for %s: id_orig=%p id_cow=%p\n", id_orig->name, id_orig, id_cow); *id_p = id_cow; @@ -605,12 +605,12 @@ void update_mesh_edit_mode_pointers(const ID *id_orig, ID *id_cow) * edit_mesh to object. */ const Mesh *mesh_orig = (const Mesh *)id_orig; Mesh *mesh_cow = (Mesh *)id_cow; - if (mesh_orig->edit_mesh == NULL) { + if (mesh_orig->edit_mesh == nullptr) { return; } mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh); - mesh_cow->edit_mesh->mesh_eval_cage = NULL; - mesh_cow->edit_mesh->mesh_eval_final = NULL; + mesh_cow->edit_mesh->mesh_eval_cage = nullptr; + mesh_cow->edit_mesh->mesh_eval_final = nullptr; } /* Edit data is stored and owned by original datablocks, copied ones @@ -646,7 +646,7 @@ void update_list_orig_pointers(const ListBase *listbase_orig, { T *element_orig = reinterpret_cast<T *>(listbase_orig->first); T *element_cow = reinterpret_cast<T *>(listbase->first); - while (element_orig != NULL) { + while (element_orig != nullptr) { element_cow->*orig_field = element_orig; element_cow = element_cow->next; element_orig = element_orig->next; @@ -679,9 +679,9 @@ void reset_particle_system_edit_eval(const Depsgraph *depsgraph, Object *object_ } LISTBASE_FOREACH (ParticleSystem *, psys, &object_cow->particlesystem) { ParticleSystem *orig_psys = psys->orig_psys; - if (orig_psys->edit != NULL) { - orig_psys->edit->psys_eval = NULL; - orig_psys->edit->psmd_eval = NULL; + if (orig_psys->edit != nullptr) { + orig_psys->edit->psys_eval = nullptr; + orig_psys->edit->psmd_eval = nullptr; } } } @@ -710,7 +710,7 @@ void update_nla_strips_orig_pointers(const ListBase *strips_orig, ListBase *stri { NlaStrip *strip_orig = reinterpret_cast<NlaStrip *>(strips_orig->first); NlaStrip *strip_cow = reinterpret_cast<NlaStrip *>(strips_cow->first); - while (strip_orig != NULL) { + while (strip_orig != nullptr) { strip_cow->orig_strip = strip_orig; update_nla_strips_orig_pointers(&strip_orig->strips, &strip_cow->strips); strip_cow = strip_cow->next; @@ -722,7 +722,7 @@ void update_nla_tracks_orig_pointers(const ListBase *tracks_orig, ListBase *trac { NlaTrack *track_orig = reinterpret_cast<NlaTrack *>(tracks_orig->first); NlaTrack *track_cow = reinterpret_cast<NlaTrack *>(tracks_cow->first); - while (track_orig != NULL) { + while (track_orig != nullptr) { update_nla_strips_orig_pointers(&track_orig->strips, &track_cow->strips); track_cow = track_cow->next; track_orig = track_orig->next; @@ -732,11 +732,11 @@ void update_nla_tracks_orig_pointers(const ListBase *tracks_orig, ListBase *trac void update_animation_data_after_copy(const ID *id_orig, ID *id_cow) { const AnimData *anim_data_orig = BKE_animdata_from_id(const_cast<ID *>(id_orig)); - if (anim_data_orig == NULL) { + if (anim_data_orig == nullptr) { return; } AnimData *anim_data_cow = BKE_animdata_from_id(id_cow); - BLI_assert(anim_data_cow != NULL); + BLI_assert(anim_data_cow != nullptr); update_nla_tracks_orig_pointers(&anim_data_orig->nla_tracks, &anim_data_cow->nla_tracks); } @@ -747,14 +747,14 @@ void update_proxy_pointers_after_copy(const Depsgraph *depsgraph, const Object *object_orig, Object *object_cow) { - if (object_cow->proxy != NULL) { + if (object_cow->proxy != nullptr) { if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy->id)) { - object_cow->proxy = NULL; + object_cow->proxy = nullptr; } } - if (object_cow->proxy_group != NULL) { + if (object_cow->proxy_group != nullptr) { if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy_group->id)) { - object_cow->proxy_group = NULL; + object_cow->proxy_group = nullptr; } } } @@ -785,7 +785,7 @@ void update_id_after_copy(const Depsgraph *depsgraph, const bArmature *armature_orig = (bArmature *)object_orig->data; bArmature *armature_cow = (bArmature *)object_cow->data; BKE_pose_remap_bone_pointers(armature_cow, object_cow->pose); - if (armature_orig->edbo == NULL) { + if (armature_orig->edbo == nullptr) { update_pose_orig_pointers(object_orig->pose, object_cow->pose); } BKE_pose_pchan_index_rebuild(object_cow->pose); @@ -819,7 +819,7 @@ int foreach_libblock_validate_callback(void *user_data, int /*cb_flag*/) { ValidateData *data = (ValidateData *)user_data; - if (*id_p != NULL) { + if (*id_p != nullptr) { if (!check_datablock_expanded(*id_p)) { data->is_valid = false; /* TODO(sergey): Store which is not valid? */ @@ -906,12 +906,12 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph, * is not to be remapped again. */ deg_tag_copy_on_write_id(id_cow, id_orig); /* Perform remapping of the nodes. */ - RemapCallbackUserData user_data = {NULL}; + RemapCallbackUserData user_data = {nullptr}; user_data.depsgraph = depsgraph; user_data.node_builder = node_builder; user_data.create_placeholders = create_placeholders; BKE_library_foreach_ID_link( - NULL, id_cow, foreach_libblock_remap_callback, (void *)&user_data, IDWALK_NOP); + nullptr, id_cow, foreach_libblock_remap_callback, (void *)&user_data, IDWALK_NOP); /* Correct or tweak some pointers which are not taken care by foreach * from above. */ update_id_after_copy(depsgraph, id_node, id_orig, id_cow); @@ -926,7 +926,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph, bool create_placeholders) { DEG::IDNode *id_node = depsgraph->find_id_node(id_orig); - BLI_assert(id_node != NULL); + BLI_assert(id_node != nullptr); return deg_expand_copy_on_write_datablock(depsgraph, id_node, node_builder, create_placeholders); } @@ -950,7 +950,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, const IDNode ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, ID *id_orig) { DEG::IDNode *id_node = depsgraph->find_id_node(id_orig); - BLI_assert(id_node != NULL); + BLI_assert(id_node != nullptr); return deg_update_copy_on_write_datablock(depsgraph, id_node); } @@ -959,47 +959,47 @@ namespace { void discard_armature_edit_mode_pointers(ID *id_cow) { bArmature *armature_cow = (bArmature *)id_cow; - armature_cow->edbo = NULL; + armature_cow->edbo = nullptr; } void discard_curve_edit_mode_pointers(ID *id_cow) { Curve *curve_cow = (Curve *)id_cow; - curve_cow->editnurb = NULL; - curve_cow->editfont = NULL; + curve_cow->editnurb = nullptr; + curve_cow->editfont = nullptr; } void discard_mball_edit_mode_pointers(ID *id_cow) { MetaBall *mball_cow = (MetaBall *)id_cow; - mball_cow->editelems = NULL; + mball_cow->editelems = nullptr; } void discard_lattice_edit_mode_pointers(ID *id_cow) { Lattice *lt_cow = (Lattice *)id_cow; - lt_cow->editlatt = NULL; + lt_cow->editlatt = nullptr; } void discard_mesh_edit_mode_pointers(ID *id_cow) { Mesh *mesh_cow = (Mesh *)id_cow; - if (mesh_cow->edit_mesh == NULL) { + if (mesh_cow->edit_mesh == nullptr) { return; } BKE_editmesh_free_derivedmesh(mesh_cow->edit_mesh); MEM_freeN(mesh_cow->edit_mesh); - mesh_cow->edit_mesh = NULL; + mesh_cow->edit_mesh = nullptr; } void discard_scene_pointers(ID *id_cow) { Scene *scene_cow = (Scene *)id_cow; - scene_cow->toolsettings = NULL; - scene_cow->eevee.light_cache = NULL; + scene_cow->toolsettings = nullptr; + scene_cow->eevee.light_cache = nullptr; } -/* NULL-ify all edit mode pointers which points to data from +/* nullptr-ify all edit mode pointers which points to data from * original object. */ void discard_edit_mode_pointers(ID *id_cow) { @@ -1053,8 +1053,8 @@ void deg_free_copy_on_write_datablock(ID *id_cow) * caches from modifying object->data. This is currently happening * due to mesh/curve datablock boundbox tagging dirty. */ Object *ob_cow = (Object *)id_cow; - ob_cow->data = NULL; - ob_cow->sculpt = NULL; + ob_cow->data = nullptr; + ob_cow->sculpt = nullptr; break; } default: @@ -1081,12 +1081,12 @@ void deg_evaluate_copy_on_write(struct ::Depsgraph *graph, const IDNode *id_node bool deg_validate_copy_on_write_datablock(ID *id_cow) { - if (id_cow == NULL) { + if (id_cow == nullptr) { return false; } ValidateData data; data.is_valid = true; - BKE_library_foreach_ID_link(NULL, id_cow, foreach_libblock_validate_callback, &data, IDWALK_NOP); + BKE_library_foreach_ID_link(nullptr, id_cow, foreach_libblock_validate_callback, &data, IDWALK_NOP); return data.is_valid; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h index 2f83c2f54b9..1992c80e036 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h @@ -52,11 +52,11 @@ struct IDNode; */ ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph, const IDNode *id_node, - DepsgraphNodeBuilder *node_builder = NULL, + DepsgraphNodeBuilder *node_builder = nullptr, bool create_placeholders = false); ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph, struct ID *id_orig, - DepsgraphNodeBuilder *node_builder = NULL, + DepsgraphNodeBuilder *node_builder = nullptr, bool create_placeholders = false); /* Makes sure given CoW data-block is brought back to state of the original diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index cf9b1259e4e..d99f6cccc69 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -157,7 +157,7 @@ BLI_INLINE void flush_handle_component_node(IDNode *id_node, * whole IK solver, otherwise result might be unpredictable. */ if (comp_node->type == NodeType::BONE) { ComponentNode *pose_comp = id_node->find_component(NodeType::EVAL_POSE); - BLI_assert(pose_comp != NULL); + BLI_assert(pose_comp != nullptr); if (pose_comp->custom_flags == COMPONENT_STATE_NONE) { queue->push_front(pose_comp->get_entry_operation()); pose_comp->custom_flags = COMPONENT_STATE_SCHEDULED; @@ -173,7 +173,7 @@ BLI_INLINE void flush_handle_component_node(IDNode *id_node, */ BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQueue *queue) { - OperationNode *result = NULL; + OperationNode *result = nullptr; for (Relation *rel : op_node->outlinks) { /* Flush is forbidden, completely. */ if (rel->flag & RELATION_FLAG_NO_FLUSH) { @@ -197,7 +197,7 @@ BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQ if (to_node->scheduled) { continue; } - if (result != NULL) { + if (result != nullptr) { queue->push_front(to_node); } else { @@ -211,7 +211,7 @@ BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQ void flush_engine_data_update(ID *id) { DrawDataList *draw_data_list = DRW_drawdatalist_from_id(id); - if (draw_data_list == NULL) { + if (draw_data_list == nullptr) { return; } LISTBASE_FOREACH (DrawData *, draw_data, draw_data_list) { @@ -236,7 +236,7 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd continue; } DepsNodeFactory *factory = type_get_factory(comp_node->type); - BLI_assert(factory != NULL); + BLI_assert(factory != nullptr); id_cow->recalc |= factory->id_recalc_tag(); } GHASH_FOREACH_END(); @@ -337,8 +337,8 @@ void invalidate_tagged_evaluated_data(Depsgraph *graph) void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) { /* Sanity checks. */ - BLI_assert(bmain != NULL); - BLI_assert(graph != NULL); + BLI_assert(bmain != nullptr); + BLI_assert(graph != nullptr); /* Nothing to update, early out. */ if (graph->need_update_time) { const Scene *scene_orig = graph->scene; @@ -365,7 +365,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) while (!queue.empty()) { OperationNode *op_node = queue.front(); queue.pop_front(); - while (op_node != NULL) { + while (op_node != nullptr) { /* Tag operation as required for update. */ op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE; /* Inform corresponding ID and component nodes about the change. */ @@ -393,7 +393,7 @@ void deg_graph_clear_tags(Depsgraph *graph) DEPSOP_FLAG_USER_MODIFIED); } /* Clear any entry tags which haven't been flushed. */ - BLI_gset_clear(graph->entry_tags, NULL); + BLI_gset_clear(graph->entry_tags, nullptr); } } // namespace DEG diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc index 4da5ca77fb8..40a17666880 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc @@ -36,10 +36,10 @@ RuntimeBackup::RuntimeBackup(const Depsgraph *depsgraph) scene_backup(depsgraph), sound_backup(depsgraph), object_backup(depsgraph), - drawdata_ptr(NULL), + drawdata_ptr(nullptr), movieclip_backup(depsgraph) { - drawdata_backup.first = drawdata_backup.last = NULL; + drawdata_backup.first = drawdata_backup.last = nullptr; } void RuntimeBackup::init_from_id(ID *id) @@ -71,9 +71,9 @@ void RuntimeBackup::init_from_id(ID *id) /* Note that we never free GPU draw data from here since that's not * safe for threading and draw data is likely to be re-used. */ drawdata_ptr = DRW_drawdatalist_from_id(id); - if (drawdata_ptr != NULL) { + if (drawdata_ptr != nullptr) { drawdata_backup = *drawdata_ptr; - drawdata_ptr->first = drawdata_ptr->last = NULL; + drawdata_ptr->first = drawdata_ptr->last = nullptr; } } @@ -98,7 +98,7 @@ void RuntimeBackup::restore_to_id(ID *id) default: break; } - if (drawdata_ptr != NULL) { + if (drawdata_ptr != nullptr) { *drawdata_ptr = drawdata_backup; } } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h index 892cc88002f..cc8c6ae0d5b 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h @@ -39,7 +39,7 @@ class RuntimeBackup { public: explicit RuntimeBackup(const Depsgraph *depsgraph); - /* NOTE: Will reset all runtime fields which has been backed up to NULL. */ + /* NOTE: Will reset all runtime fields which has been backed up to nullptr. */ void init_from_id(ID *id); /* Restore fields to the given ID. */ diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc index cc4935431d1..e3beeb52ab1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc @@ -50,7 +50,7 @@ void animated_property_store_cb(ID *id, FCurve *fcurve, void *data_v) { AnimatedPropertyStoreCalbackData *data = reinterpret_cast<AnimatedPropertyStoreCalbackData *>( data_v); - if (fcurve->rna_path == NULL || fcurve->rna_path[0] == '\0') { + if (fcurve->rna_path == nullptr || fcurve->rna_path[0] == '\0') { return; } if (id != data->id) { diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc index c5744533083..3361c26a077 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc @@ -26,7 +26,7 @@ namespace DEG { ModifierDataBackupID::ModifierDataBackupID(const Depsgraph * /*depsgraph*/) - : ModifierDataBackupID(NULL, eModifierType_None) + : ModifierDataBackupID(nullptr, eModifierType_None) { } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc index 54838475bbf..d552c8da99a 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc @@ -36,8 +36,8 @@ MovieClipBackup::MovieClipBackup(const Depsgraph * /*depsgraph*/) void MovieClipBackup::reset() { - anim = NULL; - cache = NULL; + anim = nullptr; + cache = nullptr; } void MovieClipBackup::init_from_movieclip(MovieClip *movieclip) @@ -46,8 +46,8 @@ void MovieClipBackup::init_from_movieclip(MovieClip *movieclip) cache = movieclip->cache; /* Clear pointers stored in the movie clip, so they are not freed when copied-on-written * datablock is freed for re-allocation. */ - movieclip->anim = NULL; - movieclip->cache = NULL; + movieclip->anim = nullptr; + movieclip->cache = nullptr; } void MovieClipBackup::restore_to_movieclip(MovieClip *movieclip) diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc index a6a042f3e7b..df7338e1076 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc @@ -52,7 +52,7 @@ void ObjectRuntimeBackup::init_from_object(Object *object) /* Object update will override actual object->data to an evaluated version. * Need to make sure we don't have data set to evaluated one before free * anything. */ - if (mesh_eval != NULL && object->data == mesh_eval) { + if (mesh_eval != nullptr && object->data == mesh_eval) { object->data = runtime.mesh_orig; } /* Make a backup of base flags. */ @@ -73,22 +73,22 @@ inline ModifierDataBackupID create_modifier_data_id(const ModifierData *modifier void ObjectRuntimeBackup::backup_modifier_runtime_data(Object *object) { LISTBASE_FOREACH (ModifierData *, modifier_data, &object->modifiers) { - if (modifier_data->runtime == NULL) { + if (modifier_data->runtime == nullptr) { continue; } - BLI_assert(modifier_data->orig_modifier_data != NULL); + BLI_assert(modifier_data->orig_modifier_data != nullptr); ModifierDataBackupID modifier_data_id = create_modifier_data_id(modifier_data); modifier_runtime_data.insert(make_pair(modifier_data_id, modifier_data->runtime)); - modifier_data->runtime = NULL; + modifier_data->runtime = nullptr; } } void ObjectRuntimeBackup::backup_pose_channel_runtime_data(Object *object) { - if (object->pose != NULL) { + if (object->pose != nullptr) { LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - /* This is NULL in Edit mode. */ - if (pchan->orig_pchan != NULL) { + /* This is nullptr in Edit mode. */ + if (pchan->orig_pchan != nullptr) { pose_channel_runtime_data[pchan->orig_pchan] = pchan->runtime; BKE_pose_channel_runtime_reset(&pchan->runtime); } @@ -103,7 +103,7 @@ void ObjectRuntimeBackup::restore_to_object(Object *object) object->runtime = runtime; object->runtime.mesh_orig = mesh_orig; object->runtime.bb = bb; - if (object->type == OB_MESH && object->runtime.mesh_eval != NULL) { + if (object->type == OB_MESH && object->runtime.mesh_eval != nullptr) { if (object->id.recalc & ID_RECALC_GEOMETRY) { /* If geometry is tagged for update it means, that part of * evaluated mesh are not valid anymore. In this case we can not @@ -138,33 +138,33 @@ void ObjectRuntimeBackup::restore_to_object(Object *object) void ObjectRuntimeBackup::restore_modifier_runtime_data(Object *object) { LISTBASE_FOREACH (ModifierData *, modifier_data, &object->modifiers) { - BLI_assert(modifier_data->orig_modifier_data != NULL); + BLI_assert(modifier_data->orig_modifier_data != nullptr); ModifierDataBackupID modifier_data_id = create_modifier_data_id(modifier_data); ModifierRuntimeDataBackup::iterator runtime_data_iterator = modifier_runtime_data.find( modifier_data_id); if (runtime_data_iterator != modifier_runtime_data.end()) { modifier_data->runtime = runtime_data_iterator->second; - runtime_data_iterator->second = NULL; + runtime_data_iterator->second = nullptr; } } for (ModifierRuntimeDataBackup::value_type value : modifier_runtime_data) { const ModifierDataBackupID modifier_data_id = value.first; void *runtime = value.second; - if (value.second == NULL) { + if (value.second == nullptr) { continue; } const ModifierTypeInfo *modifier_type_info = modifierType_getInfo(modifier_data_id.type); - BLI_assert(modifier_type_info != NULL); + BLI_assert(modifier_type_info != nullptr); modifier_type_info->freeRuntimeData(runtime); } } void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object) { - if (object->pose != NULL) { + if (object->pose != nullptr) { LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - /* This is NULL in Edit mode. */ - if (pchan->orig_pchan != NULL) { + /* This is nullptr in Edit mode. */ + if (pchan->orig_pchan != nullptr) { PoseChannelRuntimeDataBackup::iterator runtime_data_iterator = pose_channel_runtime_data.find(pchan->orig_pchan); if (runtime_data_iterator != pose_channel_runtime_data.end()) { diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc index a288fb6ab92..a1d6961cf5d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc @@ -35,10 +35,10 @@ SceneBackup::SceneBackup(const Depsgraph *depsgraph) : sequencer_backup(depsgrap void SceneBackup::reset() { - sound_scene = NULL; - playback_handle = NULL; - sound_scrub_handle = NULL; - speaker_handles = NULL; + sound_scene = nullptr; + playback_handle = nullptr; + sound_scrub_handle = nullptr; + speaker_handles = nullptr; rigidbody_last_time = -1; } @@ -49,16 +49,16 @@ void SceneBackup::init_from_scene(Scene *scene) sound_scrub_handle = scene->sound_scrub_handle; speaker_handles = scene->speaker_handles; - if (scene->rigidbody_world != NULL) { + if (scene->rigidbody_world != nullptr) { rigidbody_last_time = scene->rigidbody_world->ltime; } /* Clear pointers stored in the scene, so they are not freed when copied-on-written datablock * is freed for re-allocation. */ - scene->sound_scene = NULL; - scene->playback_handle = NULL; - scene->sound_scrub_handle = NULL; - scene->speaker_handles = NULL; + scene->sound_scene = nullptr; + scene->playback_handle = nullptr; + scene->sound_scrub_handle = nullptr; + scene->speaker_handles = nullptr; sequencer_backup.init_from_scene(scene); } @@ -70,7 +70,7 @@ void SceneBackup::restore_to_scene(Scene *scene) scene->sound_scrub_handle = sound_scrub_handle; scene->speaker_handles = speaker_handles; - if (scene->rigidbody_world != NULL) { + if (scene->rigidbody_world != nullptr) { scene->rigidbody_world->ltime = rigidbody_last_time; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc index 0150281a4ef..f26d78d3138 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc @@ -34,14 +34,14 @@ SequenceBackup::SequenceBackup(const Depsgraph * /*depsgraph*/) void SequenceBackup::reset() { - scene_sound = NULL; + scene_sound = nullptr; } void SequenceBackup::init_from_sequence(Sequence *sequence) { scene_sound = sequence->scene_sound; - sequence->scene_sound = NULL; + sequence->scene_sound = nullptr; } void SequenceBackup::restore_to_sequence(Sequence *sequence) @@ -52,7 +52,7 @@ void SequenceBackup::restore_to_sequence(Sequence *sequence) bool SequenceBackup::isEmpty() const { - return (scene_sound == NULL); + return (scene_sound == nullptr); } } // namespace DEG diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc index 08c2697aab3..adc7fd570e8 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc @@ -63,7 +63,7 @@ void SequencerBackup::restore_to_scene(Scene *scene) /* Cleanup audio while the scene is still known. */ for (SequencesBackupMap::value_type &it : sequences_backup) { SequenceBackup &sequence_backup = it.second; - if (sequence_backup.scene_sound != NULL) { + if (sequence_backup.scene_sound != nullptr) { BKE_sound_remove_scene_sound(scene, sequence_backup.scene_sound); } } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc index 0c54032e32c..f427d57a8ef 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc @@ -36,9 +36,9 @@ SoundBackup::SoundBackup(const Depsgraph * /*depsgraph*/) void SoundBackup::reset() { - cache = NULL; - waveform = NULL; - playback_handle = NULL; + cache = nullptr; + waveform = nullptr; + playback_handle = nullptr; } void SoundBackup::init_from_sound(bSound *sound) @@ -47,9 +47,9 @@ void SoundBackup::init_from_sound(bSound *sound) waveform = sound->waveform; playback_handle = sound->playback_handle; - sound->cache = NULL; - sound->waveform = NULL; - sound->playback_handle = NULL; + sound->cache = nullptr; + sound->waveform = nullptr; + sound->playback_handle = nullptr; } void SoundBackup::restore_to_sound(bSound *sound) |