void TXsheet::getUsedLevels(set<TXshLevel *> &levels) const { set<const TXsheet *> visitedXshs; vector<const TXsheet *> todoXshs; visitedXshs.insert(this); todoXshs.push_back(this); while (!todoXshs.empty()) { const TXsheet *xsh = todoXshs.back(); todoXshs.pop_back(); int c0 = 0, c1 = xsh->getColumnCount() - 1; for (int c = c0; c <= c1; ++c) { TXshColumnP column = const_cast<TXsheet *>(xsh)->getColumn(c); if (!column) continue; TXshCellColumn *cellColumn = column->getCellColumn(); if (!cellColumn) continue; int r0, r1; if (!cellColumn->getRange(r0, r1)) continue; TXshLevel *level = 0; for (int r = r0; r <= r1; r++) { TXshCell cell = cellColumn->getCell(r); if (cell.isEmpty() || !cell.m_level) continue; if (level != cell.m_level.getPointer()) { level = cell.m_level.getPointer(); levels.insert(level); if (level->getChildLevel()) { TXsheet *childXsh = level->getChildLevel()->getXsheet(); if (visitedXshs.count(childXsh) == 0) { visitedXshs.insert(childXsh); todoXshs.push_back(childXsh); } } } } } } }
void TLevelSet::loadFolder(TIStream &is, TFilePath folder) { std::string s; is.getTagParam("type", s); if (s == "default") setDefaultFolder(folder); while (!is.eos()) { std::string tagName; is.matchTag(tagName); if (tagName == "levels") { while (!is.eos()) { TPersist *p = 0; is >> p; TXshLevel *xshLevel = dynamic_cast<TXshLevel *>(p); if (xshLevel && !xshLevel->getChildLevel()) moveLevelToFolder(folder, xshLevel); } } else if (tagName == "folder") { is.getTagParam("name", s); TFilePath child = createFolder(folder, ::to_wstring(s)); loadFolder(is, child); } else throw TException("expected <levels> or <folder>"); is.closeChild(); }
ZPlacement cameraPlacement; if (m_subXSheetStack.empty()) cameraPlacement = m_cameraPlacement; else cameraPlacement = m_subXSheetStack.back().m_camera; TAffine columnZaff; bool columnBehindCamera = TStageObject::perspective( columnZaff, cameraPlacement.m_aff, cameraPlacement.m_z, columnAff, columnZ, columnNoScaleZ); if (!columnBehindCamera) return; TXshSimpleLevel *sl = xl->getSimpleLevel(); bool storePlayer = sl || (xl->getChildLevel() && locals::applyPlasticDeform(column.getPointer(), m_vs) && locals::isMeshDeformed(xsh, pegbar, m_vs)); if (storePlayer) { // Build and store a player Player player; player.m_sl = sl; player.m_fid = cell.m_frameId; player.m_xsh = xsh; player.m_column = col; player.m_frame = row; player.m_dpiAff = sl ? getDpiAffine(sl, cell.m_frameId) : TAffine(); player.m_onionSkinDistance = m_onionSkinDistance; player.m_isCurrentColumn = (m_currentColumnIndex == col);