diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 19:49:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 20:08:25 +0300 |
commit | 16732def37c5a66f3ea28dbe247b09cc6bca6677 (patch) | |
tree | 5d14f5c920a1411e336bd80b12becbb3f73de19a /source/blender/io/alembic/intern | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/io/alembic/intern')
7 files changed, 37 insertions, 37 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_curves.cc b/source/blender/io/alembic/intern/abc_reader_curves.cc index e29b6eda6fc..8d6605d6973 100644 --- a/source/blender/io/alembic/intern/abc_reader_curves.cc +++ b/source/blender/io/alembic/intern/abc_reader_curves.cc @@ -101,7 +101,7 @@ void AbcCurveReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele ICompoundProperty user_props = m_curves_schema.getUserProperties(); if (user_props) { const PropertyHeader *header = user_props.getPropertyHeader(ABC_CURVE_RESOLUTION_U_PROPNAME); - if (header != NULL && header->isScalar() && IInt16Property::matches(*header)) { + if (header != nullptr && header->isScalar() && IInt16Property::matches(*header)) { IInt16Property resolu(user_props, header->getName()); cu->resolu = resolu.getValue(sample_sel); } @@ -218,10 +218,10 @@ void AbcCurveReader::read_curve_sample(Curve *cu, nu->pntsu -= overlap; } - const bool do_weights = (weights != NULL) && (weights->size() > 1); + const bool do_weights = (weights != nullptr) && (weights->size() > 1); float weight = 1.0f; - const bool do_radius = (radiuses != NULL) && (radiuses->size() > 1); + const bool do_radius = (radiuses != nullptr) && (radiuses->size() > 1); float radius = (radiuses && radiuses->size() == 1) ? (*radiuses)[0] : 1.0f; nu->type = CU_NURBS; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index c3576ccf259..6b7633d19e8 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -149,7 +149,7 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data) const P3fArraySamplePtr &positions = mesh_data.positions; if (config.use_vertex_interpolation && config.weight != 0.0f && - mesh_data.ceil_positions != NULL && mesh_data.ceil_positions->size() == positions->size()) { + mesh_data.ceil_positions != nullptr && mesh_data.ceil_positions->size() == positions->size()) { read_mverts_interp(mverts, positions, mesh_data.ceil_positions, config.weight); return; } @@ -383,19 +383,19 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type) /* unsupported custom data type -- don't do anything. */ if (!ELEM(cd_data_type, CD_MLOOPUV, CD_MLOOPCOL)) { - return NULL; + return nullptr; } loopdata = &mesh->ldata; cd_ptr = CustomData_get_layer_named(loopdata, cd_data_type, name); - if (cd_ptr != NULL) { + if (cd_ptr != nullptr) { /* layer already exists, so just return it. */ return cd_ptr; } /* Create a new layer. */ numloops = mesh->totloop; - cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, NULL, numloops, name); + cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, nullptr, numloops, name); return cd_ptr; } @@ -552,7 +552,7 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); m_object->data = mesh; - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, nullptr); if (read_mesh != mesh) { /* XXX fixme after 2.80; mesh->flag isn't copied by BKE_mesh_nomain_to_mesh() */ /* read_mesh can be freed by BKE_mesh_nomain_to_mesh(), so get the flag before that happens. */ @@ -657,7 +657,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh, return existing_mesh; } - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; /* Only read point data when streaming meshes, unless we need to create new ones. */ ImportSettings settings; @@ -777,7 +777,7 @@ BLI_INLINE MEdge *find_edge(MEdge *edges, int totedge, int v1, int v2) } } - return NULL; + return nullptr; } static void read_subd_sample(const std::string &iobject_full_name, @@ -867,7 +867,7 @@ void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); m_object->data = mesh; - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, nullptr); if (read_mesh != mesh) { BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); } @@ -903,7 +903,7 @@ void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec } MEdge *edge = find_edge(edges, totedge, v1, v2); - if (edge == NULL) { + if (edge == nullptr) { edge = find_edge(edges, totedge, v2, v1); } @@ -949,7 +949,7 @@ Mesh *AbcSubDReader::read_mesh(Mesh *existing_mesh, const Alembic::Abc::Int32ArraySamplePtr &face_indices = sample.getFaceIndices(); const Alembic::Abc::Int32ArraySamplePtr &face_counts = sample.getFaceCounts(); - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; ImportSettings settings; settings.read_flag |= read_flag; diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc index 707241ca17f..5ca7022bb36 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.cc +++ b/source/blender/io/alembic/intern/abc_reader_object.cc @@ -44,13 +44,13 @@ using Alembic::AbcGeom::IXformSchema; namespace blender::io::alembic { AbcObjectReader::AbcObjectReader(const IObject &object, ImportSettings &settings) - : m_object(NULL), + : m_object(nullptr), m_iobject(object), m_settings(&settings), m_min_time(std::numeric_limits<chrono_t>::max()), m_max_time(std::numeric_limits<chrono_t>::min()), m_refcount(0), - parent_reader(NULL) + parent_reader(nullptr) { m_name = object.getFullName(); std::vector<std::string> parts; @@ -203,7 +203,7 @@ void AbcObjectReader::setupObjectTransform(const float time) if (!is_constant) { bConstraint *con = BKE_constraint_add_for_object( - m_object, NULL, CONSTRAINT_TYPE_TRANSFORM_CACHE); + m_object, nullptr, CONSTRAINT_TYPE_TRANSFORM_CACHE); bTransformCacheConstraint *data = static_cast<bTransformCacheConstraint *>(con->data); BLI_strncpy(data->object_path, m_iobject.getFullName().c_str(), FILE_MAX); diff --git a/source/blender/io/alembic/intern/abc_reader_points.cc b/source/blender/io/alembic/intern/abc_reader_points.cc index 88b5088805f..f7dcba7a0de 100644 --- a/source/blender/io/alembic/intern/abc_reader_points.cc +++ b/source/blender/io/alembic/intern/abc_reader_points.cc @@ -82,7 +82,7 @@ bool AbcPointsReader::accepts_object_type( void AbcPointsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) { Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, 0, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, 0, nullptr); if (read_mesh != mesh) { BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); @@ -145,7 +145,7 @@ struct Mesh *AbcPointsReader::read_mesh(struct Mesh *existing_mesh, const P3fArraySamplePtr &positions = sample.getPositions(); - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; if (existing_mesh->totvert != positions->size()) { new_mesh = BKE_mesh_new_nomain(positions->size(), 0, 0, 0, 0); diff --git a/source/blender/io/alembic/intern/abc_reader_transform.cc b/source/blender/io/alembic/intern/abc_reader_transform.cc index 3aab2f2d339..625cd255dba 100644 --- a/source/blender/io/alembic/intern/abc_reader_transform.cc +++ b/source/blender/io/alembic/intern/abc_reader_transform.cc @@ -72,7 +72,7 @@ bool AbcEmptyReader::accepts_object_type( void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector &UNUSED(sample_sel)) { m_object = BKE_object_add_only_object(bmain, OB_EMPTY, m_object_name.c_str()); - m_object->data = NULL; + m_object->data = nullptr; } } // namespace blender::io::alembic diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index edb20da89a5..aa7beb37dc5 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -132,7 +132,7 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return false; } - return prop.getPropertyHeader(name) != NULL; + return prop.getPropertyHeader(name) != nullptr; } typedef std::pair<Alembic::AbcCoreAbstract::index_t, float> index_time_pair_t; @@ -173,7 +173,7 @@ float get_weight_and_index(float time, AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings) { - AbcObjectReader *reader = NULL; + AbcObjectReader *reader = nullptr; const Alembic::AbcGeom::MetaData &md = object.getMetaData(); diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 026a11ca25e..c9eefbf9039 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -167,7 +167,7 @@ AbcArchiveHandle *ABC_create_handle(struct Main *bmain, if (!archive->valid()) { delete archive; - return NULL; + return nullptr; } if (object_paths) { @@ -239,7 +239,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( if (!object.valid()) { std::cerr << " - " << full_name << ": object is invalid, skipping it and all its children.\n"; - return std::make_pair(false, static_cast<AbcObjectReader *>(NULL)); + return std::make_pair(false, static_cast<AbcObjectReader *>(nullptr)); } /* The interpretation of data by the children determine the role of this @@ -261,7 +261,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( bool child_claims_this_object = child_result.first; AbcObjectReader *child_reader = child_result.second; - if (child_reader == NULL) { + if (child_reader == nullptr) { BLI_assert(!child_claims_this_object); } else { @@ -277,7 +277,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( } BLI_assert(children_claiming_this_object == claiming_child_readers.size()); - AbcObjectReader *reader = NULL; + AbcObjectReader *reader = nullptr; const MetaData &md = object.getMetaData(); bool parent_is_part_of_this_object = false; @@ -544,8 +544,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa const AbcObjectReader *parent_reader = reader->parent_reader; Object *ob = reader->object(); - if (parent_reader == NULL || !reader->inherits_xform()) { - ob->parent = NULL; + if (parent_reader == nullptr || !reader->inherits_xform()) { + ob->parent = nullptr; } else { ob->parent = parent_reader->object(); @@ -583,7 +583,7 @@ static void import_endjob(void *user_data) /* It's possible that cancellation occurred between the creation of * the reader and the creation of the Blender object. */ - if (ob == NULL) { + if (ob == nullptr) { continue; } @@ -685,7 +685,7 @@ bool ABC_import(bContext *C, job->settings.validate_meshes = validate_meshes; job->error_code = ABC_NO_ERROR; job->was_cancelled = false; - job->archive = NULL; + job->archive = nullptr; job->is_background_job = as_background_job; G.is_break = false; @@ -702,7 +702,7 @@ bool ABC_import(bContext *C, /* setup job */ WM_jobs_customdata_set(wm_job, job, import_freejob); WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_FRAME, NC_SCENE | ND_FRAME); - WM_jobs_callbacks(wm_job, import_startjob, NULL, NULL, import_endjob); + WM_jobs_callbacks(wm_job, import_startjob, nullptr, nullptr, import_endjob); WM_jobs_start(CTX_wm_manager(C), wm_job); } @@ -762,13 +762,13 @@ static AbcObjectReader *get_abc_reader(CacheReader *reader, Object *ob, const ch if (!iobject.valid()) { *err_str = "Invalid object: verify object path"; - return NULL; + return nullptr; } const ObjectHeader &header = iobject.getHeader(); if (!abc_reader->accepts_object_type(header, ob, err_str)) { /* err_str is set by acceptsObjectType() */ - return NULL; + return nullptr; } return abc_reader; @@ -789,8 +789,8 @@ Mesh *ABC_read_mesh(CacheReader *reader, int read_flag) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); - if (abc_reader == NULL) { - return NULL; + if (abc_reader == nullptr) { + return nullptr; } ISampleSelector sample_sel = sample_selector_for_time(time); @@ -801,7 +801,7 @@ bool ABC_mesh_topology_changed( CacheReader *reader, Object *ob, Mesh *existing_mesh, const float time, const char **err_str) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); - if (abc_reader == NULL) { + if (abc_reader == nullptr) { return false; } @@ -851,9 +851,9 @@ CacheReader *CacheReader_open_alembic_object(AbcArchiveHandle *handle, ImportSettings settings; AbcObjectReader *abc_reader = create_reader(iobject, settings); - if (abc_reader == NULL) { + if (abc_reader == nullptr) { /* This object is not supported */ - return NULL; + return nullptr; } abc_reader->object(object); abc_reader->incref(); |