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


C++ ToonzScene::decodeFilePath方法代码示例

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


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

示例1: onLevelPathChanged

void MagpieFileImportPopup::onLevelPathChanged()
{
	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TFilePath levelPath(m_levelField->getPath().toStdWString());
	levelPath = scene->decodeFilePath(levelPath);
	if (levelPath.isEmpty() || levelPath.getUndottedType().empty() || !TSystem::doesExistFileOrLevel(levelPath)) {
		DVGui::error(tr("The file path is missing."));
		return;
	}
	m_levelPath = levelPath;

	string format = m_levelPath.getType();
	if (format == "tzp" || format == "tzu") {

		wstring name = m_levelPath.getWideName();
		IoCmd::ConvertingPopup *convertingPopup = new IoCmd::ConvertingPopup(
			TApp::instance()->getMainWindow(),
			QString::fromStdWString(name) + QString::fromStdString(m_levelPath.getDottedType()));
		convertingPopup->show();

		bool ok = scene->convertLevelIfNeeded(m_levelPath);
		convertingPopup->hide();
		if (!ok)
			return;
	}
	m_flipbook->setLevel(m_levelPath);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:27,代码来源:magpiefileimportpopup.cpp

示例2: 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

示例3: updateImageInfo

void CameraTab::updateImageInfo()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	TDimension outRes(0, 0);
	TPointD outDpi;

	params->getOutputImageInfo(outRes, outDpi.x, outDpi.y);
	setImageInfo(outRes.lx, outRes.ly, outDpi.x, outDpi.y);

	TXshSimpleLevel *sl;
	TFrameId fid;
	model->getCleanupFrame(sl, fid);

	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TFilePath outputPath(sl ? scene->decodeFilePath(model->getOutputPath(sl, params)) : TFilePath());

	setImageInfo(outputPath);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:20,代码来源:cleanupsettingspopup.cpp

示例4: 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);
//.........这里部分代码省略.........
开发者ID:janisozaur,项目名称:opentoonz,代码行数:101,代码来源:levelcreatepopup.cpp

示例5: 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

示例6: setLevel

void Vectorizer::setLevel(const TXshSimpleLevelP &level)
{
	m_level = level;

	//Creo il livello pli
	TXshSimpleLevel *sl = m_level.getPointer();
	if (!sl)
		return;

	int rowCount = sl->getFrameCount();
	if (rowCount <= 0 || sl->isEmpty())
		return;

	TXshLevel *xl;
	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();

	// Build the new level name
	wstring levelName = sl->getName() + L"v";
	{
		std::auto_ptr<NameBuilder> nameBuilder(NameBuilder::getBuilder(levelName));

		for (;;) {
			levelName = nameBuilder->getNext();
			if (scene->getLevelSet()->getLevel(levelName) == 0)
				break;
		}
	}

	TFilePath dstPath = sl->getPath().withName(levelName).withType("pli");
	dstPath = scene->decodeFilePath(dstPath);

	bool overWrite = false;
	if (TSystem::doesExistFileOrLevel(dstPath)) {
		m_dialogShown = true;

		std::wstring name = m_dialog->execute(scene, dstPath, true);
		if (m_dialog->cancelPressed())
			return;

		switch (m_dialog->getChoice()) {
		case OverwriteDialog::KEEP_OLD: {
			xl = scene->getLevelSet()->getLevel(levelName);
			if (!xl)
				xl = scene->loadLevel(dstPath);

			m_vLevel = xl->getSimpleLevel();
			return;
		}

			CASE OverwriteDialog::OVERWRITE : overWrite = true;

		DEFAULT:
			levelName = name;
		}
	}

	xl = scene->createNewLevel(PLI_XSHLEVEL, levelName);

	TXshSimpleLevel *vl = xl->getSimpleLevel();
	assert(vl);

	if (overWrite) {
		vl->setPath(scene->codeFilePath(dstPath));
		vl->setName(levelName);
	}

	TPalette *palette = 0;
	if (sl->getType() == TZP_XSHLEVEL)
		palette = sl->getPalette();

	palette = palette ? palette->clone() : new TPalette;

	palette->setPaletteName(vl->getName());
	vl->setPalette(palette);

	m_vLevel = vl;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:77,代码来源:vectorizerpopup.cpp


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