Skip to content

Commit

Permalink
Merge branch 'master' into kimkulling-documentationfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Mar 21, 2018
2 parents efd4a6c + e2f1587 commit a531e4f
Show file tree
Hide file tree
Showing 24 changed files with 194 additions and 191 deletions.
2 changes: 1 addition & 1 deletion code/3DSConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
unsigned int idx( NotSet );
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
{
std::string s = mScene->mMaterials[i].mName;
std::string &s = mScene->mMaterials[i].mName;
for ( std::string::iterator it = s.begin(); it != s.end(); ++it ) {
*it = static_cast< char >( ::tolower( *it ) );
}
Expand Down
9 changes: 5 additions & 4 deletions code/AMFImporter_Postprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string&
TextureConverted_Index = 0;
for(const SPP_Texture& tex_convd: mTexture_Converted)
{
if(tex_convd.ID == TextureConverted_ID)
return TextureConverted_Index;
else
TextureConverted_Index++;
if ( tex_convd.ID == TextureConverted_ID ) {
return TextureConverted_Index;
} else {
++TextureConverted_Index;
}
}

//
Expand Down
26 changes: 13 additions & 13 deletions code/ASEParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ void Parser::Parse()
// at the file extension (ASE, ASK, ASC)
// *************************************************************

if (fmt)iFileFormat = fmt;
if ( fmt ) {
iFileFormat = fmt;
}
continue;
}
// main scene information
Expand Down Expand Up @@ -427,28 +429,25 @@ void Parser::ParseLV1SoftSkinBlock()
// Reserve enough storage
vert.mBoneWeights.reserve(numWeights);

for (unsigned int w = 0; w < numWeights;++w)
{
std::string bone;
std::string bone;
for (unsigned int w = 0; w < numWeights;++w) {
bone.clear();
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");

// Find the bone in the mesh's list
std::pair<int,ai_real> me;
me.first = -1;

for (unsigned int n = 0; n < curMesh->mBones.size();++n)
{
if (curMesh->mBones[n].mName == bone)
{
for (unsigned int n = 0; n < curMesh->mBones.size();++n) {
if (curMesh->mBones[n].mName == bone) {
me.first = n;
break;
}
}
if (-1 == me.first)
{
if (-1 == me.first) {
// We don't have this bone yet, so add it to the list
me.first = (int)curMesh->mBones.size();
curMesh->mBones.push_back(ASE::Bone(bone));
me.first = static_cast<int>( curMesh->mBones.size() );
curMesh->mBones.push_back( ASE::Bone( bone ) );
}
ParseLV4MeshFloat( me.second );

Expand Down Expand Up @@ -745,6 +744,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
// empty the texture won't be used later.
// ***********************************************************
bool parsePath = true;
std::string temp;
while (true)
{
if ('*' == *filePtr)
Expand All @@ -753,7 +753,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
// type of map
if (TokenMatch(filePtr,"MAP_CLASS" ,9))
{
std::string temp;
temp.clear();
if(!ParseString(temp,"*MAP_CLASS"))
SkipToNextToken();
if (temp != "Bitmap" && temp != "Normal Bump")
Expand Down
27 changes: 14 additions & 13 deletions code/BVHLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ aiNode* BVHLoader::ReadNode()
Node& internNode = mNodes.back();

// now read the node's contents
std::string siteToken;
while( 1)
{
std::string token = GetNextToken();
Expand All @@ -218,7 +219,8 @@ aiNode* BVHLoader::ReadNode()
else if( token == "End")
{
// The real symbol is "End Site". Second part comes in a separate token
std::string siteToken = GetNextToken();
siteToken.clear();
siteToken = GetNextToken();
if( siteToken != "Site")
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );

Expand Down Expand Up @@ -262,21 +264,18 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
aiNode* node = new aiNode( "EndSite_" + pParentName);

// now read the node's contents. Only possible entry is "OFFSET"
while( 1)
{
std::string token = GetNextToken();
std::string token;
while( 1) {
token.clear();
token = GetNextToken();

// end node's offset
if( token == "OFFSET")
{
if( token == "OFFSET") {
ReadNodeOffset( node);
}
else if( token == "}")
{
} else if( token == "}") {
// we're done with the end node
break;
} else
{
} else {
// everything else is a parse error
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
}
Expand All @@ -296,8 +295,10 @@ void BVHLoader::ReadNodeOffset( aiNode* pNode)
offset.z = GetNextTokenAsFloat();

// build a transformation matrix from it
pNode->mTransformation = aiMatrix4x4( 1.0f, 0.0f, 0.0f, offset.x, 0.0f, 1.0f, 0.0f, offset.y,
0.0f, 0.0f, 1.0f, offset.z, 0.0f, 0.0f, 0.0f, 1.0f);
pNode->mTransformation = aiMatrix4x4( 1.0f, 0.0f, 0.0f, offset.x,
0.0f, 1.0f, 0.0f, offset.y,
0.0f, 0.0f, 1.0f, offset.z,
0.0f, 0.0f, 0.0f, 1.0f);
}

// ------------------------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion code/BaseImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions) {
/* static */ bool BaseImporter::CheckMagicToken(IOSystem* pIOHandler, const std::string& pFile,
const void* _magic, unsigned int num, unsigned int offset, unsigned int size)
{
ai_assert(size <= 16 && _magic);
ai_assert( size <= 16 );
ai_assert( _magic );

if (!pIOHandler) {
return false;
Expand Down
14 changes: 9 additions & 5 deletions code/ColladaExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,15 +1269,18 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)

mOutput << startstr << "<animation id=\"" + idstrEscaped + "\" name=\"" + animation_name_escaped + "\">" << endstr;
PushTag();


std::string node_idstr;
for (size_t a = 0; a < anim->mNumChannels; ++a) {
const aiNodeAnim * nodeAnim = anim->mChannels[a];

// sanity check
if ( nodeAnim->mNumPositionKeys != nodeAnim->mNumScalingKeys || nodeAnim->mNumPositionKeys != nodeAnim->mNumRotationKeys ) continue;

{
const std::string node_idstr = nodeAnim->mNodeName.data + std::string("_matrix-input");
node_idstr.clear();
node_idstr += nodeAnim->mNodeName.data;
node_idstr += std::string( "_matrix-input" );

std::vector<ai_real> frames;
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
Expand All @@ -1289,12 +1292,14 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
}

{
const std::string node_idstr = nodeAnim->mNodeName.data + std::string("_matrix-output");
node_idstr.clear();

node_idstr += nodeAnim->mNodeName.data;
node_idstr += std::string("_matrix-output");

std::vector<ai_real> keyframes;
keyframes.reserve(nodeAnim->mNumPositionKeys * 16);
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {

aiVector3D Scaling = nodeAnim->mScalingKeys[i].mValue;
aiMatrix4x4 ScalingM; // identity
ScalingM[0][0] = Scaling.x; ScalingM[1][1] = Scaling.y; ScalingM[2][2] = Scaling.z;
Expand Down Expand Up @@ -1361,7 +1366,6 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
PopTag();
mOutput << startstr << "</source>" << endstr;
}

}

for (size_t a = 0; a < anim->mNumChannels; ++a) {
Expand Down
12 changes: 8 additions & 4 deletions code/ColladaLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
continue;

// now check all channels if they affect the current node
std::string targetID, subElement;
for( std::vector<Collada::AnimationChannel>::const_iterator cit = pSrcAnim->mChannels.begin();
cit != pSrcAnim->mChannels.end(); ++cit)
{
Expand All @@ -1147,7 +1148,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
}
if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos)
continue;
std::string targetID = srcChannel.mTarget.substr( 0, slashPos);

targetID.clear();
targetID = srcChannel.mTarget.substr( 0, slashPos);
if( targetID != srcNode->mID)
continue;

Expand All @@ -1160,7 +1163,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars

entry.mTransformId = srcChannel.mTarget.substr( slashPos+1, dotPos - slashPos - 1);

std::string subElement = srcChannel.mTarget.substr( dotPos+1);
subElement.clear();
subElement = srcChannel.mTarget.substr( dotPos+1);
if( subElement == "ANGLE")
entry.mSubElement = 3; // last number in an Axis-Angle-Transform is the angle
else if( subElement == "X")
Expand All @@ -1181,7 +1185,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
if (bracketPos != std::string::npos)
{
entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1);
std::string subElement = srcChannel.mTarget.substr(bracketPos);
subElement.clear();
subElement = srcChannel.mTarget.substr(bracketPos);

if (subElement == "(0)(0)")
entry.mSubElement = 0;
Expand Down Expand Up @@ -1215,7 +1220,6 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
entry.mSubElement = 14;
else if (subElement == "(3)(3)")
entry.mSubElement = 15;

}

// determine which transform step is affected by this channel
Expand Down
6 changes: 3 additions & 3 deletions code/D3MFExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,20 @@ void D3MFExporter::writeMetaData() {

void D3MFExporter::writeBaseMaterials() {
mModelOutput << "<basematerials id=\"1\">\n";
std::string strName, hexDiffuseColor , tmp;
for ( size_t i = 0; i < mScene->mNumMaterials; ++i ) {
aiMaterial *mat = mScene->mMaterials[ i ];
std::string strName;
aiString name;
if ( mat->Get( AI_MATKEY_NAME, name ) != aiReturn_SUCCESS ) {
strName = "basemat_" + to_string( i );
} else {
strName = name.C_Str();
}
std::string hexDiffuseColor;
aiColor4D color;
if ( mat->Get( AI_MATKEY_COLOR_DIFFUSE, color ) == aiReturn_SUCCESS ) {
hexDiffuseColor.clear();
tmp.clear();
hexDiffuseColor = "#";
std::string tmp;

tmp = DecimalToHexa( color.r );
hexDiffuseColor += tmp;
Expand Down
3 changes: 2 additions & 1 deletion code/D3MFImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ class XmlSerializer {
scene->mRootNode = new aiNode();
std::vector<aiNode*> children;

std::string nodeName;
while(ReadToEndElement(D3MF::XmlTag::model)) {
const std::string nodeName( xmlReader->getNodeName() );
nodeName = xmlReader->getNodeName();
if( nodeName == D3MF::XmlTag::object) {
children.push_back(ReadObject(scene));
} else if( nodeName == D3MF::XmlTag::build) {
Expand Down
4 changes: 2 additions & 2 deletions code/D3MFOpcPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ bool D3MFZipArchive::Exists(const char* pFile) const {
return false;
}

std::string rFile(pFile);
std::map<std::string, ZipFile*>::const_iterator it = m_ArchiveMap.find(rFile);
std::string filename(pFile);
std::map<std::string, ZipFile*>::const_iterator it = m_ArchiveMap.find(filename);
bool exist( false );
if(it != m_ArchiveMap.end()) {
exist = true;
Expand Down
1 change: 0 additions & 1 deletion code/DXFHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class LineReader
}

private:

LineSplitter splitter;
int groupcode;
std::string value;
Expand Down
5 changes: 2 additions & 3 deletions code/FBXConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1642,9 +1642,8 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
}

void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh )
{
const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh ) {
LayeredTextureMap::const_iterator it = layeredTextures.find( propName );
if ( it == layeredTextures.end() ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion code/Importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
if (s != std::string::npos) {
DefaultLogger::get()->info("File extension not known, trying signature-based detection");
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {

if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
imp = pimpl->mImporter[a];
break;
Expand Down Expand Up @@ -947,6 +946,7 @@ BaseImporter* Importer::GetImporter (const char* szExtension) const
size_t Importer::GetImporterIndex (const char* szExtension) const
{
ai_assert(szExtension);

ASSIMP_BEGIN_EXCEPTION_REGION();

// skip over wildcard and dot characters at string head --
Expand Down
5 changes: 2 additions & 3 deletions code/Importer/IFC/IFCLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,8 @@ typedef std::map<std::string, std::string> Metadata;

// ------------------------------------------------------------------------------------------------
void ProcessMetadata(const Schema_2x3::ListOf< Schema_2x3::Lazy< Schema_2x3::IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties,
const std::string& prefix = "",
unsigned int nest = 0)
{
const std::string& prefix = "",
unsigned int nest = 0) {
for(const Schema_2x3::IfcProperty& property : set) {
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
if (const Schema_2x3::IfcPropertySingleValue* const singleValue = property.ToPtr<Schema_2x3::IfcPropertySingleValue>()) {
Expand Down
Loading

0 comments on commit a531e4f

Please sign in to comment.