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

View File

@ -153,7 +153,9 @@ void FBXImporter::InternReadFile( const std::string& pFile,
TokenList tokens; TokenList tokens;
try { try {
bool is_binary = false;
if (!strncmp(begin,"Kaydara FBX Binary",18)) { if (!strncmp(begin,"Kaydara FBX Binary",18)) {
is_binary = true;
TokenizeBinary(tokens,begin,contents.size()); TokenizeBinary(tokens,begin,contents.size());
} }
else { else {
@ -162,7 +164,7 @@ void FBXImporter::InternReadFile( const std::string& pFile,
// use this information to construct a very rudimentary // use this information to construct a very rudimentary
// parse-tree representing the FBX scope structure // 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 // take the raw parse-tree and convert it to a FBX DOM
Document doc(parser,settings); 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) : tokens(tokens)
, last() , last()
, current() , current()
, cursor(tokens.begin()) , cursor(tokens.begin())
, is_binary(is_binary)
{ {
root.reset(new Scope(*this,true)); 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 - /** Parse given a token list. Does not take ownership of the tokens -
* the objects must persist during the entire parser lifetime */ * the objects must persist during the entire parser lifetime */
Parser (const TokenList& tokens); Parser (const TokenList& tokens,bool is_binary);
~Parser(); ~Parser();
public: public:
@ -171,6 +171,11 @@ public:
return *root.get(); return *root.get();
} }
bool IsBinary() const {
return is_binary;
}
private: private:
friend class Scope; friend class Scope;
@ -181,6 +186,8 @@ private:
TokenPtr LastToken() const; TokenPtr LastToken() const;
TokenPtr CurrentToken() const; TokenPtr CurrentToken() const;
private: private:
const TokenList& tokens; const TokenList& tokens;
@ -188,6 +195,8 @@ private:
TokenPtr last, current; TokenPtr last, current;
TokenList::const_iterator cursor; TokenList::const_iterator cursor;
boost::scoped_ptr<Scope> root; boost::scoped_ptr<Scope> root;
const bool is_binary;
}; };