You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Update Assimp to master at d3d98a7ec0c8d38e1952b46dfe53f7e9233dc92d
* ASCII FBX embedded content * Improved uv scaling metadata
This commit is contained in:
32
thirdparty/assimp/code/FBXMaterial.cpp
vendored
32
thirdparty/assimp/code/FBXMaterial.cpp
vendored
@@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/ByteSwapper.h>
|
||||
|
||||
#include <algorithm> // 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<aiVector3D>(*props, "Scaling", ok);
|
||||
if (ok) {
|
||||
uvScaling.x = scaling.x;
|
||||
uvScaling.y = scaling.y;
|
||||
}
|
||||
|
||||
const aiVector3D& trans = PropertyGet<aiVector3D>(*props, "Translation", ok);
|
||||
if (ok) {
|
||||
uvTrans.x = trans.x;
|
||||
uvTrans.y = trans.y;
|
||||
}
|
||||
|
||||
// resolve video links
|
||||
if(doc.Settings().readTextures) {
|
||||
const std::vector<const Connection*>& 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<size_t>(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<size_t>(token.end() - data) < 5) {
|
||||
DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);
|
||||
|
||||
Reference in New Issue
Block a user