diff --git a/.coveralls.yml b/.coveralls.yml
deleted file mode 100644
index f69c0ba34..000000000
--- a/.coveralls.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-service_name: travis-pro
-repo_token: GZXuNlublKFy7HAewHAZLk5ZwgipTFAOA
diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
index 47914a3f2..f9d0d6c05 100644
--- a/.github/workflows/ccpp.yml
+++ b/.github/workflows/ccpp.yml
@@ -99,7 +99,7 @@ jobs:
- name: Set Windows specific CMake arguments
if: contains(matrix.name, 'windows')
id: windows_extra_cmake_args
- run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1"
+ run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1"
- name: Set Hunter specific CMake arguments
if: contains(matrix.name, 'hunter')
diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml
index 57d6e78f1..b23f4520f 100644
--- a/.github/workflows/sanitizer.yml
+++ b/.github/workflows/sanitizer.yml
@@ -57,3 +57,13 @@ jobs:
- name: test
run: cd build/bin && ./unit
shell: bash
+
+ job3:
+ name: printf-sanitizer
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: run scan_printf script
+ run: ./scripts/scan_printf.sh
+ shell: bash
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3288a18f0..0f0e5a793 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
-# Copyright (c) 2006-2022, assimp team
+# Copyright (c) 2006-2023, assimp team
#
# All rights reserved.
#
@@ -84,10 +84,6 @@ OPTION( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality."
OFF
)
-OPTION( ASSIMP_BUILD_ZLIB
- "Build your own zlib"
- OFF
-)
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library."
OFF
@@ -134,6 +130,18 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
OFF
)
+IF (WIN32)
+ OPTION( ASSIMP_BUILD_ZLIB
+ "Build your own zlib"
+ ON
+ )
+ELSE()
+ OPTION( ASSIMP_BUILD_ZLIB
+ "Build your own zlib"
+ OFF
+ )
+ENDIF()
+
IF (WIN32)
# Use subset of Windows.h
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
@@ -262,13 +270,13 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW)
ENDIF()
# hide all not-exported symbols
IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" )
- SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
- SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
- SET(LIBSTDC++_LIBRARIES -lstdc++)
+ SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
+ SET(LIBSTDC++_LIBRARIES -lstdc++)
ELSE()
- SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
- SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
- SET(LIBSTDC++_LIBRARIES -lstdc++)
+ SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
+ SET(LIBSTDC++_LIBRARIES -lstdc++)
ENDIF()
ELSEIF(MSVC)
# enable multi-core compilation with MSVC
@@ -277,13 +285,15 @@ ELSEIF(MSVC)
ELSE() # msvc
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
ENDIF()
+
# disable "elements of array '' will be default initialized" warning on MSVC2013
IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
- ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated
+ # supress warning for double to float conversion if Double precission is activated
+ ADD_COMPILE_OPTIONS(/wd4244)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED)
@@ -388,14 +398,6 @@ IF (NOT TARGET uninstall AND ASSIMP_INSTALL)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
-# cmake configuration files
-if(${BUILD_SHARED_LIBS})
- set(BUILD_LIB_TYPE SHARED)
-else()
- set(BUILD_LIB_TYPE STATIC)
- add_definitions(-DDDL_STATIC_LIBRARY=OFF)
-endif()
-
IF( UNIX )
# Use GNUInstallDirs for Unix predefined directories
INCLUDE(GNUInstallDirs)
@@ -488,7 +490,11 @@ ELSE()
FIND_PACKAGE(ZLIB)
ENDIF()
- IF( NOT ZLIB_FOUND )
+ IF ( NOT ZLIB_FOUND AND NOT ASSIMP_BUILD_ZLIB )
+ message( FATAL_ERROR
+ "Build configured with -DASSIMP_BUILD_ZLIB=OFF but unable to find zlib"
+ )
+ ELSEIF( NOT ZLIB_FOUND )
MESSAGE(STATUS "compiling zlib from sources")
INCLUDE(CheckIncludeFile)
INCLUDE(CheckTypeSize)
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..18c914718
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,128 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity
+and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series
+of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or
+permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within
+the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0, available at
+https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct
+enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at
+https://www.contributor-covenant.org/translations.
diff --git a/Readme.md b/Readme.md
index 0a04da999..1af71fad8 100644
--- a/Readme.md
+++ b/Readme.md
@@ -14,7 +14,6 @@ A library to import and export various 3d-model-formats including scene-post-pro
[![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")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open")
-[![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/)
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
@@ -76,10 +75,13 @@ The source code is organized in the following way:
code/AssetLib/ Implementation for import and export for the format
### Where to get help ###
-For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
-(CHMs for Windows are included in some release packages and should be located right here in the root folder).
+To find our documentation, visit [our website](https://assimp.org/) or check out [Wiki](https://github.com/assimp/assimp/wiki)
-If the docs don't solve your problem, ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
+If the docs don't solve your problem, you can:
+- Ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest).
+- Ask on [Assimp-Community on Reddit](https://www.reddit.com/r/Assimp/)
+- Ask a question at [The Assimp-Discussion Board](https://github.com/assimp/assimp/discussions)
+- Nothing has worked? File a question or an issue-report at [The Assimp-Issue Tracker](https://github.com/assimp/assimp/issues)
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h
index dc1098035..06c36bfeb 100644
--- a/code/AssetLib/3DS/3DSHelper.h
+++ b/code/AssetLib/3DS/3DSHelper.h
@@ -322,7 +322,6 @@ struct Texture {
//! Default constructor
Texture() AI_NO_EXCEPT
: mTextureBlend(0.0f),
- mMapName(),
mOffsetU(0.0),
mOffsetV(0.0),
mScaleU(1.0),
@@ -334,51 +333,11 @@ struct Texture {
mTextureBlend = get_qnan();
}
- Texture(const Texture &other) :
- mTextureBlend(other.mTextureBlend),
- mMapName(other.mMapName),
- mOffsetU(other.mOffsetU),
- mOffsetV(other.mOffsetV),
- mScaleU(other.mScaleU),
- mScaleV(other.mScaleV),
- mRotation(other.mRotation),
- mMapMode(other.mMapMode),
- bPrivate(other.bPrivate),
- iUVSrc(other.iUVSrc) {
- // empty
- }
+ Texture(const Texture &other) = default;
- Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend),
- mMapName(std::move(other.mMapName)),
- mOffsetU(other.mOffsetU),
- mOffsetV(other.mOffsetV),
- mScaleU(other.mScaleU),
- mScaleV(other.mScaleV),
- mRotation(other.mRotation),
- mMapMode(other.mMapMode),
- bPrivate(other.bPrivate),
- iUVSrc(other.iUVSrc) {
- // empty
- }
+ Texture(Texture &&other) AI_NO_EXCEPT = default;
- Texture &operator=(Texture &&other) AI_NO_EXCEPT {
- if (this == &other) {
- return *this;
- }
-
- mTextureBlend = other.mTextureBlend;
- mMapName = std::move(other.mMapName);
- mOffsetU = other.mOffsetU;
- mOffsetV = other.mOffsetV;
- mScaleU = other.mScaleU;
- mScaleV = other.mScaleV;
- mRotation = other.mRotation;
- mMapMode = other.mMapMode;
- bPrivate = other.bPrivate;
- iUVSrc = other.iUVSrc;
-
- return *this;
- }
+ Texture &operator=(Texture &&other) AI_NO_EXCEPT = default;
//! Specifies the blend factor for the texture
ai_real mTextureBlend;
@@ -436,83 +395,13 @@ struct Material {
// empty
}
- Material(const Material &other) :
- mName(other.mName),
- mDiffuse(other.mDiffuse),
- mSpecularExponent(other.mSpecularExponent),
- mShininessStrength(other.mShininessStrength),
- mSpecular(other.mSpecular),
- mAmbient(other.mAmbient),
- mShading(other.mShading),
- mTransparency(other.mTransparency),
- sTexDiffuse(other.sTexDiffuse),
- sTexOpacity(other.sTexOpacity),
- sTexSpecular(other.sTexSpecular),
- sTexReflective(other.sTexReflective),
- sTexBump(other.sTexBump),
- sTexEmissive(other.sTexEmissive),
- sTexShininess(other.sTexShininess),
- mBumpHeight(other.mBumpHeight),
- mEmissive(other.mEmissive),
- sTexAmbient(other.sTexAmbient),
- mTwoSided(other.mTwoSided) {
- // empty
- }
+ Material(const Material &other) = default;
- //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
- Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)),
- mDiffuse(other.mDiffuse),
- mSpecularExponent(other.mSpecularExponent),
- mShininessStrength(other.mShininessStrength),
- mSpecular(other.mSpecular),
- mAmbient(other.mAmbient),
- mShading(other.mShading),
- mTransparency(other.mTransparency),
- sTexDiffuse(std::move(other.sTexDiffuse)),
- sTexOpacity(std::move(other.sTexOpacity)),
- sTexSpecular(std::move(other.sTexSpecular)),
- sTexReflective(std::move(other.sTexReflective)),
- sTexBump(std::move(other.sTexBump)),
- sTexEmissive(std::move(other.sTexEmissive)),
- sTexShininess(std::move(other.sTexShininess)),
- mBumpHeight(other.mBumpHeight),
- mEmissive(other.mEmissive),
- sTexAmbient(std::move(other.sTexAmbient)),
- mTwoSided(other.mTwoSided) {
- // empty
- }
+ Material(Material &&other) AI_NO_EXCEPT = default;
- Material &operator=(Material &&other) AI_NO_EXCEPT {
- if (this == &other) {
- return *this;
- }
+ Material &operator=(Material &&other) AI_NO_EXCEPT = default;
- mName = std::move(other.mName);
- mDiffuse = other.mDiffuse;
- mSpecularExponent = other.mSpecularExponent;
- mShininessStrength = other.mShininessStrength,
- mSpecular = other.mSpecular;
- mAmbient = other.mAmbient;
- mShading = other.mShading;
- mTransparency = other.mTransparency;
- sTexDiffuse = std::move(other.sTexDiffuse);
- sTexOpacity = std::move(other.sTexOpacity);
- sTexSpecular = std::move(other.sTexSpecular);
- sTexReflective = std::move(other.sTexReflective);
- sTexBump = std::move(other.sTexBump);
- sTexEmissive = std::move(other.sTexEmissive);
- sTexShininess = std::move(other.sTexShininess);
- mBumpHeight = other.mBumpHeight;
- mEmissive = other.mEmissive;
- sTexAmbient = std::move(other.sTexAmbient);
- mTwoSided = other.mTwoSided;
-
- return *this;
- }
-
- virtual ~Material() {
- // empty
- }
+ virtual ~Material() = default;
//! Name of the material
std::string mName;
diff --git a/code/AssetLib/3MF/3MFTypes.h b/code/AssetLib/3MF/3MFTypes.h
index 987cdf613..02238ceab 100644
--- a/code/AssetLib/3MF/3MFTypes.h
+++ b/code/AssetLib/3MF/3MFTypes.h
@@ -69,9 +69,7 @@ public:
// empty
}
- virtual ~Resource() {
- // empty
- }
+ virtual ~Resource() = default;
virtual ResourceType getType() const {
return ResourceType::RT_Unknown;
diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp
index 42cd991e6..4ba3bbf24 100644
--- a/code/AssetLib/3MF/D3MFExporter.cpp
+++ b/code/AssetLib/3MF/D3MFExporter.cpp
@@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen
namespace D3MF {
D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) :
- mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() {
+ mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) {
// empty
}
diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp
index a2182dc29..934305d49 100644
--- a/code/AssetLib/3MF/D3MFOpcPackage.cpp
+++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp
@@ -160,7 +160,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) :
// deal with zip-bug
rootFile = rootFile.substr(1);
}
- }
+ }
ASSIMP_LOG_VERBOSE_DEBUG(rootFile);
diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp
index 674c6b916..c77111728 100644
--- a/code/AssetLib/3MF/XmlSerializer.cpp
+++ b/code/AssetLib/3MF/XmlSerializer.cpp
@@ -216,7 +216,7 @@ void XmlSerializer::ImportXml(aiScene *scene) {
if (nullptr == scene) {
return;
}
-
+
scene->mRootNode = new aiNode(XmlTag::RootTag);
XmlNode node = mXmlParser->getRootNode().child(XmlTag::model);
if (node.empty()) {
@@ -444,7 +444,7 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
}
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
}
- }
+ }
}
}
diff --git a/code/AssetLib/AC/ACLoader.cpp b/code/AssetLib/AC/ACLoader.cpp
index 26bc2e9d5..e93fba5f0 100644
--- a/code/AssetLib/AC/ACLoader.cpp
+++ b/code/AssetLib/AC/ACLoader.cpp
@@ -227,7 +227,9 @@ void AC3DImporter::LoadObjectSection(std::vector &objects) {
}
} else if (TokenMatch(buffer, "texture", 7)) {
SkipSpaces(&buffer);
- buffer = AcGetString(buffer, obj.texture);
+ std::string texture;
+ buffer = AcGetString(buffer, texture);
+ obj.textures.push_back(texture);
} else if (TokenMatch(buffer, "texrep", 6)) {
SkipSpaces(&buffer);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texRepeat);
@@ -295,7 +297,7 @@ void AC3DImporter::LoadObjectSection(std::vector &objects) {
Surface &surf = obj.surfaces.back();
surf.flags = strtoul_cppstyle(buffer);
- while (1) {
+ while (true) {
if (!GetNextLine()) {
throw DeadlyImportError("AC3D: Unexpected EOF: surface is incomplete");
}
@@ -351,8 +353,8 @@ void AC3DImporter::ConvertMaterial(const Object &object,
s.Set(matSrc.name);
matDest.AddProperty(&s, AI_MATKEY_NAME);
}
- if (object.texture.length()) {
- s.Set(object.texture);
+ if (!object.textures.empty()) {
+ s.Set(object.textures[0]);
matDest.AddProperty(&s, AI_MATKEY_TEXTURE_DIFFUSE(0));
// UV transformation
@@ -532,7 +534,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
// allocate UV coordinates, but only if the texture name for the
// surface is not empty
aiVector3D *uv = nullptr;
- if (object.texture.length()) {
+ if (!object.textures.empty()) {
uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
mesh->mNumUVComponents[0] = 2;
}
@@ -750,7 +752,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
std::unique_ptr file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open AC3D file ", pFile, ".");
}
diff --git a/code/AssetLib/AC/ACLoader.h b/code/AssetLib/AC/ACLoader.h
index aabc114e3..7f8dfd03c 100644
--- a/code/AssetLib/AC/ACLoader.h
+++ b/code/AssetLib/AC/ACLoader.h
@@ -125,7 +125,6 @@ public:
type(World),
name(),
children(),
- texture(),
texRepeat(1.f, 1.f),
texOffset(0.0f, 0.0f),
rotation(),
@@ -151,7 +150,8 @@ public:
std::vector children;
// texture to be assigned to all surfaces of the object
- std::string texture;
+ // the .acc format supports up to 4 textures
+ std::vector textures;
// texture repat factors (scaling for all coordinates)
aiVector2D texRepeat, texOffset;
diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp
index 4103dcdf4..ff581b492 100644
--- a/code/AssetLib/AMF/AMFImporter.cpp
+++ b/code/AssetLib/AMF/AMFImporter.cpp
@@ -83,11 +83,7 @@ void AMFImporter::Clear() {
AMFImporter::AMFImporter() AI_NO_EXCEPT :
mNodeElement_Cur(nullptr),
- mXmlParser(nullptr),
- mUnit(),
- mVersion(),
- mMaterial_Converted(),
- mTexture_Converted() {
+ mXmlParser(nullptr) {
// empty
}
@@ -261,7 +257,7 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
std::unique_ptr file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open AMF file ", pFile, ".");
}
diff --git a/code/AssetLib/AMF/AMFImporter_Node.hpp b/code/AssetLib/AMF/AMFImporter_Node.hpp
index c827533a6..dd27316d3 100644
--- a/code/AssetLib/AMF/AMFImporter_Node.hpp
+++ b/code/AssetLib/AMF/AMFImporter_Node.hpp
@@ -88,9 +88,7 @@ public:
std::list Child; ///< Child elements.
public: /// Destructor, virtual..
- virtual ~AMFNodeElementBase() {
- // empty
- }
+ virtual ~AMFNodeElementBase() = default;
/// Disabled copy constructor and co.
AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete;
@@ -103,7 +101,7 @@ protected:
/// \param [in] pType - element type.
/// \param [in] pParent - parent element.
AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) :
- Type(pType), ID(), Parent(pParent), Child() {
+ Type(pType), Parent(pParent) {
// empty
}
}; // class IAMFImporter_NodeElement
@@ -174,7 +172,7 @@ struct AMFColor : public AMFNodeElementBase {
/// @brief Constructor.
/// @param [in] pParent - pointer to parent node.
AMFColor(AMFNodeElementBase *pParent) :
- AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() {
+ AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() {
// empty
}
};
@@ -270,7 +268,7 @@ struct AMFTexMap : public AMFNodeElementBase {
/// Constructor.
/// \param [in] pParent - pointer to parent node.
AMFTexMap(AMFNodeElementBase *pParent) :
- AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() {
+ AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} {
// empty
}
};
diff --git a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp
index a65f9260e..d5160870a 100644
--- a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp
+++ b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp
@@ -815,6 +815,7 @@ nl_clean_loop:
for (; next_it != nodeArray.end(); ++next_it) {
if ((*next_it)->FindNode((*nl_it)->mName) != nullptr) {
// if current top node(nl_it) found in another top node then erase it from node_list and restart search loop.
+ // FIXME: this leaks memory on test models test8.amf and test9.amf
nodeArray.erase(nl_it);
goto nl_clean_loop;
diff --git a/code/AssetLib/ASE/ASELoader.cpp b/code/AssetLib/ASE/ASELoader.cpp
index f78ff99fb..951e8539d 100644
--- a/code/AssetLib/ASE/ASELoader.cpp
+++ b/code/AssetLib/ASE/ASELoader.cpp
@@ -87,10 +87,6 @@ ASEImporter::ASEImporter() :
// empty
}
-// ------------------------------------------------------------------------------------------------
-// Destructor, private as well
-ASEImporter::~ASEImporter() = default;
-
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool ASEImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
@@ -122,7 +118,7 @@ void ASEImporter::InternReadFile(const std::string &pFile,
std::unique_ptr file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open ASE file ", pFile, ".");
}
diff --git a/code/AssetLib/ASE/ASELoader.h b/code/AssetLib/ASE/ASELoader.h
index cd9123556..2509671ef 100644
--- a/code/AssetLib/ASE/ASELoader.h
+++ b/code/AssetLib/ASE/ASELoader.h
@@ -62,7 +62,7 @@ namespace Assimp {
class ASEImporter : public BaseImporter {
public:
ASEImporter();
- ~ASEImporter() override;
+ ~ASEImporter() override = default;
// -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file.
diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp
index 96346bdcb..839d308de 100644
--- a/code/AssetLib/ASE/ASEParser.cpp
+++ b/code/AssetLib/ASE/ASEParser.cpp
@@ -1774,7 +1774,13 @@ void Parser::ParseLV4MeshFace(ASE::Face &out) {
// FIX: There needn't always be a value, sad but true
while (true) {
if (*filePtr < '9' && *filePtr >= '0') {
- out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr));
+ uint32_t value = strtoul10(filePtr, &filePtr);
+ if (value < 32) {
+ out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr));
+ } else {
+ const std::string message = std::string("Unable to set smooth group, value with ") + ai_to_string(value) + std::string(" out of range");
+ LogWarning(message.c_str());
+ }
}
SkipSpaces(&filePtr);
if (',' != *filePtr) {
diff --git a/code/AssetLib/ASE/ASEParser.h b/code/AssetLib/ASE/ASEParser.h
index 8cda32f24..c41cd59d3 100644
--- a/code/AssetLib/ASE/ASEParser.h
+++ b/code/AssetLib/ASE/ASEParser.h
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
-
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -385,12 +384,10 @@ struct Dummy : public BaseNode {
/** \brief Class to parse ASE files
*/
class Parser {
-private:
- Parser() AI_NO_EXCEPT {
- // empty
- }
-
public:
+ /// @brief No default constructor.
+ Parser() = delete;
+
// -------------------------------------------------------------------
//! Construct a parser from a given input file which is
//! guaranteed to be terminated with zero.
diff --git a/code/AssetLib/Assbin/AssbinExporter.h b/code/AssetLib/Assbin/AssbinExporter.h
index 1801c1680..8b721994d 100644
--- a/code/AssetLib/Assbin/AssbinExporter.h
+++ b/code/AssetLib/Assbin/AssbinExporter.h
@@ -56,5 +56,5 @@ namespace Assimp {
void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/);
}
-#endif
+#endif
#endif // AI_ASSBINEXPORTER_H_INC
diff --git a/code/AssetLib/Assbin/AssbinFileWriter.cpp b/code/AssetLib/Assbin/AssbinFileWriter.cpp
index 97be634de..e9d857a84 100644
--- a/code/AssetLib/Assbin/AssbinFileWriter.cpp
+++ b/code/AssetLib/Assbin/AssbinFileWriter.cpp
@@ -291,15 +291,15 @@ public:
size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override {
return 0;
}
-
+
aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override {
return aiReturn_FAILURE;
}
-
+
size_t Tell() const override {
return cursor;
}
-
+
void Flush() override {
// not implemented
}
diff --git a/code/AssetLib/Assjson/json_exporter.cpp b/code/AssetLib/Assjson/json_exporter.cpp
index 7a8403831..ea5194fb0 100644
--- a/code/AssetLib/Assjson/json_exporter.cpp
+++ b/code/AssetLib/Assjson/json_exporter.cpp
@@ -43,7 +43,7 @@ public:
Flag_WriteSpecialFloats = 0x2,
Flag_SkipWhitespaces = 0x4
};
-
+
JSONWriter(Assimp::IOStream &out, unsigned int flags = 0u) :
out(out), indent (""), newline("\n"), space(" "), buff (), first(false), flags(flags) {
// make sure that all formatting happens using the standard, C locale and not the user's current locale
@@ -499,18 +499,18 @@ static void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
}
break;
- case aiPTI_String:
+ case aiPTI_String:
{
aiString s;
aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s);
out.SimpleValue(s);
- }
+ }
break;
- case aiPTI_Buffer:
+ case aiPTI_Buffer:
{
// binary data is written as series of hex-encoded octets
out.SimpleValue(prop->mData, prop->mDataLength);
- }
+ }
break;
default:
ai_assert(false);
diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.cpp b/code/AssetLib/Assxml/AssxmlFileWriter.cpp
index a443e3fe9..8f8e76bd2 100644
--- a/code/AssetLib/Assxml/AssxmlFileWriter.cpp
+++ b/code/AssetLib/Assxml/AssxmlFileWriter.cpp
@@ -652,7 +652,7 @@ void DumpSceneToAssxml(
const char *pFile, const char *cmd, IOSystem *pIOSystem,
const aiScene *pScene, bool shortened) {
std::unique_ptr file(pIOSystem->Open(pFile, "wt"));
- if (!file.get()) {
+ if (!file) {
throw std::runtime_error("Unable to open output file " + std::string(pFile) + '\n');
}
diff --git a/code/AssetLib/B3D/B3DImporter.cpp b/code/AssetLib/B3D/B3DImporter.cpp
index 68aa7d4d4..e87744603 100644
--- a/code/AssetLib/B3D/B3DImporter.cpp
+++ b/code/AssetLib/B3D/B3DImporter.cpp
@@ -116,7 +116,7 @@ void B3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::unique_ptr file(pIOHandler->Open(pFile));
// Check whether we can read from the file
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open B3D file ", pFile, ".");
}
@@ -150,7 +150,7 @@ AI_WONT_RETURN void B3DImporter::Fail(const string &str) {
// ------------------------------------------------------------------------------------------------
int B3DImporter::ReadByte() {
- if (_pos > _buf.size()) {
+ if (_pos >= _buf.size()) {
Fail("EOF");
}
@@ -253,7 +253,7 @@ size_t B3DImporter::ChunkSize() {
template
T *B3DImporter::to_array(const vector &v) {
if (v.empty()) {
- return 0;
+ return nullptr;
}
T *p = new T[v.size()];
for (size_t i = 0; i < v.size(); ++i) {
@@ -266,7 +266,7 @@ T *B3DImporter::to_array(const vector &v) {
template
T **unique_to_array(vector> &v) {
if (v.empty()) {
- return 0;
+ return nullptr;
}
T **p = new T *[v.size()];
for (size_t i = 0; i < v.size(); ++i) {
@@ -617,7 +617,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
} else if (chunk == "BRUS") {
ReadBRUS();
} else if (chunk == "NODE") {
- ReadNODE(0);
+ ReadNODE(nullptr);
}
ExitChunk();
}
@@ -642,7 +642,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
int n_tris = mesh->mNumFaces;
int n_verts = mesh->mNumVertices = n_tris * 3;
- aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = 0, *mc = 0;
+ aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = nullptr, *mc = nullptr;
if (_vflags & 1) {
mn = mesh->mNormals = new aiVector3D[n_verts];
}
diff --git a/code/AssetLib/BVH/BVHLoader.cpp b/code/AssetLib/BVH/BVHLoader.cpp
index 0ce60ea1c..d92887c9e 100644
--- a/code/AssetLib/BVH/BVHLoader.cpp
+++ b/code/AssetLib/BVH/BVHLoader.cpp
@@ -115,7 +115,7 @@ void BVHLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IOSyst
// read file into memory
std::unique_ptr file(pIOHandler->Open(pFile));
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open file ", pFile, ".");
}
@@ -191,7 +191,7 @@ aiNode *BVHLoader::ReadNode() {
// now read the node's contents
std::string siteToken;
- while (1) {
+ while (true) {
std::string token = GetNextToken();
// node offset to parent node
@@ -247,7 +247,7 @@ aiNode *BVHLoader::ReadEndSite(const std::string &pParentName) {
// now read the node's contents. Only possible entry is "OFFSET"
std::string token;
- while (1) {
+ while (true) {
token.clear();
token = GetNextToken();
diff --git a/code/AssetLib/Blender/BlenderBMesh.cpp b/code/AssetLib/Blender/BlenderBMesh.cpp
index be536ebdb..a82e7c678 100644
--- a/code/AssetLib/Blender/BlenderBMesh.cpp
+++ b/code/AssetLib/Blender/BlenderBMesh.cpp
@@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
template <>
const char *LogFunctions::Prefix() {
- static auto prefix = "BLEND_BMESH: ";
- return prefix;
+ return "BLEND_BMESH: ";
}
} // namespace Assimp
@@ -140,7 +139,7 @@ void BlenderBMeshConverter::ConvertPolyToFaces(const MPoly &poly) {
ThrowException("BMesh uv loop array has incorrect size");
}
const MLoopUV *loopUV = &BMesh->mloopuv[poly.loopstart];
- AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : 0);
+ AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : nullptr);
}
} else if (poly.totloop > 4) {
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
diff --git a/code/AssetLib/Blender/BlenderBMesh.h b/code/AssetLib/Blender/BlenderBMesh.h
index 45ca2c806..7d2f71717 100644
--- a/code/AssetLib/Blender/BlenderBMesh.h
+++ b/code/AssetLib/Blender/BlenderBMesh.h
@@ -80,7 +80,7 @@ namespace Assimp
void DestroyTriMesh( );
void ConvertPolyToFaces( const Blender::MPoly& poly );
void AddFace( int v1, int v2, int v3, int v4 = 0 );
- void AddTFace( const float* uv1, const float* uv2, const float *uv3, const float* uv4 = 0 );
+ void AddTFace(const float *uv1, const float *uv2, const float *uv3, const float *uv4 = nullptr);
const Blender::Mesh* BMesh;
Blender::Mesh* triMesh;
diff --git a/code/AssetLib/Blender/BlenderDNA.cpp b/code/AssetLib/Blender/BlenderDNA.cpp
index fbb61ab4f..d22c4bfd7 100644
--- a/code/AssetLib/Blender/BlenderDNA.cpp
+++ b/code/AssetLib/Blender/BlenderDNA.cpp
@@ -72,7 +72,7 @@ struct Type {
// ------------------------------------------------------------------------------------------------
void DNAParser::Parse() {
- StreamReaderAny &stream = *db.reader.get();
+ StreamReaderAny &stream = *db.reader;
DNA &dna = db.dna;
if (!match4(stream, "SDNA")) {
diff --git a/code/AssetLib/Blender/BlenderDNA.h b/code/AssetLib/Blender/BlenderDNA.h
index dc5a36c2a..494dc4b34 100644
--- a/code/AssetLib/Blender/BlenderDNA.h
+++ b/code/AssetLib/Blender/BlenderDNA.h
@@ -106,9 +106,7 @@ struct ElemBase {
// empty
}
- virtual ~ElemBase() {
- // empty
- }
+ virtual ~ElemBase() = default;
/** Type name of the element. The type
* string points is the `c_str` of the `name` attribute of the
@@ -431,6 +429,17 @@ inline bool Structure ::ResolvePointer(std::shared_pt
const Field &f,
bool) const;
+template <> bool Structure :: ResolvePointer(
+ std::shared_ptr& out, const Pointer & ptrval,
+ const FileDatabase& db, const Field&, bool) const;
+template <> inline void Structure :: Convert (int& dest,const FileDatabase& db) const;
+template<> inline void Structure :: Convert (short& dest,const FileDatabase& db) const;
+template <> inline void Structure :: Convert (char& dest,const FileDatabase& db) const;
+template <> inline void Structure::Convert(unsigned char& dest, const FileDatabase& db) const;
+template <> inline void Structure :: Convert (float& dest,const FileDatabase& db) const;
+template <> inline void Structure :: Convert (double& dest,const FileDatabase& db) const;
+template <> inline void Structure :: Convert (Pointer& dest,const FileDatabase& db) const;
+
// -------------------------------------------------------------------------------
/** Represents the full data structure information for a single BLEND file.
* This data is extracted from the DNA1 chunk in the file.
diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp
index 870554700..269c90b96 100644
--- a/code/AssetLib/Blender/BlenderLoader.cpp
+++ b/code/AssetLib/Blender/BlenderLoader.cpp
@@ -63,6 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
+#include
#include
// zlib is needed for compressed blend files
@@ -79,8 +80,7 @@ namespace Assimp {
template <>
const char *LogFunctions::Prefix() {
- static auto prefix = "BLEND: ";
- return prefix;
+ return "BLEND: ";
}
} // namespace Assimp
@@ -182,7 +182,7 @@ void BlenderImporter::InternReadFile(const std::string &pFile,
}
// replace the input stream with a memory stream
- stream.reset(new MemoryIOStream(reinterpret_cast(uncompressed.data()), total));
+ stream = std::make_shared(reinterpret_cast(uncompressed.data()), total);
// .. and retry
stream->Read(magic, 7, 1);
@@ -219,7 +219,7 @@ void BlenderImporter::ParseBlendFile(FileDatabase &out, std::shared_ptr(
const FileDatabase &db) const {
ReadFieldArray(dest.co, "co", db);
- ReadFieldArray(dest.no, "no", db);
+ ReadFieldArray(dest.no, "no", db);
ReadField(dest.flag, "flag", db);
//ReadField(dest.mat_nr,"mat_nr",db);
ReadField(dest.bweight, "bweight", db);
diff --git a/code/AssetLib/Blender/BlenderScene.h b/code/AssetLib/Blender/BlenderScene.h
index 436e47061..ba7ded909 100644
--- a/code/AssetLib/Blender/BlenderScene.h
+++ b/code/AssetLib/Blender/BlenderScene.h
@@ -182,7 +182,7 @@ struct MVert : ElemBase {
int bweight;
MVert() :
- ElemBase(), flag(0), mat_nr(0), bweight(0) {}
+ flag(0), mat_nr(0), bweight(0) {}
};
// -------------------------------------------------------------------------------
@@ -417,7 +417,6 @@ struct CustomDataLayer : ElemBase {
std::shared_ptr data; // must be converted to real type according type member
CustomDataLayer() :
- ElemBase(),
type(0),
offset(0),
flag(0),
@@ -729,7 +728,7 @@ struct Object : ElemBase {
ListBase modifiers;
Object() :
- ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() {
+ type(Type_EMPTY), parent(nullptr) {
// empty
}
};
@@ -741,8 +740,7 @@ struct Base : ElemBase {
std::shared_ptr object WARN;
Base() :
- ElemBase(), prev(nullptr), next(), object() {
- // empty
+ prev(nullptr) {
// empty
}
};
@@ -758,10 +756,7 @@ struct Scene : ElemBase {
ListBase base;
- Scene() :
- ElemBase(), camera(), world(), basact(), master_collection() {
- // empty
- }
+ Scene() = default;
};
// -------------------------------------------------------------------------------
@@ -791,10 +786,7 @@ struct Image : ElemBase {
short gen_x, gen_y, gen_type;
- Image() :
- ElemBase() {
- // empty
- }
+ Image() = default;
};
// -------------------------------------------------------------------------------
@@ -884,7 +876,7 @@ struct Tex : ElemBase {
//char use_nodes;
Tex() :
- ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() {
+ imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) {
// empty
}
};
@@ -976,10 +968,7 @@ struct MTex : ElemBase {
//float shadowfac;
//float zenupfac, zendownfac, blendfac;
- MTex() :
- ElemBase() {
- // empty
- }
+ MTex() = default;
};
} // namespace Blender
diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp
index d3ef5ae5e..73fd56b98 100644
--- a/code/AssetLib/Blender/BlenderTessellator.cpp
+++ b/code/AssetLib/Blender/BlenderTessellator.cpp
@@ -62,8 +62,7 @@ namspace Assimp
{
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
{
- static auto prefix = "BLEND_TESS_GL: ";
- return prefix;
+ return "BLEND_TESS_GL: ";
}
}
@@ -81,9 +80,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ):
}
// ------------------------------------------------------------------------------------------------
-BlenderTessellatorGL::~BlenderTessellatorGL( )
-{
-}
+BlenderTessellatorGL::~BlenderTessellatorGL() = default;
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )
@@ -259,8 +256,7 @@ namespace Assimp
{
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
{
- static auto prefix = "BLEND_TESS_P2T: ";
- return prefix;
+ return "BLEND_TESS_P2T: ";
}
}
diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp
index 06d7a3412..c11ec0280 100644
--- a/code/AssetLib/C4D/C4DImporter.cpp
+++ b/code/AssetLib/C4D/C4DImporter.cpp
@@ -86,8 +86,7 @@ void GetWriterInfo(int &id, String &appname) {
namespace Assimp {
template<> const char* LogFunctions::Prefix() {
- static auto prefix = "C4D: ";
- return prefix;
+ return "C4D: ";
}
}
@@ -106,15 +105,10 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
-C4DImporter::C4DImporter()
-: BaseImporter() {
- // empty
-}
+C4DImporter::C4DImporter() = default;
// ------------------------------------------------------------------------------------------------
-C4DImporter::~C4DImporter() {
- // empty
-}
+C4DImporter::~C4DImporter() = default;
// ------------------------------------------------------------------------------------------------
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const {
@@ -124,7 +118,7 @@ bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, b
} else if ((!extension.length() || checkSig) && pIOHandler) {
// TODO
}
-
+
return false;
}
diff --git a/code/AssetLib/COB/COBLoader.cpp b/code/AssetLib/COB/COBLoader.cpp
index a540ffaf1..20df53f75 100644
--- a/code/AssetLib/COB/COBLoader.cpp
+++ b/code/AssetLib/COB/COBLoader.cpp
@@ -158,7 +158,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// sort faces by material indices
for (std::shared_ptr &n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
- Mesh &mesh = (Mesh &)(*n.get());
+ Mesh &mesh = (Mesh &)(*n);
for (Face &f : mesh.faces) {
mesh.temp_map[f.material].push_back(&f);
}
@@ -168,7 +168,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// count meshes
for (std::shared_ptr &n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
- Mesh &mesh = (Mesh &)(*n.get());
+ Mesh &mesh = (Mesh &)(*n);
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
pScene->mNumMeshes += static_cast(mesh.temp_map.size());
}
@@ -211,7 +211,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
}
}
- pScene->mRootNode = BuildNodes(*root.get(), scene, pScene);
+ pScene->mRootNode = BuildNodes(*root, scene, pScene);
//flip normals after import
FlipWindingOrderProcess flip;
flip.Execute(pScene);
@@ -868,7 +868,7 @@ void COBImporter::ReadBinaryFile(Scene &out, StreamReaderLE *reader) {
return;
}
- while (1) {
+ while (true) {
std::string type;
type += reader->GetI1();
type += reader->GetI1();
@@ -1054,7 +1054,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
id[0] = reader.GetI1(), id[1] = reader.GetI1();
if (id[0] == 'e' && id[1] == ':') {
- mat.tex_env.reset(new Texture());
+ mat.tex_env = std::make_shared();
reader.GetI1();
ReadString_Binary(mat.tex_env->path, reader);
@@ -1064,7 +1064,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
}
if (id[0] == 't' && id[1] == ':') {
- mat.tex_color.reset(new Texture());
+ mat.tex_color = std::make_shared();
reader.GetI1();
ReadString_Binary(mat.tex_color->path, reader);
@@ -1080,7 +1080,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
}
if (id[0] == 'b' && id[1] == ':') {
- mat.tex_bump.reset(new Texture());
+ mat.tex_bump = std::make_shared();
reader.GetI1();
ReadString_Binary(mat.tex_bump->path, reader);
diff --git a/code/AssetLib/CSM/CSMLoader.cpp b/code/AssetLib/CSM/CSMLoader.cpp
index 7bf736298..db152f453 100644
--- a/code/AssetLib/CSM/CSMLoader.cpp
+++ b/code/AssetLib/CSM/CSMLoader.cpp
@@ -117,7 +117,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
std::unique_ptr file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
- if( file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError( "Failed to open CSM file ", pFile, ".");
}
@@ -130,7 +130,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
int first = 0, last = 0x00ffffff;
// now process the file and look out for '$' sections
- while (1) {
+ while (true) {
SkipSpaces(&buffer);
if ('\0' == *buffer)
break;
@@ -154,7 +154,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
else if (TokenMatchI(buffer,"order",5)) {
std::vector< aiNodeAnim* > anims_temp;
anims_temp.reserve(30);
- while (1) {
+ while (true) {
SkipSpaces(&buffer);
if (IsLineEnd(*buffer) && SkipSpacesAndLineEnd(&buffer) && *buffer == '$')
break; // next section
@@ -196,7 +196,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
unsigned int filled = 0;
// Now read all point data.
- while (1) {
+ while (true) {
SkipSpaces(&buffer);
if (IsLineEnd(*buffer) && (!SkipSpacesAndLineEnd(&buffer) || *buffer == '$')) {
break; // next section
diff --git a/code/AssetLib/Collada/ColladaExporter.cpp b/code/AssetLib/Collada/ColladaExporter.cpp
index 23897ffaa..29b714bd7 100644
--- a/code/AssetLib/Collada/ColladaExporter.cpp
+++ b/code/AssetLib/Collada/ColladaExporter.cpp
@@ -246,7 +246,7 @@ void ColladaExporter::WriteHeader() {
}
// Assimp root nodes can have meshes, Collada Scenes cannot
- if (mScene->mRootNode->mNumChildren == 0 || mScene->mRootNode->mMeshes != 0) {
+ if (mScene->mRootNode->mNumChildren == 0 || mScene->mRootNode->mMeshes != nullptr) {
mAdd_root_node = true;
}
@@ -448,7 +448,7 @@ void ColladaExporter::WriteLight(size_t pIndex) {
PushTag();
switch (light->mType) {
case aiLightSource_AMBIENT:
- WriteAmbienttLight(light);
+ WriteAmbientLight(light);
break;
case aiLightSource_DIRECTIONAL:
WriteDirectionalLight(light);
@@ -543,7 +543,7 @@ void ColladaExporter::WriteSpotLight(const aiLight *const light) {
mOutput << startstr << "" << endstr;
}
-void ColladaExporter::WriteAmbienttLight(const aiLight *const light) {
+void ColladaExporter::WriteAmbientLight(const aiLight *const light) {
const aiColor3D &color = light->mColorAmbient;
mOutput << startstr << "" << endstr;
diff --git a/code/AssetLib/Collada/ColladaExporter.h b/code/AssetLib/Collada/ColladaExporter.h
index 7288dce54..e372a5c5c 100644
--- a/code/AssetLib/Collada/ColladaExporter.h
+++ b/code/AssetLib/Collada/ColladaExporter.h
@@ -101,7 +101,7 @@ protected:
void WritePointLight(const aiLight *const light);
void WriteDirectionalLight(const aiLight *const light);
void WriteSpotLight(const aiLight *const light);
- void WriteAmbienttLight(const aiLight *const light);
+ void WriteAmbientLight(const aiLight *const light);
/// Writes the controller library
void WriteControllerLibrary();
diff --git a/code/AssetLib/Collada/ColladaHelper.h b/code/AssetLib/Collada/ColladaHelper.h
index 2930f5108..c5b6a2d13 100644
--- a/code/AssetLib/Collada/ColladaHelper.h
+++ b/code/AssetLib/Collada/ColladaHelper.h
@@ -666,7 +666,7 @@ struct ChannelEntry {
const Collada::Accessor *mTimeAccessor; ///> Collada accessor to the time values
const Collada::Data *mTimeData; ///> Source data array for the time values
const Collada::Accessor *mValueAccessor; ///> Collada accessor to the key value values
- const Collada::Data *mValueData; ///> Source datat array for the key value values
+ const Collada::Data *mValueData; ///> Source data array for the key value values
ChannelEntry() :
mChannel(),
diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp
index 405944f29..f3750ceab 100644
--- a/code/AssetLib/Collada/ColladaLoader.cpp
+++ b/code/AssetLib/Collada/ColladaLoader.cpp
@@ -92,15 +92,6 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() :
- mFileName(),
- mMeshIndexByID(),
- mMaterialIndexByName(),
- mMeshes(),
- newMats(),
- mCameras(),
- mLights(),
- mTextures(),
- mAnims(),
noSkeletonMesh(false),
removeEmptyBones(false),
ignoreUpDirection(false),
@@ -1264,12 +1255,12 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
// now for every unique point in time, find or interpolate the key values for that time
// and apply them to the transform chain. Then the node's present transformation can be calculated.
ai_real time = startTime;
- while (1) {
+ while (true) {
for (ChannelEntry & e : entries) {
// find the keyframe behind the current point in time
size_t pos = 0;
ai_real postTime = 0.0;
- while (1) {
+ while (true) {
if (pos >= e.mTimeAccessor->mCount) {
break;
}
@@ -1523,7 +1514,7 @@ void ColladaLoader::AddTexture(aiMaterial &mat,
map = -1;
for (std::string::const_iterator it = sampler.mUVChannel.begin(); it != sampler.mUVChannel.end(); ++it) {
if (IsNumeric(*it)) {
- map = strtoul10(&(*it));
+ map = strtoul10(&(*it));
break;
}
}
@@ -1680,7 +1671,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture(const ColladaParser &pParse
// recurse through the param references until we end up at an image
std::string name = pName;
- while (1) {
+ while (true) {
// the given string is a param entry. Find it
Effect::ParamLibrary::const_iterator it = pEffect.mParams.find(name);
// if not found, we're at the end of the recursion. The resulting string should be the image ID
diff --git a/code/AssetLib/Collada/ColladaParser.cpp b/code/AssetLib/Collada/ColladaParser.cpp
index 944adedaa..cce6a0db6 100644
--- a/code/AssetLib/Collada/ColladaParser.cpp
+++ b/code/AssetLib/Collada/ColladaParser.cpp
@@ -145,7 +145,7 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) :
} else {
// attempt to open the file directly
daefile.reset(pIOHandler->Open(pFile));
- if (daefile.get() == nullptr) {
+ if (daefile == nullptr) {
throw DeadlyImportError("Failed to open file '", pFile, "'.");
}
}
@@ -759,9 +759,10 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC
XmlParser::getValueAsString(currentNode, stdText);
const char *text = stdText.c_str();
for (std::vector>::iterator it = pController.mWeights.begin(); it != pController.mWeights.end(); ++it) {
- if (text == 0) {
+ if (text == nullptr) {
throw DeadlyImportError("Out of data while reading ");
}
+ SkipSpacesAndLineEnd(&text);
it->first = strtoul10(text, &text);
SkipSpacesAndLineEnd(&text);
if (*text == 0) {
diff --git a/code/AssetLib/DXF/DXFHelper.h b/code/AssetLib/DXF/DXFHelper.h
index e50c471d2..4d7893cc4 100644
--- a/code/AssetLib/DXF/DXFHelper.h
+++ b/code/AssetLib/DXF/DXFHelper.h
@@ -65,7 +65,6 @@ public:
LineReader(StreamReaderLE& reader)
: splitter(reader,false,true)
, groupcode( 0 )
- , value()
, end() {
// empty
}
@@ -186,8 +185,7 @@ struct InsertBlock {
InsertBlock()
: pos()
, scale(1.f,1.f,1.f)
- , angle()
- , name() {
+ , angle() {
// empty
}
diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp
index 9d0246903..1fb9490cc 100644
--- a/code/AssetLib/DXF/DXFLoader.cpp
+++ b/code/AssetLib/DXF/DXFLoader.cpp
@@ -136,7 +136,7 @@ void DXFImporter::InternReadFile( const std::string& filename, aiScene* pScene,
std::shared_ptr file = std::shared_ptr( pIOHandler->Open( filename) );
// Check whether we can read the file
- if( file.get() == nullptr ) {
+ if (file == nullptr) {
throw DeadlyImportError( "Failed to open DXF file ", filename, "");
}
@@ -371,7 +371,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping.");
continue;
}
-
+
std::shared_ptr pl_out = std::shared_ptr(new DXF::PolyLine(*pl_in));
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {
diff --git a/code/AssetLib/FBX/FBXCommon.h b/code/AssetLib/FBX/FBXCommon.h
index c592c5649..c3d715892 100644
--- a/code/AssetLib/FBX/FBXCommon.h
+++ b/code/AssetLib/FBX/FBXCommon.h
@@ -55,6 +55,7 @@ const char NULL_RECORD[NumNullRecords] = { // 25 null bytes in 64-bit and 13 nul
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
}; // who knows why, it looks like two integers 32/64 bit (compressed and uncompressed sizes?) + 1 byte (might be compression type?)
+static std::string NULL_RECORD_STRING(NumNullRecords, '\0');
const std::string SEPARATOR = { '\x00', '\x01' }; // for use inside strings
const std::string MAGIC_NODE_TAG = "_$AssimpFbx$"; // from import
const int64_t SECOND = 46186158000; // FBX's kTime unit
diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp
index e5ba37642..f1f57c10b 100644
--- a/code/AssetLib/FBX/FBXConverter.cpp
+++ b/code/AssetLib/FBX/FBXConverter.cpp
@@ -119,7 +119,7 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
if (mat) {
if (materials_converted.find(mat) == materials_converted.end()) {
- ConvertMaterial(*mat, 0);
+ ConvertMaterial(*mat, nullptr);
}
}
}
@@ -873,8 +873,12 @@ void FBXConverter::SetupNodeMetadata(const Model &model, aiNode &nd) {
data->Set(index++, prop.first, interpretedBool->Value());
} else if (const TypedProperty *interpretedInt = prop.second->As>()) {
data->Set(index++, prop.first, interpretedInt->Value());
+ } else if (const TypedProperty *interpretedUInt = prop.second->As>()) {
+ data->Set(index++, prop.first, interpretedUInt->Value());
} else if (const TypedProperty *interpretedUint64 = prop.second->As>()) {
data->Set(index++, prop.first, interpretedUint64->Value());
+ } else if (const TypedProperty *interpretedint64 = prop.second->As>()) {
+ data->Set(index++, prop.first, interpretedint64->Value());
} else if (const TypedProperty *interpretedFloat = prop.second->As>()) {
data->Set(index++, prop.first, interpretedFloat->Value());
} else if (const TypedProperty *interpretedString = prop.second->As>()) {
@@ -1176,15 +1180,23 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c
std::vector animMeshes;
for (const BlendShape *blendShape : mesh.GetBlendShapes()) {
for (const BlendShapeChannel *blendShapeChannel : blendShape->BlendShapeChannels()) {
- const std::vector &shapeGeometries = blendShapeChannel->GetShapeGeometries();
- for (size_t i = 0; i < shapeGeometries.size(); i++) {
+ const auto& shapeGeometries = blendShapeChannel->GetShapeGeometries();
+ for (const ShapeGeometry *shapeGeometry : shapeGeometries) {
aiAnimMesh *animMesh = aiCreateAnimMesh(out_mesh);
- const ShapeGeometry *shapeGeometry = shapeGeometries.at(i);
- const std::vector &curVertices = shapeGeometry->GetVertices();
- const std::vector &curNormals = shapeGeometry->GetNormals();
- const std::vector &curIndices = shapeGeometry->GetIndices();
+ const auto &curVertices = shapeGeometry->GetVertices();
+ const auto &curNormals = shapeGeometry->GetNormals();
+ const auto &curIndices = shapeGeometry->GetIndices();
//losing channel name if using shapeGeometry->Name()
- animMesh->mName.Set(FixAnimMeshName(blendShapeChannel->Name()));
+ // if blendShapeChannel Name is empty or don't have a ".", add geoMetryName;
+ auto aniName = FixAnimMeshName(blendShapeChannel->Name());
+ auto geoMetryName = FixAnimMeshName(shapeGeometry->Name());
+ if (aniName.empty()) {
+ aniName = geoMetryName;
+ }
+ else if (aniName.find('.') == aniName.npos) {
+ aniName += "." + geoMetryName;
+ }
+ animMesh->mName.Set(aniName);
for (size_t j = 0; j < curIndices.size(); j++) {
const unsigned int curIndex = curIndices.at(j);
aiVector3D vertex = curVertices.at(j);
@@ -1406,13 +1418,12 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co
std::vector animMeshes;
for (const BlendShape *blendShape : mesh.GetBlendShapes()) {
for (const BlendShapeChannel *blendShapeChannel : blendShape->BlendShapeChannels()) {
- const std::vector &shapeGeometries = blendShapeChannel->GetShapeGeometries();
- for (size_t i = 0; i < shapeGeometries.size(); i++) {
+ const auto& shapeGeometries = blendShapeChannel->GetShapeGeometries();
+ for (const ShapeGeometry *shapeGeometry : shapeGeometries) {
aiAnimMesh *animMesh = aiCreateAnimMesh(out_mesh);
- const ShapeGeometry *shapeGeometry = shapeGeometries.at(i);
- const std::vector &curVertices = shapeGeometry->GetVertices();
- const std::vector &curNormals = shapeGeometry->GetNormals();
- const std::vector &curIndices = shapeGeometry->GetIndices();
+ const auto& curVertices = shapeGeometry->GetVertices();
+ const auto& curNormals = shapeGeometry->GetNormals();
+ const auto& curIndices = shapeGeometry->GetIndices();
animMesh->mName.Set(FixAnimMeshName(shapeGeometry->Name()));
for (size_t j = 0; j < curIndices.size(); j++) {
unsigned int curIndex = curIndices.at(j);
@@ -1455,7 +1466,9 @@ static void copyBoneToSkeletonBone(aiMesh *mesh, aiBone *bone, aiSkeletonBone *s
skeletonBone->mWeights = bone->mWeights;
skeletonBone->mOffsetMatrix = bone->mOffsetMatrix;
skeletonBone->mMeshId = mesh;
+#ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS
skeletonBone->mNode = bone->mNode;
+#endif
skeletonBone->mParent = -1;
}
@@ -1563,7 +1576,7 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, const ai
out->mBones = nullptr;
out->mNumBones = 0;
return;
- }
+ }
out->mBones = new aiBone *[bones.size()]();
out->mNumBones = static_cast(bones.size());
@@ -3228,7 +3241,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
}
bool ok = false;
-
+
const auto zero_epsilon = ai_epsilon;
const aiVector3D& preRotation = PropertyGet(props, "PreRotation", ok);
diff --git a/code/AssetLib/FBX/FBXDeformer.cpp b/code/AssetLib/FBX/FBXDeformer.cpp
index df134a401..1aab55ea9 100644
--- a/code/AssetLib/FBX/FBXDeformer.cpp
+++ b/code/AssetLib/FBX/FBXDeformer.cpp
@@ -154,8 +154,10 @@ BlendShape::BlendShape(uint64_t id, const Element& element, const Document& doc,
for (const Connection* con : conns) {
const BlendShapeChannel* const bspc = ProcessSimpleConnection(*con, false, "BlendShapeChannel -> BlendShape", element);
if (bspc) {
- blendShapeChannels.push_back(bspc);
- continue;
+ auto pr = blendShapeChannels.insert(bspc);
+ if (!pr.second) {
+ FBXImporter::LogWarn("there is the same blendShapeChannel id ", bspc->ID());
+ }
}
}
}
@@ -179,8 +181,10 @@ BlendShapeChannel::BlendShapeChannel(uint64_t id, const Element& element, const
for (const Connection* con : conns) {
const ShapeGeometry* const sg = ProcessSimpleConnection(*con, false, "Shape -> BlendShapeChannel", element);
if (sg) {
- shapeGeometries.push_back(sg);
- continue;
+ auto pr = shapeGeometries.insert(sg);
+ if (!pr.second) {
+ FBXImporter::LogWarn("there is the same shapeGeometrie id ", sg->ID());
+ }
}
}
}
diff --git a/code/AssetLib/FBX/FBXDocument.cpp b/code/AssetLib/FBX/FBXDocument.cpp
index 957aa764f..ea39a9a00 100644
--- a/code/AssetLib/FBX/FBXDocument.cpp
+++ b/code/AssetLib/FBX/FBXDocument.cpp
@@ -78,7 +78,7 @@ const Object* LazyObject::Get(bool dieOnError) {
return nullptr;
}
- if (object.get()) {
+ if (object) {
return object.get();
}
@@ -222,7 +222,7 @@ const Object* LazyObject::Get(bool dieOnError) {
return nullptr;
}
- if (!object.get()) {
+ if (!object) {
//DOMError("failed to convert element to DOM object, class: " + classtag + ", name: " + name,&element);
}
@@ -381,8 +381,10 @@ void Document::ReadObjects() {
DOMError("encountered object with implicitly defined id 0",el.second);
}
- if(objects.find(id) != objects.end()) {
+ const auto foundObject = objects.find(id);
+ if(foundObject != objects.end()) {
DOMWarning("encountered duplicate object id, ignoring first occurrence",el.second);
+ delete foundObject->second;
}
objects[id] = new LazyObject(id, *el.second, *this);
diff --git a/code/AssetLib/FBX/FBXDocument.h b/code/AssetLib/FBX/FBXDocument.h
index c362e6475..821d4d5cb 100644
--- a/code/AssetLib/FBX/FBXDocument.h
+++ b/code/AssetLib/FBX/FBXDocument.h
@@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_FBX_DOCUMENT_H
#include
+#include
#include
#include
#include "FBXProperties.h"
@@ -168,7 +169,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
private:
@@ -432,7 +433,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
/** Get material links */
@@ -503,7 +504,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
// return a 4-tuple
@@ -618,7 +619,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
const uint8_t* Content() const {
@@ -632,7 +633,7 @@ public:
uint8_t* RelinquishContent() {
uint8_t* ptr = content;
- content = 0;
+ content = nullptr;
return ptr;
}
@@ -663,7 +664,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
const TextureMap& Textures() const {
@@ -735,7 +736,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
@@ -780,7 +781,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
/* the optional white list specifies a list of property names for which the caller
@@ -808,7 +809,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
const AnimationLayerList& Layers() const {
@@ -829,7 +830,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
private:
@@ -855,14 +856,14 @@ public:
return fullWeights;
}
- const std::vector& GetShapeGeometries() const {
+ const std::unordered_set& GetShapeGeometries() const {
return shapeGeometries;
}
private:
float percent;
WeightArray fullWeights;
- std::vector shapeGeometries;
+ std::unordered_set shapeGeometries;
};
/** DOM class for BlendShape deformers */
@@ -872,12 +873,12 @@ public:
virtual ~BlendShape();
- const std::vector& BlendShapeChannels() const {
+ const std::unordered_set& BlendShapeChannels() const {
return blendShapeChannels;
}
private:
- std::vector blendShapeChannels;
+ std::unordered_set blendShapeChannels;
};
/** DOM class for skin deformer clusters (aka sub-deformers) */
@@ -1018,7 +1019,7 @@ public:
const PropertyTable& Props() const {
ai_assert(props.get());
- return *props.get();
+ return *props;
}
const Document& GetDocument() const {
@@ -1097,7 +1098,7 @@ public:
const FileGlobalSettings& GlobalSettings() const {
ai_assert(globals.get());
- return *globals.get();
+ return *globals;
}
const PropertyTemplateMap& Templates() const {
diff --git a/code/AssetLib/FBX/FBXDocumentUtil.h b/code/AssetLib/FBX/FBXDocumentUtil.h
index d32c12e1a..1e4653201 100644
--- a/code/AssetLib/FBX/FBXDocumentUtil.h
+++ b/code/AssetLib/FBX/FBXDocumentUtil.h
@@ -58,12 +58,11 @@ namespace Util {
/* DOM/Parse error reporting - does not return */
AI_WONT_RETURN void DOMError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX;
-AI_WONT_RETURN void DOMError(const std::string& message, const Element* element = NULL) AI_WONT_RETURN_SUFFIX;
+AI_WONT_RETURN void DOMError(const std::string &message, const Element *element = nullptr) AI_WONT_RETURN_SUFFIX;
// does return
void DOMWarning(const std::string& message, const Token& token);
-void DOMWarning(const std::string& message, const Element* element = NULL);
-
+void DOMWarning(const std::string &message, const Element *element = nullptr);
// fetch a property table and the corresponding property template
std::shared_ptr GetPropertyTable(const Document& doc,
diff --git a/code/AssetLib/FBX/FBXExportNode.cpp b/code/AssetLib/FBX/FBXExportNode.cpp
index 21c61b257..21e591425 100644
--- a/code/AssetLib/FBX/FBXExportNode.cpp
+++ b/code/AssetLib/FBX/FBXExportNode.cpp
@@ -360,7 +360,7 @@ void FBX::Node::EndBinary(
bool has_children
) {
// if there were children, add a null record
- if (has_children) { s.PutString(Assimp::FBX::NULL_RECORD); }
+ if (has_children) { s.PutString(Assimp::FBX::NULL_RECORD_STRING); }
// now go back and write initial pos
this->end_pos = s.Tell();
diff --git a/code/AssetLib/FBX/FBXExportNode.h b/code/AssetLib/FBX/FBXExportNode.h
index 62c06e16b..99644b216 100644
--- a/code/AssetLib/FBX/FBXExportNode.h
+++ b/code/AssetLib/FBX/FBXExportNode.h
@@ -77,8 +77,6 @@ public: // constructors
/// The class constructor with the name.
Node(const std::string& n)
: name(n)
- , properties()
- , children()
, force_has_children( false ) {
// empty
}
@@ -87,8 +85,6 @@ public: // constructors
template
Node(const std::string& n, More&&... more)
: name(n)
- , properties()
- , children()
, force_has_children(false) {
AddProperties(std::forward(more)...);
}
diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp
index b7f182262..31bea76b5 100644
--- a/code/AssetLib/FBX/FBXExporter.cpp
+++ b/code/AssetLib/FBX/FBXExporter.cpp
@@ -681,9 +681,9 @@ void FBXExporter::WriteDefinitions ()
pt = FBX::Node("PropertyTemplate", "FBXAnimLayer");
p = FBX::Node("Properties70");
p.AddP70("Weight", "Number", "", "A", double(100));
- p.AddP70bool("Mute", 0);
- p.AddP70bool("Solo", 0);
- p.AddP70bool("Lock", 0);
+ p.AddP70bool("Mute", false);
+ p.AddP70bool("Solo", false);
+ p.AddP70bool("Lock", false);
p.AddP70color("Color", 0.8, 0.8, 0.8);
p.AddP70("BlendMode", "enum", "", "", int32_t(0));
p.AddP70("RotationAccumulationMode", "enum", "", "", int32_t(0));
@@ -733,42 +733,42 @@ void FBXExporter::WriteDefinitions ()
p.AddP70vector("RotationPivot", 0.0, 0.0, 0.0);
p.AddP70vector("ScalingOffset", 0.0, 0.0, 0.0);
p.AddP70vector("ScalingPivot", 0.0, 0.0, 0.0);
- p.AddP70bool("TranslationActive", 0);
+ p.AddP70bool("TranslationActive", false);
p.AddP70vector("TranslationMin", 0.0, 0.0, 0.0);
p.AddP70vector("TranslationMax", 0.0, 0.0, 0.0);
- p.AddP70bool("TranslationMinX", 0);
- p.AddP70bool("TranslationMinY", 0);
- p.AddP70bool("TranslationMinZ", 0);
- p.AddP70bool("TranslationMaxX", 0);
- p.AddP70bool("TranslationMaxY", 0);
- p.AddP70bool("TranslationMaxZ", 0);
+ p.AddP70bool("TranslationMinX", false);
+ p.AddP70bool("TranslationMinY", false);
+ p.AddP70bool("TranslationMinZ", false);
+ p.AddP70bool("TranslationMaxX", false);
+ p.AddP70bool("TranslationMaxY", false);
+ p.AddP70bool("TranslationMaxZ", false);
p.AddP70enum("RotationOrder", 0);
- p.AddP70bool("RotationSpaceForLimitOnly", 0);
+ p.AddP70bool("RotationSpaceForLimitOnly", false);
p.AddP70double("RotationStiffnessX", 0.0);
p.AddP70double("RotationStiffnessY", 0.0);
p.AddP70double("RotationStiffnessZ", 0.0);
p.AddP70double("AxisLen", 10.0);
p.AddP70vector("PreRotation", 0.0, 0.0, 0.0);
p.AddP70vector("PostRotation", 0.0, 0.0, 0.0);
- p.AddP70bool("RotationActive", 0);
+ p.AddP70bool("RotationActive", false);
p.AddP70vector("RotationMin", 0.0, 0.0, 0.0);
p.AddP70vector("RotationMax", 0.0, 0.0, 0.0);
- p.AddP70bool("RotationMinX", 0);
- p.AddP70bool("RotationMinY", 0);
- p.AddP70bool("RotationMinZ", 0);
- p.AddP70bool("RotationMaxX", 0);
- p.AddP70bool("RotationMaxY", 0);
- p.AddP70bool("RotationMaxZ", 0);
+ p.AddP70bool("RotationMinX", false);
+ p.AddP70bool("RotationMinY", false);
+ p.AddP70bool("RotationMinZ", false);
+ p.AddP70bool("RotationMaxX", false);
+ p.AddP70bool("RotationMaxY", false);
+ p.AddP70bool("RotationMaxZ", false);
p.AddP70enum("InheritType", 0);
- p.AddP70bool("ScalingActive", 0);
+ p.AddP70bool("ScalingActive", false);
p.AddP70vector("ScalingMin", 0.0, 0.0, 0.0);
p.AddP70vector("ScalingMax", 1.0, 1.0, 1.0);
- p.AddP70bool("ScalingMinX", 0);
- p.AddP70bool("ScalingMinY", 0);
- p.AddP70bool("ScalingMinZ", 0);
- p.AddP70bool("ScalingMaxX", 0);
- p.AddP70bool("ScalingMaxY", 0);
- p.AddP70bool("ScalingMaxZ", 0);
+ p.AddP70bool("ScalingMinX", false);
+ p.AddP70bool("ScalingMinY", false);
+ p.AddP70bool("ScalingMinZ", false);
+ p.AddP70bool("ScalingMaxX", false);
+ p.AddP70bool("ScalingMaxY", false);
+ p.AddP70bool("ScalingMaxZ", false);
p.AddP70vector("GeometricTranslation", 0.0, 0.0, 0.0);
p.AddP70vector("GeometricRotation", 0.0, 0.0, 0.0);
p.AddP70vector("GeometricScaling", 1.0, 1.0, 1.0);
@@ -789,11 +789,11 @@ void FBXExporter::WriteDefinitions ()
p.AddP70double("PreferedAngleZ", 0.0);
p.AddP70("LookAtProperty", "object", "", "");
p.AddP70("UpVectorProperty", "object", "", "");
- p.AddP70bool("Show", 1);
- p.AddP70bool("NegativePercentShapeSupport", 1);
+ p.AddP70bool("Show", true);
+ p.AddP70bool("NegativePercentShapeSupport", true);
p.AddP70int("DefaultAttributeIndex", -1);
- p.AddP70bool("Freeze", 0);
- p.AddP70bool("LODBox", 0);
+ p.AddP70bool("Freeze", false);
+ p.AddP70bool("LODBox", false);
p.AddP70(
"Lcl Translation", "Lcl Translation", "", "A",
double(0), double(0), double(0)
@@ -840,9 +840,9 @@ void FBXExporter::WriteDefinitions ()
p.AddP70color("Color", 0, 0, 0);
p.AddP70vector("BBoxMin", 0, 0, 0);
p.AddP70vector("BBoxMax", 0, 0, 0);
- p.AddP70bool("Primary Visibility", 1);
- p.AddP70bool("Casts Shadows", 1);
- p.AddP70bool("Receive Shadows", 1);
+ p.AddP70bool("Primary Visibility", true);
+ p.AddP70bool("Casts Shadows", true);
+ p.AddP70bool("Receive Shadows", true);
pt.AddChild(p);
n.AddChild(pt);
object_nodes.push_back(n);
@@ -873,7 +873,7 @@ void FBXExporter::WriteDefinitions ()
} else {
p.AddP70string("ShadingModel", "Lambert");
}
- p.AddP70bool("MultiLayer", 0);
+ p.AddP70bool("MultiLayer", false);
p.AddP70colorA("EmissiveColor", 0.0, 0.0, 0.0);
p.AddP70numberA("EmissiveFactor", 1.0);
p.AddP70colorA("AmbientColor", 0.2, 0.2, 0.2);
@@ -910,7 +910,7 @@ void FBXExporter::WriteDefinitions ()
n.AddChild("Count", count);
pt = FBX::Node("PropertyTemplate", "FbxVideo");
p = FBX::Node("Properties70");
- p.AddP70bool("ImageSequence", 0);
+ p.AddP70bool("ImageSequence", false);
p.AddP70int("ImageSequenceOffset", 0);
p.AddP70double("FrameRate", 0.0);
p.AddP70int("LastFrame", 0);
@@ -922,8 +922,8 @@ void FBXExporter::WriteDefinitions ()
p.AddP70double("PlaySpeed", 0.0);
p.AddP70time("Offset", 0);
p.AddP70enum("InterlaceMode", 0);
- p.AddP70bool("FreeRunning", 0);
- p.AddP70bool("Loop", 0);
+ p.AddP70bool("FreeRunning", false);
+ p.AddP70bool("Loop", false);
p.AddP70enum("AccessMode", 0);
pt.AddChild(p);
n.AddChild(pt);
@@ -944,8 +944,8 @@ void FBXExporter::WriteDefinitions ()
p.AddP70enum("CurrentMappingType", 0);
p.AddP70enum("WrapModeU", 0);
p.AddP70enum("WrapModeV", 0);
- p.AddP70bool("UVSwap", 0);
- p.AddP70bool("PremultiplyAlpha", 1);
+ p.AddP70bool("UVSwap", false);
+ p.AddP70bool("PremultiplyAlpha", true);
p.AddP70vectorA("Translation", 0.0, 0.0, 0.0);
p.AddP70vectorA("Rotation", 0.0, 0.0, 0.0);
p.AddP70vectorA("Scaling", 1.0, 1.0, 1.0);
@@ -953,8 +953,8 @@ void FBXExporter::WriteDefinitions ()
p.AddP70vector("TextureScalingPivot", 0.0, 0.0, 0.0);
p.AddP70enum("CurrentTextureBlendMode", 1);
p.AddP70string("UVSet", "default");
- p.AddP70bool("UseMaterial", 0);
- p.AddP70bool("UseMipMap", 0);
+ p.AddP70bool("UseMaterial", false);
+ p.AddP70bool("UseMipMap", false);
pt.AddChild(p);
n.AddChild(pt);
object_nodes.push_back(n);
@@ -1708,7 +1708,7 @@ void FBXExporter::WriteObjects ()
p.AddP70vectorA("Scaling", trafo.mScaling[0], trafo.mScaling[1], 0.0);
p.AddP70enum("CurrentTextureBlendMode", 0); // TODO: verify
//p.AddP70string("UVSet", ""); // TODO: how should this work?
- p.AddP70bool("UseMaterial", 1);
+ p.AddP70bool("UseMaterial", true);
tnode.AddChild(p);
// can't easily determine which texture path will be correct,
// so just store what we have in every field.
@@ -2501,7 +2501,7 @@ void FBXExporter::WriteModelNode(
m.AddProperties(node_uid, std::move(name), type);
m.AddChild("Version", int32_t(232));
FBX::Node p("Properties70");
- p.AddP70bool("RotationActive", 1);
+ p.AddP70bool("RotationActive", true);
p.AddP70int("DefaultAttributeIndex", 0);
p.AddP70enum("InheritType", inherit_type);
if (transform_chain.empty()) {
diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp
index 7ff194905..e4f5f9dd4 100644
--- a/code/AssetLib/FBX/FBXImporter.cpp
+++ b/code/AssetLib/FBX/FBXImporter.cpp
@@ -62,8 +62,7 @@ namespace Assimp {
template <>
const char *LogFunctions::Prefix() {
- static auto prefix = "FBX: ";
- return prefix;
+ return "FBX: ";
}
} // namespace Assimp
@@ -90,10 +89,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by #Importer
-FBXImporter::FBXImporter() :
- mSettings() {
- // empty
-}
+FBXImporter::FBXImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
diff --git a/code/AssetLib/FBX/FBXMaterial.cpp b/code/AssetLib/FBX/FBXMaterial.cpp
index 0db0ec6d7..2677d652a 100644
--- a/code/AssetLib/FBX/FBXMaterial.cpp
+++ b/code/AssetLib/FBX/FBXMaterial.cpp
@@ -292,10 +292,10 @@ void LayeredTexture::fillTexture(const Document& doc) {
}
// ------------------------------------------------------------------------------------------------
-Video::Video(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
- Object(id,element,name),
+Video::Video(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
+ Object(id, element, name),
contentLength(0),
- content(0) {
+ content(nullptr) {
const Scope& sc = GetRequiredScope(element);
const Element* const Type = sc["Type"];
@@ -380,7 +380,6 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
props = GetPropertyTable(doc,"Video.FbxVideo",element,sc);
}
-
Video::~Video() {
delete[] content;
}
diff --git a/code/AssetLib/FBX/FBXMeshGeometry.cpp b/code/AssetLib/FBX/FBXMeshGeometry.cpp
index ace4ad749..fcbaac169 100644
--- a/code/AssetLib/FBX/FBXMeshGeometry.cpp
+++ b/code/AssetLib/FBX/FBXMeshGeometry.cpp
@@ -69,13 +69,16 @@ Geometry::Geometry(uint64_t id, const Element& element, const std::string& name,
}
const BlendShape* const bsp = ProcessSimpleConnection(*con, false, "BlendShape -> Geometry", element);
if (bsp) {
- blendShapes.push_back(bsp);
+ auto pr = blendShapes.insert(bsp);
+ if (!pr.second) {
+ FBXImporter::LogWarn("there is the same blendShape id ", bsp->ID());
+ }
}
}
}
// ------------------------------------------------------------------------------------------------
-const std::vector& Geometry::GetBlendShapes() const {
+const std::unordered_set& Geometry::GetBlendShapes() const {
return blendShapes;
}
diff --git a/code/AssetLib/FBX/FBXMeshGeometry.h b/code/AssetLib/FBX/FBXMeshGeometry.h
index ad24877e4..3d67ec567 100644
--- a/code/AssetLib/FBX/FBXMeshGeometry.h
+++ b/code/AssetLib/FBX/FBXMeshGeometry.h
@@ -2,8 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2022, assimp team
-
+Copyright (c) 2006-2023, assimp team
All rights reserved.
@@ -53,84 +52,101 @@ namespace Assimp {
namespace FBX {
/**
- * DOM base class for all kinds of FBX geometry
+ * @brief DOM base class for all kinds of FBX geometry
*/
class Geometry : public Object {
public:
/// @brief The class constructor with all parameters.
/// @param id The id.
- /// @param element
- /// @param name
- /// @param doc
+ /// @param element The element instance
+ /// @param name The name instance
+ /// @param doc The document instance
Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc );
+
+ /// @brief The class destructor, default.
virtual ~Geometry() = default;
- /// Get the Skin attached to this geometry or nullptr
+ /// @brief Get the Skin attached to this geometry or nullptr.
+ /// @return The deformer skip instance as a pointer, nullptr if none.
const Skin* DeformerSkin() const;
- /// Get the BlendShape attached to this geometry or nullptr
- const std::vector& GetBlendShapes() const;
+ /// @brief Get the BlendShape attached to this geometry or nullptr
+ /// @return The blendshape arrays.
+ const std::unordered_set& GetBlendShapes() const;
private:
const Skin* skin;
- std::vector blendShapes;
+ std::unordered_set blendShapes;
+
};
typedef std::vector MatIndexArray;
-
/**
- * DOM class for FBX geometry of type "Mesh"
+ * @brief DOM class for FBX geometry of type "Mesh"
*/
class MeshGeometry : public Geometry {
public:
- /** The class constructor */
+ /// @brief The class constructor
+ /// @param id The id.
+ /// @param element The element instance
+ /// @param name The name instance
+ /// @param doc The document instance
MeshGeometry( uint64_t id, const Element& element, const std::string& name, const Document& doc );
- /** The class destructor */
+ /// @brief The class destructor, default.
virtual ~MeshGeometry() = default;
- /** Get a list of all vertex points, non-unique*/
+ /// brief Get a vector of all vertex points, non-unique.
+ /// @return The vertices vector.
const std::vector& GetVertices() const;
- /** Get a list of all vertex normals or an empty array if
- * no normals are specified. */
+ /// @brief Get a vector of all vertex normals or an empty array if no normals are specified.
+ /// @return The normal vector.
const std::vector& GetNormals() const;
- /** Get a list of all vertex tangents or an empty array
- * if no tangents are specified */
+ /// @brief Get a vector of all vertex tangents or an empty array if no tangents are specified.
+ /// @return The vertex tangents vector.
const std::vector& GetTangents() const;
- /** Get a list of all vertex bi-normals or an empty array
- * if no bi-normals are specified */
+ /// @brief Get a vector of all vertex bi-normals or an empty array if no bi-normals are specified.
+ /// @return The binomal vector.
const std::vector& GetBinormals() const;
- /** Return list of faces - each entry denotes a face and specifies
- * how many vertices it has. Vertices are taken from the
- * vertex data arrays in sequential order. */
+ /// @brief Return list of faces - each entry denotes a face and specifies how many vertices it has.
+ /// Vertices are taken from the vertex data arrays in sequential order.
+ /// @return The face indices vector.
const std::vector& GetFaceIndexCounts() const;
- /** Get a UV coordinate slot, returns an empty array if
- * the requested slot does not exist. */
+ /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist.
+ /// @param index The requested texture coordinate slot.
+ /// @return The texture coordinates.
const std::vector& GetTextureCoords( unsigned int index ) const;
- /** Get a UV coordinate slot, returns an empty array if
- * the requested slot does not exist. */
+ /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist.
+ /// @param index The requested texture coordinate slot.
+ /// @return The texture coordinate channel name.
std::string GetTextureCoordChannelName( unsigned int index ) const;
- /** Get a vertex color coordinate slot, returns an empty array if
- * the requested slot does not exist. */
+ /// @brief Get a vertex color coordinate slot, returns an empty array if the requested slot does not exist.
+ /// @param index The requested texture coordinate slot.
+ /// @return The vertex color vector.
const std::vector& GetVertexColors( unsigned int index ) const;
- /** Get per-face-vertex material assignments */
+ /// @brief Get per-face-vertex material assignments.
+ /// @return The Material indices Array.
const MatIndexArray& GetMaterialIndices() const;
- /** Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr
- * if the vertex index is not valid. */
+ /// @brief Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr if the vertex index is not valid.
+ /// @param in_index The requested input index.
+ /// @param count The number of indices.
+ /// @return The indices.
const unsigned int* ToOutputVertexIndex( unsigned int in_index, unsigned int& count ) const;
- /** Determine the face to which a particular output vertex index belongs.
- * This mapping is always unique. */
+ /// @brief Determine the face to which a particular output vertex index belongs.
+ /// This mapping is always unique.
+ /// @param in_index The requested input index.
+ /// @return The face-to-vertex index.
unsigned int FaceForVertexIndex( unsigned int in_index ) const;
private:
diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp
index da6d3889a..d71321452 100644
--- a/code/AssetLib/FBX/FBXParser.cpp
+++ b/code/AssetLib/FBX/FBXParser.cpp
@@ -187,7 +187,7 @@ Scope::Scope(Parser& parser,bool topLevel)
if (str.empty()) {
ParseError("unexpected content: empty string.");
}
-
+
elements.insert(ElementMap::value_type(str,new_Element(*n,parser)));
// Element() should stop at the next Key token (or right after a Close token)
diff --git a/code/AssetLib/FBX/FBXParser.h b/code/AssetLib/FBX/FBXParser.h
index 6aeedb211..fd5c5a181 100644
--- a/code/AssetLib/FBX/FBXParser.h
+++ b/code/AssetLib/FBX/FBXParser.h
@@ -163,7 +163,7 @@ public:
~Parser() = default;
const Scope& GetRootScope() const {
- return *root.get();
+ return *root;
}
bool IsBinary() const {
diff --git a/code/AssetLib/FBX/FBXTokenizer.h b/code/AssetLib/FBX/FBXTokenizer.h
index 5ed48e61d..79f71229b 100644
--- a/code/AssetLib/FBX/FBXTokenizer.h
+++ b/code/AssetLib/FBX/FBXTokenizer.h
@@ -154,7 +154,6 @@ private:
const unsigned int column;
};
-// XXX should use C++11's unique_ptr - but assimp's need to keep working with 03
typedef const Token* TokenPtr;
typedef std::vector< TokenPtr > TokenList;
diff --git a/code/AssetLib/HMP/HMPLoader.cpp b/code/AssetLib/HMP/HMPLoader.cpp
index 79fdae807..3dd27eb02 100644
--- a/code/AssetLib/HMP/HMPLoader.cpp
+++ b/code/AssetLib/HMP/HMPLoader.cpp
@@ -104,7 +104,7 @@ void HMPImporter::InternReadFile(const std::string &pFile,
std::unique_ptr file(mIOHandler->Open(pFile));
// Check whether we can read from the file
- if (file.get() == nullptr) {
+ if (file == nullptr) {
throw DeadlyImportError("Failed to open HMP file ", pFile, ".");
}
@@ -327,7 +327,7 @@ void HMPImporter::CreateMaterial(const unsigned char *szCurrent,
ReadFirstSkin(pcHeader->numskins, szCurrent, &szCurrent);
*szCurrentOut = szCurrent;
return;
- }
+ }
// generate a default material
const int iMode = (int)aiShadingMode_Gouraud;
@@ -484,11 +484,11 @@ void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned
if (uv == nullptr) {
return;
}
-
+
if (height == 0.0f || width == 0.0) {
return;
}
-
+
const float fY = (1.0f / height) + (1.0f / height) / height;
const float fX = (1.0f / width) + (1.0f / width) / width;
diff --git a/code/AssetLib/IFC/IFCBoolean.cpp b/code/AssetLib/IFC/IFCBoolean.cpp
index 64248b037..6baaf0687 100644
--- a/code/AssetLib/IFC/IFCBoolean.cpp
+++ b/code/AssetLib/IFC/IFCBoolean.cpp
@@ -388,8 +388,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const Schema_2x3::IfcPoly
n.Normalize();
// obtain the polygonal bounding volume
- std::shared_ptr profile = std::shared_ptr(new TempMesh());
- if (!ProcessCurve(hs->PolygonalBoundary, *profile.get(), conv)) {
+ std::shared_ptr profile = std::make_shared();
+ if (!ProcessCurve(hs->PolygonalBoundary, *profile, conv)) {
IFCImporter::LogError("expected valid polyline for boundary of boolean halfspace");
return;
}
@@ -672,7 +672,7 @@ void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedArea
// operand should be near-planar. Luckily, this is usually the case in Ifc
// buildings.
- std::shared_ptr meshtmp = std::shared_ptr(new TempMesh());
+ std::shared_ptr meshtmp = std::make_shared();
ProcessExtrudedAreaSolid(*as, *meshtmp, conv, false);
std::vector openings(1, TempOpening(as, IfcVector3(0, 0, 0), std::move(meshtmp), std::shared_ptr()));
diff --git a/code/AssetLib/IFC/IFCGeometry.cpp b/code/AssetLib/IFC/IFCGeometry.cpp
index 4b6fbfff2..798b0a123 100644
--- a/code/AssetLib/IFC/IFCGeometry.cpp
+++ b/code/AssetLib/IFC/IFCGeometry.cpp
@@ -610,7 +610,7 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te
nors.reserve(conv.apply_openings->size());
for(TempOpening& t : *conv.apply_openings) {
- TempMesh& bounds = *t.profileMesh.get();
+ TempMesh &bounds = *t.profileMesh;
if( bounds.mVerts.size() <= 2 ) {
nors.emplace_back();
@@ -787,7 +787,7 @@ bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned
const ::Assimp::STEP::EXPRESS::ENTITY& e = shell->To<::Assimp::STEP::EXPRESS::ENTITY>();
const Schema_2x3::IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To();
- ProcessConnectedFaceSet(fs,*meshtmp.get(),conv);
+ ProcessConnectedFaceSet(fs, *meshtmp, conv);
}
catch(std::bad_cast&) {
IFCImporter::LogWarn("unexpected type error, IfcShell ought to inherit from IfcConnectedFaceSet");
@@ -796,27 +796,27 @@ bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned
fix_orientation = true;
}
else if(const Schema_2x3::IfcConnectedFaceSet* fset = geo.ToPtr()) {
- ProcessConnectedFaceSet(*fset,*meshtmp.get(),conv);
+ ProcessConnectedFaceSet(*fset, *meshtmp, conv);
fix_orientation = true;
}
else if(const Schema_2x3::IfcSweptAreaSolid* swept = geo.ToPtr()) {
- ProcessSweptAreaSolid(*swept,*meshtmp.get(),conv);
+ ProcessSweptAreaSolid(*swept, *meshtmp, conv);
}
else if(const Schema_2x3::IfcSweptDiskSolid* disk = geo.ToPtr()) {
- ProcessSweptDiskSolid(*disk,*meshtmp.get(),conv);
+ ProcessSweptDiskSolid(*disk, *meshtmp, conv);
}
else if(const Schema_2x3::IfcManifoldSolidBrep* brep = geo.ToPtr()) {
- ProcessConnectedFaceSet(brep->Outer,*meshtmp.get(),conv);
+ ProcessConnectedFaceSet(brep->Outer, *meshtmp, conv);
fix_orientation = true;
}
else if(const Schema_2x3::IfcFaceBasedSurfaceModel* surf = geo.ToPtr()) {
for(const Schema_2x3::IfcConnectedFaceSet& fc : surf->FbsmFaces) {
- ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
+ ProcessConnectedFaceSet(fc, *meshtmp, conv);
}
fix_orientation = true;
}
else if(const Schema_2x3::IfcBooleanResult* boolean = geo.ToPtr()) {
- ProcessBoolean(*boolean,*meshtmp.get(),conv);
+ ProcessBoolean(*boolean, *meshtmp, conv);
}
else if(geo.ToPtr()) {
// silently skip over bounding boxes
diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp
index 599f08ee3..ee718681e 100644
--- a/code/AssetLib/IFC/IFCLoader.cpp
+++ b/code/AssetLib/IFC/IFCLoader.cpp
@@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
+#include
#include
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
@@ -72,8 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
template <>
const char *LogFunctions::Prefix() {
- static auto prefix = "IFC: ";
- return prefix;
+ return "IFC: ";
}
} // namespace Assimp
@@ -186,7 +186,7 @@ void IFCImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// get file size, etc.
unz_file_info fileInfo;
char filename[256];
- unzGetCurrentFileInfo(zip, &fileInfo, filename, sizeof(filename), 0, 0, 0, 0);
+ unzGetCurrentFileInfo(zip, &fileInfo, filename, sizeof(filename), nullptr, 0, nullptr, 0);
if (GetExtension(filename) != "ifc") {
continue;
}
@@ -211,7 +211,7 @@ void IFCImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
ThrowException("Failed to decompress IFC ZIP file");
}
unzCloseCurrentFile(zip);
- stream.reset(new MemoryIOStream(buff, fileInfo.uncompressed_size, true));
+ stream = std::make_shared(buff, fileInfo.uncompressed_size, true);
if (unzGoToNextFile(zip) == UNZ_END_OF_LIST_OF_FILE) {
ThrowException("Found no IFC file member in IFCZIP file (1)");
}
diff --git a/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp b/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp
index a6f7ae3eb..73e3c91d8 100644
--- a/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp
+++ b/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp
@@ -1065,28 +1065,28 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcRoo
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->GlobalId, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRoot to be a `IfcGloballyUniqueId`")); }
- } while(0);
+ } while (false);
do { // convert the 'OwnerHistory' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
try { GenericConvert( in->OwnerHistory, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRoot to be a `IfcOwnerHistory`")); }
- } while(0);
+ } while (false);
do { // convert the 'Name' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRoot to be a `IfcLabel`")); }
- } while(0);
+ } while (false);
do { // convert the 'Description' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRoot to be a `IfcText`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcObjectDefinition* in)
@@ -1152,28 +1152,28 @@ template <> size_t GenericFill(const DB& db, const LIST& para
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->ContextOfItems, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentation to be a `IfcRepresentationContext`")); }
- } while(0);
+ } while (false);
do { // convert the 'RepresentationIdentifier' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->RepresentationIdentifier, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentation to be a `IfcLabel`")); }
- } while(0);
+ } while (false);
do { // convert the 'RepresentationType' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->RepresentationType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRepresentation to be a `IfcLabel`")); }
- } while(0);
+ } while (false);
do { // convert the 'Items' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; }
try { GenericConvert( in->Items, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRepresentation to be a `SET [1:?] OF IfcRepresentationItem`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcShapeModel* in)
@@ -1239,8 +1239,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcO
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->ObjectType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcObject to be a `IfcLabel`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcControl* in)
@@ -1292,21 +1292,21 @@ template <> size_t GenericFill(const DB& db, const LIS
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProductRepresentation to be a `IfcLabel`")); }
- } while(0);
+ } while (false);
do { // convert the 'Description' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProductRepresentation to be a `IfcText`")); }
- } while(0);
+ } while (false);
do { // convert the 'Representations' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; }
try { GenericConvert( in->Representations, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcProductRepresentation to be a `LIST [1:?] OF IfcRepresentation`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcProduct* in)
@@ -1318,15 +1318,15 @@ template <> size_t GenericFill(const DB& db, const LIST& params, Ifc
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->ObjectPlacement, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcProduct to be a `IfcObjectPlacement`")); }
- } while(0);
+ } while (false);
do { // convert the 'Representation' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Representation, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcProduct to be a `IfcProductRepresentation`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcElement* in)
@@ -1338,8 +1338,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, Ifc
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Tag, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcElement to be a `IfcIdentifier`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcDistributionElement* in)
@@ -1376,14 +1376,14 @@ template <> size_t GenericFill(const DB& db, const LIST& para
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Segments, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCompositeCurve to be a `LIST [1:?] OF IfcCompositeCurveSegment`")); }
- } while(0);
+ } while (false);
do { // convert the 'SelfIntersect' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
try { GenericConvert( in->SelfIntersect, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcCompositeCurve to be a `LOGICAL`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, Ifc2DCompositeCurve* in)
@@ -1402,28 +1402,28 @@ template <> size_t GenericFill(const DB& db,
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Axis1, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCartesianTransformationOperator to be a `IfcDirection`")); }
- } while(0);
+ } while (false);
do { // convert the 'Axis2' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Axis2, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcCartesianTransformationOperator to be a `IfcDirection`")); }
- } while(0);
+ } while (false);
do { // convert the 'LocalOrigin' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; }
try { GenericConvert( in->LocalOrigin, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcCartesianTransformationOperator to be a `IfcCartesianPoint`")); }
- } while(0);
+ } while (false);
do { // convert the 'Scale' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Scale, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcCartesianTransformationOperator to be a `REAL`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcCartesianTransformationOperator3D* in)
@@ -1435,8 +1435,8 @@ template <> size_t GenericFill(const DB& d
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Axis3, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcCartesianTransformationOperator3D to be a `IfcDirection`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcProperty* in)
@@ -1447,15 +1447,15 @@ template <> size_t GenericFill(const DB& db, const LIST& params, If
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProperty to be a `IfcIdentifier`")); }
- } while(0);
+ } while (false);
do { // convert the 'Description' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
if (dynamic_cast(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProperty to be a `IfcText`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcSimpleProperty* in)
@@ -1499,8 +1499,8 @@ template <> size_t GenericFill(const DB& db, const LIST& p
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Position, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcElementarySurface to be a `IfcAxis2Placement3D`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcPlane* in)
@@ -1517,20 +1517,20 @@ template <> size_t GenericFill(const DB& db, const LIST& param
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Operator, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcBooleanResult to be a `IfcBooleanOperator`")); }
- } while(0);
+ } while (false);
do { // convert the 'FirstOperand' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; }
try { GenericConvert( in->FirstOperand, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcBooleanResult to be a `IfcBooleanOperand`")); }
- } while(0);
+ } while (false);
do { // convert the 'SecondOperand' argument
std::shared_ptr arg = params[base++];
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; }
try { GenericConvert( in->SecondOperand, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcBooleanResult to be a `IfcBooleanOperand`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcBooleanClippingResult* in)
@@ -1553,8 +1553,8 @@ template <> size_t GenericFill(const DB& db, const LIST& p
if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Outer, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcManifoldSolidBrep to be a `IfcClosedShell`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcFlowTerminalType* in)
@@ -1632,13 +1632,13 @@ template <> size_t GenericFill(const DB& db, const LIST& par
std::shared_ptr arg = params[base++];
try { GenericConvert( in->RelatingOpeningElement, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelFillsElement to be a `IfcOpeningElement`")); }
- } while(0);
+ } while (false);
do { // convert the 'RelatedBuildingElement' argument
std::shared_ptr arg = params[base++];
try { GenericConvert( in->RelatedBuildingElement, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelFillsElement to be a `IfcElement`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcProcedure* in)
@@ -1683,13 +1683,13 @@ template <> size_t GenericFill(const DB& db,
std::shared_ptr arg = params[base++];
try { GenericConvert( in->RelatedElements, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelContainedInSpatialStructure to be a `SET [1:?] OF IfcProduct`")); }
- } while(0);
+ } while (false);
do { // convert the 'RelatingStructure' argument
std::shared_ptr arg = params[base++];
try { GenericConvert( in->RelatingStructure, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelContainedInSpatialStructure to be a `IfcSpatialStructureElement`")); }
- } while(0);
- return base;
+ } while (false);
+ return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill(const DB& db, const LIST& params, IfcTopologicalRepresentationItem* in)
@@ -1774,8 +1774,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I
std::shared_ptr