diff options
Diffstat (limited to 'src/3rdparty/assimp/code/FBXMaterial.cpp')
-rw-r--r-- | src/3rdparty/assimp/code/FBXMaterial.cpp | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/3rdparty/assimp/code/FBXMaterial.cpp b/src/3rdparty/assimp/code/FBXMaterial.cpp index 43e501d67..a80f243ba 100644 --- a/src/3rdparty/assimp/code/FBXMaterial.cpp +++ b/src/3rdparty/assimp/code/FBXMaterial.cpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -227,7 +228,6 @@ Texture::~Texture() LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name) : Object(id,element,name) -,texture(0) ,blendMode(BlendMode_Modulate) ,alpha(1) { @@ -249,7 +249,7 @@ LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Docume LayeredTexture::~LayeredTexture() { - + } void LayeredTexture::fillTexture(const Document& doc) @@ -267,7 +267,7 @@ void LayeredTexture::fillTexture(const Document& doc) const Texture* const tex = dynamic_cast<const Texture*>(ob); - texture = tex; + textures.push_back(tex); } } @@ -281,7 +281,7 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std const Scope& sc = GetRequiredScope(element); const Element* const Type = sc["Type"]; - const Element* const FileName = sc["FileName"]; + const Element* const FileName = sc.FindElementCaseInsensitive("FileName"); //some files retain the information as "Filename", others "FileName", who knows const Element* const RelativeFilename = sc["RelativeFilename"]; const Element* const Content = sc["Content"]; @@ -291,35 +291,40 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std if(FileName) { fileName = ParseTokenAsString(GetRequiredToken(*FileName,0)); - } + } if(RelativeFilename) { relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0)); } if(Content) { - const Token& token = GetRequiredToken(*Content, 0); - const char* data = token.begin(); - if(!token.IsBinary()) { - DOMWarning("video content is not binary data, ignoring", &element); - } - 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); - } - else if(*data != 'R') { - DOMWarning("video content is not raw binary data, ignoring", &element); - } - else { - // read number of elements - uint32_t len = 0; - ::memcpy(&len, data + 1, sizeof(len)); - AI_SWAP4(len); - - contentLength = len; - - content = new uint8_t[len]; - ::memcpy(content, data + 5, len); - } + //this field is ommited when the embedded texture is already loaded, let's ignore if itīs not found + try { + const Token& token = GetRequiredToken(*Content, 0); + const char* data = token.begin(); + if (!token.IsBinary()) { + DOMWarning("video content is not binary data, ignoring", &element); + } + 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); + } + else if (*data != 'R') { + DOMWarning("video content is not raw binary data, ignoring", &element); + } + else { + // read number of elements + uint32_t len = 0; + ::memcpy(&len, data + 1, sizeof(len)); + AI_SWAP4(len); + + contentLength = len; + + content = new uint8_t[len]; + ::memcpy(content, data + 5, len); + } + } catch (runtime_error runtimeError) { + //we donīt need the content data for contents that has already been loaded + } } props = GetPropertyTable(doc,"Video.FbxVideo",element,sc); |