コード例 #1
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath TFilePath::withType(const string &type) const {
  const string dotDot = "..";
  assert(type.length() < 2 || type.substr(0, 2) != dotDot);
  int i = getLastSlash(m_path);       // cerco l'ultimo slash
  string str = m_path.substr(i + 1);  // str e' il path senza parentdir
  int j      = str.rfind('.');
  if (j == string::npos || str == dotDot)
  // il path originale non ha tipo
  {
    if (type == "")
      return *this;
    else if (type[0] == '.')
      return TFilePath(m_path + type);
    else
      return TFilePath(m_path + "." + type);
  } else
  // il path originale ha gia' il tipo
  {
    if (type == "")
      return TFilePath(m_path.substr(0, i + j + 1));
    else if (type[0] == '.')
      return TFilePath(m_path.substr(0, i + j + 1) + type);
    else
      return TFilePath(m_path.substr(0, i + j + 2) + type);
  }
}
コード例 #2
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath TFilePath::withFrame(const TFrameId &frame,
                               TFrameId::FrameFormat format) const {
  const string dot = ".", dotDot = "..";
  int i = getLastSlash(m_path);       // cerco l'ultimo slash
  string str = m_path.substr(i + 1);  // str e' il path senza parentdir
  assert(str != dot && str != dotDot);
  int j = str.rfind('.');
  if (j == string::npos) {
    if (frame.isEmptyFrame() || frame.isNoFrame())
      return *this;
    else
      return TFilePath(m_path + "." + frame.expand(format));
  }

  string frameString;
  if (frame.isNoFrame())
    frameString = "";
  else
    frameString = "." + frame.expand(format);

  int k = str.substr(0, j).rfind('.');
  if (k == string::npos)
    return TFilePath(m_path.substr(0, j + i + 1) + frameString + str.substr(j));
  else
    return TFilePath(m_path.substr(0, k + i + 1) + frameString + str.substr(j));
}
コード例 #3
0
void Ffmpeg::cleanUpFiles() {
  for (QString path : m_cleanUpList) {
    if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
      TSystem::deleteFile(TFilePath(path));
    }
  }
}
コード例 #4
0
void ResourceImporter::process(TXshSimpleLevel *sl)
{
	if (sl->getPath().isAbsolute())
		return;
	TFilePath newPath;

	TFilePath slPath = sl->getPath();
	string suffix = extractPsdSuffix(slPath);

	TFilePath imgRefPath;
	if (sl->getPalette())
		imgRefPath = sl->getPalette()->getRefImgPath();
	newPath = m_importStrategy.process(m_dstScene, m_scene, slPath);
	if (imgRefPath != TFilePath() && !m_dstScene->isExternPath(m_dstScene->decodeFilePath(imgRefPath)))
		m_importStrategy.process(m_dstScene, m_scene, imgRefPath);

	if (suffix != "")
		newPath = buildPsd(newPath, suffix);

	sl->setPath(newPath);
	if (sl->getScannedPath() != TFilePath()) {
		newPath = m_importStrategy.process(m_dstScene, m_scene, sl->getScannedPath());
		sl->setScannedPath(newPath);
	}
	sl->setDirtyFlag(false);
}
コード例 #5
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath TFilePath::withName(const string &name) const {
  int i = getLastSlash(m_path);       // cerco l'ultimo slash
  string str = m_path.substr(i + 1);  // str e' il path senza parentdir
  int j      = str.rfind('.');
  if (j == string::npos) return TFilePath(m_path.substr(0, i + 1) + name);
  int k                    = str.substr(0, j).rfind(".");
  if (k == string::npos) k = j;
  return TFilePath(m_path.substr(0, i + 1) + name + str.substr(k));
}
コード例 #6
0
TFilePath Ffmpeg::getFfmpegCache() {
  QString cacheRoot = ToonzFolder::getCacheRootFolder().getQString();
  if (!TSystem::doesExistFileOrLevel(TFilePath(cacheRoot + "/ffmpeg"))) {
    TSystem::mkDir(TFilePath(cacheRoot + "/ffmpeg"));
  }
  std::string ffmpegPath =
      TFilePath(cacheRoot + "/ffmpeg").getQString().toStdString();
  return TFilePath(cacheRoot + "/ffmpeg");
}
コード例 #7
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath TFilePath::operator-(const TFilePath &fp) const {
#ifdef WIN32
  if (toLower(m_path) == toLower(fp.m_path)) return TFilePath("");
#else
  if (m_path == fp.m_path) return TFilePath("");
#endif
  if (!fp.isAncestorOf(*this)) return *this;
  int len = fp.m_path.length();
  if (len == 0 || fp.m_path[len - 1] != slash) len++;

  return TFilePath(m_path.substr(len));
}
コード例 #8
0
TFilePath TFilePath::getParentDir() const // noSlash!
{
	int i = getLastSlash(m_path); //cerco l'ultimo slash
	if (i < 0) {
		if (m_path.length() >= 2 && ('a' <= m_path[0] && m_path[0] <= 'z' || 'A' <= m_path[0] && m_path[0] <= 'Z') && m_path[1] == ':')
			return TFilePath(m_path.substr(0, 2));
		else
			return TFilePath("");
	} else if (i == 0)
		return TFilePath("/");
	else
		return TFilePath(m_path.substr(0, i));
}
コード例 #9
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath &TFilePath::operator+=(const TFilePath &fp) {
  assert(!fp.isAbsolute());
  if (fp.isEmpty())
    return *this;
  else if (isEmpty()) {
    *this = fp;
    return *this;
  } else if (m_path.length() != 1 || m_path[0] != slash) {
    *this = TFilePath(m_path + slash + fp.m_path);
    return *this;
  } else {
    *this = TFilePath(m_path + fp.m_path);
    return *this;
  }
}
コード例 #10
0
ファイル: tasks.cpp プロジェクト: ArseniyShestakov/opentoonz
void CasmTask2::setFileArg(const string &fp)
{
	TFilePath filePath = TFilePath(fp);
	CasmFileInfo casmFileInfo(filePath);
	int start, end;
	bool interlaced;
	casmFileInfo.getFrameRange(start, end, interlaced);

	m_filePath = fp;
	m_start = start;
	m_end = end;
	m_step = 1;

	setName(TFilePath(fp).getName());
}
コード例 #11
0
ファイル: pane.cpp プロジェクト: Makoto-Sasahara/opentoonz
void TPanelTitleBarButtonForSafeArea::getSafeAreaNameList(
    QList<QString> &nameList) {
  TFilePath fp                = TEnv::getConfigDir();
  QString currentSafeAreaName = QString::fromStdString(EnvSafeAreaName);

  std::string safeAreaFileName = "safearea.ini";

  while (!TFileStatus(fp + safeAreaFileName).doesExist() && !fp.isRoot() &&
         fp.getParentDir() != TFilePath())
    fp = fp.getParentDir();

  fp = fp + safeAreaFileName;

  if (TFileStatus(fp).doesExist()) {
    QSettings settings(toQString(fp), QSettings::IniFormat);

    // find the current safearea name from the list
    QStringList groups = settings.childGroups();
    for (int g = 0; g < groups.size(); g++) {
      settings.beginGroup(groups.at(g));
      nameList.push_back(settings.value("name", "").toString());
      settings.endGroup();
    }
  }
}
コード例 #12
0
TRasterImageP Ffmpeg::getImage(int frameIndex) {
  QString ffmpegCachePath = getFfmpegCache().getQString();
  QString tempPath        = ffmpegCachePath + "//" + cleanPathSymbols();
  std::string tmpPath     = tempPath.toStdString();
  // QString tempPath= m_path.getQString();
  QString number   = QString("%1").arg(frameIndex, 4, 10, QChar('0'));
  QString tempName = "In" + number + ".png";
  tempName         = tempPath + tempName;

  // for debugging
  std::string strPath = tempName.toStdString();
  if (TSystem::doesExistFileOrLevel(TFilePath(tempName))) {
    QImage *temp = new QImage(tempName, "PNG");
    if (temp) {
      QImage tempToo = temp->convertToFormat(QImage::Format_ARGB32);
      delete temp;
      const UCHAR *bits = tempToo.bits();

      TRasterPT<TPixelRGBM32> ret;
      ret.create(m_lx, m_ly);
      ret->lock();
      memcpy(ret->getRawData(), bits, m_lx * m_ly * 4);
      ret->unlock();
      ret->yMirror();
      return TRasterImageP(ret);
    }
  } else
    return TRasterImageP();
}
コード例 #13
0
void CasmSubmitPage::Data::browseCasmFiles()
{
	static FileBrowserPopup *popup = 0;

	if (!popup) {
		vector<string> fileTypes;
		fileTypes.push_back("casm");
		popup = new FileBrowserPopup(m_cspage, fileTypes);

		popup->setOkAction(
			new TFileBrowserPopupAction<CasmSubmitPage::Data>(this, &CasmSubmitPage::Data::loadCasm));
	}

	if (!popup)
		return;

	TFilePath fp = Application::instance()->getCurrentFolder();
	if (fp != TFilePath())
		popup->setCurrentDir(fp);

	TDimension d = TMainshell::getMainshell()->getSize();
#ifdef WIN32
	HDC hdc = GetDC(0);
	d.lx = GetDeviceCaps(hdc, HORZRES);
	d.ly = GetDeviceCaps(hdc, VERTRES);
	ReleaseDC(0, hdc);
#endif

	d -= popup->getSize();
	//TDimension d = TMainshell::getMainshell()->getSize() - popup->getSize();
	popup->popup(TPoint(d.lx / 2, d.ly / 2));
	popup->setCaption("Load Casm");
}
コード例 #14
0
void TVectorBrushStyle::loadBrush(const std::string &brushName)
{
	m_brushName = brushName;
	m_colorCount = 0;

	if (brushName.empty())
		return;

	if (!m_brush) {
		//Load the image associated with fp
		TFilePath fp(m_rootDir + TFilePath(brushName + ".pli"));

		TLevelReaderP lr(fp);
		TLevelP level = lr->loadInfo();

		m_brush = lr->getFrameReader(level->begin()->first)->load();
		assert(m_brush);

		TPalette *palette = level->getPalette();
		m_brush->setPalette(palette);
	}

	assert(m_brush);
	m_colorCount = m_brush->getPalette()->getStyleInPagesCount() - 1; //No transparent
}
コード例 #15
0
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."));
	}
}
コード例 #16
0
ファイル: shaderinterface.cpp プロジェクト: SaierMe/opentoonz
 inline static TFilePath getAbsolutePath(const TFilePath &file,
                                         const TFilePath &relTo) {
   QDir relToDir(
       QString::fromStdWString(relTo.getParentDir().getWideString()));
   QString absFileStr(relToDir.absoluteFilePath(
       QString::fromStdWString(file.getWideString())));
   return TFilePath(absFileStr.toStdWString());
 }
コード例 #17
0
TFilePathSet TMyPaintBrushStyle::getBrushesDirs() {
  TFilePathSet paths;
  paths.push_back(m_libraryDir + "mypaint brushes");
  QStringList genericLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
  for(QStringList::iterator i = genericLocations.begin(); i != genericLocations.end(); ++i)
    paths.push_back(TFilePath(*i) + "mypaint" + "brushes");
  return paths;
}
コード例 #18
0
ファイル: shaderinterface.cpp プロジェクト: SaierMe/opentoonz
 inline static TFilePath getRelativePath(const TFilePath &file,
                                         const TFilePath &relTo) {
   QDir relToDir(
       QString::fromStdWString(relTo.getParentDir().getWideString()));
   QString relFileStr(relToDir.relativeFilePath(
       QString::fromStdWString(file.getWideString())));
   return TFilePath(relFileStr.toStdWString());
 }
コード例 #19
0
FormatSettingsPopup::FormatSettingsPopup(QWidget *parent,
                                         const std::string &format,
                                         TPropertyGroup *props)
    : Dialog(parent)
    , m_format(format)
    , m_props(props)
    , m_levelPath(TFilePath())
#ifdef _WIN32
    , m_codecRestriction(0)
    , m_codecComboBox(0)
    , m_configureCodec(0)
#endif
{
  setWindowTitle(tr("File Settings"));

  setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint);

  m_mainLayout = new QGridLayout();
  m_mainLayout->setMargin(0);
  m_mainLayout->setVerticalSpacing(5);
  m_mainLayout->setHorizontalSpacing(5);
  m_mainLayout->setColumnStretch(0, 0);
  m_mainLayout->setColumnStretch(1, 1);

  int i = 0;
  for (i = 0; i < m_props->getPropertyCount(); i++) {
    if (dynamic_cast<TEnumProperty *>(m_props->getProperty(i)))
      buildPropertyComboBox(i, m_props);
    else if (dynamic_cast<TIntProperty *>(m_props->getProperty(i)))
      buildValueField(i, m_props);
    else if (dynamic_cast<TBoolProperty *>(m_props->getProperty(i)))
      buildPropertyCheckBox(i, m_props);
    else if (dynamic_cast<TStringProperty *>(m_props->getProperty(i)))
      buildPropertyLineEdit(i, m_props);
    else
      assert(false);
  }

#ifdef _WIN32
  if (format == "avi") {
    m_codecRestriction = new QLabel(this);
    m_codecRestriction->setMinimumHeight(70);
    m_codecRestriction->setStyleSheet("border: 1px solid rgb(200,200,200);");
    m_mainLayout->addWidget(m_codecRestriction, m_mainLayout->rowCount(), 0, 1,
                            2);
    m_configureCodec = new QPushButton(tr("Configure Codec"), this);
    m_configureCodec->setObjectName("PushButton_NoPadding");
    m_configureCodec->setFixedSize(100, DVGui::WidgetHeight);
    m_mainLayout->addWidget(m_configureCodec, m_mainLayout->rowCount(), 0, 1,
                            2);
    connect(m_configureCodec, SIGNAL(released()), this,
            SLOT(onAviCodecConfigure()));
  }
#endif

  m_topLayout->addLayout(m_mainLayout, 1);
}
コード例 #20
0
void CleanupTab::onPathChange()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	m_path = params->m_path = TFilePath(m_pathField->getPath().toStdWString());

	model->commitChanges();
}
コード例 #21
0
bool Ffmpeg::checkFilesExist() {
  QString ffmpegCachePath = getFfmpegCache().getQString();
  QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols() + "In0001." +
                     m_intermediateFormat;
  if (TSystem::doesExistFileOrLevel(TFilePath(tempPath))) {
    return true;
  } else
    return false;
}
コード例 #22
0
void TExternalProgramFx::initialize(std::string name) {
  TFilePath fp = getExternFxPath() + (name + ".xml");
  TIStream is(fp);
  if (!is) return;

  std::string tagName;
  if (!is.matchTag(tagName) || tagName != "externFx") return;

  try {
    while (is.matchTag(tagName)) {
      if (tagName == "executable") {
        TFilePath executable = TFilePath(is.getTagAttribute("path"));
        std::string args     = is.getTagAttribute("args");
        if (executable == TFilePath())
          throw TException("missing executable path");
        if (args == "") throw TException("missing args string");
        setExecutable(executable, args);
      } else if (tagName == "inport" || tagName == "outport") {
        std::string portName = is.getTagAttribute("name");
        std::string ext      = is.getTagAttribute("ext");
        if (portName == "") throw TException("missing port name");
        if (ext == "") throw TException("missing port ext");
        addPort(portName, ext, tagName == "inport");
      } else if (tagName == "param") {
        std::string paramName = is.getTagAttribute("name");
        if (paramName == "") throw TException("missing param name");
        std::string type = is.getTagAttribute("type");
        if (type == "") throw TException("missing param type");
        if (type != "double")
          throw TException("param type not yet implemented");
        TDoubleParamP param = new TDoubleParam();
        param->setName(paramName);
        m_params.push_back(param);
      } else
        throw TException("unexpected tag " + tagName);
    }
    is.closeChild();

    for (int i = 0; i < (int)m_params.size(); i++)
      bindParam(this, m_params[i]->getName(), m_params[i]);

  } catch (...) {
  }
}
コード例 #23
0
ファイル: convert2tlv.cpp プロジェクト: CroW-CZ/opentoonz
Convert2Tlv::Convert2Tlv(const TFilePath &filepath1, const TFilePath &filepath2, const TFilePath &outFolder, const QString &outName,
						 int from, int to, bool doAutoclose, const TFilePath &palettePath, int colorTolerance,
						 int antialiasType, int antialiasValue, bool isUnpaintedFromNAA)
	: m_size(0, 0), m_level1(), m_levelIn1(), m_levelIn2(), m_levelOut(), m_autoclose(doAutoclose), m_premultiply(false), m_count(0), m_from(from), m_to(to), m_palettePath(palettePath), m_colorTolerance(colorTolerance), m_palette(0), m_antialiasType(antialiasType), m_antialiasValue(antialiasValue), m_isUnpaintedFromNAA(isUnpaintedFromNAA)
{
	if (filepath1 != TFilePath()) {
		m_levelIn1 = filepath1.getParentDir() + filepath1.getLevelName();
		if (outFolder != TFilePath())
			m_levelOut = m_levelIn1.withParentDir(outFolder).withNoFrame().withType("tlv");
		else
			m_levelOut = m_levelIn1.withNoFrame().withType("tlv"); //filePaths[0].getParentDir() + TFilePath(filePaths[0].getWideName() + L".tlv");

		if (outName != "")
			m_levelOut = m_levelOut.withName(outName.toStdString());
	}

	if (filepath2 != TFilePath())
		m_levelIn2 = filepath2.getParentDir() + filepath2.getLevelName();
}
コード例 #24
0
void CasmSubmitPage::Data::loadCasm(const TFilePath &fp)
{
	if (!TFileStatus(fp).doesExist()) {
		string msg = toString(fp.getWideString()) + "\n";
		msg += "File not found\n";
		msg += "Please verify that the path and file name are correct";
		m_filepathTextField->setText("");
		TMessage::error(msg);
		return;
	}

	Application::instance()->setCurrentFolder(fp.getParentDir());

	string uncString = convertToUncString(fp);

	m_filepathTextField->setText(uncString);
	m_taskNameTextField->setText(TFilePath(uncString).getName());

#ifdef WIN32
	int x = uncString.find("\\", 2);
	while (x != string::npos) {
		uncString.replace(x, 1, "/", 0, 1);
		x = uncString.find("\\", x + 1);
	}
#endif

	TFilePath uncFilePath = TFilePath(uncString);
	CasmFileInfo casmFileInfo(uncFilePath);
	int start, end;
	bool interlaced;
	casmFileInfo.getFrameRange(start, end, interlaced);

	if (m_casmTask)
		delete m_casmTask;
	m_casmTask = new CasmTask;

	m_casmTask->m_casmFile = uncString;
	m_casmTask->m_start = start;
	m_casmTask->m_end = end;
	m_casmTask->m_step = 1;

	m_configPanel->setTask(m_casmTask);
}
コード例 #25
0
AddFxContextMenu::AddFxContextMenu()
	: QObject(), m_app(0), m_currentCursorScenePos(0, 0), m_againCommand(0)
{
	m_fxListPath = TFilePath(ToonzFolder::getProfileFolder() + "layouts" + "fxs" + "fxs.lst");
	m_presetPath = TFilePath(ToonzFolder::getFxPresetFolder() + "presets");

	m_insertMenu = new QMenu(tr("Insert FX"), 0);
	m_insertActionGroup = new QActionGroup(m_insertMenu);
	m_addMenu = new QMenu(tr("Add FX"), 0);
	m_addActionGroup = new QActionGroup(m_addMenu);
	m_replaceMenu = new QMenu(tr("Replace FX"), 0);
	m_replaceActionGroup = new QActionGroup(m_replaceMenu);

	connect(m_insertActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(onInsertFx(QAction *)));
	connect(m_addActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(onAddFx(QAction *)));
	connect(m_replaceActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(onReplaceFx(QAction *)));

	fillMenus();
}
コード例 #26
0
SceneLevel::SceneLevel(ToonzScene *scene, TXshSimpleLevel *sl)
	: SceneResource(scene), m_sl(sl), m_oldPath(sl->getPath()), m_oldActualPath(scene->decodeFilePath(sl->getPath())), m_oldScannedPath(sl->getScannedPath()), m_oldRefImgPath(), m_oldActualRefImgPath()
{
	if (m_oldScannedPath != TFilePath())
		m_oldActualScannedPath = m_scene->decodeFilePath(m_oldScannedPath);
	if ((sl->getPath().getType() == "tlv" || sl->getPath().getType() == "pli") && sl->getPalette()) {
		m_oldRefImgPath = sl->getPalette()->getRefImgPath();
		m_oldActualRefImgPath = m_scene->decodeFilePath(m_oldRefImgPath);
	}
}
コード例 #27
0
ファイル: tfilepath.cpp プロジェクト: walkerka/opentoonz
TFilePath TFilePath::decode(const std::map<string, string> &dictionary) const {
  TFilePath parent   = getParentDir();
  TFilePath filename = withParentDir("");
  std::map<string, string>::const_iterator it =
      dictionary.find(filename.getFullPath());
  if (it != dictionary.end()) filename = TFilePath(it->second);
  if (parent.isEmpty())
    return filename;
  else
    return parent.decode(dictionary) + filename;
}
コード例 #28
0
bool Ffmpeg::checkFfprobe() {
  // check the user defined path in preferences first
  QString path = Preferences::instance()->getFfmpegPath() + "/ffprobe";
#if defined(_WIN32)
  path = path + ".exe";
#endif
  if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true;

  // check the OpenToonz root directory next
  path = QDir::currentPath() + "/ffprobe";
#if defined(_WIN32)
  path = path + ".exe";
#endif
  if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
    Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString());
    return true;
  }

  // give up
  return false;
}
コード例 #29
0
void ResourceCollector::process(TXshSimpleLevel *sl)
{
	TFilePath path = sl->getPath();
	std::string suffix = ResourceImporter::extractPsdSuffix(path);
	std::map<TFilePath, TFilePath>::iterator it = m_collectedFiles.find(path);
	if (it != m_collectedFiles.end()) {
		TFilePath destPath = it->second;
		if (suffix != "")
			destPath = ResourceImporter::buildPsd(destPath, suffix);
		sl->setPath(destPath);
	} else {
		TFilePath collectedPath = path;
		if (getCollectedPath(m_scene, collectedPath)) {
			TFilePath actualCollectedPath = m_scene->decodeFilePath(collectedPath);
			if (actualCollectedPath != path && TSystem::doesExistFileOrLevel(path) &&
				!TSystem::doesExistFileOrLevel(actualCollectedPath)) {
				try {
					TSystem::touchParentDir(actualCollectedPath);
					TXshSimpleLevel::copyFiles(actualCollectedPath, path);
				} catch (...) {
				}
			}
			++m_count;
			TFilePath destPath = collectedPath;
			if (suffix != "")
				destPath = ResourceImporter::buildPsd(destPath, suffix);
			sl->setPath(destPath);
			m_collectedFiles[path] = collectedPath;
		}
	}

	if (sl->getScannedPath() != TFilePath()) {
		path = sl->getScannedPath();
		TFilePath collectedPath = path;
		if (getCollectedPath(m_scene, collectedPath)) {
			TFilePath actualCollectedPath = m_scene->decodeFilePath(collectedPath);
			if (actualCollectedPath != path && TSystem::doesExistFileOrLevel(path)) {
				try {
					TSystem::touchParentDir(actualCollectedPath);
					TXshSimpleLevel::copyFiles(actualCollectedPath, path);
				} catch (...) {
				}
			}
			sl->setScannedPath(collectedPath);
			m_count++;
		}
	}
	sl->setDirtyFlag(false);
}
コード例 #30
0
TRasterP TCacheResource::load(const PointLess &cellPos)
{
	if (m_path.isEmpty())
		return 0;

	TFilePath cellPath(TCacheResourcePool::instance()->getPath() + m_path + TFilePath(getCellName(cellPos.x, cellPos.y)));
	TRasterP ras;
	if (m_tileType == CM32) {
		::loadCompressed(cellPath, ras, CM32);
	} else {
		TImageReader::load(cellPath.withType(".tif"), ras);
	}

	return ras;
}