Skip to content

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

C

Tahoma2d#48:disable auto apply on locked palette

shun-iwasawa2888cdfd98cf
diff --git a/toonz/sources/include/toonz/palettecontroller.h b/toonz/sources/include/toonz/palettecontroller.h
index 1296b38c8..7ec2b473e 100644
--- a/toonz/sources/include/toonz/palettecontroller.h
+++ b/toonz/sources/include/toonz/palettecontroller.h
@@ -96,6 +96,7 @@ signals:
void colorAutoApplyEnabled(bool enabled);
void colorSampleChanged(const TPixel32 &);
+ void checkPaletteLock();
// used for "passive pick" feature in the tool options bar of the rgb picker
// tool
diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h
index 25f0e5457..460483dd8 100644
--- a/toonz/sources/include/toonzqt/styleeditor.h
+++ b/toonz/sources/include/toonzqt/styleeditor.h
@@ -727,6 +727,7 @@ protected slots:
void onCleanupStyleChanged(bool isDragging);
void onOldStyleClicked(const TColorStyle &);
void updateOrientationButton();
+ void checkPaletteLock();
// called (e.g.) by PaletteController when an other StyleEditor change the
// toggle
void enableColorAutoApply(bool enabled);
diff --git a/toonz/sources/toonzlib/palettecontroller.cpp b/toonz/sources/toonzlib/palettecontroller.cpp
index 5d7f8c67a..080314ef2 100644
--- a/toonz/sources/toonzlib/palettecontroller.cpp
+++ b/toonz/sources/toonzlib/palettecontroller.cpp
@@ -90,6 +90,7 @@ void PaletteController::setCurrentPalette(TPaletteHandle *paletteHandle) {
void PaletteController::editLevelPalette() {
setCurrentPalette(m_currentLevelPalette);
+ emit(checkPaletteLock());
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp
index 095b00ae3..d4aa79b5e 100644
--- a/toonz/sources/toonzqt/styleeditor.cpp
+++ b/toonz/sources/toonzqt/styleeditor.cpp
@@ -3283,6 +3283,8 @@ void StyleEditor::showEvent(QShowEvent *) {
SLOT(onStyleChanged(bool)));
ret = ret && connect(m_paletteHandle, SIGNAL(paletteSwitched()), this,
SLOT(onStyleSwitched()));
+ ret = ret && connect(m_paletteController, SIGNAL(checkPaletteLock()), this,
+ SLOT(checkPaletteLock()));
if (m_cleanupPaletteHandle)
ret =
ret && connect(m_cleanupPaletteHandle, SIGNAL(colorStyleChanged(bool)),
@@ -3492,8 +3494,8 @@ void StyleEditor::onColorChanged(const ColorModel &color, bool isDragging) {
m_newColor->setStyle(*m_editedStyle);
m_colorParameterSelector->setStyle(*m_editedStyle);
-
- if (m_autoButton->isChecked()) {
+ // Auto Button should be disabled with locked palette
+ if (m_autoButton->isEnabled() && m_autoButton->isChecked()) {
copyEditedStyleToPalette(isDragging);
}
}
@@ -3525,7 +3527,6 @@ void StyleEditor::enable(bool enabled, bool enabledOnlyFirstTab,
// when the palette is locked
if (palette->isLocked()) {
m_applyButton->setEnabled(false);
- m_autoButton->setChecked(false);
m_autoButton->setEnabled(false);
} else // when the palette is unlocked
{
@@ -3534,6 +3535,17 @@ void StyleEditor::enable(bool enabled, bool enabledOnlyFirstTab,
}
}
}
+//-----------------------------------------------------------------------------
+
+void StyleEditor::checkPaletteLock() {
+ if (getPalette() && getPalette()->isLocked()) {
+ m_applyButton->setEnabled(false);
+ m_autoButton->setEnabled(false);
+ } else {
+ m_applyButton->setDisabled(m_autoButton->isChecked());
+ m_autoButton->setEnabled(true);
+ }
+}
//-----------------------------------------------------------------------------