- fbx: read first set of header properties (format version, timestamp etc).
parent
e4aee83c5b
commit
1a9790ae9a
|
@ -468,6 +468,12 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
|
||||||
: parser(parser)
|
: parser(parser)
|
||||||
, settings(settings)
|
, settings(settings)
|
||||||
{
|
{
|
||||||
|
// cannot use array default initialization syntax because vc8 fails on it
|
||||||
|
for (unsigned int i = 0; i < 7; ++i) {
|
||||||
|
creationTimeStamp[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadHeader();
|
||||||
ReadPropertyTemplates();
|
ReadPropertyTemplates();
|
||||||
|
|
||||||
// this order is important, connections need parsed objects to check
|
// this order is important, connections need parsed objects to check
|
||||||
|
@ -487,6 +493,38 @@ Document::~Document()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void Document::ReadHeader()
|
||||||
|
{
|
||||||
|
// read ID objects from "Objects" section
|
||||||
|
const Scope& sc = parser.GetRootScope();
|
||||||
|
const Element* const ehead = sc["FBXHeaderExtension"];
|
||||||
|
if(!ehead || !ehead->Compound()) {
|
||||||
|
DOMError("no FBXHeaderExtension dictionary found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const Scope& shead = *ehead->Compound();
|
||||||
|
fbxVersion = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(shead,"FBXVersion",ehead),0));
|
||||||
|
|
||||||
|
const Element* const ecreator = shead["Creator"];
|
||||||
|
if(ecreator) {
|
||||||
|
creator = ParseTokenAsString(GetRequiredToken(*ecreator,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Element* const etimestamp = shead["CreationTimeStamp"];
|
||||||
|
if(etimestamp && etimestamp->Compound()) {
|
||||||
|
const Scope& stimestamp = *etimestamp->Compound();
|
||||||
|
creationTimeStamp[0] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Year"),0));
|
||||||
|
creationTimeStamp[1] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Month"),0));
|
||||||
|
creationTimeStamp[2] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Day"),0));
|
||||||
|
creationTimeStamp[3] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Hour"),0));
|
||||||
|
creationTimeStamp[4] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Minute"),0));
|
||||||
|
creationTimeStamp[5] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Second"),0));
|
||||||
|
creationTimeStamp[6] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Millisecond"),0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Document::ReadObjects()
|
void Document::ReadObjects()
|
||||||
{
|
{
|
||||||
|
|
|
@ -477,6 +477,20 @@ public:
|
||||||
|
|
||||||
LazyObject* GetObject(uint64_t id) const;
|
LazyObject* GetObject(uint64_t id) const;
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int FBXVersion() const {
|
||||||
|
return fbxVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& Creator() const {
|
||||||
|
return creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
// elements (in this order): Uear, Month, Day, Hour, Second, Millisecond
|
||||||
|
const unsigned int* CreationTimeStamp() const {
|
||||||
|
return creationTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
const PropertyTemplateMap& Templates() const {
|
const PropertyTemplateMap& Templates() const {
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
@ -502,6 +516,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void ReadHeader();
|
||||||
void ReadObjects();
|
void ReadObjects();
|
||||||
void ReadPropertyTemplates();
|
void ReadPropertyTemplates();
|
||||||
void ReadConnections();
|
void ReadConnections();
|
||||||
|
@ -516,6 +531,11 @@ private:
|
||||||
PropertyTemplateMap templates;
|
PropertyTemplateMap templates;
|
||||||
ConnectionMap src_connections;
|
ConnectionMap src_connections;
|
||||||
ConnectionMap dest_connections;
|
ConnectionMap dest_connections;
|
||||||
|
|
||||||
|
unsigned int fbxVersion;
|
||||||
|
std::string creator;
|
||||||
|
unsigned int creationTimeStamp[7];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue