Merge branch 'master' into 3mf-improvements
commit
465220b26a
|
@ -375,6 +375,11 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
|
|
||||||
// now come the individual properties
|
// now come the individual properties
|
||||||
const char* begin_cursor = cursor;
|
const char* begin_cursor = cursor;
|
||||||
|
|
||||||
|
if ((begin_cursor + prop_length) > end) {
|
||||||
|
TokenizeError("property length out of bounds reading length ", input, cursor);
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < prop_count; ++i) {
|
for (unsigned int i = 0; i < prop_count; ++i) {
|
||||||
ReadData(sbeg, send, input, cursor, begin_cursor + prop_length);
|
ReadData(sbeg, send, input, cursor, begin_cursor + prop_length);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
// Header files, Assimp
|
// Header files, Assimp
|
||||||
|
@ -331,7 +332,10 @@ inline void Buffer::Read(Value &obj, Asset &r) {
|
||||||
}
|
}
|
||||||
} else { // Local file
|
} else { // Local file
|
||||||
if (byteLength > 0) {
|
if (byteLength > 0) {
|
||||||
std::string dir = !r.mCurrentAssetDir.empty() ? (r.mCurrentAssetDir) : "";
|
std::string dir = !r.mCurrentAssetDir.empty() ? (
|
||||||
|
r.mCurrentAssetDir.back() == '/' ?
|
||||||
|
r.mCurrentAssetDir : r.mCurrentAssetDir + '/'
|
||||||
|
) : "";
|
||||||
|
|
||||||
IOStream *file = r.OpenFile(dir + uri, "rb");
|
IOStream *file = r.OpenFile(dir + uri, "rb");
|
||||||
if (file) {
|
if (file) {
|
||||||
|
@ -1276,7 +1280,9 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
|
||||||
|
|
||||||
/*int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
/*int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
||||||
if (pos != int(std::string::npos)) mCurrentAssetDir = pFile.substr(0, pos + 1);*/
|
if (pos != int(std::string::npos)) mCurrentAssetDir = pFile.substr(0, pos + 1);*/
|
||||||
mCurrentAssetDir = getCurrentAssetDir(pFile);
|
if (0 != strncmp(pFile.c_str(), AI_MEMORYIO_MAGIC_FILENAME, AI_MEMORYIO_MAGIC_FILENAME_LENGTH)) {
|
||||||
|
mCurrentAssetDir = getCurrentAssetDir(pFile);
|
||||||
|
}
|
||||||
|
|
||||||
shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
|
shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -400,7 +401,10 @@ inline void Buffer::Read(Value &obj, Asset &r) {
|
||||||
}
|
}
|
||||||
} else { // Local file
|
} else { // Local file
|
||||||
if (byteLength > 0) {
|
if (byteLength > 0) {
|
||||||
std::string dir = !r.mCurrentAssetDir.empty() ? (r.mCurrentAssetDir) : "";
|
std::string dir = !r.mCurrentAssetDir.empty() ? (
|
||||||
|
r.mCurrentAssetDir.back() == '/' ?
|
||||||
|
r.mCurrentAssetDir : r.mCurrentAssetDir + '/'
|
||||||
|
) : "";
|
||||||
|
|
||||||
IOStream *file = r.OpenFile(dir + uri, "rb");
|
IOStream *file = r.OpenFile(dir + uri, "rb");
|
||||||
if (file) {
|
if (file) {
|
||||||
|
@ -1590,7 +1594,9 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
|
||||||
/*int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
/*int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
||||||
if (pos != int(std::string::npos)) */
|
if (pos != int(std::string::npos)) */
|
||||||
|
|
||||||
mCurrentAssetDir = glTFCommon::getCurrentAssetDir(pFile);
|
if (0 != strncmp(pFile.c_str(), AI_MEMORYIO_MAGIC_FILENAME, AI_MEMORYIO_MAGIC_FILENAME_LENGTH)) {
|
||||||
|
mCurrentAssetDir = glTFCommon::getCurrentAssetDir(pFile);
|
||||||
|
}
|
||||||
|
|
||||||
shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
|
shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
|
Loading…
Reference in New Issue