first pass at collada metadata

pull/2417/head
RichardTea 2019-04-08 17:11:50 +01:00
parent 2a3626577f
commit d66166675a
3 changed files with 24 additions and 2 deletions

View File

@ -207,6 +207,12 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
0, 0, 0, 1);
}
// Store scene metadata
for (auto it = parser.mAssetMetaData.cbegin(); it != parser.mAssetMetaData.cend(); ++it)
{
pScene->mMetaData->Add((*it).first, (*it).second);
}
// store all meshes
StoreSceneMeshes( pScene);

View File

@ -264,9 +264,22 @@ void ColladaParser::ReadAssetInfo()
// check element end
TestClosing( "up_axis");
} else
}
else if(IsElement("contributor"))
{
SkipElement();
// This has no data of its own, will get children next time through
}
else
{
const char* metadata_key = mReader->getNodeName();
const char* metadata_value = TestTextContent();
if (metadata_key != nullptr && metadata_value != nullptr)
{
aiString aistr;
aistr.Set(metadata_value);
mAssetMetaData.emplace(metadata_key, aistr);
}
//SkipElement();
}
}
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)

View File

@ -343,6 +343,9 @@ namespace Assimp
/** Which is the up vector */
enum { UP_X, UP_Y, UP_Z } mUpDirection;
typedef std::map<std::string, aiString> AssetMetaData;
AssetMetaData mAssetMetaData;
/** Collada file format version */
Collada::FormatVersion mFormat;
};