Merge remote-tracking branch 'official/master' into contrib

pull/261/head
Léo Terziman 2014-03-03 12:47:45 +01:00
commit 172c917c37
3 changed files with 24 additions and 24 deletions

View File

@ -62,7 +62,6 @@ namespace FBX {
#define MAGIC_NODE_TAG "_$AssimpFbx$" #define MAGIC_NODE_TAG "_$AssimpFbx$"
#define MAGIC_NULL_TAG "_$AssimpFbxNull$"
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L #define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
@ -95,7 +94,13 @@ public:
TransformationComp_MAXIMUM TransformationComp_MAXIMUM
}; };
enum MetadataKeys
{
MetadataKeys_UserProperties = 0,
MetadataKeys_IsNull,
MetadataKeys_MAXIMUM
};
public: public:
@ -257,14 +262,6 @@ private:
ConvertCameras(*model); ConvertCameras(*model);
} }
// preserve the info that a node was marked as Null node
// in the original file.
if(model->IsNull()) {
const std::string& new_name = original_name + MAGIC_NULL_TAG;
RenameNode(original_name, new_name);
name_carrier->mName.Set( new_name.c_str() );
}
nodes.push_back(nodes_chain.front()); nodes.push_back(nodes_chain.front());
nodes_chain.clear(); nodes_chain.clear();
} }
@ -764,20 +761,20 @@ private:
{ {
const PropertyTable& props = model.Props(); const PropertyTable& props = model.Props();
// find user defined properties //create metadata on node
const std::string& userProps = PropertyGet<std::string>(props, "UDP3DSMAX", "");
//setup metadata //TODO: make metadata more friendly (eg. have Add()/Remove() functions to be easier to use)
aiMetadata* data = new aiMetadata(); aiMetadata* data = new aiMetadata();
data->mNumProperties = 1; data->mNumProperties = MetadataKeys_MAXIMUM;
data->mKeys = new aiString[data->mNumProperties](); data->mKeys = new aiString[data->mNumProperties]();
data->mValues = new aiString[data->mNumProperties](); data->mValues = new aiString[data->mNumProperties]();
//add user properties
data->mKeys[0].Set("UserProperties");
data->mValues[0].Set(userProps);
nd.mMetaData = data; nd.mMetaData = data;
// find user defined properties
data->mKeys[MetadataKeys_UserProperties].Set("UserProperties");
data->mValues[MetadataKeys_UserProperties].Set(PropertyGet<std::string>(props, "UDP3DSMAX", ""));
// preserve the info that a node was marked as Null node in the original file.
data->mKeys[MetadataKeys_IsNull].Set("IsNull");
data->mValues[MetadataKeys_IsNull].Set(model.IsNull() ? "true" : "false");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -427,7 +427,7 @@ bool PLY::DOM::SkipComments (const char* pCur,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary)
{ {
ai_assert(NULL != pCur && NULL != pCurOut); ai_assert(NULL != pCur && NULL != pCurOut);
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
@ -458,7 +458,10 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut)
SkipLine(&pCur); SkipLine(&pCur);
} }
} }
SkipSpacesAndLineEnd(pCur,&pCur); if(!isBinary)
{ // it would occur an error, if binary data start with values as space or line end.
SkipSpacesAndLineEnd(pCur,&pCur);
}
*pCurOut = pCur; *pCurOut = pCur;
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded");
@ -527,7 +530,7 @@ bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE)
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
if(!p_pcOut->ParseHeader(pCur,&pCur)) if(!p_pcOut->ParseHeader(pCur,&pCur,true))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure");
return false; return false;
@ -550,7 +553,7 @@ bool PLY::DOM::ParseInstance (const char* pCur,DOM* p_pcOut)
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin");
if(!p_pcOut->ParseHeader(pCur,&pCur)) if(!p_pcOut->ParseHeader(pCur,&pCur,false))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure"); DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
return false; return false;

View File

@ -434,7 +434,7 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Handle the file header and read all element descriptions //! Handle the file header and read all element descriptions
bool ParseHeader (const char* pCur,const char** pCurOut); bool ParseHeader (const char* pCur,const char** pCurOut, bool p_bBE);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Read in all element instance lists //! Read in all element instance lists