Skip to content

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

C

Update directory when scene switched

Konstantin Dmitriev225725801b5f
diff --git a/toonz/sources/toonz/scenebrowser.cpp b/toonz/sources/toonz/scenebrowser.cpp
index 6d03de518..99a8635b9 100644
--- a/toonz/sources/toonz/scenebrowser.cpp
+++ b/toonz/sources/toonz/scenebrowser.cpp
@@ -241,6 +241,15 @@ SceneBrowser::SceneBrowser(QWidget *parent, Qt::WFlags flags, bool noContextMenu
ret = ret && connect(MyFileSystemWatcher::instance(),
SIGNAL(directoryChanged(const QString &)), this,
SLOT(onFileSystemChanged(const QString &)));
+
+ // when the scene switched, update the path of the scene location node
+ TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene();
+ //ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this,
+ // SLOT(onSceneSwitched()));
+ ret = ret && connect(sceneHandle, SIGNAL(nameSceneChanged()), this,
+ SLOT(onSceneSwitched()));
+
+ //onSceneSwitched();
// store the first item("Root") in the history
m_indexHistoryList.append(m_folderTreeView->currentIndex());
@@ -1901,6 +1910,14 @@ void SceneBrowser::convertToPaintedTlv() {
//-----------------------------------------------------------------------------
+void SceneBrowser::onSceneSwitched() {
+ //TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene();
+ TFilePath scenesFolder = TProjectManager::instance()->getCurrentProject()->getScenesPath();
+ setFolder(scenesFolder, true);
+}
+
+//-----------------------------------------------------------------------------
+
void SceneBrowser::onSelectedItems(const std::set<int> &indexes) {
std::set<TFilePath> filePaths;
std::set<int>::const_iterator it;
diff --git a/toonz/sources/toonz/scenebrowser.h b/toonz/sources/toonz/scenebrowser.h
index 76574c6c7..c5612dec7 100644
--- a/toonz/sources/toonz/scenebrowser.h
+++ b/toonz/sources/toonz/scenebrowser.h
@@ -140,6 +140,7 @@ protected slots:
void onClickedItem(int index);
void onDoubleClickedItem(int index);
void onSelectedItems(const std::set<int> &indexes);
+ void onSceneSwitched();
void folderUp();
void newFolder();