コード例 #1
0
ファイル: functionviewer.cpp プロジェクト: SaierMe/opentoonz
void FunctionViewer::refreshModel() {
  TXsheet *xsh = m_xshHandle ? m_xshHandle->getXsheet() : 0;

  m_functionGraph->getModel()->refreshData(xsh);

  if (xsh) {
    int rowCount = xsh->getFrameCount();
    m_numericalColumns->setRowCount(rowCount);
    m_numericalColumns->updateAll();

    ToonzScene *scene = xsh->getScene();
    if (!scene)  // This seems wrong. It should rather be
      return;    // asserted - though I'm not touching it now...

    TFilePath scenePath = scene->getScenePath().getParentDir();
    if (scene->isUntitled())
      scenePath =
          TProjectManager::instance()->getCurrentProject()->getScenesPath();

    m_treeView->setCurrentScenePath(scenePath);

    int distance, offset;
    scene->getProperties()->getMarkers(distance, offset);
    m_numericalColumns->setMarkRow(distance, offset);
  }

  m_treeView->updateAll();
  m_toolbar->setCurve(0);
}
コード例 #2
0
ファイル: tapp.cpp プロジェクト: SaierMe/opentoonz
void TApp::autosave() {
  ToonzScene *scene = getCurrentScene()->getScene();

  if (!getCurrentScene()->getDirtyFlag()) return;

  if (getCurrentTool()->isToolBusy()) {
    m_autosaveSuspended = true;
    return;
  } else
    m_autosaveSuspended = false;

  if (scene->isUntitled()) {
    DVGui::warning(
        tr("It is not possible to save automatically an untitled scene."));
    return;
  }

  DVGui::ProgressDialog pb(
      "Autosaving scene..." + toQString(scene->getScenePath()), 0, 0, 1);
  pb.show();
  IoCmd::saveScene();
  pb.setValue(1);
}
コード例 #3
0
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;
}