From 52916b094c331da5ea615d095adb8d5d3371e23e Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Thu, 6 Feb 2014 12:55:52 +0900 Subject: [PATCH 1/5] remove SkipSpaceAndLineEnd after parsing end_header in PlyParser.cpp --- code/PlyParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 792392511..8b0aa111c 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -458,7 +458,8 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) SkipLine(&pCur); } } - SkipSpacesAndLineEnd(pCur,&pCur); + // Is this needed ? it can't work as expected, if binary data start with values as space or line end. + // SkipSpacesAndLineEnd(pCur,&pCur); *pCurOut = pCur; DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); From 8e35ea59d520a3449793e50f678af3a14b8cd140 Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Fri, 7 Feb 2014 10:38:49 +0900 Subject: [PATCH 2/5] check binary or not in ParseHeader in PlyParser --- code/PlyParser.cpp | 13 +++++++------ code/PlyParser.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 8b0aa111c..43563ec4d 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -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 p_bBE) { ai_assert(NULL != pCur && NULL != pCurOut); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); @@ -458,9 +458,10 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) SkipLine(&pCur); } } - // Is this needed ? it can't work as expected, if binary data start with values as space or line end. - // SkipSpacesAndLineEnd(pCur,&pCur); - *pCurOut = pCur; + if(!p_bBE) + { // it would occur an error, if binary data start with values as space or line end. + SkipSpacesAndLineEnd(pCur,&pCur); + } DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); return true; @@ -528,7 +529,7 @@ bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE) DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); - if(!p_pcOut->ParseHeader(pCur,&pCur)) + if(!p_pcOut->ParseHeader(pCur,&pCur,p_bBE)) { DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); return false; @@ -551,7 +552,7 @@ bool PLY::DOM::ParseInstance (const char* pCur,DOM* p_pcOut) 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"); return false; diff --git a/code/PlyParser.h b/code/PlyParser.h index d02e39d85..47ea1c265 100644 --- a/code/PlyParser.h +++ b/code/PlyParser.h @@ -434,7 +434,7 @@ private: // ------------------------------------------------------------------- //! 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 From 99e4176576461409931c38ea81623b19fafc6d7b Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Tue, 18 Feb 2014 02:14:07 +0900 Subject: [PATCH 3/5] fix using flag --- code/PlyParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 43563ec4d..51a0379fe 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -427,7 +427,7 @@ bool PLY::DOM::SkipComments (const char* pCur, } // ------------------------------------------------------------------------------------------------ -bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool p_bBE) +bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary) { ai_assert(NULL != pCur && NULL != pCurOut); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); @@ -458,7 +458,7 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool p_bBE) SkipLine(&pCur); } } - if(!p_bBE) + if(!isBinary) { // it would occur an error, if binary data start with values as space or line end. SkipSpacesAndLineEnd(pCur,&pCur); } @@ -529,7 +529,7 @@ bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE) DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); - if(!p_pcOut->ParseHeader(pCur,&pCur,p_bBE)) + if(!p_pcOut->ParseHeader(pCur,&pCur,true)) { DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); return false; From 2db48ef532a5c3806f1483342de72e547546b5da Mon Sep 17 00:00:00 2001 From: George Papadopoulos Date: Sun, 23 Feb 2014 12:27:34 +0200 Subject: [PATCH 4/5] [FBX] Do not rename nodes if they are marked as null in fbx. Preserve this information in node metadata. Use can use node.Metadata.Get("IsNull") to check. (returns "true" or "false") --- code/FBXConverter.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index e9d680a0c..c2ad4daf3 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -62,7 +62,6 @@ namespace FBX { #define MAGIC_NODE_TAG "_$AssimpFbx$" -#define MAGIC_NULL_TAG "_$AssimpFbxNull$" #define CONVERT_FBX_TIME(time) static_cast(time) / 46186158000L @@ -95,7 +94,13 @@ public: TransformationComp_MAXIMUM }; + enum MetadataKeys + { + MetadataKeys_UserProperties = 0, + MetadataKeys_IsNull, + MetadataKeys_MAXIMUM + }; public: @@ -257,14 +262,6 @@ private: 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_chain.clear(); } @@ -764,20 +761,20 @@ private: { const PropertyTable& props = model.Props(); - // find user defined properties - const std::string& userProps = PropertyGet(props, "UDP3DSMAX", ""); - - //setup metadata //TODO: make metadata more friendly (eg. have Add()/Remove() functions to be easier to use) + //create metadata on node aiMetadata* data = new aiMetadata(); - data->mNumProperties = 1; + data->mNumProperties = MetadataKeys_MAXIMUM; data->mKeys = 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; + + // find user defined properties + data->mKeys[MetadataKeys_UserProperties].Set("UserProperties"); + data->mValues[MetadataKeys_UserProperties].Set(PropertyGet(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"); } // ------------------------------------------------------------------------------------------------ From 08324b80954f3542c42941719b2837c3bc6d6348 Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Sat, 1 Mar 2014 20:34:57 +0900 Subject: [PATCH 5/5] fix miss commit at 8e35ea59d520a3449793e50f678af3a14b8cd140 --- code/PlyParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 51a0379fe..67f5b0bc8 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -462,6 +462,7 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary) { // it would occur an error, if binary data start with values as space or line end. SkipSpacesAndLineEnd(pCur,&pCur); } + *pCurOut = pCur; DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); return true;