Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

New option to retain original styles when loading color model's palette (#407)

shun-iwasawa6b7c9c57246b
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 621b62106..5c6d3cd26 100644
Binary 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" differ
diff --git "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzlib.qm" "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzlib.qm"
index 09a94e913..15517b034 100644
Binary files "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzlib.qm" and "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzlib.qm" differ
diff --git "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzqt.qm" "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzqt.qm"
index 95bc494b1..22b2e93f0 100644
Binary files "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzqt.qm" and "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonzqt.qm" differ
diff --git a/toonz/sources/include/convert2tlv.h b/toonz/sources/include/convert2tlv.h
index 7827820e2..b2153fd0c 100644
--- a/toonz/sources/include/convert2tlv.h
+++ b/toonz/sources/include/convert2tlv.h
@@ -38,6 +38,7 @@ private:
int m_antialiasValue;
bool m_isUnpaintedFromNAA;
+ bool m_appendDefaultPalette;
void buildToonzRaster(TRasterCM32P &rout, const TRasterP &rin1, const TRasterP &rin2);
void doFill(TRasterCM32P &rout, const TRaster32P &rin);
@@ -60,7 +61,7 @@ public:
// la tlv e la tpl vengono salvate con il nome e il folder di filepath1.
Convert2Tlv(const TFilePath &filepath1, const TFilePath &filepath2, const TFilePath &outFolder, const QString &outName,
int from, int to, bool doAutoclose, const TFilePath &palettePath, int colorTolerance,
- int antialiasType, int antialiasValue, bool isUnpaintedFromNAA);
+ int antialiasType, int antialiasValue, bool isUnpaintedFromNAA, bool appendDefaultPalette);
bool init(std::string &errorMessage);
int getFramesToConvertCount();
diff --git a/toonz/sources/include/toonz/palettecmd.h b/toonz/sources/include/toonz/palettecmd.h
index 343c66299..32b7e556f 100644
--- a/toonz/sources/include/toonz/palettecmd.h
+++ b/toonz/sources/include/toonz/palettecmd.h
@@ -59,7 +59,14 @@ DVAPI void addPage(TPaletteHandle *paletteHandle, std::wstring name = L"", bool
DVAPI void destroyPage(TPaletteHandle *paletteHandle, int pageIndex);
-DVAPI int loadReferenceImage(TPaletteHandle *paletteHandle, bool replace,
+enum ColorModelPltBehavior
+{
+ KeepColorModelPlt = 0,
+ ReplaceColorModelPlt,
+ AddColorModelPlt
+};
+
+DVAPI int loadReferenceImage(TPaletteHandle *paletteHandle, ColorModelPltBehavior pltBehavior,
const TFilePath &_fp, int &frame, ToonzScene *scene,
const std::vector<int> &frames = std::vector<int>());
diff --git a/toonz/sources/toonz/colormodelviewer.cpp b/toonz/sources/toonz/colormodelviewer.cpp
index c6322bb02..550734fc8 100644
--- a/toonz/sources/toonz/colormodelviewer.cpp
+++ b/toonz/sources/toonz/colormodelviewer.cpp
@@ -152,22 +152,42 @@ void ColorModelViewer::loadImage(const TFilePath &fp)
if (!paletteHandle->getPalette())
return;
+ std::string type(fp.getType());
+
QString question(QObject::tr("The color model palette is different from the destination palette.\nWhat do you want to do? "));
QList<QString> list;
list.append(QObject::tr("Overwrite the destination palette."));
list.append(QObject::tr("Keep the destination palette and apply it to the color model."));
+ /*- if the file is raster image (i.e. without palette), then add another option "add styles" -*/
+ if (type != "tlv" && type != "pli")
+ list.append(QObject::tr("Add color model's palette to the destination palette."));
+
int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
- if (ret == 0)
+
+ PaletteCmd::ColorModelPltBehavior pltBehavior;
+ switch (ret)
+ {
+ case 0:
return;
- bool replace = false;
- if (ret == 2)
- replace = true;
+ case 1:
+ pltBehavior = PaletteCmd::KeepColorModelPlt;
+ break;
+ case 2:
+ pltBehavior = PaletteCmd::ReplaceColorModelPlt;
+ break;
+ case 3:
+ pltBehavior = PaletteCmd::AddColorModelPlt;
+ break;
+ default:
+ pltBehavior = PaletteCmd::KeepColorModelPlt;
+ break;
+ }
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
int paletteFrame = 0;
- PaletteCmd::loadReferenceImage(paletteHandle, replace, fp, paletteFrame, scene);
+ PaletteCmd::loadReferenceImage(paletteHandle, pltBehavior, fp, paletteFrame, scene);
TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
if (!level)
diff --git a/toonz/sources/toonz/convertpopup.cpp b/toonz/sources/toonz/convertpopup.cpp
index f4296261b..b6cd97333 100644
--- a/toonz/sources/toonz/convertpopup.cpp
+++ b/toonz/sources/toonz/convertpopup.cpp
@@ -53,6 +53,7 @@ TEnv::IntVar ConvertPopupSkipExisting("ConvertPopupSkipExisting", 0);
/*-- フレーム番号の前のドットを取る --*/
TEnv::IntVar ConvertPopupRemoveDot("ConvertPopupRemoveDot", 1);
TEnv::IntVar ConvertPopupSaveToNopaint("ConvertPopupSaveToNopaint", 1);
+TEnv::IntVar ConvertPopupAppendDefaultPalette("ConvertPopupAppendDefaultPalette", 0);
//=============================================================================
// convertPopup
@@ -406,9 +407,10 @@ ConvertPopup::ConvertPopup(bool specifyInput)
ConvertPopupBgColorG,
ConvertPopupBgColorB,
ConvertPopupBgColorA));
- m_skip->setChecked(ConvertPopupSkipExisting ? 1 : 0);
- m_removeDotBeforeFrameNumber->setChecked(ConvertPopupRemoveDot ? 1 : 0);
- m_saveBackupToNopaint->setChecked(ConvertPopupSaveToNopaint ? 1 : 0);
+ m_skip->setChecked( ConvertPopupSkipExisting != 0 );
+ m_removeDotBeforeFrameNumber->setChecked( ConvertPopupRemoveDot != 0 );
+ m_saveBackupToNopaint->setChecked( ConvertPopupSaveToNopaint != 0 );
+ m_appendDefaultPalette->setChecked( ConvertPopupAppendDefaultPalette != 0 );
//--- signal-slot connections
qRegisterMetaType<TFilePath>("TFilePath");
@@ -491,6 +493,7 @@ QFrame *ConvertPopup::createTlvSettings()
m_unpaintedSuffix = new DVGui::LineEdit("_np");
m_applyAutoclose = new QCheckBox(tr("Apply Autoclose"));
m_saveBackupToNopaint = new QCheckBox(tr("Save Backup to \"nopaint\" Folder"));
+ m_appendDefaultPalette = new QCheckBox(tr("Append Default Palette"));
m_antialias = new QComboBox();
m_antialiasIntensity = new DVGui::IntLineEdit(0, 50, 0, 100);
m_palettePath = new DVGui::FileField(0, QString(CreateNewPalette), true);
@@ -506,6 +509,8 @@ QFrame *ConvertPopup::createTlvSettings()
items << TlvMode_Unpainted << TlvMode_UnpaintedFromNonAA << TlvMode_PaintedFromTwoImages << TlvMode_PaintedFromNonAA;
m_tlvMode->addItems(items);
m_antialiasIntensity->setEnabled(false);
+
+ m_appendDefaultPalette->setToolTip(tr("When activated, styles of the default palette\n($TOONZSTUDIOPALETTE\\cleanup_default.tpl) will \nbe appended to the palette after conversion in \norder to save the effort of creating styles \nbefore color designing."));
m_palettePath->setMinimumWidth(300);
m_palettePath->setFileMode(QFileDialog::ExistingFile);
@@ -533,7 +538,8 @@ QFrame *ConvertPopup::createTlvSettings()
gridLay->addWidget(new QLabel(tr("Tolerance:")), 4, 2, Qt::AlignRight | Qt::AlignVCenter);
gridLay->addWidget(m_tolerance, 4, 3);
- gridLay->addWidget(m_saveBackupToNopaint, 5, 1, 1, 3);
+ gridLay->addWidget(m_appendDefaultPalette, 5, 1, 1, 3);
+ gridLay->addWidget(m_saveBackupToNopaint, 6, 1, 1, 3);
}
gridLay->setColumnStretch(0, 0);
gridLay->setColumnStretch(1, 1);
@@ -760,7 +766,8 @@ Convert2Tlv *ConvertPopup::makeTlvConverter(const TFilePath &sourceFilePath)
m_tolerance->getValue(),
m_antialias->currentIndex(),
m_antialiasIntensity->getValue(),
- getTlvMode() == TlvMode_UnpaintedFromNonAA);
+ getTlvMode() == TlvMode_UnpaintedFromNonAA,
+ m_appendDefaultPalette->isChecked());
return converter;
}
@@ -988,9 +995,10 @@ void ConvertPopup::apply()
ConvertPopupBgColorG = (int)bgCol.g;
ConvertPopupBgColorB = (int)bgCol.b;
ConvertPopupBgColorA = (int)bgCol.m;
- ConvertPopupSkipExisting = (int)m_skip->isChecked();
- ConvertPopupRemoveDot = (int)m_removeDotBeforeFrameNumber->isChecked();
- ConvertPopupSaveToNopaint = (int)m_saveBackupToNopaint->isChecked();
+ ConvertPopupSkipExisting = m_skip->isChecked() ? 1 : 0;
+ ConvertPopupRemoveDot = m_removeDotBeforeFrameNumber->isChecked() ? 1 : 0;
+ ConvertPopupSaveToNopaint = m_saveBackupToNopaint->isChecked() ? 1 : 0;
+ ConvertPopupAppendDefaultPalette = m_appendDefaultPalette->isChecked() ? 1 : 0;
// parameters are ok: close the dialog first
close();
diff --git a/toonz/sources/toonz/convertpopup.h b/toonz/sources/toonz/convertpopup.h
index 0d96818be..23bc2cbb8 100644
--- a/toonz/sources/toonz/convertpopup.h
+++ b/toonz/sources/toonz/convertpopup.h
@@ -113,7 +113,8 @@ private:
QFrame *m_tlvFrame;
QCheckBox *m_applyAutoclose,
*m_removeDotBeforeFrameNumber,
- *m_saveBackupToNopaint;
+ *m_saveBackupToNopaint,
+ *m_appendDefaultPalette;
DVGui::CheckBox *m_skip;
QComboBox *m_antialias,
*m_tlvMode,
diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp
index 4beacb739..a645a7fe1 100644
--- a/toonz/sources/toonz/filebrowserpopup.cpp
+++ b/toonz/sources/toonz/filebrowserpopup.cpp
@@ -1728,21 +1728,38 @@ bool LoadColorModelPopup::execute()
return false;
}
- bool replace = false;
+ PaletteCmd::ColorModelPltBehavior pltBehavior;
// if the palette is locked, replace the color model's palette with the destination
if (palette->isLocked())
- replace = true;
+ pltBehavior = PaletteCmd::ReplaceColorModelPlt;
else {
+ std::string type(fp.getType());
QString question(QObject::tr("The color model palette is different from the destination palette.\nWhat do you want to do? "));
QList<QString> list;
list.append(QObject::tr("Overwrite the destination palette."));
list.append(QObject::tr("Keep the destination palette and apply it to the color model."));
+ /*- if the file is raster image (i.e. without palette), then add another option "add styles" -*/
+ if (type != "tlv" && type != "pli")
+ list.append(QObject::tr("Add color model's palette to the destination palette."));
int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
- if (ret == 0)
+ switch (ret)
+ {
+ case 0:
return false;
- if (ret == 2)
- replace = true;
+ case 1:
+ pltBehavior = PaletteCmd::KeepColorModelPlt;
+ break;
+ case 2:
+ pltBehavior = PaletteCmd::ReplaceColorModelPlt;
+ break;
+ case 3:
+ pltBehavior = PaletteCmd::AddColorModelPlt;
+ break;
+ default:
+ pltBehavior = PaletteCmd::KeepColorModelPlt;
+ break;
+ }
}
std::vector<int> framesInput = string2Indexes(m_paletteFrame->text());
@@ -1754,7 +1771,7 @@ bool LoadColorModelPopup::execute()
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
- int isLoaded = PaletteCmd::loadReferenceImage(paletteHandle, replace, fp, index, scene, framesInput);
+ int isLoaded = PaletteCmd::loadReferenceImage(paletteHandle, pltBehavior, fp, index, scene, framesInput);
// return value - isLoaded
// 2: failed to get palette
@@ -1772,7 +1789,8 @@ bool LoadColorModelPopup::execute()
}
//no changes in the icon with replace (Keep the destination palette) option
- if (!replace) {
+ if (pltBehavior != PaletteCmd::ReplaceColorModelPlt)
+ {
TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
if (!level)
return true;
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index 2de17804f..747fde10a 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -1691,75 +1691,6 @@ bool IoCmd::saveSound(TXshSoundLevel *sl)
return saveSound(sl->getPath(), sl, true);
}
-//===========================================================================
-// IoCmd::loadColorModel(soundColumn)
-//---------------------------------------------------------------------------
-
-bool IoCmd::loadColorModel(const TFilePath &fp, int frame)
-{
- TPaletteHandle *paletteHandle = TApp::instance()->getPaletteController()->getCurrentPalette();
- TPalette *palette = paletteHandle->getPalette();
-
- if (!palette || palette->isCleanupPalette()) {
- error(QObject::tr("Cannot load Color Model in current palette."));
- return false;
- }
-
- ResourceImportDialog importDialog;
- importDialog.setIsLastResource(true);
- TFilePath path = fp;
- if (!path.isLevelName())
- path = TFilePath(path.getLevelNameW()).withParentDir(path.getParentDir());
-
- if (!TSystem::doesExistFileOrLevel(path))
- return false;
-
- bool importFlag = false;
- ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
- if (scene->isExternPath(path)) {
- // extern resource: import or link?
- int ret = importDialog.askImportQuestion(path);
- if (ret == ResourceImportDialog::A_CANCEL)
- return true;
-
- importFlag = (ret == ResourceImportDialog::A_IMPORT);
- }
-
- QString question(QObject::tr("The color model palette is different from the destination palette.\nWhat do you want to do? "));
- QList<QString> list;
- list.append(QObject::tr("Overwrite the destination palette."));
- list.append(QObject::tr("Keep the destination palette and apply it to the color model."));
-
- int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
- if (ret == 0)
- return false;
-
- bool replace = false;
- if (ret == 2)
- replace = true;
-
- try {
- path = importDialog.process(scene, 0, path);
- } catch (std::string msg) {
- error(QString::fromStdString(msg));
- return true;
- }
-
- int isLoaded = PaletteCmd::loadReferenceImage(paletteHandle, replace, path, frame, scene);
- if (isLoaded != 0)
- return false;
-
- TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
- if (!level)
- return true;
-
- std::vector<TFrameId> fids;
- level->getFids(fids);
- invalidateIcons(level, fids);
-
- return true;
-}
-
//=========================================================================
// IoCmd::loadScene(scene, scenePath, import)
//---------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/iocommand.h b/toonz/sources/toonz/iocommand.h
index f7aa5b0ca..0ea534468 100644
--- a/toonz/sources/toonz/iocommand.h
+++ b/toonz/sources/toonz/iocommand.h
@@ -180,8 +180,6 @@ bool saveAll();
bool saveSound(const TFilePath &fp, TXshSoundLevel *sc, bool overwrite);
bool saveSound(TXshSoundLevel *sc);
-bool loadColorModel(const TFilePath &fp, int paletteFrame = 0);
-
/*! \note Will fallback to loadResourceFolders() in case all
argument paths are folders. */
diff --git a/toonz/sources/toonz/palettecmd.cpp b/toonz/sources/toonz/palettecmd.cpp
deleted file mode 100644
index c64681f6a..000000000
--- a/toonz/sources/toonz/palettecmd.cpp
+++ /dev/null
@@ -1,665 +0,0 @@
-
-
-#include "palettecmd.h"
-#include "tpalette.h"
-#include "tcolorstyles.h"
-#include "tundo.h"
-#include "tapp.h"
-#include "toonz/tpalettehandle.h"
-#include "toonz/tscenehandle.h"
-#include "toonz/txshlevelhandle.h"
-#include "toonzqt/tselectionhandle.h"
-#include "styleselection.h"
-#include "tconvert.h"
-#include "tcolorutils.h"
-#include "toonzutil.h"
-
-#include "tlevel_io.h"
-#include "trasterimage.h"
-
-#include "toonz/txshlevel.h"
-#include "toonz/toonzscene.h"
-#include "toonz/toonzimageutils.h"
-
-using namespace DVGui;
-
-//===================================================================
-//
-// arrangeStyles
-// srcPage : {a0,a1,...an } ==> dstPage : {b,b+1,...b+n-1}
-//
-//-------------------------------------------------------------------
-
-/*! \namespace PaletteCmd
- \brief Provides a collection of methods to manage \b TPalette.
-*/
-
-namespace
-{
-
-class ArrangeStylesUndo : public TUndo
-{
- TPaletteP m_palette;
- int m_dstPageIndex;
- int m_dstIndexInPage;
- int m_srcPageIndex;
- std::set<int> m_srcIndicesInPage;
-
-public:
- ArrangeStylesUndo(
- TPalette *palette,
- int dstPageIndex,
- int dstIndexInPage,
- int srcPageIndex,
- const std::set<int> &srcIndicesInPage)
- : m_palette(palette), m_dstPageIndex(dstPageIndex), m_dstIndexInPage(dstIndexInPage), m_srcPageIndex(srcPageIndex), m_srcIndicesInPage(srcIndicesInPage)
- {
- assert(m_palette);
- assert(0 <= dstPageIndex && dstPageIndex < m_palette->getPageCount());
- assert(0 <= srcPageIndex && srcPageIndex < m_palette->getPageCount());
- TPalette::Page *dstPage = m_palette->getPage(dstPageIndex);
- assert(dstPage);
- assert(0 <= dstIndexInPage && dstIndexInPage <= dstPage->getStyleCount());
- assert(!srcIndicesInPage.empty());
- TPalette::Page *srcPage = m_palette->getPage(srcPageIndex);
- assert(srcPage);
- assert(0 <= *srcIndicesInPage.begin() && *srcIndicesInPage.rbegin() < srcPage->getStyleCount());
- }
- void undo() const
- {
- TPalette::Page *srcPage = m_palette->getPage(m_srcPageIndex);
- assert(srcPage);
- TPalette::Page *dstPage = m_palette->getPage(m_dstPageIndex);
- assert(dstPage);
- std::vector<int> styles;
- int count = m_srcIndicesInPage.size();
- int h = m_dstIndexInPage;
- std::set<int>::const_iterator i;
- for (i = m_srcIndicesInPage.begin(); i != m_srcIndicesInPage.end(); ++i) {
- if (*i < h)
- h--;
- else
- break;
- }
- assert(h + count <= dstPage->getStyleCount());
- int k;
- for (k = 0; k < count; k++) {
- styles.push_back(dstPage->getStyleId(h));
- dstPage->removeStyle(h);
- }
- k = 0;
- for (i = m_srcIndicesInPage.begin(); i != m_srcIndicesInPage.end(); ++i, ++k)
- srcPage->insertStyle(*i, styles[k]);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- void redo() const
- {
- TPalette::Page *srcPage = m_palette->getPage(m_srcPageIndex);
- assert(srcPage);
- TPalette::Page *dstPage = m_palette->getPage(m_dstPageIndex);
- assert(dstPage);
-
- std::vector<int> styles;
- std::set<int>::const_reverse_iterator i;
- std::vector<int>::reverse_iterator j;
- int k = m_dstIndexInPage;
- for (i = m_srcIndicesInPage.rbegin(); i != m_srcIndicesInPage.rend(); ++i) {
- int index = *i;
- if (m_dstPageIndex == m_srcPageIndex && index < k)
- k--;
- styles.push_back(srcPage->getStyleId(index));
- srcPage->removeStyle(index);
- }
- for (j = styles.rbegin(); j != styles.rend(); ++j)
- dstPage->insertStyle(k, *j);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
-
- /*
- if(TStyleSelection *sl = dynamic_cast<TStyleSelection *>(TSelection::getCurrent()))
- {
- sl->selectNone();
- for(int h = 0; h<(int)styles.size(); h++)
- sl->select(m_palette, m_dstPageIndex, k+h, true);
- }
- */
- }
- int getSize() const { return sizeof *this + m_srcIndicesInPage.size() * sizeof(int); }
-};
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-
-void PaletteCmd::arrangeStyles(
- TPalette *palette,
- int dstPageIndex,
- int dstIndexInPage,
- int srcPageIndex,
- const std::set<int> &srcIndicesInPage)
-{
- ArrangeStylesUndo *undo =
- new ArrangeStylesUndo(
- palette,
- dstPageIndex,
- dstIndexInPage,
- srcPageIndex,
- srcIndicesInPage);
- undo->redo();
- TUndoManager::manager()->add(undo);
-}
-
-//=============================================================================
-//CreateStyle
-//-----------------------------------------------------------------------------
-namespace
-{
-//-----------------------------------------------------------------------------
-
-class CreateStyleUndo : public TUndo
-{
- TPaletteP m_palette;
- int m_pageIndex;
- int m_styleId;
-
-public:
- CreateStyleUndo(
- const TPaletteP &palette,
- int pageIndex,
- int styleId)
- : m_palette(palette), m_pageIndex(pageIndex), m_styleId(styleId)
- {
- assert(m_palette);
- assert(0 <= pageIndex && pageIndex < m_palette->getPageCount());
- assert(0 <= styleId && styleId < m_palette->getStyleCount());
- }
- void undo() const
- {
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- int indexInPage = page->search(m_styleId);
- assert(indexInPage >= 0);
- page->removeStyle(indexInPage);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- void redo() const
- {
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- assert(m_palette->getStylePage(m_styleId) == 0);
- page->addStyle(m_styleId);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- int getSize() const { return sizeof *this; }
-};
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-
-void PaletteCmd::createStyle(
- TPalette *palette,
- TPalette::Page *page)
-{
- int index = TApp::instance()->getCurrentPalette()->getStyleIndex();
- int newIndex;
- if (index == -1)
- newIndex = page->addStyle(TPixel32::Black);
- else {
- TColorStyle *style = palette->getStyle(index);
- newIndex = page->addStyle(style->getMainColor());
- }
- TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
- if (!palette->isCleanupPalette() && level)
- level->setPaletteDirtyFlag(true);
- else
- TApp::instance()->getCurrentScene()->setDirtyFlag(true);
-
- TStyleSelection *styleSelection = dynamic_cast<TStyleSelection *>(TApp::instance()->getCurrentSelection()->getSelection());
- if (!styleSelection)
- styleSelection = new TStyleSelection();
- styleSelection->select(palette, page->getIndex(), newIndex, true);
- TApp::instance()->getCurrentPalette()->setStyleIndex(page->getStyleId(newIndex));
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- TUndoManager::manager()->add(new CreateStyleUndo(palette, page->getIndex(), page->getStyleId(newIndex)));
-}
-
-//=============================================================================
-// addPage
-//-----------------------------------------------------------------------------
-
-namespace
-{
-
-class AddPageUndo : public TUndo
-{
- TPaletteP m_palette;
- int m_pageIndex;
- wstring m_pageName;
- std::vector<std::pair<TColorStyle *, int>> m_styles;
-
-public:
- // creare DOPO l'inserimento
- AddPageUndo(
- const TPaletteP &palette,
- int pageIndex,
- wstring pageName)
- : m_palette(palette), m_pageIndex(pageIndex), m_pageName(pageName)
- {
- assert(m_palette);
- assert(0 <= m_pageIndex && m_pageIndex < m_palette->getPageCount());
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- for (int i = 0; i < page->getStyleCount(); i++) {
- std::pair<TColorStyle *, int> p;
- p.first = page->getStyle(i)->clone();
- p.second = page->getStyleId(i);
- m_styles.push_back(p);
- }
- }
- ~AddPageUndo()
- {
- for (int i = 0; i < (int)m_styles.size(); i++)
- delete m_styles[i].first;
- }
- void undo() const
- {
- m_palette->erasePage(m_pageIndex);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- void redo() const
- {
- TPalette::Page *page = m_palette->addPage(m_pageName);
- assert(page);
- assert(page->getIndex() == m_pageIndex);
- for (int i = 0; i < (int)m_styles.size(); i++) {
- TColorStyle *cs = m_styles[i].first->clone();
- int styleId = m_styles[i].second;
- assert(m_palette->getStylePage(styleId) == 0);
- m_palette->setStyle(styleId, cs);
- page->addStyle(styleId);
- };
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- int getSize() const { return sizeof *this + m_styles.size() * sizeof(TColorStyle); }
-};
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-
-void PaletteCmd::addPage(TPalette *palette, wstring name)
-{
- if (name == L"")
- name = L"page " + toWideString(palette->getPageCount() + 1);
- TPalette::Page *page = palette->addPage(name);
- TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
- if (!palette->isCleanupPalette() && level)
- level->setPaletteDirtyFlag(true);
- else
- TApp::instance()->getCurrentScene()->setDirtyFlag(true);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- TUndoManager::manager()->add(new AddPageUndo(palette, page->getIndex(), name));
-}
-
-//=============================================================================
-// destroyPage
-//-----------------------------------------------------------------------------
-
-namespace
-{
-
-class DestroyPageUndo : public TUndo
-{
- TPaletteP m_palette;
- int m_pageIndex;
- wstring m_pageName;
- std::vector<int> m_styles;
-
-public:
- DestroyPageUndo(const TPaletteP &palette, int pageIndex)
- : m_palette(palette), m_pageIndex(pageIndex)
- {
- assert(m_palette);
- assert(0 <= pageIndex && pageIndex < m_palette->getPageCount());
- assert(m_palette->getPageCount() > 1);
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- m_pageName = page->getName();
- m_styles.resize(page->getStyleCount());
- for (int i = 0; i < page->getStyleCount(); i++)
- m_styles[i] = page->getStyleId(i);
- }
- void undo() const
- {
- TPalette::Page *page = m_palette->addPage(m_pageName);
- m_palette->movePage(page, m_pageIndex);
- for (int i = 0; i < (int)m_styles.size(); i++)
- page->addStyle(m_styles[i]);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- void redo() const
- {
- m_palette->erasePage(m_pageIndex);
- TApp::instance()->getCurrentPalette()->notifyPaletteChanged();
- }
- int getSize() const { return sizeof *this; }
-};
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-
-void PaletteCmd::destroyPage(
- TPalette *palette,
- int pageIndex)
-{
- assert(0 <= pageIndex && pageIndex < palette->getPageCount());
- TUndoManager::manager()->add(new DestroyPageUndo(palette, pageIndex));
- palette->erasePage(pageIndex);
-}
-
-//=============================================================================
-// addStyles
-//-----------------------------------------------------------------------------
-
-namespace
-{
-
-//=============================================================================
-// AddStylesUndo
-//-----------------------------------------------------------------------------
-
-class AddStylesUndo : public TUndo
-{
- TPaletteP m_palette;
- int m_pageIndex;
- int m_indexInPage;
- std::vector<std::pair<TColorStyle *, int>> m_styles;
-
-public:
- // creare DOPO l'inserimento
- AddStylesUndo(
- const TPaletteP &palette,
- int pageIndex,
- int indexInPage,
- int count)
- : m_palette(palette), m_pageIndex(pageIndex), m_indexInPage(indexInPage)
- {
- assert(m_palette);
- assert(0 <= m_pageIndex && m_pageIndex < m_palette->getPageCount());
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- assert(0 <= indexInPage && indexInPage + count <= page->getStyleCount());
- for (int i = 0; i < count; i++) {
- std::pair<TColorStyle *, int> p;
- p.second = page->getStyleId(m_indexInPage + i);
- p.first = m_palette->getStyle(p.second)->clone();
- m_styles.push_back(p);
- }
- }
- ~AddStylesUndo()
- {
- for (int i = 0; i < (int)m_styles.size(); i++)
- delete m_styles[i].first;
- }
- void undo() const
- {
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- int count = m_styles.size();
- for (int i = 0; i < count; i++)
- page->removeStyle(m_indexInPage + i);
- }
- void redo() const
- {
- TPalette::Page *page = m_palette->getPage(m_pageIndex);
- assert(page);
- for (int i = 0; i < (int)m_styles.size(); i++) {
- TColorStyle *cs = m_styles[i].first->clone();
- int styleId = m_styles[i].second;
- assert(m_palette->getStylePage(styleId) == 0);
- m_palette->setStyle(styleId, cs);
- page->insertStyle(m_indexInPage + i, styleId);
- }
- }
- int getSize() const { return sizeof *this + m_styles.size() * sizeof(TColorStyle); }
-};
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-
-void PaletteCmd::addStyles(const TPaletteP &palette,
- int pageIndex,
- int indexInPage,
- const std::vector<TColorStyle *> &styles)
-{
- assert(0 <= pageIndex && pageIndex < palette->getPageCount());
- TPalette::Page *page = palette->getPage(pageIndex);
- assert(page);
- assert(0 <= indexInPage && indexInPage <= page->getStyleCount());
- int count = styles.size();
- for (int i = 0; i < count; i++)
- page->insertStyle(indexInPage + i, styles[i]->clone());
- TUndoManager::manager()->add(new AddStylesUndo(palette, pageIndex, indexInPage, count));
-}
-
-//===================================================================
-// ReferenceImage
-//-------------------------------------------------------------------
-
-namespace
-{
-
-//===================================================================
-// SetReferenceImageUndo
-//-------------------------------------------------------------------
-
-class SetReferenceImageUndo : public TUndo
-{
- TPaletteP m_palette;
- TPaletteP m_oldPalette, m_newPalette;
-
-public:
- SetReferenceImageUndo(TPaletteP palette)
- : m_palette(palette), m_oldPalette(palette->clone())
- {
- }
- void onAdd()
- {
- m_newPalette = m_palette->clone();
- }
- void undo() const
- {
- m_palette->assign(m_oldPalette.getPointer());
- }
- void redo() const
- {
- m_palette->assign(m_newPalette.getPointer());
- }
- int getSize() const
- {
- return sizeof(*this) + sizeof(TPalette) * 2;
- }
-};
-
-//===================================================================
-// loadRefImage
-//-------------------------------------------------------------------
-
-int loadRefImage(TPaletteP levelPalette, const TFilePath &_fp, int &index)
-{
- bool paletteAlreadyLoaded = false;
- TFilePath &fp = (TFilePath &)_fp;
- if (_fp == TFilePath()) {
- paletteAlreadyLoaded = true;
- fp = levelPalette->getRefImgPath();
- }
-
- TImageP img;
- try {
- TLevelReaderP lr(fp);
- if (fp != TFilePath() && lr) {
- TLevelP level = lr->loadInfo();
- if (level && level->getFrameCount() > 0) {
- TLevel::Iterator it;
- if (!paletteAlreadyLoaded) {
- std::vector<TFrameId> fids;
- for (it = level->begin(); it != level->end(); ++it) {
- if (it->first == -1 || it->first == -2) {
- assert(level->getFrameCount() == 1);
- fids.push_back(0);
- break;
- }
- fids.push_back(it->first);
- }
- levelPalette->setRefLevelFids(fids);
- }
- if (index < 0)
- index = 0;
- else if (index >= level->getFrameCount())
- index = level->getFrameCount() - 1;
- it = level->begin();
- advance(it, index);
- img = lr->getFrameReader(it->first)->load();
- if (img && img->getPalette() == 0) {
- if (paletteAlreadyLoaded || level->getPalette() != 0)
- img->setPalette(level->getPalette());
- else if ((fp.getType() == "tzp" || fp.getType() == "tzu"))
- img->setPalette(ToonzImageUtils::loadTzPalette(fp.withType("plt").withNoFrame()));
- }
- }
- } else
- img = levelPalette->getRefImg();
- } catch (...) {
- }
- if (!img)
- return 1;
-
- if (paletteAlreadyLoaded) {
- img->setPalette(0);
- levelPalette->setRefImg(img);
- levelPalette->setRefImgPath(fp);
- return 0;
- }
-
- TUndo *undo = new SetReferenceImageUndo(levelPalette);
-
- QString question;
- question = QObject::tr("Replace palette?");
- int ret = MsgBox(question, QObject::tr("Yes"), QObject::tr("No"));
- if (ret == 1) {
- TPaletteP imagePalette;
- if (TRasterImageP ri = img) {
- TRaster32P raster = ri->getRaster();
- if (raster) {
- std::set<TPixel32> colors;
- int colorCount = 256;
- TColorUtils::buildPalette(colors, raster, colorCount);
- colors.erase(TPixel::Black); //il nero viene messo dal costruttore della TPalette
- imagePalette = new TPalette();
- std::set<TPixel32>::const_iterator it = colors.begin();
- for (; it != colors.end(); ++it)
- imagePalette->getPage(0)->addStyle(*it);
- }
- } else
- imagePalette = img->getPalette();
-
- if (imagePalette) {
- // voglio evitare di sostituire una palette con pochi colori ad una con
- // tanti colori
- while (imagePalette->getStyleCount() < levelPalette->getStyleCount()) {
- int index = imagePalette->getStyleCount();
- assert(index < levelPalette->getStyleCount());
- TColorStyle *style = levelPalette->getStyle(index)->clone();
- imagePalette->addStyle(style);
- }
- levelPalette->assign(imagePalette.getPointer());
- }
- }
-
- img->setPalette(0);
-
- levelPalette->setRefImg(img);
- levelPalette->setRefImgPath(fp);
-
- //DAFARE ovviamente non e' la notifica corretta,
- // ma senza non aggiorna il palette viewer della studio palette e crash!
- TApp *app = TApp::instance();
- app->getCurrentPalette()->notifyPaletteChanged();
-
- TUndoManager::manager()->add(undo);
- return 0;
-}
-//-------------------------------------------------------------------
-} // namespace
-//-------------------------------------------------------------------
-
-//===================================================================
-// loadReferenceImage
-//-------------------------------------------------------------------
-
-int PaletteCmd::loadReferenceImage(const TFilePath &_fp, int &index)
-{
- TPaletteP levelPalette = TApp::instance()->getCurrentPalette()->getPalette(); //ColorController::instance()->getLevelPalette();
- if (!levelPalette)
- return 2;
-
- int ret = loadRefImage(levelPalette, _fp, index);
- if (ret != 0)
- return ret;
-
- TApp *app = TApp::instance();
- app->getCurrentPalette()->notifyPaletteChanged();
- if (app->getCurrentLevel()->getLevel())
- app->getCurrentLevel()->getLevel()->setDirtyFlag(true);
-
- return 0;
-}
-
-//===================================================================
-// loadReferenceImageInStdPlt
-//-------------------------------------------------------------------
-
-//DA FARE: togli una volta sistemata la studiopalette corrente.
-#include "studiopaletteviewer.h"
-#include "toonz/studiopalette.h"
-int PaletteCmd::loadReferenceImageInStdPlt(const TFilePath &_fp, int &index)
-{
- //DAFARE
- TPaletteP levelPalette = DAFARE::getCurrentStudioPalette(); //TApp::instance()->getCurrentPalette()->getPalette();//ColorController::instance()->getLevelPalette();
- if (!levelPalette)
- return 2;
-
- int ret = loadRefImage(levelPalette, _fp, index);
- if (ret != 0)
- return ret;
-
- wstring name = levelPalette->getGlobalName();
- StudioPalette::instance()->save(StudioPalette::instance()->getPalettePath(name),
- levelPalette.getPointer());
-
- return 0;
-}
-
-//===================================================================
-// removeReferenceImage
-//-------------------------------------------------------------------
-
-void PaletteCmd::removeReferenceImage()
-{
- TPaletteP levelPalette = TApp::instance()->getCurrentPalette()->getPalette(); //ColorController::instance()->getLevelPalette();
- if (!levelPalette)
- return;
- TUndo *undo = new SetReferenceImageUndo(levelPalette);
-
- levelPalette->setRefImg(TImageP());
- levelPalette->setRefImgPath(TFilePath());
-
- TApp *app = TApp::instance();
- app->getCurrentPalette()->notifyPaletteChanged();
- if (app->getCurrentLevel()->getLevel())
- app->getCurrentLevel()->getLevel()->setDirtyFlag(true);
-
- TUndoManager::manager()->add(undo);
-}
diff --git a/toonz/sources/toonz/palettecmd.h b/toonz/sources/toonz/palettecmd.h
deleted file mode 100644
index a5983f919..000000000
--- a/toonz/sources/toonz/palettecmd.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma once
-
-#ifndef PALETTECMD_INCLUDED
-#define PALETTECMD_INCLUDED
-
-#include <set>
-#include "tpalette.h"
-
-namespace PaletteCmd
-{
-
-void arrangeStyles(
- TPalette *palette,
- int dstPageIndex, int dstIndexInPage,
- int srcPageIndex, const std::set<int> &srcIndicesInPage);
-
-void createStyle(
- TPalette *palette,
- TPalette::Page *page);
-
-// se name == L"" viene generato un nome univoco ('page N')
-void addPage(
- TPalette *palette,
- wstring name = L"");
-
-void destroyPage(
- TPalette *palette,
- int pageIndex);
-
-void addStyles(
- const TPaletteP &palette,
- int pageIndex,
- int indexInPage,
- const std::vector<TColorStyle *> &styles);
-
-int loadReferenceImage(
- const TFilePath &_fp,
- int &index);
-
-int loadReferenceImageInStdPlt(
- const TFilePath &_fp,
- int &index);
-
-void removeReferenceImage();
-
-} // namespace
-
-#endif
diff --git a/toonz/sources/toonzlib/convert2tlv.cpp b/toonz/sources/toonzlib/convert2tlv.cpp
index 98eca4e0f..5ff26eff6 100644
--- a/toonz/sources/toonzlib/convert2tlv.cpp
+++ b/toonz/sources/toonzlib/convert2tlv.cpp
@@ -579,7 +579,10 @@ TPalette *Convert2Tlv::buildPalette()
page->addStyle(stylesToBeAddedToPage.at(s));
}
- /*-- Cleanupデフォルトパレットを追加する --*/
+ if (!m_appendDefaultPalette)
+ return m_palette;
+
+ /*-- Adding styles in the default palette to the result palette, starts here --*/
TFilePath palettePath = ToonzFolder::getStudioPaletteFolder() + "cleanup_default.tpl";
TFileStatus pfs(palettePath);
@@ -627,7 +630,7 @@ TPalette *Convert2Tlv::buildPalette()
}
}
delete defaultPalette;
- /*-- Cleanupデフォルトパレットを追加する ここまで --*/
+ /*-- Adding styles in the default palette to the result palette, ends here --*/
return m_palette;
}
@@ -636,8 +639,8 @@ TPalette *Convert2Tlv::buildPalette()
Convert2Tlv::Convert2Tlv(const TFilePath &filepath1, const TFilePath &filepath2, const TFilePath &outFolder, const QString &outName,
int from, int to, bool doAutoclose, const TFilePath &palettePath, int colorTolerance,
- int antialiasType, int antialiasValue, bool isUnpaintedFromNAA)
- : m_size(0, 0), m_level1(), m_levelIn1(), m_levelIn2(), m_levelOut(), m_autoclose(doAutoclose), m_premultiply(false), m_count(0), m_from(from), m_to(to), m_palettePath(palettePath), m_colorTolerance(colorTolerance), m_palette(0), m_antialiasType(antialiasType), m_antialiasValue(antialiasValue), m_isUnpaintedFromNAA(isUnpaintedFromNAA)
+ int antialiasType, int antialiasValue, bool isUnpaintedFromNAA, bool appendDefaultPalette)
+ : m_size(0, 0), m_level1(), m_levelIn1(), m_levelIn2(), m_levelOut(), m_autoclose(doAutoclose), m_premultiply(false), m_count(0), m_from(from), m_to(to), m_palettePath(palettePath), m_colorTolerance(colorTolerance), m_palette(0), m_antialiasType(antialiasType), m_antialiasValue(antialiasValue), m_isUnpaintedFromNAA(isUnpaintedFromNAA), m_appendDefaultPalette(appendDefaultPalette)
{
if (filepath1 != TFilePath()) {
m_levelIn1 = filepath1.getParentDir() + filepath1.getLevelName();
diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp
index c0ba6ed81..b4e583873 100644
--- a/toonz/sources/toonzlib/palettecmd.cpp
+++ b/toonz/sources/toonzlib/palettecmd.cpp
@@ -867,7 +867,7 @@ public:
// loadRefImage
//-------------------------------------------------------------------
-int loadRefImage(TPaletteHandle *paletteHandle, bool replace,
+int loadRefImage(TPaletteHandle *paletteHandle, PaletteCmd::ColorModelPltBehavior pltBehavior,
TPaletteP levelPalette, const TFilePath &_fp, int &frame, ToonzScene *scene,
const std::vector<int> &frames)
{
@@ -947,7 +947,7 @@ int loadRefImage(TPaletteHandle *paletteHandle, bool replace,
TUndo *undo = new SetReferenceImageUndo(levelPalette, paletteHandle);
- if (!replace) //ret==1)
+ if (pltBehavior != PaletteCmd::ReplaceColorModelPlt) //ret==1 or 3)
{
TPaletteP imagePalette;
if (TRasterImageP ri = img) {
@@ -962,10 +962,18 @@ int loadRefImage(TPaletteHandle *paletteHandle, bool replace,
/*-- 似ている色をまとめて1つのStyleにする --*/
TColorUtils::buildPalette(colors, raster, colorCount);
colors.erase(TPixel::Black); //il nero viene messo dal costruttore della TPalette
- imagePalette = new TPalette();
+ int pageIndex = 0;
+ if (pltBehavior == PaletteCmd::KeepColorModelPlt)
+ imagePalette = new TPalette();
+ else
+ {
+ imagePalette = levelPalette->clone();
+ /*- Add new page and store color model's styles in it -*/
+ pageIndex = imagePalette->addPage(QObject::tr("color model").toStdWString())->getIndex();
+ }
std::set<TPixel32>::const_iterator it = colors.begin();
for (; it != colors.end(); ++it)
- imagePalette->getPage(0)->addStyle(*it);
+ imagePalette->getPage(pageIndex)->addStyle(*it);
}
} else
imagePalette = img->getPalette();
@@ -992,8 +1000,6 @@ int loadRefImage(TPaletteHandle *paletteHandle, bool replace,
img->setPalette(0);
levelPalette->setRefImgPath(_fp);
- if (!replace)
- levelPalette->setDirtyFlag(true);
TUndoManager::manager()->add(undo);
paletteHandle->notifyPaletteChanged();
@@ -1011,7 +1017,7 @@ int loadRefImage(TPaletteHandle *paletteHandle, bool replace,
// return values -- 2: failed_to_get_palette, 1: failed_to_get_image, 0: OK
//-------------------------------------------------------------------
-int PaletteCmd::loadReferenceImage(TPaletteHandle *paletteHandle, bool replace,
+int PaletteCmd::loadReferenceImage(TPaletteHandle *paletteHandle, ColorModelPltBehavior pltBehavior,
const TFilePath &_fp, int &frame, ToonzScene *scene,
const std::vector<int> &frames)
{
@@ -1019,12 +1025,12 @@ int PaletteCmd::loadReferenceImage(TPaletteHandle *paletteHandle, bool replace,
if (!levelPalette)
return 2;
- int ret = loadRefImage(paletteHandle, replace, levelPalette, _fp, frame, scene, frames);
+ int ret = loadRefImage(paletteHandle, pltBehavior, levelPalette, _fp, frame, scene, frames);
if (ret != 0)
return ret;
// when choosing replace(Keep the destination palette), dirty flag is unchanged
- if (!replace)
+ if (pltBehavior != ReplaceColorModelPlt)
levelPalette->setDirtyFlag(true);
return 0;
diff --git a/toonz/sources/translations/japanese/toonz.ts b/toonz/sources/translations/japanese/toonz.ts
index eb7e3d21c..49bfaa6db 100644
--- a/toonz/sources/translations/japanese/toonz.ts
+++ b/toonz/sources/translations/japanese/toonz.ts
@@ -838,7 +838,7 @@ What do you want to do?</source>
<name>CommandListTree</name>
<message>
<source>----Separator----</source>
- <translation type="unfinished"></translation>
+ <translation>----セパレータ----</translation>
</message>
</context>
<context>
@@ -1074,6 +1074,20 @@ What do you want to do?</source>
<source>Palette:</source>
<translation>パレット :</translation>
</message>
+ <message>
+ <source>Append Default Palette</source>
+ <translation>デフォルトパレットを追加する</translation>
+ </message>
+ <message>
+ <source>When activated, styles of the default palette
+($TOONZSTUDIOPALETTE\cleanup_default.tpl) will
+be appended to the palette after conversion in
+order to save the effort of creating styles
+before color designing.</source>
+ <translation>このオプションがONのとき、デフォルトパレット ($TOONZSTUDIOPALETTE\cleanup_default.tpl)
+のスタイルが変換後のパレットに追加されます。色見本を作成する際に、スタイルを新規作成する
+手間を省くことができます。</translation>
+ </message>
</context>
<context>
<name>DVGui::ProgressDialog</name>
@@ -4229,11 +4243,15 @@ Do you want to create it?</source>
</message>
<message>
<source>&amp;Save All</source>
- <translation type="unfinished"></translation>
+ <translation>シーンとレベルを全て保存 (&amp;S)</translation>
</message>
<message>
<source>Toggle Edit in Place</source>
- <translation type="unfinished"></translation>
+ <translation>親シートの内容をビューアに表示/非表示</translation>
+ </message>
+ <message>
+ <source>Refresh Folder Tree</source>
+ <translation>フォルダ構成の再読み込み</translation>
</message>
</context>
<context>
@@ -4307,47 +4325,48 @@ Gaps</source>
<name>MenuBarPopup</name>
<message>
<source>Customize Menu Bar of Room &quot;%1&quot;</source>
- <translation type="unfinished"></translation>
+ <translation>&quot;%1&quot;ワークスペースのメニューバーをカスタマイズ</translation>
</message>
<message>
<source>OK</source>
- <translation type="unfinished">OK</translation>
+ <translation>OK</translation>
</message>
<message>
<source>Cancel</source>
- <translation type="unfinished">キャンセル</translation>
+ <translation>キャンセル</translation>
</message>
<message>
<source>%1 Menu Bar</source>
- <translation type="unfinished"></translation>
+ <translation>%1 のメニューバー</translation>
</message>
<message>
<source>Menu Items</source>
- <translation type="unfinished"></translation>
+ <translation>コマンド一覧</translation>
</message>
<message>
<source>N.B. If you put unique title to submenu, it may not be translated to another language.
N.B. Duplicated commands will be ignored. Only the last one will appear in the menu bar.</source>
- <translation type="unfinished"></translation>
+ <translation>※ サブメニューに特別な名前を付けると、他の言語での表示時にも翻訳されないことがあります。
+※ 重複したコマンドは無視され、最後に追加されたものだけがメニューバーに表示されます。</translation>
</message>
</context>
<context>
<name>MenuBarTree</name>
<message>
<source>Insert Menu</source>
- <translation type="unfinished"></translation>
+ <translation>メニューを挿入</translation>
</message>
<message>
<source>Insert Submenu</source>
- <translation type="unfinished"></translation>
+ <translation>サブメニューを挿入</translation>
</message>
<message>
<source>Remove &quot;%1&quot;</source>
- <translation type="unfinished"></translation>
+ <translation>&quot;%1&quot;を削除</translation>
</message>
<message>
<source>New Menu</source>
- <translation type="unfinished"></translation>
+ <translation>新規メニュー</translation>
</message>
</context>
<context>
@@ -5445,7 +5464,11 @@ Do you want to overwrite it?</source>
</message>
<message>
<source>Show Keyframes on Cell Area</source>
- <translation type="unfinished"></translation>
+ <translation>タイムシートのコマ領域にキーフレームを表示</translation>
+ </message>
+ <message>
+ <source>Rooms *:</source>
+ <translation>ワークスペースレイアウト *:</translation>
</message>
</context>
<context>
@@ -6997,51 +7020,55 @@ Are you sure to </source>
</message>
<message>
<source>Move Keyframe</source>
- <translation type="unfinished"></translation>
+ <translation>キーフレームを移動</translation>
</message>
<message>
<source>Move keyframe handle : %1 Handle of the keyframe %2</source>
- <translation type="unfinished"></translation>
+ <translation>キーフレームハンドルを移動: フレーム %2 のハンドル %1</translation>
</message>
<message>
<source>Toggle cycle of %1</source>
- <translation type="unfinished"></translation>
+ <translation>%1 のアニメーションの繰り返しをトグル</translation>
</message>
<message>
<source>[Drag] to move position</source>
- <translation type="unfinished"></translation>
+ <translation>[ドラッグ] 移動</translation>
</message>
<message>
<source>----Separator----</source>
- <translation type="unfinished"></translation>
+ <translation>----セパレータ----</translation>
</message>
<message>
<source>[Drag] to move position, [Double Click] to edit title</source>
- <translation type="unfinished"></translation>
+ <translation>[ドラッグ] 移動 [ダブルクリック] タイトルを編集</translation>
</message>
<message>
<source>Incorrect file</source>
- <translation type="unfinished"></translation>
+ <translation>不正なファイル</translation>
</message>
<message>
<source>[Drag&amp;Drop] to copy separator to menu bar</source>
- <translation type="unfinished"></translation>
+ <translation>[ドラッグ &amp; ドロップ] セパレータをメニューバーにコピー (&amp;D)</translation>
</message>
<message>
<source>[Drag&amp;Drop] to copy command to menu bar</source>
- <translation type="unfinished"></translation>
+ <translation>[ドラッグ &amp; ドロップ] コマンドをメニューバーにコピー (&amp;D)</translation>
</message>
<message>
<source>Cannot open menubar settings template file. Re-installing Toonz will solve this problem.</source>
- <translation type="unfinished"></translation>
+ <translation>メニューバー設定テンプレートファイルが見つかりません: OpenToonzを再インストールすると問題が解決します。</translation>
</message>
<message>
<source>Visit Web Site</source>
- <translation type="unfinished">ウェブサイトを開く</translation>
+ <translation>ウェブサイトを開く</translation>
</message>
<message>
<source>https://opentoonz.github.io/e/</source>
- <translation type="unfinished"></translation>
+ <translation></translation>
+ </message>
+ <message>
+ <source>Add color model&apos;s palette to the destination palette.</source>
+ <translation>カラーモデルのパレットを、対象のパレットに追加する。</translation>
</message>
</context>
<context>
@@ -7182,15 +7209,15 @@ The audio file will not be included in the rendered clip.</source>
</message>
<message>
<source>Are you sure you want to remove room %1</source>
- <translation>%1 ワークスペースを削除してもよろしいですか?</translation>
+ <translation>%1 ワークスペースを削除してもよろしいですか</translation>
</message>
<message>
<source>Delete Room &quot;%1&quot;</source>
- <translation type="unfinished"></translation>
+ <translation>ワークスペース&quot;%1&quot;を削除</translation>
</message>
<message>
<source>Customize Menu Bar of Room &quot;%1&quot;</source>
- <translation type="unfinished"></translation>
+ <translation>&quot;%1&quot;ワークスペースのメニューバーをカスタマイズ</translation>
</message>
</context>
<context>
@@ -8537,19 +8564,19 @@ Assign to &apos;%3&apos;?</source>
</message>
<message>
<source>Failed to load menu %1</source>
- <translation type="unfinished"></translation>
+ <translation>メニュー %1 の読み込みに失敗しました</translation>
</message>
<message>
<source>Failed to add command %1</source>
- <translation type="unfinished"></translation>
+ <translation>コマンド %1 の追加に失敗しました</translation>
</message>
<message>
<source>Cannot open menubar settings file %1</source>
- <translation type="unfinished"></translation>
+ <translation>メニューバー設定ファイル %1 を開けませんでした</translation>
</message>
<message>
<source>Failed to create menubar</source>
- <translation type="unfinished"></translation>
+ <translation>メニューバーの作成に失敗しました</translation>
</message>
</context>
<context>
@@ -8932,7 +8959,7 @@ Click the arrow button to create a new sub-xsheet</source>
<name>TopBar</name>
<message>
<source>Lock Rooms Tab</source>
- <translation type="unfinished"></translation>
+ <translation>ワークスペースタブをロック</translation>
</message>
</context>
<context>
@@ -9379,7 +9406,7 @@ Please refer to the user guide for details.</source>
</message>
<message>
<source>Double Click to Toggle Onion Skin</source>
- <translation type="unfinished"></translation>
+ <translation>[ダブルクリック] オニオンスキン表示/非表示</translation>
</message>
</context>
<context>
diff --git a/toonz/sources/translations/japanese/toonzlib.ts b/toonz/sources/translations/japanese/toonzlib.ts
index 262bf6109..b052d9cfe 100644
--- a/toonz/sources/translations/japanese/toonzlib.ts
+++ b/toonz/sources/translations/japanese/toonzlib.ts
@@ -328,6 +328,10 @@
<source>Move Center %1 Frame %2</source>
<translation>センター位置を移動 %1 フレーム %2</translation>
</message>
+ <message>
+ <source>color model</source>
+ <translation>カラーモデル</translation>
+ </message>
</context>
<context>
<name>TScriptBinding::CenterlineVectorizer</name>
diff --git a/toonz/sources/translations/japanese/toonzqt.ts b/toonz/sources/translations/japanese/toonzqt.ts
index 35ad8c7d9..09192edf2 100644
--- a/toonz/sources/translations/japanese/toonzqt.ts
+++ b/toonz/sources/translations/japanese/toonzqt.ts
@@ -124,11 +124,11 @@ Possibly the preset file has been corrupted</source>
</message>
<message>
<source>Error : Preset Name is Invalid</source>
- <translation type="unfinished"></translation>
+ <translation>エラー : プリセット名は無効です</translation>
</message>
<message>
<source>The preset name must not use &apos;,&apos;(comma).</source>
- <translation type="unfinished"></translation>
+ <translation>プリセット名に &quot;,&quot; (カンマ)を使用できません</translation>
</message>
</context>
<context>
@@ -1845,7 +1845,7 @@ Are you sure?</source>
</message>
<message>
<source>OpenToonz 1.0</source>
- <translation type="unfinished"></translation>
+ <translation></translation>
</message>
</context>
<context>
@@ -1906,7 +1906,7 @@ Are you sure?</source>
</message>
<message>
<source>&amp;Swtich output port display mode</source>
- <translation type="unfinished"></translation>
+ <translation>ポートの表示を切り替える (&amp;S)</translation>
</message>
</context>
<context>