|
enum | TextFileMode { ALLOW_EMPTY,
FORBID_EMPTY
} |
|
static bool | CheckMagicToken (IOSystem *pIOHandler, const std::string &pFile, const void *magic, unsigned int num, unsigned int offset=0, unsigned int size=4) |
| Check whether a file starts with one or more magic tokens. More...
|
|
static void | ConvertToUTF8 (std::vector< char > &data) |
| An utility for all text file loaders. More...
|
|
static void | ConvertUTF8toISO8859_1 (std::string &data) |
| An utility for all text file loaders. More...
|
|
template<typename T > |
static AI_FORCE_INLINE void | CopyVector (std::vector< T > &vec, T *&out, unsigned int &outLength) |
| Utility function to move a std::vector into a aiScene array. More...
|
|
static std::string | GetExtension (const std::string &pFile) |
| Extract file extension from a string. More...
|
|
static bool | SearchFileHeaderForToken (IOSystem *pIOSystem, const std::string &file, const char **tokens, unsigned int numTokens, unsigned int searchBytes=200, bool tokensSol=false) |
| A utility for CanRead(). More...
|
|
static bool | SimpleExtensionCheck (const std::string &pFile, const char *ext0, const char *ext1=NULL, const char *ext2=NULL) |
| Check whether a file has a specific file extension. More...
|
|
static void | TextFileToBuffer (IOStream *stream, std::vector< char > &data, TextFileMode mode=FORBID_EMPTY) |
| Utility for text file loaders which copies the contents of the file into a memory buffer and converts it to our UTF8 representation. More...
|
|
static void | LogDebug (const char *message) |
|
static void | LogDebug (const Formatter::format &message) |
|
static void | LogError (const char *message) |
|
static void | LogError (const Formatter::format &message) |
|
static void | LogInfo (const char *message) |
|
static void | LogInfo (const Formatter::format &message) |
|
static void | LogWarn (const char *message) |
|
static void | LogWarn (const Formatter::format &message) |
|
static void | ThrowException (const std::string &msg) |
|
std::string | m_ErrorText |
| Error description in case there was one. More...
|
|
ProgressHandler * | m_progress |
| Currently set progress handler. More...
|
|
Load blenders official binary format.
The actual file structure (the DNA
how they call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the conversion from intermediate format to aiScene.
bool BlenderImporter::CanRead |
( |
const std::string & |
pFile, |
|
|
IOSystem * |
pIOHandler, |
|
|
bool |
checkSig |
|
) |
| const |
|
virtual |
Returns whether the class can handle the format of the given file.
The implementation should be as quick as possible. A check for the file extension is enough. If no suitable loader is found with this strategy, CanRead() is called again, the 'checkSig' parameter set to true this time. Now the implementation is expected to perform a full check of the file structure, possibly searching the first bytes of the file for magic identifiers or keywords.
- Parameters
-
pFile | Path and file name of the file to be examined. |
pIOHandler | The IO handler to use for accessing any file. |
checkSig | Set to true if this method is called a second time. This time, the implementation may take more time to examine the contents of the file to be loaded for magic bytes, keywords, etc to be able to load files with unknown/not existent file extensions. |
- Returns
- true if the class can read this file, false if not.
Implements Assimp::BaseImporter.
void BlenderImporter::InternReadFile |
( |
const std::string & |
pFile, |
|
|
aiScene * |
pScene, |
|
|
IOSystem * |
pIOHandler |
|
) |
| |
|
protectedvirtual |
Imports the given file into the given scene structure.
The function is expected to throw an ImportErrorException if there is an error. If it terminates normally, the data in aiScene is expected to be correct. Override this function to implement the actual importing.
The output scene must meet the following requirements:
-
At least a root node must be there, even if its only purpose is to reference one mesh.
-
aiMesh::mPrimitiveTypes may be 0. The types of primitives in the mesh are determined automatically in this case.
-
the vertex data is stored in a pseudo-indexed "verbose" format. In fact this means that every vertex that is referenced by a face is unique. Or the other way round: a vertex index may not occur twice in a single aiMesh.
-
aiAnimation::mDuration may be -1. Assimp determines the length of the animation automatically in this case as the length of the longest animation channel.
-
aiMesh::mBitangents may be NULL if tangents and normals are given. In this case bitangents are computed as the cross product between normal and tangent.
-
There needn't be a material. If none is there a default material is generated. However, it is recommended practice for loaders to generate a default material for yourself that matches the default material setting for the file format better than Assimp's generic default material. Note that default materials should be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy) texture.
If the AI_SCENE_FLAGS_INCOMPLETE-Flag is not set:
-
at least one mesh must be there
-
there may be no meshes with 0 vertices or faces
This won't be checked (except by the validation step): Assimp will crash if one of the conditions is not met!
- Parameters
-
pFile | Path of the file to be imported. |
pScene | The scene object to hold the imported data. NULL is not a valid parameter. |
pIOHandler | The IO handler to use for any file access. NULL is not a valid parameter. |
Implements Assimp::BaseImporter.