From d019eabd5472927719228f41a6f370f03788da33 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Fri, 24 Nov 2017 12:10:29 -0500 Subject: [PATCH 1/2] Fix filmstrip renumber issues --- toonz/sources/toonz/filmstripcommand.cpp | 30 +++++++++++++--------- toonz/sources/toonzlib/txshsimplelevel.cpp | 14 ++++++---- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/toonz/sources/toonz/filmstripcommand.cpp b/toonz/sources/toonz/filmstripcommand.cpp index 23af794e..bee176c2 100644 --- a/toonz/sources/toonz/filmstripcommand.cpp +++ b/toonz/sources/toonz/filmstripcommand.cpp @@ -83,8 +83,8 @@ void makeSpaceForFids(TXshSimpleLevel *sl, } if (!touchedFids.empty()) { sl->renumber(fids); - invalidateIcons(sl, touchedFids); - sl->setDirtyFlag(true); +// invalidateIcons(sl, touchedFids); + sl->setDirtyFlag(true); } } @@ -917,6 +917,7 @@ public: if (m_setType == DrawingData::INSERT) { assert(m_sl->getFrameCount() == m_oldLevelFrameId.size()); m_sl->renumber(m_oldLevelFrameId); + m_sl->setDirtyFlag(true); TApp::instance() ->getPaletteController() ->getCurrentLevelPalette() @@ -1120,7 +1121,7 @@ public: void undo() const override { removeFramesWithoutUndo(m_level, m_insertedFids); m_level->renumber(m_oldFids); - invalidateIcons(m_level.getPointer(), m_oldFids); +// invalidateIcons(m_level.getPointer(), m_oldFids); m_level->setDirtyFlag(true); TApp *app = TApp::instance(); @@ -1222,8 +1223,9 @@ public: m_level->renumber(fids); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); - invalidateIcons(m_level.getPointer(), fids); - TApp::instance()->getCurrentLevel()->notifyLevelChange(); +// invalidateIcons(m_level.getPointer(), fids); + m_level->setDirtyFlag(true); + TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void undo() const override { std::vector fids; @@ -1308,9 +1310,8 @@ void FilmstripCmd::renumber( TUndoManager::manager()->add(new RenumberUndo(sl, fids)); sl->renumber(fids); - sl->setDirtyFlag(true); TApp::instance()->getCurrentScene()->setDirtyFlag(true); - invalidateIcons(sl, fids); +// invalidateIcons(sl, fids); TApp::instance()->getCurrentLevel()->notifyLevelChange(); /* @@ -1381,7 +1382,7 @@ void FilmstripCmd::renumber(TXshSimpleLevel *sl, std::set &frames, assert(frames.size() == newFrames.size()); frames.swap(newFrames); - invalidateIcons(sl, fids); +// invalidateIcons(sl, fids); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1643,7 +1644,8 @@ public: removeFramesWithoutUndo(m_level, m_frames); assert(m_oldFrames.size() == m_level->getFrameCount()); m_level->renumber(m_oldFrames); - invalidateIcons(m_level.getPointer(), m_oldFrames); +// invalidateIcons(m_level.getPointer(), m_oldFrames); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1720,7 +1722,7 @@ void performReverse(const TXshSimpleLevelP &sl, sl->renumber(fids); sl->setDirtyFlag(true); // TApp::instance()->getCurrentScene()->setDirtyFlag(true); - invalidateIcons(sl.getPointer(), frames); +// invalidateIcons(sl.getPointer(), frames); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1887,6 +1889,7 @@ void stepFilmstripFrames(const TXshSimpleLevelP &sl, } } invalidateIcons(sl.getPointer(), changedFids); + sl->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1917,7 +1920,8 @@ public: m_level->renumber(m_oldFrames); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); - invalidateIcons(m_level.getPointer(), m_oldFrames); +// invalidateIcons(m_level.getPointer(), m_oldFrames); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void redo() const override { @@ -2074,7 +2078,8 @@ public: assert(m_level); removeFramesWithoutUndo(m_level, m_frameInserted); m_level->renumber(m_oldFrames); - invalidateIcons(m_level.getPointer(), m_oldFrames); +// invalidateIcons(m_level.getPointer(), m_oldFrames); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void redo() const override { @@ -2416,6 +2421,7 @@ void FilmstripCmd::renumberDrawing(TXshSimpleLevel *sl, const TFrameId &oldFid, } *it = newFid; sl->renumber(fids); + sl->setDirtyFlag(true); TXshCell oldCell(sl, oldFid); TXshCell newCell(sl, newFid); diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index fd0c0a56..ee708076 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -1960,22 +1960,26 @@ void TXshSimpleLevel::renumber(const std::vector &fids) { } ImageManager *im = ImageManager::instance(); + TImageCache *ic = TImageCache::instance(); std::map::iterator jt; { for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { std::string Id = getImageId(jt->first); - im->rebind(Id, "^" + std::to_string(i)); - TImageCache::instance()->remap("^icon:" + std::to_string(i), - "icon:" + Id); + ImageLoader::BuildExtData extData(this, jt->first); + TImageP img = im->getImage(Id, ImageManager::none, &extData); + ic->add(getIconId(jt->first), img, false); + im->rebind(Id, "^" + std::to_string(i)); + ic->remap("^icon:" + std::to_string(i), + getIconId(jt->first)); } for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { std::string Id = getImageId(jt->second); im->rebind("^" + std::to_string(i), Id); - TImageCache::instance()->remap("icon:" + Id, - "^icon:" + std::to_string(i)); + ic->remap(getIconId(jt->second), + "^icon:" + std::to_string(i)); im->renumber(Id, jt->second); } } From 0b3449627b14f5872104db2927c19c376fa4a492 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 26 Nov 2017 15:57:37 -0500 Subject: [PATCH 2/2] Removed commented out invalidateIcons --- toonz/sources/toonz/filmstripcommand.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/toonz/sources/toonz/filmstripcommand.cpp b/toonz/sources/toonz/filmstripcommand.cpp index bee176c2..0a76b5e5 100644 --- a/toonz/sources/toonz/filmstripcommand.cpp +++ b/toonz/sources/toonz/filmstripcommand.cpp @@ -83,7 +83,6 @@ void makeSpaceForFids(TXshSimpleLevel *sl, } if (!touchedFids.empty()) { sl->renumber(fids); -// invalidateIcons(sl, touchedFids); sl->setDirtyFlag(true); } } @@ -1121,7 +1120,6 @@ public: void undo() const override { removeFramesWithoutUndo(m_level, m_insertedFids); m_level->renumber(m_oldFids); -// invalidateIcons(m_level.getPointer(), m_oldFids); m_level->setDirtyFlag(true); TApp *app = TApp::instance(); @@ -1223,7 +1221,6 @@ public: m_level->renumber(fids); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); -// invalidateIcons(m_level.getPointer(), fids); m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1311,7 +1308,6 @@ void FilmstripCmd::renumber( TUndoManager::manager()->add(new RenumberUndo(sl, fids)); sl->renumber(fids); TApp::instance()->getCurrentScene()->setDirtyFlag(true); -// invalidateIcons(sl, fids); TApp::instance()->getCurrentLevel()->notifyLevelChange(); /* @@ -1382,7 +1378,6 @@ void FilmstripCmd::renumber(TXshSimpleLevel *sl, std::set &frames, assert(frames.size() == newFrames.size()); frames.swap(newFrames); -// invalidateIcons(sl, fids); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1644,7 +1639,6 @@ public: removeFramesWithoutUndo(m_level, m_frames); assert(m_oldFrames.size() == m_level->getFrameCount()); m_level->renumber(m_oldFrames); -// invalidateIcons(m_level.getPointer(), m_oldFrames); m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1722,7 +1716,6 @@ void performReverse(const TXshSimpleLevelP &sl, sl->renumber(fids); sl->setDirtyFlag(true); // TApp::instance()->getCurrentScene()->setDirtyFlag(true); -// invalidateIcons(sl.getPointer(), frames); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1920,7 +1913,6 @@ public: m_level->renumber(m_oldFrames); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); -// invalidateIcons(m_level.getPointer(), m_oldFrames); m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -2078,7 +2070,6 @@ public: assert(m_level); removeFramesWithoutUndo(m_level, m_frameInserted); m_level->renumber(m_oldFrames); -// invalidateIcons(m_level.getPointer(), m_oldFrames); m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); }