OpenToonz - An open-source full-featured 2D animation creation software
C
small fixes
shun_iwasawa9f19cf15dacd
diff --git a/toonz/sources/include/toonzqt/styleselection.h b/toonz/sources/include/toonzqt/styleselection.hindex d18bccfff..6e5099e91 100644--- a/toonz/sources/include/toonzqt/styleselection.h+++ b/toonz/sources/include/toonzqt/styleselection.h@@ -98,6 +98,8 @@ public:void removeLink();// get back the style from the studio palette (if linked)void getBackOriginalStyle();+ // return true if there is at least one linked style in the selection+ bool hasLinkedStyle();};#endif // STYLESELECTION_INCLUDEDdiff --git a/toonz/sources/toonzlib/studiopalettecmd.cpp b/toonz/sources/toonzlib/studiopalettecmd.cppindex 8cf07e951..c8023ec49 100644--- a/toonz/sources/toonzlib/studiopalettecmd.cpp+++ b/toonz/sources/toonzlib/studiopalettecmd.cpp@@ -501,7 +501,11 @@ void StudioPaletteCmd::loadIntoCurrentPalette(TPaletteHandle *paletteHandle,// keep the color model path unchangedTFilePath oldRefImagePath = current->getRefImgPath();+ std::wstring oldGlobalName = current->getGlobalName();current->assign(palette, true);+ // keep global name unchanged+ current->setGlobalName(oldGlobalName);+current->setDirtyFlag(true);current->setRefImgPath(oldRefImagePath);diff --git a/toonz/sources/toonzqt/paletteviewergui.cpp b/toonz/sources/toonzqt/paletteviewergui.cppindex b30936b9b..bf826a72b 100644--- a/toonz/sources/toonzqt/paletteviewergui.cpp+++ b/toonz/sources/toonzqt/paletteviewergui.cpp@@ -1023,7 +1023,8 @@ void PageViewer::contextMenuEvent(QContextMenuEvent *event) {// remove links from studio paletteif (m_viewType == LEVEL_PALETTE && m_styleSelection &&- !m_styleSelection->isEmpty() && !isLocked) {+ !m_styleSelection->isEmpty() && !isLocked &&+ m_styleSelection->hasLinkedStyle()) {menu.addSeparator();QAction *toggleStyleLink = cmd->getAction("MI_ToggleLinkToStudioPalette");menu.addAction(toggleStyleLink);diff --git a/toonz/sources/toonzqt/styleselection.cpp b/toonz/sources/toonzqt/styleselection.cppindex 1b49737a5..99f9bb989 100644--- a/toonz/sources/toonzqt/styleselection.cpp+++ b/toonz/sources/toonzqt/styleselection.cpp@@ -1794,3 +1794,26 @@ void TStyleSelection::getBackOriginalStyle() {} elsedelete undo;}++//-----------------------------------------------------------------------------+/*! return true if there is at least one linked style in the selection+*/++bool TStyleSelection::hasLinkedStyle() {+ TPalette *palette = getPalette();+ if (!palette || m_pageIndex < 0 || isEmpty()) return false;+ if (m_styleIndicesInPage.size() <= 0) return false;++ TPalette::Page *page = palette->getPage(m_pageIndex);+ assert(page);++ // for each selected style+ for (std::set<int>::iterator it = m_styleIndicesInPage.begin();+ it != m_styleIndicesInPage.end(); ++it) {+ TColorStyle *cs = page->getStyle(*it);+ std::wstring gname = cs->getGlobalName();+ // if the style has link, return true+ if (gname != L"" && (gname[0] == L'-' || gname[0] == L'+')) return true;+ }+ return false;+}