OpenToonz - An open-source full-featured 2D animation creation software
C
Camera Capture feature : Save scene in the subfolder checkbox (#1496)
shun-iwasawa3f818e3fc68f
diff --git "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm"index 9fd4950b4..72d1da6fb 100644Binary files "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" and "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" differdiff --git a/toonz/sources/include/toonz/sceneproperties.h b/toonz/sources/include/toonz/sceneproperties.hindex 2c2c6b673..88c5d4278 100644--- a/toonz/sources/include/toonz/sceneproperties.h+++ b/toonz/sources/include/toonz/sceneproperties.h@@ -76,6 +76,7 @@ private:QList<TPixel32> m_notesColor;bool m_columnColorFilterOnRender;+ TFilePath m_camCapSaveInPath;public:/*!@@ -260,6 +261,14 @@ and height.m_columnColorFilterOnRender = on;}+ /* Returns initial save in path for the camera capture feature */+ TFilePath cameraCaptureSaveInPath() const { return m_camCapSaveInPath; }++ /* Set the initial save in path for the camera capture feature */+ void setCameraCaptureSaveInPath(const TFilePath &fp) {+ m_camCapSaveInPath = fp;+ }+//! Substitutes current cameras with those stored in the specified stage tree.void cloneCamerasFrom(TStageObjectTree *stageObjects);diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cppindex 90645c53d..ceb0c9e7d 100644--- a/toonz/sources/toonz/penciltestpopup.cpp+++ b/toonz/sources/toonz/penciltestpopup.cpp@@ -8,6 +8,8 @@#include "cellselection.h"#include "toonzqt/tselectionhandle.h"#include "cameracapturelevelcontrol.h"+#include "iocommand.h"+// TnzQt includes#include "toonzqt/menubarcommand.h"#include "toonzqt/filefield.h"@@ -92,6 +94,8 @@ TEnv::StringVar CamCapSaveInPopupEpisode("CamCapSaveInPopupEpisode", "1");TEnv::StringVar CamCapSaveInPopupSequence("CamCapSaveInPopupSequence", "1");TEnv::StringVar CamCapSaveInPopupScene("CamCapSaveInPopupScene", "1");TEnv::IntVar CamCapSaveInPopupAutoSubName("CamCapSaveInPopupAutoSubName", 1);+TEnv::IntVar CamCapSaveInPopupCreateSceneInFolder(+ "CamCapSaveInPopupCreateSceneInFolder", 0);namespace {@@ -680,10 +684,7 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent): Dialog(parent, true, false, "PencilTestSaveInFolder") {setWindowTitle("Create the Destination Subfolder to Save");- QString parentFolder = QString::fromStdString(CamCapSaveInParentFolder);- if (parentFolder.isEmpty())- parentFolder = QString("+%1").arg(QString::fromStdString(TProject::Extras));- m_parentFolderField = new FileField(this, parentFolder);+ m_parentFolderField = new FileField(this);QPushButton* setAsDefaultBtn = new QPushButton(tr("Set As Default"), this);setAsDefaultBtn->setToolTip(@@ -707,6 +708,7 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent)QCheckBox* showPopupOnLaunchCB =new QCheckBox(tr("Show This on Launch of the Camera Capture"), this);+ m_createSceneInFolderCB = new QCheckBox(tr("Save Scene in Subfolder"), this);QPushButton* okBtn = new QPushButton(tr("OK"), this);QPushButton* cancelBtn = new QPushButton(tr("Cancel"), this);@@ -743,6 +745,11 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent)m_subNameFormatCombo->setCurrentIndex(CamCapSaveInPopupAutoSubName - 1);showPopupOnLaunchCB->setChecked(CamCapOpenSaveInPopupOnLaunch != 0);+ m_createSceneInFolderCB->setChecked(CamCapSaveInPopupCreateSceneInFolder !=+ 0);+ m_createSceneInFolderCB->setToolTip(+ tr("Save the current scene in the subfolder.\nSet the output folder path "+ "to the subfolder as well."));addButtonBarWidget(okBtn, cancelBtn);@@ -807,6 +814,8 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent)subNameLay->setColumnStretch(1, 1);subNameGroupBox->setLayout(subNameLay);subFolderLay->addWidget(subNameGroupBox, 0);++ subFolderLay->addWidget(m_createSceneInFolderCB, 0, Qt::AlignLeft);}subFolderFrame->setLayout(subFolderLay);m_topLayout->addWidget(subFolderFrame);@@ -816,7 +825,7 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent)m_topLayout->addStretch(1);}- resize(300, 400);+ resize(300, 440);//---- signal-slot connectionbool ret = true;@@ -838,12 +847,13 @@ PencilTestSaveInFolderPopup::PencilTestSaveInFolderPopup(QWidget* parent)ret = ret && connect(showPopupOnLaunchCB, SIGNAL(clicked(bool)), this,SLOT(onShowPopupOnLaunchCBClicked(bool)));+ ret = ret && connect(m_createSceneInFolderCB, SIGNAL(clicked(bool)), this,+ SLOT(onCreateSceneInFolderCBClicked(bool)));ret = ret && connect(setAsDefaultBtn, SIGNAL(pressed()), this,SLOT(onSetAsDefaultBtnPressed()));ret = ret && connect(okBtn, SIGNAL(clicked(bool)), this, SLOT(onOkPressed()));ret = ret && connect(cancelBtn, SIGNAL(clicked(bool)), this, SLOT(reject()));-assert(ret);updateSubFolderName();@@ -863,6 +873,15 @@ QString PencilTestSaveInFolderPopup::getParentPath() {return m_parentFolderField->getPath();}+//-----------------------------------------------------------------------------++void PencilTestSaveInFolderPopup::showEvent(QShowEvent* event) {+ // Show "Save the scene" check box only when the scene is untitled+ bool isUntitled =+ TApp::instance()->getCurrentScene()->getScene()->isUntitled();+ m_createSceneInFolderCB->setVisible(isUntitled);+}+//-----------------------------------------------------------------------------namespace {QString formatString(QString inStr, int charNum) {@@ -931,6 +950,12 @@ void PencilTestSaveInFolderPopup::onShowPopupOnLaunchCBClicked(bool on) {//-----------------------------------------------------------------------------+void PencilTestSaveInFolderPopup::onCreateSceneInFolderCBClicked(bool on) {+ CamCapSaveInPopupCreateSceneInFolder = (on) ? 1 : 0;+}++//-----------------------------------------------------------------------------+void PencilTestSaveInFolderPopup::onSetAsDefaultBtnPressed() {CamCapSaveInParentFolder = m_parentFolderField->getPath().toStdString();}@@ -987,9 +1012,57 @@ void PencilTestSaveInFolderPopup::onOkPressed() {return;}+ createSceneInFolder();accept();}+//-----------------------------------------------------------------------------++void PencilTestSaveInFolderPopup::createSceneInFolder() {+ // make sure that the check box is displayed (= the scene is untitled) and is+ // checked.+ if (m_createSceneInFolderCB->isHidden() ||+ !m_createSceneInFolderCB->isChecked())+ return;+ // just in case+ if (!m_subFolderCB->isChecked()) return;++ // set the output folder+ ToonzScene* scene = TApp::instance()->getCurrentScene()->getScene();+ if (!scene) return;++ TFilePath fp(getPath().toStdWString());+ TOutputProperties* prop = scene->getProperties()->getOutputProperties();+ TFilePath outFp = prop->getPath().withParentDir(fp);++ prop->setPath(outFp);++ // save the scene+ TFilePath sceneFp =+ scene->decodeFilePath(fp) ++ TFilePath(m_subFolderNameField->text().toStdWString()).withType("tnz");+ IoCmd::saveScene(sceneFp, 0);+}++//-----------------------------------------------------------------------------++void PencilTestSaveInFolderPopup::updateParentFolder() {+ // If the parent folder is saved in the scene, use it+ ToonzScene* scene = TApp::instance()->getCurrentScene()->getScene();+ QString parentFolder =+ scene->getProperties()->cameraCaptureSaveInPath().getQString();+ if (parentFolder.isEmpty()) {+ // else then, if the user-env stores the parent folder value, use it+ parentFolder = QString::fromStdString(CamCapSaveInParentFolder);+ // else, use "+extras" project folder+ if (parentFolder.isEmpty())+ parentFolder =+ QString("+%1").arg(QString::fromStdString(TProject::Extras));+ }++ m_parentFolderField->setPath(parentFolder);+}+//=============================================================================PencilTestPopup::PencilTestPopup()@@ -1095,7 +1168,8 @@ PencilTestPopup::PencilTestPopup()m_saveOnCaptureCB->setChecked(true);imageFrame->setObjectName("CleanupSettingsFrame");- m_colorTypeCombo->addItems({tr("Color"), tr("Grayscale"), tr("Black & White")});+ m_colorTypeCombo->addItems(+ {tr("Color"), tr("Grayscale"), tr("Black & White")});m_colorTypeCombo->setCurrentIndex(0);m_upsideDownCB->setChecked(false);@@ -1347,7 +1421,7 @@ PencilTestPopup::PencilTestPopup()ret = ret && connect(subfolderButton, SIGNAL(clicked(bool)), this,SLOT(openSaveInFolderPopup()));ret = ret && connect(m_saveInFileFld, SIGNAL(pathChanged()), this,- SLOT(refreshFrameInfo()));+ SLOT(onSaveInPathEdited()));ret = ret && connect(m_fileTypeCombo, SIGNAL(activated(int)), this,SLOT(refreshFrameInfo()));ret = ret && connect(m_frameNumberEdit, SIGNAL(editingFinished()), this,@@ -1763,9 +1837,9 @@ void PencilTestPopup::showEvent(QShowEvent* event) {}TSceneHandle* sceneHandle = TApp::instance()->getCurrentScene();- connect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(refreshFrameInfo()));+ connect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched()));connect(sceneHandle, SIGNAL(castChanged()), this, SLOT(refreshFrameInfo()));- refreshFrameInfo();+ onSceneSwitched();}//-----------------------------------------------------------------------------@@ -2207,8 +2281,9 @@ void PencilTestPopup::openSaveInFolderPopup() {m_saveInFileFld->setPath(m_saveInFolderPopup->getPath());if (oldPath == m_saveInFileFld->getPath())setToNextNewLevel();- else- refreshFrameInfo();+ else {+ onSaveInPathEdited();+ }}}@@ -2463,6 +2538,23 @@ void PencilTestPopup::refreshFrameInfo() {//-----------------------------------------------------------------------------+void PencilTestPopup::onSaveInPathEdited() {+ ToonzScene* scene = TApp::instance()->getCurrentScene()->getScene();+ TFilePath saveInPath(m_saveInFileFld->getPath().toStdWString());+ scene->getProperties()->setCameraCaptureSaveInPath(saveInPath);+ refreshFrameInfo();+}++//-----------------------------------------------------------------------------++void PencilTestPopup::onSceneSwitched() {+ m_saveInFolderPopup->updateParentFolder();+ m_saveInFileFld->setPath(m_saveInFolderPopup->getParentPath());+ refreshFrameInfo();+}++//-----------------------------------------------------------------------------+OpenPopupCommandHandler<PencilTestPopup> openPencilTestPopup(MI_PencilTest);// specialized in order to call openSaveInFolderPopup()diff --git a/toonz/sources/toonz/penciltestpopup.h b/toonz/sources/toonz/penciltestpopup.hindex 8cfa88f02..0ebee8419 100644--- a/toonz/sources/toonz/penciltestpopup.h+++ b/toonz/sources/toonz/penciltestpopup.h@@ -150,18 +150,25 @@ class PencilTestSaveInFolderPopup : public DVGui::Dialog {QLineEdit *m_projectField, *m_episodeField, *m_sequenceField, *m_sceneField,*m_subFolderNameField;- QCheckBox *m_subFolderCB, *m_autoSubNameCB;+ QCheckBox *m_subFolderCB, *m_autoSubNameCB, *m_createSceneInFolderCB;QComboBox* m_subNameFormatCombo;+ void createSceneInFolder();+public:PencilTestSaveInFolderPopup(QWidget* parent = 0);QString getPath();QString getParentPath();+ void updateParentFolder();++protected:+ void showEvent(QShowEvent* event);protected slots:void updateSubFolderName();void onAutoSubNameCBClicked(bool);void onShowPopupOnLaunchCBClicked(bool);+ void onCreateSceneInFolderCBClicked(bool);void onSetAsDefaultBtnPressed();void onOkPressed();};@@ -252,6 +259,9 @@ protected slots:void refreshFrameInfo();+ void onSaveInPathEdited();+ void onSceneSwitched();+public slots:void openSaveInFolderPopup();};diff --git a/toonz/sources/toonzlib/sceneproperties.cpp b/toonz/sources/toonzlib/sceneproperties.cppindex 1c3a2e90a..4dde79d3e 100644--- a/toonz/sources/toonzlib/sceneproperties.cpp+++ b/toonz/sources/toonzlib/sceneproperties.cpp@@ -37,7 +37,8 @@ TSceneProperties::TSceneProperties(), m_tlvSubsampling(1), m_fieldGuideSize(16), m_fieldGuideAspectRatio(1.77778)- , m_columnColorFilterOnRender(false) {+ , m_columnColorFilterOnRender(false)+ , m_camCapSaveInPath() {// Default colorm_notesColor.push_back(TPixel32(255, 235, 140));m_notesColor.push_back(TPixel32(255, 160, 120));@@ -298,6 +299,8 @@ void TSceneProperties::saveData(TOStream &os) const {os.child("subsampling") << m_fullcolorSubsampling << m_tlvSubsampling;os.child("fieldguide") << m_fieldGuideSize << m_fieldGuideAspectRatio;if (m_columnColorFilterOnRender) os.child("columnColorFilterOnRender") << 1;+ if (!m_camCapSaveInPath.isEmpty())+ os.child("cameraCaputureSaveInPath") << m_camCapSaveInPath;os.openChild("noteColors");for (i = 0; i < m_notesColor.size(); i++) os << m_notesColor.at(i);@@ -673,6 +676,8 @@ void TSceneProperties::loadData(TIStream &is, bool isLoadingProject) {i++;}assert(i == 7);+ } else if (tagName == "cameraCaputureSaveInPath") {+ is >> m_camCapSaveInPath;} else {throw TException("unexpected property tag: " + tagName);}diff --git a/toonz/sources/toonzlib/tproject.cpp b/toonz/sources/toonzlib/tproject.cppindex 0a6b82e21..4c270d488 100644--- a/toonz/sources/toonzlib/tproject.cpp+++ b/toonz/sources/toonzlib/tproject.cpp@@ -1068,6 +1068,9 @@ void TProjectManager::saveTemplate(ToonzScene *scene) {props.assign(scene->getProperties());props.cloneCamerasFrom(scene->getXsheet()->getStageObjectTree());+ // camera capture's "save in" path is saved in env, not in the project+ props.setCameraCaptureSaveInPath(TFilePath());+TProjectP currentProject = getCurrentProject();currentProject->setSceneProperties(props);currentProject->save();diff --git a/toonz/sources/translations/japanese/toonz.ts b/toonz/sources/translations/japanese/toonz.tsindex 2110cd19c..bcf6f151e 100644--- a/toonz/sources/translations/japanese/toonz.ts+++ b/toonz/sources/translations/japanese/toonz.ts@@ -884,6 +884,22 @@ What do you want to do?</source><source>Field Guide</source><translation>フィールドガイド</translation></message>+ <message>+ <source>Bottom</source>+ <translation>下</translation>+ </message>+ <message>+ <source>Top</source>+ <translation>上</translation>+ </message>+ <message>+ <source>Left</source>+ <translation>左</translation>+ </message>+ <message>+ <source>Right</source>+ <translation>右</translation>+ </message></context><context><name>CleanupTab</name>@@ -5685,6 +5701,18 @@ WARNING : Image size mismatch. The saved image size is %1 x %2.</source><translation>警告: 画像サイズの不一致。保存されている画像のサイズは %1 x %2 ピクセルです。</translation></message>+ <message>+ <source>Color</source>+ <translation>カラー</translation>+ </message>+ <message>+ <source>Grayscale</source>+ <translation>グレースケール</translation>+ </message>+ <message>+ <source>Black & White</source>+ <translation>白黒二値</translation>+ </message></context><context><name>PencilTestSaveInFolderPopup</name>@@ -5780,6 +5808,16 @@ WARNING : Image size mismatch. The saved image size is %1 x %2.</source><source>Set the current "Save In" path as the default.</source><translation>現在の「作成場所」のパスを既定にします。</translation></message>+ <message>+ <source>Save Scene in Subfolder</source>+ <translation>カットフォルダ内にシーンを保存する</translation>+ </message>+ <message>+ <source>Save the current scene in the subfolder.+ Set the output folder path to the subfolder as well.</source>+ <translation>シーンをカットフォルダ内に保存します。+出力設定の保存先のパスもカットフォルダ内に変更します。</translation>+ </message></context><context><name>PltGizmoPopup</name>@@ -6621,6 +6659,18 @@ Is it OK to release these shortcuts?</source><source>Font Weight *:</source><translation>文字の太さ *:</translation></message>+ <message>+ <source>Arrow Markers</source>+ <translation>矢印マーカー</translation>+ </message>+ <message>+ <source>Animated Guide</source>+ <translation>アニメーションガイド</translation>+ </message>+ <message>+ <source>Vector Guided Style:</source>+ <translation>ベクターレベルの描き順のガイド:</translation>+ </message></context><context><name>PreferencesPopup::FormatProperties</name>@@ -8350,6 +8400,14 @@ Are you sure?</source><source>Reframe to %1's with %2 blanks</source><translation>リフレーム: %1 コマ 中 %2</translation></message>+ <message>+ <source>Stage Schematic</source>+ <translation>ステージスキマティック</translation>+ </message>+ <message>+ <source>Fx Schematic</source>+ <translation>エフェクトスキマティック</translation>+ </message></context><context><name>ReframePopup</name>@@ -9647,6 +9705,26 @@ Please commit or revert changes first.</source><source>Select Column</source><translation>列を選択</translation></message>+ <message>+ <source>Vector Guided Drawing</source>+ <translation>ベクターレベルの描き順のガイド</translation>+ </message>+ <message>+ <source>Off</source>+ <translation>オフ</translation>+ </message>+ <message>+ <source>Closest Drawing</source>+ <translation>直近の作画</translation>+ </message>+ <message>+ <source>Farthest Drawing</source>+ <translation>最も遠い作画</translation>+ </message>+ <message>+ <source>All Drawings</source>+ <translation>全ての作画</translation>+ </message></context><context><name>SceneViewerPanel</name>