From 2cd71f980f927793eb8d42937d86379f10ad8950 Mon Sep 17 00:00:00 2001 From: manongjohn <19245851+manongjohn@users.noreply.github.com> Date: Sun, 5 Jun 2022 09:17:22 -0400 Subject: [PATCH] Fix Canon Import Image crash --- toonz/sources/stopmotion/canon.cpp | 15 +++++++++++++++ toonz/sources/stopmotion/stopmotion.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/toonz/sources/stopmotion/canon.cpp b/toonz/sources/stopmotion/canon.cpp index af70e4b6..09957543 100644 --- a/toonz/sources/stopmotion/canon.cpp +++ b/toonz/sources/stopmotion/canon.cpp @@ -7,6 +7,7 @@ #include "toonz/tscenehandle.h" #include "toonz/tcamera.h" #include "toonz/toonzscene.h" +#include "tsystem.h" #include #include @@ -968,12 +969,26 @@ bool Canon::downloadImage(EdsBaseRef object) { // write out the full res file if (!isRaw) { + TFilePath parentDir = + TApp::instance()->getCurrentScene()->getScene()->decodeFilePath( + TFilePath(StopMotion::instance()->m_filePath)); + TFilePath tempFile = parentDir + "temp.jpg"; + + StopMotion::instance()->m_tempFile = tempFile.getQString(); + QFile fullImage(StopMotion::instance()->m_tempFile); fullImage.open(QIODevice::WriteOnly); QDataStream dataStream(&fullImage); dataStream.writeRawData((const char*)jpgStreamData, jpgStreamSize); fullImage.close(); } else { + TFilePath parentDir = + TApp::instance()->getCurrentScene()->getScene()->decodeFilePath( + TFilePath(StopMotion::instance()->m_filePath)); + TFilePath tempRaw = parentDir + "temp.cr2"; + + StopMotion::instance()->m_tempRaw = tempRaw.getQString(); + QFile fullImage(StopMotion::instance()->m_tempRaw); fullImage.open(QIODevice::WriteOnly); QDataStream dataStream(&fullImage); diff --git a/toonz/sources/stopmotion/stopmotion.h b/toonz/sources/stopmotion/stopmotion.h index 72ec11ee..213a40bb 100644 --- a/toonz/sources/stopmotion/stopmotion.h +++ b/toonz/sources/stopmotion/stopmotion.h @@ -70,7 +70,6 @@ private: int m_captureNumberOfFrames = 1; QString m_levelName = ""; QString m_fileType = "jpg"; - QString m_filePath = "+stopmotion"; QString m_frameInfoText = ""; QString m_infoColorName = ""; QString m_frameInfoToolTip = ""; @@ -110,6 +109,7 @@ public: bool m_isTimeLapse = false; int m_reviewTimeDSec = 20; bool m_isTestShot = false; + QString m_filePath = "+stopmotion"; QString m_tempFile, m_tempRaw; TXshSimpleLevel* m_sl;