当前位置: 首页>>代码示例>>C++>>正文


C++ TFilePath::getWideName方法代码示例

本文整理汇总了C++中TFilePath::getWideName方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::getWideName方法的具体用法?C++ TFilePath::getWideName怎么用?C++ TFilePath::getWideName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFilePath的用法示例。


在下文中一共展示了TFilePath::getWideName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute

std::wstring OverwriteDialog::execute(ToonzScene *scene, const TFilePath &srcLevelPath, bool multiload)
{
	TFilePath levelPath = srcLevelPath;
	TFilePath actualLevelPath = scene->decodeFilePath(levelPath);
	if (!TSystem::doesExistFileOrLevel(actualLevelPath))
		return levelPath.getWideName();

	if (m_applyToAll && m_choice == RENAME) {
		levelPath = addSuffix(levelPath);
		actualLevelPath = scene->decodeFilePath(levelPath);
	}
	if (m_applyToAll) {
		if (m_choice != RENAME || !TSystem::doesExistFileOrLevel(actualLevelPath))
			return levelPath.getWideName();
	}

	m_label->setText(tr("File %1 already exists.\nWhat do you want to do?").arg(toQString(levelPath)));
	// find a compatible suffix
	if (TSystem::doesExistFileOrLevel(actualLevelPath)) {
		int i = 0;
		while (TSystem::doesExistFileOrLevel(scene->decodeFilePath(addSuffix(srcLevelPath)))) {
			m_suffix->setText("_" + QString::number(++i));
		}
	}

	if (multiload)
		m_okToAllBtn->show();
	else
		m_okToAllBtn->hide();

	// there could be a WaitCursor cursor
	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
	raise();
	exec();
	QApplication::restoreOverrideCursor();

	if (m_rename->isChecked()) {
		if (m_suffix->text() == "") {
			MsgBox(WARNING, tr("The suffix field is empty. Please specify a suffix."));
			return execute(scene, srcLevelPath, multiload);
		}
		levelPath = addSuffix(srcLevelPath);
		actualLevelPath = scene->decodeFilePath(levelPath);
		if (TSystem::doesExistFileOrLevel(actualLevelPath)) {
			MsgBox(WARNING, tr("File %1 exists as well; please choose a different suffix.").arg(toQString(levelPath)));
			return execute(scene, srcLevelPath, multiload);
		}
		m_choice = RENAME;
	} else if (m_overwrite->isChecked())
		m_choice = OVERWRITE;
	else {
		assert(m_keep->isChecked());
		m_choice = KEEP_OLD;
	}

	return levelPath.getWideName();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:57,代码来源:overwritepopup.cpp

示例2: doesExistFileOrLevel

bool TSystem::doesExistFileOrLevel(const TFilePath &fp) {
  if (TFileStatus(fp).doesExist()) return true;

  if (fp.isLevelName()) {
    const TFilePath &parentDir = fp.getParentDir();
    if (!TFileStatus(parentDir).doesExist()) return false;

    TFilePathSet files;
    try {
      files = TSystem::readDirectory(parentDir, false, true, true);
    } catch (...) {
    }

    TFilePathSet::iterator it, end = files.end();
    for (it = files.begin(); it != end; ++it) {
      if (it->getLevelNameW() == fp.getLevelNameW()) return true;
    }
  } else if (fp.getType() == "psd") {
    QString name(QString::fromStdWString(fp.getWideName()));
    name.append(QString::fromStdString(fp.getDottedType()));

    int sepPos                               = name.indexOf("#");
    int dotPos                               = name.indexOf(".", sepPos);
    int removeChars                          = dotPos - sepPos;
    int doubleUnderscorePos                  = name.indexOf("__", sepPos);
    if (doubleUnderscorePos > 0) removeChars = doubleUnderscorePos - sepPos;

    name.remove(sepPos, removeChars);

    TFilePath psdpath(fp.getParentDir() + TFilePath(name.toStdWString()));
    if (TFileStatus(psdpath).doesExist()) return true;
  }

  return false;
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:35,代码来源:tsystem.cpp

示例3: doRender

void RenderCommand::doRender(bool isPreview)
{
	bool isWritable = true;
	bool isMultiFrame;
	/*-- 初期化処理。フレーム範囲の計算や、Renderの場合はOutputSettingsから保存先パスも作る --*/
	if (!init(isPreview))
		return;
	if (m_fp.getDots() == ".") {
		isMultiFrame = false;
		TFileStatus fs(m_fp);
		if (fs.doesExist())
			isWritable = fs.isWritable();
	} else {
		isMultiFrame = true;
		TFilePath dir = m_fp.getParentDir();
		QDir qDir(QString::fromStdWString(dir.getWideString()));
		QString levelName = QRegExp::escape(QString::fromStdWString(m_fp.getWideName()));
		QString levelType = QString::fromStdString(m_fp.getType());
		QString exp(levelName + ".[0-9]{1,4}." + levelType);
		QRegExp regExp(exp);
		QStringList list = qDir.entryList(QDir::Files);
		QStringList livelFrames = list.filter(regExp);

		int i;
		for (i = 0; i < livelFrames.size() && isWritable; i++) {
			TFilePath frame = dir + TFilePath(livelFrames[i].toStdWString());
			if (frame.isEmpty() || !frame.isAbsolute())
				continue;
			TFileStatus fs(frame);
			isWritable = fs.isWritable();
		}
	}
	if (!isWritable) {
		string str = "It is not possible to write the output:  the file";
		str += isMultiFrame ? "s are read only." : " is read only.";
		MsgBox(WARNING, QString::fromStdString(str));
		return;
	}

	ToonzScene *scene = 0;
	TCamera *camera = 0;

	try {
		/*-- Xsheetノードに繋がっている各ラインごとに計算するモード。
			MultipleRender で Schematic Flows または Fx Schematic Terminal Nodes が選択されている場合
		--*/
		if (m_multimediaRender && m_fp.getType() != "swf") //swf is not currently supported on multimedia...
			multimediaRender();
		else if (!isPreview && m_fp.getType() == "swf")
			flashRender();
		else
			/*-- 通常のRendering --*/
			rasterRender(isPreview);
	} catch (TException &e) {
		MsgBox(WARNING, QString::fromStdString(toString(e.getMessage())));
	} catch (...) {
		MsgBox(WARNING, QObject::tr("It is not possible to complete the rendering."));
	}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:59,代码来源:rendercommand.cpp

示例4: getFolderNameFromPath

/*! Returns the folder's name of the specified TFilePath \b folderDir.\n
        Returns the empty string if \b folderDir isn't a folder of the
   project.*/
wstring TProject::getFolderNameFromPath(const TFilePath &folderDir) {
  int index = getFolderIndexFromPath(folderDir);
  if (index < 0) return L"";
  if (getFolder(index).isAbsolute())
    return ::to_wstring("+" + getFolderName(index));
  else
    return folderDir.getWideName();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:11,代码来源:tproject.cpp

示例5: dropEvent

void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) {
  TFilePath newPath = getItemPath(m_dropItem);

  resetDropItem();

  if (newPath.isEmpty()) return;

  const QMimeData *mimeData      = event->mimeData();
  const PaletteData *paletteData = dynamic_cast<const PaletteData *>(mimeData);
  if (paletteData) {
    if (paletteData->hasOnlyPalette()) {
      TPalette *palette = paletteData->getPalette();
      if (!palette) return;

      try {
        StudioPaletteCmd::createPalette(
            newPath, ::to_string(palette->getPaletteName()), palette);
      } catch (TException &e) {
        error("Can't create palette: " +
              QString(::to_string(e.getMessage()).c_str()));
      } catch (...) {
        error("Can't create palette");
      }
    }
    return;
  }

  if (!mimeData->hasUrls() || mimeData->urls().size() == 0) return;

  QList<QUrl> urls = mimeData->urls();
  TUndoManager::manager()->beginBlock();
  int i;
  for (i = 0; i < urls.size(); i++) {
    QUrl url       = urls[i];
    TFilePath path = TFilePath(url.toLocalFile().toStdWString());

    StudioPalette *studioPalette = StudioPalette::instance();
    if (path == newPath || path.getParentDir() == newPath) continue;

    if (isInStudioPalette(path)) {
      TFilePath newPalettePath =
          newPath +
          TFilePath(path.getWideName() + ::to_wstring(path.getDottedType()));
      try {
        StudioPaletteCmd::movePalette(newPalettePath, path);
      } catch (TException &e) {
        error("Can't rename palette: " +
              QString(::to_string(e.getMessage()).c_str()));
      } catch (...) {
        error("Can't rename palette");
      }
    }
  }
  TUndoManager::manager()->endBlock();
  event->setDropAction(Qt::CopyAction);
  event->accept();
}
开发者ID:jcome,项目名称:opentoonz,代码行数:57,代码来源:studiopaletteviewer.cpp

示例6: onItemChanged

void StudioPaletteTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) {
  if (item != currentItem() || isRootItem(item)) return;
  wstring name      = item->text(column).toStdWString();
  TFilePath oldPath = getCurrentFolderPath();
  if (oldPath.isEmpty() || name.empty() || oldPath.getWideName() == name)
    return;
  TFilePath newPath(oldPath.getParentDir() +
                    TFilePath(name + ::to_wstring(oldPath.getDottedType())));
  try {
    StudioPaletteCmd::movePalette(newPath, oldPath);
  } catch (TException &e) {
    error(QString(::to_string(e.getMessage()).c_str()));
    item->setText(column, QString::fromStdWString(oldPath.getWideName()));
  } catch (...) {
    error("Can't rename file");
    item->setText(column, QString::fromStdWString(oldPath.getWideName()));
  }
  refreshItem(getItem(oldPath.getParentDir()));
  setCurrentItem(getItem(newPath));
}
开发者ID:jcome,项目名称:opentoonz,代码行数:20,代码来源:studiopaletteviewer.cpp

示例7: onCastFolderAdded

void CastTreeViewer::onCastFolderAdded(const TFilePath &path)
{
	QTreeWidgetItem *root = topLevelItem(0)->child(0);
	assert(root->data(1, Qt::DisplayRole).toString() == toQString(getLevelSet()->getDefaultFolder()));
	QString childName = QString::fromStdWString(path.getWideName());
	QString childPathQstr = QString::fromStdWString(path.getWideString());
	QTreeWidgetItem *childItem = new QTreeWidgetItem(root, QStringList(childName) << childPathQstr);
	childItem->setFlags(childItem->flags() | Qt::ItemIsEditable);
	root->addChild(childItem);
	setCurrentItem(childItem);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:11,代码来源:castviewer.cpp

示例8: 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;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:48,代码来源:sceneresources.cpp

示例9: loadMacro

void AddFxContextMenu::loadMacro() {
  TFilePath macroDir = m_presetPath + TFilePath("macroFx");
  try {
    if (TFileStatus(macroDir).isDirectory()) {
      TFilePathSet macros = TSystem::readDirectory(macroDir);
      if (macros.empty()) return;

      QMenu *insertMacroMenu  = new QMenu("Macro", m_insertMenu);
      QMenu *addMacroMenu     = new QMenu("Macro", m_addMenu);
      QMenu *replaceMacroMenu = new QMenu("Macro", m_replaceMenu);

      m_insertMenu->addMenu(insertMacroMenu);
      m_addMenu->addMenu(addMacroMenu);
      m_replaceMenu->addMenu(replaceMacroMenu);

      for (TFilePathSet::iterator it = macros.begin(); it != macros.end();
           ++it) {
        TFilePath macroPath = *it;
        QString name        = QString::fromStdWString(macroPath.getWideName());

        QAction *insertAction  = new QAction(name, insertMacroMenu);
        QAction *addAction     = new QAction(name, addMacroMenu);
        QAction *replaceAction = new QAction(name, replaceMacroMenu);

        insertAction->setData(
            QVariant(QString::fromStdWString(macroPath.getWideString())));
        addAction->setData(
            QVariant(QString::fromStdWString(macroPath.getWideString())));
        replaceAction->setData(
            QVariant(QString::fromStdWString(macroPath.getWideString())));

        insertMacroMenu->addAction(insertAction);
        addMacroMenu->addAction(addAction);
        replaceMacroMenu->addAction(replaceAction);

        m_insertActionGroup->addAction(insertAction);
        m_addActionGroup->addAction(addAction);
        m_replaceActionGroup->addAction(replaceAction);
      }
    }
  } catch (...) {
  }
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:43,代码来源:addfxcontextmenu.cpp

示例10: file

MagpieInfo::MagpieInfo(TFilePath path)
	: m_fileName(QString::fromStdWString(path.getWideName()))
{
	QFile file(QString::fromStdWString(path.getWideString()));
	if (!file.open(QFile::ReadOnly))
		return;
	QTextStream textStream(&file);
	QString line;
	do {
		line = textStream.readLine();
		//E' la prima riga
		if (line == QString("Toonz"))
			continue;
		if (!line.contains(L'|')) {
			if (!line.isEmpty())
				m_actsIdentifier.append(line);
			continue;
		}
		QStringList list = line.split(QString("|"));
		assert(list.size() == 3);
		m_actorActs.append(list.at(1));
		m_comments.append(list.at(2));
	} while (!line.isNull());
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:24,代码来源:magpiefileimportpopup.cpp

示例11: addSuffix

TFilePath OverwriteDialog::addSuffix(const TFilePath &src) const {
  return src.withName(src.getWideName() + m_suffix->text().toStdWString());
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:3,代码来源:overwritepopup.cpp

示例12: loadPreset

bool AddFxContextMenu::loadPreset(const string &name,
								  QMenu *insertFxGroup, QMenu *addFxGroup, QMenu *replaceFxGroup)
{
	TFilePath presetsFilepath(m_presetPath + name);
	if (TFileStatus(presetsFilepath).isDirectory()) {
		TFilePathSet presets = TSystem::readDirectory(presetsFilepath, false);
		if (!presets.empty()) {
			QMenu *inserMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), insertFxGroup);
			insertFxGroup->addMenu(inserMenu);
			QMenu *addMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), addFxGroup);
			addFxGroup->addMenu(addMenu);
			QMenu *replaceMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), replaceFxGroup);
			replaceFxGroup->addMenu(replaceMenu);

			//This is a workaround to set the bold style to the first element of this menu
			//Setting a font directly to a QAction is not enought; style sheet definitions
			//preval over QAction font settings.
			inserMenu->setObjectName("fxMenu");
			addMenu->setObjectName("fxMenu");
			replaceMenu->setObjectName("fxMenu");

			QAction *insertAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), inserMenu);
			QAction *addAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), addMenu);
			QAction *replaceAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), replaceMenu);

			insertAction->setCheckable(true);
			addAction->setCheckable(true);
			replaceAction->setCheckable(true);

			insertAction->setData(QVariant(QString::fromStdString(name)));
			addAction->setData(QVariant(QString::fromStdString(name)));
			replaceAction->setData(QVariant(QString::fromStdString(name)));

			inserMenu->addAction(insertAction);
			addMenu->addAction(addAction);
			replaceMenu->addAction(replaceAction);

			m_insertActionGroup->addAction(insertAction);
			m_addActionGroup->addAction(addAction);
			m_replaceActionGroup->addAction(replaceAction);

			for (TFilePathSet::iterator it2 = presets.begin(); it2 != presets.end(); ++it2) {
				TFilePath presetName = *it2;
				QString qPresetName = QString::fromStdWString(presetName.getWideName());

				insertAction = new QAction(qPresetName, inserMenu);
				addAction = new QAction(qPresetName, addMenu);
				replaceAction = new QAction(qPresetName, replaceMenu);

				insertAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));
				addAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));
				replaceAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));

				inserMenu->addAction(insertAction);
				addMenu->addAction(addAction);
				replaceMenu->addAction(replaceAction);

				m_insertActionGroup->addAction(insertAction);
				m_addActionGroup->addAction(addAction);
				m_replaceActionGroup->addAction(replaceAction);
			}
			return true;
		} else
			return false;
	} else
		return false;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:67,代码来源:addfxcontextmenu.cpp

示例13: langPathFs


//.........这里部分代码省略.........
	getValue(*m_settings, "animationStep", m_animationStep);

	getValue(*m_settings, "textureSize", m_textureSize);
	QString scanLevelType;
	scanLevelType = m_settings->value("scanLevelType").toString();
	if (scanLevelType != "")
		m_scanLevelType = scanLevelType;
	setScanLevelType(m_scanLevelType.toStdString());

	getValue(*m_settings, "shmmax", m_shmmax);
	getValue(*m_settings, "shmseg", m_shmseg);
	getValue(*m_settings, "shmall", m_shmall);
	getValue(*m_settings, "shmmni", m_shmmni);

	// Load level formats
	getDefaultLevelFormats(m_levelFormats);
	getValue(*m_settings, m_levelFormats);
	std::sort(m_levelFormats.begin(), m_levelFormats.end(), // Format sorting must be
			  formatLess);									// enforced

	TFilePath lang_path = TEnv::getConfigDir() + "loc";
	TFilePathSet lang_fpset;
	m_languageMaps[0] = "english";
	//m_currentLanguage=0;
	try {
		TFileStatus langPathFs(lang_path);

		if (langPathFs.doesExist() && langPathFs.isDirectory()) {
			TSystem::readDirectory(lang_fpset, lang_path, true, false);
		} else {
		}
		TFilePathSet::iterator it = lang_fpset.begin();

		int i = 1;
		for (it; it != lang_fpset.end(); it++, i++) {
			TFilePath newPath = *it;
			if (newPath == lang_path)
				continue;
			if (TFileStatus(newPath).isDirectory()) {
				QString string = QString::fromStdWString(newPath.getWideName());
				m_languageMaps[i] = string;
			}
		}
	} catch (...) {
	}

	TFilePath path(TEnv::getConfigDir() + "qss");
	TFilePathSet fpset;
	try {
		TSystem::readDirectory(fpset, path, true, false);
		TFilePathSet::iterator it = fpset.begin();
		int i = 0;
		for (it; it != fpset.end(); it++, i++) {
			TFilePath newPath = *it;
			if (newPath == path)
				continue;
			QString fpName = QString::fromStdWString(newPath.getWideName());
#ifdef MACOSX
			QString string = fpName + QString("/") + fpName + QString("_mac.qss");
#else
			QString string = fpName + QString("/") + fpName + QString(".qss");
#endif
			if (fpName == QString("standard"))
				m_currentStyleSheet = i;
			m_styleSheetMaps[i] = "file:///" + path.getQString() + "/" + string;
		}
	} catch (...) {
	}

	getValue(*m_settings, "CurrentLanguage", m_currentLanguage);
	getValue(*m_settings, "CurrentStyleSheet", m_currentStyleSheet);
	getValue(*m_settings, "DragCellsBehaviour", m_dragCellsBehaviour);

	getValue(*m_settings, "LineTestFpsCapture", m_lineTestFpsCapture);
	getValue(*m_settings, "FillOnlysavebox", m_fillOnlySavebox);
	getValue(*m_settings, "AutocreationType", m_autocreationType);
	getValue(*m_settings, "DefLevelType", m_defLevelType);
	getValue(*m_settings, "DefLevelWidth", m_defLevelWidth);
	getValue(*m_settings, "DefLevelHeight", m_defLevelHeight);
	getValue(*m_settings, "DefLevelDpi", m_defLevelDpi);

	getValue(*m_settings, "viewerBGColor", m_viewerBGColor);
	getValue(*m_settings, "previewBGColor", m_previewBGColor);
	getValue(*m_settings, "chessboardColor1", m_chessboardColor1);
	getValue(*m_settings, "chessboardColor2", m_chessboardColor2);
	getValue(*m_settings, "showRasterImagesDarkenBlendedInViewer", m_showRasterImagesDarkenBlendedInViewer);
	getValue(*m_settings, "actualPixelViewOnSceneEditingMode", m_actualPixelViewOnSceneEditingMode);
	getValue(*m_settings, "viewerZoomCenter", m_viewerZoomCenter);
	getValue(*m_settings, "initialLoadTlvCachingBehavior", m_initialLoadTlvCachingBehavior);
	getValue(*m_settings, "removeSceneNumberFromLoadedLevelName", m_removeSceneNumberFromLoadedLevelName);
	getValue(*m_settings, "replaceAfterSaveLevelAs", m_replaceAfterSaveLevelAs);
	getValue(*m_settings, "showFrameNumberWithLetters", m_showFrameNumberWithLetters);
	getValue(*m_settings, "levelNameOnEachMarkerEnabled", m_levelNameOnEachMarker);
	getValue(*m_settings, "columnIconLoadingPolicy", m_columnIconLoadingPolicy);
	getValue(*m_settings, "moveCurrentFrameByClickCellArea", m_moveCurrentFrameByClickCellArea);
	getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled);
	getValue(*m_settings, "multiLayerStylePickerEnabled", m_multiLayerStylePickerEnabled);
	getValue(*m_settings, "paletteTypeOnLoadRasterImageAsColorModel", m_paletteTypeOnLoadRasterImageAsColorModel);
	getValue(*m_settings, "showKeyframesOnXsheetCellArea", m_showKeyframesOnXsheetCellArea);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:101,代码来源:preferences.cpp

示例14: 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;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:93,代码来源:rendercommand.cpp


注:本文中的TFilePath::getWideName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。