+ 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.

pull/14/head
Alexander Gessler 2012-06-21 17:24:50 +02:00
parent 43e19c682f
commit 4e9a0bba20
11 changed files with 68 additions and 12 deletions

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,8 +247,10 @@ void ASEImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------
if (!pScene->mNumMeshes) {
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
if (!noSkeletonMesh) {
SkeletonMeshBuilder skeleton(pScene);
}
}
}
// ------------------------------------------------------------------------------------------------
void ASEImporter::GenerateDefaultMaterial()

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

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);
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);

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

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;
if (!noSkeletonMesh) {
SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true);
}
}
#endif // !! ASSIMP_BUILD_NO_CSM_IMPORTER

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

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) {
if (!noSkeletonMesh) {
SkeletonMeshBuilder hero(pScene);
}
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
}
}

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

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);
}

View File

@ -233,6 +233,8 @@ private:
IOSystem* io;
double first,last,fps;
bool noSkeletonMesh;
};
} // end of namespace Assimp

View File

@ -77,6 +77,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_CONFIG_GLOB_MEASURE_TIME \
"GLOB_MEASURE_TIME"
// ---------------------------------------------------------------------------
/** @brief Global setting to disable generation of skeleton dummy meshes
*
* Skeleton dummy meshes are generated as a visualization aid in cases which
* the input data contains no geometry, but only animation data.
* Property data type: bool. Default value: false
*/
// ---------------------------------------------------------------------------
#define AI_CONFIG_IMPORT_NO_SKELETON_MESHES \
"IMPORT_NO_SKELETON_MESHES"
# if 0 // not implemented yet
// ---------------------------------------------------------------------------
/** @brief Set Assimp's multithreading policy.
@ -158,6 +172,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE \
"PP_GSN_MAX_SMOOTHING_ANGLE"
// ---------------------------------------------------------------------------
/** @brief Sets the colormap (= palette) to be used to decode embedded
* textures in MDL (Quake or 3DGS) files.
@ -697,9 +712,6 @@ enum aiComponent
*/
#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME"
// ---------------------------------------------------------------------------
/** @brief Specifies whether the IFC loader skips over IfcSpace elements.
*
* IfcSpace elements (and their geometric representations) are used to