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


C++ ToonzScene类代码示例

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


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

示例1: TFilePath

void CastTreeViewer::dragMoveEvent(QDragMoveEvent *event) {
  if (!event->mimeData()->hasFormat("application/vnd.toonz.levels") ||
      m_dropFilePath != TFilePath())
    return;

  m_dropTargetItem  = itemAt(event->pos());
  ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
  QString rootName  = QString("Root");
  if (scene) {
    std::wstring name =
        (scene->isUntitled()) ? L"Untitled" : scene->getSceneName();
    rootName = rootName.fromStdWString(name);
  }
  if (m_dropTargetItem &&
          m_dropTargetItem->data(0, Qt::DisplayRole).toString() ==
              AudioFolderName ||
      m_dropFilePath != TFilePath() &&
          m_dropTargetItem->data(0, Qt::DisplayRole).toString() == rootName)
    m_dropTargetItem = 0;

  if (!m_dropTargetItem)
    event->ignore();
  else
    event->acceptProposedAction();
  viewport()->update();
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:26,代码来源:castviewer.cpp

示例2: refreshModel

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);
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:29,代码来源:functionviewer.cpp

示例3: updateAllLinkedStyles

void StudioPaletteCmd::updateAllLinkedStyles(TPaletteHandle *paletteHandle,
                                             TXsheetHandle *xsheetHandle) {
  if (!xsheetHandle) return;
  TXsheet *xsheet = xsheetHandle->getXsheet();
  if (!xsheet) return;
  ToonzScene *scene = xsheet->getScene();
  if (!scene) return;

  // emit signal only if something changed
  bool somethingChanged = false;

  StudioPalette *sp   = StudioPalette::instance();
  TLevelSet *levelSet = scene->getLevelSet();
  for (int i = 0; i < levelSet->getLevelCount(); i++) {
    TXshLevel *xl       = levelSet->getLevel(i);
    TXshSimpleLevel *sl = xl ? xl->getSimpleLevel() : 0;
    if (!sl) continue;
    TPalette *palette = sl->getPalette();
    if (palette) {
      somethingChanged = somethingChanged | sp->updateLinkedColors(palette);
      if (sl->getType() == TZP_XSHLEVEL) {
        std::vector<TFrameId> fids;
        sl->getFids(fids);
        std::vector<TFrameId>::iterator it;
        for (it = fids.begin(); it != fids.end(); ++it) {
          TFrameId fid   = *it;
          std::string id = sl->getImageId(fid);
        }
      }
    }
  }
  if (!paletteHandle || !paletteHandle->getPalette()) return;
  if (somethingChanged) paletteHandle->notifyColorStyleChanged();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:34,代码来源:studiopalettecmd.cpp

示例4: execute

	void execute()
	{
		TApp *app = TApp::instance();
		ToonzScene *scene = app->getCurrentScene()->getScene();

		TLevelSet *levelSet = scene->getLevelSet();

		std::set<TXshLevel *> usedLevels;
		scene->getTopXsheet()->getUsedLevels(usedLevels);

		std::vector<TXshLevel *> unused;

		for (int i = 0; i < levelSet->getLevelCount(); i++) {
			TXshLevel *xl = levelSet->getLevel(i);
			if (usedLevels.count(xl) == 0)
				unused.push_back(xl);
		}
		if (unused.empty()) {
			DVGui::error(QObject::tr("No unused levels"));
			return;
		} else {
			TUndoManager *um = TUndoManager::manager();
			um->beginBlock();
			for (int i = 0; i < (int)unused.size(); i++) {
				TXshLevel *xl = unused[i];
				um->add(new DeleteLevelUndo(xl));
				scene->getLevelSet()->removeLevel(xl);
			}
			TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
			TApp::instance()->getCurrentScene()->notifyCastChange();

			um->endBlock();
		}
	}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:34,代码来源:levelcommand.cpp

示例5:

TXshSimpleLevel *Level::getLevel() const
{
	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TXshLevel *level = scene->getLevelSet()->getLevel(m_name.toStdWString());
	TXshSimpleLevel *sl = dynamic_cast<TXshSimpleLevel *>(level);
	return sl;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:7,代码来源:scriptengine.cpp

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

示例7: TFilePath

TFx *InsertFxPopup::createFx()
{
	TApp *app = TApp::instance();
	ToonzScene *scene = app->getCurrentScene()->getScene();
	TXsheet *xsh = scene->getXsheet();

	QTreeWidgetItem *item = m_fxTree->currentItem();
	QString text = item->data(0, Qt::UserRole).toString();

	if (text.isEmpty())
		return 0;

	TFx *fx;

	TFilePath path = TFilePath(text.toStdWString());

	if (TFileStatus(path).doesExist() && TFileStatus(path.getParentDir()).isDirectory()) {
		std::string folder = path.getParentDir().getName();
		if (folder == "macroFx") //Devo caricare una macro
			fx = createMacroFxByPath(path);
		else //Verifico se devo caricare un preset
		{
			folder = path.getParentDir().getParentDir().getName();
			if (folder == "presets") //Devo caricare un preset
				fx = createPresetFxByName(path);
		}
	} else
		fx = createFxByName(text.toStdString());

	if (fx)
		return fx;
	else
		return 0;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:34,代码来源:insertfxpopup.cpp

示例8: updateChooseLevelComboItems

/*! update combo items when the contents of scene cast are changed
*/
void Filmstrip::updateChooseLevelComboItems() {
  // clear items
  m_chooseLevelCombo->clear();
  m_levels.clear();

  std::map<TXshSimpleLevel *, TFrameId> new_workingFrames;

  // correct and register items
  ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
  if (scene) {
    std::vector<TXshLevel *> levels;
    scene->getLevelSet()->listLevels(levels);
    std::vector<TXshLevel *>::iterator it;

    for (it = levels.begin(); it != levels.end(); ++it) {
      // register only TLV and PLI
      TXshSimpleLevel *sl = (*it)->getSimpleLevel();
      if (sl) {
        // register only used level in xsheet
        if (!scene->getTopXsheet()->isLevelUsed(sl)) continue;

        m_levels.push_back(sl);

        // create new m_workingFrames map with the new levelset
        TFrameId fId;
        std::map<TXshSimpleLevel *, TFrameId>::iterator WFit =
            m_workingFrames.find(sl);

        if (WFit != m_workingFrames.end())
          fId = WFit->second;
        else
          fId = sl->getFirstFid();

        new_workingFrames.insert(std::make_pair(sl, fId));

        QString levelName = QString::fromStdWString(sl->getName());
        if (sl->getProperties()->getDirtyFlag()) levelName += " *";

        // append the current working frame number to the item name
        if (fId != sl->getFirstFid() && fId.getNumber() >= 0)
          levelName +=
              QString("  [#") + QString::number(fId.getNumber()) + QString("]");

        m_chooseLevelCombo->addItem(levelName);
      }
    }
  }

  m_chooseLevelCombo->addItem(tr("- No Current Level -"));

  // swap the list
  m_workingFrames.clear();
  m_workingFrames = new_workingFrames;

  // synchronize the current index of combo to the current level
  updateCurrentLevelComboItem();
}
开发者ID:jcome,项目名称:opentoonz,代码行数:59,代码来源:filmstrip.cpp

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

示例10: assert

VectorizerParameters *VectorizerPopup::getParameters() const {
  assert(m_sceneHandle);

  ToonzScene *scene = m_sceneHandle->getScene();
  assert(scene);

  TSceneProperties *sceneProp = scene->getProperties();
  assert(sceneProp);

  assert(sceneProp->getVectorizerParameters());
  return sceneProp->getVectorizerParameters();
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:12,代码来源:vectorizerpopup.cpp

示例11: topLevelItem

void CastTreeViewer::onSceneNameChanged() {
  QTreeWidgetItem *root = topLevelItem(0);
  if (!root) return;
  ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
  QString rootName  = QString("Root");
  if (scene) {
    std::wstring name =
        (scene->isUntitled()) ? L"Untitled" : scene->getSceneName();
    rootName = rootName.fromStdWString(name);
  }
  root->setText(0, rootName);
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:12,代码来源:castviewer.cpp

示例12: removeLevel

	bool removeLevel(TXshLevel *level)
	{
		TApp *app = TApp::instance();
		ToonzScene *scene = app->getCurrentScene()->getScene();
		if (scene->getChildStack()->getTopXsheet()->isLevelUsed(level))
			DVGui::error(QObject::tr("It is not possible to delete the used level %1.").arg(QString::fromStdWString(level->getName()))); //"E_CantDeleteUsedLevel_%1"
		else {
			TUndoManager *um = TUndoManager::manager();
			um->add(new DeleteLevelUndo(level));
			scene->getLevelSet()->removeLevel(level);
		}
		return true;
	}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:13,代码来源:levelcommand.cpp

示例13: getLevel

QScriptValue getLevel(QScriptContext *ctx, QScriptEngine *eng)
{
	QString levelName = ctx->argument(0).toString();

	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TXshLevel *level = scene->getLevelSet()->getLevel(levelName.toStdWString());
	if (!level) {
		level = scene->createNewLevel(PLI_XSHLEVEL, levelName.toStdWString());
		levelName = QString::fromStdWString(level->getName());
	}
	if (level->getSimpleLevel())
		return eng->newQObject(new ScriptWrapper::Level(level->getSimpleLevel()), QScriptEngine::ScriptOwnership);
	else
		return QScriptValue();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:15,代码来源:scriptengine.cpp

示例14: getResources

void SceneResources::getResources() {
  ToonzScene *scene = m_scene;
  std::vector<TXshLevel *> levels;
  scene->getLevelSet()->listLevels(levels);
  std::vector<TXshLevel *>::iterator it;

  for (it = levels.begin(); it != levels.end(); ++it) {
    TXshSimpleLevel *sl = (*it)->getSimpleLevel();
    if (sl) m_resources.push_back(new SceneLevel(scene, sl));
    TXshPaletteLevel *pl = (*it)->getPaletteLevel();
    if (pl) m_resources.push_back(new ScenePalette(scene, pl));
    TXshSoundLevel *sdl = (*it)->getSoundLevel();
    if (sdl) m_resources.push_back(new SceneSound(scene, sdl));
  }
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:15,代码来源:sceneresources.cpp

示例15: addSoundtrack

 void addSoundtrack(const ToonzScene &scene, int frameOffset,
                    int sceneFrameCount) {
   assert(m_status <= 2);
   m_status                       = 2;
   TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
   prop->m_frameRate              = m_fps;
   TSoundTrack *snd               = scene.getXsheet()->makeSound(prop);
   if (!snd || m_filepath.getDots() == "..") {
     m_whiteSample += sceneFrameCount * 918;
     return;
   }
   long samplePerFrame = snd->getSampleRate() / m_fps;
   TSoundTrackP snd1   = snd->extract(
       frameOffset * samplePerFrame,
       (TINT32)((frameOffset + sceneFrameCount - 1) * samplePerFrame));
   if (!m_st) {
     m_st          = TSoundTrack::create(snd1->getFormat(), m_whiteSample);
     m_whiteSample = 0;
   }
   TINT32 fromSample = m_st->getSampleCount();
   TINT32 numSample  = std::max(TINT32(sceneFrameCount * samplePerFrame),
                               snd1->getSampleCount());
   m_st = TSop::insertBlank(m_st, fromSample, numSample + m_whiteSample);
   m_st->copy(snd1, TINT32(fromSample + m_whiteSample));
   m_whiteSample = 0;
 }
开发者ID:walkerka,项目名称:opentoonz,代码行数:26,代码来源:moviegenerator.cpp


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