Skip to content

Commit

Permalink
Merge branch 'bug-3177-dae-geo-id' into bug-3201-collada_root_meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardTea committed May 5, 2020
2 parents 8e73984 + d1ae6ac commit 6e447b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions code/AssetLib/Collada/ColladaExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@ void ColladaExporter::WriteFloatArray(const std::string &pIdString, FloatDataTyp
// ------------------------------------------------------------------------------------------------
// Writes the scene library
void ColladaExporter::WriteSceneLibrary() {
const std::string sceneName = GetNodeUniqueId(mScene->mRootNode);
const std::string sceneId = GetNodeName(mScene->mRootNode);
const std::string sceneId = GetNodeUniqueId(mScene->mRootNode);
const std::string sceneName = GetNodeName(mScene->mRootNode);

mOutput << startstr << "<library_visual_scenes>" << endstr;
PushTag();
Expand Down
6 changes: 4 additions & 2 deletions code/AssetLib/X3D/X3DImporter_Postprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,10 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
// Add an element according to its type.
if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean)
{
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0)
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin()));
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0) {
const bool v = (bool) *( ( (CX3DImporter_NodeElement_MetaBoolean*) cur_meta )->Value.begin());
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, v);
}
}
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble)
{
Expand Down
15 changes: 14 additions & 1 deletion include/assimp/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ typedef enum aiMetadataType {
struct aiMetadataEntry {
aiMetadataType mType;
void *mData;

#ifdef __cplusplus
aiMetadataEntry() :
mType(AI_META_MAX),
mData( nullptr ) {
// empty
}
#endif
};

#ifdef __cplusplus
Expand Down Expand Up @@ -313,8 +321,13 @@ struct aiMetadata {

// Set metadata type
mValues[index].mType = GetAiType(value);

// Copy the given value to the dynamic storage
mValues[index].mData = new T(value);
if (nullptr != mValues[index].mData) {
::memcpy(mValues[index].mData, &value, sizeof(T));
} else {
mValues[index].mData = new T(value);
}

return true;
}
Expand Down

0 comments on commit 6e447b2

Please sign in to comment.