Add Capturing 2s, 3s etc to Stop Motion (#121)

This commit is contained in:
Jeremy Bullock 2020-08-17 23:54:39 -06:00 committed by GitHub
parent abdb0dabb6
commit 1c126afd2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 71 additions and 29 deletions

View file

@ -4,3 +4,4 @@ scenes
extras
outputs
palettes
stopmotion

View file

@ -36,6 +36,7 @@ public:
static const std::string Outputs;
static const std::string Scripts;
static const std::string Palettes;
static const std::string StopMotion;
static const TFilePath SandboxProjectName;

View file

@ -847,7 +847,7 @@ bool Canon::downloadImage(EdsBaseRef object) {
jpgStream = NULL;
if (object) EdsRelease(object);
return err;
StopMotion::instance()->m_tempRaw = TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(TFilePath("+extras")).getQString();
StopMotion::instance()->m_tempRaw = TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(TFilePath("+stopmotion")).getQString();
}

View file

@ -257,9 +257,9 @@ StopMotion::StopMotion() {
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
setToNextNewLevel();
m_filePath = scene->getDefaultLevelPath(OVL_TYPE, m_levelName.toStdWString())
.getParentDir()
.getQString();
//m_filePath = scene->getDefaultLevelPath(OVL_TYPE, m_levelName.toStdWString())
// .getParentDir()
// .getQString();
}
//-----------------------------------------------------------------
@ -1006,6 +1006,13 @@ void StopMotion::setXSheetFrameNumber(int frameNumber) {
//-----------------------------------------------------------------
void StopMotion::setCaptureNumberOfFrames(int frames) {
m_captureNumberOfFrames = frames;
emit(captureNumberOfFramesChanged(frames));
}
//-----------------------------------------------------------------
bool StopMotion::loadLineUpImage() {
if (m_liveViewStatus == LiveViewClosed || m_userCalledPause) return false;
int row;
@ -1635,18 +1642,16 @@ bool StopMotion::importImage() {
col += 1;
xsh->insertColumn(col);
}
xsh->insertCells(row, col);
xsh->setCell(row, col, TXshCell(sl, fid));
for (int i = 0; i < m_captureNumberOfFrames; i++) {
xsh->insertCells(row + i, col);
xsh->setCell(row + i, col, TXshCell(sl, fid));
}
app->getCurrentColumn()->setColumnIndex(col);
if (getReviewTime() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + 1);
m_xSheetFrameNumber = row + 2;
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
postImportProcess();
// if (m_newImage->getLx() > 2000) {
// m_subsampling = 4;
// setSubsampling();
//}
return true;
}
@ -1683,13 +1688,14 @@ bool StopMotion::importImage() {
// if there is a column containing the same level
if (foundRow >= 0) {
// put the cell at the bottom
xsh->insertCells(row, foundCol);
xsh->setCell(row, foundCol, TXshCell(sl, fid));
for (int i = 0; i < m_captureNumberOfFrames; i++) {
xsh->insertCells(row + i, foundCol);
xsh->setCell(row + i, foundCol, TXshCell(sl, fid));
}
app->getCurrentColumn()->setColumnIndex(foundCol);
if (getReviewTime() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + 1);
m_xSheetFrameNumber = row + 2;
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
}
// if the level is registered in the scene, but is not placed in the xsheet,
@ -1699,11 +1705,13 @@ bool StopMotion::importImage() {
col += 1;
xsh->insertColumn(col);
}
xsh->setCell(row, col, TXshCell(sl, fid));
for (int i = 0; i < m_captureNumberOfFrames; i++) {
xsh->setCell(row + i, col, TXshCell(sl, fid));
}
app->getCurrentColumn()->setColumnIndex(col);
if (getReviewTime() == 0 || m_isTimeLapse)
app->getCurrentFrame()->setFrame(row + 1);
m_xSheetFrameNumber = row + 2;
app->getCurrentFrame()->setFrame(row + m_captureNumberOfFrames);
m_xSheetFrameNumber = row + 1 + m_captureNumberOfFrames;
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
}
postImportProcess();

View file

@ -51,9 +51,10 @@ private:
// file stuff
int m_frameNumber = 1;
int m_xSheetFrameNumber = 1;
int m_captureNumberOfFrames = 1;
QString m_levelName = "";
QString m_fileType = "jpg";
QString m_filePath = "+extras";
QString m_filePath = "+stopmotion";
QString m_frameInfoText = "";
QString m_infoColorName = "";
QString m_frameInfoToolTip = "";
@ -114,6 +115,8 @@ public:
// files and frames
void setXSheetFrameNumber(int frameNumber);
int getXSheetFrameNumber() { return m_xSheetFrameNumber; }
void setCaptureNumberOfFrames(int frames);
int getCaptureNumberOfFrames() { return m_captureNumberOfFrames; }
void setFrameNumber(int frameNumber);
int getFrameNumber() { return m_frameNumber; }
void setLevelName(QString levelName);
@ -236,6 +239,7 @@ signals:
void frameNumberChanged(int);
void frameInfoTextChanged(QString);
void xSheetFrameNumberChanged(int);
void captureNumberOfFramesChanged(int);
// options
void optionsChanged();

View file

@ -233,6 +233,10 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
m_previousXSheetFrameButton = new QToolButton(this);
m_onionOpacityFld = new DVGui::IntField(this);
m_captureFramesCombo = new QComboBox(this);
m_captureFramesCombo->addItems({ "1s", "2s", "3s", "4s", "5s", "6s", "7s", "8s" });
m_captureFramesCombo->setCurrentIndex(m_stopMotion->getCaptureNumberOfFrames() - 1);
// should choosing the file type is disabled for simplicty
// too many options can be a bad thing
m_fileTypeCombo = new QComboBox(this);
@ -412,10 +416,12 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
fileTypeLay->setMargin(0);
fileTypeLay->setSpacing(3);
{
fileTypeLay->addWidget(new QLabel(tr("File Type:"), this), 0);
//fileTypeLay->addWidget(new QLabel(tr("File Type:"), this), 0);
fileTypeLay->addWidget(m_fileTypeCombo, 1);
fileTypeLay->addSpacing(10);
//fileTypeLay->addSpacing(10);
fileTypeLay->addWidget(m_fileFormatOptionButton);
m_fileTypeCombo->hide();
m_fileFormatOptionButton->hide();
}
fileLay->addLayout(fileTypeLay, 0);
@ -423,8 +429,9 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
saveInLay->setMargin(0);
saveInLay->setSpacing(3);
{
saveInLay->addWidget(new QLabel(tr("Save In:"), this), 0);
//saveInLay->addWidget(new QLabel(tr("Save In:"), this), 0);
saveInLay->addWidget(m_saveInFileFld, 1);
m_saveInFileFld->hide();
}
fileLay->addLayout(saveInLay, 0);
// fileLay->addWidget(subfolderButton, 0);
@ -437,7 +444,9 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
displayLay->setHorizontalSpacing(3);
displayLay->setVerticalSpacing(5);
{
displayLay->addWidget(new QLabel(tr("XSheet Frame:"), this), 0, 0,
displayLay->addWidget(new QLabel(tr("Expose as: ")), 0, 0, Qt::AlignRight);
displayLay->addWidget(m_captureFramesCombo, 0, 1, Qt::AlignLeft);
displayLay->addWidget(new QLabel(tr("XSheet Frame:"), this), 1, 0,
Qt::AlignRight);
QHBoxLayout *xsheetLay = new QHBoxLayout();
xsheetLay->setMargin(0);
@ -450,7 +459,7 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
Qt::AlignCenter);
xsheetLay->addStretch(50);
}
displayLay->addLayout(xsheetLay, 0, 1);
displayLay->addLayout(xsheetLay, 1, 1);
}
displayLay->setColumnStretch(0, 0);
displayLay->setColumnStretch(1, 1);
@ -1036,6 +1045,10 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
SLOT(onPreviousXSheetFrame()));
ret = ret && connect(m_setToCurrentXSheetFrameButton, SIGNAL(clicked()), this,
SLOT(setToCurrentXSheetFrame()));
ret = ret && connect(m_captureFramesCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(onCaptureFramesChanged(int)));
ret = ret && connect(m_stopMotion, SIGNAL(captureNumberOfFramesChanged(int)),
this, SLOT(onCaptureNumberOfFramesChanged(int)));
ret = ret && connect(m_onionOpacityFld, SIGNAL(valueEditedByHand()), this,
SLOT(onOnionOpacityFldEdited()));
ret = ret && connect(m_onionOpacityFld, SIGNAL(valueChanged(bool)), this,
@ -1670,6 +1683,12 @@ void StopMotionController::onXSheetFrameNumberChanged(int frameNumber) {
//-----------------------------------------------------------------------------
void StopMotionController::onCaptureNumberOfFramesChanged(int frames) {
m_captureFramesCombo->setCurrentIndex(frames - 1);
}
//-----------------------------------------------------------------------------
void StopMotionController::onFilePathChanged(QString filePath) {
m_saveInFileFld->setPath(filePath);
}
@ -2921,6 +2940,12 @@ void StopMotionController::onXSheetFrameNumberChanged() {
//-----------------------------------------------------------------------------
void StopMotionController::onCaptureFramesChanged(int index) {
m_stopMotion->setCaptureNumberOfFrames(index + 1);
}
//-----------------------------------------------------------------------------
void StopMotionController::onSaveInPathEdited() {
m_stopMotion->setFilePath(m_saveInFileFld->getPath());
}

View file

@ -96,7 +96,7 @@ class StopMotionController final : public QWidget {
*m_liveViewCompensationSlider;
QComboBox *m_cameraListCombo, *m_exposureCombo, *m_fileTypeCombo,
*m_whiteBalanceCombo, *m_resolutionCombo, *m_imageQualityCombo,
*m_pictureStyleCombo, *m_controlDeviceCombo;
*m_pictureStyleCombo, *m_controlDeviceCombo, *m_captureFramesCombo;
LevelNameLineEdit *m_levelNameEdit;
QCheckBox *m_blackScreenForCapture, *m_placeOnXSheetCB, *m_directShowCB,
*m_liveViewOnAllFramesCB, *m_useMjpgCB, *m_useNumpadCB, *m_drawBeneathCB,
@ -157,6 +157,8 @@ protected slots:
void onFileTypeActivated();
void onFrameNumberChanged();
void onXSheetFrameNumberChanged();
void onCaptureFramesChanged(int index);
void onCaptureNumberOfFramesChanged(int frames);
void onFrameCaptured(QImage &image);
void onOnionOpacityFldEdited();
void onOnionOpacitySliderChanged(bool ignore);

View file

@ -54,7 +54,8 @@ const std::string
/*! Default outputs folder: is used to save all rendered scenes.*/
TProject::Outputs = "outputs",
/*! Default palettes folder: is used for color design (色指定)*/
TProject::Palettes = "palettes";
TProject::Palettes = "palettes",
TProject::StopMotion = "stopmotion";
//! Default project name
const TFilePath TProject::SandboxProjectName("sandbox");
@ -944,7 +945,7 @@ void TProjectManager::getFolderNames(std::vector<std::string> &names) {
}
const std::string stdNames[] = {TProject::Inputs, TProject::Drawings,
TProject::Scenes, TProject::Extras,
TProject::Outputs, TProject::Scripts};
TProject::Outputs, TProject::Scripts, TProject::StopMotion};
for (auto const &name : stdNames) {
// se il nome non e' gia' stato inserito lo aggiungo
if (std::find(names.begin(), names.end(), name) == names.end())