From 2888cdfd98cf961af04c18e1b878323114aa689c Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Dec 09 2020 09:01:50 +0000 Subject: Tahoma2d#48:disable auto apply on locked palette Co-authored-by: Jeremy Bullock --- diff --git a/toonz/sources/include/toonz/palettecontroller.h b/toonz/sources/include/toonz/palettecontroller.h index 1296b38..7ec2b47 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 25f0e54..460483d 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 5d7f8c6..080314e 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 095b00a..d4aa79b 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); + } +} //-----------------------------------------------------------------------------