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


C++ TXsheet::getFrameCount方法代码示例

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


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

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

示例2: resequence

void ColumnCmd::resequence(int index) {
  if (!canResequence(index)) return;
  TXsheet *xsh       = TApp::instance()->getCurrentXsheet()->getXsheet();
  TXshColumn *column = xsh->getColumn(index);
  assert(column);
  TXshLevelColumn *lcolumn = column->getLevelColumn();
  assert(lcolumn);
  int r0 = 0, r1 = -1;
  lcolumn->getRange(r0, r1);
  assert(r0 <= r1);
  TXshCell cell = lcolumn->getCell(r0);
  assert(!cell.isEmpty());
  TXshChildLevel *xl = cell.m_level->getChildLevel();
  assert(xl);
  TXsheet *childXsh              = xl->getXsheet();
  int frameCount                 = childXsh->getFrameCount();
  if (frameCount < 1) frameCount = 1;

  TUndoManager::manager()->add(new ResequenceUndo(index, frameCount));

  lcolumn->clearCells(r0, r1 - r0 + 1);
  for (int i = 0; i < frameCount; i++) {
    cell.m_frameId = TFrameId(i + 1);
    lcolumn->setCell(r0 + i, cell);
  }

  xsh->updateFrameCount();

  TApp::instance()->getCurrentScene()->setDirtyFlag(true);
  TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
开发者ID:opentoonz,项目名称:opentoonz,代码行数:31,代码来源:columncommand.cpp

示例3: mousePressEvent

void RowArea::mousePressEvent(QMouseEvent *event)
{
	m_viewer->setQtModifiers(event->modifiers());
	if (event->button() == Qt::LeftButton) {
		bool playRangeModifierisClicked = false;

		TApp *app = TApp::instance();
		TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet();
		TPoint pos(event->pos().x(), event->pos().y());

		int row = m_viewer->yToRow(pos.y);

		QRect visibleRect = visibleRegion().boundingRect();
		int playR0, playR1, step;
		XsheetGUI::getPlayRange(playR0, playR1, step);

		bool playRangeEnabled = playR0 <= playR1;
		if (!playRangeEnabled) {
			TXsheet *xsh = m_viewer->getXsheet();
			playR1 = xsh->getFrameCount() - 1;
			playR0 = 0;
		}

		if (playR1 == -1) { //getFrameCount = 0 i.e. xsheet is empty
			setDragTool(XsheetGUI::DragTool::makeCurrentFrameModifierTool(m_viewer));
		} else if (m_xa <= pos.x && pos.x <= m_xa + 10 && (row == playR0 || row == playR1)) {
			if (!playRangeEnabled)
				XsheetGUI::setPlayRange(playR0, playR1, step);
			setDragTool(XsheetGUI::DragTool::makePlayRangeModifierTool(m_viewer));
			playRangeModifierisClicked = true;
		} else
			setDragTool(XsheetGUI::DragTool::makeCurrentFrameModifierTool(m_viewer));

		//when shift+click the row area, select a single row region in the cell area
		if (!playRangeModifierisClicked && 0 != (event->modifiers() & Qt::ShiftModifier)) {
			int filledCol;
			for (filledCol = xsh->getColumnCount() - 1; filledCol >= 0; filledCol--) {
				TXshColumn *currentColumn = xsh->getColumn(filledCol);
				if (!currentColumn)
					continue;
				if (!currentColumn->isEmpty())
					break;
			}

			m_viewer->getCellSelection()->selectNone();
			m_viewer->getCellSelection()->selectCells(row, 0, row, tmax(0, filledCol));
			m_viewer->updateCellRowAree();
		}

		m_viewer->dragToolClick(event);
		event->accept();
	} // left-click
	// pan by middle-drag
	else if (event->button() == Qt::MidButton) {
		m_pos = event->pos();
		m_isPanning = true;
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:58,代码来源:xshrowviewer.cpp

示例4: updateValues

void TimeStretchPopup::updateValues(TSelection *selection) {
  int from = 0, to = 0, newRange = 0;
  if (m_currentStretchType == eWholeXsheet) {
    TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
    newRange        = xsheet->getFrameCount();
  } else {
    TCellSelection *cellCelection = dynamic_cast<TCellSelection *>(selection);
    if (cellCelection) {
      int c0, c1;
      cellCelection->getSelectedCells(from, c0, to, c1);
      newRange = to - from + 1;
    }
  }

  m_newRangeFld->setText(QString::number(newRange));
  m_oldRange->setText(QString::number(newRange));
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:17,代码来源:timestretchpopup.cpp

示例5: drawPlayRange

void RowArea::drawPlayRange(QPainter &p, int r0, int r1)
{
	bool playRangeEnabled = XsheetGUI::isPlayRangeEnabled();

	// Update the play range internal fields
	if (playRangeEnabled) {
		int step;
		XsheetGUI::getPlayRange(m_r0, m_r1, step);
	}
	// if the preview range is not set, then put markers at the first and the last frames of the scene
	else {
		TXsheet *xsh = m_viewer->getXsheet();
		m_r1 = xsh->getFrameCount() - 1;
		if (m_r1 == -1)
			return;
		m_r0 = 0;
	}

	QColor ArrowColor = (playRangeEnabled) ? QColor(255, 255, 255) : grey150;
	p.setBrush(QBrush(ArrowColor));

	if (m_r0 > r0 - 1 && r1 + 1 > m_r0) {
		int y0 = m_viewer->rowToY(m_r0);
		drawArrow(p, QPointF(m_xa, y0 + 1),
				  QPointF(m_xa + 10, y0 + 1),
				  QPointF(m_xa, y0 + 11),
				  true, ArrowColor);
	}

	if (m_r1 > r0 - 1 && r1 + 1 > m_r1) {
		int y1 = m_viewer->rowToY(m_r1 + 1) - 12;
		drawArrow(p, QPointF(m_xa, y1 + 1),
				  QPointF(m_xa + 10, y1 + 11),
				  QPointF(m_xa, y1 + 11),
				  true, ArrowColor);
	}
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:37,代码来源:xshrowviewer.cpp

示例6: drawRows

void RowArea::drawRows(QPainter &p, int r0, int r1)
{
	int playR0, playR1, step;
	XsheetGUI::getPlayRange(playR0, playR1, step);

	if (!XsheetGUI::isPlayRangeEnabled()) {
		TXsheet *xsh = m_viewer->getXsheet();
		playR1 = xsh->getFrameCount() - 1;
		playR0 = 0;
	}

#ifdef _WIN32
	static QFont font("Arial", XSHEET_FONT_SIZE, QFont::Bold);
#else
	static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
#endif
	p.setFont(font);

	// marker interval
	int distance, offset;
	TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers(distance, offset);

	//default value
	if (distance == 0)
		distance = 6;

	QRect visibleRect = visibleRegion().boundingRect();

	int x0 = visibleRect.left();
	int x1 = visibleRect.right();
	int y0 = visibleRect.top();
	int y1 = visibleRect.bottom();

	for (int r = r0; r <= r1; r++) {
		int y = m_viewer->rowToY(r);

		//--- draw horizontal line
		QColor color = ((r - offset) % distance != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor();
		p.setPen(color);
		p.drawLine(x0, y, x1, y);

		// draw frame text
		if (playR0 <= r && r <= playR1) {
			p.setPen(((r - m_r0) % step == 0) ? m_viewer->getPreviewFrameTextColor() : m_viewer->getTextColor());
		}
		//not in preview range
		else
			p.setPen(m_viewer->getTextColor());

		switch (m_viewer->getFrameDisplayStyle()) {
		case XsheetViewer::SecAndFrame: {
			int frameRate = TApp::instance()->getCurrentScene()->getScene()->getProperties()->getOutputProperties()->getFrameRate();
			QString str;
			int koma = (r + 1) % frameRate;
			if (koma == 1) {
				int sec = (r + 1) / frameRate;
				str = QString("%1' %2\"").arg(QString::number(sec).rightJustified(2, '0')).arg(QString::number(koma).rightJustified(2, '0'));
			} else {
				if (koma == 0)
					koma = frameRate;
				str = QString("%1\"").arg(QString::number(koma).rightJustified(2, '0'));
			}

			p.drawText(QRect(width() / 2 - 15, y + 1, width() / 2 + 7, RowHeight - 2), Qt::AlignRight | Qt::AlignBottom, str);

			break;
		}

		case XsheetViewer::Frame: {
			QString number = QString::number(r + 1);
			p.drawText(QRect(width() / 2 - 2, y + 1, width() / 2, RowHeight - 2), Qt::AlignHCenter | Qt::AlignBottom, number);
			break;
		}

		//6 second sheet (144frames per page)
		case XsheetViewer::SixSecSheet: {
			int frameRate = TApp::instance()->getCurrentScene()->getScene()->getProperties()->getOutputProperties()->getFrameRate();
			QString str;
			int koma = (r + 1) % (frameRate * 6);
			if ((r + 1) % frameRate == 1) {
				int page = (r + 1) / (frameRate * 6) + 1;
				str = QString("p%1  %2").arg(QString::number(page)).arg(QString::number(koma).rightJustified(3, '0'));
			} else {
				if (koma == 0)
					koma = frameRate * 6;
				str = QString("%1").arg(QString::number(koma).rightJustified(3, '0'));
			}
			p.drawText(QRect(width() / 2 - 21, y + 1, width() / 2 + 7, RowHeight - 2), Qt::AlignRight | Qt::AlignBottom, str);
			break;
		}
		//3 second sheet (72frames per page)
		case XsheetViewer::ThreeSecSheet: {
			int frameRate = TApp::instance()->getCurrentScene()->getScene()->getProperties()->getOutputProperties()->getFrameRate();
			QString str;
			int koma = (r + 1) % (frameRate * 3);
			if ((r + 1) % frameRate == 1) {
				int page = (r + 1) / (frameRate * 3) + 1;
				str = QString("p%1  %2").arg(QString::number(page)).arg(QString::number(koma).rightJustified(2, '0'));
			} else {
				if (koma == 0)
//.........这里部分代码省略.........
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:101,代码来源:xshrowviewer.cpp

示例7: updateLevelSettings

/*! Update popup value.
                Take current level and act on level type set popup value.
*/
void LevelSettingsPopup::updateLevelSettings() {
  TApp *app = TApp::instance();
  TXshLevelP selectedLevel;
  CastSelection *castSelection =
      dynamic_cast<CastSelection *>(app->getCurrentSelection()->getSelection());
  TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
      app->getCurrentSelection()->getSelection());
  TColumnSelection *columnSelection = dynamic_cast<TColumnSelection *>(
      app->getCurrentSelection()->getSelection());
  FxSelection *fxSelection =
      dynamic_cast<FxSelection *>(app->getCurrentSelection()->getSelection());

  /*--セル選択の場合--*/
  if (cellSelection) {
    TXsheet *currentXsheet = app->getCurrentXsheet()->getXsheet();
    if (currentXsheet && !cellSelection->isEmpty()) {
      selectedLevel = 0;
      int r0, c0, r1, c1;
      cellSelection->getSelectedCells(r0, c0, r1, c1);
      for (int c = c0; c <= c1; c++) {
        for (int r = r0; r <= r1; r++) {
          if (currentXsheet->getCell(r, c).m_level) {
            selectedLevel = currentXsheet->getCell(r, c).m_level;
            break;
          }
        }
        if (selectedLevel) break;
      }
    } else
      selectedLevel = app->getCurrentLevel()->getLevel();
  }
  /*--カラム選択の場合--*/
  else if (columnSelection) {
    TXsheet *currentXsheet = app->getCurrentXsheet()->getXsheet();
    if (currentXsheet && !columnSelection->isEmpty()) {
      selectedLevel   = 0;
      int sceneLength = currentXsheet->getFrameCount();

      std::set<int> columnIndices = columnSelection->getIndices();
      std::set<int>::iterator it;
      /*-- 選択Columnを探索、最初に見つかったLevelの内容を表示 --*/
      for (it = columnIndices.begin(); it != columnIndices.end(); ++it) {
        int columnIndex = *it;
        for (int r = 0; r < sceneLength; r++) {
          if (currentXsheet->getCell(r, columnIndex).m_level) {
            selectedLevel = currentXsheet->getCell(r, columnIndex).m_level;
            break;
          }
        }
        if (selectedLevel) break;
      }
    } else
      selectedLevel = app->getCurrentLevel()->getLevel();
  } else if (castSelection) {
    std::vector<TXshLevel *> levels;
    castSelection->getSelectedLevels(levels);

    int selectedLevelSize                    = levels.size();
    if (selectedLevelSize > 0) selectedLevel = levels[selectedLevelSize - 1];
  }
  /*-- Fx選択(Schematicノード選択)の場合 --*/
  else if (fxSelection) {
    selectedLevel           = 0;
    TXsheet *currentXsheet  = app->getCurrentXsheet()->getXsheet();
    QList<TFxP> selectedFxs = fxSelection->getFxs();
    if (currentXsheet && !selectedFxs.isEmpty()) {
      for (int f = 0; f < selectedFxs.size(); f++) {
        TLevelColumnFx *lcfx =
            dynamic_cast<TLevelColumnFx *>(selectedFxs.at(f).getPointer());
        if (lcfx) {
          int firstRow = lcfx->getXshColumn()->getCellColumn()->getFirstRow();
          TXshLevelP levelP =
              lcfx->getXshColumn()->getCellColumn()->getCell(firstRow).m_level;
          if (levelP) {
            selectedLevel = levelP;
            break;
          }
        }
      }
      if (!selectedLevel) selectedLevel = app->getCurrentLevel()->getLevel();
    } else
      selectedLevel = app->getCurrentLevel()->getLevel();
    // std::cout<<"fxSelection is current!"<<std::endl;
  } else
    selectedLevel = app->getCurrentLevel()->getLevel();

  m_sl  = dynamic_cast<TXshSimpleLevel *>(selectedLevel.getPointer());
  m_pl  = dynamic_cast<TXshPaletteLevel *>(selectedLevel.getPointer());
  m_cl  = dynamic_cast<TXshChildLevel *>(selectedLevel.getPointer());
  m_sdl = dynamic_cast<TXshSoundLevel *>(selectedLevel.getPointer());

  bool isSimpleLevel = m_sl;
  bool isChildLevel  = m_cl;
  bool isRasterLevel = m_sl && (m_sl->getType() & RASTER_TYPE);
  bool isTzpLevel    = m_sl && (m_sl->getType() == TZP_XSHLEVEL);
  bool isMeshLevel   = m_sl && (m_sl->getType() == MESH_XSHLEVEL);

//.........这里部分代码省略.........
开发者ID:opentoonz,项目名称:opentoonz,代码行数:101,代码来源:levelsettingspopup.cpp


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