本文整理汇总了C++中TLevelSet类的典型用法代码示例。如果您正苦于以下问题:C++ TLevelSet类的具体用法?C++ TLevelSet怎么用?C++ TLevelSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLevelSet类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:34,代码来源:levelcommand.cpp
示例2: 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();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:34,代码来源:studiopalettecmd.cpp
示例3: refreshData
void CastBrowser::refreshData() {
m_castItems->clear();
TLevelSet *levelSet = CastTreeViewer::getLevelSet();
TFilePath folder = m_treeViewer->getCurrentFolder();
m_folderName->setText(toQString(folder));
std::vector<TXshLevel *> levels;
if (folder != TFilePath())
levelSet->listLevels(levels, folder);
else
levelSet->listLevels(levels);
int i;
for (i = 0; i < (int)levels.size(); i++) {
if (levels[i]->getSimpleLevel())
m_castItems->addItem(new LevelCastItem(
levels[i], m_itemViewer->getPanel()->getIconSize()));
else if (levels[i]->getPaletteLevel())
m_castItems->addItem(
new PaletteCastItem(levels[i]->getPaletteLevel(),
m_itemViewer->getPanel()->getIconSize()));
else if (levels[i]->getSoundLevel())
m_castItems->addItem(new SoundCastItem(
levels[i]->getSoundLevel(), m_itemViewer->getPanel()->getIconSize()));
}
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:25,代码来源:castviewer.cpp
示例4: assert
TFilePath ResourceImportStrategy::process(ToonzScene *scene, ToonzScene *srcScene, TFilePath srcPath)
{
TFilePath srcActualPath = srcScene->decodeFilePath(srcPath);
if (!scene->isExternPath(srcActualPath) || m_strategy == DONT_IMPORT)
return srcPath;
TFilePath dstPath;
if (srcPath.getWideString().find(L'+') == 0)
dstPath = srcPath;
else
dstPath = scene->getImportedLevelPath(srcPath);
TFilePath actualDstPath = scene->decodeFilePath(dstPath);
assert(actualDstPath != TFilePath());
if (m_strategy == IMPORT_AND_OVERWRITE) {
//bool overwritten = false;
if (TSystem::doesExistFileOrLevel(actualDstPath)) {
TSystem::removeFileOrLevel(actualDstPath);
// overwritten = true;
}
if (TSystem::doesExistFileOrLevel(srcPath))
TXshSimpleLevel::copyFiles(actualDstPath, srcPath);
return dstPath;
} else if (m_strategy == IMPORT_AND_RENAME) {
std::wstring levelName = srcPath.getWideName();
TLevelSet *parentLevelSet = scene->getLevelSet();
NameModifier nm(levelName);
wstring newName;
for (;;) {
newName = nm.getNext();
if (!parentLevelSet->hasLevel(newName))
break;
}
dstPath = dstPath.withName(newName);
actualDstPath = scene->decodeFilePath(dstPath);
if (TSystem::doesExistFileOrLevel(actualDstPath))
TSystem::removeFileOrLevel(actualDstPath);
if (TSystem::doesExistFileOrLevel(srcActualPath)) {
TXshSimpleLevel::copyFiles(actualDstPath, srcActualPath);
}
return dstPath;
}
return srcPath;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:48,代码来源:sceneresources.cpp
示例5: TFilePath
void CastTreeViewer::dropEvent(QDropEvent *event)
{
m_dropTargetItem = 0;
if (m_dropFilePath != TFilePath()) {
IoCmd::loadScene(m_dropFilePath);
m_dropFilePath = TFilePath();
m_dropTargetItem = 0;
update();
return;
}
if (!event->mimeData()->hasFormat("application/vnd.toonz.levels"))
return;
m_dropTargetItem = itemAt(event->pos());
if (!m_dropTargetItem)
return;
TFilePath folderPath(m_dropTargetItem->data(1, Qt::DisplayRole).toString().toStdWString());
m_dropTargetItem = 0;
update();
if (folderPath.getName() == AudioFolderName) {
event->ignore();
return;
}
event->acceptProposedAction();
TLevelSet *levelSet = getLevelSet();
const CastItems *castItems = dynamic_cast<const CastItems *>(event->mimeData());
assert(castItems);
if (!castItems)
return;
int i;
TUndoManager::manager()->beginBlock();
for (i = 0; i < castItems->getItemCount(); i++) {
CastItem *item = castItems->getItem(i);
if (LevelCastItem *li = dynamic_cast<LevelCastItem *>(item)) {
TXshLevel *level = li->getLevel();
wstring levelName = level->getName();
MoveLevelToFolderUndo *undo = new MoveLevelToFolderUndo(levelSet, levelName, folderPath);
levelSet->moveLevelToFolder(folderPath, level);
TUndoManager::manager()->add(undo);
} else if (SoundCastItem *si = dynamic_cast<SoundCastItem *>(item)) {
}
}
TUndoManager::manager()->endBlock();
emit itemMovedToFolder();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:48,代码来源:castviewer.cpp
示例6: levelExists
bool LevelCreatePopup::levelExists(std::wstring levelName) {
TFilePath fp;
TFilePath actualFp;
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
TLevelSet *levelSet =
TApp::instance()->getCurrentScene()->getScene()->getLevelSet();
TFilePath parentDir(m_pathFld->getPath().toStdWString());
fp = scene->getDefaultLevelPath(getLevelType(), levelName)
.withParentDir(parentDir);
actualFp = scene->decodeFilePath(fp);
if (levelSet->getLevel(levelName) != 0 ||
TSystem::doesExistFileOrLevel(actualFp)) {
return true;
} else
return false;
}
开发者ID:janisozaur,项目名称:opentoonz,代码行数:18,代码来源:levelcreatepopup.cpp
示例7: currentItem
void CastTreeViewer::deleteFolder() {
QTreeWidgetItem *item = currentItem();
if (!item || !item->parent()) return;
QString itemName = item->data(0, Qt::DisplayRole).toString();
if (itemName == AudioFolderName) return;
int ret = DVGui::MsgBox(tr("Delete folder ") + item->text(0) + "?", tr("Yes"),
tr("No"), 1);
if (ret == 2 || ret == 0) return;
QTreeWidgetItem *parentItem = item->parent();
TFilePath childPath(item->data(1, Qt::DisplayRole).toString().toStdWString());
TLevelSet *levelSet =
TApp::instance()->getCurrentScene()->getScene()->getLevelSet();
levelSet->removeFolder(childPath);
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
parentItem->removeChild(item);
setCurrentItem(parentItem);
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:19,代码来源:castviewer.cpp
示例8: onPaletteChanged
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);
}
}
}
}
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:20,代码来源:tapp.cpp
示例9: if
void LevelSettingsPopup::onNameChanged() {
QString text = m_nameFld->text();
TXshLevel *level = 0;
if (m_sl)
level = m_sl.getPointer();
else if (m_cl)
level = m_cl.getPointer();
else
return;
if (text.length() == 0) {
error("The name " + text +
" you entered for the level is not valid.\n Please enter a different "
"name.");
m_nameFld->setFocus();
return;
}
/*-- Level名に変更がない場合 --*/
if (level->getName() == text.toStdWString()) {
// warning("Level name unchanged.");
return;
}
TLevelSet *levelSet =
TApp::instance()->getCurrentScene()->getScene()->getLevelSet();
if (!levelSet->renameLevel(level, text.toStdWString())) {
error("The name " + text +
" you entered for the level is already used.\nPlease enter a "
"different name.");
m_nameFld->setFocus();
return;
}
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentScene()->notifyCastChange();
}
开发者ID:opentoonz,项目名称:opentoonz,代码行数:38,代码来源:levelsettingspopup.cpp
示例10: newPath
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;
//.........这里部分代码省略.........
开发者ID:opentoonz,项目名称:opentoonz,代码行数:101,代码来源:levelsettingspopup.cpp
注:本文中的TLevelSet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论