+ fbx: Parser::IsBinary(), Document::IsBinary()

pull/14/head
Alexander Gessler 2012-08-10 21:39:47 +02:00
parent 49cfcf4c07
commit 729e98fef0
4 changed files with 27 additions and 6 deletions

View File

@ -886,6 +886,9 @@ public:
LazyObject* GetObject(uint64_t id) const;
bool IsBinary() const {
return parser.IsBinary();
}
unsigned int FBXVersion() const {
return fbxVersion;
@ -932,15 +935,21 @@ public:
std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, const char* classname) const;
std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, const char* classname) const;
std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, const char* const* classnames, size_t count) const;
std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, const char* const* classnames, size_t count) const;
std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source,
const char* const* classnames, size_t count) const;
std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest,
const char* const* classnames,
size_t count) const;
const std::vector<const AnimationStack*>& AnimationStacks() const;
private:
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, const ConnectionMap&) const;
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src, const ConnectionMap&, const char* const* classnames, size_t count) const;
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src,
const ConnectionMap&,
const char* const* classnames,
size_t count) const;
private:

View File

@ -153,7 +153,9 @@ void FBXImporter::InternReadFile( const std::string& pFile,
TokenList tokens;
try {
bool is_binary = false;
if (!strncmp(begin,"Kaydara FBX Binary",18)) {
is_binary = true;
TokenizeBinary(tokens,begin,contents.size());
}
else {
@ -162,7 +164,7 @@ void FBXImporter::InternReadFile( const std::string& pFile,
// use this information to construct a very rudimentary
// parse-tree representing the FBX scope structure
Parser parser(tokens);
Parser parser(tokens, is_binary);
// take the raw parse-tree and convert it to a FBX DOM
Document doc(parser,settings);

View File

@ -163,11 +163,12 @@ Scope::~Scope()
// ------------------------------------------------------------------------------------------------
Parser::Parser (const TokenList& tokens)
Parser::Parser (const TokenList& tokens, bool is_binary)
: tokens(tokens)
, last()
, current()
, cursor(tokens.begin())
, is_binary(is_binary)
{
root.reset(new Scope(*this,true));
}

View File

@ -162,7 +162,7 @@ public:
/** Parse given a token list. Does not take ownership of the tokens -
* the objects must persist during the entire parser lifetime */
Parser (const TokenList& tokens);
Parser (const TokenList& tokens,bool is_binary);
~Parser();
public:
@ -171,6 +171,11 @@ public:
return *root.get();
}
bool IsBinary() const {
return is_binary;
}
private:
friend class Scope;
@ -181,6 +186,8 @@ private:
TokenPtr LastToken() const;
TokenPtr CurrentToken() const;
private:
const TokenList& tokens;
@ -188,6 +195,8 @@ private:
TokenPtr last, current;
TokenList::const_iterator cursor;
boost::scoped_ptr<Scope> root;
const bool is_binary;
};