Skip to content

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

C

enable to change hold cells when doing drag-and-drop (outside url or a frame from level strip)

Abel You8af6104e332f
diff --git a/toonz/sources/toonz/xsheetdragtool.cpp b/toonz/sources/toonz/xsheetdragtool.cpp
index e7119ecee..6f886d610 100644
--- a/toonz/sources/toonz/xsheetdragtool.cpp
+++ b/toonz/sources/toonz/xsheetdragtool.cpp
@@ -2120,9 +2120,9 @@ public:
if (e->keyboardModifiers() & Qt::ShiftModifier)
m_type = INSERT_CELLS;
else if (e->keyboardModifiers() & Qt::AltModifier)
- m_type = OVERWRITE_CELLS;
- else
m_valid = canChange(row, col);
+ else
+ m_type = OVERWRITE_CELLS;
m_curPos = pos;
refreshCellsArea();
}
@@ -2149,12 +2149,25 @@ public:
IoCmd::loadResources(args);
} else if (!m_data->m_levels.empty()) {
int i;
- for (i = 0; i < (int)m_data->m_levels.size(); i++) {
- TXshSimpleLevel *sl = m_data->m_levels[i].first.getPointer();
- std::vector<TFrameId> fids = m_data->m_levels[i].second;
- if (!sl || fids.empty()) continue;
+ // Change hold cells when there are only one frame
+ if (overWrite && m_data->m_levels.size() == 1 &&
+ m_data->m_levels[0].second.size() == 1) {
+ TXshSimpleLevel *sl = m_data->m_levels[0].first.getPointer();
+ std::vector<TFrameId> fids = m_data->m_levels[0].second;
+ if (!sl || fids.empty()) return;
+ auto xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet();
+ int r1 = row;
+ if (!xsh->getCell(r1, col).isEmpty())
+ for (; xsh->getCell(r1, col) == xsh->getCell(r1 + 1, col);
+ fids.push_back(fids.front()), r1++);
IoCmd::exposeLevel(sl, row, col, fids, insert, overWrite);
- }
+ } else
+ for (i = 0; i < (int)m_data->m_levels.size(); i++) {
+ TXshSimpleLevel *sl = m_data->m_levels[i].first.getPointer();
+ std::vector<TFrameId> fids = m_data->m_levels[i].second;
+ if (!sl || fids.empty()) continue;
+ IoCmd::exposeLevel(sl, row, col, fids, insert, overWrite);
+ }
}
refreshCellsArea();
}