Merge pull request #892 from justburner/StopMotionSound

Stop motion play sound on capture and deciseconds resolution
This commit is contained in:
manongjohn 2022-02-10 14:43:43 -05:00 committed by GitHub
commit b4c2c7e576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 79 deletions

View file

@ -46,9 +46,11 @@
TEnv::IntVar StopMotionOpacity("StopMotionOpacity", 204); TEnv::IntVar StopMotionOpacity("StopMotionOpacity", 204);
TEnv::IntVar StopMotionAlwaysLiveView("StopMotionAlwaysLiveView", 0); TEnv::IntVar StopMotionAlwaysLiveView("StopMotionAlwaysLiveView", 0);
TEnv::IntVar StopMotionPlaceOnXSheet("StopMotionPlaceOnXSheet", 1); TEnv::IntVar StopMotionPlaceOnXSheet("StopMotionPlaceOnXSheet", 1);
TEnv::IntVar StopMotionReviewTime("StopMotionReviewTime", 1); TEnv::IntVar StopMotionReviewDSec("StopMotionReviewDSec", 10);
TEnv::IntVar StopMotionIntervalDSec("StopMotionIntervalDSec", 100);
TEnv::IntVar StopMotionUseNumpad("StopMotionUseNumpad", 0); TEnv::IntVar StopMotionUseNumpad("StopMotionUseNumpad", 0);
TEnv::IntVar StopMotionDrawBeneathLevels("StopMotionDrawBeneathLevels", 1); TEnv::IntVar StopMotionDrawBeneathLevels("StopMotionDrawBeneathLevels", 1);
TEnv::IntVar StopMotionPlayCaptureSound("StopMotionPlayCaptureSound", 0);
// Connected camera // Connected camera
TEnv::StringVar StopMotionCameraName("CamCapCameraName", ""); TEnv::StringVar StopMotionCameraName("CamCapCameraName", "");
@ -252,9 +254,11 @@ StopMotion::StopMotion() {
m_alwaysLiveView = StopMotionAlwaysLiveView; m_alwaysLiveView = StopMotionAlwaysLiveView;
m_placeOnXSheet = StopMotionPlaceOnXSheet; m_placeOnXSheet = StopMotionPlaceOnXSheet;
m_reviewTime = StopMotionReviewTime; m_reviewTimeDSec = StopMotionReviewDSec;
m_intervalDSec = StopMotionIntervalDSec;
m_useNumpadShortcuts = StopMotionUseNumpad; m_useNumpadShortcuts = StopMotionUseNumpad;
m_drawBeneathLevels = StopMotionDrawBeneathLevels; m_drawBeneathLevels = StopMotionDrawBeneathLevels;
m_playCaptureSound = StopMotionPlayCaptureSound;
m_numpadForStyleSwitching = m_numpadForStyleSwitching =
Preferences::instance()->isUseNumpadForSwitchingStylesEnabled(); Preferences::instance()->isUseNumpadForSwitchingStylesEnabled();
setUseNumpadShortcuts(m_useNumpadShortcuts); setUseNumpadShortcuts(m_useNumpadShortcuts);
@ -265,6 +269,7 @@ StopMotion::StopMotion() {
m_intervalTimer = new QTimer(this); m_intervalTimer = new QTimer(this);
m_countdownTimer = new QTimer(this); m_countdownTimer = new QTimer(this);
m_webcamOverlayTimer = new QTimer(this); m_webcamOverlayTimer = new QTimer(this);
m_camSnapSound = new QSound(":Resources/camera_snap.wav");
// Make the interval timer single-shot. When the capture finished, restart // Make the interval timer single-shot. When the capture finished, restart
// timer for next frame. // timer for next frame.
@ -517,10 +522,10 @@ void StopMotion::setPlaceOnXSheet(bool on) {
//----------------------------------------------------------------- //-----------------------------------------------------------------
void StopMotion::setReviewTime(int time) { void StopMotion::setReviewTimeDSec(int timeDSec) {
m_reviewTime = time; m_reviewTimeDSec = timeDSec;
StopMotionReviewTime = time; StopMotionReviewDSec = timeDSec;
emit(reviewTimeChangedSignal(time)); emit(reviewTimeChangedSignal(timeDSec));
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
@ -619,8 +624,8 @@ void StopMotion::toggleInterval(bool on) {
void StopMotion::startInterval() { void StopMotion::startInterval() {
if (m_liveViewStatus > 1) { if (m_liveViewStatus > 1) {
m_intervalTimer->start(m_intervalTime * 1000); m_intervalTimer->start(m_intervalDSec * 100);
if (m_intervalTime != 0) m_countdownTimer->start(100); if (m_intervalDSec != 0) m_countdownTimer->start(100);
m_intervalStarted = true; m_intervalStarted = true;
emit(intervalStarted()); emit(intervalStarted());
} else { } else {
@ -641,8 +646,9 @@ void StopMotion::stopInterval() {
//----------------------------------------------------------------- //-----------------------------------------------------------------
void StopMotion::setIntervalAmount(int value) { void StopMotion::setIntervalDSec(int value) {
m_intervalTime = value; m_intervalDSec = value;
StopMotionIntervalDSec = value;
emit(intervalAmountChanged(value)); emit(intervalAmountChanged(value));
} }
@ -663,10 +669,10 @@ void StopMotion::onIntervalCaptureTimerTimeout() {
void StopMotion::restartInterval() { void StopMotion::restartInterval() {
// restart interval timer for capturing next frame (it is single shot) // restart interval timer for capturing next frame (it is single shot)
if (m_isTimeLapse && m_intervalStarted) { if (m_isTimeLapse && m_intervalStarted) {
m_intervalTimer->start(m_intervalTime * 1000); m_intervalTimer->start(m_intervalDSec * 100);
// restart the count down as well (for aligning the timing. It is not // restart the count down as well (for aligning the timing. It is not
// single shot) // single shot)
if (m_intervalTime != 0) m_countdownTimer->start(100); if (m_intervalDSec != 0) m_countdownTimer->start(100);
} }
} }
@ -1314,6 +1320,14 @@ void StopMotion::getSubsampling() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotion::setPlayCaptureSound(bool on) {
m_playCaptureSound = on;
StopMotionPlayCaptureSound = on;
emit(playCaptureSignal(on));
}
//-----------------------------------------------------------------------------
void StopMotion::update() { getSubsampling(); } void StopMotion::update() { getSubsampling(); }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1666,9 +1680,9 @@ bool StopMotion::importImage() {
// for now always save. This can be tweaked later // for now always save. This can be tweaked later
sl->save(); sl->save();
m_sl = sl; m_sl = sl;
if (getReviewTime() > 0 && !m_isTimeLapse) { if (getReviewTimeDSec() > 0 && !m_isTimeLapse) {
m_liveViewStatus = LiveViewPaused; m_liveViewStatus = LiveViewPaused;
m_reviewTimer->start(getReviewTime() * 1000); m_reviewTimer->start(getReviewTimeDSec() * 100);
} }
/* placement in xsheet */ /* placement in xsheet */
@ -1691,7 +1705,7 @@ bool StopMotion::importImage() {
xsh->setCell(row + i, col, TXshCell(sl, fid)); xsh->setCell(row + i, col, TXshCell(sl, fid));
} }
app->getCurrentColumn()->setColumnIndex(col); app->getCurrentColumn()->setColumnIndex(col);
if (getReviewTime() == 0 || m_isTimeLapse) if (getReviewTimeDSec() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames); app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames; m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber)); emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
@ -1737,7 +1751,7 @@ bool StopMotion::importImage() {
xsh->setCell(row + i, foundCol, TXshCell(sl, fid)); xsh->setCell(row + i, foundCol, TXshCell(sl, fid));
} }
app->getCurrentColumn()->setColumnIndex(foundCol); app->getCurrentColumn()->setColumnIndex(foundCol);
if (getReviewTime() == 0 || m_isTimeLapse) if (getReviewTimeDSec() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames); app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames; m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber)); emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
@ -1753,7 +1767,7 @@ bool StopMotion::importImage() {
xsh->setCell(row + i, col, TXshCell(sl, fid)); xsh->setCell(row + i, col, TXshCell(sl, fid));
} }
app->getCurrentColumn()->setColumnIndex(col); app->getCurrentColumn()->setColumnIndex(col);
if (getReviewTime() == 0 || m_isTimeLapse) if (getReviewTimeDSec() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames); app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames; m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber)); emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
@ -1765,6 +1779,9 @@ bool StopMotion::importImage() {
//----------------------------------------------------------------- //-----------------------------------------------------------------
void StopMotion::captureImage() { void StopMotion::captureImage() {
if (m_playCaptureSound) {
m_camSnapSound->play();
}
if (m_isTimeLapse && !m_intervalStarted) { if (m_isTimeLapse && !m_intervalStarted) {
startInterval(); startInterval();
return; return;
@ -1801,7 +1818,7 @@ void StopMotion::captureWebcamImage() {
m_light->showOverlays(); m_light->showOverlays();
m_webcamOverlayTimer->start(500); m_webcamOverlayTimer->start(500);
} else { } else {
if (getReviewTime() > 0 && !m_isTimeLapse) { if (getReviewTimeDSec() > 0 && !m_isTimeLapse) {
m_timer->stop(); m_timer->stop();
if (m_liveViewStatus > LiveViewClosed) { if (m_liveViewStatus > LiveViewClosed) {
// m_liveViewStatus = LiveViewPaused; // m_liveViewStatus = LiveViewPaused;
@ -1821,7 +1838,7 @@ void StopMotion::captureWebcamOnTimeout() {
saveTestShot(); saveTestShot();
return; return;
} }
if (getReviewTime() > 0 && !m_isTimeLapse) { if (getReviewTimeDSec() > 0 && !m_isTimeLapse) {
m_timer->stop(); m_timer->stop();
if (m_liveViewStatus > LiveViewClosed) { if (m_liveViewStatus > LiveViewClosed) {
// m_liveViewStatus = LiveViewPaused; // m_liveViewStatus = LiveViewPaused;
@ -1846,7 +1863,7 @@ void StopMotion::captureDslrImage() {
return; return;
} }
#endif #endif
if (getReviewTime() > 0 && !m_isTimeLapse) { if (getReviewTimeDSec() > 0 && !m_isTimeLapse) {
m_timer->stop(); m_timer->stop();
} }

View file

@ -29,6 +29,7 @@
#include <QObject> #include <QObject>
#include <QThread> #include <QThread>
#include <QSound>
class QCamera; class QCamera;
class QCameraInfo; class QCameraInfo;
@ -85,6 +86,9 @@ private:
std::map<std::string, QAction*> m_oldActionMap; std::map<std::string, QAction*> m_oldActionMap;
std::map<int, TRaster32P> m_liveViewImageMap; std::map<int, TRaster32P> m_liveViewImageMap;
bool m_playCaptureSound = false;
QSound* m_camSnapSound = 0;
public: public:
enum LiveViewStatus { enum LiveViewStatus {
LiveViewClosed = 0, LiveViewClosed = 0,
@ -104,14 +108,14 @@ public:
bool m_userCalledPause = false; bool m_userCalledPause = false;
bool m_drawBeneathLevels = true; bool m_drawBeneathLevels = true;
bool m_isTimeLapse = false; bool m_isTimeLapse = false;
int m_reviewTime = 2; int m_reviewTimeDSec = 20;
bool m_isTestShot = false; bool m_isTestShot = false;
QString m_tempFile, m_tempRaw; QString m_tempFile, m_tempRaw;
TXshSimpleLevel* m_sl; TXshSimpleLevel* m_sl;
// timers // timers
QTimer* m_timer; QTimer* m_timer;
int m_intervalTime = 10; int m_intervalDSec = 100;
bool m_intervalStarted = false; bool m_intervalStarted = false;
QTimer* m_reviewTimer; QTimer* m_reviewTimer;
QTimer *m_intervalTimer, *m_countdownTimer, *m_webcamOverlayTimer; QTimer *m_intervalTimer, *m_countdownTimer, *m_webcamOverlayTimer;
@ -183,7 +187,8 @@ public:
void toggleInterval(bool on); void toggleInterval(bool on);
void startInterval(); void startInterval();
void stopInterval(); void stopInterval();
void setIntervalAmount(int value); void setIntervalDSec(int value);
int getIntervalDSec() { return m_intervalDSec; };
void restartInterval(); void restartInterval();
// options // options
@ -200,12 +205,14 @@ public:
void toggleNumpadShortcuts(bool on); void toggleNumpadShortcuts(bool on);
void toggleNumpadForFocusCheck(bool on); void toggleNumpadForFocusCheck(bool on);
void setDrawBeneathLevels(bool on); void setDrawBeneathLevels(bool on);
void setReviewTime(int time); void setReviewTimeDSec(int timeDSec);
int getReviewTime() { return m_reviewTime; } int getReviewTimeDSec() { return m_reviewTimeDSec; }
void getSubsampling(); void getSubsampling();
void setSubsampling(); void setSubsampling();
int getSubsamplingValue() { return m_subsampling; } int getSubsamplingValue() { return m_subsampling; }
void setSubsamplingValue(int subsampling); void setSubsamplingValue(int subsampling);
void setPlayCaptureSound(bool on);
bool getPlayCaptureSound() { return m_playCaptureSound; }
// saving and loading // saving and loading
void saveXmlFile(); void saveXmlFile();
@ -264,6 +271,7 @@ signals:
void useNumpadSignal(bool); void useNumpadSignal(bool);
void drawBeneathLevelsSignal(bool); void drawBeneathLevelsSignal(bool);
void reviewTimeChangedSignal(int); void reviewTimeChangedSignal(int);
void playCaptureSignal(bool);
// time lapse // time lapse
void intervalToggled(bool); void intervalToggled(bool);

View file

@ -36,6 +36,7 @@
// TnzQt includes // TnzQt includes
#include "toonzqt/filefield.h" #include "toonzqt/filefield.h"
#include "toonzqt/intfield.h" #include "toonzqt/intfield.h"
#include "toonzqt/doublefield.h"
#include "toonzqt/menubarcommand.h" #include "toonzqt/menubarcommand.h"
// Qt includes // Qt includes
@ -1374,32 +1375,50 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
// Make Options Page // Make Options Page
QGroupBox *webcamBox = new QGroupBox(tr("Webcam Options"), this); QGroupBox *webcamBox = new QGroupBox(tr("Webcam Options"), this);
QGroupBox *dslrBox = new QGroupBox(tr("DSLR Options"), this); QGroupBox *dslrBox = new QGroupBox(tr("DSLR Options"), this);
QGroupBox *timerFrame = new QGroupBox(tr("Time Lapse"), this); m_timerCB = new QGroupBox(tr("Use Time Lapse"), this);
m_timerCB = new QCheckBox(tr("Use time lapse"), this); m_timerIntervalFld = new DVGui::DoubleField(this, true, 1);
m_timerIntervalFld = new DVGui::IntField(this); m_timerCB->setCheckable(true);
timerFrame->setObjectName("CleanupSettingsFrame"); m_timerCB->setObjectName("CleanupSettingsFrame");
m_timerCB->setChecked(false); m_timerCB->setChecked(false);
m_timerIntervalFld->setRange(0, 60); m_timerIntervalFld->setRange(0.0, 60.0);
m_timerIntervalFld->setValue(10); m_timerIntervalFld->setValue(0.0);
m_timerIntervalFld->setDisabled(true);
m_postCaptureReviewFld = new DVGui::IntField(this); m_postCaptureReviewFld = new DVGui::DoubleField(this, true, 1);
m_postCaptureReviewFld->setRange(0, 10); m_postCaptureReviewFld->setRange(0.0, 10.0);
m_postCaptureReviewFld->setValue(0.0);
m_subsamplingFld = new DVGui::IntField(this); m_subsamplingFld = new DVGui::IntField(this);
m_subsamplingFld->setRange(1, 30); m_subsamplingFld->setRange(1, 30);
m_subsamplingFld->setDisabled(true); m_subsamplingFld->setDisabled(true);
m_placeOnXSheetCB = new QCheckBox(this); m_placeOnXSheetCB = new QCheckBox(tr("Place on XSheet"), this);
m_placeOnXSheetCB->setToolTip(tr("Place the frame in the Scene")); m_placeOnXSheetCB->setToolTip(tr("Place the frame in the Scene"));
m_directShowLabel = new QLabel(tr("Use Direct Show Webcam Drivers"), this); m_directShowCB = new QCheckBox(tr("Use Direct Show Webcam Drivers"), this);
m_directShowCB = new QCheckBox(this); m_useMjpgCB = new QCheckBox(tr("Use MJPG with Webcam"), this);
m_useMjpgCB = new QCheckBox(this); m_useNumpadCB = new QCheckBox(tr("Use Numpad Shortcuts When Active"), this);
m_useNumpadCB = new QCheckBox(this); m_useNumpadCB->setToolTip(
m_drawBeneathCB = new QCheckBox(this); tr("Requires restarting camera when toggled\n"
"NP 1 = Previous Frame\n"
"NP 2 = Next Frame\n"
"NP 3 = Jump To Camera\n"
"NP 5 = Toggle Live View\n"
"NP 6 = Short Play\n"
"NP 8 = Loop\n"
"NP 0 = Play\n"
"Period = Use Live View Images\n"
"Plus = Raise Opacity\n"
"Minus = Lower Opacity\n"
"Enter = Capture\n"
"BackSpace = Remove Frame\n"
"Multiply = Toggle Zoom\n"
"Divide = Focus Check"));
m_drawBeneathCB = new QCheckBox(tr("Show Camera Below Other Levels"), this);
m_liveViewOnAllFramesCB =
new QCheckBox(tr("Show Live View on All Frames"), this);
m_playSound = new QCheckBox(tr("Play Sound on Capture"), this);
m_playSound->setToolTip(tr("Make a click sound on each capture"));
m_liveViewOnAllFramesCB = new QCheckBox(this);
QVBoxLayout *optionsOutsideLayout = new QVBoxLayout; QVBoxLayout *optionsOutsideLayout = new QVBoxLayout;
QGridLayout *optionsLayout = new QGridLayout; QGridLayout *optionsLayout = new QGridLayout;
optionsLayout->setSpacing(3); optionsLayout->setSpacing(3);
@ -1414,11 +1433,8 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
optionsOutsideLayout->addWidget(dslrBox, Qt::AlignCenter); optionsOutsideLayout->addWidget(dslrBox, Qt::AlignCenter);
dslrBox->hide(); dslrBox->hide();
webcamLayout->addWidget(m_directShowCB, 0, 0, Qt::AlignRight); webcamLayout->addWidget(m_directShowCB, 0, 0, 1, 2);
webcamLayout->addWidget(m_directShowLabel, 0, 1, Qt::AlignLeft); webcamLayout->addWidget(m_useMjpgCB, 1, 0, 1, 2);
webcamLayout->addWidget(m_useMjpgCB, 1, 0, Qt::AlignRight);
webcamLayout->addWidget(new QLabel(tr("Use MJPG with Webcam")), 1, 1,
Qt::AlignLeft);
webcamLayout->setColumnStretch(1, 30); webcamLayout->setColumnStretch(1, 30);
webcamBox->setLayout(webcamLayout); webcamBox->setLayout(webcamLayout);
webcamBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); webcamBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
@ -1430,36 +1446,24 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
timerLay->setHorizontalSpacing(3); timerLay->setHorizontalSpacing(3);
timerLay->setVerticalSpacing(5); timerLay->setVerticalSpacing(5);
{ {
timerLay->addWidget(m_timerCB, 0, 0, 1, 2);
timerLay->addWidget(new QLabel(tr("Interval(sec):"), this), 1, 0, timerLay->addWidget(new QLabel(tr("Interval(sec):"), this), 1, 0,
Qt::AlignRight); Qt::AlignRight);
timerLay->addWidget(m_timerIntervalFld, 1, 1); timerLay->addWidget(m_timerIntervalFld, 1, 1);
} }
timerLay->setColumnStretch(0, 0); timerLay->setColumnStretch(0, 0);
timerLay->setColumnStretch(1, 1); timerLay->setColumnStretch(1, 1);
timerFrame->setLayout(timerLay); m_timerCB->setLayout(timerLay);
optionsOutsideLayout->addWidget(timerFrame); optionsOutsideLayout->addWidget(m_timerCB);
checkboxLayout->addWidget(m_placeOnXSheetCB, 0, 0, 1, 1, Qt::AlignRight); checkboxLayout->addWidget(m_placeOnXSheetCB, 0, 0, 1, 2);
// checkboxLayout->addWidget(new QLabel(tr("Place in Scene")), 0, 1,
// Qt::AlignLeft);
m_placeOnXSheetCB->hide(); m_placeOnXSheetCB->hide();
checkboxLayout->addWidget(m_drawBeneathCB, 1, 0, Qt::AlignRight); checkboxLayout->addWidget(m_drawBeneathCB, 1, 0, 1, 2);
// checkboxLayout->addWidget(new QLabel(tr("Show Camera Below Other
// Levels")),
// 1, 1, Qt::AlignLeft);
m_drawBeneathCB->hide(); m_drawBeneathCB->hide();
checkboxLayout->addWidget(m_useNumpadCB, 2, 0, Qt::AlignRight); checkboxLayout->addWidget(m_useNumpadCB, 2, 0, 1, 2);
checkboxLayout->addWidget( checkboxLayout->addWidget(m_liveViewOnAllFramesCB, 3, 0, 1, 2);
new QLabel(tr("Use Numpad Shortcuts When Active")), 2, 1,
Qt::AlignLeft);
checkboxLayout->addWidget(m_liveViewOnAllFramesCB, 3, 0, Qt::AlignRight);
m_liveViewOnAllFramesCB->hide(); m_liveViewOnAllFramesCB->hide();
// checkboxLayout->addWidget(new QLabel(tr("Show Live View on All Frames")), checkboxLayout->addWidget(m_playSound, 4, 0, 1, 2);
// 3,
// 1, Qt::AlignLeft);
checkboxLayout->setColumnStretch(1, 30); checkboxLayout->setColumnStretch(1, 30);
optionsOutsideLayout->addLayout(checkboxLayout, Qt::AlignLeft); optionsOutsideLayout->addLayout(checkboxLayout, Qt::AlignLeft);
@ -1766,7 +1770,8 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
// Options Page // Options Page
ret = ret && connect(m_liveViewOnAllFramesCB, SIGNAL(stateChanged(int)), this, ret = ret && connect(m_liveViewOnAllFramesCB, SIGNAL(stateChanged(int)), this,
SLOT(onLiveViewOnAllFramesChanged(int))); SLOT(onLiveViewOnAllFramesChanged(int)));
ret = ret && connect(m_playSound, SIGNAL(toggled(bool)), this,
SLOT(onPlaySoundToggled(bool)));
ret = ret && connect(m_placeOnXSheetCB, SIGNAL(stateChanged(int)), this, ret = ret && connect(m_placeOnXSheetCB, SIGNAL(stateChanged(int)), this,
SLOT(onPlaceOnXSheetChanged(int))); SLOT(onPlaceOnXSheetChanged(int)));
ret = ret && connect(m_directShowCB, SIGNAL(stateChanged(int)), this, ret = ret && connect(m_directShowCB, SIGNAL(stateChanged(int)), this,
@ -1802,6 +1807,8 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
this, SLOT(onDrawBeneathSignal(bool))); this, SLOT(onDrawBeneathSignal(bool)));
ret = ret && connect(m_stopMotion, SIGNAL(reviewTimeChangedSignal(int)), this, ret = ret && connect(m_stopMotion, SIGNAL(reviewTimeChangedSignal(int)), this,
SLOT(onReviewTimeChangedSignal(int))); SLOT(onReviewTimeChangedSignal(int)));
ret = ret && connect(m_stopMotion, SIGNAL(playCaptureSignal(bool)), this,
SLOT(onPlayCaptureSignal(bool)));
// From Stop Motion Main // From Stop Motion Main
ret = ret && connect(m_stopMotion, SIGNAL(newDimensions()), this, ret = ret && connect(m_stopMotion, SIGNAL(newDimensions()), this,
@ -2024,6 +2031,7 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
m_useNumpadCB->setChecked(m_stopMotion->getUseNumpadShortcuts()); m_useNumpadCB->setChecked(m_stopMotion->getUseNumpadShortcuts());
m_drawBeneathCB->setChecked(m_stopMotion->m_drawBeneathLevels); m_drawBeneathCB->setChecked(m_stopMotion->m_drawBeneathLevels);
m_liveViewOnAllFramesCB->setChecked(m_stopMotion->getAlwaysLiveView()); m_liveViewOnAllFramesCB->setChecked(m_stopMotion->getAlwaysLiveView());
m_playSound->setChecked(m_stopMotion->getPlayCaptureSound());
m_blackScreenForCapture->setChecked( m_blackScreenForCapture->setChecked(
m_stopMotion->m_light->getBlackCapture() ? true : false); m_stopMotion->m_light->getBlackCapture() ? true : false);
if (m_stopMotion->m_light->getBlackCapture()) { if (m_stopMotion->m_light->getBlackCapture()) {
@ -2031,7 +2039,8 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
m_screen2Box->setDisabled(true); m_screen2Box->setDisabled(true);
m_screen3Box->setDisabled(true); m_screen3Box->setDisabled(true);
} }
m_postCaptureReviewFld->setValue(m_stopMotion->getReviewTime()); m_postCaptureReviewFld->setValue(m_stopMotion->getReviewTimeDSec() / 10.0);
m_timerIntervalFld->setValue(m_stopMotion->getIntervalDSec() / 10.0);
refreshCameraList(QString("")); refreshCameraList(QString(""));
onSceneSwitched(); onSceneSwitched();
@ -2040,7 +2049,6 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
#ifndef _WIN32 #ifndef _WIN32
m_directShowCB->hide(); m_directShowCB->hide();
m_directShowLabel->hide();
#endif #endif
} }
@ -2321,19 +2329,25 @@ void StopMotionController::onDrawBeneathSignal(bool on) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onCaptureReviewFldEdited() { void StopMotionController::onCaptureReviewFldEdited() {
m_stopMotion->setReviewTime(m_postCaptureReviewFld->getValue()); m_stopMotion->setReviewTimeDSec(m_postCaptureReviewFld->getValue() * 10.0);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onCaptureReviewSliderChanged(bool ignore) { void StopMotionController::onCaptureReviewSliderChanged(bool ignore) {
m_stopMotion->setReviewTime(m_postCaptureReviewFld->getValue()); m_stopMotion->setReviewTimeDSec(m_postCaptureReviewFld->getValue() * 10.0);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onReviewTimeChangedSignal(int time) { void StopMotionController::onReviewTimeChangedSignal(int time) {
m_postCaptureReviewFld->setValue(time); m_postCaptureReviewFld->setValue(time / 10.0);
}
//-----------------------------------------------------------------------------
void StopMotionController::onPlayCaptureSignal(bool on) {
m_playSound->setChecked(on);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -3540,7 +3554,7 @@ void StopMotionController::onIntervalTimerCBToggled(bool on) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onIntervalSliderValueChanged(bool on) { void StopMotionController::onIntervalSliderValueChanged(bool on) {
m_stopMotion->setIntervalAmount(m_timerIntervalFld->getValue()); m_stopMotion->setIntervalDSec(m_timerIntervalFld->getValue() * 10.0);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -3563,14 +3577,13 @@ void StopMotionController::onIntervalCountDownTimeout() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onIntervalAmountChanged(int value) { void StopMotionController::onIntervalAmountChanged(int value) {
m_timerIntervalFld->blockSignals(true); m_timerIntervalFld->blockSignals(true);
m_timerIntervalFld->setValue(value); m_timerIntervalFld->setValue(value / 10.0);
m_timerIntervalFld->blockSignals(false); m_timerIntervalFld->blockSignals(false);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onIntervalToggled(bool on) { void StopMotionController::onIntervalToggled(bool on) {
m_timerCB->blockSignals(true); m_timerCB->blockSignals(true);
m_timerIntervalFld->setEnabled(on);
m_captureButton->setCheckable(on); m_captureButton->setCheckable(on);
if (on) if (on)
m_captureButton->setText(tr("Start Capturing")); m_captureButton->setText(tr("Start Capturing"));
@ -3601,6 +3614,12 @@ void StopMotionController::onIntervalStopped() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StopMotionController::onPlaySoundToggled(bool on) {
m_stopMotion->setPlayCaptureSound(on);
}
//-----------------------------------------------------------------------------
void StopMotionController::openSaveInFolderPopup() { void StopMotionController::openSaveInFolderPopup() {
if (m_saveInFolderPopup->exec()) { if (m_saveInFolderPopup->exec()) {
QString oldPath = m_saveInFileFld->getPath(); QString oldPath = m_saveInFileFld->getPath();

View file

@ -15,6 +15,7 @@
#include "toonzqt/tabbar.h" #include "toonzqt/tabbar.h"
#include "toonzqt/gutil.h" #include "toonzqt/gutil.h"
#include "toonzqt/colorfield.h" #include "toonzqt/colorfield.h"
#include "toonzqt/doublefield.h"
// Qt includes // Qt includes
#include <QWidget> #include <QWidget>
@ -191,7 +192,7 @@ class StopMotionController final : public QWidget {
*m_focusFar3Button, *m_captureFilterSettingsBtn, *m_testLightsButton; *m_focusFar3Button, *m_captureFilterSettingsBtn, *m_testLightsButton;
QHBoxLayout *m_focusAndZoomLayout; QHBoxLayout *m_focusAndZoomLayout;
QLabel *m_frameInfoLabel, *m_cameraSettingsLabel, *m_cameraModeLabel, QLabel *m_frameInfoLabel, *m_cameraSettingsLabel, *m_cameraModeLabel,
*m_resolutionLabel, *m_directShowLabel, *m_cameraStatusLabel, *m_resolutionLabel, *m_cameraStatusLabel,
*m_apertureLabel, *m_kelvinValueLabel, *m_isoLabel, *m_shutterSpeedLabel, *m_apertureLabel, *m_kelvinValueLabel, *m_isoLabel, *m_shutterSpeedLabel,
*m_webcamLabel, *m_liveViewCompensationLabel; *m_webcamLabel, *m_liveViewCompensationLabel;
QToolButton *m_previousLevelButton, *m_previousFrameButton, QToolButton *m_previousLevelButton, *m_previousFrameButton,
@ -208,21 +209,22 @@ class StopMotionController final : public QWidget {
LevelNameLineEdit *m_levelNameEdit; LevelNameLineEdit *m_levelNameEdit;
QCheckBox *m_blackScreenForCapture, *m_placeOnXSheetCB, *m_directShowCB, QCheckBox *m_blackScreenForCapture, *m_placeOnXSheetCB, *m_directShowCB,
*m_liveViewOnAllFramesCB, *m_useMjpgCB, *m_useNumpadCB, *m_drawBeneathCB, *m_liveViewOnAllFramesCB, *m_useMjpgCB, *m_useNumpadCB, *m_drawBeneathCB,
*m_timerCB, *m_showScene1, *m_showScene2, *m_playSound, *m_showScene1, *m_showScene2,
*m_showScene3; //, *m_upsideDownCB; *m_showScene3; //, *m_upsideDownCB;
CameraCaptureLevelControl *m_camCapLevelControl; CameraCaptureLevelControl *m_camCapLevelControl;
DVGui::FileField *m_saveInFileFld; DVGui::FileField *m_saveInFileFld;
DVGui::IntLineEdit *m_xSheetFrameNumberEdit; DVGui::IntLineEdit *m_xSheetFrameNumberEdit;
FrameNumberLineEdit *m_frameNumberEdit; FrameNumberLineEdit *m_frameNumberEdit;
DVGui::IntField *m_onionOpacityFld, *m_postCaptureReviewFld, DVGui::IntField *m_onionOpacityFld, *m_subsamplingFld;
*m_subsamplingFld; DVGui::DoubleField *m_postCaptureReviewFld;
StopMotionSaveInFolderPopup *m_saveInFolderPopup; StopMotionSaveInFolderPopup *m_saveInFolderPopup;
DVGui::IntField *m_timerIntervalFld; DVGui::DoubleField *m_timerIntervalFld;
DVGui::ColorField *m_screen1ColorFld, *m_screen2ColorFld, *m_screen3ColorFld; DVGui::ColorField *m_screen1ColorFld, *m_screen2ColorFld, *m_screen3ColorFld;
QGroupBox *m_screen1Box; QGroupBox *m_screen1Box;
QGroupBox *m_screen2Box; QGroupBox *m_screen2Box;
QGroupBox *m_screen3Box; QGroupBox *m_screen3Box;
QGroupBox *m_webcamAutoFocusGB; QGroupBox *m_webcamAutoFocusGB;
QGroupBox *m_timerCB;
QTimer *m_lightTestTimer; QTimer *m_lightTestTimer;
// tests variables // tests variables
@ -302,6 +304,9 @@ protected slots:
void onIntervalStarted(); void onIntervalStarted();
void onIntervalStopped(); void onIntervalStopped();
// sound
void onPlaySoundToggled(bool);
// lights and screens // lights and screens
void setScreen1Color(const TPixel32 &value, bool isDragging); void setScreen1Color(const TPixel32 &value, bool isDragging);
void setScreen2Color(const TPixel32 &value, bool isDragging); void setScreen2Color(const TPixel32 &value, bool isDragging);
@ -384,6 +389,7 @@ protected slots:
void onUseMjpgSignal(bool); void onUseMjpgSignal(bool);
void onUseDirectShowSignal(bool); void onUseDirectShowSignal(bool);
void onReviewTimeChangedSignal(int); void onReviewTimeChangedSignal(int);
void onPlayCaptureSignal(bool);
void onUseNumpadSignal(bool); void onUseNumpadSignal(bool);
void onDrawBeneathSignal(bool); void onDrawBeneathSignal(bool);
void onLiveViewChanged(bool); void onLiveViewChanged(bool);

Binary file not shown.

View file

@ -584,6 +584,7 @@
<file>Resources/brush.png</file> <file>Resources/brush.png</file>
<file>Resources/camera.svg</file> <file>Resources/camera.svg</file>
<file>Resources/camera_small.svg</file> <file>Resources/camera_small.svg</file>
<file>Resources/camera_snap.wav</file>
<file>Resources/center.png</file> <file>Resources/center.png</file>
<file>Resources/clapboard.png</file> <file>Resources/clapboard.png</file>
<file>Resources/curve.svg</file> <file>Resources/curve.svg</file>