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


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

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


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

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

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


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