Skip to content

Commit

Permalink
Merge branch 'master' into 3ds-namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling authored May 2, 2021
2 parents e73a2ed + b516d94 commit e278673
Show file tree
Hide file tree
Showing 52 changed files with 1,322 additions and 445 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ A library to import and export various 3d-model-formats including scene-post-pro
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/5607/badge.svg"/>
</a>
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade)
[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master)
[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5be56faac64f46fc941ac890fb4febef)](https://www.codacy.com/app/kimkulling/assimp?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/)
<br>

Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/3DS/3DSConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
mat.AddProperty(&tex, AI_MATKEY_GLOBAL_BACKGROUND_IMAGE);

// Be sure this is only done for the first material
mBackgroundImage = std::string("");
mBackgroundImage = std::string();
}

// At first add the base ambient color of the scene to the material
Expand Down
8 changes: 4 additions & 4 deletions code/AssetLib/3DS/3DSLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
mRootNode->mHierarchyIndex = -1;
mRootNode->mParent = nullptr;
mMasterScale = 1.0f;
mBackgroundImage = "";
mBackgroundImage = std::string();
bHasBG = false;
bIsPrj = false;

Expand Down Expand Up @@ -981,9 +981,9 @@ void Discreet3DSImporter::ParseMeshChunk() {
mMesh.mMat.a3 = stream->GetF4();
mMesh.mMat.b3 = stream->GetF4();
mMesh.mMat.c3 = stream->GetF4();
mMesh.mMat.d1 = stream->GetF4();
mMesh.mMat.d2 = stream->GetF4();
mMesh.mMat.d3 = stream->GetF4();
mMesh.mMat.a4 = stream->GetF4();
mMesh.mMat.b4 = stream->GetF4();
mMesh.mMat.c4 = stream->GetF4();
} break;

case Discreet3DS::CHUNK_MAPLIST: {
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/3MF/D3MFOpcPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ bool D3MFOpcPackage::validate() {
std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
XmlParser xmlParser;
if (!xmlParser.parse(stream)) {
return "";
return std::string();
}

OpcPackageRelationshipReader reader(xmlParser);
Expand Down
4 changes: 2 additions & 2 deletions code/AssetLib/AC/ACLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ class AC3DImporter : public BaseImporter {
struct Object {
Object() :
type(World),
name(""),
name(),
children(),
texture(""),
texture(),
texRepeat(1.f, 1.f),
texOffset(0.0f, 0.0f),
rotation(),
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/ASE/ASEParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ void Parser::ParseLV3MapBlock(Texture &map) {
// Files with 'None' as map name are produced by
// an Maja to ASE exporter which name I forgot ..
ASSIMP_LOG_WARN("ASE: Skipping invalid map entry");
map.mMapName = "";
map.mMapName = std::string();
}

continue;
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Blender/BlenderLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ using namespace Assimp::Blender;
using namespace Assimp::Formatter;

static const aiImporterDesc blenderDesc = {
"Blender 3D Importer \nhttp://www.blender3d.org",
"Blender 3D Importer (http://www.blender3d.org)",
"",
"",
"No animation support yet",
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Collada/ColladaLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
continue;
}
entry.mTargetId = entry.mTransformId;
entry.mTransformId = "";
entry.mTransformId = std::string();
}

entry.mChannel = &(*cit);
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/FBX/FBXMeshGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
}

const Element* Name = source["Name"];
m_uvNames[index] = "";
m_uvNames[index] = std::string();
if(Name) {
m_uvNames[index] = ParseTokenAsString(GetRequiredToken(*Name,0));
}
Expand Down
8 changes: 4 additions & 4 deletions code/AssetLib/FBX/FBXParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,15 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)

if (t.Type() != TokenType_DATA) {
err_out = "expected TOK_DATA token";
return "";
return std::string();
}

if(t.IsBinary())
{
const char* data = t.begin();
if (data[0] != 'S') {
err_out = "failed to parse S(tring), unexpected data type (binary)";
return "";
return std::string();
}

// read string length
Expand All @@ -484,13 +484,13 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
const size_t length = static_cast<size_t>(t.end() - t.begin());
if(length < 2) {
err_out = "token is too short to hold a string";
return "";
return std::string();
}

const char* s = t.begin(), *e = t.end() - 1;
if (*s != '\"' || *e != '\"') {
err_out = "expected double quoted string";
return "";
return std::string();
}

return std::string(s+1,length-2);
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/FBX/FBXProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ std::string PeekPropertyName(const Element& element)
ai_assert(element.KeyToken().StringContents() == "P");
const TokenList& tok = element.Tokens();
if(tok.size() < 4) {
return "";
return std::string();
}

return ParseTokenAsString(*tok[0]);
Expand Down
4 changes: 2 additions & 2 deletions code/AssetLib/IFC/IFCLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ typedef std::map<std::string, std::string> Metadata;

// ------------------------------------------------------------------------------------------------
void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcProperty>, 1, 0> &set, ConversionData &conv, Metadata &properties,
const std::string &prefix = "",
const std::string &prefix = std::string(),
unsigned int nest = 0) {
for (const Schema_2x3::IfcProperty &property : set) {
const std::string &key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
Expand Down Expand Up @@ -618,7 +618,7 @@ void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcPr
ProcessMetadata(complexProp->HasProperties, conv, properties, key, nest + 1);
}
} else {
properties[key] = "";
properties[key] = std::string();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Irr/IRRLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy

// Check whether we can read from the file
if (file.get() == nullptr) {
throw DeadlyImportError("Failed to open IRR file " + pFile + "");
throw DeadlyImportError("Failed to open IRR file " + pFile);
}

// Construct the irrXML parser
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Irr/IRRMeshLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,

// Check whether we can read from the file
if (file.get() == NULL)
throw DeadlyImportError("Failed to open IRRMESH file " + pFile + "");
throw DeadlyImportError("Failed to open IRRMESH file " + pFile);

// Construct the irrXML parser
XmlParser parser;
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/LWO/LWOFileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ struct Surface {
Surface() :
mColor(0.78431f, 0.78431f, 0.78431f), bDoubleSided(false), mDiffuseValue(1.f), mSpecularValue(0.f), mTransparency(0.f), mGlossiness(0.4f), mLuminosity(0.f), mColorHighlights(0.f), mMaximumSmoothAngle(0.f) // 0 == not specified, no smoothing
,
mVCMap(""),
mVCMap(),
mVCMapType(AI_LWO_RGBA),
mIOR(1.f) // vakuum
,
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/LWS/LWSLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct NodeDesc {
id(),
number(0),
parent(0),
name(""),
name(),
isPivotSet(false),
lightColor(1.f, 1.f, 1.f),
lightIntensity(1.f),
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/MD2/MD2NormalTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MDL_NORMALTABLE_H_INC


float g_avNormals[162][3] = {
const float g_avNormals[162][3] = {
{ -0.525731f, 0.000000f, 0.850651f },
{ -0.442863f, 0.238856f, 0.864188f },
{ -0.295242f, 0.000000f, 0.955423f },
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/MDC/MDCNormalTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MDC_NORMAL_TABLE_INCLUDED

/* mdc decoding normal table */
float mdcNormals[ 256 ][ 3 ] =
const float mdcNormals[ 256 ][ 3 ] =
{
{ 1.000000f, 0.000000f, 0.000000f },
{ 0.980785f, 0.195090f, 0.000000f },
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void UniqueNameGenerator::make_unique(std::vector<std::string> &names) {
auto generate_unique_name = [&](const std::string &base_name) -> std::string {
auto *duplicate_info = &names_to_duplicates[base_name];

std::string new_name = "";
std::string new_name;

bool found_identical_name;
bool tried_with_base_name_only = false;
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/MMD/MMDImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ using namespace std;
// Default constructor
MMDImporter::MMDImporter() :
m_Buffer(),
m_strAbsPath("") {
m_strAbsPath() {
DefaultIOSystem io;
m_strAbsPath = io.getOsSeparator();
}
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/MMD/MMDPmxParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace pmx
std::vector<char> buffer;
if (size == 0)
{
return std::string("");
return std::string();
}
buffer.reserve(size);
stream->read((char*) buffer.data(), size);
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/OpenGEX/OpenGEXImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ USE_ODDLPARSER_NS

//------------------------------------------------------------------------------------------------
static void propId2StdString(Property *prop, std::string &name, std::string &key) {
name = key = "";
name = key = std::string();
if (nullptr == prop) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/OpenGEX/OpenGEXImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct MetricInfo {
int m_intValue;

MetricInfo()
: m_stringValue( "" )
: m_stringValue( )
, m_floatValue( 0.0f )
, m_intValue( -1 ) {
// empty
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Q3BSP/Q3BSPFileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct Q3BSPModel {
m_Textures(),
m_Lightmaps(),
m_EntityData(),
m_ModelName( "" )
m_ModelName()
{
// empty
}
Expand Down
16 changes: 8 additions & 8 deletions code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void extractIds(const std::string &key, int &id1, int &id2) {
// ------------------------------------------------------------------------------------------------
// Local helper function to normalize filenames.
static void normalizePathName(const std::string &rPath, std::string &normalizedPath) {
normalizedPath = "";
normalizedPath = std::string();
if (rPath.empty()) {
return;
}
Expand Down Expand Up @@ -183,7 +183,7 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
throw DeadlyImportError("Failed to open file ", rFile, ".");
}

std::string archiveName(""), mapName("");
std::string archiveName, mapName;
separateMapName(rFile, archiveName, mapName);

if (mapName.empty()) {
Expand All @@ -202,8 +202,8 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
// ------------------------------------------------------------------------------------------------
// Separates the map name from the import name.
void Q3BSPFileImporter::separateMapName(const std::string &importName, std::string &archiveName, std::string &mapName) {
archiveName = "";
mapName = "";
archiveName = std::string();
mapName = std::string();
if (importName.empty()) {
return;
}
Expand All @@ -221,7 +221,7 @@ void Q3BSPFileImporter::separateMapName(const std::string &importName, std::stri
// ------------------------------------------------------------------------------------------------
// Returns the first map in the map archive.
bool Q3BSPFileImporter::findFirstMapInArchive(ZipArchiveIOSystem &bspArchive, std::string &mapName) {
mapName = "";
mapName = std::string();
std::vector<std::string> fileList;
bspArchive.getFileListExtension(fileList, "bsp");
if (fileList.empty()) {
Expand Down Expand Up @@ -440,7 +440,7 @@ void Q3BSPFileImporter::createMaterials(const Q3BSP::Q3BSPModel *pModel, aiScene
if (-1 != textureId) {
sQ3BSPTexture *pTexture = pModel->m_Textures[textureId];
if (nullptr != pTexture) {
std::string tmp("*"), texName("");
std::string tmp("*"), texName;
tmp += pTexture->strName;
tmp += ".jpg";
normalizePathName(tmp, texName);
Expand Down Expand Up @@ -512,7 +512,7 @@ size_t Q3BSPFileImporter::countTriangles(const std::vector<Q3BSP::sQ3BSPFace *>
// ------------------------------------------------------------------------------------------------
// Creates the faces-to-material map.
void Q3BSPFileImporter::createMaterialMap(const Q3BSP::Q3BSPModel *pModel) {
std::string key("");
std::string key;
std::vector<sQ3BSPFace *> *pCurFaceArray = nullptr;
for (size_t idx = 0; idx < pModel->m_Faces.size(); idx++) {
Q3BSP::sQ3BSPFace *pQ3BSPFace = pModel->m_Faces[idx];
Expand Down Expand Up @@ -660,7 +660,7 @@ bool Q3BSPFileImporter::expandFile(ZipArchiveIOSystem *pArchive, const std::stri

if (rExtList.empty()) {
rFile = rFilename;
rExt = "";
rExt = std::string();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/X/XFileHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct Mesh {

std::vector<Bone> mBones;

explicit Mesh(const std::string &pName = "") AI_NO_EXCEPT
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
: mName( pName )
, mPositions()
, mPosFaces()
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/XGL/XGLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy

// check whether we can read from the file
if (stream.get() == NULL) {
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile + "");
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile);
}

// see if its compressed, if so uncompress it
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/glTF/glTFAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ namespace glTF

AssetMetadata()
: premultipliedAlpha(false)
, version("")
, version()
{
}
};
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/glTF2/glTF2Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ struct AssetMetadata {
void Read(Document &doc);

AssetMetadata() :
version("") {}
version() {}
};

//
Expand Down
Loading

0 comments on commit e278673

Please sign in to comment.