Skip to content

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

C

Remove some References of GlobalParameters

Abel You3b3e1e3f8a41
diff --git a/toonz/sources/include/toonz/cleanupparameters.h b/toonz/sources/include/toonz/cleanupparameters.h
index 16a93c008..77fa9c7c4 100644
--- a/toonz/sources/include/toonz/cleanupparameters.h
+++ b/toonz/sources/include/toonz/cleanupparameters.h
@@ -129,10 +129,15 @@ class DVAPI CleanupParameters {
CleanupTypes::FDG_INFO m_fdgInfo;
bool m_dirtyFlag;
+ // Both not stored in the scene
public:
- static CleanupParameters GlobalParameters;
+ // To store the scene's default CleanUpSettings(read when scene switched) and loaded .cln Settings
+ static CleanupParameters GlobalParameters;
+ // To compare with CurrentParameters
static CleanupParameters LastSavedParameters;
+ // TIP: The CleanupSettings also exist in Project
+
public:
CleanupTypes::AUTOCENTER_TYPE m_autocenterType;
CleanupTypes::PEGS_SIDE m_pegSide;
diff --git a/toonz/sources/toonz/cleanupsettingsmodel.cpp b/toonz/sources/toonz/cleanupsettingsmodel.cpp
index bceff21c9..63ea43217 100644
--- a/toonz/sources/toonz/cleanupsettingsmodel.cpp
+++ b/toonz/sources/toonz/cleanupsettingsmodel.cpp
@@ -346,15 +346,7 @@ void CleanupSettingsModel::commitChanges(int action) {
m_backupParams.assign(currentParams, false);
currentParams->setDirtyFlag(true);
-
- // Deal with scene stuff
- if (m_clnPath.isEmpty()) {
- TApp::instance()->getCurrentScene()->setDirtyFlag(
- true); // This should be moved outside... sadly not supported at the
- // moment...
- CleanupParameters::GlobalParameters.assign(
- currentParams); // The global settings are being changed
- }
+ TApp::instance()->getCurrentScene()->setDirtyFlag(true);
}
// Perform actions
@@ -459,7 +451,7 @@ void CleanupSettingsModel::onSceneSwitched() {
// copy them there.
CleanupParameters *params = getCurrentParameters();
CleanupParameters::GlobalParameters.assign(params);
-
+
// The cleanupper always uses current cleanup parameters. It has to be
// specified somewhere,
// so let's do it once here.
@@ -580,12 +572,13 @@ void CleanupSettingsModel::restoreGlobalSettings() {
currentParams->assign(&CleanupParameters::GlobalParameters);
// Make sure that the current cleanup palette is set to currentParams' palette
+ // This would refresh the StyleEditor
TApp::instance()
->getPaletteController()
->getCurrentCleanupPalette()
->setPalette(currentParams->m_cleanupPalette.getPointer());
- m_clnPath = TFilePath();
+ m_clnPath = TFilePath(); // This Path won't be stored in scene or project
m_backupParams.assign(currentParams, false);
if (m_previewersCount > 0 || m_cameraTestsCount > 0) rebuildPreview();
@@ -660,22 +653,12 @@ bool CleanupSettingsModel::loadSettings(const TFilePath &clnPath) {
CleanupParameters *cp = getCurrentParameters();
if (!loadSettings(cp, clnPath)) return false;
- // The same as restoreGlobalSettings()
TApp::instance()
->getPaletteController()
->getCurrentCleanupPalette()
->setPalette(cp->m_cleanupPalette.getPointer());
- /*---
- * LoadSettingsPopupからこの関数が呼ばれたとき、ロードしたパラメータをGlobal設定に格納する---*/
- if (m_clnPath.isEmpty()) {
- TApp::instance()->getCurrentScene()->setDirtyFlag(
- true); // This should be moved outside... sadly not supported at the
- // moment...
- CleanupParameters::GlobalParameters.assign(
- cp); // The global settings are being changed
- }
-
+ TApp::instance()->getCurrentScene()->setDirtyFlag(true);
m_backupParams.assign(cp, false);
if (m_previewersCount > 0 || m_cameraTestsCount > 0) rebuildPreview();
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index edd4a0d1c..8ff8648ef 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -1384,8 +1384,9 @@ void IoCmd::newScene() {
app->getCurrentObject()->setIsSpline(false);
app->getCurrentColumn()->setColumnIndex(0);
- CleanupParameters *cp = scene->getProperties()->getCleanupParameters();
- CleanupParameters::GlobalParameters.assign(cp);
+ //CleanupParameters *cp = scene->getProperties()->getCleanupParameters();
+ //CleanupParameters::GlobalParameters.assign(cp);
+ //CleanupSettingsModel::onSceneSwitched()
// updateCleanupSettingsPopup();
@@ -1513,13 +1514,6 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
#endif
}
- //In case of a .cln file be loaded into GlobalParemeters,
- //we should also write these info into .tnz (scene file)
- // TODO: optimize the GlobalParemeters sturcture
- CleanupParameters *cp = scene->getProperties()->getCleanupParameters();
- //CleanupParameters oldCP(*cp);
- cp->assign(&CleanupParameters::GlobalParameters);
-
// Must wait for current save to finish, just in case
while (TApp::instance()->isSaveInProgress())
;
@@ -1534,14 +1528,6 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
}
TApp::instance()->setSaveInProgress(false);
- //cp->assign(&oldCP);
-
- // Make sure that the current cleanup palette is set to currentParams' palette
- TApp::instance()
- ->getPaletteController()
- ->getCurrentCleanupPalette()
- ->setPalette(cp->m_cleanupPalette.getPointer());
-
// in case of saving subxsheet, revert the level paths after saving
revertOrgLevelPaths();
@@ -2012,10 +1998,9 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
Previewer::clearAll();
PreviewFxManager::instance()->reset();
// updateCleanupSettingsPopup();
- /*- CleanupParameterの更新 -*/
- CleanupParameters *cp = scene->getProperties()->getCleanupParameters();
- CleanupParameters::GlobalParameters.assign(cp);
-
+ /*- CleanupParameterの更新 -*/ //CleanupSettingsModel::onSceneSwitched()
+ //CleanupParameters *cp = scene->getProperties()->getCleanupParameters();
+ //CleanupParameters::GlobalParameters.assign(cp);
CacheFxCommand::instance()->onSceneLoaded();
#ifdef USE_SQLITE_HDPOOL
@@ -2127,6 +2112,8 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
2); // "All Icons & Images"
printf("%s:%s loadScene() completed :\n", __FILE__, __FUNCTION__);
+
+ TApp::instance()->getPaletteController()->editLevelPalette();
return true;
}