Skip to content

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

C

Merge remote-tracking branch 'origin/master' into numpad_for_palette_shortcut

shun_iwasawa53bef613276a
diff --cc toonz/sources/common/tvrender/tpalette.cpp
index f3e229ee5,902a439e9..ad236ef84
--- a/toonz/sources/common/tvrender/tpalette.cpp
+++ b/toonz/sources/common/tvrender/tpalette.cpp
@@@ -1095,18 -1116,14 +1122,30 @@@ void TPalette::setShortcutValue(int key
}
}
+ //-------------------------------------------------------------------
+ // Returns true if there is at least one style with picked pos value
+ //-------------------------------------------------------------------
+
+ bool TPalette::hasPickedPosStyle() {
+ for (int i = 0; i < getStyleCount(); ++i) {
+ TColorStyleP style = m_styles[i].second;
+ if (style->getPickedPosition() != TPoint()) return true;
+ }
+ return false;
-}
++}
++
+//-------------------------------------------------------------------
+
+void TPalette::nextShortcutScope(bool invert) {
+ if (invert) {
+ if (m_shortcutScopeIndex > 0)
+ m_shortcutScopeIndex -= 1;
+ else
+ m_shortcutScopeIndex = getPage(0)->getStyleCount() / 10;
+ } else {
+ if ((m_shortcutScopeIndex + 1) * 10 < getPage(0)->getStyleCount())
+ m_shortcutScopeIndex += 1;
+ else
+ m_shortcutScopeIndex = 0;
+ }
+}
diff --cc toonz/sources/include/toonzqt/paletteviewergui.h
index 1d88c1c13,3cc54aa75..e853458b5
--- a/toonz/sources/include/toonzqt/paletteviewergui.h
+++ b/toonz/sources/include/toonzqt/paletteviewergui.h
@@@ -199,14 -199,6 +199,8 @@@ protected
void zoomInChip();
void zoomOutChip();
+ bool hasShortcut(int indexInPage);
+
- protected slots:
-
- void toggleLink();
- void eraseToggleLink();
- void removeLink();
-
private:
DVGui::LineEdit *m_renameTextField;
QPoint m_dragStartPosition;
diff --cc toonz/sources/include/tpalette.h
index 339186f6c,a1085ce8c..e883e6d74
--- a/toonz/sources/include/tpalette.h
+++ b/toonz/sources/include/tpalette.h
@@@ -420,8 -417,9 +420,11 @@@ between RGBA color components
m_isLocked = lock;
}
+ bool hasPickedPosStyle(); // Returns true if there is at least one style with
+ // picked pos value
+
+ void nextShortcutScope(bool invert);
+
public:
// Deprecated functions
diff --cc toonz/sources/toonz/preferencespopup.h
index 616582a7c,8a4997390..ba790d7e8
--- a/toonz/sources/toonz/preferencespopup.h
+++ b/toonz/sources/toonz/preferencespopup.h
@@@ -68,11 -69,16 +69,17 @@@ private
QPushButton *m_addLevelFormat, *m_removeLevelFormat, *m_editLevelFormat;
DVGui::CheckBox *m_inksOnly, *m_enableVersionControl, *m_levelsBackup,
- *m_onionSkinVisibility, *m_pixelsOnlyCB, *m_onionSkinDuringPlayback,
+ *m_onionSkinVisibility, *m_pixelsOnlyCB, *m_projectRootDocuments,
+ *m_projectRootDesktop, *m_projectRootCustom, *m_projectRootStuff,
- *m_onionSkinDuringPlayback, *m_autoSaveSceneCB, *m_autoSaveOtherFilesCB;
++ *m_onionSkinDuringPlayback, *m_autoSaveSceneCB, *m_autoSaveOtherFilesCB,
+ *m_useNumpadForSwitchingStyles;
+ DVGui::FileField *m_customProjectRootFileField;
+
DVGui::FileField *m_ffmpegPathFileFld;
+ QGroupBox *m_autoSaveGroup;
+
private:
// QWidget* create(const QString& lbl, bool def, const char* slot);
void rebuildFormatsList();
diff --cc toonz/sources/toonz/sceneviewerevents.cpp
index c55a75a00,d07163fb9..201a5530d
--- a/toonz/sources/toonz/sceneviewerevents.cpp
+++ b/toonz/sources/toonz/sceneviewerevents.cpp
@@@ -14,11 -14,8 +14,12 @@@
#include "onionskinmaskgui.h"
#include "ruler.h"
#include "comboviewerpane.h"
+ #include "locatorpopup.h"
+// TnzQt includes
+#include "toonzqt/tselectionhandle.h"
+#include "toonzqt/styleselection.h"
+
// TnzTools includes
#include "tools/cursors.h"
#include "tools/toolhandle.h"
diff --cc toonz/sources/toonzlib/preferences.cpp
index 9af590c03,07f7fcf52..588792ee6
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@@ -288,9 -290,11 +291,12 @@@ Preferences::Preferences(
, m_multiLayerStylePickerEnabled(false)
, m_paletteTypeOnLoadRasterImageAsColorModel(0)
, m_showKeyframesOnXsheetCellArea(true)
+ , m_projectRoot(0x08)
+ , m_customProjectRoot("")
, m_precompute(true)
, m_ffmpegTimeout(30)
- , m_shortcutPreset("defopentoonz") {
++ , m_shortcutPreset("defopentoonz")
+ , m_useNumpadForSwitchingStyles(false) {
TCamera camera;
m_defLevelType = PLI_XSHLEVEL;
m_defLevelWidth = camera.getSize().lx;
@@@ -549,8 -560,9 +562,11 @@@
if (ffmpegPath != "") m_ffmpegPath = ffmpegPath;
setFfmpegPath(m_ffmpegPath.toStdString());
getValue(*m_settings, "ffmpegTimeout", m_ffmpegTimeout);
+ QString shortcutPreset = m_settings->value("shortcutPreset").toString();
+ if (shortcutPreset != "") m_shortcutPreset = shortcutPreset;
+ setShortcutPreset(m_shortcutPreset.toStdString());
+ getValue(*m_settings, "useNumpadForSwitchingStyles",
+ m_useNumpadForSwitchingStyles);
}
//-----------------------------------------------------------------
diff --cc toonz/sources/toonzqt/paletteviewergui.cpp
index 43f0e81c6,c42db3b87..a692b7123
--- a/toonz/sources/toonzqt/paletteviewergui.cpp
+++ b/toonz/sources/toonzqt/paletteviewergui.cpp
@@@ -1407,34 -1372,6 +1409,15 @@@ void PageViewer::onStyleRenamed()
PaletteCmd::renamePaletteStyle(getPaletteHandle(), newName);
}
- //-----------------------------------------------------------------------------
- /*! Recall \b TStyleSelection::toggleLink() to current page style selection.
- */
- void PageViewer::toggleLink() {
- if (!m_page || !m_styleSelection || m_styleSelection->isEmpty()) return;
- m_styleSelection->toggleLink();
- update();
- emit changeWindowTitleSignal();
- }
-
- //-----------------------------------------------------------------------------
- /*! Recall \b TStyleSelection::eraseToggleLink() to current page style
- * selection.
- */
- void PageViewer::eraseToggleLink() {
- if (!m_page || !m_styleSelection || m_styleSelection->isEmpty()) return;
- m_styleSelection->eraseToggleLink();
- }
-
+//-----------------------------------------------------------------------------
+
+bool PageViewer::hasShortcut(int indexInPage) {
+ if (!m_page) return false;
+ if (indexInPage < 0 || indexInPage >= m_page->getStyleCount()) return false;
+ int styleIndex = m_page->getStyleId(indexInPage);
+ return (m_page->getPalette()->getStyleShortcut(styleIndex) >= 0);
+}
+
//=============================================================================
/*! \class PaletteViewerGUI::PaletteTabBar
\brief The PaletteTabBar class provides a bar with tab to show