Example #1
0
void TKeyframeSelection::setKeyframes() {
  TApp *app                   = TApp::instance();
  TXsheetHandle *xsheetHandle = app->getCurrentXsheet();
  TXsheet *xsh                = xsheetHandle->getXsheet();
  TStageObjectId cameraId     = xsh->getStageObjectTree()->getCurrentCameraId();
  if (isEmpty()) return;
  Position pos         = *m_positions.begin();
  int row              = pos.first;
  int col              = pos.second;
  TStageObjectId id    = col < 0 ? cameraId : TStageObjectId::ColumnId(col);
  TStageObject *pegbar = xsh->getStageObject(id);
  if (!pegbar) return;
  if (pegbar->isKeyframe(row)) {
    TStageObject::Keyframe key = pegbar->getKeyframe(row);
    pegbar->removeKeyframeWithoutUndo(row);
    UndoRemoveKeyFrame *undo =
        new UndoRemoveKeyFrame(id, row, key, xsheetHandle);
    undo->setObjectHandle(app->getCurrentObject());
    TUndoManager::manager()->add(undo);
  } else {
    pegbar->setKeyframeWithoutUndo(row);
    UndoSetKeyFrame *undo = new UndoSetKeyFrame(id, row, xsheetHandle);
    undo->setObjectHandle(app->getCurrentObject());
    TUndoManager::manager()->add(undo);
  }
  TApp::instance()->getCurrentScene()->setDirtyFlag(true);
  TApp::instance()->getCurrentObject()->notifyObjectIdChanged(false);
}
Example #2
0
void ViewerKeyframeNavigator::toggle()
{
	TStageObject *pegbar = getStageObject();
	if (!pegbar)
		return;
	int frame = getCurrentFrame();

	if (pegbar->isFullKeyframe(frame)) {
		TStageObject::Keyframe key = pegbar->getKeyframe(frame);
		pegbar->removeKeyframeWithoutUndo(frame);
		UndoRemoveKeyFrame *undo = new UndoRemoveKeyFrame(pegbar->getId(), frame, key, m_xsheetHandle);
		undo->setObjectHandle(m_objectHandle);
		TUndoManager::manager()->add(undo);
	} else {
		UndoSetKeyFrame *undo = new UndoSetKeyFrame(pegbar->getId(), frame, m_xsheetHandle);
		pegbar->setKeyframeWithoutUndo(frame);
		undo->setObjectHandle(m_objectHandle);
		TUndoManager::manager()->add(undo);
	}
	m_objectHandle->notifyObjectIdChanged(false);
}
Example #3
0
	void undo() const
	{
		m_tool->setTemporaryPinnedColumns(m_oldTemp);

		if (m_columnIndex >= 0)
			getRangeSet(m_columnIndex)->removeRange(m_newRange.first, m_newRange.second);
		if (m_oldColumnIndex >= 0) {
			TPinnedRangeSet *rangeSet = getRangeSet(m_oldColumnIndex);
			rangeSet->setRange(m_oldRange.first, m_oldRange.second);
			rangeSet->setPlacement(m_oldPlacement);
		}
		TXsheet *xsh = getXsheet();
		for (int i = 0; i < (int)m_keyframes.size(); i++) {
			TStageObject *stageObject = getXsheet()->getStageObject(m_keyframes[i].first);
			if (!stageObject)
				continue;
			stageObject->removeKeyframeWithoutUndo(m_frame);
			if (m_keyframes[i].second.m_isKeyframe)
				stageObject->setKeyframeWithoutUndo(m_frame, m_keyframes[i].second);
		}

		notify();
	}