reenable animation and skins exports
Currently incorrect, however. May need to be removedpull/1423/head
parent
f09892ab63
commit
ab08a7c3cb
|
@ -928,9 +928,11 @@ namespace glTF2
|
||||||
friend class AssetWriter;
|
friend class AssetWriter;
|
||||||
|
|
||||||
typedef typename std::gltf_unordered_map< unsigned int, unsigned int > Dict;
|
typedef typename std::gltf_unordered_map< unsigned int, unsigned int > Dict;
|
||||||
|
typedef typename std::gltf_unordered_map< std::string, unsigned int > IdDict;
|
||||||
|
|
||||||
std::vector<T*> mObjs; //! The read objects
|
std::vector<T*> mObjs; //! The read objects
|
||||||
Dict mObjsByOIndex; //! The read objects accessible by original index
|
Dict mObjsByOIndex; //! The read objects accessible by original index
|
||||||
|
IdDict mObjsById; //! The read objects accessible by id
|
||||||
const char* mDictId; //! ID of the dictionary object
|
const char* mDictId; //! ID of the dictionary object
|
||||||
const char* mExtId; //! ID of the extension defining the dictionary
|
const char* mExtId; //! ID of the extension defining the dictionary
|
||||||
Value* mDict; //! JSON dictionary object
|
Value* mDict; //! JSON dictionary object
|
||||||
|
@ -951,6 +953,7 @@ namespace glTF2
|
||||||
Ref<T> Retrieve(unsigned int i);
|
Ref<T> Retrieve(unsigned int i);
|
||||||
|
|
||||||
Ref<T> Get(unsigned int i);
|
Ref<T> Get(unsigned int i);
|
||||||
|
Ref<T> Get(const char* id);
|
||||||
|
|
||||||
Ref<T> Create(const char* id);
|
Ref<T> Create(const char* id);
|
||||||
Ref<T> Create(const std::string& id)
|
Ref<T> Create(const std::string& id)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -193,14 +193,6 @@ inline void LazyDict<T>::DetachFromDocument()
|
||||||
mDict = 0;
|
mDict = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
|
||||||
Ref<T> LazyDict<T>::Get(unsigned int i)
|
|
||||||
{
|
|
||||||
|
|
||||||
return Ref<T>(mObjs, i);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
Ref<T> LazyDict<T>::Retrieve(unsigned int i)
|
Ref<T> LazyDict<T>::Retrieve(unsigned int i)
|
||||||
{
|
{
|
||||||
|
@ -234,12 +226,34 @@ Ref<T> LazyDict<T>::Retrieve(unsigned int i)
|
||||||
return Add(inst);
|
return Add(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
Ref<T> LazyDict<T>::Get(unsigned int i)
|
||||||
|
{
|
||||||
|
|
||||||
|
return Ref<T>(mObjs, i);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
Ref<T> LazyDict<T>::Get(const char* id)
|
||||||
|
{
|
||||||
|
id = T::TranslateId(mAsset, id);
|
||||||
|
|
||||||
|
typename IdDict::iterator it = mObjsById.find(id);
|
||||||
|
if (it != mObjsById.end()) { // already created?
|
||||||
|
return Ref<T>(mObjs, it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw std::out_of_range("id \"" + std::string(id) + "\" Doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
Ref<T> LazyDict<T>::Add(T* obj)
|
Ref<T> LazyDict<T>::Add(T* obj)
|
||||||
{
|
{
|
||||||
unsigned int idx = unsigned(mObjs.size());
|
unsigned int idx = unsigned(mObjs.size());
|
||||||
mObjs.push_back(obj);
|
mObjs.push_back(obj);
|
||||||
mObjsByOIndex[obj->oIndex] = idx;
|
mObjsByOIndex[obj->oIndex] = idx;
|
||||||
|
mObjsById[obj->id] = idx;
|
||||||
mAsset.mUsedIds[obj->id] = true;
|
mAsset.mUsedIds[obj->id] = true;
|
||||||
return Ref<T>(mObjs, idx);
|
return Ref<T>(mObjs, idx);
|
||||||
}
|
}
|
||||||
|
@ -252,8 +266,10 @@ Ref<T> LazyDict<T>::Create(const char* id)
|
||||||
throw DeadlyImportError("GLTF: two objects with the same ID exist");
|
throw DeadlyImportError("GLTF: two objects with the same ID exist");
|
||||||
}
|
}
|
||||||
T* inst = new T();
|
T* inst = new T();
|
||||||
|
unsigned int idx = unsigned(mObjs.size());
|
||||||
inst->id = id;
|
inst->id = id;
|
||||||
inst->index = static_cast<int>(mObjs.size());
|
inst->index = idx;
|
||||||
|
inst->oIndex = idx;
|
||||||
return Add(inst);
|
return Add(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai
|
||||||
|
|
||||||
ExportScene();
|
ExportScene();
|
||||||
|
|
||||||
//ExportAnimations();
|
ExportAnimations();
|
||||||
|
|
||||||
AssetWriter writer(*mAsset);
|
AssetWriter writer(*mAsset);
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ Ref<Node> FindSkeletonRootJoint(Ref<Skin>& skinRef)
|
||||||
return parentNodeRef;
|
return parentNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buffer>& bufferRef, Ref<Skin>& skinRef, std::vector<aiMatrix4x4>& inverseBindMatricesData)
|
void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buffer>& bufferRef, Ref<Skin>& skinRef, std::vector<aiMatrix4x4>& inverseBindMatricesData)
|
||||||
{
|
{
|
||||||
if (aimesh->mNumBones < 1) {
|
if (aimesh->mNumBones < 1) {
|
||||||
return;
|
return;
|
||||||
|
@ -558,7 +558,7 @@ Ref<Node> FindSkeletonRootJoint(Ref<Skin>& skinRef)
|
||||||
delete[] jointsPerVertex;
|
delete[] jointsPerVertex;
|
||||||
delete[] vertexWeightData;
|
delete[] vertexWeightData;
|
||||||
delete[] vertexJointData;
|
delete[] vertexJointData;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void glTF2Exporter::ExportMeshes()
|
void glTF2Exporter::ExportMeshes()
|
||||||
{
|
{
|
||||||
|
@ -663,9 +663,9 @@ void glTF2Exporter::ExportMeshes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************** Skins ****************/
|
/*************** Skins ****************/
|
||||||
/*if(aim->HasBones()) {
|
if(aim->HasBones()) {
|
||||||
ExportSkin(*mAsset, aim, m, b, skinRef, inverseBindMatricesData);
|
ExportSkin(*mAsset, aim, m, b, skinRef, inverseBindMatricesData);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
@ -892,7 +892,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void glTF2Exporter::ExportAnimations()
|
void glTF2Exporter::ExportAnimations()
|
||||||
{
|
{
|
||||||
Ref<Buffer> bufferRef = mAsset->buffers.Get(unsigned (0));
|
Ref<Buffer> bufferRef = mAsset->buffers.Get(unsigned (0));
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} // End: for-loop mNumAnimations
|
} // End: for-loop mNumAnimations
|
||||||
} */
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_GLTF_EXPORTER
|
#endif // ASSIMP_BUILD_NO_GLTF_EXPORTER
|
||||||
|
|
Loading…
Reference in New Issue