diff --git a/toonz/sources/tnztools/tool.cpp b/toonz/sources/tnztools/tool.cpp index a607ffd3..f1f919d7 100644 --- a/toonz/sources/tnztools/tool.cpp +++ b/toonz/sources/tnztools/tool.cpp @@ -350,6 +350,13 @@ TImage *TTool::touchImage() { TXshSimpleLevel *sl = cell.getSimpleLevel(); if (sl) { + // For Single Frame levels, don't create anything + std::vector fids; + sl->getFids(fids); + if (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME)) + return 0; + // If for some reason there is no palette, try and set a default one now. if (!sl->getPalette() && (sl->getType() == TZP_XSHLEVEL || sl->getType() == PLI_XSHLEVEL)) { @@ -1072,6 +1079,20 @@ QString TTool::updateEnabled(int rowIndex, int columnIndex) { return (enable(false), QObject::tr("The current level is not editable.")); + + // For Single Frame raster levels, don't allow new levels to be created + if (levelType == OVL_XSHLEVEL && !filmstrip) { + std::vector fids; + sl->getFids(fids); + if (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME)) { + TXshCell cell = xsh->getCell(rowIndex, columnIndex); + if (cell.isEmpty()) + return (enable(false), + QObject::tr("The current tool cannot be used on empty " + "frames of a Single Frame level.")); + } + } } } diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp index bad746ac..44858c8d 100644 --- a/toonz/sources/toonz/cellselection.cpp +++ b/toonz/sources/toonz/cellselection.cpp @@ -2741,6 +2741,19 @@ void TCellSelection::createBlankDrawing(int row, int col, bool multiple) { DVGui::warning(QObject::tr("The current level is not editable")); return; } + + // Do not duplicate frames on Single Frame levels + if (level->getSimpleLevel()) { + std::vector fids; + level->getSimpleLevel()->getFids(fids); + if (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME)) { + if (!multiple) + DVGui::warning(QObject::tr( + "Unable to create a blank drawing on a Single Frame level")); + return; + } + } } ToolHandle *toolHandle = TApp::instance()->getCurrentTool(); @@ -2902,6 +2915,19 @@ void TCellSelection::duplicateFrame(int row, int col, bool multiple) { TXshSimpleLevel *sl = prevCell.getSimpleLevel(); if (!sl || sl->isSubsequence() || sl->isReadOnly()) return; + // Do not duplicate frames on Single Frame levels + if (sl) { + std::vector fids; + sl->getFids(fids); + if (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME)) { + if (!multiple) + DVGui::warning(QObject::tr( + "Unable to duplicate a drawing on a Single Frame level")); + return; + } + } + ToolHandle *toolHandle = TApp::instance()->getCurrentTool(); //----- Going to cheat a little. Use autocreate rules to help create what we diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp index 37f06dde..1ee18b37 100644 --- a/toonz/sources/toonz/filmstrip.cpp +++ b/toonz/sources/toonz/filmstrip.cpp @@ -850,6 +850,18 @@ void FilmstripFrames::mousePressEvent(QMouseEvent *event) { TFrameId fid = index2fid(index); TXshSimpleLevel *sl = getLevel(); + + // If accessed after 1st frame on a Single Frame level + // Block movement so we can't create new images + if (index > 0) { + std::vector fids; + sl->getFids(fids); + if (fids.empty() || + (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME))) + return; + } + int frameHeight = m_iconSize.height() + fs_frameSpacing + fs_iconMarginTop + fs_iconMarginBottom; int frameWidth = m_iconSize.width() + fs_frameSpacing + fs_iconMarginLR + @@ -1130,6 +1142,11 @@ void FilmstripFrames::keyPressEvent(QKeyEvent *event) { std::vector fids; level->getFids(fids); if (fids.empty()) return; + // Do not allow movement on Single Frame levels + if (fids.empty() || + (fids.size() == 1 && (fids[0].getNumber() == TFrameId::EMPTY_FRAME || + fids[0].getNumber() == TFrameId::NO_FRAME))) + return; // If on a level frame pass the frame id after the last frame to allow // creating a new frame with the down arrow key