From cc72bc6713bd1a2464f32d66f0a081d4f426c27f Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Mon, 8 Apr 2019 09:25:45 -0700 Subject: Update Assimp to master at d3d98a7ec0c8d38e1952b46dfe53f7e9233dc92d * ASCII FBX embedded content * Improved uv scaling metadata --- thirdparty/assimp/code/FBXMaterial.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'thirdparty/assimp/code/FBXMaterial.cpp') diff --git a/thirdparty/assimp/code/FBXMaterial.cpp b/thirdparty/assimp/code/FBXMaterial.cpp index 08347740fa..f16f134404 100644 --- a/thirdparty/assimp/code/FBXMaterial.cpp +++ b/thirdparty/assimp/code/FBXMaterial.cpp @@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include // std::transform +#include "FBXUtil.h" namespace Assimp { namespace FBX { @@ -206,6 +207,20 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const props = GetPropertyTable(doc,"Texture.FbxFileTexture",element,sc); + // 3DS Max and FBX SDK use "Scaling" and "Translation" instead of "ModelUVScaling" and "ModelUVTranslation". Use these properties if available. + bool ok; + const aiVector3D& scaling = PropertyGet(*props, "Scaling", ok); + if (ok) { + uvScaling.x = scaling.x; + uvScaling.y = scaling.y; + } + + const aiVector3D& trans = PropertyGet(*props, "Translation", ok); + if (ok) { + uvTrans.x = trans.x; + uvTrans.y = trans.y; + } + // resolve video links if(doc.Settings().readTextures) { const std::vector& conns = doc.GetConnectionsByDestinationSequenced(ID()); @@ -307,7 +322,22 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std const Token& token = GetRequiredToken(*Content, 0); const char* data = token.begin(); if (!token.IsBinary()) { - DOMWarning("video content is not binary data, ignoring", &element); + if (*data != '"') { + DOMError("embedded content is not surrounded by quotation marks", &element); + } + else { + const char* encodedData = data + 1; + size_t encodedDataLen = static_cast(token.end() - token.begin()); + // search for last quotation mark + while (encodedDataLen > 1 && encodedData[encodedDataLen] != '"') + encodedDataLen--; + if (encodedDataLen % 4 != 0) { + DOMError("embedded content is invalid, needs to be in base64", &element); + } + else { + contentLength = Util::DecodeBase64(encodedData, encodedDataLen, content); + } + } } else if (static_cast(token.end() - data) < 5) { DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element); -- cgit v1.2.3