From 20acce1c5ef55cd94cd078388ee2d9bdfcb375d4 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 4 Apr 2019 16:31:34 +0200 Subject: [PATCH] Suggested fix for issue : If available, use "Scaling" and "Translation" instead of "ModelUVScaling" and "ModelUVTranslation". This seems to be what 3DS Max and FBX SDK use. --- code/FBXMaterial.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/code/FBXMaterial.cpp b/code/FBXMaterial.cpp index f5f6fda03..fa3778d67 100644 --- a/code/FBXMaterial.cpp +++ b/code/FBXMaterial.cpp @@ -206,6 +206,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());