本文整理汇总了C++中TLevelSet::getLevelCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TLevelSet::getLevelCount方法的具体用法?C++ TLevelSet::getLevelCount怎么用?C++ TLevelSet::getLevelCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLevelSet
的用法示例。
在下文中一共展示了TLevelSet::getLevelCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAllLinkedStyles
void StudioPaletteCmd::updateAllLinkedStyles(TPaletteHandle *paletteHandle,
TXsheetHandle *xsheetHandle) {
if (!xsheetHandle) return;
TXsheet *xsheet = xsheetHandle->getXsheet();
if (!xsheet) return;
ToonzScene *scene = xsheet->getScene();
if (!scene) return;
// emit signal only if something changed
bool somethingChanged = false;
StudioPalette *sp = StudioPalette::instance();
TLevelSet *levelSet = scene->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
TXshLevel *xl = levelSet->getLevel(i);
TXshSimpleLevel *sl = xl ? xl->getSimpleLevel() : 0;
if (!sl) continue;
TPalette *palette = sl->getPalette();
if (palette) {
somethingChanged = somethingChanged | sp->updateLinkedColors(palette);
if (sl->getType() == TZP_XSHLEVEL) {
std::vector<TFrameId> fids;
sl->getFids(fids);
std::vector<TFrameId>::iterator it;
for (it = fids.begin(); it != fids.end(); ++it) {
TFrameId fid = *it;
std::string id = sl->getImageId(fid);
}
}
}
}
if (!paletteHandle || !paletteHandle->getPalette()) return;
if (somethingChanged) paletteHandle->notifyColorStyleChanged();
}
示例2: execute
void execute()
{
TApp *app = TApp::instance();
ToonzScene *scene = app->getCurrentScene()->getScene();
TLevelSet *levelSet = scene->getLevelSet();
std::set<TXshLevel *> usedLevels;
scene->getTopXsheet()->getUsedLevels(usedLevels);
std::vector<TXshLevel *> unused;
for (int i = 0; i < levelSet->getLevelCount(); i++) {
TXshLevel *xl = levelSet->getLevel(i);
if (usedLevels.count(xl) == 0)
unused.push_back(xl);
}
if (unused.empty()) {
DVGui::error(QObject::tr("No unused levels"));
return;
} else {
TUndoManager *um = TUndoManager::manager();
um->beginBlock();
for (int i = 0; i < (int)unused.size(); i++) {
TXshLevel *xl = unused[i];
um->add(new DeleteLevelUndo(xl));
scene->getLevelSet()->removeLevel(xl);
}
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentScene()->notifyCastChange();
um->endBlock();
}
}
示例3: onLevelColorStyleChanged
void TApp::onLevelColorStyleChanged() {
onPaletteChanged();
TXshLevel *level = m_currentLevel->getLevel();
if (!level) return;
TPalette *palette = getCurrentPalette()->getPalette();
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
} else {
TLevelSet *levelSet = getCurrentScene()->getScene()->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
if (levelSet->getLevel(i)) {
simpleLevel = levelSet->getLevel(i)->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
}
}
}
}
}
示例4: onPathChanged
void LevelSettingsPopup::onPathChanged() {
QString text = m_pathFld->getPath();
TFilePath newPath(text.toStdWString());
newPath =
TApp::instance()->getCurrentScene()->getScene()->codeFilePath(newPath);
m_pathFld->setPath(QString::fromStdWString(newPath.getWideString()));
if (!m_sl && !!m_sdl) {
// old level is a sound level
TFileType::Type levelType = TFileType::getInfo(newPath);
if (levelType == TFileType::AUDIO_LEVEL) {
TFilePath oldPath = m_sdl->getPath();
if (oldPath == newPath) return;
m_sdl->setPath(newPath);
m_sdl->loadSoundTrack();
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged();
} else {
error(tr("The file %1 is not a sound level.")
.arg(QString::fromStdWString(newPath.getLevelNameW())));
updateLevelSettings();
}
return;
}
if (!m_sl) return;
TFilePath oldPath = m_sl->getPath();
if (oldPath == newPath) return;
TLevelSet *levelSet =
TApp::instance()->getCurrentScene()->getScene()->getLevelSet();
TXshSimpleLevel *sl = 0;
for (int i = 0; i < levelSet->getLevelCount(); i++) {
TXshLevel *xl = levelSet->getLevel(i);
if (!xl) continue;
sl = xl->getSimpleLevel();
if (!sl) continue;
if (sl == m_sl.getPointer()) {
sl = 0;
continue;
}
if (sl->getPath() == newPath) break;
sl = 0;
}
if (sl) {
QString question;
question = "The path you entered for the level " +
QString(::to_string(sl->getName()).c_str()) +
"is already used: this may generate some conflicts in the file "
"management.\nAre you sure you want to assign the same path to "
"two different levels?";
int ret = DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"));
if (ret == 0 || ret == 2) {
m_pathFld->setPath(toQString(m_sl->getPath()));
return;
}
}
TFileType::Type oldType = TFileType::getInfo(oldPath);
TFileType::Type newType = TFileType::getInfo(newPath);
if (m_sl->getType() == TZP_XSHLEVEL &&
m_sl->getScannedPath() != TFilePath()) {
if (newPath == TFilePath() || newPath == m_sl->getScannedPath()) {
newPath = m_sl->getScannedPath();
m_sl->setType(OVL_XSHLEVEL);
m_sl->setScannedPath(TFilePath());
m_sl->setPath(newPath);
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentScene()->notifyCastChange();
updateLevelSettings();
m_sl->invalidateFrames();
std::vector<TFrameId> frames;
m_sl->getFids(frames);
for (auto const &fid : frames) {
IconGenerator::instance()->invalidate(m_sl.getPointer(), fid);
}
return;
}
}
if (oldType != newType ||
m_sl->getType() == TZP_XSHLEVEL && newPath.getType() != "tlv" ||
m_sl->getType() != TZP_XSHLEVEL && newPath.getType() == "tlv") {
error("Wrong path");
m_pathFld->setPath(toQString(m_sl->getPath()));
return;
}
/*-- ここでPathを更新 --*/
m_sl->setPath(newPath);
TApp::instance()
->getPaletteController()
->getCurrentLevelPalette()
->setPalette(m_sl->getPalette());
TApp::instance()->getCurrentLevel()->notifyLevelChange();
TApp::instance()->getCurrentScene()->notifySceneChanged();
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
m_sl->invalidateFrames();
std::vector<TFrameId> frames;
//.........这里部分代码省略.........