Esempio n. 1
0
//!Build the scene fx for each node below the xsheet one.
//!Remember that left xsheet ports must not be expanded.
void MultimediaRenderer::Imp::scanSceneForLayers()
{
	//Retrieve the terminal fxs (ie, fxs which are implicitly
	//connected to the xsheet one)
	TXsheet *xsh = m_scene->getXsheet();
	TFxSet *fxs = xsh->getFxDag()->getTerminalFxs();

	//Examine all of them and - eventually - expand left xsheet
	//ports (ie fx nodes who allow implicit overlaying)
	for (int i = 0; i < fxs->getFxCount(); ++i) {
		TFx *fx = fxs->getFx(i);
		TFxPort *leftXSheetPort;

	retry:

		if (!fx)
			continue;
		leftXSheetPort = fx->getXsheetPort();

		if (!leftXSheetPort) {
			m_fxsToRender.addFx(fx);
			continue;
		}

		//If the leftXSheetPort is not connected, retry on port 0
		if (leftXSheetPort->isConnected())
			m_fxsToRender.addFx(fx);
		else {
			fx = fx->getInputPort(0)->getFx();
			goto retry;
		}
	}
}
Esempio n. 2
0
//!Retrieve the first level of scene columns, climb their paths
//!along unary fxs, and then build the scene fxs.
void MultimediaRenderer::Imp::scanSceneForColumns()
{
	//Retrieve the terminal fxs (ie, fxs which are implicitly
	//connected to the xsheet one)
	TXsheet *xsh = m_scene->getXsheet();
	TFxSet *fxs = xsh->getFxDag()->getTerminalFxs();

	//Launch the recursive column climber procedure for each
	for (int i = 0; i < fxs->getFxCount(); ++i) {
		TFx *fx = fxs->getFx(i);
		if (!fx)
			continue;
		bool isItARenderFx = scanColsRecursive(fx);
		if (isItARenderFx)
			m_fxsToRender.addFx(fx);
	}
}
Esempio n. 3
0
bool FxSelection::isConnected() {
  if (m_selectedFxs.isEmpty()) return false;
  QList<TFx *> visitedFxs;
  visitFx(m_selectedFxs.at(0).getPointer(), visitedFxs);
  bool connected = true;
  QList<TFxP>::const_iterator it;
  TXsheet *xsh        = m_xshHandle->getXsheet();
  TFxSet *internalFxs = xsh->getFxDag()->getInternalFxs();
  for (it = m_selectedFxs.begin(); it != m_selectedFxs.end(); it++) {
    TFx *selectedFx = it->getPointer();
    TColumnFx *cfx  = dynamic_cast<TColumnFx *>(selectedFx);
    if (!cfx && !internalFxs->containsFx(selectedFx)) return false;
    TZeraryColumnFx *zfx = dynamic_cast<TZeraryColumnFx *>(selectedFx);
    if (zfx) selectedFx  = zfx->getZeraryFx();
    connected            = connected && visitedFxs.contains(selectedFx);
  }
  return connected;
}
Esempio n. 4
0
void ColumnCmd::cloneChild(int index) {
  if (!canResequence(index)) return;

  /*-- カラムを取得 --*/
  TXsheet *xsh       = TApp::instance()->getCurrentXsheet()->getXsheet();
  TXshColumn *column = xsh->getColumn(index);
  assert(column);

  // get the subxsheet to clone (childLevel, childXsh)
  /*-- SubXsheetレベルを取得 --*/
  TXshLevelColumn *lcolumn = column->getLevelColumn();
  assert(lcolumn);
  int r0 = 0, r1 = -1;
  lcolumn->getRange(r0, r1);
  assert(r0 <= r1);
  /*-- SubXsheetの一番頭のセル --*/
  TXshCell cell = lcolumn->getCell(r0);
  assert(!cell.isEmpty());
  /*- cell内に格納されているLevelを取得 -*/
  TXshChildLevel *childLevel = cell.m_level->getChildLevel();
  assert(childLevel);
  /*- SubXsheetのXsheetを取得 -*/
  TXsheet *childXsh = childLevel->getXsheet();

  // insert a new empty column
  /*- 隣に空きColumnをInsertしてCloneに備える -*/
  int newColumnIndex = index + 1;
  xsh->insertColumn(newColumnIndex);

  // create a subxsheet (newChildLevel, newChildXsh)
  ToonzScene *scene      = TApp::instance()->getCurrentScene()->getScene();
  ChildStack *childStack = scene->getChildStack();
  TXshChildLevel *newChildLevel = childStack->createChild(0, newColumnIndex);
  TXsheet *newChildXsh          = newChildLevel->getXsheet();

  // copy columns.
  std::set<int> indices;
  for (int i = 0; i < childXsh->getColumnCount(); i++) indices.insert(i);
  StageObjectsData *data = new StageObjectsData();
  data->storeColumns(indices, childXsh, 0);
  data->storeColumnFxs(indices, childXsh, 0);
  std::list<int> restoredSplineIds;
  data->restoreObjects(indices, restoredSplineIds, newChildXsh,
                       StageObjectsData::eDoClone);
  delete data;

  cloneNotColumnLinkedFxsAndOutputsFx(childXsh, newChildXsh);
  cloneXsheetTStageObjectTree(childXsh, newChildXsh);
  /*--以下は、Clone SubXsheet
  するときに、SubXsheet内にある子SubXsheetをクローンする関数
  クローンされた中にある子SubXsheetは、同じもので良いので、スキップする --*/
  // cloneSubXsheets(newChildXsh);

  /*-- XSheetノードのFxSchematicでのDagNodePosを再現
  FxやColumnノードの位置の再現は上のsetColumnで行っている
--*/
  newChildXsh->getFxDag()->getXsheetFx()->getAttributes()->setDagNodePos(
      childXsh->getFxDag()->getXsheetFx()->getAttributes()->getDagNodePos());

  newChildXsh->updateFrameCount();

  /*-- TXshChildLevel作成時にsetCellした1つ目のセルを消去 --*/
  xsh->removeCells(0, newColumnIndex);
  /*-- CloneしたColumnのセル番号順を再現 --*/
  for (int r = r0; r <= r1; r++) {
    TXshCell cell = lcolumn->getCell(r);
    if (cell.isEmpty()) continue;

    cell.m_level = newChildLevel;
    xsh->setCell(r, newColumnIndex, cell);
  }

  TStageObjectId currentObjectId =
      TApp::instance()->getCurrentObject()->getObjectId();
  xsh->getStageObject(TStageObjectId::ColumnId(newColumnIndex))
      ->setParent(xsh->getStageObjectParent(currentObjectId));

  xsh->updateFrameCount();
  TUndoManager::manager()->add(
      new CloneChildUndo(newChildLevel, newColumnIndex));

  // notify changes
  TApp::instance()->getCurrentScene()->setDirtyFlag(true);
  TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}