本文整理汇总了C++中TFilePath::withName方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::withName方法的具体用法?C++ TFilePath::withName怎么用?C++ TFilePath::withName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::withName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDeliver
void onDeliver()
{
if (m_error) {
m_error = false;
MsgBox(DVGui::CRITICAL, QObject::tr("There was an error saving frames for the %1 level.").arg(QString::fromStdWString(m_fp.withoutParentDir().getWideString())));
}
bool isPreview = (m_fp.getType() == "noext");
TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0"));
TNotifier::instance()->notify(TSceneNameChange());
if (Preferences::instance()->isGeneratedMovieViewEnabled()) {
if (!isPreview && (Preferences::instance()->isDefaultViewerEnabled()) &&
(m_fp.getType() == "mov" || m_fp.getType() == "avi" || m_fp.getType() == "3gp")) {
QString name = QString::fromStdString(m_fp.getName());
int index;
if ((index = name.indexOf("#RENDERID")) != -1) //!quite ugly I know....
m_fp = m_fp.withName(name.left(index).toStdWString());
if (!TSystem::showDocument(m_fp)) {
QString msg(QObject::tr("It is not possible to display the file %1: no player associated with its format").arg(QString::fromStdWString(m_fp.withoutParentDir().getWideString())));
MsgBox(WARNING, msg);
}
}
else {
int r0, r1, step;
TApp *app = TApp::instance();
ToonzScene *scene = app->getCurrentScene()->getScene();
TOutputProperties &outputSettings = isPreview ? *scene->getProperties()->getPreviewProperties() : *scene->getProperties()->getOutputProperties();
outputSettings.getRange(r0, r1, step);
const TRenderSettings rs = outputSettings.getRenderSettings();
if (r0 == 0 && r1 == -1)
r0 = 0, r1 = scene->getFrameCount() - 1;
double timeStretchFactor = isPreview ? 1.0 : (double)outputSettings.getRenderSettings().m_timeStretchTo /
outputSettings.getRenderSettings().m_timeStretchFrom;
r0 = tfloor(r0 * timeStretchFactor);
r1 = tceil((r1 + 1) * timeStretchFactor) - 1;
TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
prop->m_frameRate = outputSettings.getFrameRate();
TSoundTrack *snd = app->getCurrentXsheet()->getXsheet()->makeSound(prop);
if (outputSettings.getRenderSettings().m_stereoscopic) {
assert(!isPreview);
::viewFile(m_fp.withName(m_fp.getName() + "_l"), r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
::viewFile(m_fp.withName(m_fp.getName() + "_r"), r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
} else
::viewFile(m_fp, r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
}
}
}
示例2: extractPsdSuffix
std::string ResourceImporter::extractPsdSuffix(TFilePath &path) {
if (path.getType() != "psd") return "";
std::string name = path.getName();
int i = name.find("#");
if (i == std::string::npos) return "";
std::string suffix = name.substr(i);
path = path.withName(name.substr(0, i));
return suffix;
}
示例3: process
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;
}
示例4: renameFolder
TFilePath TLevelSet::renameFolder(const TFilePath &folder,
const std::wstring &newName) {
// Impedisco la creazione di folder con nome "" che creano problemi
// (praticamente Ecome se avessero infinite sottocartelle)
if (newName == L"") return folder;
TFilePath folder2 = folder.withName(newName);
for (int i = 0; i < (int)m_folders.size(); i++) {
if (folder == m_folders[i])
m_folders[i] = folder2;
else if (folder.isAncestorOf(m_folders[i]))
m_folders[i] = folder2 + (m_folders[i] - folder);
}
if (m_defaultFolder == folder) m_defaultFolder = folder2;
std::map<TXshLevel *, TFilePath>::iterator it;
for (it = m_folderTable.begin(); it != m_folderTable.end(); ++it) {
if (folder == it->second)
it->second = folder2;
else if (folder.isAncestorOf(it->second))
it->second = folder2 + (it->second - folder);
}
return folder2;
}
示例5: addSuffix
TFilePath OverwriteDialog::addSuffix(const TFilePath &src) const {
return src.withName(src.getWideName() + m_suffix->text().toStdWString());
}
示例6: init
bool RenderCommand::init(bool isPreview)
{
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
TSceneProperties *sprop = scene->getProperties();
/*-- Preview/Renderに応じてそれぞれのSettingを取得 --*/
TOutputProperties &outputSettings = isPreview ? *sprop->getPreviewProperties() : *sprop->getOutputProperties();
outputSettings.getRange(m_r0, m_r1, m_step);
/*-- シーン全体のレンダリングの場合、m_r1をScene長に設定 --*/
if (m_r0 == 0 && m_r1 == -1) {
m_r0 = 0;
m_r1 = scene->getFrameCount() - 1;
}
if (m_r0 < 0)
m_r0 = 0;
if (m_r1 >= scene->getFrameCount())
m_r1 = scene->getFrameCount() - 1;
if (m_r1 < m_r0) {
MsgBox(WARNING, QObject::tr("The command cannot be executed because the scene is empty."));
return false;
// throw TException("empty scene");
// non so perche', ma termina il programma
// nonostante il try all'inizio
}
// Initialize the preview case
/*TRenderSettings rs = sprop->getPreviewProperties()->getRenderSettings();
TRenderSettings rso = sprop->getOutputProperties()->getRenderSettings();
rs.m_stereoscopic=true;
rs.m_stereoscopicShift=0.05;
rso.m_stereoscopic=true;
rso.m_stereoscopicShift=0.05;
sprop->getPreviewProperties()->setRenderSettings(rs);
sprop->getOutputProperties()->setRenderSettings(rso);*/
if (isPreview) {
/*-- PreviewではTimeStretchを考慮しないので、そのままフレーム値を格納してゆく --*/
m_numFrames = (int)(m_r1 - m_r0 + 1);
m_r = m_r0;
m_stepd = m_step;
m_multimediaRender = 0;
return true;
}
// Full render case
// Read the output filepath
TFilePath fp = outputSettings.getPath();
/*-- ファイル名が指定されていない場合は、シーン名を出力ファイル名にする --*/
if (fp.getWideName() == L"")
fp = fp.withName(scene->getScenePath().getName());
/*-- ラスタ画像の場合、ファイル名にフレーム番号を追加 --*/
if (TFileType::getInfo(fp) == TFileType::RASTER_IMAGE || fp.getType() == "pct" || fp.getType() == "pic" || fp.getType() == "pict") //pct e' un formato"livello" (ha i settings di quicktime) ma fatto di diversi frames
fp = fp.withFrame(TFrameId::EMPTY_FRAME);
fp = scene->decodeFilePath(fp);
if (!TFileStatus(fp.getParentDir()).doesExist()) {
try {
TFilePath parent = fp.getParentDir();
TSystem::mkDir(parent);
DvDirModel::instance()->refreshFolder(parent.getParentDir());
} catch (TException &e) {
MsgBox(WARNING, QObject::tr("It is not possible to create folder : %1").arg(QString::fromStdString(toString(e.getMessage()))));
return false;
} catch (...) {
MsgBox(WARNING, QObject::tr("It is not possible to create a folder."));
return false;
}
}
m_fp = fp;
// Retrieve camera infos
const TCamera *camera = isPreview ? scene->getCurrentPreviewCamera() : scene->getCurrentCamera();
TDimension cameraSize = camera->getRes();
TPointD cameraDpi = camera->getDpi();
// Retrieve render interval/step/times
double stretchTo = (double)outputSettings.getRenderSettings().m_timeStretchTo;
double stretchFrom = (double)outputSettings.getRenderSettings().m_timeStretchFrom;
m_timeStretchFactor = stretchTo / stretchFrom;
m_stepd = m_step / m_timeStretchFactor;
int stretchedR0 = tfloor(m_r0 * m_timeStretchFactor);
int stretchedR1 = tceil((m_r1 + 1) * m_timeStretchFactor) - 1;
m_r = stretchedR0 / m_timeStretchFactor;
m_numFrames = (stretchedR1 - stretchedR0) / m_step + 1;
// Update the multimedia render switch
m_multimediaRender = outputSettings.getMultimediaRendering();
return true;
}
示例7: buildPsd
TFilePath ResourceImporter::buildPsd(const TFilePath &basePath, const string &suffix)
{
return basePath.withName(basePath.getName() + suffix);
}
示例8: codePath
TFilePath ResourceImporter::codePath(const TFilePath &oldPath, const TFilePath &newActualPath)
{
return oldPath.withName(newActualPath.getName());
}