Canon DSLR and Stop Motion Support (#2635)

* Stop Motion Features

Please note that this feature won't appear in the nightly build until some related changes are completed.
This commit is contained in:
Jeremy Bullock 2019-12-23 04:24:44 -07:00 committed by shun-iwasawa
parent fb92fd2ade
commit f159071bf7
35 changed files with 6797 additions and 10 deletions

View file

@ -70,6 +70,23 @@ Rename the following files:
1. Open `$opentoonz/toonz/build/OpenToonz.sln` and change to `Debug` or `Release` in the top bar.
2. The output will be in the corresponding folder in `$opentoonz/toonz/build/`
## Building with extended stop motion support for webcams and Canon DSLR cameras.
You will need three additional libraries.
- [OpenCV](https://opencv.org/)
- [libjpeg-turbo](https://www.libjpeg-turbo.org/)
- The Canon SDK. This requires applying for the Canon developer program and downloading the SDK.
Copy the following folders into the `$opentoonz/thirdparty` folder.
- Copy the Header and library folders from the Canon SDK to `$opentoonz/thirdparty/canon`
- Make sure that the library is the one from the EDSDK_64 folder.
- Copy the lib and include folders from libjpeg-turbo64 into `$opentoonz/thirdparty/libjpeg-turbo64`.
- Copy the include folder from opencv2/build into `$opentoonz/thirdparty/opencv2`
- Copy the lib folder from opencv2/build/x64/vc15 into `$opentoonz/thirdparty/opencv2`
Check the checkbox in CMake to build with stop motion support.
To run the program with stop motion support, you will need to copy the .dll files from opencv2, libjpeg-turbo and the Canon SDK into the folder where your project is built.
## Running the Program
### Setting Up the Program's Path
1. Copy the entire contents of `$opentoonz/toonz/build/Release` to an appropriate folder.

View file

@ -151,6 +151,7 @@ QGroupBox {
qproperty-BottomBelowLineColor: #212223;
}
.tab-flat,
#StopMotionTabBar::tab,
#StyleEditorTabBar::tab,
#PaletteTabBar::tab,
#FxSettingsTabBar::tab {
@ -161,6 +162,7 @@ QGroupBox {
padding: 3 4 3 4;
}
.tab-flat:hover,
#StopMotionTabBar::tab:hover,
#StyleEditorTabBar::tab:hover,
#PaletteTabBar::tab:hover,
#FxSettingsTabBar::tab:hover {
@ -168,6 +170,7 @@ QGroupBox {
color: #94969a;
}
.tab-flat:selected,
#StopMotionTabBar::tab:selected,
#StyleEditorTabBar::tab:selected,
#PaletteTabBar::tab:selected,
#FxSettingsTabBar::tab:selected {
@ -176,6 +179,7 @@ QGroupBox {
border-bottom-color: #414345;
}
.tab-flat:only-one,
#StopMotionTabBar::tab:only-one,
#StyleEditorTabBar::tab:only-one,
#PaletteTabBar::tab:only-one,
#FxSettingsTabBar::tab:only-one {
@ -1158,6 +1162,29 @@ PencilTestPopup {
#LargeSizedText {
font-size: 17px;
}
/* -----------------------------------------------------------------------------
Stop Motion Controller
----------------------------------------------------------------------------- */
#StopMotionController QScrollArea {
margin: 8;
}
#StopMotionController QPushButton {
margin: 2 1;
padding: 0;
}
#StopMotionController #TabBarContainer {
margin-left: -4;
}
#StopMotionController #bottomWidget {
border-top: 1 solid #212223;
padding: 3 2 8 3;
}
#StopMotionController #bottomWidget QPushButton {
padding: 3 5;
}
#StopMotionTabBar::tab::first {
border-left: 1 solid #212223;
}
/* -----------------------------------------------------------------------------
Unknowns + Legacy
----------------------------------------------------------------------------- */

View file

@ -151,6 +151,7 @@ QGroupBox {
qproperty-BottomBelowLineColor: #161616;
}
.tab-flat,
#StopMotionTabBar::tab,
#StyleEditorTabBar::tab,
#PaletteTabBar::tab,
#FxSettingsTabBar::tab {
@ -161,6 +162,7 @@ QGroupBox {
padding: 3 4 3 4;
}
.tab-flat:hover,
#StopMotionTabBar::tab:hover,
#StyleEditorTabBar::tab:hover,
#PaletteTabBar::tab:hover,
#FxSettingsTabBar::tab:hover {
@ -168,6 +170,7 @@ QGroupBox {
color: #8b8b8b;
}
.tab-flat:selected,
#StopMotionTabBar::tab:selected,
#StyleEditorTabBar::tab:selected,
#PaletteTabBar::tab:selected,
#FxSettingsTabBar::tab:selected {
@ -176,6 +179,7 @@ QGroupBox {
border-bottom-color: #303030;
}
.tab-flat:only-one,
#StopMotionTabBar::tab:only-one,
#StyleEditorTabBar::tab:only-one,
#PaletteTabBar::tab:only-one,
#FxSettingsTabBar::tab:only-one {
@ -1158,6 +1162,29 @@ PencilTestPopup {
#LargeSizedText {
font-size: 17px;
}
/* -----------------------------------------------------------------------------
Stop Motion Controller
----------------------------------------------------------------------------- */
#StopMotionController QScrollArea {
margin: 8;
}
#StopMotionController QPushButton {
margin: 2 1;
padding: 0;
}
#StopMotionController #TabBarContainer {
margin-left: -4;
}
#StopMotionController #bottomWidget {
border-top: 1 solid #161616;
padding: 3 2 8 3;
}
#StopMotionController #bottomWidget QPushButton {
padding: 3 5;
}
#StopMotionTabBar::tab::first {
border-left: 1 solid #161616;
}
/* -----------------------------------------------------------------------------
Unknowns + Legacy
----------------------------------------------------------------------------- */

View file

@ -151,6 +151,7 @@ QGroupBox {
qproperty-BottomBelowLineColor: #272727;
}
.tab-flat,
#StopMotionTabBar::tab,
#StyleEditorTabBar::tab,
#PaletteTabBar::tab,
#FxSettingsTabBar::tab {
@ -161,6 +162,7 @@ QGroupBox {
padding: 3 4 3 4;
}
.tab-flat:hover,
#StopMotionTabBar::tab:hover,
#StyleEditorTabBar::tab:hover,
#PaletteTabBar::tab:hover,
#FxSettingsTabBar::tab:hover {
@ -168,6 +170,7 @@ QGroupBox {
color: #a1a1a1;
}
.tab-flat:selected,
#StopMotionTabBar::tab:selected,
#StyleEditorTabBar::tab:selected,
#PaletteTabBar::tab:selected,
#FxSettingsTabBar::tab:selected {
@ -176,6 +179,7 @@ QGroupBox {
border-bottom-color: #484848;
}
.tab-flat:only-one,
#StopMotionTabBar::tab:only-one,
#StyleEditorTabBar::tab:only-one,
#PaletteTabBar::tab:only-one,
#FxSettingsTabBar::tab:only-one {
@ -1158,6 +1162,29 @@ PencilTestPopup {
#LargeSizedText {
font-size: 17px;
}
/* -----------------------------------------------------------------------------
Stop Motion Controller
----------------------------------------------------------------------------- */
#StopMotionController QScrollArea {
margin: 8;
}
#StopMotionController QPushButton {
margin: 2 1;
padding: 0;
}
#StopMotionController #TabBarContainer {
margin-left: -4;
}
#StopMotionController #bottomWidget {
border-top: 1 solid #272727;
padding: 3 2 8 3;
}
#StopMotionController #bottomWidget QPushButton {
padding: 3 5;
}
#StopMotionTabBar::tab::first {
border-left: 1 solid #272727;
}
/* -----------------------------------------------------------------------------
Unknowns + Legacy
----------------------------------------------------------------------------- */

View file

@ -25,6 +25,44 @@ PencilTestPopup {
font-size: 17px;
}
/* -----------------------------------------------------------------------------
Stop Motion Controller
----------------------------------------------------------------------------- */
#StopMotionController {
& QScrollArea {
margin: 8;
}
& QPushButton {
// Adds spacing to buttons, but this setting may be temporary
margin: 2 1;
padding: 0;
}
& #TabBarContainer {
margin-left: -4; // reset left edge margin
}
& #bottomWidget {
border-top: 1 solid @accent;
padding: 3 2 8 3;
& QPushButton {
// override above margin reset
padding: 3 5;
}
}
}
#StopMotionTabBar {
&::tab {
&:extend(.tab-flat all);
&::first {
// add a border to first item on
// the left side due to the spacer
// coded in the cpp file
border-left: 1 solid @accent;
}
}
}
/* -----------------------------------------------------------------------------
Unknowns + Legacy
----------------------------------------------------------------------------- */

View file

@ -151,6 +151,7 @@ QGroupBox {
qproperty-BottomBelowLineColor: #404040;
}
.tab-flat,
#StopMotionTabBar::tab,
#StyleEditorTabBar::tab,
#PaletteTabBar::tab,
#FxSettingsTabBar::tab {
@ -161,6 +162,7 @@ QGroupBox {
padding: 3 4 3 4;
}
.tab-flat:hover,
#StopMotionTabBar::tab:hover,
#StyleEditorTabBar::tab:hover,
#PaletteTabBar::tab:hover,
#FxSettingsTabBar::tab:hover {
@ -168,6 +170,7 @@ QGroupBox {
color: #fff;
}
.tab-flat:selected,
#StopMotionTabBar::tab:selected,
#StyleEditorTabBar::tab:selected,
#PaletteTabBar::tab:selected,
#FxSettingsTabBar::tab:selected {
@ -176,6 +179,7 @@ QGroupBox {
border-bottom-color: #808080;
}
.tab-flat:only-one,
#StopMotionTabBar::tab:only-one,
#StyleEditorTabBar::tab:only-one,
#PaletteTabBar::tab:only-one,
#FxSettingsTabBar::tab:only-one {
@ -1158,6 +1162,29 @@ PencilTestPopup {
#LargeSizedText {
font-size: 17px;
}
/* -----------------------------------------------------------------------------
Stop Motion Controller
----------------------------------------------------------------------------- */
#StopMotionController QScrollArea {
margin: 8;
}
#StopMotionController QPushButton {
margin: 2 1;
padding: 0;
}
#StopMotionController #TabBarContainer {
margin-left: -4;
}
#StopMotionController #bottomWidget {
border-top: 1 solid #404040;
padding: 3 2 8 3;
}
#StopMotionController #bottomWidget QPushButton {
padding: 3 5;
}
#StopMotionTabBar::tab::first {
border-left: 1 solid #404040;
}
/* -----------------------------------------------------------------------------
Unknowns + Legacy
----------------------------------------------------------------------------- */

2
thirdparty/canon/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
Header/*
library/*

2
thirdparty/canon/copy_canon_sdk.txt vendored Normal file
View file

@ -0,0 +1,2 @@
Copy the Header and library folders from the Canon SDK to this folder.
Make sure that the library is the one from the EDSDK_64 folder.

2
thirdparty/libjpeg-turbo64/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
include/*
lib/*

0
thirdparty/libjpeg-turbo64/.gitkeep vendored Normal file
View file

View file

@ -0,0 +1 @@
Copy the lib and include folders from libjpeg-turbo64 into this folder.

2
thirdparty/opencv2/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
lib/*
include/*

0
thirdparty/opencv2/.gitkeep vendored Normal file
View file

2
thirdparty/opencv2/copy_opencv2.txt vendored Normal file
View file

@ -0,0 +1,2 @@
Copy the include folder from opencv2/build into this folder
Copy the lib folder from opencv2/build/x64/vc15 into this folder

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_BUILD_TYPE_INIT Release)
@ -101,6 +101,7 @@ endif()
option(WITH_SYSTEM_LZO "Use the system LZO library instead of 'thirdpary'" ${_init_SYSTEM_LZO})
option(WITH_SYSTEM_SUPERLU "Use the system SuperLU library instead of 'thirdpary'" ${_init_SYSTEM_SUPERLU})
option(WITH_STOPMOTION "Build with Stop Motion features - Requires Canon SDK" OFF)
# avoid using again
option_defaults_clear()
@ -258,7 +259,7 @@ if(Qt5Core_VERSION VERSION_LESS QT_MINIMUM_VERSION)
endif()
unset(QT_MINIMUM_VERSION)
if(BUILD_ENV_MSVC)
if(BUILD_ENV_MSVC AND NOT WITH_STOPMOTION)
include_directories(
SYSTEM
${SDKROOT}/glut/3.7.6/include
@ -270,6 +271,21 @@ if(BUILD_ENV_MSVC)
)
endif()
if(BUILD_ENV_MSVC AND WITH_STOPMOTION)
include_directories(
SYSTEM
${SDKROOT}/glut/3.7.6/include
${SDKROOT}/zlib-1.2.8
${SDKROOT}/LibJPEG/jpeg-9
${SDKROOT}/canon/Header
${SDKROOT}/libjpeg-turbo64/include
${SDKROOT}/opencv2/include
)
add_definitions(
-DGLUT_NO_LIB_PRAGMA
)
endif()
get_target_property(QtCore_location Qt5::Core LOCATION)
get_target_property(QtWidget_location Qt5::Widgets LOCATION)
message(STATUS "Qt Core Location:" ${QtCore_location})
@ -330,6 +346,14 @@ if(BUILD_ENV_MSVC)
set(SUPERLU_LIB ${SDKROOT}/superlu/SuperLU_${MSVC_LIB_VERSION}_${PLATFORM}.lib)
set(OPENBLAS_LIB ${SDKROOT}/openblas/libopenblas_${PLATFORM}.lib)
set(USB_LIB) # unused
if (WITH_STOPMOTION)
set(CANON_LIB ${SDKROOT}/canon/library/EDSDK.lib)
set(TURBOJPEG_LIB ${SDKROOT}/libjpeg-turbo64/lib/turbojpeg.lib)
set(OPENCV_LIB
optimized ${SDKROOT}/opencv2/lib/opencv_world412.lib
debug ${SDKROOT}/opencv2/lib/opencv_world412d.lib
)
endif()
if(PLATFORM EQUAL 32)
set(QT_LIB ${SDKROOT}/quicktime/QT73SDK/Libraries/QTMLClient.lib)
endif()

View file

@ -48,11 +48,13 @@ public:
//! adpoted.
bool m_whiteTransp, //!< <TT>[default: false]</TT> Whether white should be
//! visualized as transparent.
m_premultiply; //!< <TT>[default: false]</TT> Whether level images should
//! visualized as transparent.
m_premultiply, //!< <TT>[default: false]</TT> Whether level images should
//! be
//! premultiplied by Toonz for alpha compositing (because they
//! are not).
//! premultiplied by Toonz for alpha compositing (because they
//! are not).
m_isStopMotionLevel;
public:
LevelOptions(); //!< Constructs with default values.
@ -220,6 +222,13 @@ ie
}
bool whiteTransp() const { return m_options.m_whiteTransp; }
void setIsStopMotion(bool isStopMotion) // Is this level used for Stop Motion
{
m_options.m_isStopMotionLevel = isStopMotion;
}
bool isStopMotionLevel() const { return m_options.m_isStopMotionLevel; }
private:
TPointD m_imageDpi;

View file

@ -84,7 +84,7 @@ public:
Tile(const TRasterCM32P &ras, const TPoint &p);
~Tile();
QString id() const override {
return "TileCM" + QString::number((uintptr_t)this);
return "TileCM" + QString::number((uintptr_t) this);
}
Tile *clone() const override;
@ -124,7 +124,7 @@ public:
Tile(const TRasterP &ras, const TPoint &p);
~Tile();
QString id() const override {
return "TTileSet32::Tile" + QString::number((uintptr_t)this);
return "TTileSet32::Tile" + QString::number((uintptr_t) this);
}
Tile *clone() const override;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,380 @@
#pragma once
#ifndef STOPMOTION_H
#define STOPMOTION_H
#ifdef WITH_STOPMOTION
// Canon Includes
#include "EDSDK.h"
#include "EDSDKErrors.h"
#include "EDSDKTypes.h"
#include "turbojpeg.h"
#include "opencv2/opencv.hpp"
// Toonz Includes
#include "traster.h"
#include "toonzqt/gutil.h"
#include "toonzqt/dvdialog.h"
#include <QObject>
class QCamera;
class QCameraInfo;
class QDialog;
class QTimer;
enum ASPECT_RATIO { FOUR_THREE = 0, THREE_TWO, SIXTEEN_NINE, OTHER_RATIO };
#endif
#include <QThread>
//=============================================================================
// JpgConverter
//-----------------------------------------------------------------------------
class JpgConverter : public QThread {
Q_OBJECT
#ifdef WITH_STOPMOTION
EdsStreamRef m_stream;
TRaster32P m_finalImage;
bool m_scale = false;
int m_scaleWidth = 0;
public:
JpgConverter();
~JpgConverter();
void setStream(EdsStreamRef stream);
void setScale(bool scale) { m_scale = scale; }
void setScaleWidth(bool scaleWidth) { m_scaleWidth = scaleWidth; }
TRaster32P getImage() { return m_finalImage; }
void convertFromJpg();
protected:
void run() override;
#endif
signals:
void imageReady(bool);
};
class StopMotion : public QObject { // Singleton
Q_OBJECT
public:
static StopMotion* instance() {
static StopMotion _instance;
return &_instance;
};
#ifdef WITH_STOPMOTION
private:
StopMotion();
~StopMotion();
int m_opacity = 255.0;
int m_xSheetFrameNumber = 1;
int m_frameNumber = 1;
int m_subsampling = 1;
QString m_levelName = "";
QString m_fileType = "jpg";
QString m_filePath = "+extras";
QString m_frameInfoText = "";
QString m_infoColorName = "";
QString m_frameInfoToolTip = "";
QSize m_allowedCameraSize;
QStringList m_isoOptions, m_shutterSpeedOptions, m_apertureOptions,
m_exposureOptions, m_whiteBalanceOptions, m_colorTempOptions,
m_imageQualityOptions, m_pictureStyleOptions;
std::map<EdsUInt32, std::string> m_avMap, m_tvMap, m_isoMap, m_modeMap,
m_exposureMap, m_whiteBalanceMap, m_imageQualityMap, m_pictureStyleMap;
QDialog *m_fullScreen1, *m_fullScreen2, *m_fullScreen3;
int m_screenCount;
bool m_useMjpg = true;
bool m_useNumpadShortcuts = false;
bool m_numpadForStyleSwitching = true;
bool m_turnOnRewind = false;
QTimer* m_reviewTimer;
std::map<std::string, QAction*> m_oldActionMap;
// Webcam Properties
QList<QCameraInfo> m_webcams;
QCamera* m_webcam;
cv::VideoCapture m_cvWebcam;
static EdsError EDSCALLBACK handleObjectEvent(EdsObjectEvent event,
EdsBaseRef object,
EdsVoid* context);
static EdsError EDSCALLBACK handlePropertyEvent(EdsPropertyEvent event,
EdsPropertyID property,
EdsUInt32 param,
EdsVoid* context);
static EdsError EDSCALLBACK handleStateEvent(EdsStateEvent event,
EdsUInt32 parameter,
EdsVoid* context);
static EdsError EDSCALLBACK handleCameraAddedEvent(EdsVoid* context);
void buildAvMap();
void buildTvMap();
void buildIsoMap();
void buildModeMap();
void buildExposureMap();
void buildWhiteBalanceMap();
void buildImageQualityMap();
void buildPictureStyleMap();
public:
enum LiveViewStatus {
LiveViewClosed = 0,
LiveViewStarting,
LiveViewOpen,
LiveViewPaused
};
JpgConverter* m_converter;
bool m_useScaledImages = true;
bool m_usingWebcam = false;
bool m_blackCapture = true;
bool m_placeOnXSheet = true;
int m_reviewTime = 2;
int m_liveViewStatus = LiveViewClosed;
bool m_hasLiveViewImage, m_hasLineUpImage, m_showLineUpImage;
bool m_alwaysLiveView = false;
bool m_active = false;
bool m_userCalledPause = false;
bool m_converterSucceeded = false;
QString m_tempFile;
QTimer* m_timer;
QList<QSize> m_webcamResolutions;
// Canon Public Properties
EdsError m_error = EDS_ERR_OK;
bool m_isSDKLoaded = false;
EdsUInt32 m_count = 0;
EdsCameraListRef m_cameraList = NULL;
EdsCameraRef m_camera = NULL;
bool m_sessionOpen = false;
bool m_zooming = false;
std::string m_cameraName;
TRaster32P m_liveViewImage, m_newImage, m_lineUpImage;
TDimension m_liveViewImageDimensions = TDimension(0, 0);
TDimension m_fullImageDimensions = TDimension(0, 0);
TDimension m_proxyImageDimensions = TDimension(0, 0);
TPointD m_proxyDpi = TPointD(0.0, 0.0);
TPointD m_liveViewDpi = TPointD(0.0, 0.0);
TPointD m_fullImageDpi = TPointD(0.0, 0.0);
TPoint m_liveViewZoomOffset = TPoint(0, 0);
EdsUInt32 m_liveViewZoom = 1;
bool m_pickLiveViewZoom = false;
TPointD m_liveViewZoomPickPoint = TPointD(0.0, 0.0);
TPoint m_zoomRect = TPoint(0, 0);
TPoint m_calculatedZoomPoint = TPoint(0, 0);
TPoint m_finalZoomPoint = TPoint(0, 0);
// Webcam Public Properties
QString m_webcamDeviceName;
QString m_webcamDescription;
int m_webcamIndex = -1;
bool m_useDirectShow = true;
int m_webcamWidth = 0;
int m_webcamHeight = 0;
void setOpacity(int opacity);
int getOpacity() { return m_opacity; }
void setUseScaledImages(bool on);
bool getUseScaledImages() { return m_useScaledImages; }
void setAlwaysLiveView(bool on);
bool getAlwaysLiveView() { return m_alwaysLiveView; }
void setBlackCapture(bool on);
bool getBlackCapture() { return m_blackCapture; }
void setPlaceOnXSheet(bool on);
bool getPlaceOnXSheet() { return m_placeOnXSheet; }
void setUseMjpg(bool on);
bool getUseMjpg() { return m_useMjpg; }
void setUseNumpadShortcuts(bool on);
bool getUseNumpadShortcuts() { return m_useNumpadShortcuts; }
void toggleNumpadShortcuts(bool on);
void setReviewTime(int time);
int getReviewTime() { return m_reviewTime; }
void setXSheetFrameNumber(int frameNumber);
int getXSheetFrameNumber() { return m_xSheetFrameNumber; }
void setFrameNumber(int frameNumber);
int getFrameNumber() { return m_frameNumber; }
void setLevelName(QString levelName);
QString getLevelName() { return m_levelName; }
void setFileType(QString fileType);
QString getFileType() { return m_fileType; }
void setFilePath(QString filePath);
QString getFilePath() { return m_filePath; }
void updateLevelNameAndFrame(std::wstring levelName);
void setToNextNewLevel();
void nextFrame();
void previousFrame();
void lastFrame();
void nextName();
void previousName();
QString getFrameInfoText() { return m_frameInfoText; }
QString getInfoColorName() { return m_infoColorName; }
QString getFrameInfoToolTip() { return m_frameInfoToolTip; }
bool toggleLiveView();
void pauseLiveView();
void getSubsampling();
void setSubsampling();
int getSubsamplingValue() { return m_subsampling; }
void setSubsamplingValue(int subsampling);
void captureImage();
void postImportProcess();
void refreshFrameInfo();
void refreshCameraList();
void changeCameras(int index);
void raiseOpacity();
void lowerOpacity();
void jumpToCameraFrame();
std::string getTEnvCameraName();
void setTEnvCameraName(std::string name);
std::string getTEnvCameraResolution();
void setTEnvCameraResolution(std::string resolution);
void saveJpg(TRaster32P, TFilePath path);
bool loadJpg(TFilePath path, TRaster32P& image);
bool loadLineUpImage();
// Webcam Commands
QList<QCameraInfo> getWebcams();
QCamera* getWebcam() { return m_webcam; }
void setWebcam(QCamera* camera);
bool initWebcam(int index = 0);
void releaseWebcam();
void setWebcamResolution(QString resolution);
void getWebcamImage();
bool translateIndex(int index);
bool getUseDirectShow() { return m_useDirectShow; }
void setUseDirectShow(int state);
QList<QSize> getWebcamResolutions() { return m_webcamResolutions; }
// void changeResolutions(int index);
// Canon Commands
EdsError initializeCanonSDK();
void closeCanonSDK();
EdsCameraListRef getCameraList();
EdsError releaseCameraList();
int getCameraCount();
EdsError getCamera(int index);
EdsError releaseCamera();
void cameraAdded();
EdsError openCameraSession();
EdsError closeCameraSession();
std::string getCameraName();
EdsError downloadImage(EdsBaseRef object);
EdsError takePicture();
EdsError startLiveView();
EdsError endLiveView();
EdsError downloadEVFData();
QStringList getIsoOptions() { return m_isoOptions; }
QStringList getShutterSpeedOptions() { return m_shutterSpeedOptions; }
QStringList getApertureOptions() { return m_apertureOptions; }
QStringList getExposureOptions() { return m_exposureOptions; }
QStringList getWhiteBalanceOptions() { return m_whiteBalanceOptions; }
QStringList getColorTemperatureOptions() { return m_colorTempOptions; }
QStringList getImageQualityOptions() { return m_imageQualityOptions; }
QStringList getPictureStyleOptions() { return m_pictureStyleOptions; }
EdsError getAvailableShutterSpeeds();
EdsError getAvailableIso();
EdsError getAvailableApertures();
EdsError getAvailableExposureCompensations();
EdsError getAvailableWhiteBalances();
EdsError getAvailableImageQualities();
EdsError getAvailablePictureStyles();
void buildColorTemperatures();
QString getCurrentShutterSpeed();
QString getCurrentIso();
QString getCurrentAperture();
QString getCurrentExposureCompensation();
QString getCurrentWhiteBalance();
QString getCurrentColorTemperature();
QString getCurrentImageQuality();
QString getCurrentPictureStyle();
EdsError setShutterSpeed(QString shutterSpeed);
EdsError setIso(QString iso);
EdsError setAperture(QString aperture);
EdsError setExposureCompensation(QString exposure);
EdsError setWhiteBalance(QString whiteBalance);
EdsError setColorTemperature(QString temp);
EdsError setImageQuality(QString quality);
EdsError setPictureStyle(QString style);
QString getMode();
void refreshOptions();
EdsError zoomLiveView();
EdsError setZoomPoint();
void makeZoomPoint(TPointD pos);
EdsError focusNear();
EdsError focusFar();
EdsError focusNear2();
EdsError focusFar2();
EdsError focusNear3();
EdsError focusFar3();
#endif // WITH_STOPMOTION
public slots:
void onImageReady(const bool&);
void onFinished();
void onTimeout();
void onReviewTimeout();
void update();
bool importImage();
void onSceneSwitched();
void onPlaybackChanged();
signals:
void newLiveViewImageReady();
void liveViewStopped();
void newImageReady();
void cameraChanged();
void optionsChanged();
void liveViewChanged(bool);
void newCameraSelected(int, bool);
void webcamResolutionsChanged();
void newWebcamResolutionSelected(int);
void apertureOptionsChanged();
void isoOptionsChanged();
void shutterSpeedOptionsChanged();
void exposureOptionsChanged();
void whiteBalanceOptionsChanged();
void colorTemperatureChanged();
void imageQualityOptionsChanged();
void pictureStyleOptionsChanged();
void apertureChangedSignal(QString);
void isoChangedSignal(QString);
void shutterSpeedChangedSignal(QString);
void exposureChangedSignal(QString);
void whiteBalanceChangedSignal(QString);
void colorTemperatureChangedSignal(QString);
void imageQualityChangedSignal(QString);
void pictureStyleChangedSignal(QString);
void modeChanged();
void newDimensions();
void subsamplingChanged(int);
void filePathChanged(QString);
void levelNameChanged(QString);
void fileTypeChanged(QString);
void xSheetFrameNumberChanged(int);
void frameNumberChanged(int);
void frameInfoTextChanged(QString);
void opacityChanged(int);
void scaleFullSizeImagesSignal(bool);
void blackCaptureSignal(bool);
void liveViewOnAllFramesSignal(bool);
void placeOnXSheetSignal(bool);
void useMjpgSignal(bool);
void useNumpadSignal(bool);
void useDirectShowSignal(bool);
void reviewTimeChangedSignal(int);
void updateCameraList();
};
#endif // STOPMOTION_H

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,206 @@
#pragma once
#ifndef STOPMOTIONCONTROLLER_H
#define STOPMOTIONCONTROLLER_H
// TnzCore includes
#include "stopmotion.h"
#include "penciltestpopup.h"
// TnzQt includes
#include "toonzqt/tabbar.h"
#include "toonzqt/gutil.h"
// Qt includes
#include <QWidget>
#include <QFrame>
#include <QTabBar>
#include <QSlider>
#include <QScrollArea>
#include <QPointF>
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//=============================================
// Forward declarations
class TColorStyle;
class TPalette;
class TXshLevelHandle;
class QGridLayout;
class QLabel;
class QStackedWidget;
class QSlider;
class QRadioButton;
class QButtonGroup;
class QPushButton;
class QTabWidget;
class QToolBar;
class QTimer;
//=============================================================================
// StopMotionController
//-----------------------------------------------------------------------------
class StopMotionController final : public QWidget {
Q_OBJECT
StopMotion *m_stopMotion;
QWidget *m_parent;
TXshLevelHandle
*m_levelHandle; //!< for clearing the level cache when the color changed
DVGui::TabBar *m_tabBar;
QFrame *m_mainControlsPage;
QFrame *m_cameraSettingsPage;
QFrame *m_optionsPage;
QStackedWidget *m_stackedChooser;
TabBarContainter *m_tabBarContainer; //!< Tabs container for style types.
QPushButton *m_toggleLiveViewButton, *m_setToCurrentXSheetFrameButton;
QPushButton *m_fileFormatOptionButton, *m_captureButton, *m_zoomButton,
*m_pickZoomButton, *m_focusNearButton, *m_focusFarButton,
*m_focusNear2Button, *m_focusNear3Button, *m_focusFar2Button,
*m_focusFar3Button, *m_captureFilterSettingsBtn;
QHBoxLayout *m_focusAndZoomLayout;
QLabel *m_frameInfoLabel, *m_cameraSettingsLabel, *m_cameraModeLabel,
*m_kelvinLabel, *m_resolutionLabel, *m_directShowLabel;
QToolButton *m_previousLevelButton, *m_previousFrameButton,
*m_previousXSheetFrameButton;
QComboBox *m_cameraListCombo, *m_fileTypeCombo, *m_isoCombo,
*m_shutterSpeedCombo, *m_exposureCombo, *m_apertureCombo,
*m_whiteBalanceCombo, *m_kelvinCombo, *m_resolutionCombo,
*m_imageQualityCombo, *m_pictureStyleCombo;
LevelNameLineEdit *m_levelNameEdit;
QCheckBox *m_blackScreenForCapture, *m_useScaledFullSizeImages,
*m_placeOnXSheetCB, *m_directShowCB, *m_liveViewOnAllFramesCB,
*m_useMjpgCB, *m_useNumpadCB;
DVGui::FileField *m_saveInFileFld;
DVGui::IntLineEdit *m_xSheetFrameNumberEdit;
FrameNumberLineEdit *m_frameNumberEdit;
DVGui::IntField *m_onionOpacityFld, *m_postCaptureReviewFld,
*m_subsamplingFld;
PencilTestSaveInFolderPopup *m_saveInFolderPopup;
public:
StopMotionController(QWidget *parent = 0);
~StopMotionController();
protected:
void updateStopMotion();
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
// void mousePressEvent(QMouseEvent *event) override;
// void keyPressEvent(QKeyEvent *event);
protected slots:
void refreshCameraList();
void refreshCameraListCalled();
void refreshOptionsLists();
void refreshApertureList();
void refreshShutterSpeedList();
void refreshIsoList();
void refreshExposureList();
void refreshWhiteBalanceList();
void refreshColorTemperatureList();
void refreshImageQualityList();
void refreshPictureStyleList();
void onCameraListComboActivated(int index);
void onResolutionComboActivated(const QString &itemText);
void onCaptureFilterSettingsBtnPressed();
void onFileFormatOptionButtonPressed();
void onLevelNameEdited();
void onNextName();
void onPreviousName();
void onNextFrame();
void onPreviousFrame();
void onNextNewLevel();
void onLastFrame();
void onFileTypeActivated();
void onFrameNumberChanged();
void onXSheetFrameNumberChanged();
void onFrameCaptured(QImage &image);
void onOnionOpacityFldEdited();
void onOnionOpacitySliderChanged(bool ignore);
void onLiveViewToggleClicked();
void onCaptureButtonClicked(bool);
void setPage(int);
void onScaleFullSizeImagesChanged(int checked);
void onBlackScreenForCaptureChanged(int checked);
void onPlaceOnXSheetChanged(int checked);
void onUseMjpgChanged(int checked);
void onUseDirectShowChanged(int checked);
void onLiveViewOnAllFramesChanged(int checked);
void onUseNumpadChanged(int checked);
void updateDimensions();
void onSaveInPathEdited();
void onSceneSwitched();
void onPreviousXSheetFrame();
void onNextXSheetFrame();
void setToCurrentXSheetFrame();
void onApertureChanged(int index);
void onShutterSpeedChanged(int index);
void onIsoChanged(int index);
void onExposureChanged(int index);
void onWhiteBalanceChanged(int index);
void onColorTemperatureChanged(int index);
void onImageQualityChanged(int index);
void onPictureStyleChanged(int index);
void refreshMode();
void onZoomPressed();
void onPickZoomPressed();
void onFocusNear();
void onFocusFar();
void onFocusNear2();
void onFocusFar2();
void onFocusNear3();
void onFocusFar3();
void onCaptureReviewFldEdited();
void onCaptureReviewSliderChanged(bool ignore);
void onSubsamplingFldEdited();
void onSubsamplingSliderChanged(bool ignore);
void onSubsamplingChanged(int);
void onFilePathChanged(QString);
void onLevelNameChanged(QString);
void onFileTypeChanged(QString);
void onXSheetFrameNumberChanged(int);
void onFrameNumberChanged(int);
void onFrameInfoTextChanged(QString);
void onOpacityChanged(int opacity);
void onScaleFullSizeImagesSignal(bool);
void onBlackCaptureSignal(bool);
void onLiveViewOnAllFramesSignal(bool);
void onPlaceOnXSheetSignal(bool);
void onUseMjpgSignal(bool);
void onUseDirectShowSignal(bool);
void onReviewTimeChangedSignal(int);
void onUseNumpadSignal(bool);
void onLiveViewChanged(bool);
void onNewCameraSelected(int, bool);
void onWebcamResolutionsChanged();
void onNewWebcamResolutionSelected(int);
void onApertureChangedSignal(QString);
void onIsoChangedSignal(QString);
void onShutterSpeedChangedSignal(QString);
void onExposureChangedSignal(QString);
void onWhiteBalanceChangedSignal(QString);
void onColorTemperatureChangedSignal(QString);
void onImageQualityChangedSignal(QString);
void onPictureStyleChangedSignal(QString);
public slots:
void openSaveInFolderPopup();
};
#endif // STOPMOTIONCONTROLLER_H

View file

@ -122,6 +122,14 @@ set(MOC_HEADERS
xshtoolbar.h
)
if(WITH_STOPMOTION)
set(MOC_HEADERS
${MOC_HEADERS}
../stopmotion/stopmotion.h
../stopmotion/stopmotioncontroller.h
)
endif()
set(HEADERS
${MOC_HEADERS}
celldata.h
@ -346,6 +354,14 @@ set(SOURCES
predict3d.cpp
)
if(WITH_STOPMOTION)
set(SOURCES
${SOURCES}
../stopmotion/stopmotion.cpp
../stopmotion/stopmotioncontroller.cpp
)
endif()
add_translation(toonz ${HEADERS} ${SOURCES})
set(OBJCSOURCES filebrowsermodel.cpp)
@ -400,6 +416,11 @@ include_directories(
../../sources/toonzqt
)
if (WITH_STOPMOTION)
include_directories(../../sources/stopmotion)
add_definitions(-DWITH_STOPMOTION)
endif()
if(BUILD_ENV_APPLE)
include_directories(../../sources/mousedragfilter)
endif()
@ -415,7 +436,15 @@ if(BUILD_TARGET_WIN)
endif()
endif()
if(BUILD_ENV_MSVC)
if(BUILD_ENV_MSVC AND WITH_STOPMOTION)
target_link_libraries(OpenToonz
Qt5::WinMain Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml
Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia
${GL_LIB} ${GLUT_LIB}
${CANON_LIB} ${TURBOJPEG_LIB} ${OPENCV_LIB} strmiids
tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm
)
elseif(BUILD_ENV_MSVC)
target_link_libraries(OpenToonz
Qt5::WinMain Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml
Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia

View file

@ -1972,6 +1972,11 @@ void MainWindow::defineActions() {
createMenuWindowsAction(MI_OpenToolbar, tr("&Toolbar"), "");
createMenuWindowsAction(MI_OpenToolOptionBar, tr("&Tool Option Bar"), "");
createMenuWindowsAction(MI_OpenCommandToolbar, tr("&Command Bar"), "");
#ifdef WITH_STOPMOTION
createMenuWindowsAction(MI_OpenStopMotionPanel, tr("&Stop Motion Controls"),
"");
#endif
createMenuWindowsAction(MI_OpenLevelView, tr("&Viewer"), "");
#ifdef LINETEST
createMenuWindowsAction(MI_OpenLineTestCapture, tr("&LineTest Capture"), "");
@ -2291,6 +2296,20 @@ void MainWindow::defineActions() {
ToolCommandType);
createMiscAction("A_FxSchematicToggle", tr("Toggle FX/Stage schematic"), "");
#ifdef WITH_STOPMOTION
createAction(MI_StopMotionCapture, tr("Capture Stop Motion Frame"), "Enter");
createAction(MI_StopMotionRaiseOpacity, tr("Raise Stop Motion Opacity"), "");
createAction(MI_StopMotionLowerOpacity, tr("Lower Stop Motion Opacity"), "");
createAction(MI_StopMotionToggleLiveView, tr("Toggle Stop Motion Live View"),
"");
createAction(MI_StopMotionToggleZoom, tr("Toggle Stop Motion Zoom"), "");
createAction(MI_StopMotionLowerSubsampling,
tr("Lower Stop Motion Level Subsampling"), "");
createAction(MI_StopMotionRaiseSubsampling,
tr("Raise Stop Motion Level Subsampling"), "");
createAction(MI_StopMotionJumpToCamera, tr("Go to Stop Motion Insert Frame"),
"");
#endif
}
//-----------------------------------------------------------------------------

View file

@ -1423,6 +1423,9 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
addMenuItem(windowsMenu, MI_OpenTMessage);
addMenuItem(windowsMenu, MI_OpenHistoryPanel);
addMenuItem(windowsMenu, MI_AudioRecording);
#ifdef WITH_STOPMOTION
addMenuItem(windowsMenu, MI_OpenStopMotionPanel);
#endif
addMenuItem(windowsMenu, MI_StartupPopup);
#ifdef LINETEST
windowsMenu->addSeparator();

View file

@ -95,6 +95,7 @@
#define MI_OpenCommandToolbar "MI_OpenCommandToolbar"
#define MI_OpenToolOptionBar "MI_OpenToolOptionBar"
#define MI_OpenLevelView "MI_OpenLevelView"
#define MI_OpenStopMotionPanel "MI_OpenStopMotionPanel"
#ifdef LINETEST
#define MI_OpenExport "MI_OpenExport"
#define MI_OpenLineTestView "MI_OpenLineTestView"
@ -351,6 +352,15 @@
#define MI_TouchGestureControl "MI_TouchGestureControl"
#define MI_SeparateColors "MI_SeparateColors"
#define MI_StopMotionCapture "MI_StopMotionCapture"
#define MI_StopMotionRaiseOpacity "MI_StopMotionRaiseOpacity"
#define MI_StopMotionLowerOpacity "MI_StopMotionLowerOpacity"
#define MI_StopMotionToggleLiveView "MI_StopMotionToggleLiveView"
#define MI_StopMotionToggleZoom "MI_StopMotionToggleZoom"
#define MI_StopMotionLowerSubsampling "MI_StopMotionLowerSubsampling"
#define MI_StopMotionRaiseSubsampling "MI_StopMotionRaiseSubsampling"
#define MI_StopMotionJumpToCamera "MI_StopMotionJumpToCamera"
#define MI_OpenOnlineManual "MI_OpenOnlineManual"
#define MI_ClearCacheFolder "MI_ClearCacheFolder"
#endif

View file

@ -11,6 +11,7 @@
#include "menubarcommandids.h"
#include "ruler.h"
#include "locatorpopup.h"
#include "../stopmotion/stopmotion.h"
// TnzTools includes
#include "tools/cursors.h"
@ -577,6 +578,9 @@ SceneViewer::SceneViewer(ImageUtils::FullScreenWidget *parent)
, m_isBusyOnTabletMove(false) {
m_visualSettings.m_sceneProperties =
TApp::instance()->getCurrentScene()->getScene()->getProperties();
#ifdef WITH_STOPMOTION
m_stopMotion = StopMotion::instance();
#endif
// Enables multiple key input.
setAttribute(Qt::WA_KeyCompression);
// Enables input methods for Asian languages.
@ -847,6 +851,13 @@ void SceneViewer::showEvent(QShowEvent *) {
connect(app, SIGNAL(tabletLeft()), this, SLOT(resetTabletStatus()));
if (m_stopMotion) {
connect(m_stopMotion, SIGNAL(newLiveViewImageReady()), this,
SLOT(onNewStopMotionImageReady()));
connect(m_stopMotion, SIGNAL(liveViewStopped()), this,
SLOT(onStopMotionLiveViewStopped()));
}
if (m_hRuler && m_vRuler) {
if (!viewRulerToggle.getStatus()) {
m_hRuler->hide();
@ -901,6 +912,14 @@ void SceneViewer::hideEvent(QHideEvent *) {
if (toolHandle) toolHandle->disconnect(this);
disconnect(app, SIGNAL(tabletLeft()), this, SLOT(resetTabletStatus()));
if (!m_stopMotion == NULL) {
disconnect(m_stopMotion, SIGNAL(newImageReady()), this,
SLOT(onNewStopMotionImageReady()));
disconnect(m_stopMotion, SIGNAL(liveViewStopped()), this,
SLOT(onStopMotionLiveViewStopped()));
}
// hide locator
if (m_locator && m_locator->isVisible()) m_locator->hide();
}
@ -923,6 +942,41 @@ double SceneViewer::getHGuide(int index) { return m_hRuler->getGuide(index); }
//-----------------------------------------------------------------------------
void SceneViewer::onNewStopMotionImageReady() {
#ifdef WITH_STOPMOTION
if (m_stopMotion->m_hasLineUpImage) {
// if (m_hasStopMotionLineUpImage) delete m_stopMotionLineUpImage;
// is there a way to do this without cloning the image twice?
// TRasterImageP image = m_stopMotion->m_lineUpImage->clone();
m_stopMotionLineUpImage =
(TRasterImageP)m_stopMotion->m_lineUpImage->clone();
// m_stopMotionLineUpImage = (TRasterImage *)image->cloneImage();
m_stopMotionLineUpImage->setDpi(m_stopMotion->m_liveViewDpi.x,
m_stopMotion->m_liveViewDpi.y);
m_hasStopMotionLineUpImage = true;
}
if (m_stopMotion->m_hasLiveViewImage) {
// if (m_hasStopMotionImage) delete m_stopMotionImage;
// is there a way to do this without cloning the image twice?
// TRasterImageP image = m_stopMotion->m_liveViewImage->clone();
m_stopMotionImage = m_stopMotion->m_liveViewImage->clone();
// m_stopMotionImage = (TRasterImage *)image->cloneImage();
m_stopMotionImage->setDpi(m_stopMotion->m_liveViewDpi.x,
m_stopMotion->m_liveViewDpi.y);
m_hasStopMotionImage = true;
if (m_stopMotion->m_pickLiveViewZoom) {
setToolCursor(this, ToolCursor::ZoomCursor);
}
onSceneChanged();
}
#endif
}
//-----------------------------------------------------------------------------
void SceneViewer::onStopMotionLiveViewStopped() { onSceneChanged(); }
//-----------------------------------------------------------------------------
void SceneViewer::initializeGL() {
initializeOpenGLFunctions();
@ -1700,6 +1754,29 @@ void SceneViewer::drawScene() {
Stage::visit(painter, args);
}
#ifdef WITH_STOPMOTION
if (!frameHandle->isPlaying() && m_stopMotion->m_liveViewStatus == 2) {
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;
painter.onRasterImage(m_stopMotionLineUpImage.getPointer(), smPlayer);
}
if (m_hasStopMotionImage) {
Stage::Player smPlayer;
double dpiX, dpiY;
m_stopMotionImage->getDpi(dpiX, dpiY);
smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY);
bool hide_opacity =
m_stopMotion->m_zooming || m_stopMotion->m_pickLiveViewZoom;
smPlayer.m_opacity = hide_opacity ? 255.0 : m_stopMotion->getOpacity();
painter.onRasterImage(m_stopMotionImage.getPointer(), smPlayer);
}
}
#endif
assert(glGetError() == 0);
painter.flushRasterImages();

View file

@ -38,6 +38,7 @@ class QGestureEvent;
class QTouchEvent;
class QOpenGLFramebufferObject;
class LutCalibrator;
class StopMotion;
namespace ImageUtils {
class FullScreenWidget;
@ -144,6 +145,10 @@ class SceneViewer final : public GLWidgetForHighDpi,
TRaster32P m_3DSideL;
TRaster32P m_3DSideR;
TRaster32P m_3DTop;
TRasterImageP m_stopMotionImage, m_stopMotionLineUpImage;
StopMotion *m_stopMotion = NULL;
bool m_hasStopMotionImage = false;
bool m_hasStopMotionLineUpImage = false;
TPointD m_sideRasterPos;
TPointD m_topRasterPos;
@ -438,6 +443,9 @@ public slots:
void releaseBusyOnTabletMove() { m_isBusyOnTabletMove = false; }
void onContextAboutToBeDestroyed();
void onNewStopMotionImageReady();
void onStopMotionLiveViewStopped();
signals:
void onZoomChanged();

View file

@ -17,6 +17,10 @@
#include "locatorpopup.h"
#include "cellselection.h"
#ifdef WITH_STOPMOTION
#include "stopmotion.h"
#endif
// TnzQt includes
#include "toonzqt/tselectionhandle.h"
#include "toonzqt/styleselection.h"
@ -580,6 +584,11 @@ void SceneViewer::onMove(const TMouseEvent &event) {
tool->mouseMove(pos, event);
}
if (!cursorSet) setToolCursor(this, tool->getCursorId());
#ifdef WITH_STOPMOTION
if (StopMotion::instance()->m_pickLiveViewZoom)
setToolCursor(this, ToolCursor::ZoomCursor);
#endif
m_pos = curPos;
m_tabletMove = false;
m_toolSwitched = false;
@ -721,6 +730,17 @@ void SceneViewer::onPress(const TMouseEvent &event) {
pos.x /= m_dpiScale.x;
pos.y /= m_dpiScale.y;
}
#ifdef WITH_STOPMOTION
// grab screen picking for stop motion live view zoom
if (StopMotion::instance()->m_pickLiveViewZoom) {
StopMotion::instance()->m_pickLiveViewZoom = false;
StopMotion::instance()->makeZoomPoint(pos);
if (tool) setToolCursor(this, tool->getCursorId());
if (m_mouseButton != Qt::RightButton) return;
}
#endif
// separate tablet and mouse events
if (m_tabletEvent && m_tabletState == Touched) {
TApp::instance()->getCurrentTool()->setToolBusy(true);

View file

@ -24,6 +24,10 @@
#include "historypane.h"
#include "cleanupsettingspane.h"
#ifdef WITH_STOPMOTION
#include "stopmotioncontroller.h"
#endif
#ifdef LINETEST
#include "linetestpane.h"
#include "linetestcapturepane.h"
@ -1361,6 +1365,34 @@ OpenFloatingPanel openHistoryPanelCommand(MI_OpenHistoryPanel, "HistoryPanel",
QObject::tr("History"));
//=============================================================================
#ifdef WITH_STOPMOTION
//=============================================================================
// StopMotion Controller
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class StopMotionPanelFactory final : public TPanelFactory {
public:
StopMotionPanelFactory() : TPanelFactory("StopMotionController") {}
void initialize(TPanel *panel) override {
StopMotionController *stopMotionController =
new StopMotionController(panel);
panel->setWidget(stopMotionController);
panel->setWindowTitle(QObject::tr("Stop Motion Controller"));
panel->setIsMaximizable(false);
}
} stopMotionPanelFactory;
//=============================================================================
OpenFloatingPanel openStopMotionPanelCommand(
MI_OpenStopMotionPanel, "StopMotionController",
QObject::tr("Stop Motion Controller"));
//-----------------------------------------------------------------------------
#endif
//=============================================================================
// FxSettings
//-----------------------------------------------------------------------------

View file

@ -17,6 +17,7 @@
class PaletteViewer;
class TPaletteHandle;
class StyleEditor;
class StopMotionController;
class TLevel;
class StudioPaletteViewer;
class TPanelTitleBarButton;

View file

@ -12,6 +12,7 @@
#include "cellselection.h"
#include "menubarcommandids.h"
#include "toonzqt/menubarcommand.h"
#include "../stopmotion/stopmotion.h"
#include "toonz/toonzscene.h"
#include "tconvert.h"
@ -370,8 +371,26 @@ void RowArea::drawCurrentRowGadget(QPainter &p, int r0, int r1) {
p.fillRect(header, m_viewer->getCurrentRowBgColor());
}
#ifdef WITH_STOPMOTION
//-----------------------------------------------------------------------------
void RowArea::drawStopMotionCameraIndicator(QPainter &p) {
int cameraRow = StopMotion::instance()->getXSheetFrameNumber() - 1;
if (cameraRow < 0) return;
QPoint topLeft = m_viewer->positionToXY(CellPosition(cameraRow, 0));
if (!m_viewer->orientation()->isVerticalTimeline()) topLeft.setY(0);
QRect header = m_viewer->orientation()
->rect(PredefinedRect::FRAME_HEADER)
.translated(topLeft);
int frameAdj = m_viewer->getFrameZoomAdjustment();
header.adjust(1, 1, -frameAdj, 0);
p.fillRect(header, Qt::GlobalColor::darkGreen);
}
//-----------------------------------------------------------------------------
#endif
void RowArea::drawOnionSkinBackground(QPainter &p, int r0, int r1) {
const Orientation *o = m_viewer->orientation();
@ -830,6 +849,15 @@ void RowArea::paintEvent(QPaintEvent *event) {
// current frame
drawCurrentRowGadget(p, r0, r1);
#ifdef WITH_STOPMOTION
StopMotion *stopMotion = StopMotion::instance();
if (stopMotion->getPlaceOnXSheet() &&
(stopMotion->m_liveViewStatus > 0)) {
drawStopMotionCameraIndicator(p);
}
#endif
if (TApp::instance()->getCurrentFrame()->isEditingScene() &&
Preferences::instance()->isCurrentTimelineIndicatorEnabled() &&
!m_viewer->orientation()->isVerticalTimeline())

View file

@ -55,6 +55,10 @@ class RowArea final : public QWidget {
void drawCurrentTimeLine(QPainter &p);
void drawShiftTraceMarker(QPainter &p);
#ifdef WITH_STOPMOTION
void drawStopMotionCameraIndicator(QPainter &p);
#endif
DragTool *getDragTool() const;
void setDragTool(DragTool *dragTool);

View file

@ -15,7 +15,8 @@ LevelOptions::LevelOptions()
, m_antialias(0)
, m_dpiPolicy(DP_ImageDpi)
, m_whiteTransp(false)
, m_premultiply(false) {}
, m_premultiply(false)
, m_isStopMotionLevel(false) {}
//-----------------------------------------------------------------------------
@ -24,6 +25,7 @@ bool LevelOptions::operator==(const LevelOptions &other) const {
m_whiteTransp == other.m_whiteTransp &&
m_dpiPolicy == other.m_dpiPolicy &&
m_antialias == other.m_antialias &&
m_isStopMotionLevel == other.m_isStopMotionLevel &&
(m_dpiPolicy == LevelOptions::DP_ImageDpi || m_dpi == other.m_dpi));
}

View file

@ -467,6 +467,14 @@ void RasterPainter::flushRasterImages() {
int lx = rect.getLx(), ly = rect.getLy();
TDimension dim(lx, ly);
// this is needed since a stop motion live view
// doesn't register as a node correctly
// there is probably a better way to do this.
if (rect.getLx() == 0 && lx == 0) {
rect = m_clipRect;
dim = m_dim;
}
// Build a raster buffer of sufficient size to hold said union.
// The buffer is per-thread cached in order to improve the rendering speed.
if (!threadBuffers.hasLocalData())

View file

@ -907,6 +907,7 @@ void TXshSimpleLevel::loadData(TIStream &is) {
int doPremultiply = 0;
int whiteTransp = 0;
int antialiasSoftness = 0;
int isStopMotionLevel = 0;
LevelProperties::DpiPolicy dpiPolicy = LevelProperties::DP_ImageDpi;
if (is.getTagParam("dpix", v)) xdpi = std::stod(v);
if (is.getTagParam("dpiy", v)) ydpi = std::stod(v);
@ -918,6 +919,9 @@ void TXshSimpleLevel::loadData(TIStream &is) {
if (is.getTagParam("premultiply", v)) doPremultiply = std::stoi(v);
if (is.getTagParam("antialias", v)) antialiasSoftness = std::stoi(v);
if (is.getTagParam("whiteTransp", v)) whiteTransp = std::stoi(v);
if (is.getTagParam("isStopMotionLevel", v))
isStopMotionLevel = std::stoi(v);
m_properties->setDpiPolicy(dpiPolicy);
m_properties->setDpi(TPointD(xdpi, ydpi));
@ -925,6 +929,8 @@ void TXshSimpleLevel::loadData(TIStream &is) {
m_properties->setDoPremultiply(doPremultiply);
m_properties->setDoAntialias(antialiasSoftness);
m_properties->setWhiteTransp(whiteTransp);
m_properties->setIsStopMotion(isStopMotionLevel);
if (isStopMotionLevel == 1) setIsReadOnly(true);
} else
throw TException("unexpected tag " + tagName);
} else {
@ -1366,6 +1372,9 @@ void TXshSimpleLevel::saveData(TOStream &os) {
attr["premultiply"] = std::to_string(getProperties()->doPremultiply());
} else if (getProperties()->whiteTransp()) {
attr["whiteTransp"] = std::to_string(getProperties()->whiteTransp());
} else if (getProperties()->isStopMotionLevel()) {
attr["isStopMotionLevel"] =
std::to_string(getProperties()->isStopMotionLevel());
}
if (m_type == TZI_XSHLEVEL) attr["type"] = "s";
@ -2318,6 +2327,7 @@ bool TXshSimpleLevel::isFrameReadOnly(TFrameId fid) {
// the OS level
if (getType() == OVL_XSHLEVEL || getType() == TZI_XSHLEVEL ||
getType() == MESH_XSHLEVEL) {
if (getProperties()->isStopMotionLevel()) return true;
TFilePath fullPath = getScene()->decodeFilePath(m_path);
std::string fileType = fullPath.getType();
if (fileType == "psd" || fileType == "gif" || fileType == "mp4" ||