Merge branch 'master' into add-step-extension

This commit is contained in:
Kim Kulling
2021-05-04 22:35:21 +02:00
committed by GitHub
63 changed files with 1481 additions and 630 deletions
+1 -1
View File
@@ -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
+3 -2
View File
@@ -102,13 +102,14 @@ private:
// preserves the mesh's given name if it has one. |index| is the index
// of the mesh in |aiScene::mMeshes|.
std::string GetMeshName(const aiMesh &mesh, unsigned int index, const aiNode &node) {
static const std::string underscore = "_";
static const char underscore = '_';
char postfix[10] = { 0 };
ASSIMP_itoa10(postfix, index);
std::string result = node.mName.C_Str();
if (mesh.mName.length > 0) {
result += underscore + mesh.mName.C_Str();
result += underscore;
result += mesh.mName.C_Str();
}
return result + underscore + postfix;
}
+3 -13
View File
@@ -61,20 +61,10 @@ namespace D3DS {
#include <assimp/Compiler/pushpack1.h>
// ---------------------------------------------------------------------------
/** Discreet3DS class: Helper class for loading 3ds files. Defines chunks
* and data structures.
/** Defines chunks and data structures.
*/
class Discreet3DS {
private:
Discreet3DS() AI_NO_EXCEPT {
// empty
}
namespace Discreet3DS {
~Discreet3DS() {
// empty
}
public:
//! data structure for a single chunk in a .3ds file
struct Chunk {
uint16_t Flag;
@@ -314,7 +304,7 @@ public:
// camera sub-chunks
CHUNK_CAM_RANGES = 0x4720
};
};
}
// ---------------------------------------------------------------------------
/** Helper structure representing a 3ds mesh face */
+4 -4
View File
@@ -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;
@@ -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: {
+53 -50
View File
@@ -44,63 +44,66 @@ namespace Assimp {
namespace D3MF {
namespace XmlTag {
// Root tag
const char* const RootTag = "3MF";
// Meta-data
static const std::string meta = "metadata";
static const std::string meta_name = "name";
const char* const meta = "metadata";
const char* const meta_name = "name";
// Model-data specific tags
static const std::string model = "model";
static const std::string model_unit = "unit";
static const std::string metadata = "metadata";
static const std::string resources = "resources";
static const std::string object = "object";
static const std::string mesh = "mesh";
static const std::string components = "components";
static const std::string component = "component";
static const std::string vertices = "vertices";
static const std::string vertex = "vertex";
static const std::string triangles = "triangles";
static const std::string triangle = "triangle";
static const std::string x = "x";
static const std::string y = "y";
static const std::string z = "z";
static const std::string v1 = "v1";
static const std::string v2 = "v2";
static const std::string v3 = "v3";
static const std::string id = "id";
static const std::string pid = "pid";
static const std::string pindex = "pindex";
static const std::string p1 = "p1";
static const std::string name = "name";
static const std::string type = "type";
static const std::string build = "build";
static const std::string item = "item";
static const std::string objectid = "objectid";
static const std::string transform = "transform";
const char* const model = "model";
const char* const model_unit = "unit";
const char* const metadata = "metadata";
const char* const resources = "resources";
const char* const object = "object";
const char* const mesh = "mesh";
const char* const components = "components";
const char* const component = "component";
const char* const vertices = "vertices";
const char* const vertex = "vertex";
const char* const triangles = "triangles";
const char* const triangle = "triangle";
const char* const x = "x";
const char* const y = "y";
const char* const z = "z";
const char* const v1 = "v1";
const char* const v2 = "v2";
const char* const v3 = "v3";
const char* const id = "id";
const char* const pid = "pid";
const char* const pindex = "pindex";
const char* const p1 = "p1";
const char* const name = "name";
const char* const type = "type";
const char* const build = "build";
const char* const item = "item";
const char* const objectid = "objectid";
const char* const transform = "transform";
// Material definitions
static const std::string basematerials = "basematerials";
static const std::string basematerials_id = "id";
static const std::string basematerials_base = "base";
static const std::string basematerials_name = "name";
static const std::string basematerials_displaycolor = "displaycolor";
const char* const basematerials = "basematerials";
const char* const basematerials_id = "id";
const char* const basematerials_base = "base";
const char* const basematerials_name = "name";
const char* const basematerials_displaycolor = "displaycolor";
// Meta info tags
static const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
static const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
static const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
static const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
static const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
static const std::string RELS_RELATIONSHIP_NODE = "Relationship";
static const std::string RELS_ATTRIB_TARGET = "Target";
static const std::string RELS_ATTRIB_TYPE = "Type";
static const std::string RELS_ATTRIB_ID = "Id";
static const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
static const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
static const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
static const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
const char* const SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
const char* const SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
const char* const RELS_RELATIONSHIP_CONTAINER = "Relationships";
const char* const RELS_RELATIONSHIP_NODE = "Relationship";
const char* const RELS_ATTRIB_TARGET = "Target";
const char* const RELS_ATTRIB_TYPE = "Type";
const char* const RELS_ATTRIB_ID = "Id";
const char* const PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
const char* const PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
} // Namespace D3MF
} // Namespace Assimp
+26 -11
View File
@@ -307,18 +307,26 @@ void D3MFExporter::writeMesh(aiMesh *mesh) {
return;
}
mModelOutput << "<" << XmlTag::mesh << ">" << std::endl;
mModelOutput << "<" << XmlTag::vertices << ">" << std::endl;
mModelOutput << "<"
<< XmlTag::mesh
<< ">" << "\n";
mModelOutput << "<"
<< XmlTag::vertices
<< ">" << "\n";
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
writeVertex(mesh->mVertices[i]);
}
mModelOutput << "</" << XmlTag::vertices << ">" << std::endl;
mModelOutput << "</"
<< XmlTag::vertices << ">"
<< "\n";
const unsigned int matIdx(mesh->mMaterialIndex);
writeFaces(mesh, matIdx);
mModelOutput << "</" << XmlTag::mesh << ">" << std::endl;
mModelOutput << "</"
<< XmlTag::mesh << ">"
<< "\n";
}
void D3MFExporter::writeVertex(const aiVector3D &pos) {
@@ -334,27 +342,34 @@ void D3MFExporter::writeFaces(aiMesh *mesh, unsigned int matIdx) {
if (!mesh->HasFaces()) {
return;
}
mModelOutput << "<" << XmlTag::triangles << ">" << std::endl;
mModelOutput << "<"
<< XmlTag::triangles << ">"
<< "\n";
for (unsigned int i = 0; i < mesh->mNumFaces; ++i) {
aiFace &currentFace = mesh->mFaces[i];
mModelOutput << "<" << XmlTag::triangle << " v1=\"" << currentFace.mIndices[0] << "\" v2=\""
<< currentFace.mIndices[1] << "\" v3=\"" << currentFace.mIndices[2]
<< "\" pid=\"1\" p1=\"" + ai_to_string(matIdx) + "\" />";
mModelOutput << std::endl;
mModelOutput << "\n";
}
mModelOutput << "</" << XmlTag::triangles << ">";
mModelOutput << std::endl;
mModelOutput << "</"
<< XmlTag::triangles
<< ">";
mModelOutput << "\n";
}
void D3MFExporter::writeBuild() {
mModelOutput << "<" << XmlTag::build << ">" << std::endl;
mModelOutput << "<"
<< XmlTag::build
<< ">"
<< "\n";
for (size_t i = 0; i < mBuildItems.size(); ++i) {
mModelOutput << "<" << XmlTag::item << " objectid=\"" << i + 2 << "\"/>";
mModelOutput << std::endl;
mModelOutput << "\n";
}
mModelOutput << "</" << XmlTag::build << ">";
mModelOutput << std::endl;
mModelOutput << "\n";
}
void D3MFExporter::zipContentType(const std::string &filename) {
+82 -81
View File
@@ -72,32 +72,39 @@ enum class ResourceType {
RT_Unknown
}; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...)
class Resource
{
class Resource {
public:
Resource(int id) :
mId(id) {}
virtual ~Resource() {}
int mId;
virtual ResourceType getType() {
Resource(int id) :
mId(id) {
// empty
}
virtual ~Resource() {
// empty
}
virtual ResourceType getType() const {
return ResourceType::RT_Unknown;
}
};
class BaseMaterials : public Resource {
public:
BaseMaterials(int id) :
Resource(id),
mMaterials(),
mMaterialIndex() {}
std::vector<aiMaterial *> mMaterials;
std::vector<unsigned int> mMaterialIndex;
virtual ResourceType getType() {
BaseMaterials(int id) :
Resource(id),
mMaterials(),
mMaterialIndex() {
// empty
}
~BaseMaterials() = default;
ResourceType getType() const override {
return ResourceType::RT_BaseMaterials;
}
};
@@ -109,24 +116,26 @@ struct Component {
class Object : public Resource {
public:
std::vector<aiMesh*> mMeshes;
std::vector<aiMesh *> mMeshes;
std::vector<unsigned int> mMeshIndex;
std::vector<Component> mComponents;
std::string mName;
Object(int id) :
Resource(id),
mName(std::string("Object_") + ai_to_string(id)) {}
mName(std::string("Object_") + ai_to_string(id)) {
// empty
}
virtual ResourceType getType() {
~Object() = default;
ResourceType getType() const override {
return ResourceType::RT_Object;
}
};
class XmlSerializer {
public:
XmlSerializer(XmlParser *xmlParser) :
mResourcesDictionnary(),
mMaterialCount(0),
@@ -136,7 +145,7 @@ public:
}
~XmlSerializer() {
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) {
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it ) {
delete it->second;
}
}
@@ -146,28 +155,27 @@ public:
return;
}
scene->mRootNode = new aiNode("3MF");
scene->mRootNode = new aiNode(XmlTag::RootTag);
XmlNode node = mXmlParser->getRootNode().child("model");
XmlNode node = mXmlParser->getRootNode().child(XmlTag::model);
if (node.empty()) {
return;
}
XmlNode resNode = node.child("resources");
for (XmlNode currentNode = resNode.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
XmlNode resNode = node.child(XmlTag::resources);
for (auto &currentNode : resNode.children()) {
const std::string &currentNodeName = currentNode.name();
if (currentNodeName == D3MF::XmlTag::object) {
ReadObject(currentNode);;
} else if (currentNodeName == D3MF::XmlTag::basematerials) {
if (currentNodeName == XmlTag::object) {
ReadObject(currentNode);
} else if (currentNodeName == XmlTag::basematerials) {
ReadBaseMaterials(currentNode);
} else if (currentNodeName == D3MF::XmlTag::meta) {
} else if (currentNodeName == XmlTag::meta) {
ReadMetadata(currentNode);
}
}
XmlNode buildNode = node.child("build");
for (XmlNode currentNode = buildNode.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
for (auto &currentNode : resNode.children()) {
const std::string &currentNodeName = currentNode.name();
if (currentNodeName == D3MF::XmlTag::item) {
if (currentNodeName == XmlTag::item) {
int objectId = -1;
std::string transformationMatrixStr;
aiMatrix4x4 transformationMatrix;
@@ -186,7 +194,6 @@ public:
}
}
// import the metadata
if (!mMetaData.empty()) {
const size_t numMeta(mMetaData.size());
@@ -201,22 +208,21 @@ public:
scene->mNumMeshes = static_cast<unsigned int>(mMeshCount);
if (scene->mNumMeshes != 0) {
scene->mMeshes = new aiMesh *[scene->mNumMeshes]();
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) {
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it) {
if (it->second->getType() == ResourceType::RT_Object) {
Object *obj = static_cast<Object*>(it->second);
Object *obj = static_cast<Object *>(it->second);
for (unsigned int i = 0; i < obj->mMeshes.size(); ++i) {
scene->mMeshes[obj->mMeshIndex[i]] = obj->mMeshes[i];
}
}
}
}
// import the materials
scene->mNumMaterials = static_cast<unsigned int>(mMaterialCount);
scene->mNumMaterials = mMaterialCount;
if (scene->mNumMaterials != 0) {
scene->mMaterials = new aiMaterial *[scene->mNumMaterials];
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); it++) {
for (auto it = mResourcesDictionnary.begin(); it != mResourcesDictionnary.end(); ++it) {
if (it->second->getType() == ResourceType::RT_BaseMaterials) {
BaseMaterials *baseMaterials = static_cast<BaseMaterials *>(it->second);
for (unsigned int i = 0; i < baseMaterials->mMaterials.size(); ++i) {
@@ -228,35 +234,36 @@ public:
}
private:
void addObjectToNode(aiNode *parent, Object *obj, aiMatrix4x4 nodeTransform) {
ai_assert(nullptr != obj);
void addObjectToNode(aiNode* parent, Object* obj, aiMatrix4x4 nodeTransform) {
aiNode *sceneNode = new aiNode(obj->mName);
sceneNode->mNumMeshes = static_cast<unsigned int>(obj->mMeshes.size());
sceneNode->mMeshes = new unsigned int[sceneNode->mNumMeshes];
std::copy(obj->mMeshIndex.begin(), obj->mMeshIndex.end(), sceneNode->mMeshes);
sceneNode->mTransformation = nodeTransform;
parent->addChildren(1, &sceneNode);
if (nullptr != parent) {
parent->addChildren(1, &sceneNode);
}
for (size_t i = 0; i < obj->mComponents.size(); ++i) {
Component c = obj->mComponents[i];
auto it = mResourcesDictionnary.find(c.mObjectId);
if (it != mResourcesDictionnary.end() && it->second->getType() == ResourceType::RT_Object) {
addObjectToNode(sceneNode, static_cast<Object*>(it->second), c.mTransformation);
addObjectToNode(sceneNode, static_cast<Object *>(it->second), c.mTransformation);
}
}
}
bool getNodeAttribute(const XmlNode& node, const std::string& attribute, std::string& value) {
bool getNodeAttribute(const XmlNode &node, const std::string &attribute, std::string &value) {
pugi::xml_attribute objectAttribute = node.attribute(attribute.c_str());
if (!objectAttribute.empty()) {
value = objectAttribute.as_string();
return true;
} else {
return false;
}
return false;
}
bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &value) {
@@ -265,9 +272,9 @@ private:
if (ret) {
value = std::atoi(strValue.c_str());
return true;
} else {
return false;
}
}
return false;
}
aiMatrix4x4 parseTransformMatrix(std::string matrixStr) {
@@ -287,7 +294,7 @@ private:
}
}
if (currentNumber.size() > 0) {
float f = std::stof(currentNumber);
const float f = std::stof(currentNumber);
numbers.push_back(f);
}
@@ -311,29 +318,26 @@ private:
transformMatrix.b4 = numbers[10];
transformMatrix.c4 = numbers[11];
transformMatrix.d4 = 1;
return transformMatrix;
}
void ReadObject(XmlNode &node) {
int id = -1, pid = -1, pindex = -1;
bool hasId = getNodeAttribute(node, D3MF::XmlTag::id, id);
//bool hasType = getNodeAttribute(node, D3MF::XmlTag::type, type); not used currently
bool hasPid = getNodeAttribute(node, D3MF::XmlTag::pid, pid);
bool hasPindex = getNodeAttribute(node, D3MF::XmlTag::pindex, pindex);
std::string idStr = ai_to_string(id);
bool hasId = getNodeAttribute(node, XmlTag::id, id);
bool hasPid = getNodeAttribute(node, XmlTag::pid, pid);
bool hasPindex = getNodeAttribute(node, XmlTag::pindex, pindex);
if (!hasId) {
return;
}
Object *obj = new Object(id);
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
for (XmlNode &currentNode : node.children()) {
const std::string &currentName = currentNode.name();
if (currentName == D3MF::XmlTag::mesh) {
auto mesh = ReadMesh(currentNode);
mesh->mName.Set(idStr);
mesh->mName.Set(ai_to_string(id));
if (hasPid) {
auto it = mResourcesDictionnary.find(pid);
@@ -347,7 +351,7 @@ private:
obj->mMeshIndex.push_back(mMeshCount);
mMeshCount++;
} else if (currentName == D3MF::XmlTag::components) {
for (XmlNode currentSubNode = currentNode.first_child(); currentSubNode; currentSubNode = currentSubNode.next_sibling()) {
for (XmlNode &currentSubNode : currentNode.children()) {
if (currentSubNode.name() == D3MF::XmlTag::component) {
int objectId = -1;
std::string componentTransformStr;
@@ -369,21 +373,20 @@ private:
aiMesh *ReadMesh(XmlNode &node) {
aiMesh *mesh = new aiMesh();
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
for (XmlNode &currentNode : node.children()) {
const std::string &currentName = currentNode.name();
if (currentName == D3MF::XmlTag::vertices) {
if (currentName == XmlTag::vertices) {
ImportVertices(currentNode, mesh);
} else if (currentName == D3MF::XmlTag::triangles) {
} else if (currentName == XmlTag::triangles) {
ImportTriangles(currentNode, mesh);
}
}
return mesh;
}
void ReadMetadata(XmlNode &node) {
pugi::xml_attribute attribute = node.attribute(D3MF::XmlTag::meta_name.c_str());
pugi::xml_attribute attribute = node.attribute(D3MF::XmlTag::meta_name);
const std::string name = attribute.as_string();
const std::string value = node.value();
if (name.empty()) {
@@ -398,7 +401,7 @@ private:
void ImportVertices(XmlNode &node, aiMesh *mesh) {
std::vector<aiVector3D> vertices;
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
for (XmlNode &currentNode : node.children()) {
const std::string &currentName = currentNode.name();
if (currentName == D3MF::XmlTag::vertex) {
vertices.push_back(ReadVertex(currentNode));
@@ -412,9 +415,9 @@ private:
aiVector3D ReadVertex(XmlNode &node) {
aiVector3D vertex;
vertex.x = ai_strtof(node.attribute(D3MF::XmlTag::x.c_str()).as_string(), nullptr);
vertex.y = ai_strtof(node.attribute(D3MF::XmlTag::y.c_str()).as_string(), nullptr);
vertex.z = ai_strtof(node.attribute(D3MF::XmlTag::z.c_str()).as_string(), nullptr);
vertex.x = ai_strtof(node.attribute(D3MF::XmlTag::x).as_string(), nullptr);
vertex.y = ai_strtof(node.attribute(D3MF::XmlTag::y).as_string(), nullptr);
vertex.z = ai_strtof(node.attribute(D3MF::XmlTag::z).as_string(), nullptr);
return vertex;
}
@@ -433,8 +436,7 @@ private:
if (hasPid && hasP1) {
auto it = mResourcesDictionnary.find(pid);
if (it != mResourcesDictionnary.end())
{
if (it != mResourcesDictionnary.end()) {
if (it->second->getType() == ResourceType::RT_BaseMaterials) {
BaseMaterials *baseMaterials = static_cast<BaseMaterials *>(it->second);
mesh->mMaterialIndex = baseMaterials->mMaterialIndex[p1];
@@ -457,9 +459,9 @@ private:
face.mNumIndices = 3;
face.mIndices = new unsigned int[face.mNumIndices];
face.mIndices[0] = static_cast<unsigned int>(std::atoi(node.attribute(D3MF::XmlTag::v1.c_str()).as_string()));
face.mIndices[1] = static_cast<unsigned int>(std::atoi(node.attribute(D3MF::XmlTag::v2.c_str()).as_string()));
face.mIndices[2] = static_cast<unsigned int>(std::atoi(node.attribute(D3MF::XmlTag::v3.c_str()).as_string()));
face.mIndices[0] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v1).as_string()));
face.mIndices[1] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v2).as_string()));
face.mIndices[2] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v3).as_string()));
return face;
}
@@ -467,11 +469,10 @@ private:
void ReadBaseMaterials(XmlNode &node) {
int id = -1;
if (getNodeAttribute(node, D3MF::XmlTag::basematerials_id, id)) {
BaseMaterials* baseMaterials = new BaseMaterials(id);
BaseMaterials *baseMaterials = new BaseMaterials(id);
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling())
{
if (currentNode.name() == D3MF::XmlTag::basematerials_base) {
for (XmlNode &currentNode : node.children()) {
if (currentNode.name() == XmlTag::basematerials_base) {
baseMaterials->mMaterialIndex.push_back(mMaterialCount);
baseMaterials->mMaterials.push_back(readMaterialDef(currentNode, id));
mMaterialCount++;
@@ -488,7 +489,7 @@ private:
}
//format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
const size_t len(strlen(color));
const size_t len = strlen(color);
if (9 != len && 7 != len) {
return false;
}
@@ -517,7 +518,7 @@ private:
}
void assignDiffuseColor(XmlNode &node, aiMaterial *mat) {
const char *color = node.attribute(D3MF::XmlTag::basematerials_displaycolor.c_str()).as_string();
const char *color = node.attribute(XmlTag::basematerials_displaycolor).as_string();
aiColor4D diffuse;
if (parseColor(color, diffuse)) {
mat->AddProperty<aiColor4D>(&diffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
@@ -531,7 +532,7 @@ private:
bool hasName = getNodeAttribute(node, D3MF::XmlTag::basematerials_name, name);
std::string stdMaterialName;
std::string strId(ai_to_string(basematerialsId));
const std::string strId(ai_to_string(basematerialsId));
stdMaterialName += "id";
stdMaterialName += strId;
stdMaterialName += "_";
@@ -556,7 +557,7 @@ private:
std::string value;
};
std::vector<MetaEntry> mMetaData;
std::map<unsigned int, Resource*> mResourcesDictionnary;
std::map<unsigned int, Resource *> mResourcesDictionnary;
unsigned int mMaterialCount, mMeshCount;
XmlParser *mXmlParser;
};
+4 -4
View File
@@ -103,9 +103,9 @@ public:
std::string name = currentNode.name();
if (name == "Relationship") {
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
relPtr->id = currentNode.attribute(XmlTag::RELS_ATTRIB_ID.c_str()).as_string();
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE.c_str()).as_string();
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET.c_str()).as_string();
relPtr->id = currentNode.attribute(XmlTag::RELS_ATTRIB_ID).as_string();
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
if (validateRels(relPtr)) {
m_relationShips.push_back(relPtr);
}
@@ -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);
+2 -2
View File
@@ -123,9 +123,9 @@ public:
struct Object {
Object() :
type(World),
name(""),
name(),
children(),
texture(""),
texture(),
texRepeat(1.f, 1.f),
texOffset(0.0f, 0.0f),
rotation(),
-4
View File
@@ -517,10 +517,6 @@ bool AMFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool p
return false;
}
void AMFImporter::GetExtensionList(std::set<std::string> &pExtensionList) {
pExtensionList.insert("amf");
}
const aiImporterDesc *AMFImporter::GetInfo() const {
return &Description;
}
-1
View File
@@ -277,7 +277,6 @@ public:
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
void ParseHelper_Node_Exit();
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const;
void GetExtensionList(std::set<std::string> &pExtensionList);
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
const aiImporterDesc *GetInfo() const;
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
@@ -428,10 +428,10 @@ void AMFImporter::Postprocess_BuildMeshSet(const AMFMesh &pNodeElement, const st
if (pBiggerThan != nullptr) {
bool found = false;
const size_t biggerThan = *pBiggerThan;
for (const SComplexFace &face : pFaceList) {
for (size_t idx_vert = 0; idx_vert < face.Face.mNumIndices; idx_vert++) {
if (face.Face.mIndices[idx_vert] > *pBiggerThan) {
if (face.Face.mIndices[idx_vert] > biggerThan) {
rv = face.Face.mIndices[idx_vert];
found = true;
break;
+1 -1
View File
@@ -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;
-6
View File
@@ -132,12 +132,6 @@ bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bo
return false;
}
// ------------------------------------------------------------------------------------------------
// List all extensions handled by this loader
void BlenderImporter::GetExtensionList(std::set<std::string> &app) {
app.insert("blend");
}
// ------------------------------------------------------------------------------------------------
// Loader registry entry
const aiImporterDesc *BlenderImporter::GetInfo() const {
-1
View File
@@ -110,7 +110,6 @@ public:
protected:
const aiImporterDesc* GetInfo () const;
void GetExtensionList(std::set<std::string>& app);
void SetupProperties(const Importer* pImp);
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
void ParseBlendFile(Blender::FileDatabase& out, std::shared_ptr<IOStream> stream);
+2 -2
View File
@@ -75,7 +75,7 @@ static const aiImporterDesc desc = {
3,
1,
5,
"dae zae"
"dae xml zae"
};
static const float kMillisecondsFromSeconds = 1000.f;
@@ -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);
+3 -3
View File
@@ -1789,13 +1789,13 @@ void FBXExporter::WriteObjects ()
blendchannel_uid, blendshape_name + FBX::SEPARATOR + "SubDeformer", "BlendShapeChannel"
);
sdnode.AddChild("Version", int32_t(100));
sdnode.AddChild("DeformPercent", int32_t(100));
sdnode.AddChild("DeformPercent", float_t(0.0));
FBX::Node p("Properties70");
p.AddP70numberA("DeformPercent", 100.);
p.AddP70numberA("DeformPercent", 0.0);
sdnode.AddChild(p);
// TODO: Normally just one weight per channel, adding stub for later development
std::vector<float>fFullWeights;
fFullWeights.push_back(0.);
fFullWeights.push_back(100.);
sdnode.AddChild("FullWeights", fFullWeights);
sdnode.Dump(outstream, binary, indent);
+1 -1
View File
@@ -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));
}
+4 -4
View File
@@ -462,7 +462,7 @@ 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())
@@ -470,7 +470,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
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
@@ -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);
+1 -1
View File
@@ -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]);
+2 -2
View File
@@ -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;
@@ -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();
}
}
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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
,
+1 -1
View File
@@ -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),
+2 -3
View File
@@ -95,10 +95,9 @@ static const aiImporterDesc desc = {
0,
0,
0,
#ifdef M3D_ASCII
"m3d a3d"
#else
"m3d"
#ifdef M3D_ASCII
" a3d"
#endif
};
+1 -1
View File
@@ -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 },
+1 -1
View File
@@ -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 },
@@ -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;
+1 -1
View File
@@ -75,7 +75,7 @@ using namespace std;
// Default constructor
MMDImporter::MMDImporter() :
m_Buffer(),
m_strAbsPath("") {
m_strAbsPath() {
DefaultIOSystem io;
m_strAbsPath = io.getOsSeparator();
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -79,7 +79,7 @@ struct MetricInfo {
int m_intValue;
MetricInfo()
: m_stringValue( "" )
: m_stringValue( )
, m_floatValue( 0.0f )
, m_intValue( -1 ) {
// empty
+1 -1
View File
@@ -178,7 +178,7 @@ struct Q3BSPModel {
m_Textures(),
m_Lightmaps(),
m_EntityData(),
m_ModelName( "" )
m_ModelName()
{
// empty
}
+9 -9
View File
@@ -75,7 +75,7 @@ static const aiImporterDesc desc = {
0,
0,
0,
"pk3"
"bsp pk3"
};
namespace Assimp {
@@ -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;
}
@@ -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()) {
@@ -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;
}
@@ -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()) {
@@ -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);
@@ -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];
@@ -660,7 +660,7 @@ bool Q3BSPFileImporter::expandFile(ZipArchiveIOSystem *pArchive, const std::stri
if (rExtList.empty()) {
rFile = rFilename;
rExt = "";
rExt = std::string();
return true;
}
+1 -1
View File
@@ -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()
-4
View File
@@ -167,10 +167,6 @@ bool X3DImporter::CanRead( const std::string &pFile, IOSystem * /*pIOHandler*/,
return false;
}
void X3DImporter::GetExtensionList( std::set<std::string> &extensionList ) {
extensionList.insert("x3d");
}
void X3DImporter::InternReadFile( const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler ) {
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
if (!stream) {
-1
View File
@@ -307,7 +307,6 @@ public:
/// \param [in] pIOHandler - pointer to IO helper object.
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const;
void GetExtensionList(std::set<std::string> &pExtensionList);
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
const aiImporterDesc *GetInfo() const;
void Clear();
+1 -1
View File
@@ -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
+1 -1
View File
@@ -1033,7 +1033,7 @@ namespace glTF
AssetMetadata()
: premultipliedAlpha(false)
, version("")
, version()
{
}
};
+1 -1
View File
@@ -1071,7 +1071,7 @@ struct AssetMetadata {
void Read(Document &doc);
AssetMetadata() :
version("") {}
version() {}
};
//
+2 -2
View File
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
CIOStreamWrapper::~CIOStreamWrapper(void) {
CIOStreamWrapper::~CIOStreamWrapper() {
/* Various places depend on this destructor to close the file */
if (mFile) {
mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile);
@@ -78,7 +78,7 @@ aiReturn CIOStreamWrapper::Seek(size_t pOffset,
}
// ...................................................................
size_t CIOStreamWrapper::Tell(void) const {
size_t CIOStreamWrapper::Tell() const {
return mFile->TellProc(mFile);
}
+2 -2
View File
@@ -97,7 +97,7 @@ void BaseImporter::UpdateImporterScale(Importer *pImp) {
// Set active scaling
pImp->SetPropertyFloat(AI_CONFIG_APP_SCALE_KEY, static_cast<float>(activeScale));
ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: %f", activeScale);
ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: ", activeScale);
}
// ------------------------------------------------------------------------------------------------
@@ -271,7 +271,7 @@ std::string BaseImporter::GetExtension(const std::string &file) {
// no file extension at all
if (pos == std::string::npos) {
return "";
return std::string();
}
// thanks to Andy Maloney for the hint
+1 -1
View File
@@ -76,7 +76,7 @@ public:
if (std::string::npos != (ss2 = mBase.find_last_of("\\/"))) {
mBase.erase(ss2,mBase.length()-ss2);
} else {
mBase = "";
mBase = std::string();
}
// make sure the directory is terminated properly
+3 -3
View File
@@ -149,7 +149,7 @@ void AllocateFromAssimpHeap::operator delete[] ( void* data) {
Importer::Importer()
: pimpl( new ImporterPimpl ) {
pimpl->mScene = nullptr;
pimpl->mErrorString = "";
pimpl->mErrorString = std::string();
// Allocate a default IO handler
pimpl->mIOHandler = new DefaultIOSystem;
@@ -387,7 +387,7 @@ void Importer::FreeScene( ) {
delete pimpl->mScene;
pimpl->mScene = nullptr;
pimpl->mErrorString = "";
pimpl->mErrorString = std::string();
pimpl->mException = std::exception_ptr();
ASSIMP_END_EXCEPTION_REGION(void);
}
@@ -434,7 +434,7 @@ aiScene* Importer::GetOrphanedScene() {
ASSIMP_BEGIN_EXCEPTION_REGION();
pimpl->mScene = nullptr;
pimpl->mErrorString = ""; // reset error string
pimpl->mErrorString = std::string();
pimpl->mException = std::exception_ptr();
ASSIMP_END_EXCEPTION_REGION(aiScene*);
+15 -2
View File
@@ -48,6 +48,7 @@ corresponding preprocessor flag to selectively disable formats.
#include <assimp/BaseImporter.h>
#include <vector>
#include <cstdlib>
// ------------------------------------------------------------------------------------------------
// Importers
@@ -204,7 +205,17 @@ corresponding preprocessor flag to selectively disable formats.
namespace Assimp {
// ------------------------------------------------------------------------------------------------
void GetImporterInstanceList(std::vector<BaseImporter *> &out) {
void GetImporterInstanceList(std::vector<BaseImporter *> &out) {
// Some importers may be unimplemented or otherwise unsuitable for general use
// in their current state. Devs can set ASSIMP_ENABLE_DEV_IMPORTERS in their
// local environment to enable them, otherwise they're left out of the registry.
const char *envStr = std::getenv("ASSIMP_ENABLE_DEV_IMPORTERS");
bool devImportersEnabled = envStr && strcmp(envStr, "0");
// Ensure no unused var warnings if all uses are #ifndef'd away below:
(void)devImportersEnabled;
// ----------------------------------------------------------------------------
// Add an instance of each worker class here
// (register_new_importers_here)
@@ -354,7 +365,9 @@ void GetImporterInstanceList(std::vector<BaseImporter *> &out) {
out.push_back(new D3MFImporter());
#endif
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
out.push_back(new X3DImporter());
if (devImportersEnabled) { // https://github.com/assimp/assimp/issues/3647
out.push_back(new X3DImporter());
}
#endif
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
out.push_back(new MMDImporter());
+4 -2
View File
@@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// possible as new fields are added to assimp structures.
// ----------------------------------------------------------------------------
/**
/**
* @file Implements Assimp::SceneCombiner. This is a smart utility
* class that combines multiple scenes, meshes, ... into one. Currently
* these utilities are used by the IRR and LWS loaders and the
@@ -359,7 +359,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
// generate the output texture list + an offset table for all texture indices
if (dest->mNumTextures) {
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumMaterials];
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumTextures];
cnt = 0;
for (unsigned int n = 0; n < src.size(); ++n) {
SceneHelper *cur = &src[n];
@@ -638,6 +638,8 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
deleteMe->mMaterials = nullptr;
delete[] deleteMe->mAnimations;
deleteMe->mAnimations = nullptr;
delete[] deleteMe->mTextures;
deleteMe->mTextures = nullptr;
deleteMe->mRootNode = nullptr;
+1 -1
View File
@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
aiNode::aiNode()
: mName("")
: mName()
, mParent(nullptr)
, mNumChildren(0)
, mChildren(nullptr)
@@ -81,7 +81,7 @@ public:
/** @brief Set list of fixed (inmutable) materials
* @param fixed See #AI_CONFIG_PP_RRM_EXCLUDE_LIST
*/
void SetFixedMaterialsString(const std::string& fixed = "") {
void SetFixedMaterialsString(const std::string& fixed = std::string()) {
mConfigFixedMaterials = fixed;
}