+ add AI_CONFIG_IMPORT_NO_SKELETON_MESHES flag to control skeleton mesh visualization. No need for this in Blender, and difficult to just ignore the geometry created by it.

This commit is contained in:
Alexander Gessler
2012-06-21 17:24:50 +02:00
parent 43e19c682f
commit 4e9a0bba20
11 changed files with 68 additions and 12 deletions
+6 -1
View File
@@ -74,6 +74,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ASEImporter::ASEImporter()
: noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------
@@ -111,6 +112,8 @@ void ASEImporter::SetupProperties(const Importer* pImp)
{
configRecomputeNormals = (pImp->GetPropertyInteger(
AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS,1) ? true : false);
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
}
// ------------------------------------------------------------------------------------------------
@@ -244,7 +247,9 @@ void ASEImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------
if (!pScene->mNumMeshes) {
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
SkeletonMeshBuilder skeleton(pScene);
if (!noSkeletonMesh) {
SkeletonMeshBuilder skeleton(pScene);
}
}
}
// ------------------------------------------------------------------------------------------------
+1
View File
@@ -197,6 +197,7 @@ protected:
/** Config options: Recompute the normals in every case - WA
for 3DS Max broken ASE normal export */
bool configRecomputeNormals;
bool noSkeletonMesh;
};
} // end of namespace Assimp
+11 -2
View File
@@ -65,6 +65,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
BVHLoader::BVHLoader()
: noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------
@@ -89,6 +90,12 @@ bool BVHLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs
return false;
}
// ------------------------------------------------------------------------------------------------
void BVHLoader::SetupProperties(const Importer* pImp)
{
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
}
// ------------------------------------------------------------------------------------------------
// Loader meta information
const aiImporterDesc* BVHLoader::GetInfo () const
@@ -119,8 +126,10 @@ void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSys
mLine = 1;
ReadStructure( pScene);
// build a dummy mesh for the skeleton so that we see something at least
SkeletonMeshBuilder meshBuilder( pScene);
if (!noSkeletonMesh) {
// build a dummy mesh for the skeleton so that we see something at least
SkeletonMeshBuilder meshBuilder( pScene);
}
// construct an animation from all the motion data we read
CreateAnimation( pScene);
+3
View File
@@ -94,6 +94,7 @@ public:
* See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const;
void SetupProperties(const Importer* pImp);
const aiImporterDesc* GetInfo () const;
protected:
@@ -159,6 +160,8 @@ protected:
/** basic Animation parameters */
float mAnimTickDuration;
unsigned int mAnimNumFrames;
bool noSkeletonMesh;
};
} // end of namespace Assimp
+7 -3
View File
@@ -71,6 +71,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
CSMImporter::CSMImporter()
: noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------
@@ -104,9 +105,9 @@ const aiImporterDesc* CSMImporter::GetInfo () const
// ------------------------------------------------------------------------------------------------
// Setup configuration properties for the loader
void CSMImporter::SetupProperties(const Importer* /*pImp*/)
void CSMImporter::SetupProperties(const Importer* pImp)
{
// nothing to be done for the moment
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
}
// ------------------------------------------------------------------------------------------------
@@ -289,7 +290,10 @@ void CSMImporter::InternReadFile( const std::string& pFile,
// mark the scene as incomplete and run SkeletonMeshBuilder on it
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true);
if (!noSkeletonMesh) {
SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true);
}
}
#endif // !! ASSIMP_BUILD_NO_CSM_IMPORTER
+3
View File
@@ -79,6 +79,9 @@ protected:
IOSystem* pIOHandler);
private:
bool noSkeletonMesh;
}; // end of class CSMImporter
} // end of namespace Assimp
#endif // AI_AC3DIMPORTER_H_INC
+11 -1
View File
@@ -73,6 +73,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ColladaLoader::ColladaLoader()
: noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------
@@ -103,6 +104,13 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo
return false;
}
// ------------------------------------------------------------------------------------------------
void ColladaLoader::SetupProperties(const Importer* pImp)
{
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
}
// ------------------------------------------------------------------------------------------------
// Get file extension list
const aiImporterDesc* ColladaLoader::GetInfo () const
@@ -180,7 +188,9 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
// If no meshes have been loaded, it's probably just an animated skeleton.
if (!pScene->mNumMeshes) {
SkeletonMeshBuilder hero(pScene);
if (!noSkeletonMesh) {
SkeletonMeshBuilder hero(pScene);
}
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
}
}
+4
View File
@@ -94,6 +94,8 @@ protected:
*/
const aiImporterDesc* GetInfo () const;
void SetupProperties(const Importer* pImp);
/** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details
*/
@@ -230,6 +232,8 @@ protected:
/** Accumulated animations for the target scene */
std::vector<aiAnimation*> mAnims;
bool noSkeletonMesh;
};
} // end of namespace Assimp
+4 -1
View File
@@ -123,6 +123,7 @@ void LWS::Element::Parse (const char*& buffer)
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
LWSImporter::LWSImporter()
: noSkeletonMesh()
{
// nothing to do here
}
@@ -177,6 +178,8 @@ void LWSImporter::SetupProperties(const Importer* pImp)
if (last < first) {
std::swap(last,first);
}
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
}
// ------------------------------------------------------------------------------------------------
@@ -908,7 +911,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
if (!pScene->mNumMeshes || !pScene->mNumMaterials) {
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
if (pScene->mNumAnimations) {
if (pScene->mNumAnimations && !noSkeletonMesh) {
// construct skeleton mesh
SkeletonMeshBuilder builder(pScene);
}
+2
View File
@@ -233,6 +233,8 @@ private:
IOSystem* io;
double first,last,fps;
bool noSkeletonMesh;
};
} // end of namespace Assimp