Explicitly use nullptr

pull/2731/head
RevoluPowered 2019-10-27 11:29:56 +00:00
parent 5d0c63391b
commit 9c8d835704
5 changed files with 44 additions and 44 deletions

View File

@ -44,23 +44,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
aiNode::aiNode() aiNode::aiNode()
: mName("") : mName("")
, mParent(NULL) , mParent(nullptr)
, mNumChildren(0) , mNumChildren(0)
, mChildren(NULL) , mChildren(nullptr)
, mNumMeshes(0) , mNumMeshes(0)
, mMeshes(NULL) , mMeshes(nullptr)
, mMetaData(NULL) { , mMetaData(nullptr) {
// empty // empty
} }
aiNode::aiNode(const std::string& name) aiNode::aiNode(const std::string& name)
: mName(name) : mName(name)
, mParent(NULL) , mParent(nullptr)
, mNumChildren(0) , mNumChildren(0)
, mChildren(NULL) , mChildren(nullptr)
, mNumMeshes(0) , mNumMeshes(0)
, mMeshes(NULL) , mMeshes(nullptr)
, mMetaData(NULL) { , mMetaData(nullptr) {
// empty // empty
} }

View File

@ -1134,7 +1134,7 @@ namespace Assimp {
binormals = &tempBinormals; binormals = &tempBinormals;
} }
else { else {
binormals = NULL; binormals = nullptr;
} }
} }
@ -1184,7 +1184,7 @@ namespace Assimp {
ConvertMaterialForMesh(out_mesh, model, mesh, mindices[0]); ConvertMaterialForMesh(out_mesh, model, mesh, mindices[0]);
} }
if (doc.Settings().readWeights && mesh.DeformerSkin() != NULL) { if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr) {
ConvertWeights(out_mesh, model, mesh, absolute_transform, parent, root_node, NO_MATERIAL_SEPARATION, ConvertWeights(out_mesh, model, mesh, absolute_transform, parent, root_node, NO_MATERIAL_SEPARATION,
nullptr); nullptr);
} }
@ -1264,7 +1264,7 @@ namespace Assimp {
const std::vector<aiVector3D>& vertices = mesh.GetVertices(); const std::vector<aiVector3D>& vertices = mesh.GetVertices();
const std::vector<unsigned int>& faces = mesh.GetFaceIndexCounts(); const std::vector<unsigned int>& faces = mesh.GetFaceIndexCounts();
const bool process_weights = doc.Settings().readWeights && mesh.DeformerSkin() != NULL; const bool process_weights = doc.Settings().readWeights && mesh.DeformerSkin() != nullptr;
unsigned int count_faces = 0; unsigned int count_faces = 0;
unsigned int count_vertices = 0; unsigned int count_vertices = 0;
@ -1324,7 +1324,7 @@ namespace Assimp {
binormals = &tempBinormals; binormals = &tempBinormals;
} }
else { else {
binormals = NULL; binormals = nullptr;
} }
} }
@ -1513,9 +1513,9 @@ namespace Assimp {
unsigned int count = 0; unsigned int count = 0;
const unsigned int* const out_idx = geo.ToOutputVertexIndex(index, count); const unsigned int* const out_idx = geo.ToOutputVertexIndex(index, count);
// ToOutputVertexIndex only returns NULL if index is out of bounds // ToOutputVertexIndex only returns nullptr if index is out of bounds
// which should never happen // which should never happen
ai_assert(out_idx != NULL); ai_assert(out_idx != nullptr);
index_out_indices.push_back(no_index_sentinel); index_out_indices.push_back(no_index_sentinel);
count_out_indices.push_back(0); count_out_indices.push_back(0);
@ -1586,7 +1586,7 @@ namespace Assimp {
std::string deformer_name = cl->TargetNode()->Name(); std::string deformer_name = cl->TargetNode()->Name();
aiString bone_name = aiString(FixNodeName(deformer_name)); aiString bone_name = aiString(FixNodeName(deformer_name));
aiBone *bone = NULL; aiBone *bone = nullptr;
if (bone_map.count(deformer_name)) { if (bone_map.count(deformer_name)) {
std::cout << "retrieved bone from lookup " << bone_name.C_Str() << ". Deformer: " << deformer_name std::cout << "retrieved bone from lookup " << bone_name.C_Str() << ". Deformer: " << deformer_name
@ -2740,7 +2740,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
// sanity check whether the input is ok // sanity check whether the input is ok
static void validateAnimCurveNodes(const std::vector<const AnimationCurveNode*>& curves, static void validateAnimCurveNodes(const std::vector<const AnimationCurveNode*>& curves,
bool strictMode) { bool strictMode) {
const Object* target(NULL); const Object* target(nullptr);
for (const AnimationCurveNode* node : curves) { for (const AnimationCurveNode* node : curves) {
if (!target) { if (!target) {
target = node->Target(); target = node->Target();
@ -2771,7 +2771,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
validateAnimCurveNodes(curves, doc.Settings().strictMode); validateAnimCurveNodes(curves, doc.Settings().strictMode);
#endif #endif
const AnimationCurveNode* curve_node = NULL; const AnimationCurveNode* curve_node = nullptr;
for (const AnimationCurveNode* node : curves) { for (const AnimationCurveNode* node : curves) {
ai_assert(node); ai_assert(node);
@ -3619,7 +3619,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
ai_assert(!out->mMeshes); ai_assert(!out->mMeshes);
ai_assert(!out->mNumMeshes); ai_assert(!out->mNumMeshes);
// note: the trailing () ensures initialization with NULL - not // note: the trailing () ensures initialization with nullptr - not
// many C++ users seem to know this, so pointing it out to avoid // many C++ users seem to know this, so pointing it out to avoid
// confusion why this code works. // confusion why this code works.

View File

@ -115,7 +115,7 @@ aiNode *ArmaturePopulate::GetArmatureRoot(aiNode *bone_node,
ASSIMP_LOG_WARN("GetArmatureRoot() can't find armature!"); ASSIMP_LOG_WARN("GetArmatureRoot() can't find armature!");
return NULL; return nullptr;
} }
/* Simple IsBoneNode check if this could be a bone */ /* Simple IsBoneNode check if this could be a bone */
@ -139,7 +139,7 @@ bool ArmaturePopulate::IsBoneNode(const aiString &bone_name,
aiNode *ArmaturePopulate::GetNodeFromStack(const aiString &node_name, aiNode *ArmaturePopulate::GetNodeFromStack(const aiString &node_name,
std::vector<aiNode *> &nodes) { std::vector<aiNode *> &nodes) {
std::vector<aiNode *>::iterator iter; std::vector<aiNode *>::iterator iter;
aiNode *found = NULL; aiNode *found = nullptr;
for (iter = nodes.begin(); iter < nodes.end(); ++iter) { for (iter = nodes.begin(); iter < nodes.end(); ++iter) {
aiNode *element = *iter; aiNode *element = *iter;
ai_assert(element); ai_assert(element);
@ -150,13 +150,13 @@ aiNode *ArmaturePopulate::GetNodeFromStack(const aiString &node_name,
} }
} }
if (found != NULL) { if (found != nullptr) {
// now pop the element from the node list // now pop the element from the node list
nodes.erase(iter); nodes.erase(iter);
return found; return found;
} }
return NULL; return nullptr;
} }
/* Prepare flat node list which can be used for non recursive lookups later */ /* Prepare flat node list which can be used for non recursive lookups later */
@ -233,10 +233,10 @@ void ArmaturePopulate::BuildBoneStack(aiNode *current_node,
for (aiBone *bone : bones) { for (aiBone *bone : bones) {
ai_assert(bone); ai_assert(bone);
aiNode *node = GetNodeFromStack(bone->mName, node_stack); aiNode *node = GetNodeFromStack(bone->mName, node_stack);
if (node == NULL) { if (node == nullptr) {
node_stack.clear(); node_stack.clear();
BuildNodeList(root_node, node_stack); BuildNodeList(root_node, node_stack);
ASSIMP_LOG_DEBUG_F("Resetting bone stack: null element %s\n", bone->mName.C_Str()); ASSIMP_LOG_DEBUG_F("Resetting bone stack: nullptr element %s\n", bone->mName.C_Str());
node = GetNodeFromStack(bone->mName, node_stack); node = GetNodeFromStack(bone->mName, node_stack);

View File

@ -435,11 +435,11 @@ struct aiAnimMesh
/**Anim Mesh name */ /**Anim Mesh name */
C_STRUCT aiString mName; C_STRUCT aiString mName;
/** Replacement for aiMesh::mVertices. If this array is non-NULL, /** Replacement for aiMesh::mVertices. If this array is non-nullptr,
* it *must* contain mNumVertices entries. The corresponding * it *must* contain mNumVertices entries. The corresponding
* array in the host mesh must be non-NULL as well - animation * array in the host mesh must be non-nullptr as well - animation
* meshes may neither add or nor remove vertex components (if * meshes may neither add or nor remove vertex components (if
* a replacement array is NULL and the corresponding source * a replacement array is nullptr and the corresponding source
* array is not, the source data is taken instead)*/ * array is not, the source data is taken instead)*/
C_STRUCT aiVector3D* mVertices; C_STRUCT aiVector3D* mVertices;
@ -613,7 +613,7 @@ struct aiMesh
C_STRUCT aiVector3D* mVertices; C_STRUCT aiVector3D* mVertices;
/** Vertex normals. /** Vertex normals.
* The array contains normalized vectors, NULL if not present. * The array contains normalized vectors, nullptr if not present.
* The array is mNumVertices in size. Normals are undefined for * The array is mNumVertices in size. Normals are undefined for
* point and line primitives. A mesh consisting of points and * point and line primitives. A mesh consisting of points and
* lines only may not have normal vectors. Meshes with mixed * lines only may not have normal vectors. Meshes with mixed
@ -636,7 +636,7 @@ struct aiMesh
/** Vertex tangents. /** Vertex tangents.
* The tangent of a vertex points in the direction of the positive * The tangent of a vertex points in the direction of the positive
* X texture axis. The array contains normalized vectors, NULL if * X texture axis. The array contains normalized vectors, nullptr if
* not present. The array is mNumVertices in size. A mesh consisting * not present. The array is mNumVertices in size. A mesh consisting
* of points and lines only may not have normal vectors. Meshes with * of points and lines only may not have normal vectors. Meshes with
* mixed primitive types (i.e. lines and triangles) may have * mixed primitive types (i.e. lines and triangles) may have
@ -650,7 +650,7 @@ struct aiMesh
/** Vertex bitangents. /** Vertex bitangents.
* The bitangent of a vertex points in the direction of the positive * The bitangent of a vertex points in the direction of the positive
* Y texture axis. The array contains normalized vectors, NULL if not * Y texture axis. The array contains normalized vectors, nullptr if not
* present. The array is mNumVertices in size. * present. The array is mNumVertices in size.
* @note If the mesh contains tangents, it automatically also contains * @note If the mesh contains tangents, it automatically also contains
* bitangents. * bitangents.
@ -659,14 +659,14 @@ struct aiMesh
/** Vertex color sets. /** Vertex color sets.
* A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex * A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex
* colors per vertex. NULL if not present. Each array is * colors per vertex. nullptr if not present. Each array is
* mNumVertices in size if present. * mNumVertices in size if present.
*/ */
C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS]; C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
/** Vertex texture coords, also known as UV channels. /** Vertex texture coords, also known as UV channels.
* A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per * A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
* vertex. NULL if not present. The array is mNumVertices in size. * vertex. nullptr if not present. The array is mNumVertices in size.
*/ */
C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS]; C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
@ -688,7 +688,7 @@ struct aiMesh
C_STRUCT aiFace* mFaces; C_STRUCT aiFace* mFaces;
/** The number of bones this mesh contains. /** The number of bones this mesh contains.
* Can be 0, in which case the mBones array is NULL. * Can be 0, in which case the mBones array is nullptr.
*/ */
unsigned int mNumBones; unsigned int mNumBones;

View File

@ -110,13 +110,13 @@ struct ASSIMP_API aiNode
/** The transformation relative to the node's parent. */ /** The transformation relative to the node's parent. */
C_STRUCT aiMatrix4x4 mTransformation; C_STRUCT aiMatrix4x4 mTransformation;
/** Parent node. NULL if this node is the root node. */ /** Parent node. nullptr if this node is the root node. */
C_STRUCT aiNode* mParent; C_STRUCT aiNode* mParent;
/** The number of child nodes of this node. */ /** The number of child nodes of this node. */
unsigned int mNumChildren; unsigned int mNumChildren;
/** The child nodes of this node. NULL if mNumChildren is 0. */ /** The child nodes of this node. nullptr if mNumChildren is 0. */
C_STRUCT aiNode** mChildren; C_STRUCT aiNode** mChildren;
/** The number of meshes of this node. */ /** The number of meshes of this node. */
@ -127,7 +127,7 @@ struct ASSIMP_API aiNode
*/ */
unsigned int* mMeshes; unsigned int* mMeshes;
/** Metadata associated with this node or NULL if there is no metadata. /** Metadata associated with this node or nullptr if there is no metadata.
* Whether any metadata is generated depends on the source file format. See the * Whether any metadata is generated depends on the source file format. See the
* @link importer_notes @endlink page for more information on every source file * @link importer_notes @endlink page for more information on every source file
* format. Importers that don't document any metadata don't write any. * format. Importers that don't document any metadata don't write any.
@ -149,7 +149,7 @@ struct ASSIMP_API aiNode
* of the scene. * of the scene.
* *
* @param name Name to search for * @param name Name to search for
* @return NULL or a valid Node if the search was successful. * @return nullptr or a valid Node if the search was successful.
*/ */
inline inline
const aiNode* FindNode(const aiString& name) const { const aiNode* FindNode(const aiString& name) const {
@ -344,7 +344,7 @@ struct aiScene
#ifdef __cplusplus #ifdef __cplusplus
//! Default constructor - set everything to 0/NULL //! Default constructor - set everything to 0/nullptr
ASSIMP_API aiScene(); ASSIMP_API aiScene();
//! Destructor //! Destructor
@ -353,33 +353,33 @@ struct aiScene
//! Check whether the scene contains meshes //! Check whether the scene contains meshes
//! Unless no special scene flags are set this will always be true. //! Unless no special scene flags are set this will always be true.
inline bool HasMeshes() const { inline bool HasMeshes() const {
return mMeshes != NULL && mNumMeshes > 0; return mMeshes != nullptr && mNumMeshes > 0;
} }
//! Check whether the scene contains materials //! Check whether the scene contains materials
//! Unless no special scene flags are set this will always be true. //! Unless no special scene flags are set this will always be true.
inline bool HasMaterials() const { inline bool HasMaterials() const {
return mMaterials != NULL && mNumMaterials > 0; return mMaterials != nullptr && mNumMaterials > 0;
} }
//! Check whether the scene contains lights //! Check whether the scene contains lights
inline bool HasLights() const { inline bool HasLights() const {
return mLights != NULL && mNumLights > 0; return mLights != nullptr && mNumLights > 0;
} }
//! Check whether the scene contains textures //! Check whether the scene contains textures
inline bool HasTextures() const { inline bool HasTextures() const {
return mTextures != NULL && mNumTextures > 0; return mTextures != nullptr && mNumTextures > 0;
} }
//! Check whether the scene contains cameras //! Check whether the scene contains cameras
inline bool HasCameras() const { inline bool HasCameras() const {
return mCameras != NULL && mNumCameras > 0; return mCameras != nullptr && mNumCameras > 0;
} }
//! Check whether the scene contains animations //! Check whether the scene contains animations
inline bool HasAnimations() const { inline bool HasAnimations() const {
return mAnimations != NULL && mNumAnimations > 0; return mAnimations != nullptr && mNumAnimations > 0;
} }
//! Returns a short filename from a full path //! Returns a short filename from a full path