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


C++ TStageObject::setKeyframeWithoutUndo方法代码示例

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


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

示例1: setKeyframes

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

示例2: redo

	void redo() const
	{
		TXsheet *xsh = getXsheet();
		for (int i = 0; i < (int)m_keyframes.size(); i++) {
			TStageObject *stageObject = getXsheet()->getStageObject(m_keyframes[i].first);
			if (stageObject)
				stageObject->setKeyframeWithoutUndo(m_frame);
		}
		m_tool->setTemporaryPinnedColumns(m_newTemp);

		if (m_oldColumnIndex >= 0)
			getRangeSet(m_oldColumnIndex)->removeRange(m_oldRange.first, m_oldRange.second);
		if (m_columnIndex >= 0) {
			TPinnedRangeSet *rangeSet = getRangeSet(m_columnIndex);
			rangeSet->setRange(m_newRange.first, m_newRange.second);
			rangeSet->setPlacement(m_newPlacement);
		}
		notify();
	}
开发者ID:titer1,项目名称:opentoonz,代码行数:19,代码来源:skeletontool.cpp

示例3: toggle

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

示例4: getKeyframes

// data -> xsh
bool TKeyframeData::getKeyframes(std::set<Position> &positions, TXsheet *xsh) const
{
	std::set<TKeyframeSelection::Position>::iterator it2 = positions.begin();
	int r0 = it2->first;
	int c0 = it2->second;
	for (++it2; it2 != positions.end(); ++it2) {
		r0 = std::min(r0, it2->first);
		c0 = std::min(c0, it2->second);
	}
	positions.clear();
	TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
	Iterator it;
	bool keyFrameChanged = false;
	for (it = m_keyData.begin(); it != m_keyData.end(); ++it) {
		Position pos = it->first;
		int row = r0 + pos.first;
		int col = c0 + pos.second;
		positions.insert(std::make_pair(row, col));
		TXshColumn *column = xsh->getColumn(col);
		if (column && column->getSoundColumn())
			continue;
		TStageObject *pegbar = xsh->getStageObject(col >= 0 ? TStageObjectId::ColumnId(col) : cameraId);
		if (pegbar->getId().isColumn() && xsh->getColumn(col) && xsh->getColumn(col)->isLocked())
			continue;
		keyFrameChanged = true;
		assert(pegbar);
		pegbar->setKeyframeWithoutUndo(row, it->second);
	}
	if (!keyFrameChanged)
		return false;

	for (auto const pegbar : m_isPegbarsCycleEnabled) {
		int const col = pegbar.first;
		TStageObjectId objectId = (col >= 0) ? TStageObjectId::ColumnId(col) : cameraId;
		xsh->getStageObject(objectId)->enableCycle(pegbar.second);
	}
	return true;
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:39,代码来源:keyframedata.cpp

示例5: togglePinnedStatus

void SkeletonTool::togglePinnedStatus(int columnIndex, int frame, bool shiftPressed)
{
	Skeleton skeleton;
	buildSkeleton(skeleton, columnIndex);
	if (!skeleton.getRootBone() || !skeleton.getRootBone()->getStageObject())
		return;
	Skeleton::Bone *bone = skeleton.getBoneByColumnIndex(columnIndex);
	assert(bone);
	if (!bone)
		return;

	TogglePinnedStatusUndo *undo = new TogglePinnedStatusUndo(this, frame);
	for (int i = 0; i < skeleton.getBoneCount(); i++) {
		TStageObject *obj = skeleton.getBone(i)->getStageObject();
		if (obj) {
			undo->addBoneId(obj->getId());
			obj->setKeyframeWithoutUndo(frame);
		}
	}

	getApplication()->getCurrentXsheet()->notifyXsheetChanged();
	getApplication()->getCurrentObject()->notifyObjectIdChanged(false);

	undo->setOldTemp(m_temporaryPinnedColumns);
	bool isTemporaryPinned = m_temporaryPinnedColumns.count(columnIndex) > 0;
	if (shiftPressed || isTemporaryPinned) {
		if (isTemporaryPinned)
			m_temporaryPinnedColumns.erase(columnIndex);
		else
			m_temporaryPinnedColumns.insert(columnIndex);
	} else {
		TXsheet *xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet();
		TAffine placement = xsh->getPlacement(bone->getStageObject()->getId(), frame);

		TStageObjectId rootId = skeleton.getRootBone()->getStageObject()->getId();
		TAffine rootPlacement = xsh->getPlacement(rootId, frame);

		int pinnedStatus = bone->getPinnedStatus();
		if (pinnedStatus != Skeleton::Bone::PINNED) {
			int oldPinned = -1;
			for (int i = 0; i < skeleton.getBoneCount(); i++) {
				TStageObject *obj = skeleton.getBone(i)->getStageObject();
				if (obj->getPinnedRangeSet()->isPinned(frame)) {
					oldPinned = i;
					break;
				}
			}

			int lastFrame = 1000000;
			if (oldPinned >= 0) {
				assert(skeleton.getBone(oldPinned) != bone);
				TStageObject *obj = skeleton.getBone(oldPinned)->getStageObject();
				const TPinnedRangeSet::Range *range = obj->getPinnedRangeSet()->getRange(frame);
				assert(range && range->first <= frame && frame <= range->second);
				lastFrame = range->second;
				TPinnedRangeSet *rangeSet = obj->getPinnedRangeSet();
				rangeSet->removeRange(frame, range->second);
				obj->invalidate();
				undo->setOldRange(oldPinned, frame, range->second, rangeSet->getPlacement());
			} else {
				for (int i = 0; i < skeleton.getBoneCount(); i++) {
					TStageObject *obj = skeleton.getBone(i)->getStageObject();
					const TPinnedRangeSet::Range *range = obj->getPinnedRangeSet()->getNextRange(frame);
					if (range) {
						assert(range->first > frame);
						if (range->first - 1 < lastFrame)
							lastFrame = range->first - 1;
					}
				}
			}

			TStageObject *obj = bone->getStageObject();
			TPinnedRangeSet *rangeSet = obj->getPinnedRangeSet();
			rangeSet->setRange(frame, lastFrame);
			if (frame == 0) {
				// this code should be moved elsewhere, possibly in the stageobject implementation
				// the idea is to remove the normal
				TStageObject *rootObj = skeleton.getRootBone()->getStageObject();
				rootObj->setStatus(TStageObject::XY);
				placement = rootObj->getPlacement(0).inv() * placement;
				rootObj->setStatus(TStageObject::IK);
				rangeSet->setPlacement(placement);
				rootObj->invalidate();
			}
			undo->setNewRange(bone->getColumnIndex(), frame, lastFrame, rangeSet->getPlacement());
		}
	}
	undo->setNewTemp(m_temporaryPinnedColumns);
	TUndoManager::manager()->add(undo);
}
开发者ID:titer1,项目名称:opentoonz,代码行数:90,代码来源:skeletontool.cpp


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