diff --git a/.github/workflows/workflow_windows.yml b/.github/workflows/workflow_windows.yml index bc458e2..4c12f7b 100644 --- a/.github/workflows/workflow_windows.yml +++ b/.github/workflows/workflow_windows.yml @@ -140,10 +140,7 @@ jobs: - name: Build run: | cd toonz - if [ -d build ];then - ls build - fi - mkdir build + mkdir build | Out-Null cd build $env:CLCACHE_CL = '${{ env.CLCACHE_CL }}' cmake ../sources -G 'Visual Studio 16 2019' -Ax64 -DQT_PATH='D:/a/opentoonz/Qt/5.15.2/msvc2019_64' -DOpenCV_DIR='C:/vcpkg/installed/x64-windows/share/opencv' -DBOOST_ROOT="$env:BOOST_ROOT_1_72_0" diff --git a/appveyor.yml b/appveyor.yml index 1c778fc..0749e3a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,15 +2,20 @@ version: 1.4.0.{build} pull_requests: do_not_increment_build_number: true skip_tags: true -image: Visual Studio 2015 +image: Visual Studio 2019 configuration: - Debug - Release platform: x64 clone_depth: 1 -# C:\Qt\5.9 is mapped to C:\Qt\5.9.n for backward compatibility +cache: c:\tools\vcpkg\installed install: +- cmd: >- + vcpkg install --clean-after-build --triplet x64-windows-static libjpeg-turbo + - cmd: >- + choco install opencv + cd thirdparty copy /Y LibJPEG\jpeg-9\jconfig.vc LibJPEG\jpeg-9\jconfig.h @@ -21,12 +26,19 @@ install: copy /Y libpng-1.6.21\scripts\pnglibconf.h.prebuilt libpng-1.6.21\pnglibconf.h + mkdir libjpeg-turbo64\lib + + copy C:\tools\vcpkg\installed\x64-windows-static\lib\turbojpeg.lib libjpeg-turbo64\lib\turbojpeg.lib + + mkdir libjpeg-turbo64\include + + copy C:\tools\vcpkg\installed\x64-windows-static\include\* libjpeg-turbo64\include cd ../toonz mkdir %PLATFORM% && cd %PLATFORM% - cmake ..\sources -G "Visual Studio 14 2015 Win64" -DQT_PATH="C:\Qt\5.9\msvc2015_64" -DBOOST_ROOT="C:\Libraries\boost_1_60_0" + cmake ..\sources -G "Visual Studio 16 2019" -Ax64 -DQT_PATH="C:\Qt\5.15.2\msvc2019_64" -DBOOST_ROOT="C:\Libraries\boost_1_73_0" -DOpenCV_DIR="C:\Tools\opencv\build" build: project: $(APPVEYOR_BUILD_FOLDER)\toonz\$(PLATFORM)\ALL_BUILD.vcxproj parallel: true @@ -37,7 +49,7 @@ after_build: move %CONFIGURATION%\*.* %CONFIGURATION%\OpenToonz - C:\Qt\5.9\msvc2015_64\bin\windeployqt.exe %CONFIGURATION%\OpenToonz\OpenToonz.exe + C:\Qt\5.15.2\msvc2019_64\bin\windeployqt.exe %CONFIGURATION%\OpenToonz\OpenToonz.exe copy /Y ..\..\thirdparty\glut\3.7.6\lib\glut64.dll %CONFIGURATION%\OpenToonz @@ -51,6 +63,8 @@ after_build: copy /Y ..\..\thirdparty\libmypaint\dist\64\libmypaint-1-4-0.dll %CONFIGURATION%\OpenToonz + copy /Y "C:\Tools\opencv\build\x64\vc15\bin\opencv_world412.dll" %CONFIGURATION%\OpenToonz + mkdir "%CONFIGURATION%\OpenToonz stuff" xcopy /Y /E ..\..\stuff "%CONFIGURATION%\OpenToonz stuff" diff --git a/toonz/sources/include/toonz/stagevisitor.h b/toonz/sources/include/toonz/stagevisitor.h index e2072fb..c3a6a1a 100644 --- a/toonz/sources/include/toonz/stagevisitor.h +++ b/toonz/sources/include/toonz/stagevisitor.h @@ -98,7 +98,7 @@ public: virtual void onImage( const Player &player) = 0; //!< The \a visitation function. - + virtual void onRasterImage(TRasterImage *ri, const Stage::Player &data) = 0; // I've not checked the actual meaning of the methods below. They are unused @@ -139,7 +139,7 @@ struct DVAPI VisitArgs { int m_guidedBackStroke; #if defined(x64) TRasterImageP m_liveViewImage = 0; - TRasterImageP m_lineupImage = 0; + TRasterImageP m_lineupImage = 0; Stage::Player m_liveViewPlayer; Stage::Player m_lineupPlayer; #endif @@ -316,7 +316,7 @@ public: void setMinimumDistance(double d); void onImage(const Stage::Player &data) override; - void onRasterImage(TRasterImage *ri, const Stage::Player &data) override {}; + void onRasterImage(TRasterImage *ri, const Stage::Player &data) override{}; void beginMask() override; void endMask() override; void enableMask() override; diff --git a/toonz/sources/stopmotion/canon.cpp b/toonz/sources/stopmotion/canon.cpp index bd43e8e..db50097 100644 --- a/toonz/sources/stopmotion/canon.cpp +++ b/toonz/sources/stopmotion/canon.cpp @@ -159,7 +159,7 @@ void Canon::resetCanon(bool liveViewOpen) { EdsError Canon::openCameraSession() { if (m_camera != NULL) { - m_error = EdsOpenSession(m_camera); + m_error = EdsOpenSession(m_camera); if (m_error == EDS_ERR_OK) m_sessionOpen = true; } m_error = EdsSetObjectEventHandler(m_camera, kEdsObjectEvent_All, @@ -176,8 +176,8 @@ EdsError Canon::openCameraSession() { if (getCurrentImageQuality().contains("RAW")) setImageQuality("Large Fine Jpeg"); - EdsUInt32 saveto = kEdsSaveTo_Host; - m_error = EdsSetPropertyData(m_camera, kEdsPropID_SaveTo, 0, + EdsUInt32 saveto = kEdsSaveTo_Host; + m_error = EdsSetPropertyData(m_camera, kEdsPropID_SaveTo, 0, sizeof(EdsUInt32), &saveto); EdsCapacity newCapacity = {0x7FFFFFFF, 0x1000, 1}; m_error = EdsSetCapacity(m_camera, newCapacity); @@ -309,7 +309,7 @@ EdsError Canon::getAvailableExposureCompensations() { EdsError err = EDS_ERR_OK; m_exposureOptions.clear(); - err = EdsGetPropertyDesc(m_camera, kEdsPropID_ExposureCompensation, + err = EdsGetPropertyDesc(m_camera, kEdsPropID_ExposureCompensation, exposureDesc); int count = exposureDesc->numElements; if (count > 0) { @@ -736,7 +736,7 @@ bool Canon::downloadImage(EdsBaseRef object) { err = EdsDownload(object, dirItemInfo.size, stream); EdsDownloadComplete(object); -// tj code + // tj code #ifdef MACOSX UInt64 mySize = 0; @@ -806,7 +806,7 @@ bool Canon::downloadImage(EdsBaseRef object) { m_proxyImageDimensions = TDimension(tempWidth, tempHeight); double minimumDpi = std::min(m_proxyImageDimensions.lx / size.lx, m_proxyImageDimensions.ly / size.ly); - m_proxyDpi = TPointD(minimumDpi, minimumDpi); + m_proxyDpi = TPointD(minimumDpi, minimumDpi); } tjDecompress2(tjInstance, data, mySize, imgBuf, tempWidth, @@ -1328,10 +1328,10 @@ EdsError Canon::handlePropertyEvent(EdsPropertyEvent event, EdsError Canon::handleStateEvent(EdsStateEvent event, EdsUInt32 parameter, EdsVoid* context) { if (event == kEdsStateEvent_Shutdown) { - instance()->m_sessionOpen = false; - instance()->releaseCamera(); + instance()->m_sessionOpen = false; + instance()->releaseCamera(); if (instance()->m_sessionOpen && instance()->getCameraCount() > 0) { - //instance()->closeCameraSession(); + // instance()->closeCameraSession(); } StopMotion::instance()->m_liveViewStatus = 0; emit(instance()->canonCameraChanged(QString(""))); diff --git a/toonz/sources/stopmotion/jpgconverter.cpp b/toonz/sources/stopmotion/jpgconverter.cpp index ec78575..8c20efc 100644 --- a/toonz/sources/stopmotion/jpgconverter.cpp +++ b/toonz/sources/stopmotion/jpgconverter.cpp @@ -135,9 +135,9 @@ bool JpgConverter::loadJpg(TFilePath path, TRaster32P& image) { if ((jpegFile = fopen(c_path, "rb")) == NULL) success = false; if (success && fseek(jpegFile, 0, SEEK_END) < 0 || ((size = ftell(jpegFile)) < 0) || fseek(jpegFile, 0, SEEK_SET) < 0) - success = false; + success = false; if (success && size == 0) success = false; - jpegSize = (unsigned long)size; + jpegSize = (unsigned long)size; if (success && (jpegBuf = (unsigned char*)tjAlloc(jpegSize)) == NULL) success = false; if (success && fread(jpegBuf, jpegSize, 1, jpegFile) < 1) success = false; @@ -146,9 +146,8 @@ bool JpgConverter::loadJpg(TFilePath path, TRaster32P& image) { if (success && (tjInstance = tjInitDecompress()) == NULL) success = false; - if (success && - tjDecompressHeader3(tjInstance, jpegBuf, jpegSize, &width, &height, - &inSubsamp, &inColorspace) < 0) + if (success && tjDecompressHeader3(tjInstance, jpegBuf, jpegSize, &width, + &height, &inSubsamp, &inColorspace) < 0) success = false; int pixelFormat = TJPF_BGRX; @@ -159,9 +158,8 @@ bool JpgConverter::loadJpg(TFilePath path, TRaster32P& image) { int flags = 0; flags |= TJFLAG_BOTTOMUP; - if (success && - tjDecompress2(tjInstance, jpegBuf, jpegSize, imgBuf, width, 0, height, - pixelFormat, flags) < 0) + if (success && tjDecompress2(tjInstance, jpegBuf, jpegSize, imgBuf, width, 0, + height, pixelFormat, flags) < 0) success = false; tjFree(jpegBuf); jpegBuf = NULL; diff --git a/toonz/sources/stopmotion/stopmotion.cpp b/toonz/sources/stopmotion/stopmotion.cpp index 4b69f3f..a78a834 100644 --- a/toonz/sources/stopmotion/stopmotion.cpp +++ b/toonz/sources/stopmotion/stopmotion.cpp @@ -309,7 +309,7 @@ void StopMotion::onSceneSwitched() { setXSheetFrameNumber(xsh->getFrameCount() + 1); loadXmlFile(); buildLiveViewMap(sl); - m_sl = sl; + m_sl = sl; found = true; break; } @@ -632,7 +632,7 @@ void StopMotion::toggleNumpadShortcuts(bool on) { // can't just return if this feature is off // it could have been toggled while the camera was active if (!m_useNumpadShortcuts) on = false; - CommandManager *comm = CommandManager::instance(); + CommandManager *comm = CommandManager::instance(); if (on) { m_oldActionMap.clear(); @@ -1386,10 +1386,10 @@ void StopMotion::setLiveViewImage() { TDimension(m_liveViewImage->getLx(), m_liveViewImage->getLy()); double minimumDpi = std::min(m_liveViewImageDimensions.lx / size.lx, m_liveViewImageDimensions.ly / size.ly); - m_liveViewDpi = TPointD(minimumDpi, minimumDpi); + m_liveViewDpi = TPointD(minimumDpi, minimumDpi); if (!m_usingWebcam) { - minimumDpi = std::min(m_fullImageDimensions.lx / size.lx, + minimumDpi = std::min(m_fullImageDimensions.lx / size.lx, m_fullImageDimensions.ly / size.ly); m_fullImageDpi = TPointD(minimumDpi, minimumDpi); } else { @@ -1534,9 +1534,8 @@ bool StopMotion::importImage() { /* if the loaded level does not match in pixel size, then return */ sl = level->getSimpleLevel(); - if (!sl || - sl->getProperties()->getImageRes() != - TDimension(m_newImage->getLx(), m_newImage->getLy())) { + if (!sl || sl->getProperties()->getImageRes() != + TDimension(m_newImage->getLx(), m_newImage->getLy())) { DVGui::error( tr("The captured image size does not match with the existing " "level.")); @@ -1558,7 +1557,7 @@ bool StopMotion::importImage() { else { TXshLevel *level = scene->createNewLevel(OVL_XSHLEVEL, levelName, TDimension(), 0, levelFp); - sl = level->getSimpleLevel(); + sl = level->getSimpleLevel(); sl->setPath(levelFp, true); sl->getProperties()->setDpiPolicy(LevelProperties::DP_CustomDpi); TPointD dpi; @@ -1573,7 +1572,7 @@ bool StopMotion::importImage() { TDimensionD size = camera->getSize(); double minimumDpi = std::min(m_newImage->getLx() / size.lx, m_newImage->getLy() / size.ly); - dpi = TPointD(minimumDpi, minimumDpi); + dpi = TPointD(minimumDpi, minimumDpi); } sl->getProperties()->setDpi(dpi.x); sl->getProperties()->setImageDpi(dpi); @@ -1978,7 +1977,7 @@ bool StopMotion::loadXmlFile() { while (!xmlReader.atEnd()) { if (xmlReader.isStartElement()) { if (xmlReader.name() == "Webcam") { - text = xmlReader.readElementText(); + text = xmlReader.readElementText(); if (text == "yes") webcam = true; } if (xmlReader.name() == "CameraName") { @@ -2247,7 +2246,7 @@ void StopMotion::refreshFrameInfo() { int frameNumber = m_frameNumber; TDimension stopMotionRes; - bool checkRes = true; + bool checkRes = true; if (m_usingWebcam) stopMotionRes = m_liveViewImageDimensions; #ifdef WITH_CANON else if (m_canon->m_useScaledImages || @@ -2280,7 +2279,7 @@ void StopMotion::refreshFrameInfo() { // frame existence TFilePath frameFp(actualLevelFp.withFrame(frameNumber)); - bool frameExist = false; + bool frameExist = false; if (levelExist) frameExist = TFileStatus(frameFp).doesExist(); // reset acceptable camera size diff --git a/toonz/sources/stopmotion/stopmotioncontroller.cpp b/toonz/sources/stopmotion/stopmotioncontroller.cpp index 8347e45..259404b 100644 --- a/toonz/sources/stopmotion/stopmotioncontroller.cpp +++ b/toonz/sources/stopmotion/stopmotioncontroller.cpp @@ -2076,7 +2076,7 @@ void StopMotionController::onCaptureFilterSettingsBtnPressed() { m_stopMotion->m_webcam->getWebcamDeviceName()) { #ifdef _WIN32 m_stopMotion->m_webcam->openSettingsWindow(); -// openCaptureFilterSettings(this, cameras.at(c).description()); + // openCaptureFilterSettings(this, cameras.at(c).description()); #endif return; diff --git a/toonz/sources/stopmotion/webcam.cpp b/toonz/sources/stopmotion/webcam.cpp index d09de81..9781771 100644 --- a/toonz/sources/stopmotion/webcam.cpp +++ b/toonz/sources/stopmotion/webcam.cpp @@ -424,9 +424,9 @@ bool Webcam::translateIndex(int index) { #ifdef WIN32 -// Thanks to: -// https://elcharolin.wordpress.com/2017/08/28/webcam-capture-with-the-media-foundation-sdk/ -// for the webcam enumeration here + // Thanks to: + // https://elcharolin.wordpress.com/2017/08/28/webcam-capture-with-the-media-foundation-sdk/ + // for the webcam enumeration here #define CLEAN_ATTRIBUTES() \ if (attributes) { \ diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp index d6f35d2..2684958 100644 --- a/toonz/sources/toonz/filebrowserpopup.cpp +++ b/toonz/sources/toonz/filebrowserpopup.cpp @@ -468,7 +468,8 @@ bool GenericSaveFilePopup::execute() { // (yep, even if a DIFFERENT type was specified - next time do it right :P) const QStringList &extList = m_browser->getFilterTypes(); - if (!m_isDirectoryOnly && !extList.contains(QString::fromStdString(path.getType()))) { + if (!m_isDirectoryOnly && + !extList.contains(QString::fromStdString(path.getType()))) { path = TFilePath(path.getWideString() + L"." + extList.first().toStdWString()); } @@ -1222,10 +1223,10 @@ bool LoadLevelPopup::execute() { args.frameIdsSet.push_back(tmp_fids); } - int xFrom = m_xFrom->text().toInt(); + int xFrom = m_xFrom->text().toInt(); if (xFrom) args.xFrom = xFrom; - int xTo = m_xTo->text().toInt(); - if (xTo) args.xTo = xTo; + int xTo = m_xTo->text().toInt(); + if (xTo) args.xTo = xTo; args.levelName = m_levelName->text().toStdWString(); args.step = m_stepCombo->currentIndex(); @@ -1576,7 +1577,7 @@ bool SaveLevelAsPopup::execute() { TXshSimpleLevel *sl = dynamic_cast( TApp::instance()->getCurrentLevel()->getLevel()); if (!sl) return false; - std::string ext = sl->getPath().getType(); + std::string ext = sl->getPath().getType(); if (fp.getType() == "") fp = fp.withType(ext); IoCmd::LoadResourceArguments args(fp); @@ -2233,7 +2234,7 @@ void BrowserPopup::initFolder(TFilePath path) { } if (!TFileStatus(path).doesExist()) { ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); - if (scene) path = scene->decodeFilePath(path); + if (scene) path = scene->decodeFilePath(path); } if (!path.getType().empty()) path = path.getParentDir(); @@ -2302,8 +2303,8 @@ void BrowserPopupController::openPopup(QStringList filters, QString BrowserPopupController::getPath(bool codePath) { m_isExecute = false; if (!m_browserPopup) return QString(); - ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); - TFilePath fp = m_browserPopup->getPath(); + ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); + TFilePath fp = m_browserPopup->getPath(); if (scene && codePath) fp = scene->codeFilePath(fp); std::cout << ::to_string(fp) << std::endl; return toQString(fp); diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 97e6202..7c29604 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1618,7 +1618,7 @@ QAction *MainWindow::createToolOptionsAction(const char *id, //----------------------------------------------------------------------------- QAction *MainWindow::createStopMotionAction(const char *id, const QString &name, - const QString &defaultShortcut) { + const QString &defaultShortcut) { return createAction(id, name, defaultShortcut, StopMotionCommandType); } @@ -1741,7 +1741,7 @@ void MainWindow::defineActions() { createMenuFileAction(MI_SoundTrack, tr("&Export Soundtrack"), ""); #if defined(x64) createStopMotionAction(MI_StopMotionExportImageSequence, - tr("&Export Stop Motion Image Sequence"), ""); + tr("&Export Stop Motion Image Sequence"), ""); #endif menuAct = createMenuRenderAction(MI_SavePreviewedFrames, tr("&Save Previewed Frames"), ""); @@ -2883,29 +2883,33 @@ void MainWindow::defineActions() { createMiscAction("A_FxSchematicToggle", tr("Toggle FX/Stage schematic"), ""); #if defined(x64) - createStopMotionAction(MI_StopMotionCapture, tr("Capture Stop Motion Frame"), ""); - createStopMotionAction(MI_StopMotionRaiseOpacity, tr("Raise Stop Motion Opacity"), ""); - createStopMotionAction(MI_StopMotionLowerOpacity, tr("Lower Stop Motion Opacity"), ""); - createStopMotionAction(MI_StopMotionToggleLiveView, tr("Toggle Stop Motion Live View"), - ""); + createStopMotionAction(MI_StopMotionCapture, tr("Capture Stop Motion Frame"), + ""); + createStopMotionAction(MI_StopMotionRaiseOpacity, + tr("Raise Stop Motion Opacity"), ""); + createStopMotionAction(MI_StopMotionLowerOpacity, + tr("Lower Stop Motion Opacity"), ""); + createStopMotionAction(MI_StopMotionToggleLiveView, + tr("Toggle Stop Motion Live View"), ""); #ifdef WITH_CANON - createStopMotionAction(MI_StopMotionToggleZoom, tr("Toggle Stop Motion Zoom"), ""); + createStopMotionAction(MI_StopMotionToggleZoom, tr("Toggle Stop Motion Zoom"), + ""); createStopMotionAction(MI_StopMotionPickFocusCheck, - tr("Pick Focus Check Location"), ""); -#endif // WITH_CANON + tr("Pick Focus Check Location"), ""); +#endif // WITH_CANON createStopMotionAction(MI_StopMotionLowerSubsampling, - tr("Lower Stop Motion Level Subsampling"), ""); + tr("Lower Stop Motion Level Subsampling"), ""); createStopMotionAction(MI_StopMotionRaiseSubsampling, - tr("Raise Stop Motion Level Subsampling"), ""); - createStopMotionAction(MI_StopMotionJumpToCamera, tr("Go to Stop Motion Insert Frame"), - ""); + tr("Raise Stop Motion Level Subsampling"), ""); + createStopMotionAction(MI_StopMotionJumpToCamera, + tr("Go to Stop Motion Insert Frame"), ""); createStopMotionAction(MI_StopMotionRemoveFrame, - tr("Remove frame before Stop Motion Camera"), ""); + tr("Remove frame before Stop Motion Camera"), ""); createStopMotionAction(MI_StopMotionNextFrame, - tr("Next Frame including Stop Motion Camera"), ""); + tr("Next Frame including Stop Motion Camera"), ""); createStopMotionAction(MI_StopMotionToggleUseLiveViewImages, - tr("Show original live view images."), ""); -#endif // x64 + tr("Show original live view images."), ""); +#endif // x64 } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/mainwindow.h b/toonz/sources/toonz/mainwindow.h index 672637c..e20fbd6 100644 --- a/toonz/sources/toonz/mainwindow.h +++ b/toonz/sources/toonz/mainwindow.h @@ -274,7 +274,7 @@ private: QAction *createToolOptionsAction(const char *id, const QString &name, const QString &defaultShortcut); QAction *createStopMotionAction(const char *id, const QString &name, - const QString &defaultShortcut); + const QString &defaultShortcut); protected slots: void onCurrentRoomChanged(int newRoomIndex); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index dd2e7d2..05ed07c 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -421,7 +421,8 @@ #define MI_StopMotionLowerOpacity "MI_StopMotionLowerOpacity" #define MI_StopMotionToggleLiveView "MI_StopMotionToggleLiveView" #define MI_StopMotionToggleZoom "MI_StopMotionToggleZoom" -#define MI_StopMotionToggleUseLiveViewImages "MI_StopMotionToggleUseLiveViewImages" +#define MI_StopMotionToggleUseLiveViewImages \ + "MI_StopMotionToggleUseLiveViewImages" #define MI_StopMotionLowerSubsampling "MI_StopMotionLowerSubsampling" #define MI_StopMotionRaiseSubsampling "MI_StopMotionRaiseSubsampling" #define MI_StopMotionJumpToCamera "MI_StopMotionJumpToCamera" diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cpp index ebabc13..69f1222 100644 --- a/toonz/sources/toonz/penciltestpopup.cpp +++ b/toonz/sources/toonz/penciltestpopup.cpp @@ -1214,14 +1214,13 @@ void PencilTestSaveInFolderPopup::updateParentFolder() { PencilTestPopup::PencilTestPopup() // set the parent 0 in order to enable the popup behind the main window - : Dialog(0, false, false, "PencilTest"), - m_currentCamera(NULL), - m_captureWhiteBGCue(false), - m_captureCue(false), - m_useMjpg(CamCapUseMjpg != 0) + : Dialog(0, false, false, "PencilTest") + , m_currentCamera(NULL) + , m_captureWhiteBGCue(false) + , m_captureCue(false) + , m_useMjpg(CamCapUseMjpg != 0) #ifdef _WIN32 - , - m_useDirectShow(CamCapUseDirectShow != 0) + , m_useDirectShow(CamCapUseDirectShow != 0) #endif { setWindowTitle(tr("Camera Capture")); @@ -2010,7 +2009,7 @@ int PencilTestPopup::translateIndex(int camIndex) { } // clean CLEAN_ATTRIBUTES() -#endif // WIN32 +#endif // WIN32 return camIndex; } @@ -2454,9 +2453,8 @@ bool PencilTestPopup::importImage(QImage image) { /* if the loaded level does not match in pixel size, then return */ sl = level->getSimpleLevel(); - if (!sl || - sl->getProperties()->getImageRes() != - TDimension(image.width(), image.height())) { + if (!sl || sl->getProperties()->getImageRes() != + TDimension(image.width(), image.height())) { error(tr( "The captured image size does not match with the existing level.")); return false; @@ -2481,7 +2479,7 @@ bool PencilTestPopup::importImage(QImage image) { else { TXshLevel* level = scene->createNewLevel(OVL_XSHLEVEL, levelName, TDimension(), 0, levelFp); - sl = level->getSimpleLevel(); + sl = level->getSimpleLevel(); sl->setPath(levelFp, true); sl->getProperties()->setDpiPolicy(LevelProperties::DP_CustomDpi); TPointD dpi; @@ -2670,7 +2668,7 @@ void PencilTestPopup::refreshFrameInfo() { // frame existence TFilePath frameFp(actualLevelFp.withFrame(frameNumber)); - bool frameExist = false; + bool frameExist = false; if (levelExist) frameExist = TFileStatus(frameFp).doesExist(); // reset acceptable camera size diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index 48e9dbc..42ffbd1 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -1190,12 +1190,12 @@ void SceneViewer::onNewStopMotionImageReady() { //----------------------------------------------------------------------------- void SceneViewer::onStopMotionLiveViewStopped() { - m_hasStopMotionImage = false; - m_hasStopMotionLineUpImage = false; - onSceneChanged(); + m_hasStopMotionImage = false; + m_hasStopMotionLineUpImage = false; + onSceneChanged(); } -#endif //x64 +#endif // x64 //----------------------------------------------------------------------------- void SceneViewer::onPreferenceChanged(const QString &prefName) { @@ -1629,8 +1629,8 @@ void SceneViewer::drawOverlay() { #ifdef WITH_CANON if (m_stopMotion->m_liveViewStatus == StopMotion::LiveViewOpen && - app->getCurrentFrame()->getFrame() == - m_stopMotion->getXSheetFrameNumber() - 1) { + app->getCurrentFrame()->getFrame() == + m_stopMotion->getXSheetFrameNumber() - 1) { int x0, x1, y0, y1; rect().getCoords(&x0, &y0, &x1, &y1); x0 = (-(x1 / 2)) + 15; @@ -1640,11 +1640,11 @@ void SceneViewer::drawOverlay() { // draw Stop Motion Zoom Box if (m_stopMotion->m_liveViewStatus == 2 && - m_stopMotion->m_canon->m_pickLiveViewZoom) { + m_stopMotion->m_canon->m_pickLiveViewZoom) { glPushMatrix(); tglMultMatrix(m_drawCameraAff); m_pixelSize = sqrt(tglGetPixelSize2()) * getDevPixRatio(); - TRect rect = m_stopMotion->m_canon->m_zoomRect; + TRect rect = m_stopMotion->m_canon->m_zoomRect; glColor3d(1.0, 0.0, 0.0); @@ -2040,36 +2040,36 @@ void SceneViewer::drawScene() { #if defined(x64) if (m_stopMotion->m_alwaysUseLiveViewImages && - m_stopMotion->m_liveViewStatus > 0 && - frame != m_stopMotion->getXSheetFrameNumber() - 1 && - m_hasStopMotionImage && !m_stopMotion->m_reviewTimer->isActive()) { + m_stopMotion->m_liveViewStatus > 0 && + frame != m_stopMotion->getXSheetFrameNumber() - 1 && + m_hasStopMotionImage && !m_stopMotion->m_reviewTimer->isActive()) { TRaster32P image; bool hasImage = m_stopMotion->loadLiveViewImage(frame, image); if (hasImage) { Stage::Player smPlayer; double dpiX, dpiY; m_stopMotionImage->getDpi(dpiX, dpiY); - smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY); - smPlayer.m_opacity = 255; - smPlayer.m_sl = m_stopMotion->m_sl; + smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY); + smPlayer.m_opacity = 255; + smPlayer.m_sl = m_stopMotion->m_sl; args.m_liveViewImage = static_cast(image); args.m_liveViewPlayer = smPlayer; // painter.onRasterImage(static_cast(image).getPointer(), // smPlayer); } } - if (//!m_stopMotion->m_drawBeneathLevels && - m_stopMotion->m_liveViewStatus == 2 && - ( //! frameHandle->isPlaying() || - frame == m_stopMotion->getXSheetFrameNumber() - 1)) { + if ( //! m_stopMotion->m_drawBeneathLevels && + m_stopMotion->m_liveViewStatus == 2 && + ( //! frameHandle->isPlaying() || + frame == m_stopMotion->getXSheetFrameNumber() - 1)) { if (m_hasStopMotionLineUpImage && m_stopMotion->m_showLineUpImage) { Stage::Player smPlayer; double dpiX, dpiY; m_stopMotionLineUpImage->getDpi(dpiX, dpiY); - smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY); - smPlayer.m_opacity = 255; - smPlayer.m_sl = m_stopMotion->m_sl; - args.m_lineupImage = m_stopMotionLineUpImage; + smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY); + smPlayer.m_opacity = 255; + smPlayer.m_sl = m_stopMotion->m_sl; + args.m_lineupImage = m_stopMotionLineUpImage; args.m_lineupPlayer = smPlayer; // painter.onRasterImage(m_stopMotionLineUpImage.getPointer(), // smPlayer); @@ -2082,21 +2082,20 @@ void SceneViewer::drawScene() { bool hide_opacity = false; #ifdef WITH_CANON hide_opacity = m_stopMotion->m_canon->m_zooming || - m_stopMotion->m_canon->m_pickLiveViewZoom || - !m_hasStopMotionLineUpImage; + m_stopMotion->m_canon->m_pickLiveViewZoom || + !m_hasStopMotionLineUpImage; #endif smPlayer.m_opacity = - hide_opacity ? 255.0 : m_stopMotion->getOpacity(); - smPlayer.m_sl = m_stopMotion->m_sl; - args.m_liveViewImage = m_stopMotionImage; + hide_opacity ? 255.0 : m_stopMotion->getOpacity(); + smPlayer.m_sl = m_stopMotion->m_sl; + args.m_liveViewImage = m_stopMotionImage; args.m_liveViewPlayer = smPlayer; // painter.onRasterImage(m_stopMotionImage.getPointer(), smPlayer); } + } +#endif // x64 + Stage::visit(painter, args); } -#endif //x64 - Stage::visit(painter, args); - } - assert(glGetError() == 0); painter.flushRasterImages(); diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp index e7fb90c..fdc7b84 100644 --- a/toonz/sources/toonz/sceneviewerevents.cpp +++ b/toonz/sources/toonz/sceneviewerevents.cpp @@ -75,7 +75,7 @@ namespace { void initToonzEvent(TMouseEvent &toonzEvent, QMouseEvent *event, int widgetHeight, double pressure, int devPixRatio) { - toonzEvent.m_pos = TPointD(event->pos().x() * devPixRatio, + toonzEvent.m_pos = TPointD(event->pos().x() * devPixRatio, widgetHeight - 1 - event->pos().y() * devPixRatio); toonzEvent.m_mousePos = event->pos(); toonzEvent.m_pressure = 1.0; @@ -505,7 +505,7 @@ void SceneViewer::onMove(const TMouseEvent &event) { cursorSet = true; setToolCursor(this, ToolCursor::ScaleHCursor); } else if (std::abs((height() - curPos.y()) - - height() * m_compareSettings.m_compareY) < 20) { + height() * m_compareSettings.m_compareY) < 20) { cursorSet = true; setToolCursor(this, ToolCursor::ScaleVCursor); } @@ -577,7 +577,7 @@ void SceneViewer::onMove(const TMouseEvent &event) { #ifdef WITH_CANON // grab screen picking for stop motion live view zoom if ((event.buttons() & Qt::LeftButton) && - StopMotion::instance()->m_canon->m_pickLiveViewZoom) { + StopMotion::instance()->m_canon->m_pickLiveViewZoom) { StopMotion::instance()->m_canon->makeZoomPoint(pos); return; } @@ -723,7 +723,7 @@ void SceneViewer::onPress(const TMouseEvent &event) { m_tabletState = None; return; } else if (std::abs((height() - m_pos.y()) - - height() * m_compareSettings.m_compareY) < 20) { + height() * m_compareSettings.m_compareY) < 20) { m_compareSettings.m_dragCompareY = true; m_compareSettings.m_dragCompareX = false; m_compareSettings.m_compareX = ImagePainter::DefaultCompareValue; @@ -886,9 +886,9 @@ quit: // Don't clear it out table state so the tablePress event will process // correctly. if (m_tabletState != Touched) m_tabletState = None; - m_mouseState = None; - m_tabletMove = false; - m_pressure = 0; + m_mouseState = None; + m_tabletMove = false; + m_pressure = 0; } //----------------------------------------------------------------------------- @@ -940,12 +940,12 @@ void SceneViewer::wheelEvent(QWheelEvent *event) { default: // Qt::MouseEventSynthesizedByQt, // Qt::MouseEventSynthesizedByApplication - { - std::cout << "not supported event: Qt::MouseEventSynthesizedByQt, " - "Qt::MouseEventSynthesizedByApplication" - << std::endl; - break; - } + { + std::cout << "not supported event: Qt::MouseEventSynthesizedByQt, " + "Qt::MouseEventSynthesizedByApplication" + << std::endl; + break; + } } // end switch @@ -1041,8 +1041,8 @@ void SceneViewer::gestureEvent(QGestureEvent *e) { qreal rotationDelta = gesture->rotationAngle() - gesture->lastRotationAngle(); if (m_isFlippedX != m_isFlippedY) rotationDelta = -rotationDelta; - TAffine aff = getViewMatrix().inv(); - TPointD center = aff * TPointD(0, 0); + TAffine aff = getViewMatrix().inv(); + TPointD center = aff * TPointD(0, 0); if (!m_rotating && !m_zooming) { m_rotationDelta += rotationDelta; double absDelta = std::abs(m_rotationDelta); @@ -1183,10 +1183,9 @@ bool SceneViewer::event(QEvent *e) { break; } */ - if (e->type() == QEvent::Gesture && - CommandManager::instance() - ->getAction(MI_TouchGestureControl) - ->isChecked()) { + if (e->type() == QEvent::Gesture && CommandManager::instance() + ->getAction(MI_TouchGestureControl) + ->isChecked()) { gestureEvent(static_cast(e)); return true; } @@ -1357,13 +1356,12 @@ void SceneViewer::keyPressEvent(QKeyEvent *event) { if (m_freezedStatus != NO_FREEZED) return; int key = event->key(); - #ifdef WITH_CANON if ((m_stopMotion->m_canon->m_pickLiveViewZoom || - m_stopMotion->m_canon->m_zooming) && - (key == Qt::Key_Left || key == Qt::Key_Right || key == Qt::Key_Up || - key == Qt::Key_Down || key == Qt::Key_2 || key == Qt::Key_4 || - key == Qt::Key_6 || key == Qt::Key_8)) { + m_stopMotion->m_canon->m_zooming) && + (key == Qt::Key_Left || key == Qt::Key_Right || key == Qt::Key_Up || + key == Qt::Key_Down || key == Qt::Key_2 || key == Qt::Key_4 || + key == Qt::Key_6 || key == Qt::Key_8)) { if (m_stopMotion->m_canon->m_liveViewZoomReadyToPick == true) { if (key == Qt::Key_Left || key == Qt::Key_4) { m_stopMotion->m_canon->m_liveViewZoomPickPoint.x -= 10; @@ -1384,19 +1382,17 @@ void SceneViewer::keyPressEvent(QKeyEvent *event) { m_stopMotion->m_canon->calculateZoomPoint(); event->accept(); return; - } - else if (m_stopMotion->m_canon->m_pickLiveViewZoom && - (key == Qt::Key_Escape || key == Qt::Key_Enter || - key == Qt::Key_Return)) { + } else if (m_stopMotion->m_canon->m_pickLiveViewZoom && + (key == Qt::Key_Escape || key == Qt::Key_Enter || + key == Qt::Key_Return)) { m_stopMotion->m_canon->toggleZoomPicking(); event->accept(); return; - } - else + } else #endif #if defined(x64) - if (m_stopMotion->m_liveViewStatus == 2 && - (key == Qt::Key_Enter || key == Qt::Key_Return)) { + if (m_stopMotion->m_liveViewStatus == 2 && + (key == Qt::Key_Enter || key == Qt::Key_Return)) { m_stopMotion->captureImage(); event->accept(); return; diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp index 994ae53..fb5b582 100644 --- a/toonz/sources/toonz/tpanels.cpp +++ b/toonz/sources/toonz/tpanels.cpp @@ -1430,7 +1430,7 @@ OpenFloatingPanel openStopMotionPanelCommand( QObject::tr("Stop Motion Controller")); //----------------------------------------------------------------------------- -#endif // x64 +#endif // x64 //============================================================================= // FxSettings diff --git a/toonz/sources/toonz/xshrowviewer.h b/toonz/sources/toonz/xshrowviewer.h index 67c664c..b74912d 100644 --- a/toonz/sources/toonz/xshrowviewer.h +++ b/toonz/sources/toonz/xshrowviewer.h @@ -101,6 +101,6 @@ protected slots: void onPreviewThis(); }; -} // namespace XsheetGUI; +} // namespace XsheetGUI #endif // XSHROWVIEWER_H diff --git a/toonz/sources/toonzlib/stage.cpp b/toonz/sources/toonzlib/stage.cpp index 59feba4..0db4d80 100644 --- a/toonz/sources/toonzlib/stage.cpp +++ b/toonz/sources/toonzlib/stage.cpp @@ -374,17 +374,15 @@ void StageBuilder::addCell(PlayerSet &players, ToonzScene *scene, TXsheet *xsh, if (!xl) { if (!m_liveViewImage) return; cell = xsh->getCell(row - 1, col); - xl = cell.m_level.getPointer(); + xl = cell.m_level.getPointer(); if (!xl) { return; - } - else { - xl = cell.m_level.getPointer(); + } else { + xl = cell.m_level.getPointer(); TXshSimpleLevel *sl = xl->getSimpleLevel(); if (sl && sl == m_liveViewPlayer.m_sl) { row -= 1; - } - else + } else return; } } @@ -842,8 +840,8 @@ void StageBuilder::addSimpleLevelFrame(PlayerSet &players, void StageBuilder::visit(PlayerSet &players, Visitor &visitor, bool isPlaying) { std::vector masks; - int m = players.size(); - int h = 0; + int m = players.size(); + int h = 0; bool stopMotionShown = false; for (; h < m; h++) { Player &player = players[h]; @@ -881,8 +879,7 @@ void StageBuilder::visit(PlayerSet &players, Visitor &visitor, bool isPlaying) { visitor.onRasterImage(m_liveViewImage.getPointer(), m_liveViewPlayer); stopMotionShown = true; } - } - else { + } else { visitor.onImage(player); } } @@ -898,7 +895,6 @@ void StageBuilder::visit(PlayerSet &players, Visitor &visitor, bool isPlaying) { #else visitor.onImage(player); #endif - } // vale solo per TAB pro for (h = 0; h < (int)masks.size(); h++) visitor.disableMask(); @@ -939,11 +935,11 @@ void Stage::visit(Visitor &visitor, const VisitArgs &args) { sb.m_guidedBackStroke = args.m_guidedBackStroke; #if defined(x64) if (args.m_liveViewImage) { - sb.m_liveViewImage = args.m_liveViewImage; + sb.m_liveViewImage = args.m_liveViewImage; sb.m_liveViewPlayer = args.m_liveViewPlayer; } if (args.m_lineupImage) { - sb.m_lineupImage = args.m_lineupImage; + sb.m_lineupImage = args.m_lineupImage; sb.m_lineupPlayer = args.m_lineupPlayer; } #endif diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index 99423db..1bc2edd 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -1461,7 +1461,8 @@ void TXshSimpleLevel::save(const TFilePath &fp, const TFilePath &oldFp, // backup if (Preferences::instance()->isBackupEnabled() && dOldPath == dDstPath && - TSystem::doesExistFileOrLevel(dDstPath) && !getProperties()->isStopMotionLevel()) + TSystem::doesExistFileOrLevel(dDstPath) && + !getProperties()->isStopMotionLevel()) saveBackup(dDstPath); if (isAreadOnlyLevel(dDstPath)) {