本文整理汇总了C++中ToonzScene::getDefaultLevelPath方法的典型用法代码示例。如果您正苦于以下问题:C++ ToonzScene::getDefaultLevelPath方法的具体用法?C++ ToonzScene::getDefaultLevelPath怎么用?C++ ToonzScene::getDefaultLevelPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToonzScene
的用法示例。
在下文中一共展示了ToonzScene::getDefaultLevelPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: apply
bool LevelCreatePopup::apply() {
TApp *app = TApp::instance();
int row = app->getCurrentFrame()->getFrame();
int col = app->getCurrentColumn()->getColumnIndex();
int i, j;
ToonzScene *scene = app->getCurrentScene()->getScene();
TXsheet *xsh = scene->getXsheet();
bool validColumn = true;
if (xsh->getColumn(col))
validColumn =
xsh->getColumn(col)->getColumnType() == TXshColumn::eLevelType;
int from = (int)m_fromFld->getValue();
int to = (int)m_toFld->getValue();
int inc = (int)m_incFld->getValue();
int step = (int)m_stepFld->getValue();
double w = m_widthFld->getValue();
double h = m_heightFld->getValue();
double dpi = m_dpiFld->getValue();
int xres = std::max(tround(w * dpi), 1);
int yres = std::max(tround(h * dpi), 1);
int lType = getLevelType();
std::wstring levelName = m_nameFld->text().toStdWString();
// tolgo i blanks prima e dopo
i = levelName.find_first_not_of(L' ');
if (i == (int)std::wstring::npos)
levelName = L"";
else {
int j = levelName.find_last_not_of(L' ');
assert(j != (int)std::wstring::npos);
levelName = levelName.substr(i, j - i + 1);
}
if (levelName.empty()) {
error(tr("No level name specified: please choose a valid level name"));
return false;
}
if (from > to) {
error(tr("Invalid frame range"));
return false;
}
if (inc <= 0) {
error(tr("Invalid increment value"));
return false;
}
if (step <= 0) {
error(tr("Invalid step value"));
return false;
}
int numFrames = step * (((to - from) / inc) + 1);
if (scene->getLevelSet()->getLevel(levelName)) {
error(
tr("The level name specified is already used: please choose a "
"different level name"));
m_nameFld->selectAll();
return false;
}
TFilePath parentDir(m_pathFld->getPath().toStdWString());
TFilePath fp =
scene->getDefaultLevelPath(lType, levelName).withParentDir(parentDir);
TFilePath actualFp = scene->decodeFilePath(fp);
if (TSystem::doesExistFileOrLevel(actualFp)) {
error(
tr("The level name specified is already used: please choose a "
"different level name"));
m_nameFld->selectAll();
return false;
}
parentDir = scene->decodeFilePath(parentDir);
if (!TFileStatus(parentDir).doesExist()) {
QString question;
/*question = "Folder " +toQString(parentDir) +
" doesn't exist.\nDo you
want to create it?";*/
question = tr("Folder %1 doesn't exist.\nDo you want to create it?")
.arg(toQString(parentDir));
int ret = DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"));
if (ret == 0 || ret == 2) return false;
try {
TSystem::mkDir(parentDir);
DvDirModel::instance()->refreshFolder(parentDir.getParentDir());
} catch (...) {
error(tr("Unable to create") + toQString(parentDir));
return false;
}
}
TXshLevel *level =
scene->createNewLevel(lType, levelName, TDimension(), 0, fp);
TXshSimpleLevel *sl = dynamic_cast<TXshSimpleLevel *>(level);
assert(sl);
sl->setPath(fp, true);
//.........这里部分代码省略.........
示例3: updatePath
void LevelCreatePopup::updatePath() {
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
TFilePath defaultPath;
defaultPath = scene->getDefaultLevelPath(getLevelType()).getParentDir();
m_pathFld->setPath(toQString(defaultPath));
}